|
|
@ -511,9 +511,11 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
|
[self showMediaMenuController:location];
|
|
|
|
[self showMediaMenuController:location];
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
case OWSMessageGestureLocation_QuotedReply:
|
|
|
|
case OWSMessageGestureLocation_QuotedReply: {
|
|
|
|
// TODO:
|
|
|
|
CGPoint location = [sender locationInView:self];
|
|
|
|
|
|
|
|
[self showDefaultMenuController:location];
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -528,28 +530,26 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
|
|
|
|
|
|
|
|
|
- (void)showTextMenuController:(CGPoint)fromLocation
|
|
|
|
- (void)showTextMenuController:(CGPoint)fromLocation
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// We don't want taps on messages to hide the keyboard,
|
|
|
|
[self showMenuController:fromLocation menuItems:self.viewItem.textMenuControllerItems];
|
|
|
|
// so we only let messages become first responder
|
|
|
|
}
|
|
|
|
// while they are trying to present the menu controller.
|
|
|
|
|
|
|
|
self.isPresentingMenuController = YES;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[self becomeFirstResponder];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ([UIMenuController sharedMenuController].isMenuVisible) {
|
|
|
|
- (void)showMediaMenuController:(CGPoint)fromLocation
|
|
|
|
[[UIMenuController sharedMenuController] setMenuVisible:NO animated:NO];
|
|
|
|
{
|
|
|
|
}
|
|
|
|
[self showMenuController:fromLocation menuItems:self.viewItem.mediaMenuControllerItems];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// We use custom action selectors so that we can control
|
|
|
|
- (void)showDefaultMenuController:(CGPoint)fromLocation
|
|
|
|
// the ordering of the actions in the menu.
|
|
|
|
{
|
|
|
|
NSArray *menuItems = self.viewItem.textMenuControllerItems;
|
|
|
|
[self showMenuController:fromLocation menuItems:self.viewItem.defaultMenuControllerItems];
|
|
|
|
[UIMenuController sharedMenuController].menuItems = menuItems;
|
|
|
|
|
|
|
|
CGRect targetRect = CGRectMake(fromLocation.x, fromLocation.y, 1, 1);
|
|
|
|
|
|
|
|
[[UIMenuController sharedMenuController] setTargetRect:targetRect inView:self];
|
|
|
|
|
|
|
|
[[UIMenuController sharedMenuController] setMenuVisible:YES animated:YES];
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
- (void)showMediaMenuController:(CGPoint)fromLocation
|
|
|
|
- (void)showMenuController:(CGPoint)fromLocation menuItems:(NSArray *)menuItems
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
if (menuItems.count < 1) {
|
|
|
|
|
|
|
|
OWSFail(@"%@ No menu items to present.", self.logTag);
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// We don't want taps on messages to hide the keyboard,
|
|
|
|
// We don't want taps on messages to hide the keyboard,
|
|
|
|
// so we only let messages become first responder
|
|
|
|
// so we only let messages become first responder
|
|
|
|
// while they are trying to present the menu controller.
|
|
|
|
// while they are trying to present the menu controller.
|
|
|
@ -563,7 +563,6 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
|
|
|
|
|
|
|
|
|
// We use custom action selectors so that we can control
|
|
|
|
// We use custom action selectors so that we can control
|
|
|
|
// the ordering of the actions in the menu.
|
|
|
|
// the ordering of the actions in the menu.
|
|
|
|
NSArray *menuItems = self.viewItem.mediaMenuControllerItems;
|
|
|
|
|
|
|
|
[UIMenuController sharedMenuController].menuItems = menuItems;
|
|
|
|
[UIMenuController sharedMenuController].menuItems = menuItems;
|
|
|
|
CGRect targetRect = CGRectMake(fromLocation.x, fromLocation.y, 1, 1);
|
|
|
|
CGRect targetRect = CGRectMake(fromLocation.x, fromLocation.y, 1, 1);
|
|
|
|
[[UIMenuController sharedMenuController] setTargetRect:targetRect inView:self];
|
|
|
|
[[UIMenuController sharedMenuController] setTargetRect:targetRect inView:self];
|
|
|
|