mirror of https://github.com/oxen-io/session-ios
Merge pull request #1305 from WhisperSystems/default-screen-security
Enable screen security by default / code cleanuppull/1/head
commit
b29174a374
@ -1,10 +1,7 @@
|
|||||||
#import <Foundation/Foundation.h>
|
|
||||||
|
|
||||||
@interface PropertyListPreferences : NSObject
|
@interface PropertyListPreferences : NSObject
|
||||||
|
|
||||||
- (id)tryGetValueForKey:(NSString *)key;
|
- (id)tryGetValueForKey:(NSString *)key;
|
||||||
- (void)setValueForKey:(NSString *)key toValue:(id)value;
|
- (void)setValueForKey:(NSString *)key toValue:(id)value;
|
||||||
- (id)adjustAndTryGetNewValueForKey:(NSString *)key afterAdjuster:(id (^)(id oldValue))adjuster;
|
|
||||||
- (void)clear;
|
- (void)clear;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
@ -1,19 +0,0 @@
|
|||||||
//
|
|
||||||
// SettingsTableViewCell.h
|
|
||||||
// Signal
|
|
||||||
//
|
|
||||||
// Created by Dylan Bourgeois on 11/11/14.
|
|
||||||
// Copyright (c) 2014 Open Whisper Systems. All rights reserved.
|
|
||||||
//
|
|
||||||
|
|
||||||
#import <UIKit/UIKit.h>
|
|
||||||
|
|
||||||
@interface SettingsTableViewCell : UITableViewCell
|
|
||||||
|
|
||||||
- (void)updateImageQualityLabel;
|
|
||||||
|
|
||||||
// Optionals
|
|
||||||
@property (nonatomic, strong) IBOutlet UISwitch *toggle;
|
|
||||||
@property (nonatomic, strong) IBOutlet UILabel *detailLabel;
|
|
||||||
|
|
||||||
@end
|
|
@ -1,65 +0,0 @@
|
|||||||
//
|
|
||||||
// SettingsTableViewCell.m
|
|
||||||
// Signal
|
|
||||||
//
|
|
||||||
// Created by Dylan Bourgeois on 11/11/14.
|
|
||||||
// Copyright (c) 2014 Open Whisper Systems. All rights reserved.
|
|
||||||
//
|
|
||||||
|
|
||||||
#import "SettingsTableViewCell.h"
|
|
||||||
|
|
||||||
#import "Environment.h"
|
|
||||||
#import "PreferencesUtil.h"
|
|
||||||
|
|
||||||
@implementation SettingsTableViewCell
|
|
||||||
|
|
||||||
- (void)awakeFromNib {
|
|
||||||
if (self.toggle) {
|
|
||||||
[self.toggle setOn:[Environment.preferences screenSecurityIsEnabled]];
|
|
||||||
[self.toggle addTarget:self action:@selector(toggleSetting:) forControlEvents:UIControlEventValueChanged];
|
|
||||||
}
|
|
||||||
|
|
||||||
if ([self.reuseIdentifier isEqualToString:@"imageUploadQuality"]) {
|
|
||||||
[self updateImageQualityLabel];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
|
|
||||||
[super setSelected:selected animated:animated];
|
|
||||||
}
|
|
||||||
|
|
||||||
#pragma mark - UISwitch
|
|
||||||
|
|
||||||
- (void)toggleSetting:(id)sender {
|
|
||||||
if ([self.reuseIdentifier isEqualToString:@"enableScreenSecurity"]) {
|
|
||||||
[Environment.preferences setScreenSecurity:self.toggle.isOn];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#pragma mark - Detail Label
|
|
||||||
|
|
||||||
- (void)updateImageQualityLabel {
|
|
||||||
/* this is currently unused, thus unlocalized. code should probably be excised as this will never be part of design
|
|
||||||
*/
|
|
||||||
switch ([Environment.preferences imageUploadQuality]) {
|
|
||||||
case TSImageQualityUncropped:
|
|
||||||
self.detailLabel.text = @"Full";
|
|
||||||
break;
|
|
||||||
case TSImageQualityHigh:
|
|
||||||
self.detailLabel.text = @"High";
|
|
||||||
break;
|
|
||||||
case TSImageQualityMedium:
|
|
||||||
self.detailLabel.text = @"Medium";
|
|
||||||
break;
|
|
||||||
case TSImageQualityLow:
|
|
||||||
self.detailLabel.text = @"Low";
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
DDLogWarn(@"Unknown Image Quality setting : %lu <%s>",
|
|
||||||
(unsigned long)[Environment.preferences imageUploadQuality],
|
|
||||||
__PRETTY_FUNCTION__);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@end
|
|
Loading…
Reference in New Issue