Skip to content

Commit

Permalink
put process_streamed_group_message back
Browse files Browse the repository at this point in the history
  • Loading branch information
insipx committed Aug 21, 2024
1 parent cde8e04 commit 803dd7a
Showing 1 changed file with 15 additions and 14 deletions.
29 changes: 15 additions & 14 deletions xmtp_mls/src/groups/subscriptions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,21 @@ impl MlsGroup {
.await?)
}

pub async fn process_streamed_group_message<ApiClient>(
&self,
envelope_bytes: Vec<u8>,
client: Arc<Client<ApiClient>>,
) -> Result<StoredGroupMessage, GroupError>
where
ApiClient: XmtpApi,
{
let envelope = GroupMessage::decode(envelope_bytes.as_slice())
.map_err(|e| GroupError::Generic(e.to_string()))?;

let message = self.process_stream_entry(envelope, client).await?;
message.ok_or(GroupError::MissingMessage)
}

pub fn stream_with_callback<ApiClient>(
client: Arc<Client<ApiClient>>,
group_id: Vec<u8>,
Expand All @@ -121,20 +136,6 @@ impl MlsGroup {
callback,
)
}
pub async fn process_streamed_group_message<ApiClient>(
&self,
envelope_bytes: Vec<u8>,
client: Arc<Client<ApiClient>>,
) -> Result<StoredGroupMessage, GroupError>
where
ApiClient: XmtpApi,
{
let envelope = GroupMessage::decode(envelope_bytes.as_slice())
.map_err(|e| GroupError::Generic(e.to_string()))?;

let message = self.process_stream_entry(envelope, client).await?;
message.ok_or(GroupError::MissingMessage)
}
}

#[cfg(test)]
Expand Down

0 comments on commit 803dd7a

Please sign in to comment.