Merge branch 'charlesmchen/landscapeOrientation6'

pull/1/head
Matthew Chen 6 years ago
commit f5a36ad5b7

@ -367,10 +367,31 @@ typedef enum : NSUInteger {
selector:@selector(profileWhitelistDidChange:)
name:kNSNotificationName_ProfileWhitelistDidChange
object:nil];
// Keyboard events.
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(keyboardWillShow:)
name:UIKeyboardWillShowNotification
object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(keyboardDidShow:)
name:UIKeyboardDidShowNotification
object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(keyboardWillHide:)
name:UIKeyboardWillHideNotification
object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(keyboardDidHide:)
name:UIKeyboardDidHideNotification
object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(keyboardWillChangeFrame:)
name:UIKeyboardWillChangeFrameNotification
object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(keyboardDidChangeFrame:)
name:UIKeyboardDidChangeFrameNotification
object:nil];
}
- (BOOL)isGroupConversation
@ -3589,12 +3610,33 @@ typedef enum : NSUInteger {
});
}
- (void)keyboardWillShow:(NSNotification *)notification
{
[self handleKeyboardNotification:notification];
}
- (void)keyboardDidShow:(NSNotification *)notification
{
[self handleKeyboardNotification:notification];
}
- (void)keyboardWillHide:(NSNotification *)notification
{
[self handleKeyboardNotification:notification];
}
- (void)keyboardDidHide:(NSNotification *)notification
{
[self handleKeyboardNotification:notification];
}
- (void)keyboardWillChangeFrame:(NSNotification *)notification
{
// `willChange` is the correct keyboard notifiation to observe when adjusting contentInset
// in lockstep with the keyboard presentation animation. `didChange` results in the contentInset
// not adjusting until after the keyboard is fully up.
OWSLogVerbose(@"");
[self handleKeyboardNotification:notification];
}
- (void)keyboardDidChangeFrame:(NSNotification *)notification
{
[self handleKeyboardNotification:notification];
}

@ -1,5 +1,5 @@
//
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
// Copyright (c) 2019 Open Whisper Systems. All rights reserved.
//
import Foundation
@ -60,9 +60,7 @@ class GifPickerLayout: UICollectionViewLayout {
// We use 2 or 3 columns, depending on the device.
// 2 columns will show fewer GIFs at a time,
// but use less network & be a more responsive experience.
let screenSize = UIScreen.main.bounds.size
let screenWidth = min(screenSize.width, screenSize.height)
let columnCount = UInt(max(2, screenWidth / 130))
let columnCount = UInt(max(2, collectionView.width() / 130))
let totalViewWidth = UInt(collectionView.width())
let hTotalWhitespace = (2 * hInset) + (hSpacing * (columnCount - 1))

@ -518,4 +518,10 @@ class GifPickerViewController: OWSViewController, UISearchBarDelegate, UICollect
}
tryToSearch()
}
public override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) {
super.traitCollectionDidChange(previousTraitCollection)
layout.invalidateLayout()
}
}

@ -490,7 +490,7 @@ const UIWindowLevel UIWindowLevel_MessageActions(void)
OWSLogInfo(@"showing root window.");
}
// By calling makeKeyAndVisible we ensure the rootViewController becomes firt responder.
// By calling makeKeyAndVisible we ensure the rootViewController becomes first responder.
// In the normal case, that means the SignalViewController will call `becomeFirstResponder`
// on the vc on top of its navigation stack.
[self.rootWindow makeKeyAndVisible];

Loading…
Cancel
Save