diff --git a/Signal/src/ViewControllers/AppSettings/PrivacySettingsTableViewController.m b/Signal/src/ViewControllers/AppSettings/PrivacySettingsTableViewController.m index bbc694e27..00b3f119f 100644 --- a/Signal/src/ViewControllers/AppSettings/PrivacySettingsTableViewController.m +++ b/Signal/src/ViewControllers/AppSettings/PrivacySettingsTableViewController.m @@ -111,10 +111,14 @@ NS_ASSUME_NONNULL_BEGIN OWSTableSection *screenSecuritySection = [OWSTableSection new]; screenSecuritySection.headerTitle = NSLocalizedString(@"SETTINGS_SECURITY_TITLE", @"Section header"); screenSecuritySection.footerTitle = NSLocalizedString(@"SETTINGS_SCREEN_SECURITY_DETAIL", nil); - [screenSecuritySection addItem:[OWSTableItem switchItemWithText:NSLocalizedString(@"SETTINGS_SCREEN_SECURITY", @"") - isOn:[Environment.preferences screenSecurityIsEnabled] - target:weakSelf - selector:@selector(didToggleScreenSecuritySwitch:)]]; + [screenSecuritySection + addItem:[OWSTableItem switchItemWithText:NSLocalizedString(@"SETTINGS_SCREEN_SECURITY", @"") + // If 'Screen Lock' is enabled, 'Screen Protection' is auto-enabled. + isOn:([Environment.preferences screenSecurityIsEnabled] + || OWSScreenLock.sharedManager.isScreenLockEnabled) + isEnabled:!OWSScreenLock.sharedManager.isScreenLockEnabled + target:weakSelf + selector:@selector(didToggleScreenSecuritySwitch:)]]; [contents addSection:screenSecuritySection]; OWSTableSection *removeMetadataSection = [OWSTableSection new]; diff --git a/Signal/src/util/OWSScreenLock.swift b/Signal/src/util/OWSScreenLock.swift index fffe6de24..a2317a696 100644 --- a/Signal/src/util/OWSScreenLock.swift +++ b/Signal/src/util/OWSScreenLock.swift @@ -10,16 +10,18 @@ import LocalAuthentication public enum OWSScreenLockOutcome { case success case cancel +// case userCancel +// case otherCancel case failure(error:String) +// case permanentFailure(error:String) } - @objc public let screenLockTimeoutDefault = 15 * kMinuteInterval @objc public let screenLockTimeouts = [ + 5 * kSecondInterval, + 15 * kSecondInterval, + 30 * kSecondInterval, 1 * kMinuteInterval, 5 * kMinuteInterval, - 15 * kMinuteInterval, - 30 * kMinuteInterval, - 1 * kHourInterval, 0 ] @@ -76,7 +78,8 @@ import LocalAuthentication return 0 } - return self.dbConnection.double(forKey: OWSScreenLock_Key_ScreenLockTimeoutSeconds, inCollection: OWSScreenLock_Collection, defaultValue: screenLockTimeoutDefault) + let defaultTimeout = screenLockTimeouts[0] + return self.dbConnection.double(forKey: OWSScreenLock_Key_ScreenLockTimeoutSeconds, inCollection: OWSScreenLock_Collection, defaultValue: defaultTimeout) } @objc public func setScreenLockTimeout(_ value: TimeInterval) { diff --git a/Signal/src/util/OWSScreenLockUI.m b/Signal/src/util/OWSScreenLockUI.m index d0e26d611..85049f93b 100644 --- a/Signal/src/util/OWSScreenLockUI.m +++ b/Signal/src/util/OWSScreenLockUI.m @@ -147,8 +147,9 @@ NS_ASSUME_NONNULL_BEGIN // Show 'Screen Protection' if: // // * App is inactive and... - // * 'Screen Protection' is enabled. - BOOL shouldHaveScreenProtection = (self.appIsInactive && Environment.preferences.screenSecurityIsEnabled); + // * Either 'Screen Protection' or 'Screen Lock' is enabled. + BOOL shouldHaveScreenProtection = (self.appIsInactive + && (Environment.preferences.screenSecurityIsEnabled || OWSScreenLock.sharedManager.isScreenLockEnabled)); BOOL shouldShowBlockWindow = shouldHaveScreenProtection || shouldHaveScreenLock; DDLogVerbose(@"%@, shouldHaveScreenProtection: %d, shouldHaveScreenLock: %d, shouldShowBlockWindow: %d", diff --git a/Signal/translations/en.lproj/Localizable.strings b/Signal/translations/en.lproj/Localizable.strings index e62085a68..72d3657cf 100644 --- a/Signal/translations/en.lproj/Localizable.strings +++ b/Signal/translations/en.lproj/Localizable.strings @@ -1538,7 +1538,7 @@ "SCAN_QR_CODE_VIEW_TITLE" = "Scan QR Code"; /* Indicates a delay of zero seconds, and that 'screen lock activity' will timeout immediately. */ -"SCREEN_LOCK_ACTIVITY_TIMEOUT_NONE" = "Instant"; +"SCREEN_LOCK_ACTIVITY_TIMEOUT_NONE" = "None"; /* Title for alert indicating that screen lock could not be disabled. */ "SCREEN_LOCK_DISABLE_FAILED" = "Screen Lock Could Not Be Disabled";