From 5ba5d3f52456eafb239411ef5e84f4ba6a44b0f3 Mon Sep 17 00:00:00 2001 From: Michael Kirk Date: Thu, 22 Feb 2018 08:57:58 -0500 Subject: [PATCH] Remove "Share" from edit menu Showing the share UI conflicts with the conversation views inputAccessory toolbar. Specifically: - the long press menu acquires first responder - tapping share presents the activity view - at this point, the input toolbar is hidden - launching a share extension hides the activity view, presents the share extension (could be the Signal share extension or another app's share extension) - the conversation view (which is rendered behind the share extension) regains first responder, causing the input toolbar to appear above the share extension One fix would be to re-implement an interface similar UIMenuController, which does not require mucking with the responder chain, but that's going to be more involved. // FREEBIE --- .../ConversationView/ConversationViewController.m | 12 ++++++++++++ .../ConversationView/ConversationViewItem.m | 6 ------ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/Signal/src/ViewControllers/ConversationView/ConversationViewController.m b/Signal/src/ViewControllers/ConversationView/ConversationViewController.m index ee8c6789a..514580837 100644 --- a/Signal/src/ViewControllers/ConversationView/ConversationViewController.m +++ b/Signal/src/ViewControllers/ConversationView/ConversationViewController.m @@ -549,6 +549,18 @@ typedef NS_ENUM(NSInteger, MessagesRangeSizeMode) { [self.loadMoreHeader autoSetDimension:ALDimensionHeight toSize:kLoadMoreHeaderHeight]; } +- (BOOL)becomeFirstResponder +{ + DDLogDebug(@"%@ in %s", self.logTag, __PRETTY_FUNCTION__); + return [super becomeFirstResponder]; +} + +- (BOOL)resignFirstResponder +{ + DDLogDebug(@"%@ in %s", self.logTag, __PRETTY_FUNCTION__); + return [super resignFirstResponder]; +} + - (BOOL)canBecomeFirstResponder { return YES; diff --git a/Signal/src/ViewControllers/ConversationView/ConversationViewItem.m b/Signal/src/ViewControllers/ConversationView/ConversationViewItem.m index 5ee8b4494..2e362ac58 100644 --- a/Signal/src/ViewControllers/ConversationView/ConversationViewItem.m +++ b/Signal/src/ViewControllers/ConversationView/ConversationViewItem.m @@ -465,9 +465,6 @@ NSString *NSStringForOWSMessageCellType(OWSMessageCellType cellType) [[UIMenuItem alloc] initWithTitle:NSLocalizedString(@"EDIT_ITEM_COPY_ACTION", @"Short name for edit menu item to copy contents of media message.") action:self.copyTextActionSelector], - [[UIMenuItem alloc] initWithTitle:NSLocalizedString(@"EDIT_ITEM_SHARE_ACTION", - @"Short name for edit menu item to share contents of media message.") - action:self.shareTextActionSelector], [[UIMenuItem alloc] initWithTitle:NSLocalizedString(@"EDIT_ITEM_MESSAGE_METADATA_ACTION", @"Short name for edit menu item to show message metadata.") action:self.metadataActionSelector], @@ -482,9 +479,6 @@ NSString *NSStringForOWSMessageCellType(OWSMessageCellType cellType) - (NSArray *)mediaMenuControllerItems { return @[ - [[UIMenuItem alloc] initWithTitle:NSLocalizedString(@"EDIT_ITEM_SHARE_ACTION", - @"Short name for edit menu item to share contents of media message.") - action:self.shareMediaActionSelector], [[UIMenuItem alloc] initWithTitle:NSLocalizedString(@"EDIT_ITEM_MESSAGE_METADATA_ACTION", @"Short name for edit menu item to show message metadata.") action:self.metadataActionSelector],