diff --git a/Signal/src/AppDelegate.m b/Signal/src/AppDelegate.m index 7db85c563..8ea3038e2 100644 --- a/Signal/src/AppDelegate.m +++ b/Signal/src/AppDelegate.m @@ -87,8 +87,6 @@ [self performUpdateCheck]; - [self prepareScreenshotProtection]; - self.notificationTracker = [NotificationTracker notificationTracker]; CategorizingLogger* logger = [CategorizingLogger categorizingLogger]; @@ -120,6 +118,8 @@ [self.window makeKeyAndVisible]; + [self prepareScreenshotProtection]; + [Environment.phoneManager.currentCallObservable watchLatestValue:^(CallState* latestCall) { if (latestCall == nil){ return; @@ -245,6 +245,10 @@ } } +- (void)applicationWillResignActive:(UIApplication *)application{ + [self protectScreen]; +} + - (void)application:(UIApplication *)application handleActionWithIdentifier:(NSString *)identifier forRemoteNotification:(NSDictionary *)userInfo completionHandler:(void (^)())completionHandler{ if ([identifier isEqualToString:Signal_Call_Accept_Identifier]) { [self.callPickUpFuture trySetResult:@YES]; @@ -276,12 +280,9 @@ - (void)protectScreen{ if (Environment.preferences.screenSecurityIsEnabled) { self.blankWindow.rootViewController = [UIViewController new]; + UIImageView *imageView = [[UIImageView alloc] initWithFrame:self.blankWindow.bounds]; - if (self.blankWindow.bounds.size.height == 568) { - imageView.image = [UIImage imageNamed:@"Default-568h"]; - } else { - imageView.image = [UIImage imageNamed:@"Default"]; - } + imageView.backgroundColor = [UIColor whiteColor]; imageView.opaque = YES; [self.blankWindow.rootViewController.view addSubview:imageView]; self.blankWindow.hidden = NO; diff --git a/Signal/src/Storyboard/Storyboard.storyboard b/Signal/src/Storyboard/Storyboard.storyboard index 793f8023d..5b72e1ebf 100755 --- a/Signal/src/Storyboard/Storyboard.storyboard +++ b/Signal/src/Storyboard/Storyboard.storyboard @@ -1,7 +1,7 @@ - + - + @@ -2393,7 +2393,7 @@ Licensed under the GPLv3 - + diff --git a/Signal/src/view controllers/SettingsTableViewCell.m b/Signal/src/view controllers/SettingsTableViewCell.m index f00ad29ed..3f8e37461 100644 --- a/Signal/src/view controllers/SettingsTableViewCell.m +++ b/Signal/src/view controllers/SettingsTableViewCell.m @@ -8,11 +8,14 @@ #import "SettingsTableViewCell.h" +#import "Environment.h" +#import "PreferencesUtil.h" + @implementation SettingsTableViewCell - (void)awakeFromNib { // Initialization code - + [self.toggle setOn:[Environment.preferences screenSecurityIsEnabled]]; [self.toggle addTarget:self action:@selector(toggleSetting:) forControlEvents:UIControlEventValueChanged]; } @@ -27,9 +30,10 @@ -(void)toggleSetting:(id)sender { - if ([self.reuseIdentifier isEqualToString:@"hideContactImages"]) + if ([self.reuseIdentifier isEqualToString:@"enableScreenSecurity"]) { self.state.text = self.toggle.isOn ? @"Yes" : @"No"; + [Environment.preferences setScreenSecurity:self.toggle.isOn]; } }