ADD - integrate calendar games and local marketplaces

This commit is contained in:
Eichenholz
2026-08-06 19:14:15 +02:00
191 changed files with 23266 additions and 65 deletions
+3 -1
View File
@@ -1,3 +1,5 @@
import { cloneJsonData } from '@/utils/clone'
export const ALARM_SOUND_IDS = [
'radar',
'beacon',
@@ -89,7 +91,7 @@ function readAlarm(value: unknown): Alarm | null {
}
export function parseAlarms(value: unknown): Alarm[] {
if (!Array.isArray(value)) return structuredClone(DEFAULT_ALARMS)
if (!Array.isArray(value)) return cloneJsonData(DEFAULT_ALARMS)
return value.map(readAlarm).filter((alarm): alarm is Alarm => !!alarm)
}
+5
View File
@@ -0,0 +1,5 @@
export function cloneJsonData<T>(value: T): T {
const serialized = JSON.stringify(value)
if (serialized === undefined) return value
return JSON.parse(serialized) as T
}
+15 -4
View File
@@ -1,4 +1,5 @@
import type { LaunchablePhoneAppId } from '@/types/apps'
import { cloneJsonData } from '@/utils/clone'
export const APPEARANCE_MODE_IDS = ['automatic', 'light', 'dark'] as const
export const PHONE_FRAME_IDS = [
@@ -50,8 +51,18 @@ const DEFAULT_APP_NOTIFICATIONS: Record<
phone: { enabled: true, sounds: true },
'app-store': { enabled: true, sounds: true },
calculator: { enabled: true, sounds: true },
snake: { enabled: true, sounds: true },
memory: { enabled: true, sounds: true },
'number-merge': { enabled: true, sounds: true },
minesweeper: { enabled: true, sounds: true },
'tower-stack': { enabled: true, sounds: true },
'sky-flappy': { enabled: true, sounds: true },
'neon-drop': { enabled: true, sounds: true },
citymarkt: { enabled: true, sounds: true },
'local-pages': { enabled: true, sounds: true },
camera: { enabled: true, sounds: true },
clock: { enabled: true, sounds: true },
calendar: { enabled: true, sounds: true },
weather: { enabled: true, sounds: true },
mail: { enabled: true, sounds: true },
map: { enabled: true, sounds: true },
@@ -112,7 +123,7 @@ function readNotifications(
Record<LaunchablePhoneAppId, Partial<AppNotificationPreferences>>
>)
: {}
const notifications = structuredClone(DEFAULT_APP_NOTIFICATIONS)
const notifications = cloneJsonData(DEFAULT_APP_NOTIFICATIONS)
for (const appId of Object.keys(notifications) as LaunchablePhoneAppId[]) {
notifications[appId] = {
@@ -131,13 +142,13 @@ function readNotifications(
}
export function parsePhonePreferences(raw: string | null): PhonePreferencesV1 {
if (!raw) return structuredClone(DEFAULT_PHONE_PREFERENCES)
if (!raw) return cloneJsonData(DEFAULT_PHONE_PREFERENCES)
try {
const parsed = JSON.parse(raw) as Partial<PhonePreferencesV1>
const settings = parsed.settings
if (parsed.version !== 1 || !settings || typeof settings !== 'object') {
return structuredClone(DEFAULT_PHONE_PREFERENCES)
return cloneJsonData(DEFAULT_PHONE_PREFERENCES)
}
const defaults = DEFAULT_PHONE_PREFERENCES.settings
@@ -195,6 +206,6 @@ export function parsePhonePreferences(raw: string | null): PhonePreferencesV1 {
version: 1,
}
} catch {
return structuredClone(DEFAULT_PHONE_PREFERENCES)
return cloneJsonData(DEFAULT_PHONE_PREFERENCES)
}
}