|
|
|
@ -718,10 +718,15 @@ static NSTimeInterval launchStartedAt;
|
|
|
|
[Environment.shared.contactsManager fetchSystemContactsOnceIfAlreadyAuthorized];
|
|
|
|
[Environment.shared.contactsManager fetchSystemContactsOnceIfAlreadyAuthorized];
|
|
|
|
[[AppEnvironment.shared.messageFetcherJob run] retainUntilComplete];
|
|
|
|
[[AppEnvironment.shared.messageFetcherJob run] retainUntilComplete];
|
|
|
|
|
|
|
|
|
|
|
|
[LokiAPI getMessages:^(id response, NSError *error) {
|
|
|
|
[[LokiAPI getMessagesObjc]
|
|
|
|
// TODO: Use the response
|
|
|
|
.then(^(id result) {
|
|
|
|
}];
|
|
|
|
// TODO: handle result
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
.catch(^(NSError *error) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}) retainUntilComplete];
|
|
|
|
|
|
|
|
|
|
|
|
// TODO: Ping friends to let them know we're online
|
|
|
|
// TODO: Ping friends to let them know we're online
|
|
|
|
|
|
|
|
|
|
|
|
if (![UIApplication sharedApplication].isRegisteredForRemoteNotifications) {
|
|
|
|
if (![UIApplication sharedApplication].isRegisteredForRemoteNotifications) {
|
|
|
|
@ -1156,14 +1161,14 @@ static NSTimeInterval launchStartedAt;
|
|
|
|
{
|
|
|
|
{
|
|
|
|
OWSLogInfo(@"performing background fetch");
|
|
|
|
OWSLogInfo(@"performing background fetch");
|
|
|
|
[AppReadiness runNowOrWhenAppDidBecomeReady:^{
|
|
|
|
[AppReadiness runNowOrWhenAppDidBecomeReady:^{
|
|
|
|
[LokiAPI getMessages:^(id response, NSError *error) {
|
|
|
|
[[LokiAPI getMessagesObjc]
|
|
|
|
if (response != nil) {
|
|
|
|
.then(^(id result) {
|
|
|
|
// TODO: Use the response
|
|
|
|
completionHandler(UIBackgroundFetchResultNewData);
|
|
|
|
completionHandler(UIBackgroundFetchResultNewData);
|
|
|
|
})
|
|
|
|
} else {
|
|
|
|
.catch(^(NSError *error) {
|
|
|
|
completionHandler(UIBackgroundFetchResultFailed);
|
|
|
|
completionHandler(UIBackgroundFetchResultFailed);
|
|
|
|
}
|
|
|
|
}) retainUntilComplete];
|
|
|
|
}];
|
|
|
|
|
|
|
|
// Loki: Original code
|
|
|
|
// Loki: Original code
|
|
|
|
// ========
|
|
|
|
// ========
|
|
|
|
// __block AnyPromise *job = [AppEnvironment.shared.messageFetcherJob run].then(^{
|
|
|
|
// __block AnyPromise *job = [AppEnvironment.shared.messageFetcherJob run].then(^{
|
|
|
|
|