[Refactoring] Fix incorrect typing for SharedSettings

This commit is contained in:
Alexander Zinchuk 2025-08-21 12:04:43 +02:00
parent 0a9cf1ca0a
commit 347fb38b0b
5 changed files with 33 additions and 64 deletions

View File

@ -4,7 +4,8 @@ import {
} from '../../../lib/teact/teact';
import { getActions, withGlobal } from '../../../global';
import type { SharedSettings, ThemeKey, TimeFormat } from '../../../types';
import type { SharedSettings } from '../../../global/types';
import type { ThemeKey, TimeFormat } from '../../../types';
import type { IRadioOption } from '../../ui/RadioGroup';
import { SettingsScreens } from '../../../types';

View File

@ -4,7 +4,8 @@ import {
} from '../../../lib/teact/teact';
import { getActions, withGlobal } from '../../../global';
import type { AccountSettings, LangCode, SharedSettings } from '../../../types';
import type { SharedSettings } from '../../../global/types';
import type { AccountSettings, LangCode } from '../../../types';
import { SettingsScreens } from '../../../types';
import { selectIsCurrentUserPremium } from '../../../global/selectors';

View File

@ -9,8 +9,9 @@ import {
import { getActions, withGlobal } from '../../../global';
import type { ApiInputMessageReplyInfo } from '../../../api/types';
import type { SharedSettings } from '../../../global/types';
import type {
IAnchorPosition, MessageListType, SharedSettings, ThreadId,
IAnchorPosition, MessageListType, ThreadId,
} from '../../../types';
import type { Signal } from '../../../util/signals';

View File

@ -1,35 +1,30 @@
import type { ApiLanguage } from '../../api/types';
import type {
AnimationLevel,
PerformanceType,
Point,
Size,
ThemeKey,
TimeFormat,
} from '../../types';
import type { AnimationLevel, PerformanceType, Point, Size, ThemeKey, TimeFormat } from '../../types';
export type SharedState = {
settings: {
shouldUseSystemTheme: boolean;
theme: ThemeKey;
language: string;
languages?: ApiLanguage[];
performance: PerformanceType;
messageTextSize: number;
animationLevel: AnimationLevel;
messageSendKeyCombo: 'enter' | 'ctrl-enter';
miniAppsCachedPosition?: Point;
miniAppsCachedSize?: Size;
timeFormat: TimeFormat;
wasTimeFormatSetManually: boolean;
isConnectionStatusMinimized: boolean;
canDisplayChatInTitle: boolean;
shouldForceHttpTransport?: boolean;
shouldAllowHttpTransport?: boolean;
shouldCollectDebugLogs?: boolean;
shouldDebugExportedSenders?: boolean;
shouldWarnAboutSvg?: boolean;
shouldSkipWebAppCloseConfirmation: boolean;
};
export interface SharedState {
settings: SharedSettings;
isInitial?: true;
};
}
export interface SharedSettings {
shouldUseSystemTheme: boolean;
theme: ThemeKey;
language: string;
languages?: ApiLanguage[];
performance: PerformanceType;
messageTextSize: number;
animationLevel: AnimationLevel;
messageSendKeyCombo: 'enter' | 'ctrl-enter';
miniAppsCachedPosition?: Point;
miniAppsCachedSize?: Size;
timeFormat: TimeFormat;
wasTimeFormatSetManually: boolean;
isConnectionStatusMinimized: boolean;
canDisplayChatInTitle: boolean;
shouldForceHttpTransport?: boolean;
shouldAllowHttpTransport?: boolean;
shouldCollectDebugLogs?: boolean;
shouldDebugExportedSenders?: boolean;
shouldWarnAboutSvg?: boolean;
shouldSkipWebAppCloseConfirmation: boolean;
}

View File

@ -18,7 +18,6 @@ import type {
ApiInputReplyInfo,
ApiInputSuggestedPostInfo,
ApiLabeledPrice,
ApiLanguage,
ApiMediaFormat,
ApiMessage,
ApiMessageEntity,
@ -160,34 +159,6 @@ export interface AccountSettings {
shouldPaidMessageAutoApprove: boolean;
}
export interface SharedSettings {
shouldUseSystemTheme: boolean;
theme: ThemeKey;
themes: Partial<Record<ThemeKey, IThemeSettings>>;
language: string;
languages?: ApiLanguage[];
performance: PerformanceType;
messageTextSize: number;
animationLevel: AnimationLevel;
messageSendKeyCombo: 'enter' | 'ctrl-enter';
miniAppsCachedPosition?: Point;
miniAppsCachedSize?: Size;
timeFormat: TimeFormat;
wasTimeFormatSetManually: boolean;
isConnectionStatusMinimized: boolean;
canDisplayChatInTitle: boolean;
shouldForceHttpTransport?: boolean;
shouldAllowHttpTransport?: boolean;
shouldCollectDebugLogs?: boolean;
shouldDebugExportedSenders?: boolean;
shouldWarnAboutSvg?: boolean;
shouldSkipWebAppCloseConfirmation: boolean;
hasContactJoinedNotifications?: boolean;
hasWebNotifications: boolean;
hasPushNotifications: boolean;
notificationSoundVolume: number;
}
export type IAnchorPosition = {
x: number;
y: number;