From 4dbd14ac417744c7b20748bddf5c52aef029ffbe Mon Sep 17 00:00:00 2001 From: Michael Kirk Date: Wed, 16 May 2018 16:20:14 -0400 Subject: [PATCH] WIP navbar resize -[ ] CallScreen -[x] functional button -[ ] needs design -[x] disable conversation view call buttons while in call -[ ] iOS11 -[x] resize nav content -[ ] background showing at top of all vc's -[] iPhoneX -[x] use differently sized banner for now -[] mimic X system design -[ ] iOS10 -[x] resize nav content -[ ] animation glitch while push/pop -[ ] iOS9 // FREEBIE --- .../ConversationViewController.m | 23 ++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/Signal/src/ViewControllers/ConversationView/ConversationViewController.m b/Signal/src/ViewControllers/ConversationView/ConversationViewController.m index 771c97735..b6ddfc198 100644 --- a/Signal/src/ViewControllers/ConversationView/ConversationViewController.m +++ b/Signal/src/ViewControllers/ConversationView/ConversationViewController.m @@ -289,6 +289,10 @@ typedef enum : NSUInteger { selector:@selector(blockedPhoneNumbersDidChange:) name:kNSNotificationName_BlockedPhoneNumbersDidChange object:nil]; + [[NSNotificationCenter defaultCenter] addObserver:self + selector:@selector(windowManagerCallDidChange:) + name:OWSWindowManagerCallDidChangeNotification + object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(identityStateDidChange:) name:kNSNotificationName_IdentityStateDidChange @@ -1225,6 +1229,11 @@ typedef enum : NSUInteger { self.navigationItem.leftBarButtonItem = backItem; } +- (void)windowManagerCallDidChange:(NSNotification *)notification +{ + [self updateBarButtonItems]; +} + - (void)updateBarButtonItems { if (self.userLeftGroup) { @@ -1239,9 +1248,21 @@ typedef enum : NSUInteger { // UIBarButtonItem in order to ensure that these buttons are spaced tightly. // The contents of the navigation bar are cramped in this view. UIButton *callButton = [UIButton buttonWithType:UIButtonTypeCustom]; - UIImage *image = [UIImage imageNamed:@"button_phone_white"]; + UIImage *image = [[UIImage imageNamed:@"button_phone_white"] imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate]; [callButton setImage:image forState:UIControlStateNormal]; + + if (OWSWindowManager.sharedManager.hasCall) { + callButton.enabled = NO; + callButton.userInteractionEnabled = NO; + callButton.tintColor = UIColor.lightGrayColor; + } else { + callButton.enabled = YES; + callButton.userInteractionEnabled = YES; + callButton.tintColor = UIColor.whiteColor; + } + UIEdgeInsets imageEdgeInsets = UIEdgeInsetsZero; + // We normally would want to use left and right insets that ensure the button // is square and the icon is centered. However UINavigationBar doesn't offer us // control over the margins and spacing of its content, and the buttons end up