Merge tag '2.19.5.0'

This commit is contained in:
Michael Kirk 2018-02-01 14:03:43 -08:00
commit e39ca59eeb
4 changed files with 30 additions and 1 deletions

View file

@ -36,6 +36,7 @@ NS_ASSUME_NONNULL_BEGIN
- (void)beginEditingTextMessage;
- (void)endEditingTextMessage;
- (BOOL)isInputTextViewFirstResponder;
- (void)setInputTextViewDelegate:(id<ConversationInputTextViewDelegate>)value;

View file

@ -236,6 +236,11 @@ static const CGFloat ConversationInputToolbarBorderViewHeight = 0.5;
[self.inputTextView resignFirstResponder];
}
- (BOOL)isInputTextViewFirstResponder
{
return self.inputTextView.isFirstResponder;
}
- (void)ensureContentConstraints
{
[NSLayoutConstraint deactivateConstraints:self.contentContraints];

View file

@ -1023,6 +1023,26 @@ typedef NS_ENUM(NSInteger, MessagesRangeSizeMode) {
self.isViewCompletelyAppeared = YES;
self.viewHasEverAppeared = YES;
// HACK: Because the inputToolbar is the inputAccessoryView, we make some special considertations WRT it's firstResponder status.
//
// When a view controller is presented, it is first responder. However if we resign first responder
// and the view re-appears, without being presented, the inputToolbar can become invisible.
// e.g. specifically works around the scenario:
// - Present this VC
// - Longpress on a message to show edit menu, which entails making the pressed view the first responder.
// - Begin presenting another view, e.g. swipe-left for details or swipe-right to go back, but quit part way, so that you remain on the conversation view
// - toolbar will be not be visible unless we reaquire first responder.
if (!self.isFirstResponder) {
// We don't have to worry about the input toolbar being visible if the inputToolbar.textView is first responder
// In fact doing so would unnecessarily dismiss the keyboard which is probably not desirable and at least
// a distracting animation.
if (!self.inputToolbar.isInputTextViewFirstResponder) {
DDLogDebug(@"%@ reclaiming first responder to ensure toolbar is shown.", self.logTag);
[self becomeFirstResponder];
}
}
}
// `viewWillDisappear` is called whenever the view *starts* to disappear,

View file

@ -356,7 +356,10 @@ NS_ASSUME_NONNULL_BEGIN
- (void)updateFooterBarButtonItemsWithIsPlayingVideo:(BOOL)isPlayingVideo
{
OWSAssert(self.footerBar);
if (!self.footerBar) {
DDLogVerbose(@"%@ No footer bar visible.", self.logTag);
return;
}
NSMutableArray<UIBarButtonItem *> *toolbarItems = [NSMutableArray new];