diff --git a/Signal/translations/en.lproj/Localizable.strings b/Signal/translations/en.lproj/Localizable.strings index c21d184a5c..7b624d9b13 100644 --- a/Signal/translations/en.lproj/Localizable.strings +++ b/Signal/translations/en.lproj/Localizable.strings @@ -1452,9 +1452,6 @@ /* Label for the send button in the conversation view. */ "SEND_BUTTON_TITLE" = "Send"; -/* Title for the 'send external file' view. */ -"SEND_EXTERNAL_FILE_VIEW_TITLE" = "Send File"; - /* Alert body after invite failed */ "SEND_INVITE_FAILURE" = "Sending invite failed, please try again later."; @@ -1641,6 +1638,9 @@ /* 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"; +/* Title for the 'share extension' view. */ +"SHARE_EXTENSION_VIEW_TITLE" = "Share to Signal"; + /* Action sheet item */ "SHOW_SAFETY_NUMBER_ACTION" = "Show New Safety Number"; diff --git a/SignalMessaging/attachments/SharingThreadPickerViewController.m b/SignalMessaging/attachments/SharingThreadPickerViewController.m index b42946c6b2..44e71d9cfe 100644 --- a/SignalMessaging/attachments/SharingThreadPickerViewController.m +++ b/SignalMessaging/attachments/SharingThreadPickerViewController.m @@ -59,7 +59,7 @@ typedef void (^SendMessageBlock)(SendCompletionBlock completion); _messageSender = [Environment current].messageSender; _progressView = [[UIProgressView alloc] initWithProgressViewStyle:UIProgressViewStyleDefault]; - self.title = NSLocalizedString(@"SEND_EXTERNAL_FILE_VIEW_TITLE", @"Title for the 'send external file' view."); + self.title = NSLocalizedString(@"SHARE_EXTENSION_VIEW_TITLE", @"Title for the 'share extension' view."); } - (void)viewDidLoad @@ -149,6 +149,12 @@ typedef void (^SendMessageBlock)(SendCompletionBlock completion); NSString *_Nullable messageText = [self convertAttachmentToMessageTextIfPossible]; + // Hide the navigation bar before presenting the approval view. + // + // Note that cancelling in the approval views will dismiss the entire + // share extension, so there is no "back" button. + self.navigationController.navigationBarHidden = YES; + if (messageText) { MessageApprovalViewController *approvalVC = [[MessageApprovalViewController alloc] initWithMessageText:messageText diff --git a/SignalMessaging/contacts/CountryCodeViewController.h b/SignalMessaging/contacts/CountryCodeViewController.h index 1bf349ea59..525db4f9bc 100644 --- a/SignalMessaging/contacts/CountryCodeViewController.h +++ b/SignalMessaging/contacts/CountryCodeViewController.h @@ -21,4 +21,6 @@ @property (nonatomic, weak) id countryCodeDelegate; +@property (nonatomic) BOOL isPresentedInNavigationController; + @end diff --git a/SignalMessaging/contacts/CountryCodeViewController.m b/SignalMessaging/contacts/CountryCodeViewController.m index 168c01f88e..8b81bfacd8 100644 --- a/SignalMessaging/contacts/CountryCodeViewController.m +++ b/SignalMessaging/contacts/CountryCodeViewController.m @@ -31,10 +31,12 @@ self.countryCodes = [PhoneNumberUtil countryCodesForSearchTerm:nil]; - self.navigationItem.leftBarButtonItem = - [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemStop - target:self - action:@selector(dismissWasPressed:)]; + if (!self.isPresentedInNavigationController) { + self.navigationItem.leftBarButtonItem = + [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemStop + target:self + action:@selector(dismissWasPressed:)]; + } [self createViews]; } diff --git a/SignalMessaging/contacts/SelectRecipientViewController.h b/SignalMessaging/contacts/SelectRecipientViewController.h index 0feb804276..f6a69d8af1 100644 --- a/SignalMessaging/contacts/SelectRecipientViewController.h +++ b/SignalMessaging/contacts/SelectRecipientViewController.h @@ -40,6 +40,8 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic, readonly) ContactsViewHelper *contactsViewHelper; +@property (nonatomic) BOOL isPresentedInNavigationController; + @end NS_ASSUME_NONNULL_END diff --git a/SignalMessaging/contacts/SelectRecipientViewController.m b/SignalMessaging/contacts/SelectRecipientViewController.m index 1359f26bd4..534da5bef7 100644 --- a/SignalMessaging/contacts/SelectRecipientViewController.m +++ b/SignalMessaging/contacts/SelectRecipientViewController.m @@ -238,10 +238,10 @@ NSString *const kSelectRecipientViewControllerCellIdentifier = @"kSelectRecipien callingCode:(NSString *)callingCode countryCode:(NSString *)countryCode { - _callingCode = callingCode; - NSString *title = [NSString stringWithFormat:@"%@ (%@)", callingCode, countryCode.uppercaseString]; + NSString *titleFormat = ([UIView new].isRTL ? @"(%2$@) %1$@" : @"%1$@ (%2$@)"); + NSString *title = [NSString stringWithFormat:titleFormat, callingCode, countryCode.uppercaseString]; [self.countryCodeButton setTitle:title forState:UIControlStateNormal]; [self.countryCodeButton layoutSubviews]; @@ -263,9 +263,14 @@ NSString *const kSelectRecipientViewControllerCellIdentifier = @"kSelectRecipien { CountryCodeViewController *countryCodeController = [CountryCodeViewController new]; countryCodeController.countryCodeDelegate = self; - UINavigationController *navigationController = - [[UINavigationController alloc] initWithRootViewController:countryCodeController]; - [self presentViewController:navigationController animated:YES completion:[UIUtil modalCompletionBlock]]; + countryCodeController.isPresentedInNavigationController = self.isPresentedInNavigationController; + if (self.isPresentedInNavigationController) { + [self.navigationController pushViewController:countryCodeController animated:YES]; + } else { + UINavigationController *navigationController = + [[UINavigationController alloc] initWithRootViewController:countryCodeController]; + [self presentViewController:navigationController animated:YES completion:[UIUtil modalCompletionBlock]]; + } } - (void)phoneNumberButtonPressed diff --git a/SignalMessaging/contacts/SelectThreadViewController.m b/SignalMessaging/contacts/SelectThreadViewController.m index 198fc3ab2e..fbf6940edc 100644 --- a/SignalMessaging/contacts/SelectThreadViewController.m +++ b/SignalMessaging/contacts/SelectThreadViewController.m @@ -181,6 +181,7 @@ NS_ASSUME_NONNULL_BEGIN NewNonContactConversationViewController *viewController = [NewNonContactConversationViewController new]; viewController.nonContactConversationDelegate = weakSelf; + viewController.isPresentedInNavigationController = YES; [weakSelf.navigationController pushViewController:viewController animated:YES]; }]]; diff --git a/SignalShareExtension/ShareViewController.swift b/SignalShareExtension/ShareViewController.swift index eadbe8cf6e..d80c7ba194 100644 --- a/SignalShareExtension/ShareViewController.swift +++ b/SignalShareExtension/ShareViewController.swift @@ -10,7 +10,7 @@ import SignalServiceKit import PromiseKit @objc -public class ShareViewController: UINavigationController, ShareViewDelegate, SAEFailedViewDelegate { +public class ShareViewController: UIViewController, ShareViewDelegate, SAEFailedViewDelegate { enum ShareViewControllerError: Error { case assertionError(description: String) @@ -105,8 +105,6 @@ public class ShareViewController: UINavigationController, ShareViewDelegate, SAE self.versionMigrationsDidComplete() }) - self.isNavigationBarHidden = true - // We don't need to use "screen protection" in the SAE. // Ensure OWSContactsSyncing is instantiated. @@ -470,7 +468,6 @@ public class ShareViewController: UINavigationController, ShareViewDelegate, SAE self.buildAttachment().then { attachment -> Void in let conversationPicker = SharingThreadPickerViewController(shareViewDelegate: self) conversationPicker.attachment = attachment - self.shareViewNavigationController.isNavigationBarHidden = true self.progressPoller = nil self.loadViewController = nil self.showPrimaryViewController(conversationPicker)