Generate mock notification upon successful message retrieval
This commit is contained in:
parent
188d6d4d17
commit
2092df955a
|
@ -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(^{
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue