mirror of
https://github.com/Jellify-Music/App.git
synced 2026-05-20 11:59:01 -05:00
persist now playing
This commit is contained in:
@@ -2,5 +2,6 @@ export enum MMKVStorageKeys {
|
||||
PlayQueue = "PLAY_QUEUE",
|
||||
Server = "SERVER",
|
||||
User = "USER",
|
||||
Library = "LIBRARY"
|
||||
Library = "LIBRARY",
|
||||
NowPlaying = "NowPlaying"
|
||||
}
|
||||
+4
-1
@@ -45,6 +45,7 @@ interface PlayerContext {
|
||||
|
||||
const PlayerContextInitializer = () => {
|
||||
|
||||
const nowPlayingJson = storage.getString(MMKVStorageKeys.NowPlaying)
|
||||
const queueJson = storage.getString(MMKVStorageKeys.PlayQueue);
|
||||
|
||||
const playStateApi = getPlaystateApi(Client.api!)
|
||||
@@ -54,9 +55,11 @@ const PlayerContextInitializer = () => {
|
||||
const [showMiniplayer, setShowMiniplayer] = useState<boolean>(false);
|
||||
|
||||
const [nowPlayingIsFavorite, setNowPlayingIsFavorite] = useState<boolean>(false);
|
||||
const [nowPlaying, setNowPlaying] = useState<JellifyTrack | undefined>(undefined);
|
||||
const [nowPlaying, setNowPlaying] = useState<JellifyTrack | undefined>(nowPlayingJson ? JSON.parse(nowPlayingJson) : undefined);
|
||||
const [isSkipping, setIsSkipping] = useState<boolean>(false);
|
||||
|
||||
const [queue, setQueue] = useState<JellifyTrack[]>(queueJson ? JSON.parse(queueJson) : []);
|
||||
|
||||
const [queueName, setQueueName] = useState<string | undefined>(undefined);
|
||||
//#endregion State
|
||||
|
||||
|
||||
Reference in New Issue
Block a user