Respond to CR.

// FREEBIE
pull/1/head
Matthew Chen 8 years ago
parent 90eebb3d7d
commit c0f5bda2be

@ -379,20 +379,17 @@
[ModalActivityIndicatorViewController [ModalActivityIndicatorViewController
presentFromViewController:self presentFromViewController:self
canCancel:NO canCancel:NO
presentCompletion:^(ModalActivityIndicatorViewController *modalActivityIndicator) { backgroundBlock:^(ModalActivityIndicatorViewController *modalActivityIndicator) {
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
[TSAccountManager unregisterTextSecureWithSuccess:^{ [TSAccountManager unregisterTextSecureWithSuccess:^{
[Environment resetAppData]; [Environment resetAppData];
} }
failure:^(NSError *error) { failure:^(NSError *error) {
dispatch_async(dispatch_get_main_queue(), ^{ dispatch_async(dispatch_get_main_queue(), ^{
[modalActivityIndicator dismissWithCompletion:^{ [modalActivityIndicator dismissWithCompletion:^{
[OWSAlerts [OWSAlerts showAlertWithTitle:NSLocalizedString(@"UNREGISTER_SIGNAL_FAIL", @"")];
showAlertWithTitle:NSLocalizedString(@"UNREGISTER_SIGNAL_FAIL", @"")];
}]; }];
}); });
}]; }];
});
}]; }];
} }

@ -3456,8 +3456,7 @@ typedef NS_ENUM(NSInteger, MessagesRangeSizeMode) {
[ModalActivityIndicatorViewController [ModalActivityIndicatorViewController
presentFromViewController:self presentFromViewController:self
canCancel:YES canCancel:YES
presentCompletion:^(ModalActivityIndicatorViewController *modalActivityIndicator) { backgroundBlock:^(ModalActivityIndicatorViewController *modalActivityIndicator) {
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
AVAsset *video = [AVAsset assetWithURL:movieURL]; AVAsset *video = [AVAsset assetWithURL:movieURL];
AVAssetExportSession *exportSession = AVAssetExportSession *exportSession =
[AVAssetExportSession exportSessionWithAsset:video [AVAssetExportSession exportSessionWithAsset:video
@ -3498,7 +3497,6 @@ typedef NS_ENUM(NSInteger, MessagesRangeSizeMode) {
}]; }];
}); });
}]; }];
});
}]; }];
} }

@ -36,7 +36,7 @@ class ModalActivityIndicatorViewController: OWSViewController {
} }
public class func present(fromViewController: UIViewController, public class func present(fromViewController: UIViewController,
canCancel: Bool, presentCompletion : @escaping (ModalActivityIndicatorViewController) -> Void) { canCancel: Bool, backgroundBlock : @escaping (ModalActivityIndicatorViewController) -> Void) {
AssertIsOnMainThread() AssertIsOnMainThread()
let view = ModalActivityIndicatorViewController(canCancel:canCancel) let view = ModalActivityIndicatorViewController(canCancel:canCancel)
@ -44,7 +44,9 @@ class ModalActivityIndicatorViewController: OWSViewController {
view.modalPresentationStyle = .overFullScreen view.modalPresentationStyle = .overFullScreen
fromViewController.present(view, fromViewController.present(view,
animated: false) { animated: false) {
presentCompletion(view) DispatchQueue.global().async {
backgroundBlock(view)
}
} }
} }

@ -486,7 +486,7 @@ const NSUInteger kNewGroupViewControllerAvatarWidth = 68;
[ModalActivityIndicatorViewController [ModalActivityIndicatorViewController
presentFromViewController:self presentFromViewController:self
canCancel:NO canCancel:NO
presentCompletion:^(ModalActivityIndicatorViewController *modalActivityIndicator) { backgroundBlock:^(ModalActivityIndicatorViewController *modalActivityIndicator) {
TSOutgoingMessage *message = TSOutgoingMessage *message =
[[TSOutgoingMessage alloc] initWithTimestamp:[NSDate ows_millisecondTimeStamp] [[TSOutgoingMessage alloc] initWithTimestamp:[NSDate ows_millisecondTimeStamp]
inThread:thread inThread:thread
@ -495,6 +495,7 @@ const NSUInteger kNewGroupViewControllerAvatarWidth = 68;
// This will save the message. // This will save the message.
[message updateWithCustomMessage:NSLocalizedString(@"GROUP_CREATED", nil)]; [message updateWithCustomMessage:NSLocalizedString(@"GROUP_CREATED", nil)];
dispatch_async(dispatch_get_main_queue(), ^{
if (model.groupImage) { if (model.groupImage) {
NSData *data = UIImagePNGRepresentation(model.groupImage); NSData *data = UIImagePNGRepresentation(model.groupImage);
DataSource *_Nullable dataSource = DataSource *_Nullable dataSource =
@ -508,6 +509,7 @@ const NSUInteger kNewGroupViewControllerAvatarWidth = 68;
} else { } else {
[self.messageSender sendMessage:message success:successHandler failure:failureHandler]; [self.messageSender sendMessage:message success:successHandler failure:failureHandler];
} }
});
}]; }];
} }

@ -310,8 +310,7 @@ NSString *const kSelectRecipientViewControllerCellIdentifier = @"kSelectRecipien
[ModalActivityIndicatorViewController [ModalActivityIndicatorViewController
presentFromViewController:self presentFromViewController:self
canCancel:YES canCancel:YES
presentCompletion:^(ModalActivityIndicatorViewController *modalActivityIndicator) { backgroundBlock:^(ModalActivityIndicatorViewController *modalActivityIndicator) {
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
[[ContactsUpdater sharedUpdater] lookupIdentifiers:possiblePhoneNumbers [[ContactsUpdater sharedUpdater] lookupIdentifiers:possiblePhoneNumbers
success:^(NSArray<SignalRecipient *> *recipients) { success:^(NSArray<SignalRecipient *> *recipients) {
OWSAssert([NSThread isMainThread]); OWSAssert([NSThread isMainThread]);
@ -336,14 +335,12 @@ NSString *const kSelectRecipientViewControllerCellIdentifier = @"kSelectRecipien
[modalActivityIndicator [modalActivityIndicator
dismissViewControllerAnimated:NO dismissViewControllerAnimated:NO
completion:^{ completion:^{
[OWSAlerts [OWSAlerts showAlertWithTitle:
showAlertWithTitle:
NSLocalizedString(@"ALERT_ERROR_TITLE", NSLocalizedString(@"ALERT_ERROR_TITLE",
@"Title for a generic error alert.") @"Title for a generic error alert.")
message:error.localizedDescription]; message:error.localizedDescription];
}]; }];
}]; }];
});
}]; }];
} else { } else {
NSString *recipientId = possiblePhoneNumbers[0]; NSString *recipientId = possiblePhoneNumbers[0];

Loading…
Cancel
Save