import { PlayStatus } from '../common/PlayStatus' export function ensurePlaybackHostStorageDefaults(): void { if (AppStorage.get('isShowPlay') === undefined) { AppStorage.setOrCreate('isShowPlay', false) } if (AppStorage.get('playbackRuntimeReady') === undefined) { AppStorage.setOrCreate('playbackRuntimeReady', false) } if (AppStorage.get('playbackHostOpenRequestToken') === undefined) { AppStorage.setOrCreate('playbackHostOpenRequestToken', 0) } if (AppStorage.get('playbackHostPlaylistRequestToken') === undefined) { AppStorage.setOrCreate('playbackHostPlaylistRequestToken', 0) } if (AppStorage.get('CONTROL_PlayStatus') === undefined) { AppStorage.setOrCreate('CONTROL_PlayStatus', PlayStatus.INIT) } if (AppStorage.get('progressValue') === undefined) { AppStorage.setOrCreate('progressValue', 0) } if (AppStorage.get('cover') === undefined) { AppStorage.setOrCreate('cover', '') } if (AppStorage.get('currentSong') === undefined) { AppStorage.setOrCreate('currentSong', undefined) } } export function showPlaybackPlayer(show: boolean): void { AppStorage.setOrCreate('isShowPlay', show) } export function setPlaybackRuntimeReady(ready: boolean): void { AppStorage.setOrCreate('playbackRuntimeReady', ready) } export function requestPlaybackPlayerOpen(): void { const currentToken = AppStorage.get('playbackHostOpenRequestToken') ?? 0 AppStorage.setOrCreate('isShowPlay', true) AppStorage.setOrCreate('playbackHostOpenRequestToken', currentToken + 1) } export function requestPlaybackPlaylistOpen(): void { const currentToken = AppStorage.get('playbackHostPlaylistRequestToken') ?? 0 AppStorage.setOrCreate('playbackHostPlaylistRequestToken', currentToken + 1) }