mirror of
https://github.com/oxen-io/session-ios.git
synced 2023-12-13 21:30:14 +01:00
Clean up ahead of PR.
This commit is contained in:
parent
022b2f93dd
commit
150f417a5e
9 changed files with 36 additions and 33 deletions
|
@ -5,6 +5,7 @@
|
|||
#import "AttachmentSharing.h"
|
||||
#import "TSAttachmentStream.h"
|
||||
#import "UIUtil.h"
|
||||
#import <SignalServiceKit/AppContext.h>
|
||||
#import <SignalServiceKit/Threading.h>
|
||||
|
||||
@implementation AttachmentSharing
|
||||
|
@ -55,10 +56,7 @@
|
|||
}
|
||||
}];
|
||||
|
||||
// Find the frontmost presented UIViewController from which to present the
|
||||
// share view.
|
||||
UIWindow *window = [UIApplication sharedApplication].keyWindow;
|
||||
UIViewController *fromViewController = window.rootViewController;
|
||||
UIViewController *fromViewController = CurrentAppContext().frontmostViewController;
|
||||
while (fromViewController.presentedViewController) {
|
||||
fromViewController = fromViewController.presentedViewController;
|
||||
}
|
||||
|
|
|
@ -403,7 +403,7 @@ class MediaMessageView: UIView, OWSAudioAttachmentPlayerDelegate {
|
|||
guard let fromView = sender.view else {
|
||||
return
|
||||
}
|
||||
guard let fromViewController = fromViewController() else {
|
||||
guard let fromViewController = CurrentAppContext().frontmostViewController() else {
|
||||
return
|
||||
}
|
||||
let window = UIApplication.shared.keyWindow
|
||||
|
@ -412,19 +412,6 @@ class MediaMessageView: UIView, OWSAudioAttachmentPlayerDelegate {
|
|||
viewController.present(from:fromViewController)
|
||||
}
|
||||
|
||||
private func fromViewController() -> UIViewController? {
|
||||
var responder: UIResponder? = self
|
||||
while true {
|
||||
if responder == nil {
|
||||
return nil
|
||||
}
|
||||
if let viewController = responder as? UIViewController {
|
||||
return viewController
|
||||
}
|
||||
responder = responder?.next
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Video Playback
|
||||
|
||||
func videoTapped(sender: UIGestureRecognizer) {
|
||||
|
|
|
@ -74,6 +74,11 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
return getenv("runningTests_dontStartApp");
|
||||
}
|
||||
|
||||
- (void)setNetworkActivityIndicatorVisible:(BOOL)value
|
||||
{
|
||||
[[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:value];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
|
|
@ -13,9 +13,11 @@ FOUNDATION_EXPORT const unsigned char SignalMessagingVersionString[];
|
|||
// The public headers of the framework
|
||||
#import <SignalMessaging/DebugLogger.h>
|
||||
#import <SignalMessaging/Environment.h>
|
||||
#import <SignalMessaging/NSString+OWS.h>
|
||||
#import <SignalMessaging/OWSDatabaseMigration.h>
|
||||
#import <SignalMessaging/OWSFormat.h>
|
||||
#import <SignalMessaging/OWSLogger.h>
|
||||
#import <SignalMessaging/OWSMath.h>
|
||||
#import <SignalMessaging/OWSProfileManager.h>
|
||||
#import <SignalMessaging/Release.h>
|
||||
#import <SignalMessaging/UIViewController+OWS.h>
|
||||
|
|
|
@ -232,7 +232,8 @@ NSString *const kTSStorageManager_lastKnownContactRecipientIds = @"lastKnownCont
|
|||
|
||||
for (Contact *contact in contacts) {
|
||||
NSArray<SignalRecipient *> *signalRecipients = contactIdToSignalRecipientsMap[contact.uniqueId];
|
||||
for (SignalRecipient *signalRecipient in [signalRecipients sortedArrayUsingSelector:@selector(compare:)]) {
|
||||
for (SignalRecipient *signalRecipient in
|
||||
[signalRecipients sortedArrayUsingSelector:@selector((compare:))]) {
|
||||
SignalAccount *signalAccount = [[SignalAccount alloc] initWithSignalRecipient:signalRecipient];
|
||||
signalAccount.contact = contact;
|
||||
if (signalRecipients.count > 1) {
|
||||
|
@ -437,7 +438,7 @@ NSString *const kTSStorageManager_lastKnownContactRecipientIds = @"lastKnownCont
|
|||
OWSAssert([phoneNumbersWithTheSameName containsObject:recipientId]);
|
||||
if (phoneNumbersWithTheSameName.count > 1) {
|
||||
NSUInteger index =
|
||||
[[phoneNumbersWithTheSameName sortedArrayUsingSelector:@selector(compare:)] indexOfObject:recipientId];
|
||||
[[phoneNumbersWithTheSameName sortedArrayUsingSelector:@selector((compare:))] indexOfObject:recipientId];
|
||||
NSString *indexText = [OWSFormat formatInt:(int)index + 1];
|
||||
phoneNumberLabel =
|
||||
[NSString stringWithFormat:NSLocalizedString(@"PHONE_NUMBER_TYPE_AND_INDEX_NAME_FORMAT",
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#import "LockInteractionController.h"
|
||||
#import "OWSDatabaseMigrationRunner.h"
|
||||
#import "SignalKeyingStorage.h"
|
||||
#import <SignalServiceKit/AppContext.h>
|
||||
#import <SignalServiceKit/AppVersion.h>
|
||||
#import <SignalServiceKit/NSUserDefaults+OWS.h>
|
||||
#import <SignalServiceKit/TSAccountManager.h>
|
||||
|
@ -65,9 +66,7 @@
|
|||
}];
|
||||
[alertController addAction:quitAction];
|
||||
|
||||
[[UIApplication sharedApplication].keyWindow.rootViewController presentViewController:alertController
|
||||
animated:YES
|
||||
completion:nil];
|
||||
[CurrentAppContext().frontmostViewController presentViewController:alertController animated:YES completion:nil];
|
||||
}
|
||||
|
||||
if ([self isVersion:previousVersion atLeast:@"2.0.0" andLessThan:@"2.1.70"] && [TSAccountManager isRegistered]) {
|
||||
|
|
|
@ -3,11 +3,16 @@
|
|||
//
|
||||
|
||||
#import "LockInteractionController.h"
|
||||
#import <SignalServiceKit/AppContext.h>
|
||||
|
||||
@interface LockInteractionController ()
|
||||
@property UIAlertController *alertController;
|
||||
|
||||
@property (nonatomic) UIAlertController *alertController;
|
||||
|
||||
@end
|
||||
|
||||
#pragma mark -
|
||||
|
||||
@implementation LockInteractionController
|
||||
|
||||
+ (instancetype)sharedController
|
||||
|
@ -27,7 +32,7 @@
|
|||
|
||||
{
|
||||
if (networkFlag) {
|
||||
[[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:networkFlag];
|
||||
[CurrentAppContext() setNetworkActivityIndicatorVisible:networkFlag];
|
||||
}
|
||||
|
||||
LockInteractionController *sharedController = [LockInteractionController sharedController];
|
||||
|
@ -36,10 +41,9 @@
|
|||
message:nil
|
||||
preferredStyle:UIAlertControllerStyleAlert];
|
||||
|
||||
[[UIApplication sharedApplication].keyWindow.rootViewController
|
||||
presentViewController:sharedController.alertController
|
||||
animated:YES
|
||||
completion:nil];
|
||||
[CurrentAppContext().frontmostViewController presentViewController:sharedController.alertController
|
||||
animated:YES
|
||||
completion:nil];
|
||||
|
||||
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
|
||||
BOOL success = blockingOperation();
|
||||
|
@ -49,7 +53,7 @@
|
|||
dismissViewControllerAnimated:YES
|
||||
completion:^{
|
||||
if (networkFlag) {
|
||||
[[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:NO];
|
||||
[CurrentAppContext() setNetworkActivityIndicatorVisible:NO];
|
||||
}
|
||||
|
||||
if (!success) {
|
||||
|
@ -84,9 +88,7 @@
|
|||
usesNetwork:YES];
|
||||
}]];
|
||||
|
||||
[[UIApplication sharedApplication].keyWindow.rootViewController presentViewController:retryController
|
||||
animated:YES
|
||||
completion:nil];
|
||||
[CurrentAppContext().frontmostViewController presentViewController:retryController animated:YES completion:nil];
|
||||
};
|
||||
|
||||
return retryBlock;
|
||||
|
|
|
@ -22,6 +22,7 @@ typedef void (^BackgroundTaskExpirationHandler)(void);
|
|||
// Should just return UIBackgroundTaskInvalid if isMainApp is NO.
|
||||
- (UIBackgroundTaskIdentifier)beginBackgroundTaskWithExpirationHandler:
|
||||
(BackgroundTaskExpirationHandler)expirationHandler;
|
||||
|
||||
// Should be a NOOP if isMainApp is NO.
|
||||
- (void)endBackgroundTask:(UIBackgroundTaskIdentifier)backgroundTaskIdentifier;
|
||||
|
||||
|
@ -42,6 +43,9 @@ typedef void (^BackgroundTaskExpirationHandler)(void);
|
|||
|
||||
- (BOOL)isRunningTests;
|
||||
|
||||
// Should be a NOOP if isMainApp is NO.
|
||||
- (void)setNetworkActivityIndicatorVisible:(BOOL)value;
|
||||
|
||||
@end
|
||||
|
||||
id<AppContext> CurrentAppContext(void);
|
||||
|
|
|
@ -98,6 +98,11 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
return NO;
|
||||
}
|
||||
|
||||
- (void)setNetworkActivityIndicatorVisible:(BOOL)value
|
||||
{
|
||||
OWSFail(@"%@ called %s.", self.logTag, __PRETTY_FUNCTION__);
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
|
Loading…
Reference in a new issue