Skip to content

Commit 2f16634

Browse files
authored
Push notification follow ups (#604)
* only return the public installation id for this client * add a test for it * cargo changes * fix up the styling issues
1 parent 67a03a5 commit 2f16634

File tree

3 files changed

+37
-6
lines changed

3 files changed

+37
-6
lines changed

.github/CODEOWNERS

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# Global rule:
2-
* @xmtp/messaging
2+
* @xmtp/Engineering
33
*.md @fabriguespe

bindings_ffi/src/mls.rs

+2-5
Original file line numberDiff line numberDiff line change
@@ -138,11 +138,8 @@ impl FfiXmtpClient {
138138
Ok(results)
139139
}
140140

141-
pub async fn installation_ids(&self) -> Result<Vec<Vec<u8>>, GenericError> {
142-
let address = self.inner_client.account_address();
143-
let installations = self.inner_client.get_all_active_installation_ids(vec![address]).await?;
144-
145-
Ok(installations)
141+
pub fn installation_id(&self) -> Vec<u8> {
142+
self.inner_client.installation_public_key()
146143
}
147144
}
148145

xmtp_mls/src/groups/subscriptions.rs

+34
Original file line numberDiff line numberDiff line change
@@ -93,11 +93,45 @@ where
9393

9494
#[cfg(test)]
9595
mod tests {
96+
use prost::Message;
9697
use xmtp_cryptography::utils::generate_local_wallet;
98+
use xmtp_proto::xmtp::mls::api::v1::GroupMessage;
9799

98100
use crate::{builder::ClientBuilder, storage::group_message::GroupMessageKind};
99101
use futures::StreamExt;
100102

103+
#[tokio::test(flavor = "multi_thread", worker_threads = 1)]
104+
async fn test_decode_group_message_bytes() {
105+
let amal = ClientBuilder::new_test_client(&generate_local_wallet()).await;
106+
let bola = ClientBuilder::new_test_client(&generate_local_wallet()).await;
107+
108+
let amal_group = amal.create_group(None).unwrap();
109+
// Add bola
110+
amal_group
111+
.add_members_by_installation_id(vec![bola.installation_public_key()])
112+
.await
113+
.unwrap();
114+
115+
amal_group.send_message("hello".as_bytes()).await.unwrap();
116+
let messages = amal
117+
.api_client
118+
.query_group_messages(amal_group.clone().group_id, None)
119+
.await
120+
.expect("read topic");
121+
let message = messages.first().unwrap();
122+
let mut message_bytes: Vec<u8> = Vec::new();
123+
message.encode(&mut message_bytes).unwrap();
124+
let message_again = amal_group
125+
.process_streamed_group_message(message_bytes)
126+
.await;
127+
128+
if let Ok(message) = message_again {
129+
assert_eq!(message.group_id, amal_group.clone().group_id)
130+
} else {
131+
assert!(false)
132+
}
133+
}
134+
101135
#[tokio::test(flavor = "multi_thread", worker_threads = 10)]
102136
async fn test_subscribe_messages() {
103137
let amal = ClientBuilder::new_test_client(&generate_local_wallet()).await;

0 commit comments

Comments
 (0)