refactor: Use the new APIs everywhere

This commit is contained in:
Jorge Martín
2026-02-11 13:04:08 +01:00
committed by Ivan Enderlin
parent 3169c65bf2
commit 50b1e3baf2
20 changed files with 123 additions and 117 deletions
@@ -22,7 +22,10 @@ use matrix_sdk::{
sync::SyncResponse,
timeout::ElapsedError,
};
use matrix_sdk_base::crypto::{CollectStrategy, DecryptionSettings, TrustRequirement};
use matrix_sdk_base::{
crypto::{CollectStrategy, DecryptionSettings, TrustRequirement},
store::CrossProcessStoreMode,
};
use once_cell::sync::Lazy;
use rand::Rng as _;
use tempfile::{TempDir, tempdir};
@@ -46,7 +49,7 @@ pub struct TestClientBuilder {
enable_share_history_on_invite: bool,
threading_support: ThreadingSupport,
http_proxy: Option<String>,
cross_process_store_locks_holder_name: Option<String>,
cross_process_mode: CrossProcessStoreMode,
}
impl TestClientBuilder {
@@ -66,7 +69,7 @@ impl TestClientBuilder {
enable_share_history_on_invite: false,
threading_support: ThreadingSupport::Disabled,
http_proxy: None,
cross_process_store_locks_holder_name: None,
cross_process_mode: CrossProcessStoreMode::SingleProcess,
}
}
@@ -114,8 +117,8 @@ impl TestClientBuilder {
self
}
pub fn cross_process_store_locks_holder_name(mut self, holder_name: String) -> Self {
self.cross_process_store_locks_holder_name = Some(holder_name);
pub fn cross_process_mode(mut self, cross_process_mode: CrossProcessStoreMode) -> Self {
self.cross_process_mode = cross_process_mode;
self
}
@@ -131,17 +134,13 @@ impl TestClientBuilder {
.with_room_key_recipient_strategy(self.room_key_recipient_strategy.clone())
.with_enable_share_history_on_invite(self.enable_share_history_on_invite)
.with_threading_support(self.threading_support)
.request_config(RequestConfig::short_retry());
.request_config(RequestConfig::short_retry())
.cross_process_store_mode(self.cross_process_mode.clone());
if let Some(decryption_settings) = &self.decryption_settings {
client_builder = client_builder.with_decryption_settings(decryption_settings.clone())
}
if let Some(holder_name) = &self.cross_process_store_locks_holder_name {
client_builder =
client_builder.cross_process_store_locks_holder_name(holder_name.clone());
}
if let Some(proxy) = &self.http_proxy {
client_builder = client_builder.proxy(proxy);
}
@@ -47,6 +47,7 @@ use matrix_sdk::{
},
},
};
use matrix_sdk_base::store::CrossProcessStoreMode;
use matrix_sdk_test::{TestError, TestResult};
use matrix_sdk_ui::{
Timeline,
@@ -680,7 +681,9 @@ async fn test_room_keys_received_on_notification_client_trigger_redecryption() {
// Now we create a notification client.
let notification_client = bob
.notification_client("BOB_NOTIFICATION_CLIENT".to_owned())
.notification_client(CrossProcessStoreMode::MultiProcess(
"BOB_NOTIFICATION_CLIENT".to_owned(),
))
.await
.expect("We should be able to build a notification client");