Merge branch 'mkirk/iphone-x'

pull/1/head
Michael Kirk 8 years ago
commit 87b5b85142

@ -22,6 +22,7 @@ NS_ASSUME_NONNULL_BEGIN
+ (UIColor *)ows_blackColor;
+ (UIColor *)ows_errorMessageBorderColor;
+ (UIColor *)ows_infoMessageBorderColor;
+ (UIColor *)ows_inputToolbarBackgroundColor;
+ (UIColor *)backgroundColorForContact:(NSString *)contactIdentifier;
+ (UIColor *)colorWithRGBHex:(unsigned long)value;

@ -86,6 +86,11 @@ NS_ASSUME_NONNULL_BEGIN
return [UIColor colorWithRed:239.f / 255.f green:189.f / 255.f blue:88.f / 255.f alpha:1.0f];
}
+ (UIColor *)ows_inputToolbarBackgroundColor
{
return [self colorWithWhite:245 / 255.f alpha:1.f];
}
+ (UIColor *)ows_lightBackgroundColor
{
return [UIColor colorWithRed:242.f / 255.f green:242.f / 255.f blue:242.f / 255.f alpha:1.f];

@ -33,6 +33,7 @@ class CallViewController: OWSViewController, CallObserver, CallServiceObserver {
var contactNameLabel: MarqueeLabel!
var contactAvatarView: AvatarImageView!
var contactAvatarContainerView: UIView!
var callStatusLabel: UILabel!
var callDurationTimer: Timer?
@ -270,8 +271,10 @@ class CallViewController: OWSViewController, CallObserver, CallServiceObserver {
callStatusLabel.layer.shadowRadius = 4
self.view.addSubview(callStatusLabel)
contactAvatarContainerView = UIView.container()
self.view.addSubview(contactAvatarContainerView)
contactAvatarView = AvatarImageView()
self.view.addSubview(contactAvatarView)
contactAvatarContainerView.addSubview(contactAvatarView)
}
func createSettingsNagViews() {
@ -340,25 +343,25 @@ class CallViewController: OWSViewController, CallObserver, CallServiceObserver {
action:#selector(didPressAudioSource))
audioSourceButton.accessibilityLabel = NSLocalizedString("CALL_VIEW_AUDIO_SOURCE_LABEL",
comment: "Accessibility label for selection the audio source")
hangUpButton = createButton(imageName:"hangup-active-wide",
action:#selector(didPressHangup))
hangUpButton.accessibilityLabel = NSLocalizedString("CALL_VIEW_HANGUP_LABEL",
comment: "Accessibility label for hang up call")
audioModeMuteButton = createButton(imageName:"audio-call-mute-inactive",
action:#selector(didPressMute))
audioModeMuteButton.accessibilityLabel = NSLocalizedString("CALL_VIEW_MUTE_LABEL",
comment: "Accessibility label for muting the microphone")
videoModeMuteButton = createButton(imageName:"video-mute-unselected",
action:#selector(didPressMute))
videoModeMuteButton.accessibilityLabel = NSLocalizedString("CALL_VIEW_MUTE_LABEL", comment: "Accessibility label for muting the microphone")
audioModeVideoButton = createButton(imageName:"audio-call-video-inactive",
action:#selector(didPressVideo))
audioModeVideoButton.accessibilityLabel = NSLocalizedString("CALL_VIEW_SWITCH_TO_VIDEO_LABEL", comment: "Accessibility label to switch to video call")
videoModeVideoButton = createButton(imageName:"video-video-unselected",
action:#selector(didPressVideo))
videoModeVideoButton.accessibilityLabel = NSLocalizedString("CALL_VIEW_SWITCH_TO_AUDIO_LABEL", comment: "Accessibility label to switch to audio only")
@ -569,19 +572,29 @@ class CallViewController: OWSViewController, CallObserver, CallServiceObserver {
contactNameLabel.autoPinEdge(toSuperviewEdge:.top, withInset:topMargin)
contactNameLabel.autoPinLeadingToSuperview(withMargin: contactHMargin)
contactNameLabel.setContentHuggingVerticalHigh()
contactNameLabel.setCompressionResistanceHigh()
callStatusLabel.autoPinEdge(.top, to:.bottom, of:contactNameLabel, withOffset:contactVSpacing)
callStatusLabel.autoPinLeadingToSuperview(withMargin: contactHMargin)
callStatusLabel.setContentHuggingVerticalHigh()
contactAvatarView.autoPinEdge(.top, to:.bottom, of:callStatusLabel, withOffset:+avatarTopSpacing)
contactAvatarView.autoPinEdge(.bottom, to:.top, of:ongoingCallView, withOffset:-avatarBottomSpacing)
contactAvatarView.autoHCenterInSuperview()
// Stretch that avatar to fill the available space.
contactAvatarView.setContentHuggingLow()
contactAvatarView.setCompressionResistanceLow()
// Preserve square aspect ratio of contact avatar.
contactAvatarView.autoMatch(.width, to:.height, of:contactAvatarView)
callStatusLabel.setCompressionResistanceHigh()
contactAvatarContainerView.autoPinEdge(.top, to:.bottom, of:callStatusLabel, withOffset:+avatarTopSpacing)
contactAvatarContainerView.autoPinEdge(.bottom, to:.top, of:ongoingCallView, withOffset:-avatarBottomSpacing)
contactAvatarContainerView.autoPinWidthToSuperview(withMargin: avatarTopSpacing)
contactAvatarView.autoCenterInSuperview()
// Ensure ContacAvatarView gets as close as possible to it's superview edges while maintaining
// aspect ratio.
contactAvatarView.autoPinToSquareAspectRatio()
contactAvatarView.autoPinEdge(toSuperviewEdge: .top, withInset: 0, relation: .greaterThanOrEqual)
contactAvatarView.autoPinEdge(toSuperviewEdge: .right, withInset: 0, relation: .greaterThanOrEqual)
contactAvatarView.autoPinEdge(toSuperviewEdge: .bottom, withInset: 0, relation: .greaterThanOrEqual)
contactAvatarView.autoPinEdge(toSuperviewEdge: .left, withInset: 0, relation: .greaterThanOrEqual)
NSLayoutConstraint.autoSetPriority(UILayoutPriorityDefaultLow) {
contactAvatarView.autoPinEdgesToSuperviewMargins()
}
// Ongoing call controls
ongoingCallView.autoPinEdge(toSuperviewEdge:.bottom, withInset:ongoingBottomMargin)

@ -72,7 +72,7 @@ static void *kConversationInputTextViewObservingContext = &kConversationInputTex
{
self.layoutMargins = UIEdgeInsetsZero;
self.backgroundColor = [UIColor colorWithWhite:245 / 255.f alpha:1.f];
self.backgroundColor = [UIColor ows_inputToolbarBackgroundColor];
UIView *borderView = [UIView new];
borderView.backgroundColor = [UIColor colorWithWhite:238 / 255.f alpha:1.f];

@ -479,6 +479,13 @@ typedef NS_ENUM(NSInteger, MessagesRangeSizeMode) {
[self loadDraftInCompose];
}
- (void)loadView
{
[super loadView];
self.view.backgroundColor = [UIColor ows_inputToolbarBackgroundColor];
}
- (void)createContents
{
_layout = [ConversationViewLayout new];

@ -82,7 +82,7 @@ NS_ASSUME_NONNULL_BEGIN
footer.backgroundColor = darkGrey;
[self.view addSubview:footer];
[footer autoPinWidthToSuperview];
[footer autoPinToBottomLayoutGuideOfViewController:self withInset:0];
[footer autoPinEdgeToSuperviewEdge:ALEdgeBottom];
[footer autoPinEdge:ALEdgeTop toEdge:ALEdgeBottom ofView:self.qrScanningController.view];
UILabel *cameraInstructionLabel = [UILabel new];
@ -96,7 +96,7 @@ NS_ASSUME_NONNULL_BEGIN
[footer addSubview:cameraInstructionLabel];
[cameraInstructionLabel autoPinWidthToSuperviewWithMargin:ScaleFromIPhone5To7Plus(16.f, 30.f)];
CGFloat instructionsVMargin = ScaleFromIPhone5To7Plus(10.f, 20.f);
[cameraInstructionLabel autoPinEdgeToSuperviewEdge:ALEdgeBottom withInset:instructionsVMargin];
[cameraInstructionLabel autoPinToBottomLayoutGuideOfViewController:self withInset:instructionsVMargin];
[cameraInstructionLabel autoPinEdgeToSuperviewEdge:ALEdgeTop withInset:instructionsVMargin];
}

@ -172,11 +172,19 @@ class GifPickerViewController: OWSViewController, UISearchBarDelegate, UICollect
self.collectionView.autoPinWidthToSuperview()
self.collectionView.autoPinEdge(.top, to: .bottom, of: searchBar)
// for iPhoneX devices, extends the black background to the bottom edge of the view.
let bottomBannerContainer = UIView()
bottomBannerContainer.backgroundColor = UIColor.black
self.view.addSubview(bottomBannerContainer)
bottomBannerContainer.autoPinWidthToSuperview()
bottomBannerContainer.autoPinEdge(.top, to: .bottom, of: self.collectionView)
bottomBannerContainer.autoPinEdge(toSuperviewEdge: .bottom)
let bottomBanner = UIView()
bottomBanner.backgroundColor = UIColor.black
self.view.addSubview(bottomBanner)
bottomBannerContainer.addSubview(bottomBanner)
bottomBanner.autoPinEdge(toSuperviewEdge: .top)
bottomBanner.autoPinWidthToSuperview()
bottomBanner.autoPinEdge(.top, to: .bottom, of: self.collectionView)
self.autoPinView(toBottomGuideOrKeyboard:bottomBanner)
// The Giphy API requires us to "show their trademark prominently" in our GIF experience.

@ -75,6 +75,7 @@ NS_ASSUME_NONNULL_BEGIN
{
[super loadView];
self.view.backgroundColor = UIColor.whiteColor;
_contactsViewHelper = [[ContactsViewHelper alloc] initWithDelegate:self];
_nonContactAccountSet = [NSMutableSet set];
_collation = [UILocalizedIndexedCollation currentCollation];

@ -110,7 +110,12 @@ NS_ASSUME_NONNULL_BEGIN
CGRect keyboardEndFrameConverted = [self.view convertRect:keyboardEndFrame fromView:nil];
// Adjust the position of the bottom view to account for the keyboard's
// intrusion into the view.
CGFloat offset = -MAX(0, (self.view.height - keyboardEndFrameConverted.origin.y));
//
// On iPhoneX, when no keyboard is present, we include a buffer at the bottom of the screen so the bottom view
// clears the floating "home button". But because the keyboard includes it's own buffer, we subtract the length
// (height) of the bottomLayoutGuide, else we'd have an unnecessary buffer between the popped keyboard and the input
// bar.
CGFloat offset = -MAX(0, (self.view.height - self.bottomLayoutGuide.length - keyboardEndFrameConverted.origin.y));
// There's no need to use: [UIView animateWithDuration:...].
// Any layout changes made during these notifications are

@ -61,41 +61,46 @@ NSString *const kKeychainKey_LastRegisteredPhoneNumber = @"kKeychainKey_LastRegi
- (void)createViews
{
self.view.backgroundColor = [UIColor ows_signalBrandBlueColor];
self.view.backgroundColor = [UIColor whiteColor];
self.view.userInteractionEnabled = YES;
[self.view
addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(backgroundTapped:)]];
UIView *header = [UIView new];
header.backgroundColor = [UIColor ows_signalBrandBlueColor];
[self.view addSubview:header];
[header autoPinToTopLayoutGuideOfViewController:self withInset:0];
[header autoPinWidthToSuperview];
UIView *headerWrapper = [UIView containerView];
[self.view addSubview:headerWrapper];
headerWrapper.backgroundColor = UIColor.ows_signalBrandBlueColor;
UIView *headerContent = [UIView new];
[headerWrapper addSubview:headerContent];
[headerWrapper autoPinEdgesToSuperviewEdgesWithInsets:UIEdgeInsetsZero excludingEdge:ALEdgeBottom];
[headerContent autoPinEdgeToSuperviewEdge:ALEdgeBottom];
[headerContent autoPinToTopLayoutGuideOfViewController:self withInset:0];
[headerContent autoPinWidthToSuperview];
UILabel *headerLabel = [UILabel new];
headerLabel.text = NSLocalizedString(@"REGISTRATION_TITLE_LABEL", @"");
headerLabel.textColor = [UIColor whiteColor];
headerLabel.font = [UIFont ows_mediumFontWithSize:ScaleFromIPhone5To7Plus(20.f, 24.f)];
[header addSubview:headerLabel];
[headerContent addSubview:headerLabel];
[headerLabel autoHCenterInSuperview];
[headerLabel autoPinEdgeToSuperviewEdge:ALEdgeBottom withInset:14.f];
CGFloat screenHeight = MAX([UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height);
if (screenHeight < 568) {
// iPhone 4s or smaller.
[header autoSetDimension:ALDimensionHeight toSize:20];
[headerContent autoSetDimension:ALDimensionHeight toSize:20];
headerLabel.hidden = YES;
} else if (screenHeight < 667) {
// iPhone 5 or smaller.
[header autoSetDimension:ALDimensionHeight toSize:80];
[headerContent autoSetDimension:ALDimensionHeight toSize:80];
} else {
[header autoSetDimension:ALDimensionHeight toSize:220];
[headerContent autoSetDimension:ALDimensionHeight toSize:220];
UIImage *logo = [UIImage imageNamed:@"logoSignal"];
OWSAssert(logo);
UIImageView *logoView = [UIImageView new];
logoView.image = logo;
[header addSubview:logoView];
[headerContent addSubview:logoView];
[logoView autoHCenterInSuperview];
[logoView autoPinEdge:ALEdgeBottom toEdge:ALEdgeTop ofView:headerLabel withOffset:-14.f];
}
@ -112,7 +117,7 @@ NSString *const kKeychainKey_LastRegisteredPhoneNumber = @"kKeychainKey_LastRegi
[self.view addSubview:contentView];
[contentView autoPinToBottomLayoutGuideOfViewController:self withInset:0];
[contentView autoPinWidthToSuperview];
[contentView autoPinEdge:ALEdgeTop toEdge:ALEdgeBottom ofView:header];
[contentView autoPinEdge:ALEdgeTop toEdge:ALEdgeBottom ofView:headerContent];
// Country
UIView *countryRow = [UIView containerView];

Loading…
Cancel
Save