diff --git a/Config/BuildSettings.swift b/Config/BuildSettings.swift index ef19f87c6..a8489a4f7 100644 --- a/Config/BuildSettings.swift +++ b/Config/BuildSettings.swift @@ -294,6 +294,8 @@ final class BuildSettings: NSObject { static let settingsSecurityScreenShowCryptographyInfo:Bool = true static let settingsSecurityScreenShowCryptographyExport:Bool = true static let settingsSecurityScreenShowAdvancedUnverifiedDevices:Bool = true + /// A setting to enable the presence configuration settings section. + static let settingsScreenPresenceAllowConfiguration: Bool = false // MARK: - Timeline settings static let roomInputToolbarCompressionMode: MediaCompressionMode = .prompt @@ -427,9 +429,4 @@ final class BuildSettings: NSObject { // Do not enable live location sharing atm return false } - - // MARK: - Presence - - /// A setting to enable the presence configuration settings section. - static let presenceSettingsAllowConfiguration: Bool = false } diff --git a/Riot/Modules/MatrixKit/Models/Account/MXKAccount.m b/Riot/Modules/MatrixKit/Models/Account/MXKAccount.m index 38d7e5e05..4de8b53a6 100644 --- a/Riot/Modules/MatrixKit/Models/Account/MXKAccount.m +++ b/Riot/Modules/MatrixKit/Models/Account/MXKAccount.m @@ -2173,6 +2173,9 @@ static NSArray *initialSyncSilentErrorsHTTPStatusCodes; self.mxSession.preferredSyncPresence = preferredSyncPresence; [self setUserPresence:preferredSyncPresence andStatusMessage:nil completion:nil]; } + + // Archive updated field + [[MXKAccountManager sharedManager] saveAccounts]; } @end diff --git a/Riot/Modules/MatrixKit/Models/Account/MXKAccountData.m b/Riot/Modules/MatrixKit/Models/Account/MXKAccountData.m index 35e6ca9d5..e878ffb25 100644 --- a/Riot/Modules/MatrixKit/Models/Account/MXKAccountData.m +++ b/Riot/Modules/MatrixKit/Models/Account/MXKAccountData.m @@ -80,9 +80,10 @@ _warnedAboutEncryption = [coder decodeBoolForKey:@"warnedAboutEncryption"]; - if ([coder decodeIntForKey:@"preferredSyncPresence"]) + if ([coder decodeObjectOfClass:NSString.class forKey:@"preferredSyncPresence"]) { - _preferredSyncPresence = [coder decodeInt64ForKey:@"preferredSyncPresence"]; + MXPresenceString presenceString = [coder decodeObjectOfClass:NSString.class forKey:@"preferredSyncPresence"]; + _preferredSyncPresence = [MXTools presence:presenceString]; } else { @@ -152,7 +153,8 @@ [coder encodeBool:_warnedAboutEncryption forKey:@"warnedAboutEncryption"]; - [coder encodeInt64:_preferredSyncPresence forKey:@"preferredSyncPresence"]; + MXPresenceString presenceString = [MXTools presenceString:_preferredSyncPresence]; + [coder encodeObject:presenceString forKey:@"preferredSyncPresence"]; [coder encodeObject:_others forKey:@"others"]; } diff --git a/Riot/Modules/Settings/SettingsViewController.m b/Riot/Modules/Settings/SettingsViewController.m index a8e55a443..07c529d54 100644 --- a/Riot/Modules/Settings/SettingsViewController.m +++ b/Riot/Modules/Settings/SettingsViewController.m @@ -526,7 +526,7 @@ TableViewSectionsDelegate> [tmpSections addObject: sectionUserInterface]; - if(BuildSettings.presenceSettingsAllowConfiguration) + if(BuildSettings.settingsScreenPresenceAllowConfiguration) { Section *sectionPresence = [Section sectionWithTag:SECTION_TAG_PRESENCE]; [sectionPresence addRowWithTag:PRESENCE_OFFLINE_MODE];