New version startup: clear remote expiration, hydrate from remote config

This commit is contained in:
Scott Nonnenberg 2021-08-24 16:36:43 -07:00 committed by GitHub
parent 2fe142b6d3
commit 9f1bd94627
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -678,6 +678,14 @@ export async function startApp(): Promise<void> {
`New version detected: ${currentVersion}; previous: ${lastVersion}`
);
const remoteBuildExpiration = window.storage.get('remoteBuildExpiration');
if (remoteBuildExpiration) {
window.log.info(
`Clearing remoteBuildExpiration. Previous value was ${remoteBuildExpiration}`
);
window.storage.remove('remoteBuildExpiration');
}
const themeSetting = window.Events.getThemeSetting();
const newThemeSetting = mapOldThemeToNew(themeSetting);
@ -1990,6 +1998,24 @@ export async function startApp(): Promise<void> {
// Force a re-fetch before we process our queue. We may want to turn on
// something which changes how we process incoming messages!
await window.Signal.RemoteConfig.refreshRemoteConfig(server);
const expiration = window.Signal.RemoteConfig.getValue(
'desktop.clientExpiration'
);
if (expiration) {
const remoteBuildExpirationTimestamp = window.Signal.Util.parseRemoteClientExpiration(
expiration as string
);
if (remoteBuildExpirationTimestamp) {
window.storage.put(
'remoteBuildExpiration',
remoteBuildExpirationTimestamp
);
window.reduxActions.expiration.hydrateExpirationStatus(
window.Signal.Util.hasExpired()
);
}
}
} catch (error) {
window.log.error(
'connect: Error refreshing remote config:',