Reply menu item

MVP

- [x] populate from menu
- [] send quoted message

TODO

- [] thumbnail
- [] paperclip icon showing for text message
- [] cancel button asset
- [] fonts
- [] colors
- [] adjust content inset/offset when showing quote edit

NICE TO HAVE

- [] animate presentation
- [] animate dismiss
- [] non-paperclip icon for generic attachments

// FREEBIE
pull/1/head
Michael Kirk 7 years ago
parent 6874a9e28e
commit d99054d895

@ -30,6 +30,7 @@ NS_ASSUME_NONNULL_BEGIN
viewItem:(ConversationViewItem *)conversationItem;
- (void)showMetadataViewForViewItem:(ConversationViewItem *)conversationItem;
- (void)conversationCell:(ConversationViewCell *)cell didTapReplyForViewItem:(ConversationViewItem *)conversationItem;
#pragma mark - System Cell

@ -1899,6 +1899,13 @@ CG_INLINE CGSize CGSizeCeil(CGSize size)
[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;

@ -252,13 +252,14 @@ static const CGFloat ConversationInputToolbarBorderViewHeight = 0.5;
- (void)setQuotedMessage:(TSQuotedMessage *)quotedMessage
{
// TODO update existing preview with message in case we switch which message we're quoting.
if (self.quotedMessagePreview) {
[self clearQuotedMessage];
}
OWSAssert(self.quotedMessagePreview == nil);
// TODO update preview view with message in case we switch which message we're quoting.
if (quotedMessage) {
self.quotedMessagePreview = [[QuotedReplyPreview alloc] initWithQuotedMessage:quotedMessage];
self.quotedMessagePreview.delegate = self;
}
// TODO animate
[self.contentStackView insertArrangedSubview:self.quotedMessagePreview atIndex:0];

@ -2158,6 +2158,30 @@ typedef enum : NSUInteger {
[self.navigationController pushViewController:view animated:YES];
}
- (void)conversationCell:(ConversationViewCell *)cell didTapReplyForViewItem:(ConversationViewItem *)conversationItem
{
DDLogDebug(@"%@ user did tap reply", self.logTag);
TSMessage *message = (TSMessage *)conversationItem.interaction;
if (![message isKindOfClass:[TSMessage class]]) {
OWSFail(@"%@ unexpected reply message: %@", self.logTag, message);
return;
}
__block TSQuotedMessage *quotedMessage;
[self.uiDatabaseConnection readWithBlock:^(YapDatabaseReadTransaction *_Nonnull transaction) {
quotedMessage = [OWSMessageUtils quotedMessageForMessage:message transaction:transaction];
}];
if (![quotedMessage isKindOfClass:[TSQuotedMessage class]]) {
OWSFail(@"%@ unexpected quotedMessage: %@", self.logTag, quotedMessage);
return;
}
[self.inputToolbar setQuotedMessage:quotedMessage];
[self.inputToolbar beginEditingTextMessage];
}
#pragma mark - System Messages
- (void)didTapSystemMessageWithInteraction:(TSInteraction *)interaction

@ -542,12 +542,15 @@ NSString *NSStringForOWSMessageCellType(OWSMessageCellType cellType)
- (NSArray<UIMenuItem *> *)textMenuControllerItems
{
return @[
[[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_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],
// FIXME: when deleting a caption, users will be surprised that it also deletes the attachment.
// We either need to implement a way to remove the caption separate from the attachment
// or make a design change which clarifies that the whole message is getting deleted.
@ -565,6 +568,9 @@ 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.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],
@ -604,6 +610,11 @@ NSString *NSStringForOWSMessageCellType(OWSMessageCellType cellType)
return NSSelectorFromString(@"deleteAction:");
}
- (SEL)replyActionSelector
{
return NSSelectorFromString(@"replyAction:");
}
- (SEL)metadataActionSelector
{
return NSSelectorFromString(@"metadataAction:");
@ -626,6 +637,8 @@ NSString *NSStringForOWSMessageCellType(OWSMessageCellType cellType)
return YES;
} else if (action == self.metadataActionSelector) {
return YES;
} else if (action == self.replyActionSelector) {
return YES;
} else {
return NO;
}

@ -184,9 +184,6 @@
/* Error indicating the backup import could not import the user's data. */
"BACKUP_IMPORT_ERROR_COULD_NOT_IMPORT" = "Backup could not be imported.";
/* Indicates that the backup import is checking for an existing backup. */
"BACKUP_IMPORT_PHASE_CHECK_BACKUP" = "Checking Backup State";
/* Indicates that the backup import is being configured. */
"BACKUP_IMPORT_PHASE_CONFIGURATION" = "Configuring Backup";
@ -1519,6 +1516,9 @@
/* Alert title after wrong guess for 'two-factor auth pin' reminder activity */
"REMINDER_2FA_WRONG_PIN_ALERT_TITLE" = "That is not the correct PIN.";
/* Short name for edit menu item to reply to a message. */
"REPLY_ITEM_ACTION" = "Reply";
/* No comment provided by engineer. */
"REREGISTER_FOR_PUSH" = "Re-register for push notifications";

Loading…
Cancel
Save