From e2f924104062cccc347694b7ba1f40be8e09914f Mon Sep 17 00:00:00 2001 From: Diego Mello Date: Wed, 26 Jun 2019 09:33:56 -0300 Subject: [PATCH] [FIX] App hang on "updating" (#997) * [FIX] App hang on "updating" * Fix iOS notification tap --- app/lib/methods/subscriptions/rooms.js | 13 +++++++------ app/notifications/push/push.ios.js | 5 +++-- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/app/lib/methods/subscriptions/rooms.js b/app/lib/methods/subscriptions/rooms.js index 5b23fbda7..bc70b394a 100644 --- a/app/lib/methods/subscriptions/rooms.js +++ b/app/lib/methods/subscriptions/rooms.js @@ -15,7 +15,7 @@ let disconnectedListener; let streamListener; let subServer; -export default async function subscribeRooms() { +export default function subscribeRooms() { let timer = null; const loop = () => { if (timer) { @@ -156,12 +156,13 @@ export default async function subscribeRooms() { try { // set the server that started this task subServer = this.sdk.client.host; - await this.sdk.subscribeNotifyUser(); + this.sdk.subscribeNotifyUser().catch(e => console.log(e)); + + return { + stop: () => stop() + }; } catch (e) { log('err_subscribe_rooms', e); + return Promise.reject(); } - - return { - stop: () => stop() - }; } diff --git a/app/notifications/push/push.ios.js b/app/notifications/push/push.ios.js index 56cfa3e9f..fe307ee14 100644 --- a/app/notifications/push/push.ios.js +++ b/app/notifications/push/push.ios.js @@ -25,12 +25,13 @@ class PushNotification { NotificationsIOS.setBadgesCount(count); } - configure(params) { + async configure(params) { this.onRegister = params.onRegister; this.onNotification = params.onNotification; + const initial = await NotificationsIOS.getInitialNotification(); NotificationsIOS.consumeBackgroundQueue(); - return Promise.resolve(); + return Promise.resolve(initial); } } export default new PushNotification();