diff --git a/src/libs/checkForUpdates.ts b/src/libs/checkForUpdates.ts index 51ce12335e29..532253d7494f 100644 --- a/src/libs/checkForUpdates.ts +++ b/src/libs/checkForUpdates.ts @@ -1,9 +1,6 @@ -const UPDATE_INTERVAL = 1000 * 60 * 60 * 8; +import type PlatformSpecificUpdater from '@src/setup/platformSetup/types'; -type PlatformSpecificUpdater = { - update: () => void; - init?: () => void; -}; +const UPDATE_INTERVAL = 1000 * 60 * 60 * 8; function checkForUpdates(platformSpecificUpdater: PlatformSpecificUpdater) { if (typeof platformSpecificUpdater.init === 'function') { @@ -16,4 +13,4 @@ function checkForUpdates(platformSpecificUpdater: PlatformSpecificUpdater) { }, UPDATE_INTERVAL); } -module.exports = checkForUpdates; +export default checkForUpdates; diff --git a/src/setup/index.js b/src/setup/index.ts similarity index 100% rename from src/setup/index.js rename to src/setup/index.ts diff --git a/src/setup/platformSetup/index.desktop.js b/src/setup/platformSetup/index.desktop.ts similarity index 100% rename from src/setup/platformSetup/index.desktop.js rename to src/setup/platformSetup/index.desktop.ts diff --git a/src/setup/platformSetup/index.native.js b/src/setup/platformSetup/index.native.ts similarity index 100% rename from src/setup/platformSetup/index.native.js rename to src/setup/platformSetup/index.native.ts diff --git a/src/setup/platformSetup/index.ts b/src/setup/platformSetup/index.ts new file mode 100644 index 000000000000..2d1ec238274a --- /dev/null +++ b/src/setup/platformSetup/index.ts @@ -0,0 +1 @@ +export default () => {}; diff --git a/src/setup/platformSetup/index.website.js b/src/setup/platformSetup/index.website.ts similarity index 91% rename from src/setup/platformSetup/index.website.js rename to src/setup/platformSetup/index.website.ts index bdc64e769e09..0fef333e6508 100644 --- a/src/setup/platformSetup/index.website.js +++ b/src/setup/platformSetup/index.website.ts @@ -6,6 +6,7 @@ import DateUtils from '@libs/DateUtils'; import Visibility from '@libs/Visibility'; import Config from '@src/CONFIG'; import pkg from '../../../package.json'; +import type PlatformSpecificUpdater from './types'; /** * Download the latest app version from the server, and if it is different than the current one, @@ -21,23 +22,21 @@ function webUpdate() { if (!Visibility.isVisible()) { // Page is hidden, refresh immediately - window.location.reload(true); + window.location.reload(); return; } // Prompt user to refresh the page if (window.confirm('Refresh the page to get the latest updates!')) { - window.location.reload(true); + window.location.reload(); } }); } /** * Create an object whose shape reflects the callbacks used in checkForUpdates. - * - * @returns {Object} */ -const webUpdater = () => ({ +const webUpdater = (): PlatformSpecificUpdater => ({ init: () => { // We want to check for updates and refresh the page if necessary when the app is backgrounded. // That way, it will auto-update silently when they minimize the page, diff --git a/src/setup/platformSetup/types.ts b/src/setup/platformSetup/types.ts new file mode 100644 index 000000000000..1deb4c374153 --- /dev/null +++ b/src/setup/platformSetup/types.ts @@ -0,0 +1,6 @@ +type PlatformSpecificUpdater = { + update: () => void; + init?: () => void; +}; + +export default PlatformSpecificUpdater; diff --git a/src/types/onyx/Session.ts b/src/types/onyx/Session.ts index e17bfaf1c2b9..88417a03d903 100644 --- a/src/types/onyx/Session.ts +++ b/src/types/onyx/Session.ts @@ -20,6 +20,9 @@ type Session = { /** Currently logged in user encrypted authToken */ encryptedAuthToken?: string; + /** Boolean that indicates whether it is loading or not */ + loading?: boolean; + /** Currently logged in user accountID */ accountID?: number;