Show / hide NSFW and decrypted content options in Settings screen from build settings

This commit is contained in:
Gil Eluard 2021-04-29 17:53:18 +02:00
parent 99fa785d0d
commit ddd1a6b60e
4 changed files with 33 additions and 2 deletions

View file

@ -6,6 +6,7 @@ Changes to be released in next version
🙌 Improvements
* RoomMemberDetailsVC: Enable / disable "Hide all messages from this user" from settings (#4281).
* SettingsVC: Show / hide NSFW and decrypted content options from build settings (#4290).
🐛 Bugfix
* RoomVC: Avoid navigation to integration management using integration popup with settings set to integration disabled (#4261).

View file

@ -242,6 +242,8 @@ final class BuildSettings: NSObject {
static let settingsScreenShowChangePassword:Bool = true
static let settingsScreenShowInviteFriends:Bool = true
static let settingsScreenShowEnableStunServerFallback: Bool = true
static let settingsScreenShowNotificationDecodedContentOption: Bool = true
static let settingsScreenShowNsfwRoomsOption: Bool = true
static let settingsSecurityScreenShowSessions:Bool = true
static let settingsSecurityScreenShowSetupBackup:Bool = true
static let settingsSecurityScreenShowRestoreBackup:Bool = true

View file

@ -60,6 +60,8 @@ final class RiotSettings: NSObject {
static let roomSettingsScreenShowFlairSettings = "roomSettingsScreenShowFlairSettings"
static let roomSettingsScreenShowAdvancedSettings = "roomSettingsScreenShowAdvancedSettings"
static let roomSettingsScreenAdvancedShowEncryptToVerifiedOption = "roomSettingsScreenAdvancedShowEncryptToVerifiedOption"
static let settingsScreenShowNotificationDecodedContentOption = "settingsScreenShowNotificationDecodedContentOption"
static let settingsScreenShowNsfwRoomsOption = "settingsScreenShowNsfwRoomsOption"
static let roomsAllowToJoinPublicRooms = "roomsAllowToJoinPublicRooms"
static let homeScreenShowFavouritesTab = "homeScreenShowFavouritesTab"
static let homeScreenShowPeopleTab = "homeScreenShowPeopleTab"
@ -481,6 +483,26 @@ final class RiotSettings: NSObject {
defaults.set(newValue, forKey: UserDefaultsKeys.settingsScreenShowEnableStunServerFallback)
}
}
var settingsScreenShowNotificationDecodedContentOption: Bool {
get {
guard defaults.object(forKey: UserDefaultsKeys.settingsScreenShowNotificationDecodedContentOption) != nil else {
return BuildSettings.settingsScreenShowNotificationDecodedContentOption
}
return defaults.bool(forKey: UserDefaultsKeys.settingsScreenShowNotificationDecodedContentOption)
} set {
defaults.set(newValue, forKey: UserDefaultsKeys.settingsScreenShowNotificationDecodedContentOption)
}
}
var settingsScreenShowNsfwRoomsOption: Bool {
get {
guard defaults.object(forKey: UserDefaultsKeys.settingsScreenShowNsfwRoomsOption) != nil else {
return BuildSettings.settingsScreenShowNsfwRoomsOption
}
return defaults.bool(forKey: UserDefaultsKeys.settingsScreenShowNsfwRoomsOption)
} set {
defaults.set(newValue, forKey: UserDefaultsKeys.settingsScreenShowNsfwRoomsOption)
}
}
var settingsSecurityScreenShowSessions: Bool {
get {
guard defaults.object(forKey: UserDefaultsKeys.settingsSecurityScreenShowSessions) != nil else {

View file

@ -350,7 +350,10 @@ TableViewSectionsDelegate>
Section *sectionNotificationSettings = [Section sectionWithTag:SECTION_TAG_NOTIFICATIONS];
[sectionNotificationSettings addRowWithTag:NOTIFICATION_SETTINGS_ENABLE_PUSH_INDEX];
[sectionNotificationSettings addRowWithTag:NOTIFICATION_SETTINGS_SHOW_DECODED_CONTENT];
if (RiotSettings.shared.settingsScreenShowNotificationDecodedContentOption)
{
[sectionNotificationSettings addRowWithTag:NOTIFICATION_SETTINGS_SHOW_DECODED_CONTENT];
}
[sectionNotificationSettings addRowWithTag:NOTIFICATION_SETTINGS_GLOBAL_SETTINGS_INDEX];
[sectionNotificationSettings addRowWithTag:NOTIFICATION_SETTINGS_PIN_MISSED_NOTIFICATIONS_INDEX];
[sectionNotificationSettings addRowWithTag:NOTIFICATION_SETTINGS_PIN_UNREAD_INDEX];
@ -458,7 +461,10 @@ TableViewSectionsDelegate>
[sectionOther addRowWithTag:OTHER_PRIVACY_INDEX];
}
[sectionOther addRowWithTag:OTHER_THIRD_PARTY_INDEX];
[sectionOther addRowWithTag:OTHER_SHOW_NSFW_ROOMS_INDEX];
if (RiotSettings.shared.settingsScreenShowNsfwRoomsOption)
{
[sectionOther addRowWithTag:OTHER_SHOW_NSFW_ROOMS_INDEX];
}
if (BuildSettings.settingsScreenAllowChangingCrashUsageDataSettings)
{