Stop showing version notification after 3 days

This commit is contained in:
Alexander Zinchuk 2022-09-16 18:28:45 +02:00
parent 19ac35b676
commit 4d8d208d78
3 changed files with 8 additions and 0 deletions

View File

@ -2,6 +2,7 @@ import type { ApiLimitType } from './global/types';
export const APP_NAME = process.env.APP_NAME || 'Telegram WebZ';
export const APP_VERSION = process.env.APP_VERSION!;
export const RELEASE_DATETIME = process.env.RELEASE_DATETIME;
export const PRODUCTION_HOSTNAME = 'web.telegram.org';

View File

@ -7,6 +7,7 @@ import { FocusDirection } from '../../../types';
import {
ANIMATION_END_DELAY,
APP_VERSION,
RELEASE_DATETIME,
FAST_SMOOTH_MAX_DURATION,
SERVICE_NOTIFICATIONS_USER_ID,
} from '../../../config';
@ -49,6 +50,7 @@ import type { GlobalState } from '../../types';
const FOCUS_DURATION = 1500;
const FOCUS_NO_HIGHLIGHT_DURATION = FAST_SMOOTH_MAX_DURATION + ANIMATION_END_DELAY;
const POLL_RESULT_OPEN_DELAY_MS = 450;
const VERSION_NOTIFICATION_DURATION = 1000 * 60 * 60 * 24 * 3; // 3 days
const SERVICE_NOTIFICATIONS_MAX_AMOUNT = 1e3;
let blurTimeout: number | undefined;
@ -617,6 +619,10 @@ addActionHandler('closePollModal', (global) => {
});
addActionHandler('checkVersionNotification', (global, actions) => {
if (RELEASE_DATETIME && Date.now() > Number(RELEASE_DATETIME) + VERSION_NOTIFICATION_DURATION) {
return;
}
const currentVersion = APP_VERSION.split('.').slice(0, 2).join('.');
const { serviceNotifications } = global;

View File

@ -156,6 +156,7 @@ module.exports = (_env, { mode = 'production' }) => {
APP_MOCKED_CLIENT,
APP_NAME: null,
APP_VERSION: appVersion,
RELEASE_DATETIME: Date.now(),
TELEGRAM_T_API_ID: undefined,
TELEGRAM_T_API_HASH: undefined,
TEST_SESSION: null,