Refine 'Screen Lock'.

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

@ -111,14 +111,10 @@ 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", @"")
// 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:)]];
[screenSecuritySection addItem:[OWSTableItem switchItemWithText:NSLocalizedString(@"SETTINGS_SCREEN_SECURITY", @"")
isOn:[Environment.preferences screenSecurityIsEnabled]
target:weakSelf
selector:@selector(didToggleScreenSecuritySwitch:)]];
[contents addSection:screenSecuritySection];
OWSTableSection *removeMetadataSection = [OWSTableSection new];

@ -10,18 +10,16 @@ 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
]
@ -78,8 +76,7 @@ import LocalAuthentication
return 0
}
let defaultTimeout = screenLockTimeouts[0]
return self.dbConnection.double(forKey: OWSScreenLock_Key_ScreenLockTimeoutSeconds, inCollection: OWSScreenLock_Collection, defaultValue: defaultTimeout)
return self.dbConnection.double(forKey: OWSScreenLock_Key_ScreenLockTimeoutSeconds, inCollection: OWSScreenLock_Collection, defaultValue: screenLockTimeoutDefault)
}
@objc public func setScreenLockTimeout(_ value: TimeInterval) {

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

@ -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" = "None";
"SCREEN_LOCK_ACTIVITY_TIMEOUT_NONE" = "Instant";
/* Title for alert indicating that screen lock could not be disabled. */
"SCREEN_LOCK_DISABLE_FAILED" = "Screen Lock Could Not Be Disabled";

Loading…
Cancel
Save