Skip to content

Commit

Permalink
fix missing mappings
Browse files Browse the repository at this point in the history
  • Loading branch information
mchenani committed Jan 27, 2025
1 parent fbdd11f commit aeccd04
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
11 changes: 10 additions & 1 deletion bindings_wasm/src/conversation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,20 @@ pub struct GroupMetadata {

#[wasm_bindgen]
#[derive(Clone)]
pub struct ConversationMessageDisappearingSettings {
pub struct MessageDisappearingSettings {
#[allow(dead_code)]
inner: XmtpMessageDisappearingSettings,
}

impl From<MessageDisappearingSettings> for XmtpMessageDisappearingSettings {
fn from(value: MessageDisappearingSettings) -> Self {
Self {
from_ns: value.inner.from_ns,
in_ns: value.inner.in_ns,
}
}
}

#[wasm_bindgen]
impl GroupMetadata {
#[wasm_bindgen(js_name = creatorInboxId)]
Expand Down
10 changes: 6 additions & 4 deletions bindings_wasm/src/conversations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use xmtp_mls::storage::group::ConversationType as XmtpConversationType;
use xmtp_mls::storage::group::GroupMembershipState as XmtpGroupMembershipState;
use xmtp_mls::storage::group::GroupQueryArgs;

use crate::conversation::ConversationMessageDisappearingSettings;
use crate::conversation::MessageDisappearingSettings;
use crate::messages::Message;
use crate::permissions::{GroupPermissionsOptions, PermissionPolicySet};
use crate::{client::RustXmtpClient, conversation::Conversation};
Expand Down Expand Up @@ -132,7 +132,7 @@ pub struct CreateGroupOptions {
#[wasm_bindgen(js_name = customPermissionPolicySet)]
pub custom_permission_policy_set: Option<PermissionPolicySet>,
#[wasm_bindgen(js_name = messageDisappearingSettings)]
pub message_disappearing_settings: Option<ConversationMessageDisappearingSettings>,
pub message_disappearing_settings: Option<MessageDisappearingSettings>,
}

#[wasm_bindgen]
Expand All @@ -146,7 +146,7 @@ impl CreateGroupOptions {
group_description: Option<String>,
group_pinned_frame_url: Option<String>,
custom_permission_policy_set: Option<PermissionPolicySet>,
message_disappearing_settings: Option<ConversationMessageDisappearingSettings>,
message_disappearing_settings: Option<MessageDisappearingSettings>,
) -> Self {
Self {
permissions,
Expand All @@ -167,7 +167,9 @@ impl CreateGroupOptions {
image_url_square: self.group_image_url_square,
description: self.group_description,
pinned_frame_url: self.group_pinned_frame_url,
message_disappearing_settings: None, // todo: fix mapping,
message_disappearing_settings: self
.message_disappearing_settings
.map(|settings| settings.into()),
}
}
}
Expand Down

0 comments on commit aeccd04

Please sign in to comment.