From 56da400f19e3cf1e712d26ed1e478846c9b2b7b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sa=C3=BAl=20Ibarra=20Corretg=C3=A9?= Date: Thu, 17 Sep 2020 11:39:10 +0200 Subject: [PATCH] ios: stop using react-native-background-timer Ever since https://github.com/facebook/react-native/pull/23674 landed it has been possible to run timers in the background, assuming your app is allowed to run in the background already, as is our case. So, stop using the library on iOS, which will avoid creatring needless backgound tasks. --- react/features/mobile/polyfills/browser.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/react/features/mobile/polyfills/browser.js b/react/features/mobile/polyfills/browser.js index 3ce8a6568..3b24ccbe2 100644 --- a/react/features/mobile/polyfills/browser.js +++ b/react/features/mobile/polyfills/browser.js @@ -415,10 +415,12 @@ function _visitNode(node, callback) { // Required by: // - lib-jitsi-meet // - Strophe - global.clearTimeout = BackgroundTimer.clearTimeout.bind(BackgroundTimer); - global.clearInterval = BackgroundTimer.clearInterval.bind(BackgroundTimer); - global.setInterval = BackgroundTimer.setInterval.bind(BackgroundTimer); - global.setTimeout = (fn, ms = 0) => BackgroundTimer.setTimeout(fn, ms); + if (Platform.OS === 'android') { + global.clearTimeout = BackgroundTimer.clearTimeout.bind(BackgroundTimer); + global.clearInterval = BackgroundTimer.clearInterval.bind(BackgroundTimer); + global.setInterval = BackgroundTimer.setInterval.bind(BackgroundTimer); + global.setTimeout = (fn, ms = 0) => BackgroundTimer.setTimeout(fn, ms); + } // localStorage if (typeof global.localStorage === 'undefined') {