Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3301053
D11832.id39687.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D11832.id39687.diff
View Options
diff --git a/native/native_rust_library/src/identity/device_list.rs b/native/native_rust_library/src/identity/device_list.rs
--- a/native/native_rust_library/src/identity/device_list.rs
+++ b/native/native_rust_library/src/identity/device_list.rs
@@ -1,6 +1,6 @@
use grpc_clients::identity::get_auth_client;
use grpc_clients::identity::protos::auth::{
- GetDeviceListRequest, UpdateDeviceListRequest,
+ GetDeviceListRequest, PeersDeviceListsRequest, UpdateDeviceListRequest,
};
use crate::identity::AuthInfo;
@@ -34,6 +34,24 @@
});
}
+ pub fn get_device_lists_for_users(
+ auth_user_id: String,
+ auth_device_id: String,
+ auth_access_token: String,
+ user_ids: Vec<String>,
+ promise_id: u32,
+ ) {
+ RUNTIME.spawn(async move {
+ let auth_info = AuthInfo {
+ access_token: auth_access_token,
+ user_id: auth_user_id,
+ device_id: auth_device_id,
+ };
+ let result = get_device_lists_for_users_helper(auth_info, user_ids).await;
+ handle_string_result_as_callback(result, promise_id);
+ });
+ }
+
pub fn update_device_list(
auth_user_id: String,
auth_device_id: String,
@@ -80,6 +98,29 @@
Ok(payload)
}
+async fn get_device_lists_for_users_helper(
+ auth_info: AuthInfo,
+ user_ids: Vec<String>,
+) -> Result<String, Error> {
+ let mut identity_client = get_auth_client(
+ IDENTITY_SOCKET_ADDR,
+ auth_info.user_id,
+ auth_info.device_id,
+ auth_info.access_token,
+ CODE_VERSION,
+ DEVICE_TYPE.as_str_name().to_lowercase(),
+ )
+ .await?;
+
+ let response = identity_client
+ .get_device_lists_for_users(PeersDeviceListsRequest { user_ids })
+ .await?
+ .into_inner();
+
+ let payload = serde_json::to_string(&response.users_device_lists)?;
+ Ok(payload)
+}
+
async fn update_device_list_helper(
auth_info: AuthInfo,
update_payload: String,
diff --git a/native/native_rust_library/src/lib.rs b/native/native_rust_library/src/lib.rs
--- a/native/native_rust_library/src/lib.rs
+++ b/native/native_rust_library/src/lib.rs
@@ -203,6 +203,15 @@
promise_id: u32,
);
+ #[cxx_name = "identityGetDeviceListsForUsers"]
+ fn get_device_lists_for_users(
+ auth_user_id: String,
+ auth_device_id: String,
+ auth_access_token: String,
+ user_ids: Vec<String>,
+ promise_id: u32,
+ );
+
#[cxx_name = "identityUpdateDeviceList"]
fn update_device_list(
auth_user_id: String,
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Nov 18, 11:36 PM (19 h, 20 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2536146
Default Alt Text
D11832.id39687.diff (2 KB)
Attached To
Mode
D11832: [native] implement `GetDeviceListsForUsers` RPC in `native_rust_library`
Attached
Detach File
Event Timeline
Log In to Comment