浏览代码

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.
j8
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
     // Required by:
415
     // Required by:
416
     // - lib-jitsi-meet
416
     // - lib-jitsi-meet
417
     // - Strophe
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
     // localStorage
425
     // localStorage
424
     if (typeof global.localStorage === 'undefined') {
426
     if (typeof global.localStorage === 'undefined') {

正在加载...
取消
保存