Merge branch 'charlesmchen/saeRefinements'

pull/1/head
Matthew Chen 8 years ago
commit ebb778cf52

@ -1452,9 +1452,6 @@
/* Label for the send button in the conversation view. */ /* Label for the send button in the conversation view. */
"SEND_BUTTON_TITLE" = "Send"; "SEND_BUTTON_TITLE" = "Send";
/* Title for the 'send external file' view. */
"SEND_EXTERNAL_FILE_VIEW_TITLE" = "Send File";
/* Alert body after invite failed */ /* Alert body after invite failed */
"SEND_INVITE_FAILURE" = "Sending invite failed, please try again later."; "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. */ /* 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"; "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 */ /* Action sheet item */
"SHOW_SAFETY_NUMBER_ACTION" = "Show New Safety Number"; "SHOW_SAFETY_NUMBER_ACTION" = "Show New Safety Number";

@ -59,7 +59,7 @@ typedef void (^SendMessageBlock)(SendCompletionBlock completion);
_messageSender = [Environment current].messageSender; _messageSender = [Environment current].messageSender;
_progressView = [[UIProgressView alloc] initWithProgressViewStyle:UIProgressViewStyleDefault]; _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 - (void)viewDidLoad
@ -149,6 +149,12 @@ typedef void (^SendMessageBlock)(SendCompletionBlock completion);
NSString *_Nullable messageText = [self convertAttachmentToMessageTextIfPossible]; 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) { if (messageText) {
MessageApprovalViewController *approvalVC = MessageApprovalViewController *approvalVC =
[[MessageApprovalViewController alloc] initWithMessageText:messageText [[MessageApprovalViewController alloc] initWithMessageText:messageText

@ -21,4 +21,6 @@
@property (nonatomic, weak) id<CountryCodeViewControllerDelegate> countryCodeDelegate; @property (nonatomic, weak) id<CountryCodeViewControllerDelegate> countryCodeDelegate;
@property (nonatomic) BOOL isPresentedInNavigationController;
@end @end

@ -31,10 +31,12 @@
self.countryCodes = [PhoneNumberUtil countryCodesForSearchTerm:nil]; self.countryCodes = [PhoneNumberUtil countryCodesForSearchTerm:nil];
self.navigationItem.leftBarButtonItem = if (!self.isPresentedInNavigationController) {
[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemStop self.navigationItem.leftBarButtonItem =
target:self [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemStop
action:@selector(dismissWasPressed:)]; target:self
action:@selector(dismissWasPressed:)];
}
[self createViews]; [self createViews];
} }

@ -40,6 +40,8 @@ NS_ASSUME_NONNULL_BEGIN
@property (nonatomic, readonly) ContactsViewHelper *contactsViewHelper; @property (nonatomic, readonly) ContactsViewHelper *contactsViewHelper;
@property (nonatomic) BOOL isPresentedInNavigationController;
@end @end
NS_ASSUME_NONNULL_END NS_ASSUME_NONNULL_END

@ -238,10 +238,10 @@ NSString *const kSelectRecipientViewControllerCellIdentifier = @"kSelectRecipien
callingCode:(NSString *)callingCode callingCode:(NSString *)callingCode
countryCode:(NSString *)countryCode countryCode:(NSString *)countryCode
{ {
_callingCode = callingCode; _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 setTitle:title forState:UIControlStateNormal];
[self.countryCodeButton layoutSubviews]; [self.countryCodeButton layoutSubviews];
@ -263,9 +263,14 @@ NSString *const kSelectRecipientViewControllerCellIdentifier = @"kSelectRecipien
{ {
CountryCodeViewController *countryCodeController = [CountryCodeViewController new]; CountryCodeViewController *countryCodeController = [CountryCodeViewController new];
countryCodeController.countryCodeDelegate = self; countryCodeController.countryCodeDelegate = self;
UINavigationController *navigationController = countryCodeController.isPresentedInNavigationController = self.isPresentedInNavigationController;
[[UINavigationController alloc] initWithRootViewController:countryCodeController]; if (self.isPresentedInNavigationController) {
[self presentViewController:navigationController animated:YES completion:[UIUtil modalCompletionBlock]]; [self.navigationController pushViewController:countryCodeController animated:YES];
} else {
UINavigationController *navigationController =
[[UINavigationController alloc] initWithRootViewController:countryCodeController];
[self presentViewController:navigationController animated:YES completion:[UIUtil modalCompletionBlock]];
}
} }
- (void)phoneNumberButtonPressed - (void)phoneNumberButtonPressed

@ -181,6 +181,7 @@ NS_ASSUME_NONNULL_BEGIN
NewNonContactConversationViewController *viewController = NewNonContactConversationViewController *viewController =
[NewNonContactConversationViewController new]; [NewNonContactConversationViewController new];
viewController.nonContactConversationDelegate = weakSelf; viewController.nonContactConversationDelegate = weakSelf;
viewController.isPresentedInNavigationController = YES;
[weakSelf.navigationController pushViewController:viewController [weakSelf.navigationController pushViewController:viewController
animated:YES]; animated:YES];
}]]; }]];

@ -10,7 +10,7 @@ import SignalServiceKit
import PromiseKit import PromiseKit
@objc @objc
public class ShareViewController: UINavigationController, ShareViewDelegate, SAEFailedViewDelegate { public class ShareViewController: UIViewController, ShareViewDelegate, SAEFailedViewDelegate {
enum ShareViewControllerError: Error { enum ShareViewControllerError: Error {
case assertionError(description: String) case assertionError(description: String)
@ -105,8 +105,6 @@ public class ShareViewController: UINavigationController, ShareViewDelegate, SAE
self.versionMigrationsDidComplete() self.versionMigrationsDidComplete()
}) })
self.isNavigationBarHidden = true
// We don't need to use "screen protection" in the SAE. // We don't need to use "screen protection" in the SAE.
// Ensure OWSContactsSyncing is instantiated. // Ensure OWSContactsSyncing is instantiated.
@ -470,7 +468,6 @@ public class ShareViewController: UINavigationController, ShareViewDelegate, SAE
self.buildAttachment().then { attachment -> Void in self.buildAttachment().then { attachment -> Void in
let conversationPicker = SharingThreadPickerViewController(shareViewDelegate: self) let conversationPicker = SharingThreadPickerViewController(shareViewDelegate: self)
conversationPicker.attachment = attachment conversationPicker.attachment = attachment
self.shareViewNavigationController.isNavigationBarHidden = true
self.progressPoller = nil self.progressPoller = nil
self.loadViewController = nil self.loadViewController = nil
self.showPrimaryViewController(conversationPicker) self.showPrimaryViewController(conversationPicker)

Loading…
Cancel
Save