Merge branch 'mkirk/tweak-navbar'

pull/1/head
Michael Kirk 7 years ago
commit 3ee16a0e34

@ -171,7 +171,7 @@ static NSTimeInterval launchStartedAt;
[self versionMigrationsDidComplete];
}];
[UIUtil applySignalAppearence];
[UIUtil setupSignalAppearence];
if (CurrentAppContext().isRunningTests) {
return YES;

@ -87,17 +87,6 @@ class AddContactShareToExistingContactViewController: ContactsPicker, ContactsPi
contactViewController.delegate = self
let modal = OWSNavigationController(rootViewController: contactViewController)
// HACK otherwise CNContactViewController Navbar is shows window background color.
// RADAR rdar://28433898 http://www.openradar.me/28433898
// CNContactViewController incompatible with opaque navigation bar
modal.navigationBar.isTranslucent = true
if #available(iOS 10, *) {
// Contact navbar is blue in iOS9, so our white text works,
// but gray on iOS10+, in which case we want the system default black text.
UIUtil.applyDefaultSystemAppearence()
}
self.present(modal, animated: true)
}
@ -146,16 +135,6 @@ class AddContactShareToExistingContactViewController: ContactsPicker, ContactsPi
return
}
// HACK otherwise CNContactViewController Navbar is shows window background color.
// RADAR rdar://28433898 http://www.openradar.me/28433898
// CNContactViewController incompatible with opaque navigation bar
navigationController.navigationBar.isTranslucent = false
if #available(iOS 10, *) {
// Contact navbar is blue in iOS9, so our white text works,
// but gray on iOS10+, in which case we want the system default black text.
UIUtil.applySignalAppearence()
}
let previousViewControllerIndex = navigationController.viewControllers.index(before: myIndex)
let previousViewController = navigationController.viewControllers[previousViewControllerIndex]

@ -81,9 +81,7 @@ NS_ASSUME_NONNULL_BEGIN
picker.sourceType = UIImagePickerControllerSourceTypeCamera;
picker.mediaTypes = @[ (__bridge NSString *)kUTTypeImage ];
[self.delegate.fromViewController presentViewController:picker
animated:YES
completion:[UIUtil modalCompletionBlock]];
[self.delegate.fromViewController presentViewController:picker animated:YES completion:nil];
}];
}
@ -103,9 +101,7 @@ NS_ASSUME_NONNULL_BEGIN
picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
picker.mediaTypes = @[ (__bridge NSString *)kUTTypeImage ];
[self.delegate.fromViewController presentViewController:picker
animated:YES
completion:[UIUtil modalCompletionBlock]];
[self.delegate.fromViewController presentViewController:picker animated:YES completion:nil];
}];
}
@ -144,10 +140,9 @@ NS_ASSUME_NONNULL_BEGIN
[self.delegate avatarDidChange:dstImage];
});
}];
[self.delegate.fromViewController
presentViewController:vc
[self.delegate.fromViewController presentViewController:vc
animated:YES
completion:[UIUtil modalCompletionBlock]];
completion:nil];
}
}];
}

@ -167,16 +167,6 @@ public class ContactShareViewHelper: NSObject, CNContactViewControllerDelegate {
action: #selector(didFinishEditingContact))
let modal = OWSNavigationController(rootViewController: contactViewController)
// HACK otherwise CNContactViewController Navbar is shows window background color.
// RADAR rdar://28433898 http://www.openradar.me/28433898
// CNContactViewController incompatible with opaque navigation bar
modal.navigationBar.isTranslucent = true
if #available(iOS 10, *) {
// Contact navbar is blue in iOS9, so our white text works,
// but gray on iOS10+, in which case we want the system default black text.
UIUtil.applyDefaultSystemAppearence()
}
fromViewController.present(modal, animated: true)
}
@ -197,7 +187,6 @@ public class ContactShareViewHelper: NSObject, CNContactViewControllerDelegate {
}
let viewController = AddContactShareToExistingContactViewController(contactShare: contactShare)
UIUtil.applySignalAppearence()
navigationController.pushViewController(viewController, animated: true)
}
@ -211,7 +200,6 @@ public class ContactShareViewHelper: NSObject, CNContactViewControllerDelegate {
return
}
UIUtil.applySignalAppearence()
delegate.didCreateOrEditContact()
}
@ -223,7 +211,6 @@ public class ContactShareViewHelper: NSObject, CNContactViewControllerDelegate {
return
}
UIUtil.applySignalAppearence()
delegate.didCreateOrEditContact()
}
}

@ -78,12 +78,6 @@ class ContactViewController: OWSViewController, ContactShareViewHelperDelegate {
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
// Use "dark" style status bar in this view,
// But we don't apply the entire default system UI (UIUtil.applyDefaultSystemAppearence) because
// doing so while pushing onto an existing nav controller who's navbars are hidden corrupts the
// title label/navbar items elsewhere in the stack.
CurrentAppContext().setStatusBarStyle(.default)
guard let navigationController = self.navigationController else {
owsFail("\(logTag) in \(#function) navigationController was unexpectedly nil")
return
@ -677,7 +671,6 @@ class ContactViewController: OWSViewController, ContactShareViewHelperDelegate {
Logger.info("\(logTag) \(#function)")
updateContent()
UIUtil.applySignalAppearence()
self.dismiss(animated: true)
}
}

@ -64,13 +64,13 @@ public class ConversationHeaderView: UIStackView {
avatarView.layer.borderWidth = 0
titleLabel = UILabel()
titleLabel.textColor = .white
titleLabel.textColor = .ows_navbarTitle
titleLabel.lineBreakMode = .byTruncatingTail
titleLabel.font = titlePrimaryFont
titleLabel.setContentHuggingHigh()
subtitleLabel = UILabel()
subtitleLabel.textColor = .white
subtitleLabel.textColor = .ows_navbarTitle
subtitleLabel.lineBreakMode = .byTruncatingTail
subtitleLabel.font = subtitleFont
subtitleLabel.setContentHuggingHigh()

@ -35,6 +35,8 @@ NS_ASSUME_NONNULL_BEGIN
@interface ConversationInputToolbar : UIView
- (instancetype)initWithConversationStyle:(ConversationStyle *)conversationStyle NS_DESIGNATED_INITIALIZER;
- (instancetype)initWithCoder:(NSCoder *)aDecoder NS_UNAVAILABLE;
- (instancetype)initWithFrame:(CGRect)frame NS_UNAVAILABLE;
@property (nonatomic, weak) id<ConversationInputToolbarDelegate> inputToolbarDelegate;

@ -70,7 +70,7 @@ static const CGFloat ConversationInputToolbarBorderViewHeight = 0.5;
- (instancetype)initWithConversationStyle:(ConversationStyle *)conversationStyle
{
self = [super init];
self = [super initWithFrame:CGRectZero];
_conversationStyle = conversationStyle;
@ -78,7 +78,6 @@ static const CGFloat ConversationInputToolbarBorderViewHeight = 0.5;
[self createContents];
}
return self;
}
@ -104,7 +103,18 @@ static const CGFloat ConversationInputToolbarBorderViewHeight = 0.5;
{
self.layoutMargins = UIEdgeInsetsZero;
if (UIAccessibilityIsReduceTransparencyEnabled()) {
self.backgroundColor = [UIColor ows_toolbarBackgroundColor];
} else {
// We can mute the blur by making our background color more opaque.
self.backgroundColor = [[UIColor ows_toolbarBackgroundColor] colorWithAlphaComponent:0.6];
UIBlurEffect *blurEffect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleExtraLight];
UIVisualEffectView *blurEffectView = [[UIVisualEffectView alloc] initWithEffect:blurEffect];
[self addSubview:blurEffectView];
[blurEffectView autoPinEdgesToSuperviewEdges];
}
self.autoresizingMask = UIViewAutoresizingFlexibleHeight;
UIView *borderView = [UIView new];

@ -535,6 +535,7 @@ typedef enum : NSUInteger {
{
[super loadView];
// make sure toolbar extends below iPhoneX home button.
self.view.backgroundColor = [UIColor ows_toolbarBackgroundColor];
}
@ -559,15 +560,13 @@ typedef enum : NSUInteger {
self.collectionView.keyboardDismissMode = UIScrollViewKeyboardDismissModeInteractive;
self.collectionView.backgroundColor = [UIColor whiteColor];
[self.view addSubview:self.collectionView];
[self.collectionView autoPinWidthToSuperview];
[self.collectionView autoPinToTopLayoutGuideOfViewController:self withInset:0];
[self.collectionView autoPinEdgesToSuperviewEdges];
[self.collectionView applyScrollViewInsetsFix];
_inputToolbar = [[ConversationInputToolbar alloc] initWithConversationStyle:self.conversationStyle];
self.inputToolbar.inputToolbarDelegate = self;
self.inputToolbar.inputTextViewDelegate = self;
[self.collectionView autoPinToBottomLayoutGuideOfViewController:self withInset:0];
self.loadMoreHeader = [UILabel new];
self.loadMoreHeader.text = NSLocalizedString(@"CONVERSATION_VIEW_LOADING_MORE_MESSAGES",
@ -678,9 +677,6 @@ typedef enum : NSUInteger {
[super viewWillAppear:animated];
// In case we're dismissing a CNContactViewController, or DocumentPicker which requires default system appearance
[UIUtil applySignalAppearence];
// We need to recheck on every appearance, since the user may have left the group in the settings VC,
// or on another device.
[self hideInputIfNeeded];
@ -1325,11 +1321,11 @@ typedef enum : NSUInteger {
if (OWSWindowManager.sharedManager.hasCall) {
callButton.enabled = NO;
callButton.userInteractionEnabled = NO;
callButton.tintColor = UIColor.lightGrayColor;
callButton.tintColor = [UIColor.ows_navbarIconColor colorWithAlphaComponent:0.7];
} else {
callButton.enabled = YES;
callButton.userInteractionEnabled = YES;
callButton.tintColor = UIColor.whiteColor;
callButton.tintColor = UIColor.ows_navbarIconColor;
}
UIEdgeInsets imageEdgeInsets = UIEdgeInsetsZero;
@ -1357,7 +1353,7 @@ typedef enum : NSUInteger {
DisappearingTimerConfigurationView *timerView = [[DisappearingTimerConfigurationView alloc]
initWithDurationSeconds:self.disappearingMessagesConfiguration.durationSeconds];
timerView.delegate = self;
timerView.tintColor = UIColor.whiteColor;
timerView.tintColor = UIColor.ows_navbarIconColor;
// As of iOS11, we can size barButton item custom views with autoLayout.
// Before that, though we can still use autoLayout *within* the customView,
@ -1379,6 +1375,7 @@ typedef enum : NSUInteger {
{
NSMutableAttributedString *subtitleText = [NSMutableAttributedString new];
UIColor *subtitleColor = [UIColor.ows_navbarTitleColor colorWithAlphaComponent:(CGFloat)0.9];
if (self.thread.isMuted) {
// Show a "mute" icon before the navigation bar subtitle if this thread is muted.
[subtitleText
@ -1386,7 +1383,7 @@ typedef enum : NSUInteger {
initWithString:@"\ue067 "
attributes:@{
NSFontAttributeName : [UIFont ows_elegantIconsFont:7.f],
NSForegroundColorAttributeName : [UIColor colorWithWhite:0.9f alpha:1.f],
NSForegroundColorAttributeName : subtitleColor
}]];
}
@ -1405,7 +1402,7 @@ typedef enum : NSUInteger {
initWithString:@"\uf00c "
attributes:@{
NSFontAttributeName : [UIFont ows_fontAwesomeFont:10.f],
NSForegroundColorAttributeName : [UIColor colorWithWhite:0.9f alpha:1.f],
NSForegroundColorAttributeName : subtitleColor,
}]];
}
@ -1415,7 +1412,7 @@ typedef enum : NSUInteger {
initWithString:NSLocalizedString(@"GROUP_YOU_LEFT", @"")
attributes:@{
NSFontAttributeName : self.headerView.subtitleFont,
NSForegroundColorAttributeName : [UIColor colorWithWhite:0.9f alpha:1.f],
NSForegroundColorAttributeName : subtitleColor,
}]];
} else {
[subtitleText appendAttributedString:
@ -1425,7 +1422,7 @@ typedef enum : NSUInteger {
@"title can be tapped to access settings for this conversation.")
attributes:@{
NSFontAttributeName : self.headerView.subtitleFont,
NSForegroundColorAttributeName : [UIColor colorWithWhite:0.9f alpha:1.f],
NSForegroundColorAttributeName : subtitleColor,
}]];
}
@ -2586,8 +2583,7 @@ typedef enum : NSUInteger {
[self.scrollDownButton autoSetDimension:ALDimensionWidth toSize:ConversationScrollButton.buttonSize];
[self.scrollDownButton autoSetDimension:ALDimensionHeight toSize:ConversationScrollButton.buttonSize];
self.scrollDownButtonButtomConstraint =
[self.scrollDownButton autoPinEdge:ALEdgeBottom toEdge:ALEdgeBottom ofView:self.collectionView];
self.scrollDownButtonButtomConstraint = [self.scrollDownButton autoPinEdgeToSuperviewMargin:ALEdgeBottom];
[self.scrollDownButton autoPinEdgeToSuperviewEdge:ALEdgeTrailing];
#ifdef DEBUG
@ -2782,10 +2778,6 @@ typedef enum : NSUInteger {
didPickDocumentPicker:(UIDocumentPickerViewController *)documentPicker
{
documentPicker.delegate = self;
if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(11, 0)) {
// post iOS11, document picker has no blue header.
[UIUtil applyDefaultSystemAppearence];
}
[self dismissKeyBoard];
[self presentViewController:documentPicker animated:YES completion:nil];
@ -2797,16 +2789,6 @@ typedef enum : NSUInteger {
{
DDLogDebug(@"%@ Picked document at url: %@", self.logTag, url);
if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(11, 0)) {
// post iOS11, document picker has no blue header.
[UIUtil applySignalAppearence];
}
if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(11, 0)) {
// post iOS11, document picker has no blue header.
[UIUtil applySignalAppearence];
}
NSString *type;
NSError *typeError;
[url getResourceValue:&type forKey:NSURLTypeIdentifierKey error:&typeError];
@ -2897,7 +2879,7 @@ typedef enum : NSUInteger {
picker.delegate = self;
[self dismissKeyBoard];
[self presentViewController:picker animated:YES completion:[UIUtil modalCompletionBlock]];
[self presentViewController:picker animated:YES completion:nil];
}];
}
@ -2933,7 +2915,7 @@ typedef enum : NSUInteger {
picker.mediaTypes = @[ (__bridge NSString *)kUTTypeImage, (__bridge NSString *)kUTTypeMovie ];
[self dismissKeyBoard];
[self presentViewController:picker animated:YES completion:[UIUtil modalCompletionBlock]];
[self presentViewController:picker animated:YES completion:nil];
}];
}
@ -2943,7 +2925,6 @@ typedef enum : NSUInteger {
- (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker
{
[UIUtil modalCompletionBlock]();
[self dismissViewControllerAnimated:YES completion:nil];
}
@ -2960,7 +2941,6 @@ typedef enum : NSUInteger {
- (void)imagePickerController:(UIImagePickerController *)picker
didFinishPickingMediaWithInfo:(NSDictionary<NSString *, id> *)info
{
[UIUtil modalCompletionBlock]();
[self resetFrame];
NSURL *referenceURL = [info valueForKey:UIImagePickerControllerReferenceURL];

@ -275,6 +275,8 @@ NSString *const kArchivedConversationsReuseIdentifier = @"kArchivedConversations
[self.view addSubview:self.tableView];
[self.tableView autoPinWidthToSuperview];
[self.tableView autoPinEdgeToSuperviewEdge:ALEdgeBottom];
// TODO - have content scroll behind navbar will require changing this.
[self.tableView autoPinEdge:ALEdgeTop toEdge:ALEdgeBottom ofView:reminderStackView];
self.tableView.rowHeight = UITableViewAutomaticDimension;
self.tableView.estimatedRowHeight = 60;
@ -412,7 +414,8 @@ NSString *const kArchivedConversationsReuseIdentifier = @"kArchivedConversations
// UIBarButtonItem in order to ensure that these buttons are spaced tightly.
// The contents of the navigation bar are cramped in this view.
UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
UIImage *image = [UIImage imageNamed:@"button_settings_white"];
UIImage *image = [[UIImage imageNamed:@"button_settings_white"] imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate];
button.tintColor = UIColor.ows_navbarIconColor;
[button setImage:image forState:UIControlStateNormal];
UIEdgeInsets imageEdgeInsets = UIEdgeInsetsZero;
// We normally would want to use left and right insets that ensure the button

@ -189,14 +189,6 @@ class InviteFlow: NSObject, MFMessageComposeViewControllerDelegate, MFMailCompos
@objc
public func sendSMSTo(phoneNumbers: [String]) {
if #available(iOS 10.0, *) {
// iOS10 message compose view doesn't respect some system appearence attributes.
// Specifically, the title is white, but the navbar is gray.
// So, we have to set system appearence before init'ing the message compose view controller in order
// to make its colors legible.
// Then we have to be sure to set it back in the ComposeViewControllerDelegate callback.
UIUtil.applyDefaultSystemAppearence()
}
let messageComposeViewController = MFMessageComposeViewController()
messageComposeViewController.messageComposeDelegate = self
messageComposeViewController.recipients = phoneNumbers
@ -209,8 +201,6 @@ class InviteFlow: NSObject, MFMessageComposeViewControllerDelegate, MFMailCompos
// MARK: MessageComposeViewControllerDelegate
func messageComposeViewController(_ controller: MFMessageComposeViewController, didFinishWith result: MessageComposeResult) {
// Revert system styling applied to make messaging app legible on iOS10.
UIUtil.applySignalAppearence()
self.presentingViewController.dismiss(animated: true) {
switch result {
case .failed:

@ -81,7 +81,6 @@ public class LongTextViewController: OWSViewController {
messageTextView.autoPin(toTopLayoutGuideOf: self, withInset: 0)
let footer = UIToolbar()
footer.barTintColor = UIColor.ows_materialBlue
view.addSubview(footer)
footer.autoPinWidthToSuperview(withMargin: 0)
footer.autoPinEdge(.top, to: .bottom, of: messageTextView)

@ -143,11 +143,6 @@ NS_ASSUME_NONNULL_BEGIN
[super viewDidLoad];
[self createContents];
// Even though bars are opaque, we want content to be layed out behind them.
// The bars might obscure part of the content, but they can easily be hidden by tapping
// The alternative would be that content would shift when the navbars hide.
self.extendedLayoutIncludesOpaqueBars = YES;
}
- (void)viewWillAppear:(BOOL)animated

@ -248,9 +248,6 @@ class MediaGalleryViewController: OWSNavigationController, MediaGalleryDataSourc
// animate in our view, over the existing context, similar to a cross disolve, but allowing us to have
// more fine grained control
self.modalPresentationStyle = .custom
self.navigationBar.barTintColor = UIColor.ows_materialBlue
self.navigationBar.isTranslucent = false
self.navigationBar.isOpaque = true
// The presentationView is only used during present/dismiss animations.
// It's a static image of the media content.

@ -174,7 +174,6 @@ class MediaPageViewController: UIPageViewController, UIPageViewControllerDataSou
let footerBar = UIToolbar()
self.footerBar = footerBar
footerBar.barTintColor = UIColor.ows_signalBrandBlue
self.videoPlayBarButton = UIBarButtonItem(barButtonSystemItem: .play, target: self, action: #selector(didPressPlayBarButton))
self.videoPauseBarButton = UIBarButtonItem(barButtonSystemItem: .pause, target: self, action: #selector(didPressPauseBarButton))
@ -588,7 +587,7 @@ class MediaPageViewController: UIPageViewController, UIPageViewControllerDataSou
lazy private var headerNameLabel: UILabel = {
let label = UILabel()
label.textColor = .white
label.textColor = .ows_navbarTitle
label.font = UIFont.ows_regularFont(withSize: 17)
label.textAlignment = .center
label.adjustsFontSizeToFitWidth = true
@ -599,7 +598,7 @@ class MediaPageViewController: UIPageViewController, UIPageViewControllerDataSou
lazy private var headerDateLabel: UILabel = {
let label = UILabel()
label.textColor = .white
label.textColor = .ows_navbarTitle
label.font = UIFont.ows_regularFont(withSize: 12)
label.textAlignment = .center
label.adjustsFontSizeToFitWidth = true

@ -149,7 +149,6 @@ class MessageDetailViewController: OWSViewController, MediaGalleryDataSourceDele
if hasMediaAttachment {
let footer = UIToolbar()
footer.barTintColor = UIColor.ows_materialBlue
view.addSubview(footer)
footer.autoPinWidthToSuperview(withMargin: 0)
footer.autoPinEdge(.top, to: .bottom, of: scrollView)

@ -745,12 +745,10 @@ NS_ASSUME_NONNULL_BEGIN
if ([self presentedViewController]) {
[self dismissViewControllerAnimated:YES
completion:^{
[self presentViewController:alertController
animated:YES
completion:[UIUtil modalCompletionBlock]];
[self presentViewController:alertController animated:YES completion:nil];
}];
} else {
[self presentViewController:alertController animated:YES completion:[UIUtil modalCompletionBlock]];
[self presentViewController:alertController animated:YES completion:nil];
}
}

@ -485,7 +485,7 @@ NSString *const kKeychainKey_LastRegisteredPhoneNumber = @"kKeychainKey_LastRegi
countryCodeController.countryCodeDelegate = self;
OWSNavigationController *navigationController =
[[OWSNavigationController alloc] initWithRootViewController:countryCodeController];
[self presentViewController:navigationController animated:YES completion:[UIUtil modalCompletionBlock]];
[self presentViewController:navigationController animated:YES completion:nil];
}
- (void)backgroundTapped:(UIGestureRecognizer *)sender

@ -398,12 +398,6 @@ typedef void (^CustomLayoutBlock)(void);
[self.view setNeedsLayout];
}
- (void)viewWillAppear:(BOOL)animated
{
// In case we're returning from activity view that needed default system styles.
[UIUtil applySignalAppearence];
}
#pragma mark -
- (void)showSharingActivityWithCompletion:(nullable void (^)(void))completionHandler
@ -427,7 +421,6 @@ typedef void (^CustomLayoutBlock)(void);
if (completionHandler) {
completionHandler();
}
[UIUtil applySignalAppearence];
};
// This value was extracted by inspecting `activityType` in the activityController.completionHandler
@ -440,7 +433,6 @@ typedef void (^CustomLayoutBlock)(void);
iCloudActivityType // This isn't being excluded. RADAR https://openradar.appspot.com/27493621
];
[UIUtil applyDefaultSystemAppearence];
[self presentViewController:activityController animated:YES completion:nil];
}

@ -100,20 +100,8 @@ NS_ASSUME_NONNULL_BEGIN
[cameraInstructionLabel autoPinEdgeToSuperviewEdge:ALEdgeTop withInset:instructionsVMargin];
}
- (void)viewWillAppear:(BOOL)animated
{
// In case we're returning from activity view that needed default system styles.
[UIUtil applySignalAppearence];
}
- (void)viewWillDisappear:(BOOL)animated
{
[super viewWillDisappear:YES];
}
#pragma mark - Action
- (void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];

@ -180,9 +180,6 @@ NS_ASSUME_NONNULL_BEGIN
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
// In case we're dismissing a CNContactViewController which requires default system appearance
[UIUtil applySignalAppearence];
}
#pragma mark - Actions

@ -852,9 +852,6 @@ NS_ASSUME_NONNULL_BEGIN
{
[super viewWillAppear:animated];
// In case we're dismissing a CNContactViewController which requires default system appearance
[UIUtil applySignalAppearence];
// HACK to unselect rows when swiping back
// http://stackoverflow.com/questions/19379510/uitableviewcell-doesnt-get-deselected-when-swiping-back-quickly
[self.tableView deselectRowAtIndexPath:[self.tableView indexPathForSelectedRow] animated:animated];

@ -105,14 +105,6 @@ NS_ASSUME_NONNULL_BEGIN
[self updateTableContents];
}
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
// In case we're dismissing a CNContactViewController which requires default system appearance
[UIUtil applySignalAppearence];
}
#pragma mark - Table Contents
- (void)updateTableContents

@ -457,9 +457,7 @@ NSString *const kOWSTableCellIdentifier = @"kOWSTableCellIdentifier";
[self.tableView applyScrollViewInsetsFix];
[self.view addSubview:self.tableView];
[self.tableView autoPinWidthToSuperview];
[self.tableView autoPinToTopLayoutGuideOfViewController:self withInset:0];
[self.tableView autoPinEdgeToSuperviewEdge:ALEdgeBottom];
[self.tableView autoPinEdgesToSuperviewEdges];
[self.tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:kOWSTableCellIdentifier];
}

@ -68,10 +68,6 @@ NS_ASSUME_NONNULL_BEGIN
- (NSArray<Contact *> *)nonSignalContactsMatchingSearchString:(NSString *)searchText;
/**
* NOTE: This method calls `[UIUtil applyDefaultSystemAppearence]`.
* When using this method, you must call `[UIUtil applySignalAppearence]` once contact editing is finished;
*/
- (void)presentContactViewControllerForRecipientId:(NSString *)recipientId
fromViewController:(UIViewController<ContactEditingDelegate> *)fromViewController
editImmediately:(BOOL)shouldEditImmediately;

@ -394,16 +394,6 @@ NS_ASSUME_NONNULL_BEGIN
OWSNavigationController *modal = [[OWSNavigationController alloc] initWithRootViewController:contactViewController];
// HACK otherwise CNContactViewController Navbar is shows window background color.
// RADAR rdar://28433898 http://www.openradar.me/28433898
// CNContactViewController incompatible with opaque navigation bar
modal.navigationBar.translucent = YES;
if (@available(iOS 10, *)) {
// Contact navbar is blue in iOS9, so our white tex works,
// but gray on iOS10+, in which case we want the system default black text.
[UIUtil applyDefaultSystemAppearence];
}
// We want the presentation to imply a "replacement" in this case.
if (shouldEditImmediately) {
modal.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;

@ -41,8 +41,6 @@ public class OWSNavigationBar: UINavigationBar {
override init(frame: CGRect) {
super.init(frame: frame)
self.isTranslucent = false
NotificationCenter.default.addObserver(self, selector: #selector(callDidChange), name: .OWSWindowManagerCallDidChange, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(didChangeStatusBarFrame), name: .UIApplicationDidChangeStatusBarFrame, object: nil)
}

@ -70,7 +70,6 @@ public class AttachmentApprovalViewController: OWSViewController, CaptioningTool
// Make navigationBar clear
navController.navigationBar.backgroundColor = .clear
navController.navigationBar.setBackgroundImage(UIImage(), for: .default)
navController.navigationBar.isTranslucent = true
navController.navigationBar.shadowImage = UIImage()
navController.navigationBar.clipsToBounds = true

@ -74,9 +74,6 @@ NS_ASSUME_NONNULL_BEGIN
NSArray *__nullable returnedItems,
NSError *__nullable activityError) {
DDLogDebug(@"%@ applying signal appearence", self.logTag);
[UIUtil applySignalAppearence];
if (activityError) {
DDLogInfo(@"%@ Failed to share with activityError: %@", self.logTag, activityError);
} else if (completed) {
@ -93,12 +90,7 @@ NS_ASSUME_NONNULL_BEGIN
fromViewController = fromViewController.presentedViewController;
}
OWSAssert(fromViewController);
[fromViewController presentViewController:activityViewController
animated:YES
completion:^{
DDLogDebug(@"%@ applying default system appearence", self.logTag);
[UIUtil applyDefaultSystemAppearence];
}];
[fromViewController presentViewController:activityViewController animated:YES completion:nil];
});
}

@ -8,6 +8,14 @@ NS_ASSUME_NONNULL_BEGIN
@interface UIColor (OWS)
#pragma mark - Global App Colors
@property (class, readonly, nonatomic) UIColor *ows_navbarBackgroundColor;
@property (class, readonly, nonatomic) UIColor *ows_navbarIconColor;
@property (class, readonly, nonatomic) UIColor *ows_navbarTitleColor;
#pragma mark -
@property (class, readonly, nonatomic) UIColor *ows_systemPrimaryButtonColor;
@property (class, readonly, nonatomic) UIColor *ows_signalBrandBlueColor;
@property (class, readonly, nonatomic) UIColor *ows_materialBlueColor;

@ -10,6 +10,25 @@ NS_ASSUME_NONNULL_BEGIN
@implementation UIColor (OWS)
#pragma mark - Global App Colors
+ (UIColor *)ows_navbarBackgroundColor
{
return UIColor.ows_whiteColor;
}
+ (UIColor *)ows_navbarIconColor
{
return UIColor.ows_light60Color;
}
+ (UIColor *)ows_navbarTitleColor
{
return UIColor.ows_light90Color;
}
#pragma mark -
+ (UIColor *)ows_signalBrandBlueColor
{
return [UIColor colorWithRed:0.1135657504 green:0.4787300229 blue:0.89595204589999999 alpha:1.];
@ -75,7 +94,7 @@ NS_ASSUME_NONNULL_BEGIN
+ (UIColor *)ows_toolbarBackgroundColor
{
return [self colorWithWhite:245 / 255.f alpha:1.f];
return self.ows_navbarBackgroundColor;
}
+ (UIColor *)ows_lightBackgroundColor

@ -2,8 +2,9 @@
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
//
#import "UIView+OWS.h"
#import "UIViewController+OWS.h"
#import "UIColor+OWS.h"
#import "UIView+OWS.h"
NS_ASSUME_NONNULL_BEGIN
@ -71,9 +72,10 @@ NS_ASSUME_NONNULL_BEGIN
// in a UIBarButtonItem.
[backButton addTarget:target action:selector forControlEvents:UIControlEventTouchUpInside];
UIImage *backImage = [UIImage imageNamed:(isRTL ? @"NavBarBackRTL" : @"NavBarBack")];
UIImage *backImage = [[UIImage imageNamed:(isRTL ? @"NavBarBackRTL" : @"NavBarBack")] imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate];
OWSAssert(backImage);
[backButton setImage:backImage forState:UIControlStateNormal];
backButton.tintColor = UIColor.ows_navbarIconColor;
backButton.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;

@ -270,7 +270,7 @@ NSString *const kSelectRecipientViewControllerCellIdentifier = @"kSelectRecipien
} else {
OWSNavigationController *navigationController =
[[OWSNavigationController alloc] initWithRootViewController:countryCodeController];
[self presentViewController:navigationController animated:YES completion:[UIUtil modalCompletionBlock]];
[self presentViewController:navigationController animated:YES completion:nil];
}
}

@ -20,8 +20,6 @@ typedef void (^completionBlock)(void);
+ (void)applyRoundedBorderToImageView:(UIImageView *)imageView;
+ (void)removeRoundedBorderToImageView:(UIImageView *__strong *)imageView;
+ (completionBlock)modalCompletionBlock;
+ (void)applyDefaultSystemAppearence;
+ (void)applySignalAppearence;
+ (void)setupSignalAppearence;
@end

@ -1,8 +1,9 @@
//
// Copyright (c) 2017 Open Whisper Systems. All rights reserved.
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
//
#import "UIUtil.h"
#import "UIColor+OWS.h"
#import <SignalServiceKit/AppContext.h>
#define CONTACT_PICTURE_VIEW_BORDER_WIDTH 0.5f
@ -23,42 +24,26 @@
[[*imageView layer] setCornerRadius:0];
}
+ (completionBlock)modalCompletionBlock
{
completionBlock block = ^void() {
[CurrentAppContext() setStatusBarStyle:UIStatusBarStyleLightContent];
};
return block;
}
+ (void)applyDefaultSystemAppearence
+ (void)setupSignalAppearence
{
UINavigationBar.appearance.barTintColor = UIColor.ows_navbarBackgroundColor;
UINavigationBar.appearance.tintColor = UIColor.ows_navbarIconColor;
UIToolbar.appearance.barTintColor = UIColor.ows_navbarBackgroundColor;
UIToolbar.appearance.tintColor = UIColor.ows_navbarIconColor;
UIBarButtonItem.appearance.tintColor = UIColor.ows_navbarIconColor;
// Because our launch screen is blue, we specify the light content in our plist
// but once the app has loaded we want to switch to dark.
[CurrentAppContext() setStatusBarStyle:UIStatusBarStyleDefault];
[[UINavigationBar appearance] setBarStyle:UIBarStyleDefault];
[[UINavigationBar appearance] setTintColor:[UIColor blackColor]];
[[UIBarButtonItem appearance] setTintColor:[UIColor blackColor]];
[[UINavigationBar appearance] setTitleTextAttributes:@{
NSForegroundColorAttributeName : [UIColor blackColor],
}];
}
+ (void)applySignalAppearence
{
[CurrentAppContext() setStatusBarStyle:UIStatusBarStyleLightContent];
[[UINavigationBar appearance] setBarTintColor:[UIColor ows_materialBlueColor]];
[[UINavigationBar appearance] setTintColor:[UIColor whiteColor]];
[[UIBarButtonItem appearanceWhenContainedIn:[UISearchBar class], nil] setTintColor:[UIColor ows_materialBlueColor]];
// [[UIBarButtonItem appearanceWhenContainedIn:[UISearchBar class], nil] setTintColor:[UIColor
// ows_materialBlueColor]];
[[UISwitch appearance] setOnTintColor:[UIColor ows_materialBlueColor]];
[[UIToolbar appearance] setTintColor:[UIColor ows_materialBlueColor]];
[[UIBarButtonItem appearance] setTintColor:[UIColor whiteColor]];
// If we set NSShadowAttributeName, the NSForegroundColorAttributeName value is ignored.
[[UINavigationBar appearance] setTitleTextAttributes:@{
NSForegroundColorAttributeName : [UIColor whiteColor],
}];
UINavigationBar.appearance.titleTextAttributes = @{ NSForegroundColorAttributeName : UIColor.ows_navbarTitleColor };
}
@end

@ -137,7 +137,7 @@ NS_ASSUME_NONNULL_BEGIN
- (void)setStatusBarHidden:(BOOL)isHidden animated:(BOOL)isAnimated
{
DDLogInfo(@"Ignoring request to show/hide status bar style since we're in an app extension");
DDLogInfo(@"Ignoring request to show/hide status bar since we're in an app extension");
}
- (CGFloat)statusBarHeight

Loading…
Cancel
Save