cleanup unused code

This commit is contained in:
Michael Kirk 2018-07-11 22:35:54 -06:00
parent 9496bedce1
commit 42eb7a8d31
6 changed files with 1 additions and 323 deletions

View File

@ -29,10 +29,6 @@ NS_ASSUME_NONNULL_BEGIN
- (void)didPanWithGestureRecognizer:(UIPanGestureRecognizer *)gestureRecognizer
viewItem:(ConversationViewItem *)conversationItem;
// MJK move these to MessageActionDelegate
//- (void)showMetadataViewForViewItem:(ConversationViewItem *)conversationItem;
//- (void)conversationCell:(ConversationViewCell *)cell didTapReplyForViewItem:(ConversationViewItem *)conversationItem;
#pragma mark - System Cell
- (void)tappedNonBlockingIdentityChangeForRecipientId:(nullable NSString *)signalId;

View File

@ -377,8 +377,6 @@ NS_ASSUME_NONNULL_BEGIN
[self.sendFailureBadgeView removeFromSuperview];
self.sendFailureBadgeView = nil;
// [self hideMenuControllerIfNecessary];
[[NSNotificationCenter defaultCenter] removeObserver:self];
}
@ -394,10 +392,6 @@ NS_ASSUME_NONNULL_BEGIN
}
[self ensureMediaLoadState];
// if (!isCellVisible) {
// [self hideMenuControllerIfNecessary];
// }
}
#pragma mark - Gesture recognizers
@ -452,13 +446,10 @@ NS_ASSUME_NONNULL_BEGIN
break;
}
case OWSMessageGestureLocation_Media: {
CGPoint location = [sender locationInView:self];
[self.delegate conversationCell:self didLongpressMediaViewItem:self.viewItem];
break;
}
case OWSMessageGestureLocation_QuotedReply: {
CGPoint location = [sender locationInView:self];
[self.delegate conversationCell:self didLongpressQuoteViewItem:self.viewItem];
break;
}
@ -472,136 +463,6 @@ NS_ASSUME_NONNULL_BEGIN
[self.delegate didPanWithGestureRecognizer:panRecognizer viewItem:self.viewItem];
}
//#pragma mark - UIMenuController
//
//- (void)showTextMenuController:(CGPoint)fromLocation
//{
// [self showMenuController:fromLocation menuItems:self.viewItem.textMenuControllerItems];
//}
//
//- (void)showMediaMenuController:(CGPoint)fromLocation
//{
// [self showMenuController:fromLocation menuItems:self.viewItem.mediaMenuControllerItems];
//}
//
//- (void)showDefaultMenuController:(CGPoint)fromLocation
//{
// [self showMenuController:fromLocation menuItems:self.viewItem.defaultMenuControllerItems];
//}
//
//- (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,
// // 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) {
// [[UIMenuController sharedMenuController] setMenuVisible:NO animated:NO];
// }
//
// // We use custom action selectors so that we can control
// // the ordering of the actions in the menu.
// [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];
//}
//
//- (BOOL)canPerformAction:(SEL)action withSender:(nullable id)sender
//{
// return [self.viewItem canPerformAction:action];
//}
//
//- (void)copyTextAction:(nullable id)sender
//{
// [self.viewItem copyTextAction];
//}
//
//- (void)copyMediaAction:(nullable id)sender
//{
// [self.viewItem copyMediaAction];
//}
//
//- (void)shareTextAction:(nullable id)sender
//{
// [self.viewItem shareTextAction];
//}
//
//- (void)shareMediaAction:(nullable id)sender
//{
// [self.viewItem shareMediaAction];
//}
//
//- (void)saveMediaAction:(nullable id)sender
//{
// [self.viewItem saveMediaAction];
//}
//
//- (void)deleteAction:(nullable id)sender
//{
// [self.viewItem deleteAction];
//}
//
//- (void)metadataAction:(nullable id)sender
//{
// OWSAssert([self.viewItem.interaction isKindOfClass:[TSMessage class]]);
//
// [self.delegate showMetadataViewForViewItem:self.viewItem];
//}
//
//- (void)replyAction:(nullable id)sender
//{
// OWSAssert([self.viewItem.interaction isKindOfClass:[TSMessage class]]);
//
// [self.delegate conversationCell:self didTapReplyForViewItem:self.viewItem];
//}
//- (BOOL)canBecomeFirstResponder
//{
// return self.isPresentingMenuController;
//}
//
//- (void)didHideMenuController:(NSNotification *)notification
//{
// self.isPresentingMenuController = NO;
//}
//
//- (void)setIsPresentingMenuController:(BOOL)isPresentingMenuController
//{
// if (_isPresentingMenuController == isPresentingMenuController) {
// return;
// }
//
// _isPresentingMenuController = isPresentingMenuController;
//
// if (isPresentingMenuController) {
// [[NSNotificationCenter defaultCenter] addObserver:self
// selector:@selector(didHideMenuController:)
// name:UIMenuControllerDidHideMenuNotification
// object:nil];
// } else {
// [[NSNotificationCenter defaultCenter] removeObserver:self
// name:UIMenuControllerDidHideMenuNotification
// object:nil];
// }
//}
//
//- (void)hideMenuControllerIfNecessary
//{
// if (self.isPresentingMenuController) {
// [[UIMenuController sharedMenuController] setMenuVisible:NO animated:NO];
// }
// self.isPresentingMenuController = NO;
//}
@end
NS_ASSUME_NONNULL_END

View File

@ -136,18 +136,6 @@ NS_ASSUME_NONNULL_BEGIN
return YES;
}
- (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)pasteboardHasPossibleAttachment
{
// We don't want to load/convert images more than once so we

View File

@ -114,26 +114,13 @@ NSString *NSStringForOWSMessageCellType(OWSMessageCellType cellType);
@property (nonatomic, readonly) BOOL hasBodyTextActionContent;
@property (nonatomic, readonly) BOOL hasMediaActionContent;
- (void)copyMediaAction;
- (void)copyTextAction;
- (void)shareMediaAction;
- (void)shareTextAction;
- (void)saveMediaAction;
- (void)copyMediaAction;
- (void)deleteAction;
// #pragma mark - UIMenuController
//
//- (NSArray<UIMenuItem *> *)textMenuControllerItems;
//- (NSArray<UIMenuItem *> *)mediaMenuControllerItems;
//- (NSArray<UIMenuItem *> *)defaultMenuControllerItems;
//
//- (BOOL)canPerformAction:(SEL)action;
//
//- (SEL)replyActionSelector;
//- (SEL)metadataActionSelector;
@end
NS_ASSUME_NONNULL_END

View File

@ -598,150 +598,6 @@ NSString *NSStringForOWSMessageCellType(OWSMessageCellType cellType)
return _displayableQuotedText;
}
#pragma mark - UIMenuController
//- (NSArray<UIMenuItem *> *)textMenuControllerItems
//{
// return @[
// [[UIMenuItem alloc] initWithTitle:NSLocalizedString(@"EDIT_ITEM_MESSAGE_METADATA_ACTION",
// @"Short name for edit menu item to show message metadata.")
// action:self.metadataActionSelector],
// [[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(@"REPLY_ITEM_ACTION",
// @"Short name for edit menu item to reply to a message.")
// action:self.replyActionSelector],
// [[UIMenuItem alloc] initWithTitle:NSLocalizedString(@"EDIT_ITEM_DELETE_ACTION",
// @"Short name for edit menu item to delete contents of media message.")
// action:self.deleteActionSelector]
// ];
//}
//- (NSArray<UIMenuItem *> *)mediaMenuControllerItems
//{
// return @[
// [[UIMenuItem alloc] initWithTitle:NSLocalizedString(@"EDIT_ITEM_MESSAGE_METADATA_ACTION",
// @"Short name for edit menu item to show message metadata.")
// action:self.metadataActionSelector],
// [[UIMenuItem alloc] initWithTitle:NSLocalizedString(@"EDIT_ITEM_COPY_ACTION",
// @"Short name for edit menu item to copy contents of media message.")
// action:self.copyMediaActionSelector],
// [[UIMenuItem alloc] initWithTitle:NSLocalizedString(@"REPLY_ITEM_ACTION",
// @"Short name for edit menu item to reply to a message.")
// action:self.replyActionSelector],
// [[UIMenuItem alloc] initWithTitle:NSLocalizedString(@"EDIT_ITEM_DELETE_ACTION",
// @"Short name for edit menu item to delete contents of media message.")
// action:self.deleteActionSelector],
// [[UIMenuItem alloc] initWithTitle:NSLocalizedString(@"EDIT_ITEM_SAVE_ACTION",
// @"Short name for edit menu item to save contents of media message.")
// action:self.saveMediaActionSelector],
// ];
//}
//
//- (NSArray<UIMenuItem *> *)defaultMenuControllerItems
//{
// return @[
// [[UIMenuItem alloc] initWithTitle:NSLocalizedString(@"EDIT_ITEM_MESSAGE_METADATA_ACTION",
// @"Short name for edit menu item to show message metadata.")
// action:self.metadataActionSelector],
// [[UIMenuItem alloc] initWithTitle:NSLocalizedString(@"REPLY_ITEM_ACTION",
// @"Short name for edit menu item to reply to a message.")
// action:self.replyActionSelector],
// [[UIMenuItem alloc] initWithTitle:NSLocalizedString(@"EDIT_ITEM_DELETE_ACTION",
// @"Short name for edit menu item to delete contents of media message.")
// action:self.deleteActionSelector],
// ];
//}
//- (SEL)copyTextActionSelector
//{
// return NSSelectorFromString(@"copyTextAction:");
//}
//
//- (SEL)copyMediaActionSelector
//{
// return NSSelectorFromString(@"copyMediaAction:");
//}
//
//- (SEL)saveMediaActionSelector
//{
// return NSSelectorFromString(@"saveMediaAction:");
//}
//
//- (SEL)shareTextActionSelector
//{
// return NSSelectorFromString(@"shareTextAction:");
//}
//
//- (SEL)shareMediaActionSelector
//{
// return NSSelectorFromString(@"shareMediaAction:");
//}
//
//- (SEL)deleteActionSelector
//{
// return NSSelectorFromString(@"deleteAction:");
//}
//
//- (SEL)replyActionSelector
//{
// return NSSelectorFromString(@"replyAction:");
//}
//
//- (SEL)metadataActionSelector
//{
// return NSSelectorFromString(@"metadataAction:");
//}
// We only use custom actions in UIMenuController.
//- (BOOL)canPerformAction:(SEL)action
//{
// if (action == self.copyTextActionSelector) {
// return [self hasBodyTextActionContent];
// } else if (action == self.copyMediaActionSelector) {
// return [self hasMediaActionContent];
// } else if (action == self.saveMediaActionSelector) {
// return [self canSaveMedia];
// } else if (action == self.shareTextActionSelector) {
// return [self hasBodyTextActionContent];
// } else if (action == self.shareMediaActionSelector) {
// return [self hasMediaActionContent];
// } else if (action == self.deleteActionSelector) {
// return YES;
// } else if (action == self.metadataActionSelector) {
// return YES;
// } else if (action == self.replyActionSelector) {
// if ([self.interaction isKindOfClass:[TSOutgoingMessage class]]) {
// TSOutgoingMessage *outgoingMessage = (TSOutgoingMessage *)self.interaction;
// if (outgoingMessage.messageState == TSOutgoingMessageStateFailed
// || outgoingMessage.messageState == TSOutgoingMessageStateSending) {
// // Don't let users reply to messages which aren't yet delivered to the service.
// return NO;
// }
// } else if ([self.interaction isKindOfClass:[TSIncomingMessage class]]) {
// TSIncomingMessage *incomingMessage = (TSIncomingMessage *)self.interaction;
// if (incomingMessage.hasAttachments) {
// NSString *attachmentId = incomingMessage.attachmentIds.firstObject;
// __block TSAttachment *_Nullable attachment = nil;
// [[OWSPrimaryStorage.sharedManager newDatabaseConnection]
// readWithBlock:^(YapDatabaseReadTransaction *transaction) {
// attachment = [TSAttachment fetchObjectWithUniqueID:attachmentId transaction:transaction];
// }];
// if (![attachment isKindOfClass:[TSAttachmentStream class]]) {
// // Don't let users reply to attachments which aren't yet downloaded
// // (or otherwise missing on disk).
// return NO;
// }
// }
// }
// return YES;
// } else {
// return NO;
// }
//}
// TODO: Update for quoted text.
- (void)copyTextAction
{
switch (self.messageCellType) {
@ -807,7 +663,6 @@ NSString *NSStringForOWSMessageCellType(OWSMessageCellType cellType)
}
}
// TODO: Update for quoted text.
- (void)shareTextAction
{
switch (self.messageCellType) {

View File

@ -124,15 +124,6 @@ NS_ASSUME_NONNULL_BEGIN
[self resetMediaFrame];
}
- (void)viewWillDisappear:(BOOL)animated
{
[super viewWillDisappear:animated];
if ([UIMenuController sharedMenuController].isMenuVisible) {
[[UIMenuController sharedMenuController] setMenuVisible:NO animated:NO];
}
}
- (void)viewDidLayoutSubviews
{
[super viewDidLayoutSubviews];