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.
This commit is contained in:
Saúl Ibarra Corretgé 2020-09-17 11:39:10 +02:00 committed by Saúl Ibarra Corretgé
parent ab21e3cd5e
commit 56da400f19
1 changed files with 6 additions and 4 deletions

View File

@ -415,10 +415,12 @@ function _visitNode(node, callback) {
// Required by: // Required by:
// - lib-jitsi-meet // - lib-jitsi-meet
// - Strophe // - Strophe
if (Platform.OS === 'android') {
global.clearTimeout = BackgroundTimer.clearTimeout.bind(BackgroundTimer); global.clearTimeout = BackgroundTimer.clearTimeout.bind(BackgroundTimer);
global.clearInterval = BackgroundTimer.clearInterval.bind(BackgroundTimer); global.clearInterval = BackgroundTimer.clearInterval.bind(BackgroundTimer);
global.setInterval = BackgroundTimer.setInterval.bind(BackgroundTimer); global.setInterval = BackgroundTimer.setInterval.bind(BackgroundTimer);
global.setTimeout = (fn, ms = 0) => BackgroundTimer.setTimeout(fn, ms); global.setTimeout = (fn, ms = 0) => BackgroundTimer.setTimeout(fn, ms);
}
// localStorage // localStorage
if (typeof global.localStorage === 'undefined') { if (typeof global.localStorage === 'undefined') {