diff options
Diffstat (limited to 'src/stores')
| -rw-r--r-- | src/stores/airingSchedule.ts | 6 | ||||
| -rw-r--r-- | src/stores/settings.ts | 29 | ||||
| -rw-r--r-- | src/stores/subsPlease.ts | 6 |
3 files changed, 29 insertions, 12 deletions
diff --git a/src/stores/airingSchedule.ts b/src/stores/airingSchedule.ts new file mode 100644 index 00000000..a2b05150 --- /dev/null +++ b/src/stores/airingSchedule.ts @@ -0,0 +1,6 @@ +import { writable } from "svelte/store"; +import type { AiringSchedule } from "$lib/Media/Anime/Airing/animeSchedule"; + +const airingSchedule = writable<AiringSchedule | undefined>(undefined); + +export default airingSchedule; diff --git a/src/stores/settings.ts b/src/stores/settings.ts index 1edab858..1e77afbd 100644 --- a/src/stores/settings.ts +++ b/src/stores/settings.ts @@ -6,7 +6,7 @@ import identity from "./identity"; import settingsSyncPulled from "./settingsSyncPulled"; import settingsSyncTimes from "./settingsSyncTimes"; -const VERSION = "1.0.1"; +const VERSION = "1.0.2"; export interface Settings { cacheMangaMinutes: number; @@ -49,7 +49,7 @@ export interface Settings { disableUpcomingAnime: boolean; display24HourTime: boolean; displayCountdownRightAligned: boolean; - displayNativeCountdown: boolean; + countdownSource: "native" | "sub" | "dub"; displayHoverCover: boolean; displayDisableAnimations: boolean; displayDisableNotifications: boolean; @@ -101,7 +101,7 @@ const defaultSettings: Settings = { disableUpcomingAnime: false, display24HourTime: false, displayCountdownRightAligned: false, - displayNativeCountdown: false, + countdownSource: "sub", displayHoverCover: false, displayDisableAnimations: false, displayDisableNotifications: false, @@ -147,11 +147,28 @@ const defaultSettings: Settings = { settingsVersion: VERSION, }; +// Carry the retired `displayNativeCountdown` boolean over to `countdownSource`. +const migrateSettings = (stored: Settings): Settings => { + const legacy = stored as Settings & { displayNativeCountdown?: boolean }; + + if ( + legacy.countdownSource === undefined && + legacy.displayNativeCountdown !== undefined + ) + legacy.countdownSource = legacy.displayNativeCountdown ? "native" : "sub"; + + delete legacy.displayNativeCountdown; + + return legacy; +}; + const createStore = () => { const initialValue = browser - ? parseJsonStringOrDefault( - localStorage.getItem("settings") || "", - defaultSettings, + ? migrateSettings( + parseJsonStringOrDefault( + localStorage.getItem("settings") || "", + defaultSettings, + ), ) : defaultSettings; const store = writable<Settings>(initialValue); diff --git a/src/stores/subsPlease.ts b/src/stores/subsPlease.ts deleted file mode 100644 index a1276a1c..00000000 --- a/src/stores/subsPlease.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { writable } from "svelte/store"; -import type { SubsPlease } from "$lib/Media/Anime/Airing/Subtitled/subsPlease"; - -const subsPlease = writable<SubsPlease>(undefined); - -export default subsPlease; |