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
This commit is contained in:
Michael Kirk 2018-05-16 16:20:14 -04:00 committed by Matthew Chen
parent 0e87cbe7a5
commit 4dbd14ac41
1 changed files with 22 additions and 1 deletions

View File

@ -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