Refine 'Screen Lock'.

pull/1/head
Matthew Chen 7 years ago
parent 70e95b085e
commit 871dca4138

@ -111,12 +111,8 @@ NS_ASSUME_NONNULL_BEGIN
OWSTableSection *screenSecuritySection = [OWSTableSection new]; OWSTableSection *screenSecuritySection = [OWSTableSection new];
screenSecuritySection.headerTitle = NSLocalizedString(@"SETTINGS_SECURITY_TITLE", @"Section header"); screenSecuritySection.headerTitle = NSLocalizedString(@"SETTINGS_SECURITY_TITLE", @"Section header");
screenSecuritySection.footerTitle = NSLocalizedString(@"SETTINGS_SCREEN_SECURITY_DETAIL", nil); screenSecuritySection.footerTitle = NSLocalizedString(@"SETTINGS_SCREEN_SECURITY_DETAIL", nil);
[screenSecuritySection [screenSecuritySection addItem:[OWSTableItem switchItemWithText:NSLocalizedString(@"SETTINGS_SCREEN_SECURITY", @"")
addItem:[OWSTableItem switchItemWithText:NSLocalizedString(@"SETTINGS_SCREEN_SECURITY", @"") isOn:[Environment.preferences screenSecurityIsEnabled]
// If 'Screen Lock' is enabled, 'Screen Protection' is auto-enabled.
isOn:([Environment.preferences screenSecurityIsEnabled]
|| OWSScreenLock.sharedManager.isScreenLockEnabled)
isEnabled:!OWSScreenLock.sharedManager.isScreenLockEnabled
target:weakSelf target:weakSelf
selector:@selector(didToggleScreenSecuritySwitch:)]]; selector:@selector(didToggleScreenSecuritySwitch:)]];
[contents addSection:screenSecuritySection]; [contents addSection:screenSecuritySection];

@ -10,18 +10,16 @@ import LocalAuthentication
public enum OWSScreenLockOutcome { public enum OWSScreenLockOutcome {
case success case success
case cancel case cancel
// case userCancel
// case otherCancel
case failure(error:String) case failure(error:String)
// case permanentFailure(error:String)
} }
@objc public let screenLockTimeoutDefault = 15 * kMinuteInterval
@objc public let screenLockTimeouts = [ @objc public let screenLockTimeouts = [
5 * kSecondInterval,
15 * kSecondInterval,
30 * kSecondInterval,
1 * kMinuteInterval, 1 * kMinuteInterval,
5 * kMinuteInterval, 5 * kMinuteInterval,
15 * kMinuteInterval,
30 * kMinuteInterval,
1 * kHourInterval,
0 0
] ]
@ -78,8 +76,7 @@ import LocalAuthentication
return 0 return 0
} }
let defaultTimeout = screenLockTimeouts[0] return self.dbConnection.double(forKey: OWSScreenLock_Key_ScreenLockTimeoutSeconds, inCollection: OWSScreenLock_Collection, defaultValue: screenLockTimeoutDefault)
return self.dbConnection.double(forKey: OWSScreenLock_Key_ScreenLockTimeoutSeconds, inCollection: OWSScreenLock_Collection, defaultValue: defaultTimeout)
} }
@objc public func setScreenLockTimeout(_ value: TimeInterval) { @objc public func setScreenLockTimeout(_ value: TimeInterval) {

@ -147,9 +147,8 @@ NS_ASSUME_NONNULL_BEGIN
// Show 'Screen Protection' if: // Show 'Screen Protection' if:
// //
// * App is inactive and... // * App is inactive and...
// * Either 'Screen Protection' or 'Screen Lock' is enabled. // * 'Screen Protection' is enabled.
BOOL shouldHaveScreenProtection = (self.appIsInactive BOOL shouldHaveScreenProtection = (self.appIsInactive && Environment.preferences.screenSecurityIsEnabled);
&& (Environment.preferences.screenSecurityIsEnabled || OWSScreenLock.sharedManager.isScreenLockEnabled));
BOOL shouldShowBlockWindow = shouldHaveScreenProtection || shouldHaveScreenLock; BOOL shouldShowBlockWindow = shouldHaveScreenProtection || shouldHaveScreenLock;
DDLogVerbose(@"%@, shouldHaveScreenProtection: %d, shouldHaveScreenLock: %d, shouldShowBlockWindow: %d", DDLogVerbose(@"%@, shouldHaveScreenProtection: %d, shouldHaveScreenLock: %d, shouldShowBlockWindow: %d",

@ -1538,7 +1538,7 @@
"SCAN_QR_CODE_VIEW_TITLE" = "Scan QR Code"; "SCAN_QR_CODE_VIEW_TITLE" = "Scan QR Code";
/* Indicates a delay of zero seconds, and that 'screen lock activity' will timeout immediately. */ /* Indicates a delay of zero seconds, and that 'screen lock activity' will timeout immediately. */
"SCREEN_LOCK_ACTIVITY_TIMEOUT_NONE" = "None"; "SCREEN_LOCK_ACTIVITY_TIMEOUT_NONE" = "Instant";
/* Title for alert indicating that screen lock could not be disabled. */ /* Title for alert indicating that screen lock could not be disabled. */
"SCREEN_LOCK_DISABLE_FAILED" = "Screen Lock Could Not Be Disabled"; "SCREEN_LOCK_DISABLE_FAILED" = "Screen Lock Could Not Be Disabled";

Loading…
Cancel
Save