From 75ead2ac0904ea601f654f53b9ca09573df09b70 Mon Sep 17 00:00:00 2001 From: Michael Kirk Date: Mon, 20 Aug 2018 14:58:34 -0600 Subject: [PATCH] quoted reply: distinguish "not found" vs. "no longer available" --- .../ConversationViewController.m | 26 ++++++++++++++++--- .../translations/en.lproj/Localizable.strings | 13 ++++------ 2 files changed, 28 insertions(+), 11 deletions(-) diff --git a/Signal/src/ViewControllers/ConversationView/ConversationViewController.m b/Signal/src/ViewControllers/ConversationView/ConversationViewController.m index 92af522d9..b7d77bf78 100644 --- a/Signal/src/ViewControllers/ConversationView/ConversationViewController.m +++ b/Signal/src/ViewControllers/ConversationView/ConversationViewController.m @@ -2370,6 +2370,11 @@ typedef enum : NSUInteger { __block NSUInteger threadInteractionCount = 0; __block NSNumber *_Nullable groupIndex = nil; + if (quotedReply.isRemotelySourced) { + [self presentRemotelySourcedQuotedReplyToast]; + return; + } + [self.uiDatabaseConnection readWithBlock:^(YapDatabaseReadTransaction *transaction) { quotedInteraction = [ThreadUtil findInteractionInThreadByTimestamp:quotedReply.timestamp authorId:quotedReply.authorId @@ -5317,9 +5322,24 @@ typedef enum : NSUInteger { { DDLogInfo(@"%@ in %s", self.logTag, __PRETTY_FUNCTION__); - NSString *toastText = NSLocalizedString(@"QUOTED_REPLY_MISSING_ORIGINAL_MESSAGE", - @"Toast alert text shown when tapping on a quoted message which we cannot scroll to, because the local copy of " - @"the message doesn't exist."); + NSString *toastText = NSLocalizedString(@"QUOTED_REPLY_ORIGINAL_MESSAGE_DELETED", + @"Toast alert text shown when tapping on a quoted message which we cannot scroll to because the local copy of " + @"the message was since deleted."); + + ToastController *toastController = [[ToastController alloc] initWithText:toastText]; + + CGFloat bottomInset = 10 + self.collectionView.contentInset.bottom + self.view.layoutMargins.bottom; + + [toastController presentToastViewFromBottomOfView:self.view inset:bottomInset]; +} + +- (void)presentRemotelySourcedQuotedReplyToast +{ + DDLogInfo(@"%@ in %s", self.logTag, __PRETTY_FUNCTION__); + + NSString *toastText = NSLocalizedString(@"QUOTED_REPLY_ORIGINAL_MESSAGE_REMOTELY_SOURCED", + @"Toast alert text shown when tapping on a quoted message which we cannot scroll to because the local copy of " + @"the message didn't exist when the quote was received."); ToastController *toastController = [[ToastController alloc] initWithText:toastText]; diff --git a/Signal/translations/en.lproj/Localizable.strings b/Signal/translations/en.lproj/Localizable.strings index 3e527c118..91bd09d94 100644 --- a/Signal/translations/en.lproj/Localizable.strings +++ b/Signal/translations/en.lproj/Localizable.strings @@ -1263,12 +1263,6 @@ /* Indicates that this 1:1 conversation is no longer verified. Embeds {{user's name or phone number}}. */ "MESSAGES_VIEW_CONTACT_NO_LONGER_VERIFIED_FORMAT" = "%@ is no longer marked as verified. Tap for options."; -/* Action sheet title after tapping on failed download. */ -"MESSAGES_VIEW_FAILED_DOWNLOAD_ACTIONSHEET_TITLE" = "Download Failed."; - -/* Action sheet button text */ -"MESSAGES_VIEW_FAILED_DOWNLOAD_RETRY_ACTION" = "Download Again"; - /* Indicates that a single member of this group has been blocked. */ "MESSAGES_VIEW_GROUP_1_MEMBER_BLOCKED" = "You Blocked 1 Member of this Group"; @@ -1610,8 +1604,11 @@ /* Footer label that appears below quoted messages when the quoted content was note derived locally. When the local user doesn't have a copy of the message being quoted, e.g. if it had since been deleted, we instead show the content specified by the sender. */ "QUOTED_REPLY_CONTENT_FROM_REMOTE_SOURCE" = "Original message not found."; -/* Toast alert text shown when tapping on a quoted message which we cannot scroll to, because the local copy of the message doesn't exist. */ -"QUOTED_REPLY_MISSING_ORIGINAL_MESSAGE" = "Original message not found."; +/* Toast alert text shown when tapping on a quoted message which we cannot scroll to because the local copy of the message was since deleted. */ +"QUOTED_REPLY_ORIGINAL_MESSAGE_DELETED" = "Original message no longer available."; + +/* Toast alert text shown when tapping on a quoted message which we cannot scroll to because the local copy of the message didn't exist when the quote was received. */ +"QUOTED_REPLY_ORIGINAL_MESSAGE_REMOTELY_SOURCED" = "Original message not found."; /* Indicates this message is a quoted reply to an attachment of unknown type. */ "QUOTED_REPLY_TYPE_ATTACHMENT" = "Attachment";