[Perf] Default animation level: 2 → 1

This commit is contained in:
Alexander Zinchuk 2025-08-21 12:04:54 +02:00
parent c78ea0e276
commit a1889b2f6f
4 changed files with 13 additions and 3 deletions

View File

@ -121,7 +121,7 @@ const LeftSideMenuItems = ({
? INITIAL_PERFORMANCE_STATE_MIN
: (newLevel === ANIMATION_LEVEL_MAX ? INITIAL_PERFORMANCE_STATE_MAX : INITIAL_PERFORMANCE_STATE_MED);
setSharedSettingOption({ animationLevel: newLevel as AnimationLevel });
setSharedSettingOption({ animationLevel: newLevel as AnimationLevel, wasAnimationLevelSetManually: true });
updatePerformanceSettings(performanceSettings);
});

View File

@ -166,7 +166,7 @@ export const ANIMATION_LEVEL_CUSTOM = -1;
export const ANIMATION_LEVEL_MIN = 0;
export const ANIMATION_LEVEL_MED = 1;
export const ANIMATION_LEVEL_MAX = 2;
export const ANIMATION_LEVEL_DEFAULT = ANIMATION_LEVEL_MAX;
export const ANIMATION_LEVEL_DEFAULT = ANIMATION_LEVEL_MED;
export const DEFAULT_MESSAGE_TEXT_SIZE_PX = 16;
export const IOS_DEFAULT_MESSAGE_TEXT_SIZE_PX = 17;

View File

@ -10,7 +10,7 @@ import type { ActionReturnType, GlobalState, SharedState } from './types';
import { MAIN_THREAD_ID } from '../api/types';
import {
ALL_FOLDER_ID,
ALL_FOLDER_ID, ANIMATION_LEVEL_DEFAULT,
ARCHIVED_FOLDER_ID,
DEBUG,
DEFAULT_LIMITS,
@ -349,6 +349,14 @@ function unsafeMigrateCache(cached: GlobalState, initialState: GlobalState) {
if (!cached.messages.webPageById) {
cached.messages.webPageById = initialState.messages.webPageById;
}
const cachedSharedSettings = cached.sharedState.settings;
if (
cachedSharedSettings.animationLevel !== ANIMATION_LEVEL_DEFAULT
&& !cachedSharedSettings.wasAnimationLevelSetManually
) {
cachedSharedSettings.animationLevel = ANIMATION_LEVEL_DEFAULT;
}
}
function updateCache(force?: boolean) {

View File

@ -14,6 +14,8 @@ export interface SharedSettings {
performance: PerformanceType;
messageTextSize: number;
animationLevel: AnimationLevel;
// This can be deleted after September 2025, along with the corresponding migration
wasAnimationLevelSetManually?: boolean;
messageSendKeyCombo: 'enter' | 'ctrl-enter';
miniAppsCachedPosition?: Point;
miniAppsCachedSize?: Size;