From b2fba060d882b04302dac1e2230cfeaf1ccdc34a Mon Sep 17 00:00:00 2001 From: Matthew Chen Date: Tue, 9 May 2017 14:59:28 -0400 Subject: [PATCH] Fix edge case where screen protection is not removed. // FREEBIE --- Signal/src/AppDelegate.m | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/Signal/src/AppDelegate.m b/Signal/src/AppDelegate.m index d15c7a04b..b3289cdfa 100644 --- a/Signal/src/AppDelegate.m +++ b/Signal/src/AppDelegate.m @@ -417,7 +417,10 @@ static NSString *const kURLHostVerifyPrefix = @"verify"; dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ if ([TSAccountManager isRegistered]) { dispatch_sync(dispatch_get_main_queue(), ^{ - [self protectScreen]; + if ([UIApplication sharedApplication].applicationState != UIApplicationStateActive) { + // If app has not re-entered active, show screen protection if necessary. + [self showScreenProtection]; + } [[[Environment getCurrent] signalsViewController] updateInboxCountLabel]; }); } @@ -603,16 +606,15 @@ static NSString *const kURLHostVerifyPrefix = @"verify"; self.screenProtectionWindow = window; } -- (void)protectScreen { +- (void)showScreenProtection +{ if (Environment.preferences.screenSecurityIsEnabled) { self.screenProtectionWindow.hidden = NO; } } - (void)removeScreenProtection { - if (Environment.preferences.screenSecurityIsEnabled) { - self.screenProtectionWindow.hidden = YES; - } + self.screenProtectionWindow.hidden = YES; } #pragma mark Push Notifications Delegate Methods