Skip to content

Commit

Permalink
ios: stop using react-native-background-timer
Browse files Browse the repository at this point in the history
Ever since facebook/react-native#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.
  • Loading branch information
saghul committed Sep 17, 2020
1 parent ab21e3c commit 56da400
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions react/features/mobile/polyfills/browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -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') {
Expand Down

0 comments on commit 56da400

Please sign in to comment.