mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-04 01:20:12 +00:00
Remove the CommonSettingsProtocol and use UserSession to carry multiple dependencies. (#6302)
* Remove the CommonSettingsProtocol. * Replace multiple dependencies with the UserSession when it carries them.
This commit is contained in:
@@ -15,11 +15,11 @@ enum RemoteSettingsError: Error {
|
||||
|
||||
protocol RemoteSettingsHookProtocol: Sendable {
|
||||
#if IS_MAIN_APP
|
||||
@MainActor func initializeCache(using client: ClientProtocol, applyingTo appSettings: CommonSettingsProtocol) async -> Result<Void, RemoteSettingsError>
|
||||
@MainActor func initializeCache(using client: ClientProtocol, applyingTo appSettings: AppSettings) async -> Result<Void, RemoteSettingsError>
|
||||
func updateCache(using client: ClientProtocol) async
|
||||
@MainActor func reset(_ appSettings: CommonSettingsProtocol)
|
||||
@MainActor func reset(_ appSettings: AppSettings)
|
||||
#endif
|
||||
@MainActor func loadCache(forHomeserver homeserver: String, applyingTo appSettings: CommonSettingsProtocol)
|
||||
@MainActor func loadCache(forHomeserver homeserver: String, applyingTo appSettings: AppSettings)
|
||||
}
|
||||
|
||||
struct DefaultRemoteSettingsHook: RemoteSettingsHookProtocol {
|
||||
@@ -27,7 +27,7 @@ struct DefaultRemoteSettingsHook: RemoteSettingsHookProtocol {
|
||||
/// A best effort implementation to let Element X advertise to users when they should be using
|
||||
/// Element Pro. In an ideal world the backend would be able to validate the client's requests
|
||||
/// instead of relying on it to check a well-known file for this.
|
||||
func initializeCache(using client: ClientProtocol, applyingTo appSettings: CommonSettingsProtocol) async -> Result<Void, RemoteSettingsError> {
|
||||
func initializeCache(using client: ClientProtocol, applyingTo appSettings: AppSettings) async -> Result<Void, RemoteSettingsError> {
|
||||
guard case let .success(wellKnownData) = await client.elementWellKnown() else {
|
||||
// Nothing to check, carry on as normal.
|
||||
return .success(())
|
||||
@@ -49,10 +49,10 @@ struct DefaultRemoteSettingsHook: RemoteSettingsHookProtocol {
|
||||
}
|
||||
|
||||
func updateCache(using client: ClientProtocol) async { }
|
||||
func reset(_ appSettings: any CommonSettingsProtocol) { }
|
||||
func reset(_ appSettings: AppSettings) { }
|
||||
#endif
|
||||
|
||||
func loadCache(forHomeserver homeserver: String, applyingTo appSettings: CommonSettingsProtocol) { }
|
||||
func loadCache(forHomeserver homeserver: String, applyingTo appSettings: AppSettings) { }
|
||||
}
|
||||
|
||||
private struct ElementWellKnown: Decodable {
|
||||
|
||||
Reference in New Issue
Block a user