Implement notification & privacy settings screens redesign

This commit is contained in:
Niels Andriesse 2019-12-06 09:25:26 +11:00
parent 16ab9de5be
commit 83fe454b07
8 changed files with 110 additions and 27 deletions

View File

@ -22,7 +22,7 @@ final class Values : NSObject {
@objc static let verySmallProfilePictureSize = CGFloat(26)
@objc static let smallProfilePictureSize = CGFloat(35)
@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 conversationCellStatusIndicatorSize = CGFloat(14)
@objc static let searchBarHeight = CGFloat(36)

View File

@ -25,7 +25,7 @@ final class SettingsVC : UIViewController {
private lazy var displayNameLabel: UILabel = {
let result = UILabel()
result.textColor = Colors.text
result.font = .boldSystemFont(ofSize: Values.largeFontSize)
result.font = .boldSystemFont(ofSize: Values.veryLargeFontSize)
result.lineBreakMode = .byTruncatingTail
return result
}()
@ -102,7 +102,13 @@ final class SettingsVC : UIViewController {
topStackView.layoutMargins = UIEdgeInsets(top: 0, left: Values.largeSpacing, bottom: 0, right: Values.largeSpacing)
topStackView.isLayoutMarginsRelativeArrangement = true
// 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.alignment = .fill
// Set up stack view

View File

@ -6,6 +6,7 @@
#import "Session-Swift.h"
#import "SignalApp.h"
#import <SignalMessaging/Environment.h>
#import "Session-Swift.h"
@implementation NotificationSettingsOptionsViewController
@ -14,6 +15,24 @@
[super viewDidLoad];
[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
@ -36,7 +55,7 @@
[section addItem:[OWSTableItem
itemWithCustomCellBlock:^{
UITableViewCell *cell = [OWSTableItem newCell];
cell.tintColor = UIColor.lokiGreen;
cell.tintColor = LKColors.accent;
[[cell textLabel] setText:[prefs nameForNotificationPreviewType:notificationType]];
if (selectedNotifType == notificationType) {
cell.accessoryType = UITableViewCellAccessoryCheckmark;

View File

@ -17,11 +17,29 @@
{
[super viewDidLoad];
[self setTitle:NSLocalizedString(@"SETTINGS_NOTIFICATIONS", nil)];
[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
@ -85,7 +103,7 @@
[weakSelf.navigationController pushViewController:vc animated:YES];
}]];
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];
self.contents = contents;

View File

@ -8,6 +8,7 @@
#import <SignalMessaging/OWSSounds.h>
#import <SignalMessaging/SignalMessaging-Swift.h>
#import <SignalMessaging/UIUtil.h>
#import "Session-Swift.h"
NS_ASSUME_NONNULL_BEGIN
@ -36,6 +37,24 @@ NS_ASSUME_NONNULL_BEGIN
[self updateTableContents];
[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
@ -52,6 +71,9 @@ NS_ASSUME_NONNULL_BEGIN
target:self
action:@selector(cancelWasPressed:)
accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"cancel")];
cancelItem.tintColor = [UIColor colorWithRGBHex:0xFFFFFF]; // Colors.text
self.navigationItem.leftBarButtonItem = cancelItem;
if (self.isDirty) {

View File

@ -25,13 +25,27 @@ static NSString *const kSealedSenderInfoURL = @"https://signal.org/blog/sealed-s
{
[super viewDidLoad];
self.title = NSLocalizedString(@"SETTINGS_PRIVACY_TITLE", @"");
[self observeNotifications];
[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
@ -140,7 +154,7 @@ static NSString *const kSealedSenderInfoURL = @"https://signal.org/blog/sealed-s
OWSTableSection *screenLockSection = [OWSTableSection new];
screenLockSection.headerTitle = NSLocalizedString(
@"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
addItem:[OWSTableItem
switchItemWithText:NSLocalizedString(@"SETTINGS_SCREEN_LOCK_SWITCH_LABEL",

View File

@ -2716,3 +2716,7 @@
"QR Code" = "QR Code";
"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.";
"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";

View File

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