mirror of
https://github.com/ikun0014/lx-music-mobile.git
synced 2025-05-23 22:37:41 +08:00
修复更新翻译歌词、罗马音歌词设置后需重启应用才生效的问题
This commit is contained in:
parent
c95cd040e2
commit
bc7bf345ca
@ -8,3 +8,4 @@
|
||||
|
||||
- 修复横屏状态下的歌词滚动位置计算问题
|
||||
- 修复切歌时歌词激活行的重置问题
|
||||
- 修复更新翻译歌词、罗马音歌词设置后需重启应用才生效的问题,现在更新设置后会立即生效
|
||||
|
@ -5,8 +5,8 @@ import { onDesktopLyricPositionChange, showDesktopLyric } from '@/core/desktopLy
|
||||
export default async(setting: LX.AppSetting) => {
|
||||
await initLyricPlayer()
|
||||
void setPlaybackRate(setting['player.playbackRate'])
|
||||
toggleTranslation(setting['player.isShowLyricTranslation'])
|
||||
toggleRoma(setting['player.isShowLyricRoma'])
|
||||
void toggleTranslation(setting['player.isShowLyricTranslation'])
|
||||
void toggleRoma(setting['player.isShowLyricRoma'])
|
||||
|
||||
if (setting['desktopLyric.enable']) {
|
||||
showDesktopLyric().catch(() => {
|
||||
|
@ -17,7 +17,7 @@ import {
|
||||
} from '@/core/desktopLyric'
|
||||
import { getPosition } from '@/plugins/player'
|
||||
import playerState from '@/store/player/state'
|
||||
import settingState from '@/store/setting/state'
|
||||
// import settingState from '@/store/setting/state'
|
||||
|
||||
/**
|
||||
* init lyric
|
||||
@ -31,9 +31,9 @@ export const init = async() => {
|
||||
* @param lyric lyric str
|
||||
* @param translation lyric translation
|
||||
*/
|
||||
const handleSetLyric = (lyric: string, translation = '', romalrc = '') => {
|
||||
void setDesktopLyric(lyric, translation, romalrc)
|
||||
const handleSetLyric = async(lyric: string, translation = '', romalrc = '') => {
|
||||
lrcSetLyric(lyric, translation, romalrc)
|
||||
await setDesktopLyric(lyric, translation, romalrc)
|
||||
}
|
||||
|
||||
/**
|
||||
@ -57,7 +57,7 @@ export const pause = () => {
|
||||
* stop lyric
|
||||
*/
|
||||
export const stop = () => {
|
||||
handleSetLyric('')
|
||||
void handleSetLyric('')
|
||||
}
|
||||
|
||||
/**
|
||||
@ -80,18 +80,20 @@ export const setPlaybackRate = async(playbackRate: number) => {
|
||||
* toggle show translation
|
||||
* @param isShowTranslation is show translation
|
||||
*/
|
||||
export const toggleTranslation = (isShowTranslation: boolean) => {
|
||||
export const toggleTranslation = async(isShowTranslation: boolean) => {
|
||||
lrcToggleTranslation(isShowTranslation)
|
||||
void toggleDesktopLyricTranslation(isShowTranslation)
|
||||
await toggleDesktopLyricTranslation(isShowTranslation)
|
||||
if (playerState.isPlay) play()
|
||||
}
|
||||
|
||||
/**
|
||||
* toggle show roma lyric
|
||||
* @param isShowLyricRoma is show roma lyric
|
||||
*/
|
||||
export const toggleRoma = (isShowLyricRoma: boolean) => {
|
||||
export const toggleRoma = async(isShowLyricRoma: boolean) => {
|
||||
lrcToggleRoma(isShowLyricRoma)
|
||||
void toggleDesktopLyricRoma(isShowLyricRoma)
|
||||
await toggleDesktopLyricRoma(isShowLyricRoma)
|
||||
if (playerState.isPlay) play()
|
||||
}
|
||||
|
||||
export const play = () => {
|
||||
@ -101,14 +103,14 @@ export const play = () => {
|
||||
}
|
||||
|
||||
|
||||
export const setLyric = () => {
|
||||
export const setLyric = async() => {
|
||||
if (!playerState.musicInfo.id) return
|
||||
if (playerState.musicInfo.lrc) {
|
||||
let tlrc = ''
|
||||
let rlrc = ''
|
||||
if (settingState.setting['player.isShowLyricTranslation'] && playerState.musicInfo.tlrc) tlrc = playerState.musicInfo.tlrc
|
||||
if (settingState.setting['player.isShowLyricRoma'] && playerState.musicInfo.rlrc) rlrc = playerState.musicInfo.rlrc
|
||||
handleSetLyric(playerState.musicInfo.lrc, tlrc, rlrc)
|
||||
if (playerState.musicInfo.tlrc) tlrc = playerState.musicInfo.tlrc
|
||||
if (playerState.musicInfo.rlrc) rlrc = playerState.musicInfo.rlrc
|
||||
await handleSetLyric(playerState.musicInfo.lrc, tlrc, rlrc)
|
||||
}
|
||||
|
||||
if (playerState.isPlay) play()
|
||||
|
@ -7,12 +7,14 @@ import { useSettingValue } from '@/store/setting/hook'
|
||||
|
||||
|
||||
import CheckBoxItem from '../../components/CheckBoxItem'
|
||||
import { toggleRoma } from '@/core/lyric'
|
||||
|
||||
export default memo(() => {
|
||||
const t = useI18n()
|
||||
const isShowLyricRoma = useSettingValue('player.isShowLyricRoma')
|
||||
const setShowLyricRoma = (isShowLyricRoma: boolean) => {
|
||||
updateSetting({ 'player.isShowLyricRoma': isShowLyricRoma })
|
||||
void toggleRoma(isShowLyricRoma)
|
||||
}
|
||||
|
||||
return (
|
||||
|
@ -7,12 +7,14 @@ import { useSettingValue } from '@/store/setting/hook'
|
||||
|
||||
|
||||
import CheckBoxItem from '../../components/CheckBoxItem'
|
||||
import { toggleTranslation } from '@/core/lyric'
|
||||
|
||||
export default memo(() => {
|
||||
const t = useI18n()
|
||||
const isShowLyricTranslation = useSettingValue('player.isShowLyricTranslation')
|
||||
const setShowLyricTranslation = (isShowLyricTranslation: boolean) => {
|
||||
updateSetting({ 'player.isShowLyricTranslation': isShowLyricTranslation })
|
||||
void toggleTranslation(isShowLyricTranslation)
|
||||
}
|
||||
|
||||
return (
|
||||
|
@ -46,8 +46,8 @@ const Volume = () => {
|
||||
setSliderSize(100)
|
||||
void setPlaybackRate(1).then(() => {
|
||||
void updateMetaData(playerState.musicInfo, playerState.isPlay, true) // 更新通知栏的播放速率
|
||||
void setLyricPlaybackRate(1)
|
||||
})
|
||||
void setLyricPlaybackRate(1)
|
||||
updateSetting({ 'player.playbackRate': 1 })
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user