Refine SAE UI.

pull/1/head
Matthew Chen 7 years ago
parent 6feaf0db1f
commit 114df18372

@ -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];
if (!self.isPresentedInNavigationController) {
self.navigationItem.leftBarButtonItem = self.navigationItem.leftBarButtonItem =
[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemStop [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemStop
target:self target:self
action:@selector(dismissWasPressed:)]; 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;
countryCodeController.isPresentedInNavigationController = self.isPresentedInNavigationController;
if (self.isPresentedInNavigationController) {
[self.navigationController pushViewController:countryCodeController animated:YES];
} else {
UINavigationController *navigationController = UINavigationController *navigationController =
[[UINavigationController alloc] initWithRootViewController:countryCodeController]; [[UINavigationController alloc] initWithRootViewController:countryCodeController];
[self presentViewController:navigationController animated:YES completion:[UIUtil modalCompletionBlock]]; [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