mirror of
https://github.com/GiriNeko/YesPlayMusic.git
synced 2025-12-17 21:58:03 +00:00
feat: 支持 UNM rust
This commit is contained in:
parent
4d59401549
commit
4d54060a4f
29 changed files with 717 additions and 231 deletions
|
|
@ -1,37 +1,27 @@
|
|||
import { proxy, subscribe } from 'valtio'
|
||||
import { devtools } from 'valtio/utils'
|
||||
import { Player } from '@/renderer/utils/player'
|
||||
import {merge} from 'lodash-es'
|
||||
|
||||
interface Store {
|
||||
uiStates: {
|
||||
loginPhoneCountryCode: string
|
||||
showLyricPanel: boolean
|
||||
}
|
||||
settings: {
|
||||
showSidebar: boolean
|
||||
accentColor: string
|
||||
}
|
||||
}
|
||||
|
||||
const initialState: Store = {
|
||||
uiStates: {
|
||||
loginPhoneCountryCode: '+86',
|
||||
showLyricPanel: false,
|
||||
},
|
||||
settings: {
|
||||
showSidebar: true,
|
||||
accentColor: 'blue',
|
||||
},
|
||||
}
|
||||
import { merge } from 'lodash-es'
|
||||
import { IpcChannels } from '@/shared/IpcChannels'
|
||||
import { Store, initialState } from '@/shared/store'
|
||||
|
||||
const stateInLocalStorage = localStorage.getItem('state')
|
||||
export const state = proxy<Store>(
|
||||
merge(initialState, stateInLocalStorage ? JSON.parse(stateInLocalStorage) : {})
|
||||
merge(initialState, [
|
||||
stateInLocalStorage ? JSON.parse(stateInLocalStorage) : {},
|
||||
{
|
||||
uiStates: {
|
||||
showLyricPanel: false,
|
||||
},
|
||||
},
|
||||
])
|
||||
)
|
||||
subscribe(state, () => {
|
||||
localStorage.setItem('state', JSON.stringify(state))
|
||||
})
|
||||
subscribe(state.settings, () => {
|
||||
window.ipcRenderer?.send(IpcChannels.SyncSettings, { ...state.settings })
|
||||
})
|
||||
|
||||
// player
|
||||
const playerInLocalStorage = localStorage.getItem('player')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue