diff --git a/Signal/src/ViewControllers/RegistrationViewController.m b/Signal/src/ViewControllers/RegistrationViewController.m index 51bdff0d4..af48126c0 100644 --- a/Signal/src/ViewControllers/RegistrationViewController.m +++ b/Signal/src/ViewControllers/RegistrationViewController.m @@ -359,12 +359,6 @@ NSString *const kKeychainKey_LastRegisteredPhoneNumber = @"kKeychainKey_LastRegi [self presentViewController:navigationController animated:YES completion:[UIUtil modalCompletionBlock]]; } -- (void)presentInvalidCountryCodeError { - [OWSAlerts showAlertWithTitle:NSLocalizedString(@"REGISTER_CC_ERR_ALERT_VIEW_TITLE", @"") - message:NSLocalizedString(@"REGISTER_CC_ERR_ALERT_VIEW_MESSAGE", @"") - buttonTitle:CommonStrings.dismissButton]; -} - - (void)backgroundTapped:(UIGestureRecognizer *)sender { if (sender.state == UIGestureRecognizerStateRecognized) { diff --git a/Signal/translations/en.lproj/Localizable.strings b/Signal/translations/en.lproj/Localizable.strings index d8735bc0c..a864628ea 100644 --- a/Signal/translations/en.lproj/Localizable.strings +++ b/Signal/translations/en.lproj/Localizable.strings @@ -1273,12 +1273,6 @@ /* No comment provided by engineer. */ "RATING_TITLE" = "Support Signal!"; -/* No comment provided by engineer. */ -"REGISTER_CC_ERR_ALERT_VIEW_MESSAGE" = "Please enter a valid country code"; - -/* No comment provided by engineer. */ -"REGISTER_CC_ERR_ALERT_VIEW_TITLE" = "Country Code Error"; - /* No comment provided by engineer. */ "REGISTER_CONTACTS_WELCOME" = "Welcome!"; @@ -1570,6 +1564,9 @@ /* Title indicating that the share extension cannot be used until the main app has been launched at least once. */ "SHARE_EXTENSION_NOT_YET_MIGRATED_TITLE" = "Not Ready"; +/* Shown when trying to share content to a Signal user for the share extension. Followed by failure details. */ +"SHARE_EXTENSION_UNABLE_TO_BUILD_ATTACHMENT_ALERT_TITLE" = "Unable to Prepare Attachment"; + /* Action sheet item */ "SHOW_SAFETY_NUMBER_ACTION" = "Show New Safety Number"; diff --git a/SignalMessaging/attachments/SendExternalFileViewController.m b/SignalMessaging/attachments/SendExternalFileViewController.m index 3e60bf09f..a68a55ed2 100644 --- a/SignalMessaging/attachments/SendExternalFileViewController.m +++ b/SignalMessaging/attachments/SendExternalFileViewController.m @@ -200,7 +200,7 @@ NS_ASSUME_NONNULL_BEGIN [ThreadUtil sendMessageWithAttachment:self.attachment inThread:self.thread messageSender:self.messageSender]; // FIXME SHARINGEXTENSION - // Show loading screen and dismiss entire share extnesion once entirely complete + // Show loading screen and dismiss entire share extension once entirely complete [self.navigationController popViewControllerAnimated:YES]; } diff --git a/SignalMessaging/views/OWSAlerts.swift b/SignalMessaging/views/OWSAlerts.swift index cb12ea4b9..898830b0f 100644 --- a/SignalMessaging/views/OWSAlerts.swift +++ b/SignalMessaging/views/OWSAlerts.swift @@ -34,13 +34,13 @@ import Foundation } @objc - public class func showAlert(withTitle title: String, message: String? = nil, buttonTitle: String? = nil) { + public class func showAlert(withTitle title: String, message: String? = nil, buttonTitle: String? = nil, buttonAction: ((UIAlertAction) -> Void)? = nil) { assert(title.count > 0) let actionTitle = buttonTitle ?? NSLocalizedString("OK", comment: "") let alert = UIAlertController(title: title, message: message, preferredStyle: .alert) - alert.addAction(UIAlertAction(title: actionTitle, style: .default, handler: nil)) + alert.addAction(UIAlertAction(title: actionTitle, style: .default, handler: buttonAction)) CurrentAppContext().frontmostViewController()?.present(alert, animated: true, completion: nil) } diff --git a/SignalServiceKit/src/Messages/OWSMessageSender.m b/SignalServiceKit/src/Messages/OWSMessageSender.m index 74f822033..d65ef72d8 100644 --- a/SignalServiceKit/src/Messages/OWSMessageSender.m +++ b/SignalServiceKit/src/Messages/OWSMessageSender.m @@ -242,9 +242,8 @@ NSUInteger const OWSSendMessageOperationMaxRetries = 4; AssertIsOnMainThread(); // Should only be sent once per operation - // FIXME SHARINGEXTENSION -// OWSAssert(_backgroundTaskIdentifier == UIBackgroundTaskInvalid); -// OWSAssert(backgroundTaskIdentifier != UIBackgroundTaskInvalid); + OWSAssert(!CurrentAppContext().isMainApp || _backgroundTaskIdentifier == UIBackgroundTaskInvalid); + OWSAssert(!CurrentAppContext().isMainApp || backgroundTaskIdentifier != UIBackgroundTaskInvalid); _backgroundTaskIdentifier = backgroundTaskIdentifier; } diff --git a/SignalShareExtension/ShareViewController.swift b/SignalShareExtension/ShareViewController.swift index 8517e32c2..20d526c8a 100644 --- a/SignalShareExtension/ShareViewController.swift +++ b/SignalShareExtension/ShareViewController.swift @@ -362,6 +362,11 @@ public class ShareViewController: UINavigationController, SAELoadViewDelegate, S self.pushViewController(conversationPicker, animated: false) Logger.info("presented conversation picker with attachment") }.catch { error in + OWSAlerts.showAlert(withTitle: NSLocalizedString("SHARE_EXTENSION_UNABLE_TO_BUILD_ATTACHMENT_ALERT_TITLE", comment: "Shown when trying to share content to a Signal user for the share extension. Followed by failure details."), + message: error.localizedDescription, + buttonTitle: CommonStrings.cancelButton) { _ in + self.shareExtensionWasCancelled() + } owsFail("\(self.logTag) building attachment failed with error: \(error)") }.retainUntilComplete() }