IOS-1716 adds setting to [en|dis]able extra key editability IOS-1716
authorbuff <andreas@pep-project.org>
Tue, 13 Aug 2019 14:14:17 +0200
branchIOS-1716
changeset 9664b5270087022b
parent 9663 6d18a1c2c1a7
child 9665 a739423ea8bb
IOS-1716 adds setting to [en|dis]able extra key editability
pEpForiOS/AppSettings/AppSettings.swift
pEpForiOS/AppSettings/AppSettingsProtocol.swift
pEpForiOS/AppSettings/DefaultAppSettings.swift
     1.1 --- a/pEpForiOS/AppSettings/AppSettings.swift	Tue Aug 13 13:41:21 2019 +0200
     1.2 +++ b/pEpForiOS/AppSettings/AppSettings.swift	Tue Aug 13 14:14:17 2019 +0200
     1.3 @@ -22,6 +22,7 @@
     1.4      static public let keyThreadedViewEnabled = "keyThreadedViewEnabled"
     1.5      static public let keyPassiveMode = "keyPassiveMode"
     1.6      static public let keyLastKnowDeviceGroupStateRawValue = "keyLastKnowDeviceGroupStateRawValue"
     1.7 +    static public let keyExtraKeysEditable = "keyExtraKeysEditable"
     1.8  
     1.9      /**
    1.10       The actual implementation of `AppSettingsProtocol` to defer to.
    1.11 @@ -47,6 +48,15 @@
    1.12              settingsHandler.keySyncEnabled = newValue
    1.13          }
    1.14      }
    1.15 +
    1.16 +    static var extraKeysEditable: Bool {
    1.17 +        get {
    1.18 +            return settingsHandler.extraKeysEditable
    1.19 +        }
    1.20 +        set {
    1.21 +            settingsHandler.extraKeysEditable = newValue
    1.22 +        }
    1.23 +    }
    1.24      
    1.25      static var unencryptedSubjectEnabled: Bool {
    1.26          get {
     2.1 --- a/pEpForiOS/AppSettings/AppSettingsProtocol.swift	Tue Aug 13 13:41:21 2019 +0200
     2.2 +++ b/pEpForiOS/AppSettings/AppSettingsProtocol.swift	Tue Aug 13 14:14:17 2019 +0200
     2.3 @@ -11,6 +11,7 @@
     2.4  public protocol AppSettingsProtocol {
     2.5      var shouldReinitializePepOnNextStartup: Bool { get set }
     2.6      var keySyncEnabled: Bool { get set }
     2.7 +    var extraKeysEditable: Bool { get set }
     2.8      var unencryptedSubjectEnabled: Bool { get set }
     2.9      var threadedViewEnabled: Bool { get set }
    2.10      var passiveMode: Bool { get set }
     3.1 --- a/pEpForiOS/AppSettings/DefaultAppSettings.swift	Tue Aug 13 13:41:21 2019 +0200
     3.2 +++ b/pEpForiOS/AppSettings/DefaultAppSettings.swift	Tue Aug 13 14:14:17 2019 +0200
     3.3 @@ -35,6 +35,15 @@
     3.4                                        forKey: AppSettings.keyKeySyncEnabled)
     3.5          }
     3.6      }
     3.7 +
     3.8 +    public var extraKeysEditable: Bool {
     3.9 +        get {
    3.10 +            return UserDefaults.standard.bool(forKey: AppSettings.keyExtraKeysEditable)
    3.11 +        }
    3.12 +        set {
    3.13 +            UserDefaults.standard.set(newValue, forKey: AppSettings.keyExtraKeysEditable)
    3.14 +        }
    3.15 +    }
    3.16      
    3.17      public var unencryptedSubjectEnabled: Bool {
    3.18          get {
    3.19 @@ -106,6 +115,7 @@
    3.20          defaults[AppSettings.keyThreadedViewEnabled] = true
    3.21          defaults[AppSettings.keyPassiveMode] = false
    3.22          defaults[AppSettings.keyLastKnowDeviceGroupStateRawValue] = DeviceGroupState.sole.rawValue
    3.23 +        defaults[AppSettings.keyExtraKeysEditable] = false
    3.24  
    3.25          UserDefaults.standard.register(defaults: defaults)
    3.26      }