From 4e4a9012c2719524c05188c2f66efdd1cf1551f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sa=C3=BAl=20Ibarra=20Corretg=C3=A9?= Date: Tue, 4 Jul 2017 14:50:44 +0200 Subject: [PATCH] [RN] Fix iOS lockups / resprings Apparently iOS doesn't like dangling background tasks very much, so update the background timers plugin with a version which fixes this. https://github.com/ocetnik/react-native-background-timer/pull/38 Also accomodate for the API changes upstream. Credits to @lyubomir for finding the needle in the haystack. --- package.json | 2 +- .../base/lib-jitsi-meet/native/polyfills-browser.js | 12 ++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index ecc2c5cde..08a894967 100644 --- a/package.json +++ b/package.json @@ -47,7 +47,7 @@ "react-dom": "15.4.2", "react-i18next": "4.1.0", "react-native": "0.42.3", - "react-native-background-timer": "1.0.2", + "react-native-background-timer": "saghul/react-native-background-timer#ios-end-task", "react-native-immersive": "0.0.5", "react-native-keep-awake": "2.0.4", "react-native-locale-detector": "1.0.1", diff --git a/react/features/base/lib-jitsi-meet/native/polyfills-browser.js b/react/features/base/lib-jitsi-meet/native/polyfills-browser.js index 9bde778e1..3107e576d 100644 --- a/react/features/base/lib-jitsi-meet/native/polyfills-browser.js +++ b/react/features/base/lib-jitsi-meet/native/polyfills-browser.js @@ -372,9 +372,13 @@ function _visitNode(node, callback) { // Required by: // - lib-jitsi-meet // - Strophe - global.clearTimeout = window.clearTimeout = BackgroundTimer.clearTimeout; - global.clearInterval = window.clearInterval = BackgroundTimer.clearInterval; - global.setInterval = window.setInterval = BackgroundTimer.setInterval; - global.setTimeout = window.setTimeout = BackgroundTimer.setTimeout; + global.clearTimeout = window.clearTimeout + = BackgroundTimer.clearTimeout.bind(BackgroundTimer); + global.clearInterval = window.clearInterval + = BackgroundTimer.clearInterval.bind(BackgroundTimer); + global.setInterval = window.setInterval + = BackgroundTimer.setInterval.bind(BackgroundTimer); + global.setTimeout = window.setTimeout + = BackgroundTimer.setTimeout.bind(BackgroundTimer); })(global || window || this); // eslint-disable-line no-invalid-this