mirror of
https://github.com/oxen-io/session-ios.git
synced 2023-12-13 21:30:14 +01:00
General: Screenshot protection (closes #216)
This commit is contained in:
parent
67a1a41330
commit
e70fd6391b
3 changed files with 17 additions and 12 deletions
|
@ -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;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="6254" systemVersion="14B25" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="kts-vO-ui1">
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="6250" systemVersion="14C68k" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="kts-vO-ui1">
|
||||
<dependencies>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6247"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6244"/>
|
||||
<capability name="Alignment constraints with different attributes" minToolsVersion="5.1"/>
|
||||
<capability name="Constraints to layout margins" minToolsVersion="6.0"/>
|
||||
</dependencies>
|
||||
|
@ -2393,7 +2393,7 @@ Licensed under the GPLv3</string>
|
|||
</tableViewSection>
|
||||
<tableViewSection id="JqD-8c-dMF">
|
||||
<cells>
|
||||
<tableViewCell contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" rowHeight="60" id="quP-Cu-8LE" customClass="SettingsTableViewCell">
|
||||
<tableViewCell contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" reuseIdentifier="enableScreenSecurity" rowHeight="60" id="quP-Cu-8LE" customClass="SettingsTableViewCell">
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="quP-Cu-8LE" id="i03-Ww-QZz">
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
|
|
|
@ -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];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue