| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- 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<number>('playbackHostOpenRequestToken') ?? 0
- AppStorage.setOrCreate('isShowPlay', true)
- AppStorage.setOrCreate('playbackHostOpenRequestToken', currentToken + 1)
- }
- export function requestPlaybackPlaylistOpen(): void {
- const currentToken = AppStorage.get<number>('playbackHostPlaylistRequestToken') ?? 0
- AppStorage.setOrCreate('playbackHostPlaylistRequestToken', currentToken + 1)
- }
|