Revert "Refine 'Screen Lock'."

This reverts commit 871dca4138.
pull/1/head
Matthew Chen 7 years ago
parent 871dca4138
commit 03845d0d98

@ -111,10 +111,14 @@ 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 addItem:[OWSTableItem switchItemWithText:NSLocalizedString(@"SETTINGS_SCREEN_SECURITY", @"") [screenSecuritySection
isOn:[Environment.preferences screenSecurityIsEnabled] addItem:[OWSTableItem switchItemWithText:NSLocalizedString(@"SETTINGS_SCREEN_SECURITY", @"")
target:weakSelf // If 'Screen Lock' is enabled, 'Screen Protection' is auto-enabled.
selector:@selector(didToggleScreenSecuritySwitch:)]]; isOn:([Environment.preferences screenSecurityIsEnabled]
|| OWSScreenLock.sharedManager.isScreenLockEnabled)
isEnabled:!OWSScreenLock.sharedManager.isScreenLockEnabled
target:weakSelf
selector:@selector(didToggleScreenSecuritySwitch:)]];
[contents addSection:screenSecuritySection]; [contents addSection:screenSecuritySection];
OWSTableSection *removeMetadataSection = [OWSTableSection new]; OWSTableSection *removeMetadataSection = [OWSTableSection new];

@ -10,16 +10,18 @@ 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
] ]
@ -76,7 +78,8 @@ import LocalAuthentication
return 0 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) { @objc public func setScreenLockTimeout(_ value: TimeInterval) {

@ -147,8 +147,9 @@ NS_ASSUME_NONNULL_BEGIN
// Show 'Screen Protection' if: // Show 'Screen Protection' if:
// //
// * App is inactive and... // * App is inactive and...
// * 'Screen Protection' is enabled. // * Either 'Screen Protection' or 'Screen Lock' is enabled.
BOOL shouldHaveScreenProtection = (self.appIsInactive && Environment.preferences.screenSecurityIsEnabled); BOOL shouldHaveScreenProtection = (self.appIsInactive
&& (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" = "Instant"; "SCREEN_LOCK_ACTIVITY_TIMEOUT_NONE" = "None";
/* 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