Sfoglia il codice sorgente

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.
master
Saúl Ibarra Corretgé 5 anni fa
parent
commit
56da400f19
1 ha cambiato i file con 6 aggiunte e 4 eliminazioni
  1. 6
    4
      react/features/mobile/polyfills/browser.js

+ 6
- 4
react/features/mobile/polyfills/browser.js Vedi File

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

Loading…
Annulla
Salva