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) => {
|
export default async(setting: LX.AppSetting) => {
|
||||||
await initLyricPlayer()
|
await initLyricPlayer()
|
||||||
void setPlaybackRate(setting['player.playbackRate'])
|
void setPlaybackRate(setting['player.playbackRate'])
|
||||||
toggleTranslation(setting['player.isShowLyricTranslation'])
|
void toggleTranslation(setting['player.isShowLyricTranslation'])
|
||||||
toggleRoma(setting['player.isShowLyricRoma'])
|
void toggleRoma(setting['player.isShowLyricRoma'])
|
||||||
|
|
||||||
if (setting['desktopLyric.enable']) {
|
if (setting['desktopLyric.enable']) {
|
||||||
showDesktopLyric().catch(() => {
|
showDesktopLyric().catch(() => {
|
||||||
|
@ -17,7 +17,7 @@ import {
|
|||||||
} from '@/core/desktopLyric'
|
} from '@/core/desktopLyric'
|
||||||
import { getPosition } from '@/plugins/player'
|
import { getPosition } from '@/plugins/player'
|
||||||
import playerState from '@/store/player/state'
|
import playerState from '@/store/player/state'
|
||||||
import settingState from '@/store/setting/state'
|
// import settingState from '@/store/setting/state'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* init lyric
|
* init lyric
|
||||||
@ -31,9 +31,9 @@ export const init = async() => {
|
|||||||
* @param lyric lyric str
|
* @param lyric lyric str
|
||||||
* @param translation lyric translation
|
* @param translation lyric translation
|
||||||
*/
|
*/
|
||||||
const handleSetLyric = (lyric: string, translation = '', romalrc = '') => {
|
const handleSetLyric = async(lyric: string, translation = '', romalrc = '') => {
|
||||||
void setDesktopLyric(lyric, translation, romalrc)
|
|
||||||
lrcSetLyric(lyric, translation, romalrc)
|
lrcSetLyric(lyric, translation, romalrc)
|
||||||
|
await setDesktopLyric(lyric, translation, romalrc)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -57,7 +57,7 @@ export const pause = () => {
|
|||||||
* stop lyric
|
* stop lyric
|
||||||
*/
|
*/
|
||||||
export const stop = () => {
|
export const stop = () => {
|
||||||
handleSetLyric('')
|
void handleSetLyric('')
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -80,18 +80,20 @@ export const setPlaybackRate = async(playbackRate: number) => {
|
|||||||
* toggle show translation
|
* toggle show translation
|
||||||
* @param isShowTranslation is show translation
|
* @param isShowTranslation is show translation
|
||||||
*/
|
*/
|
||||||
export const toggleTranslation = (isShowTranslation: boolean) => {
|
export const toggleTranslation = async(isShowTranslation: boolean) => {
|
||||||
lrcToggleTranslation(isShowTranslation)
|
lrcToggleTranslation(isShowTranslation)
|
||||||
void toggleDesktopLyricTranslation(isShowTranslation)
|
await toggleDesktopLyricTranslation(isShowTranslation)
|
||||||
|
if (playerState.isPlay) play()
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* toggle show roma lyric
|
* toggle show roma lyric
|
||||||
* @param isShowLyricRoma is show roma lyric
|
* @param isShowLyricRoma is show roma lyric
|
||||||
*/
|
*/
|
||||||
export const toggleRoma = (isShowLyricRoma: boolean) => {
|
export const toggleRoma = async(isShowLyricRoma: boolean) => {
|
||||||
lrcToggleRoma(isShowLyricRoma)
|
lrcToggleRoma(isShowLyricRoma)
|
||||||
void toggleDesktopLyricRoma(isShowLyricRoma)
|
await toggleDesktopLyricRoma(isShowLyricRoma)
|
||||||
|
if (playerState.isPlay) play()
|
||||||
}
|
}
|
||||||
|
|
||||||
export const 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.id) return
|
||||||
if (playerState.musicInfo.lrc) {
|
if (playerState.musicInfo.lrc) {
|
||||||
let tlrc = ''
|
let tlrc = ''
|
||||||
let rlrc = ''
|
let rlrc = ''
|
||||||
if (settingState.setting['player.isShowLyricTranslation'] && playerState.musicInfo.tlrc) tlrc = playerState.musicInfo.tlrc
|
if (playerState.musicInfo.tlrc) tlrc = playerState.musicInfo.tlrc
|
||||||
if (settingState.setting['player.isShowLyricRoma'] && playerState.musicInfo.rlrc) rlrc = playerState.musicInfo.rlrc
|
if (playerState.musicInfo.rlrc) rlrc = playerState.musicInfo.rlrc
|
||||||
handleSetLyric(playerState.musicInfo.lrc, tlrc, rlrc)
|
await handleSetLyric(playerState.musicInfo.lrc, tlrc, rlrc)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (playerState.isPlay) play()
|
if (playerState.isPlay) play()
|
||||||
|
@ -7,12 +7,14 @@ import { useSettingValue } from '@/store/setting/hook'
|
|||||||
|
|
||||||
|
|
||||||
import CheckBoxItem from '../../components/CheckBoxItem'
|
import CheckBoxItem from '../../components/CheckBoxItem'
|
||||||
|
import { toggleRoma } from '@/core/lyric'
|
||||||
|
|
||||||
export default memo(() => {
|
export default memo(() => {
|
||||||
const t = useI18n()
|
const t = useI18n()
|
||||||
const isShowLyricRoma = useSettingValue('player.isShowLyricRoma')
|
const isShowLyricRoma = useSettingValue('player.isShowLyricRoma')
|
||||||
const setShowLyricRoma = (isShowLyricRoma: boolean) => {
|
const setShowLyricRoma = (isShowLyricRoma: boolean) => {
|
||||||
updateSetting({ 'player.isShowLyricRoma': isShowLyricRoma })
|
updateSetting({ 'player.isShowLyricRoma': isShowLyricRoma })
|
||||||
|
void toggleRoma(isShowLyricRoma)
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -7,12 +7,14 @@ import { useSettingValue } from '@/store/setting/hook'
|
|||||||
|
|
||||||
|
|
||||||
import CheckBoxItem from '../../components/CheckBoxItem'
|
import CheckBoxItem from '../../components/CheckBoxItem'
|
||||||
|
import { toggleTranslation } from '@/core/lyric'
|
||||||
|
|
||||||
export default memo(() => {
|
export default memo(() => {
|
||||||
const t = useI18n()
|
const t = useI18n()
|
||||||
const isShowLyricTranslation = useSettingValue('player.isShowLyricTranslation')
|
const isShowLyricTranslation = useSettingValue('player.isShowLyricTranslation')
|
||||||
const setShowLyricTranslation = (isShowLyricTranslation: boolean) => {
|
const setShowLyricTranslation = (isShowLyricTranslation: boolean) => {
|
||||||
updateSetting({ 'player.isShowLyricTranslation': isShowLyricTranslation })
|
updateSetting({ 'player.isShowLyricTranslation': isShowLyricTranslation })
|
||||||
|
void toggleTranslation(isShowLyricTranslation)
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -46,8 +46,8 @@ const Volume = () => {
|
|||||||
setSliderSize(100)
|
setSliderSize(100)
|
||||||
void setPlaybackRate(1).then(() => {
|
void setPlaybackRate(1).then(() => {
|
||||||
void updateMetaData(playerState.musicInfo, playerState.isPlay, true) // 更新通知栏的播放速率
|
void updateMetaData(playerState.musicInfo, playerState.isPlay, true) // 更新通知栏的播放速率
|
||||||
|
void setLyricPlaybackRate(1)
|
||||||
})
|
})
|
||||||
void setLyricPlaybackRate(1)
|
|
||||||
updateSetting({ 'player.playbackRate': 1 })
|
updateSetting({ 'player.playbackRate': 1 })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user