diff --git a/Config/BuildSettings.swift b/Config/BuildSettings.swift index a4880a81e..68ba630ee 100644 --- a/Config/BuildSettings.swift +++ b/Config/BuildSettings.swift @@ -29,5 +29,40 @@ final class BuildSettings: NSObject { Bundle.app.object(forInfoDictionaryKey: "applicationGroupIdentifier") as! String } - static let aSampleTestToRemove = "This is a demo of how we will use this class. TODO: Remove it once we have some settings" + /// Setting to force protection by pin code + static let forcePinProtection: Bool = false + + /// Force non-jailbroken app usage + static let forceNonJailbrokenUsage: Bool = true + + static let showUserFirstNameInSettings: Bool = false + static let showUserSurnameInSettings: Bool = false + static let allowAddingEmailThreepids: Bool = true + static let allowAddingPhoneThreepids: Bool = true + static let showThreepidExplanatory: Bool = true + static let allowVoIPUsage: Bool = true + static let showDiscoverySettings: Bool = true + static let allowIdentityServerConfig: Bool = true + static let allowLocalContactsAccess: Bool = true + static let showAdvancedSettings: Bool = true + static let showLabSettings: Bool = true + static let allowChangingRageshakeSettings: Bool = true + static let allowChangingCrashUsageDataSettings: Bool = true + static let allowBugReportingManually: Bool = true + static let allowDeactivatingAccount: Bool = true + static let allowSendingStickers: Bool = true + static let allowSearchOnOtherServersForRoomDirectory: Bool = false + + // Message settings + static let allowMessageDetailsShare: Bool = true + static let allowMessageDetailsPermalink: Bool = true + static let allowMessageDetailsViewSource: Bool = true + static let allowMessageDetailsReportContent: Bool = true + + // Room settings + static let showLowPrioritySetting: Bool = false + static let showDirectChatSettings: Bool = false + static let showAccessControls: Bool = false + static let allowChangingHistoryVisibility: Bool = false + } diff --git a/Riot/Managers/Settings/RiotSettings.swift b/Riot/Managers/Settings/RiotSettings.swift index dda70179a..fccf787a2 100644 --- a/Riot/Managers/Settings/RiotSettings.swift +++ b/Riot/Managers/Settings/RiotSettings.swift @@ -46,46 +46,6 @@ final class RiotSettings: NSObject { // MARK: - Public - /// Setting to force protection by pin code - let forcePinProtection: Bool = false - - /// Force non-jailbroken app usage - let forceNonJailbrokenUsage: Bool = true - - // BEGIN: SETTINGS TO BE REPLACED - - let showUserFirstNameInSettings: Bool = false - let showUserSurnameInSettings: Bool = false - let allowAddingEmailThreepids: Bool = true - let allowAddingPhoneThreepids: Bool = true - var showThreepidExplanatory: Bool = true - let allowVoIPUsage: Bool = true - let showDiscoverySettings: Bool = true - let allowIdentityServerConfig: Bool = true - let allowLocalContactsAccess: Bool = true - let showAdvancedSettings: Bool = true - let showLabSettings: Bool = true - let allowChangingRageshakeSettings: Bool = true - let allowChangingCrashUsageDataSettings: Bool = true - let allowBugReportingManually: Bool = true - let allowDeactivatingAccount: Bool = true - let allowSendingStickers: Bool = true - let allowSearchOnOtherServersForRoomDirectory: Bool = false - - // Message settings - let allowMessageDetailsShare: Bool = true - let allowMessageDetailsPermalink: Bool = true - let allowMessageDetailsViewSource: Bool = true - let allowMessageDetailsReportContent: Bool = true - - // Room settings - let showLowPrioritySetting: Bool = false - let showDirectChatSettings: Bool = false - let showAccessControls: Bool = false - let allowChangingHistoryVisibility: Bool = false - - // END: SETTINGS TO BE REPLACED - // MARK: Notifications /// Indicate if `showDecryptedContentInNotifications` settings has been set once. diff --git a/Riot/Modules/Room/RoomViewController.m b/Riot/Modules/Room/RoomViewController.m index 8266abc7f..be75e0eaf 100644 --- a/Riot/Modules/Room/RoomViewController.m +++ b/Riot/Modules/Room/RoomViewController.m @@ -2578,7 +2578,7 @@ }]]; - if (RiotSettings.shared.allowMessageDetailsShare) + if (BuildSettings.allowMessageDetailsShare) { [currentAlert addAction:[UIAlertAction actionWithTitle:NSLocalizedStringFromTable(@"room_event_action_share", @"Vector", nil) style:UIAlertActionStyleDefault @@ -2691,7 +2691,7 @@ if (attachment.type != MXKAttachmentTypeSticker) { - if (RiotSettings.shared.allowMessageDetailsShare) + if (BuildSettings.allowMessageDetailsShare) { [currentAlert addAction:[UIAlertAction actionWithTitle:NSLocalizedStringFromTable(@"room_event_action_share", @"Vector", nil) style:UIAlertActionStyleDefault @@ -2802,7 +2802,7 @@ }]]; } - if (RiotSettings.shared.allowMessageDetailsPermalink) + if (BuildSettings.allowMessageDetailsPermalink) { [currentAlert addAction:[UIAlertAction actionWithTitle:NSLocalizedStringFromTable(@"room_event_action_permalink", @"Vector", nil) style:UIAlertActionStyleDefault @@ -2844,7 +2844,7 @@ }]]; } - if (RiotSettings.shared.allowMessageDetailsViewSource) + if (BuildSettings.allowMessageDetailsViewSource) { [currentAlert addAction:[UIAlertAction actionWithTitle:NSLocalizedStringFromTable(@"room_event_action_view_source", @"Vector", nil) style:UIAlertActionStyleDefault @@ -2884,7 +2884,7 @@ } } - if (RiotSettings.shared.allowMessageDetailsReportContent) + if (BuildSettings.allowMessageDetailsReportContent) { [currentAlert addAction:[UIAlertAction actionWithTitle:NSLocalizedStringFromTable(@"room_event_action_report", @"Vector", nil) style:UIAlertActionStyleDefault diff --git a/Riot/Modules/Room/Views/InputToolbar/RoomInputToolbarView.m b/Riot/Modules/Room/Views/InputToolbar/RoomInputToolbarView.m index b7d2248fd..533bf7c8c 100644 --- a/Riot/Modules/Room/Views/InputToolbar/RoomInputToolbarView.m +++ b/Riot/Modules/Room/Views/InputToolbar/RoomInputToolbarView.m @@ -347,7 +347,7 @@ }]]; - if (RiotSettings.shared.allowSendingStickers) + if (BuildSettings.allowSendingStickers) { [actionSheet addAction:[UIAlertAction actionWithTitle:NSLocalizedStringFromTable(@"room_action_send_sticker", @"Vector", nil) style:UIAlertActionStyleDefault diff --git a/Riot/Modules/SetPinCode/PinCodePreferences.swift b/Riot/Modules/SetPinCode/PinCodePreferences.swift index 0dc0bf06c..4b3768bfb 100644 --- a/Riot/Modules/SetPinCode/PinCodePreferences.swift +++ b/Riot/Modules/SetPinCode/PinCodePreferences.swift @@ -48,7 +48,7 @@ final class PinCodePreferences: NSObject { /// Setting to force protection by pin code var forcePinProtection: Bool { - return RiotSettings.shared.forcePinProtection + return BuildSettings.forcePinProtection } var isBiometricsAvailable: Bool { diff --git a/Riot/Modules/Settings/SettingsViewController.m b/Riot/Modules/Settings/SettingsViewController.m index 7317d826c..045116125 100644 --- a/Riot/Modules/Settings/SettingsViewController.m +++ b/Riot/Modules/Settings/SettingsViewController.m @@ -363,11 +363,11 @@ SettingsIdentityServerCoordinatorBridgePresenterDelegate> [sectionUserSettings addRowWithTag:USER_SETTINGS_PROFILE_PICTURE_INDEX]; [sectionUserSettings addRowWithTag:USER_SETTINGS_DISPLAYNAME_INDEX]; [sectionUserSettings addRowWithTag:USER_SETTINGS_CHANGE_PASSWORD_INDEX]; - if (RiotSettings.shared.showUserFirstNameInSettings) + if (BuildSettings.showUserFirstNameInSettings) { [sectionUserSettings addRowWithTag:USER_SETTINGS_FIRST_NAME_INDEX]; } - if (RiotSettings.shared.showUserSurnameInSettings) + if (BuildSettings.showUserSurnameInSettings) { [sectionUserSettings addRowWithTag:USER_SETTINGS_SURNAME_INDEX]; } @@ -382,15 +382,15 @@ SettingsIdentityServerCoordinatorBridgePresenterDelegate> { [sectionUserSettings addRowWithTag: USER_SETTINGS_EMAILS_OFFSET + index]; } - if (RiotSettings.shared.allowAddingEmailThreepids) + if (BuildSettings.allowAddingEmailThreepids) { [sectionUserSettings addRowWithTag:USER_SETTINGS_ADD_EMAIL_INDEX]; } - if (RiotSettings.shared.allowAddingPhoneThreepids) + if (BuildSettings.allowAddingPhoneThreepids) { [sectionUserSettings addRowWithTag:USER_SETTINGS_ADD_PHONENUMBER_INDEX]; } - if (RiotSettings.shared.showThreepidExplanatory) + if (BuildSettings.showThreepidExplanatory) { [sectionUserSettings addRowWithTag:USER_SETTINGS_THREEPIDS_INFORMATION_INDEX]; } @@ -411,7 +411,7 @@ SettingsIdentityServerCoordinatorBridgePresenterDelegate> sectionNotificationSettings.headerTitle = NSLocalizedStringFromTable(@"settings_notifications_settings", @"Vector", nil); [tmpSections addObject:sectionNotificationSettings]; - if (RiotSettings.shared.allowVoIPUsage && RiotSettings.shared.stunServerFallback) + if (BuildSettings.allowVoIPUsage && RiotSettings.shared.stunServerFallback) { Section *sectionCalls = [Section sectionWithTag:SECTION_TAG_CALLS]; [sectionCalls addRowWithTag:CALLS_ENABLE_STUN_SERVER_FALLBACK_INDEX]; @@ -420,7 +420,7 @@ SettingsIdentityServerCoordinatorBridgePresenterDelegate> [tmpSections addObject:sectionCalls]; } - if (RiotSettings.shared.showDiscoverySettings) + if (BuildSettings.showDiscoverySettings) { Section *sectionDiscovery = [Section sectionWithTag:SECTION_TAG_DISCOVERY]; NSInteger count = self.settingsDiscoveryTableViewSection.numberOfRows; @@ -432,7 +432,7 @@ SettingsIdentityServerCoordinatorBridgePresenterDelegate> [tmpSections addObject:sectionDiscovery]; } - if (RiotSettings.shared.allowIdentityServerConfig) + if (BuildSettings.allowIdentityServerConfig) { Section *sectionIdentityServer = [Section sectionWithTag:SECTION_TAG_IDENTITY_SERVER]; [sectionIdentityServer addRowWithTag:IDENTITY_SERVER_INDEX]; @@ -441,7 +441,7 @@ SettingsIdentityServerCoordinatorBridgePresenterDelegate> [tmpSections addObject:sectionIdentityServer]; } - if (RiotSettings.shared.allowLocalContactsAccess) + if (BuildSettings.allowLocalContactsAccess) { Section *sectionLocalContacts = [Section sectionWithTag:SECTION_TAG_LOCAL_CONTACTS]; [sectionLocalContacts addRowWithTag:LOCAL_CONTACTS_SYNC_INDEX]; @@ -480,7 +480,7 @@ SettingsIdentityServerCoordinatorBridgePresenterDelegate> sectionUserInterface.headerTitle = NSLocalizedStringFromTable(@"settings_user_interface", @"Vector", nil); [tmpSections addObject: sectionUserInterface]; - if (RiotSettings.shared.showAdvancedSettings) + if (BuildSettings.showAdvancedSettings) { Section *sectionAdvanced = [Section sectionWithTag:SECTION_TAG_ADVANCED]; [sectionAdvanced addRowWithTag:0]; @@ -495,24 +495,24 @@ SettingsIdentityServerCoordinatorBridgePresenterDelegate> [sectionOther addRowWithTag:OTHER_TERM_CONDITIONS_INDEX]; [sectionOther addRowWithTag:OTHER_PRIVACY_INDEX]; [sectionOther addRowWithTag:OTHER_THIRD_PARTY_INDEX]; - if (RiotSettings.shared.allowChangingCrashUsageDataSettings) + if (BuildSettings.allowChangingCrashUsageDataSettings) { [sectionOther addRowWithTag:OTHER_CRASH_REPORT_INDEX]; } - if (RiotSettings.shared.allowChangingRageshakeSettings) + if (BuildSettings.allowChangingRageshakeSettings) { [sectionOther addRowWithTag:OTHER_ENABLE_RAGESHAKE_INDEX]; } [sectionOther addRowWithTag:OTHER_MARK_ALL_AS_READ_INDEX]; [sectionOther addRowWithTag:OTHER_CLEAR_CACHE_INDEX]; - if (RiotSettings.shared.allowBugReportingManually) + if (BuildSettings.allowBugReportingManually) { [sectionOther addRowWithTag:OTHER_REPORT_BUG_INDEX]; } sectionOther.headerTitle = NSLocalizedStringFromTable(@"settings_other", @"Vector", nil); [tmpSections addObject:sectionOther]; - if (RiotSettings.shared.showLabSettings) + if (BuildSettings.showLabSettings) { Section *sectionLabs = [Section sectionWithTag:SECTION_TAG_LABS]; [sectionLabs addRowWithTag:LABS_USE_JITSI_WIDGET_INDEX]; @@ -533,7 +533,7 @@ SettingsIdentityServerCoordinatorBridgePresenterDelegate> [tmpSections addObject:sectionFlair]; } - if (RiotSettings.shared.allowDeactivatingAccount) + if (BuildSettings.allowDeactivatingAccount) { Section *sectionDeactivate = [Section sectionWithTag:SECTION_TAG_DEACTIVATE_ACCOUNT]; [sectionDeactivate addRowWithTag:0];