Delivery issue sheet

This commit is contained in:
Michelle Linington 2021-07-26 20:20:25 -07:00
parent 4f128b1146
commit 7a27aa1f13
11 changed files with 71 additions and 14 deletions

View File

@ -0,0 +1,12 @@
{
"images" : [
{
"filename" : "delivery-issue.svg",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@ -0,0 +1,13 @@
<svg width="200" height="110" viewBox="0 0 200 110" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M39.2999 15.1L12.8999 15C9.0999 15 5.9999 18.1 5.9999 21.9L5.8999 88C5.8999 91.8 8.9999 94.9 12.7999 94.9L39.0999 95C42.8999 95 45.9999 91.9 45.9999 88.1L46.1999 22C46.1999 18.2 43.0999 15.1 39.2999 15.1ZM42.7999 88.1C42.7999 90.1 41.0999 91.8 39.0999 91.8L12.6999 91.7C10.6999 91.7 8.9999 90 8.9999 88L9.0999 21.9C9.0999 19.9 10.7999 18.2 12.7999 18.2L39.1999 18.3C41.1999 18.3 42.8999 20 42.8999 22L42.7999 88.1Z" fill="#C6C6C6"/>
<path d="M187.3 15.1L160.9 15C157.1 15 154 18.1 154 21.9L153.9 88C153.9 91.8 157 94.9 160.8 94.9L187.2 95C191 95 194.1 91.9 194.1 88.1L194.2 22C194.2 18.2 191.1 15.1 187.3 15.1ZM190.8 88.1C190.8 90.1 189.1 91.8 187.1 91.8L160.7 91.7C158.7 91.7 157 90 157 88L157.1 21.9C157.1 19.9 158.8 18.2 160.8 18.2L187.2 18.3C189.2 18.3 190.9 20 190.9 22L190.8 88.1Z" fill="#C6C6C6"/>
<path d="M126 58C127.105 58 128 57.1046 128 56C128 54.8954 127.105 54 126 54C124.895 54 124 54.8954 124 56C124 57.1046 124.895 58 126 58Z" fill="#848484"/>
<path d="M136 58C137.105 58 138 57.1046 138 56C138 54.8954 137.105 54 136 54C134.895 54 134 54.8954 134 56C134 57.1046 134.895 58 136 58Z" fill="#848484"/>
<path d="M146 58C147.105 58 148 57.1046 148 56C148 54.8954 147.105 54 146 54C144.895 54 144 54.8954 144 56C144 57.1046 144.895 58 146 58Z" fill="#848484"/>
<path d="M54 58C55.1046 58 56 57.1046 56 56C56 54.8954 55.1046 54 54 54C52.8954 54 52 54.8954 52 56C52 57.1046 52.8954 58 54 58Z" fill="#848484"/>
<path d="M64 58C65.1046 58 66 57.1046 66 56C66 54.8954 65.1046 54 64 54C62.8954 54 62 54.8954 62 56C62 57.1046 62.8954 58 64 58Z" fill="#848484"/>
<path d="M74 58C75.1046 58 76 57.1046 76 56C76 54.8954 75.1046 54 74 54C72.8954 54 72 54.8954 72 56C72 57.1046 72.8954 58 74 58Z" fill="#848484"/>
<path d="M118 56C118 65.9411 109.941 74 100 74C90.0589 74 82 65.9411 82 56C82 46.0589 90.0589 38 100 38C109.941 38 118 46.0589 118 56Z" fill="#FFC207"/>
<path d="M102.083 47H97.9167L98.75 58.25H101.25L102.083 47Z" fill="white"/>
<path d="M102.079 61.5C102.353 61.87 102.5 62.305 102.5 62.75C102.5 63.3467 102.237 63.919 101.768 64.341C101.299 64.7629 100.663 65 100 65C99.5055 65 99.0222 64.868 98.6111 64.6208C98.2 64.3736 97.8795 64.0222 97.6903 63.611C97.5011 63.1999 97.4516 62.7475 97.548 62.311C97.6445 61.8746 97.8826 61.4737 98.2322 61.159C98.5819 60.8443 99.0273 60.63 99.5123 60.5432C99.9972 60.4564 100.5 60.501 100.957 60.6713C101.414 60.8416 101.804 61.13 102.079 61.5Z" fill="white"/>
</svg>

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

@ -159,7 +159,7 @@ public protocol CVComponentDelegate {
func cvc_didTapUnknownThreadWarningGroup()
func cvc_didTapUnknownThreadWarningContact()
func cvc_didTapDeliveryIssueWarning()
func cvc_didTapDeliveryIssueWarning(_ message: TSErrorMessage)
}
// MARK: -
@ -197,7 +197,7 @@ struct CVMessageAction: Equatable {
case cvc_didTapAddToContacts(contactShare: ContactShareViewModel)
case cvc_didTapUnknownThreadWarningGroup
case cvc_didTapUnknownThreadWarningContact
case cvc_didTapDeliveryIssueWarning
case cvc_didTapDeliveryIssueWarning(errorMessage: TSErrorMessage)
func perform(delegate: CVComponentDelegate) {
switch self {
@ -245,8 +245,8 @@ struct CVMessageAction: Equatable {
delegate.cvc_didTapUnknownThreadWarningGroup()
case .cvc_didTapUnknownThreadWarningContact:
delegate.cvc_didTapUnknownThreadWarningContact()
case .cvc_didTapDeliveryIssueWarning:
delegate.cvc_didTapDeliveryIssueWarning()
case .cvc_didTapDeliveryIssueWarning(let errorMessage):
delegate.cvc_didTapDeliveryIssueWarning(errorMessage)
}
}
}

View File

@ -948,7 +948,7 @@ extension CVComponentSystemMessage {
case .decryptionFailure:
return Action(title: CommonStrings.learnMore,
accessibilityIdentifier: "learn_more",
action: .cvc_didTapDeliveryIssueWarning)
action: .cvc_didTapDeliveryIssueWarning(errorMessage: message))
case .duplicateMessage,
.invalidVersion:
return nil

View File

@ -707,9 +707,13 @@ extension ConversationViewController: CVComponentDelegate {
showUnknownThreadWarningAlert()
}
public func cvc_didTapDeliveryIssueWarning() {
public func cvc_didTapDeliveryIssueWarning(_ message: TSErrorMessage) {
AssertIsOnMainThread()
guard let senderAddress = message.sender else {
owsFailDebug("Expected a sender address")
return
}
showDeliveryIssueWarningAlert()
showDeliveryIssueWarningAlert(from: senderAddress)
}
}

View File

@ -171,8 +171,30 @@ extension ConversationViewController {
presentActionSheet(actionSheet)
}
public func showDeliveryIssueWarningAlert() {
// TODO
public func showDeliveryIssueWarningAlert(from senderAddress: SignalServiceAddress) {
let senderName = databaseStorage.read { transaction in
Self.contactsManager.displayName(for: senderAddress, transaction: transaction)
}
let alertTitle = NSLocalizedString("ALERT_DELIVERY_ISSUE_TITLE", comment: "Title for delivery issue sheet")
let alertMessageFormat = NSLocalizedString("ALERT_DELIVERY_ISSUE_MESSAGE_FORMAT", comment: "Format string for delivery issue sheet message. Embeds {{ sender name }}.")
let alertMessage = String(format: alertMessageFormat, senderName)
let headerImageView = UIImageView(image: .init(named: "delivery-issue"))
headerImageView.autoSetDimension(.height, toSize: 110)
headerImageView.autoSetDimension(.width, toSize: 200)
let headerView = UIView()
headerView.addSubview(headerImageView)
headerImageView.autoPinEdge(toSuperviewEdge: .top, withInset: 22)
headerImageView.autoPinEdge(toSuperviewEdge: .bottom)
headerImageView.autoHCenterInSuperview()
let actionSheet = ActionSheetController(
title: alertTitle,
message: alertMessage)
actionSheet.customHeader = headerView
actionSheet.addAction(OWSActionSheets.okayAction)
presentActionSheet(actionSheet)
}
}

View File

@ -1035,7 +1035,7 @@ extension MessageDetailViewController: CVComponentDelegate {
func cvc_didTapUnknownThreadWarningGroup() {}
// TODO:
func cvc_didTapUnknownThreadWarningContact() {}
func cvc_didTapDeliveryIssueWarning() {}
func cvc_didTapDeliveryIssueWarning(_ message: TSErrorMessage) {}
}
extension MessageDetailViewController: UINavigationControllerDelegate {

View File

@ -412,5 +412,5 @@ extension MockConversationView: CVComponentDelegate {
func cvc_didTapUnknownThreadWarningGroup() {}
func cvc_didTapUnknownThreadWarningContact() {}
func cvc_didTapDeliveryIssueWarning() {}
func cvc_didTapDeliveryIssueWarning(_ message: TSErrorMessage) {}
}

View File

@ -112,6 +112,12 @@
/* generic button text to acknowledge that the corresponding text was read. */
"ALERT_ACTION_ACKNOWLEDGE" = "Got it";
/* Format string for delivery issue sheet message. Embeds {{ sender name }}. */
"ALERT_DELIVERY_ISSUE_MESSAGE_FORMAT" = "A message, sticker, reaction, read receipt or media couldnt be delivered to you from %@. They may have tried sending it to you directly, or in a group.";
/* Title for delivery issue sheet */
"ALERT_DELIVERY_ISSUE_TITLE" = "Delivery Issue";
/* The label for the 'discard' button in alerts and action sheets. */
"ALERT_DISCARD_BUTTON" = "Discard";
@ -1618,7 +1624,7 @@
/* Error message indicating that attachment download(s) failed. */
"ERROR_MESSAGE_ATTACHMENT_DOWNLOAD_FAILED" = "Attachment download failed.";
/* Error message for a decryption failure. Embeds {{senders name}}. */
/* Error message for a decryption failure. Embeds {{sender short name}}. */
"ERROR_MESSAGE_DECRYPTION_FAILURE" = "A message from %@ could not be delivered";
/* No comment provided by engineer. */

View File

@ -233,7 +233,7 @@ NSUInteger TSErrorMessageSchemaVersion = 2;
@"ERROR_MESSAGE_SESSION_REFRESH", @"Text notifying the user that their secure session has been reset");
case TSErrorMessageDecryptionFailure: {
NSString *formatString = NSLocalizedString(@"ERROR_MESSAGE_DECRYPTION_FAILURE",
@"Error message for a decryption failure. Embeds {{senders name}}.");
@"Error message for a decryption failure. Embeds {{sender short name}}.");
NSString *senderName = [self.contactsManager shortDisplayNameForAddress:self.sender
transaction:transaction];
return [[NSString alloc] initWithFormat:formatString, senderName];

View File

@ -82,7 +82,7 @@ NS_ASSUME_NONNULL_BEGIN
- (NSString *)previewTextWithTransaction:(SDSAnyReadTransaction *)transaction
{
NSString *formatString = NSLocalizedString(
@"ERROR_MESSAGE_DECRYPTION_FAILURE", @"Error message for a decryption failure. Embeds {{senders name}}.");
@"ERROR_MESSAGE_DECRYPTION_FAILURE", @"Error message for a decryption failure. Embeds {{sender short name}}.");
NSString *senderName = [self.contactsManager shortDisplayNameForAddress:self.sender transaction:transaction];
return [[NSString alloc] initWithFormat:formatString, senderName];
}