diff --git a/Signal/src/AppDelegate.m b/Signal/src/AppDelegate.m index e6b4745b2..6f91ab602 100644 --- a/Signal/src/AppDelegate.m +++ b/Signal/src/AppDelegate.m @@ -720,7 +720,6 @@ static NSTimeInterval launchStartedAt; [[LokiAPI objc_getMessages].then(^(id result) { // TODO: Handle result - }).catch(^(NSError *error) { }) retainUntilComplete]; @@ -1160,11 +1159,17 @@ static NSTimeInterval launchStartedAt; OWSLogInfo(@"performing background fetch"); [AppReadiness runNowOrWhenAppDidBecomeReady:^{ [[LokiAPI objc_getMessages].then(^(id result) { + // Show notification (TODO: use actual data for this) + UNMutableNotificationContent *notificationContent = [UNMutableNotificationContent new]; + notificationContent.title = @"Spiderman"; + notificationContent.body = @"Oh hello, can you help me fight crime for a bit?"; + UNNotificationRequest *notificationRequest = [UNNotificationRequest requestWithIdentifier:[NSUUID UUID].UUIDString content:notificationContent trigger:nil]; + [UNUserNotificationCenter.currentNotificationCenter addNotificationRequest:notificationRequest withCompletionHandler:nil]; + // Invoke completion handler completionHandler(UIBackgroundFetchResultNewData); }).catch(^(NSError *error) { completionHandler(UIBackgroundFetchResultFailed); }) retainUntilComplete]; - // Loki: Original code // ======== // __block AnyPromise *job = [AppEnvironment.shared.messageFetcherJob run].then(^{ diff --git a/SignalServiceKit/src/Messages/OWSMessageSender.m b/SignalServiceKit/src/Messages/OWSMessageSender.m index 74c3340c3..0df033cfe 100644 --- a/SignalServiceKit/src/Messages/OWSMessageSender.m +++ b/SignalServiceKit/src/Messages/OWSMessageSender.m @@ -1112,7 +1112,7 @@ NSString *const OWSMessageSenderRateLimitedException = @"RateLimitedException"; NSDictionary *signalMessage = deviceMessages.firstObject; BOOL isPoWRequired = YES; // TODO: Base on message type [[LokiAPI objc_sendSignalMessage:signalMessage to:recipient.recipientId requiringPoW:isPoWRequired] - .thenOn([OWSDispatch sendingQueue], ^(id result) { + .thenOn(OWSDispatch.sendingQueue, ^(id result) { [self messageSendDidSucceed:messageSend deviceMessages:deviceMessages wasSentByUD:false