ソースを参照

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年前
コミット
56da400f19
1個のファイルの変更6行の追加4行の削除
  1. 6
    4
      react/features/mobile/polyfills/browser.js

+ 6
- 4
react/features/mobile/polyfills/browser.js ファイルの表示

@@ -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') {

読み込み中…
キャンセル
保存