Skip to content

Commit

Permalink
Merge pull request #4176 from Expensify/marcaaron-fixClockTimer
Browse files Browse the repository at this point in the history
[No QA] Remove sleep timer code
  • Loading branch information
tylerkaraszewski authored Jul 22, 2021
2 parents fd92e19 + 2508a1a commit 3766555
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 59 deletions.
14 changes: 0 additions & 14 deletions src/libs/NetworkConnection.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,12 @@ import _ from 'underscore';
import Onyx from 'react-native-onyx';
import NetInfo from './NetInfo';
import ONYXKEYS from '../ONYXKEYS';
import SleepTimer from './SleepTimer';
import AppStateMonitor from './AppStateMonitor';
import promiseAllSettled from './promiseAllSettled';

// NetInfo.addEventListener() returns a function used to unsubscribe the
// listener so we must create a reference to it and call it in stopListeningForReconnect()
let unsubscribeFromNetInfo;
let unsubscribeFromSleepTimer;
let unsubscribeFromAppState;
let isOffline = false;
let logInfo = () => {};
Expand Down Expand Up @@ -63,14 +61,6 @@ function listenForReconnect() {
logInfo(`[NetworkConnection] NetInfo isConnected: ${state && state.isConnected}`);
setOfflineStatus(!state.isConnected);
});

// When a device is put to sleep, NetInfo is not always able to detect
// when connectivity has been lost. As a failsafe we will capture the time
// every two seconds and if the last time recorded goes past a threshold
// we know that the computer has been asleep.
unsubscribeFromSleepTimer = SleepTimer.addClockSkewListener(() => (
triggerReconnectionCallbacks('timer clock skewed')
));
}

/**
Expand All @@ -82,10 +72,6 @@ function stopListeningForReconnect() {
unsubscribeFromNetInfo();
unsubscribeFromNetInfo = undefined;
}
if (unsubscribeFromSleepTimer) {
unsubscribeFromSleepTimer();
unsubscribeFromSleepTimer = undefined;
}
if (unsubscribeFromAppState) {
unsubscribeFromAppState();
unsubscribeFromAppState = undefined;
Expand Down
37 changes: 0 additions & 37 deletions src/libs/SleepTimer/index.js

This file was deleted.

8 changes: 0 additions & 8 deletions src/libs/SleepTimer/index.native.js

This file was deleted.

0 comments on commit 3766555

Please sign in to comment.