mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-02 21:33:26 +00:00
Remove the dynamic member lookup from UserSettings in favour of nested access. (#6294)
* Remove the dynamic member lookup from UserSettings in favour of nested access. * Remove forwarding methods from UserSettings. * Update the Enterprise submodule.
This commit is contained in:
@@ -10,44 +10,16 @@ import Macros
|
||||
|
||||
/// The settings for a signed in account, composed of the app wide settings and the settings
|
||||
/// specific to that account.
|
||||
@dynamicMemberLookup
|
||||
final nonisolated class UserSettings: Sendable {
|
||||
// TODO: @pixlwave Make this private after handling Advanced/Labs/Developer screen models.
|
||||
let app: AppSettings
|
||||
private let account: AccountSettings
|
||||
let account: AccountSettings
|
||||
|
||||
init(appSettings: AppSettings, accountSettings: AccountSettings) {
|
||||
self.app = appSettings
|
||||
self.account = accountSettings
|
||||
app = appSettings
|
||||
account = accountSettings
|
||||
}
|
||||
|
||||
static func mock(userID: String = "@me:matrix.org") -> UserSettings {
|
||||
AppSettings.volatile().userSettings(for: userID)
|
||||
}
|
||||
|
||||
subscript<Value>(dynamicMember keyPath: ReferenceWritableKeyPath<AppSettings, Value>) -> Value {
|
||||
get { app[keyPath: keyPath] }
|
||||
set { app[keyPath: keyPath] = newValue }
|
||||
}
|
||||
|
||||
subscript<Value>(dynamicMember keyPath: KeyPath<AppSettings, Value>) -> Value {
|
||||
app[keyPath: keyPath]
|
||||
}
|
||||
|
||||
subscript<Value>(dynamicMember keyPath: ReferenceWritableKeyPath<AccountSettings, Value>) -> Value {
|
||||
get { account[keyPath: keyPath] }
|
||||
set { account[keyPath: keyPath] = newValue }
|
||||
}
|
||||
|
||||
subscript<Value>(dynamicMember keyPath: KeyPath<AccountSettings, Value>) -> Value {
|
||||
account[keyPath: keyPath]
|
||||
}
|
||||
|
||||
func migrateAppSettingsValueToAccountSettings(_ keyPath: KeyPath<AccountSettings, UserPreferenceKey>) {
|
||||
account.migrateAppSettingsValue(keyPath)
|
||||
}
|
||||
|
||||
func resetSessionSpecificSettings() {
|
||||
account.reset()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user