From 5800222606afb670cd0ed76d4eb00d90c58cc207 Mon Sep 17 00:00:00 2001 From: Niels Andriesse Date: Tue, 14 May 2019 16:37:25 +1000 Subject: [PATCH] Remove unnecessary fetches --- Signal/src/AppDelegate.m | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/Signal/src/AppDelegate.m b/Signal/src/AppDelegate.m index 43566b3c9..d7c0cd30c 100644 --- a/Signal/src/AppDelegate.m +++ b/Signal/src/AppDelegate.m @@ -715,6 +715,8 @@ static NSTimeInterval launchStartedAt; dispatch_async(dispatch_get_main_queue(), ^{ [self.socketManager requestSocketOpen]; [Environment.shared.contactsManager fetchSystemContactsOnceIfAlreadyAuthorized]; + + // Loki: Fetch immediately [[AppEnvironment.shared.messageFetcherJob run] retainUntilComplete]; // Loki: Start poller @@ -1025,10 +1027,6 @@ static NSTimeInterval launchStartedAt; OWSLogInfo(@"Ignoring remote notification; app not ready."); return; } - - [AppReadiness runNowOrWhenAppDidBecomeReady:^{ - [[AppEnvironment.shared.messageFetcherJob run] retainUntilComplete]; - }]; } - (void)application:(UIApplication *)application @@ -1044,13 +1042,6 @@ static NSTimeInterval launchStartedAt; OWSLogInfo(@"Ignoring remote notification; app not ready."); return; } - - [AppReadiness runNowOrWhenAppDidBecomeReady:^{ - [[AppEnvironment.shared.messageFetcherJob run] retainUntilComplete]; - dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 20 * NSEC_PER_SEC), dispatch_get_main_queue(), ^{ - completionHandler(UIBackgroundFetchResultNewData); - }); - }]; } - (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification { @@ -1221,11 +1212,6 @@ static NSTimeInterval launchStartedAt; if ([self.tsAccountManager isRegistered]) { OWSLogInfo(@"localNumber: %@", [TSAccountManager localNumber]); - // Fetch messages as soon as possible after launching. In particular, when - // launching from the background, without this, we end up waiting some extra - // seconds before receiving an actionable push notification. - [[AppEnvironment.shared.messageFetcherJob run] retainUntilComplete]; - // This should happen at any launch, background or foreground. __unused AnyPromise *pushTokenpromise = [OWSSyncPushTokensJob runWithAccountManager:AppEnvironment.shared.accountManager