mirror of
https://github.com/YuzuZensai/VRC-Circle.git
synced 2026-09-14 03:10:01 +00:00
♻️ refactor: centralize app settings
This commit is contained in:
+2
-1
@@ -29,7 +29,7 @@ import type { AccountSettings, ContentFilterKey, Pending2Fa, RecoveryCode } from
|
||||
import type { Group, GroupSnapshot } from "./types/group";
|
||||
import type { EnhancementId, EnhancementsSnapshot } from "./types/enhancements";
|
||||
import type { GallerySnapshot, Photo, ThumbCacheStats } from "./types/gallery";
|
||||
import type { AppConfig, PreferredRegion, RegionPing } from "./types/appConfig";
|
||||
import type { AppConfig, AppPreferences, PreferredRegion, RegionPing } from "./types/appConfig";
|
||||
import type { GameStatus } from "./types/game";
|
||||
import type { IpcResult } from "./types/result";
|
||||
import type { CacheEntryInfo, CacheStats, DebugSnapshot, LogEntry, WsEvent } from "./types/debug";
|
||||
@@ -150,6 +150,7 @@ export interface IpcRequests {
|
||||
"config:setGamePath": (p: { gamePath: string | null }) => IpcResult<AppConfig>;
|
||||
"config:pickGamePath": () => IpcResult<AppConfig>;
|
||||
"config:setPreferredRegion": (p: { region: PreferredRegion }) => IpcResult<AppConfig>;
|
||||
"config:setPreferences": (p: Partial<AppPreferences>) => IpcResult<AppConfig>;
|
||||
|
||||
"region:detect": () => IpcResult<InstanceRegion>;
|
||||
"region:ping": () => IpcResult<RegionPing[]>;
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
export const DEFAULT_LOCALE = "en" as const;
|
||||
|
||||
export const LOCALES = [
|
||||
{ code: "en", nativeName: "English", englishName: "English" },
|
||||
{ code: "ja", nativeName: "日本語", englishName: "Japanese" },
|
||||
{ code: "th", nativeName: "ไทย", englishName: "Thai" },
|
||||
] as const;
|
||||
|
||||
export type AppLocale = (typeof LOCALES)[number]["code"];
|
||||
|
||||
export function isAppLocale(value: unknown): value is AppLocale {
|
||||
return typeof value === "string" && LOCALES.some((locale) => locale.code === value);
|
||||
}
|
||||
@@ -1,12 +1,22 @@
|
||||
import type { InstanceRegion } from "./instance";
|
||||
import type { AppLocale } from "../locales";
|
||||
|
||||
export type PreferredRegion = InstanceRegion | "auto";
|
||||
export type AppSchemeMode = "light" | "dark" | "auto";
|
||||
|
||||
export interface AppPreferences {
|
||||
schemeMode: AppSchemeMode;
|
||||
accent: string | null;
|
||||
locale: AppLocale;
|
||||
showDebugNav: boolean;
|
||||
}
|
||||
|
||||
export interface AppConfig {
|
||||
version: string;
|
||||
gamePath: string | null;
|
||||
detectedGamePath: string | null;
|
||||
preferredRegion: PreferredRegion;
|
||||
preferences: AppPreferences;
|
||||
}
|
||||
|
||||
export interface RegionPing {
|
||||
|
||||
Reference in New Issue
Block a user