Implement notification & privacy settings screens redesign

pull/68/head
Niels Andriesse 5 years ago
parent 16ab9de5be
commit 83fe454b07

@ -22,7 +22,7 @@ final class Values : NSObject {
@objc static let verySmallProfilePictureSize = CGFloat(26) @objc static let verySmallProfilePictureSize = CGFloat(26)
@objc static let smallProfilePictureSize = CGFloat(35) @objc static let smallProfilePictureSize = CGFloat(35)
@objc static let mediumProfilePictureSize = CGFloat(45) @objc static let mediumProfilePictureSize = CGFloat(45)
@objc static let largeProfilePictureSize = CGFloat(65) @objc static let largeProfilePictureSize = CGFloat(75)
@objc static let borderThickness = CGFloat(1) @objc static let borderThickness = CGFloat(1)
@objc static let conversationCellStatusIndicatorSize = CGFloat(14) @objc static let conversationCellStatusIndicatorSize = CGFloat(14)
@objc static let searchBarHeight = CGFloat(36) @objc static let searchBarHeight = CGFloat(36)

@ -25,7 +25,7 @@ final class SettingsVC : UIViewController {
private lazy var displayNameLabel: UILabel = { private lazy var displayNameLabel: UILabel = {
let result = UILabel() let result = UILabel()
result.textColor = Colors.text result.textColor = Colors.text
result.font = .boldSystemFont(ofSize: Values.largeFontSize) result.font = .boldSystemFont(ofSize: Values.veryLargeFontSize)
result.lineBreakMode = .byTruncatingTail result.lineBreakMode = .byTruncatingTail
return result return result
}() }()
@ -102,7 +102,13 @@ final class SettingsVC : UIViewController {
topStackView.layoutMargins = UIEdgeInsets(top: 0, left: Values.largeSpacing, bottom: 0, right: Values.largeSpacing) topStackView.layoutMargins = UIEdgeInsets(top: 0, left: Values.largeSpacing, bottom: 0, right: Values.largeSpacing)
topStackView.isLayoutMarginsRelativeArrangement = true topStackView.isLayoutMarginsRelativeArrangement = true
// Set up setting buttons stack view // Set up setting buttons stack view
let settingButtonsStackView = UIStackView(arrangedSubviews: getSettingButtons()) func getSeparator() -> UIView {
let result = UIView()
result.backgroundColor = Colors.separator
result.set(.height, to: Values.separatorThickness)
return result
}
let settingButtonsStackView = UIStackView(arrangedSubviews: [ getSeparator() ] + getSettingButtons() + [ getSeparator() ] )
settingButtonsStackView.axis = .vertical settingButtonsStackView.axis = .vertical
settingButtonsStackView.alignment = .fill settingButtonsStackView.alignment = .fill
// Set up stack view // Set up stack view

@ -6,6 +6,7 @@
#import "Session-Swift.h" #import "Session-Swift.h"
#import "SignalApp.h" #import "SignalApp.h"
#import <SignalMessaging/Environment.h> #import <SignalMessaging/Environment.h>
#import "Session-Swift.h"
@implementation NotificationSettingsOptionsViewController @implementation NotificationSettingsOptionsViewController
@ -14,6 +15,24 @@
[super viewDidLoad]; [super viewDidLoad];
[self updateTableContents]; [self updateTableContents];
LKGradient *gradient = LKGradients.defaultLokiBackground;
self.view.backgroundColor = UIColor.clearColor;
[self.view setGradient:gradient];
self.tableView.backgroundColor = UIColor.clearColor;
UINavigationBar *navigationBar = self.navigationController.navigationBar;
[navigationBar setBackgroundImage:[UIImage new] forBarMetrics:UIBarMetricsDefault];
navigationBar.shadowImage = [UIImage new];
[navigationBar setTranslucent:NO];
navigationBar.barTintColor = LKColors.navigationBarBackground;
UILabel *titleLabel = [UILabel new];
titleLabel.text = NSLocalizedString(@"Content", @"");
titleLabel.textColor = LKColors.text;
titleLabel.font = [UIFont boldSystemFontOfSize:LKValues.veryLargeFontSize];
self.navigationItem.titleView = titleLabel;
} }
#pragma mark - Table Contents #pragma mark - Table Contents
@ -36,7 +55,7 @@
[section addItem:[OWSTableItem [section addItem:[OWSTableItem
itemWithCustomCellBlock:^{ itemWithCustomCellBlock:^{
UITableViewCell *cell = [OWSTableItem newCell]; UITableViewCell *cell = [OWSTableItem newCell];
cell.tintColor = UIColor.lokiGreen; cell.tintColor = LKColors.accent;
[[cell textLabel] setText:[prefs nameForNotificationPreviewType:notificationType]]; [[cell textLabel] setText:[prefs nameForNotificationPreviewType:notificationType]];
if (selectedNotifType == notificationType) { if (selectedNotifType == notificationType) {
cell.accessoryType = UITableViewCellAccessoryCheckmark; cell.accessoryType = UITableViewCellAccessoryCheckmark;

@ -17,11 +17,29 @@
{ {
[super viewDidLoad]; [super viewDidLoad];
[self setTitle:NSLocalizedString(@"SETTINGS_NOTIFICATIONS", nil)];
[self updateTableContents]; [self updateTableContents];
[LKAnalytics.shared track:@"Notification Settings Opened"]; LKGradient *gradient = LKGradients.defaultLokiBackground;
self.view.backgroundColor = UIColor.clearColor;
[self.view setGradient:gradient];
self.tableView.backgroundColor = UIColor.clearColor;
UINavigationBar *navigationBar = self.navigationController.navigationBar;
[navigationBar setBackgroundImage:[UIImage new] forBarMetrics:UIBarMetricsDefault];
navigationBar.shadowImage = [UIImage new];
[navigationBar setTranslucent:NO];
navigationBar.barTintColor = LKColors.navigationBarBackground;
UILabel *titleLabel = [UILabel new];
titleLabel.text = NSLocalizedString(@"Notifications", @"");
titleLabel.textColor = LKColors.text;
titleLabel.font = [UIFont boldSystemFontOfSize:LKValues.veryLargeFontSize];
self.navigationItem.titleView = titleLabel;
UIBarButtonItem *backButton = [[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"Back", "") style:UIBarButtonItemStylePlain target:nil action:nil];
backButton.tintColor = LKColors.text;
self.navigationItem.backBarButtonItem = backButton;
} }
- (void)viewDidAppear:(BOOL)animated - (void)viewDidAppear:(BOOL)animated
@ -85,7 +103,7 @@
[weakSelf.navigationController pushViewController:vc animated:YES]; [weakSelf.navigationController pushViewController:vc animated:YES];
}]]; }]];
backgroundSection.footerTitle backgroundSection.footerTitle
= NSLocalizedString(@"SETTINGS_NOTIFICATION_CONTENT_DESCRIPTION", @"table section footer"); = NSLocalizedString(@"Notifications can appear while your phone is locked. You may wish to limit what is shown in these notifications.", @"");
[contents addSection:backgroundSection]; [contents addSection:backgroundSection];
self.contents = contents; self.contents = contents;

@ -8,6 +8,7 @@
#import <SignalMessaging/OWSSounds.h> #import <SignalMessaging/OWSSounds.h>
#import <SignalMessaging/SignalMessaging-Swift.h> #import <SignalMessaging/SignalMessaging-Swift.h>
#import <SignalMessaging/UIUtil.h> #import <SignalMessaging/UIUtil.h>
#import "Session-Swift.h"
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
@ -36,6 +37,24 @@ NS_ASSUME_NONNULL_BEGIN
[self updateTableContents]; [self updateTableContents];
[self updateNavigationItems]; [self updateNavigationItems];
LKGradient *gradient = LKGradients.defaultLokiBackground;
self.view.backgroundColor = UIColor.clearColor;
[self.view setGradient:gradient];
self.tableView.backgroundColor = UIColor.clearColor;
UINavigationBar *navigationBar = self.navigationController.navigationBar;
[navigationBar setBackgroundImage:[UIImage new] forBarMetrics:UIBarMetricsDefault];
navigationBar.shadowImage = [UIImage new];
[navigationBar setTranslucent:NO];
navigationBar.barTintColor = LKColors.navigationBarBackground;
UILabel *titleLabel = [UILabel new];
titleLabel.text = NSLocalizedString(@"Sound", @"");
titleLabel.textColor = LKColors.text;
titleLabel.font = [UIFont boldSystemFontOfSize:LKValues.veryLargeFontSize];
self.navigationItem.titleView = titleLabel;
} }
- (void)viewDidAppear:(BOOL)animated - (void)viewDidAppear:(BOOL)animated
@ -52,6 +71,9 @@ NS_ASSUME_NONNULL_BEGIN
target:self target:self
action:@selector(cancelWasPressed:) action:@selector(cancelWasPressed:)
accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"cancel")]; accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"cancel")];
cancelItem.tintColor = [UIColor colorWithRGBHex:0xFFFFFF]; // Colors.text
self.navigationItem.leftBarButtonItem = cancelItem; self.navigationItem.leftBarButtonItem = cancelItem;
if (self.isDirty) { if (self.isDirty) {

@ -25,13 +25,27 @@ static NSString *const kSealedSenderInfoURL = @"https://signal.org/blog/sealed-s
{ {
[super viewDidLoad]; [super viewDidLoad];
self.title = NSLocalizedString(@"SETTINGS_PRIVACY_TITLE", @"");
[self observeNotifications]; [self observeNotifications];
[self updateTableContents]; [self updateTableContents];
[LKAnalytics.shared track:@"Privacy Settings Opened"]; LKGradient *gradient = LKGradients.defaultLokiBackground;
self.view.backgroundColor = UIColor.clearColor;
[self.view setGradient:gradient];
self.tableView.backgroundColor = UIColor.clearColor;
UINavigationBar *navigationBar = self.navigationController.navigationBar;
[navigationBar setBackgroundImage:[UIImage new] forBarMetrics:UIBarMetricsDefault];
navigationBar.shadowImage = [UIImage new];
[navigationBar setTranslucent:NO];
navigationBar.barTintColor = LKColors.navigationBarBackground;
UILabel *titleLabel = [UILabel new];
titleLabel.text = NSLocalizedString(@"Privacy", @"");
titleLabel.textColor = LKColors.text;
titleLabel.font = [UIFont boldSystemFontOfSize:LKValues.veryLargeFontSize];
self.navigationItem.titleView = titleLabel;
} }
- (void)viewDidAppear:(BOOL)animated - (void)viewDidAppear:(BOOL)animated
@ -140,7 +154,7 @@ static NSString *const kSealedSenderInfoURL = @"https://signal.org/blog/sealed-s
OWSTableSection *screenLockSection = [OWSTableSection new]; OWSTableSection *screenLockSection = [OWSTableSection new];
screenLockSection.headerTitle = NSLocalizedString( screenLockSection.headerTitle = NSLocalizedString(
@"SETTINGS_SCREEN_LOCK_SECTION_TITLE", @"Title for the 'screen lock' section of the privacy settings."); @"SETTINGS_SCREEN_LOCK_SECTION_TITLE", @"Title for the 'screen lock' section of the privacy settings.");
screenLockSection.footerTitle = NSLocalizedString(@"Unlock Loki Messenger's screen using Touch ID, Face ID, or your iOS device passcode. You can still answer incoming calls and receive message notifications while Screen Lock is enabled. Loki Messenger's notification settings allow you to customize the information that is displayed.", @""); screenLockSection.footerTitle = NSLocalizedString(@"Unlock Loki Messenger's screen using Touch ID, Face ID, or your iOS device passcode. You can still receive message notifications while Screen Lock is enabled. Loki Messenger's notification settings allow you to customize the information that is displayed.", @"");
[screenLockSection [screenLockSection
addItem:[OWSTableItem addItem:[OWSTableItem
switchItemWithText:NSLocalizedString(@"SETTINGS_SCREEN_LOCK_SWITCH_LABEL", switchItemWithText:NSLocalizedString(@"SETTINGS_SCREEN_LOCK_SWITCH_LABEL",

@ -2716,3 +2716,7 @@
"QR Code" = "QR Code"; "QR Code" = "QR Code";
"Scan Me" = "Scan Me"; "Scan Me" = "Scan Me";
"This is your unique public QR code. Other users may scan this in order to begin a conversation with you." = "This is your unique public QR code. Other users may scan this in order to begin a conversation with you."; "This is your unique public QR code. Other users may scan this in order to begin a conversation with you." = "This is your unique public QR code. Other users may scan this in order to begin a conversation with you.";
"Privacy" = "Privacy";
"Unlock Loki Messenger's screen using Touch ID, Face ID, or your iOS device passcode. You can still receive message notifications while Screen Lock is enabled. Loki Messenger's notification settings allow you to customize the information that is displayed." = "Unlock Loki Messenger's screen using Touch ID, Face ID, or your iOS device passcode. You can still receive message notifications while Screen Lock is enabled. Loki Messenger's notification settings allow you to customize the information that is displayed.";
"Sound" = "Sound";
"Content" = "Content";

@ -108,18 +108,20 @@ const CGFloat kOWSTable_DefaultCellHeight = 45.f;
+ (void)configureCell:(UITableViewCell *)cell + (void)configureCell:(UITableViewCell *)cell
{ {
cell.backgroundColor = [Theme backgroundColor]; cell.backgroundColor = [UIColor colorWithRGBHex:0x1B1B1B]; // Colors.cellBackground
if (@available(iOS 13, *)) { if (@available(iOS 13, *)) {
cell.contentView.backgroundColor = UIColor.clearColor; cell.contentView.backgroundColor = UIColor.clearColor;
} else { } else {
cell.contentView.backgroundColor = Theme.backgroundColor; cell.contentView.backgroundColor = [UIColor colorWithRGBHex:0x1B1B1B]; // Colors.cellBackground
} }
cell.textLabel.font = [UIFont ows_regularFontWithSize:18.f];
cell.textLabel.textColor = [Theme primaryColor]; cell.textLabel.font = [UIFont systemFontOfSize:15]; // Values.mediumFontSize
cell.detailTextLabel.textColor = [Theme secondaryColor]; cell.textLabel.textColor = [UIColor colorWithRGBHex:0xFFFFFF]; // Colors.text
cell.detailTextLabel.font = [UIFont systemFontOfSize:15]; // Values.mediumFontSize
cell.detailTextLabel.textColor = [UIColor colorWithRGBHex:0xFFFFFF]; // Colors.text
UIView *selectedBackgroundView = [UIView new]; UIView *selectedBackgroundView = [UIView new];
selectedBackgroundView.backgroundColor = Theme.cellSelectedColor; selectedBackgroundView.backgroundColor = [UIColor colorWithRGBHex:0x0C0C0C]; // Colors.cellSelected
cell.selectedBackgroundView = selectedBackgroundView; cell.selectedBackgroundView = selectedBackgroundView;
} }
@ -181,7 +183,7 @@ const CGFloat kOWSTable_DefaultCellHeight = 45.f;
return [self itemWithText:text return [self itemWithText:text
accessibilityIdentifier:accessibilityIdentifier accessibilityIdentifier:accessibilityIdentifier
actionBlock:actionBlock actionBlock:actionBlock
accessoryType:UITableViewCellAccessoryDisclosureIndicator]; accessoryType:UITableViewCellAccessoryNone];
} }
+ (OWSTableItem *)checkmarkItemWithText:(NSString *)text actionBlock:(nullable OWSTableActionBlock)actionBlock + (OWSTableItem *)checkmarkItemWithText:(NSString *)text actionBlock:(nullable OWSTableActionBlock)actionBlock
@ -221,7 +223,7 @@ const CGFloat kOWSTable_DefaultCellHeight = 45.f;
cell.textLabel.text = text; cell.textLabel.text = text;
cell.accessoryType = accessoryType; cell.accessoryType = accessoryType;
cell.accessibilityIdentifier = accessibilityIdentifier; cell.accessibilityIdentifier = accessibilityIdentifier;
cell.tintColor = UIColor.lokiGreen; cell.tintColor = [UIColor colorWithRGBHex:0x00F782]; // Colors.accent
return cell; return cell;
}; };
return item; return item;
@ -273,7 +275,6 @@ const CGFloat kOWSTable_DefaultCellHeight = 45.f;
[OWSTableItem configureCell:cell]; [OWSTableItem configureCell:cell];
cell.textLabel.text = text; cell.textLabel.text = text;
cell.detailTextLabel.text = detailText; cell.detailTextLabel.text = detailText;
[cell setAccessoryType:UITableViewCellAccessoryDisclosureIndicator];
cell.accessibilityIdentifier = accessibilityIdentifier; cell.accessibilityIdentifier = accessibilityIdentifier;
return cell; return cell;
}; };
@ -299,7 +300,6 @@ const CGFloat kOWSTable_DefaultCellHeight = 45.f;
item.customCellBlock = ^{ item.customCellBlock = ^{
UITableViewCell *cell = [OWSTableItem newCell]; UITableViewCell *cell = [OWSTableItem newCell];
cell.textLabel.text = text; cell.textLabel.text = text;
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
return cell; return cell;
}; };
return item; return item;
@ -350,10 +350,10 @@ const CGFloat kOWSTable_DefaultCellHeight = 45.f;
// These cells look quite different. // These cells look quite different.
// //
// Smaller font. // Smaller font.
cell.textLabel.font = [UIFont ows_regularFontWithSize:15.f]; cell.textLabel.font = [UIFont systemFontOfSize:15]; // Values.mediumFontSize
// Soft color. // Soft color.
// TODO: Theme, review with design. // TODO: Theme, review with design.
cell.textLabel.textColor = Theme.middleGrayColor; cell.textLabel.textColor = [UIColor colorWithRGBHex:0xFFFFFF]; // Colors.text
// Centered. // Centered.
cell.textLabel.textAlignment = NSTextAlignmentCenter; cell.textLabel.textAlignment = NSTextAlignmentCenter;
cell.userInteractionEnabled = NO; cell.userInteractionEnabled = NO;
@ -397,8 +397,8 @@ const CGFloat kOWSTable_DefaultCellHeight = 45.f;
UILabel *accessoryLabel = [UILabel new]; UILabel *accessoryLabel = [UILabel new];
accessoryLabel.text = accessoryText; accessoryLabel.text = accessoryText;
accessoryLabel.textColor = [Theme secondaryColor]; accessoryLabel.textColor = [UIColor colorWithRGBHex:0xFFFFFF]; // Colors.text
accessoryLabel.font = [UIFont ows_regularFontWithSize:16.0f]; accessoryLabel.font = [UIFont systemFontOfSize:15]; // Values.mediumFontSize
accessoryLabel.textAlignment = NSTextAlignmentRight; accessoryLabel.textAlignment = NSTextAlignmentRight;
[accessoryLabel sizeToFit]; [accessoryLabel sizeToFit];
cell.accessoryView = accessoryLabel; cell.accessoryView = accessoryLabel;
@ -420,7 +420,6 @@ const CGFloat kOWSTable_DefaultCellHeight = 45.f;
cell.textLabel.text = text; cell.textLabel.text = text;
cell.textLabel.numberOfLines = 0; cell.textLabel.numberOfLines = 0;
cell.textLabel.lineBreakMode = NSLineBreakByWordWrapping; cell.textLabel.lineBreakMode = NSLineBreakByWordWrapping;
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
return cell; return cell;
}; };
@ -476,6 +475,7 @@ const CGFloat kOWSTable_DefaultCellHeight = 45.f;
UISwitch *cellSwitch = [UISwitch new]; UISwitch *cellSwitch = [UISwitch new];
cell.accessoryView = cellSwitch; cell.accessoryView = cellSwitch;
cellSwitch.onTintColor = [UIColor colorWithRGBHex:0x00F782]; // Colors.accent
[cellSwitch setOn:isOnBlock()]; [cellSwitch setOn:isOnBlock()];
[cellSwitch addTarget:weakTarget action:selector forControlEvents:UIControlEventValueChanged]; [cellSwitch addTarget:weakTarget action:selector forControlEvents:UIControlEventValueChanged];
cellSwitch.enabled = isEnabledBlock(); cellSwitch.enabled = isEnabledBlock();

Loading…
Cancel
Save