CR: rename keyWindow -> keyReferenceView, split long line

// FREEBIE
pull/1/head
Michael Kirk 7 years ago
parent ca999627ef
commit 0429836ff9

@ -76,7 +76,7 @@ NS_ASSUME_NONNULL_BEGIN
return UIApplication.sharedApplication.frontmostViewControllerIgnoringAlerts;
}
- (UIView *)keyWindow
- (nullable UIView *)rootReferenceView
{
return UIApplication.sharedApplication.keyWindow;
}

@ -383,7 +383,7 @@ NS_ASSUME_NONNULL_BEGIN
presentViewController:self
animated:NO
completion:^{
UIView *window = CurrentAppContext().keyWindow;
UIView *window = CurrentAppContext().rootReferenceView;
// During the presentation animation, we want to seamlessly animate the image
// from its location in the conversation view. To do so, we need a
// consistent coordinate system, so we pass the `originRect` in the

@ -426,7 +426,7 @@ public class MediaMessageView: UIView, OWSAudioAttachmentPlayerDelegate {
return
}
let window = CurrentAppContext().keyWindow
let window = CurrentAppContext().rootReferenceView
let convertedRect = fromView.convert(fromView.bounds, to:window)
let viewController = FullImageViewController(attachment:attachment, from:convertedRect)
viewController.present(from:fromViewController)

@ -19,7 +19,7 @@ typedef void (^BackgroundTaskExpirationHandler)(void);
@property (nonatomic, readonly) BOOL isRunningTests;
// Useful for translating coordinates to the "entire screen"
@property (nonatomic, readonly) UIView *keyWindow;
@property (nonatomic, readonly, nullable) UIView *rootReferenceView;
// Should only be called if isMainApp is YES.
//

@ -355,7 +355,8 @@ public class ShareViewController: UINavigationController, SAELoadViewDelegate, S
self.setViewControllers([conversationPicker], animated: true)
Logger.info("showing picker with attachment: \(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."),
let alertTitle = 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.")
OWSAlerts.showAlert(withTitle: alertTitle,
message: error.localizedDescription,
buttonTitle: CommonStrings.cancelButton) { _ in
self.shareExtensionWasCancelled()

@ -92,7 +92,7 @@ NS_ASSUME_NONNULL_BEGIN
return [self.rootViewController findFrontmostViewController:YES];
}
- (UIView *)keyWindow
- (nullable UIView *)rootReferenceView
{
return self.rootViewController.view;
}

Loading…
Cancel
Save