(patch) Don't nudge to refresh in localhost

d16ae73c

## Issue
dev instances are also affected.

## Change
Use another env to enable the feature.

The cleaner solution that avoids the double env is to simply not make MIN_VERSION appear in the default file + define only in production instances. But putting it in the default file makes things clearer, plus easier to "bump + build" by just pushing a new commit.
This commit is contained in:
infinite-persistence 2022-07-12 18:17:50 +08:00 committed by infinite-persistence
parent e858cdd88b
commit d8571781ed
3 changed files with 9 additions and 4 deletions

View file

@ -6,6 +6,9 @@
# Bump this when we want to nudge the user to refresh.
MINIMUM_VERSION=20220708001
# This is 'false' in the production instances:
IGNORE_MINIMUM_VERSION=true
# --- Base config ---
WEBPACK_WEB_PORT=9090
WEBPACK_ELECTRON_PORT=9091

View file

@ -4,6 +4,7 @@ require('dotenv-defaults').config({ silent: false });
const config = {
MINIMUM_VERSION: process.env.MINIMUM_VERSION,
IGNORE_MINIMUM_VERSION: process.env.IGNORE_MINIMUM_VERSION,
WEBPACK_WEB_PORT: process.env.WEBPACK_WEB_PORT,
WEBPACK_ELECTRON_PORT: process.env.WEBPACK_ELECTRON_PORT,
WEB_SERVER_PORT: process.env.WEB_SERVER_PORT,

View file

@ -4,7 +4,7 @@ import isDev from 'electron-is-dev';
import { ipcRenderer, remote } from 'electron';
// @endif
import path from 'path';
import { MINIMUM_VERSION, URL } from 'config';
import { MINIMUM_VERSION, IGNORE_MINIMUM_VERSION, URL } from 'config';
import * as ACTIONS from 'constants/action_types';
import * as MODALS from 'constants/modal_types';
import * as SETTINGS from 'constants/settings';
@ -290,12 +290,13 @@ export function doMinVersionCheck() {
export function doMinVersionSubscribe() {
return (dispatch) => {
// @if process.env.NODE_ENV='production'
dispatch(doMinVersionCheck());
if (IGNORE_MINIMUM_VERSION === 'true') {
return;
}
dispatch(doMinVersionCheck());
const CHECK_UPGRADE_INTERVAL_MS = 60 * 60 * 1000;
setInterval(() => dispatch(doMinVersionCheck()), CHECK_UPGRADE_INTERVAL_MS);
// @endif
};
}