mirror of
https://github.com/ikun0014/lx-music-mobile.git
synced 2025-07-03 06:52:09 +08:00
优化代码
This commit is contained in:
parent
b481d0367f
commit
b5201495f1
@ -160,7 +160,7 @@ export const getOnlineOtherSourceMusicUrl = async({ musicInfos, quality, onToggl
|
||||
if (retryedSource.includes(musicInfo.source)) continue
|
||||
retryedSource.push(musicInfo.source)
|
||||
if (!assertApiSupport(musicInfo.source)) continue
|
||||
itemQuality = quality ?? getPlayQuality(settingState.setting['player.highQuality'], musicInfo)
|
||||
itemQuality = quality ?? getPlayQuality(settingState.setting['player.isPlayHighQuality'], musicInfo)
|
||||
if (!musicInfo.meta._qualitys[itemQuality]) continue
|
||||
|
||||
console.log('try toggle to: ', musicInfo.source, musicInfo.name, musicInfo.singer, musicInfo.interval)
|
||||
@ -205,7 +205,7 @@ export const handleGetOnlineMusicUrl = async({ musicInfo, quality, onToggleSourc
|
||||
isFromCache: boolean
|
||||
}> => {
|
||||
// console.log(musicInfo.source)
|
||||
const targetQuality = quality ?? getPlayQuality(settingState.setting['player.highQuality'], musicInfo)
|
||||
const targetQuality = quality ?? getPlayQuality(settingState.setting['player.isPlayHighQuality'], musicInfo)
|
||||
|
||||
let reqPromise
|
||||
try {
|
||||
|
@ -67,7 +67,7 @@ const getMusicPlayUrl = async(musicInfo: LX.Music.MusicInfo | LX.Download.ListIt
|
||||
// this.musicInfo.url = await getMusicPlayUrl(targetSong, type)
|
||||
setStatusText(global.i18n.t('player__geting_url'))
|
||||
|
||||
// const type = getPlayType(settingState.setting['player.highQuality'], musicInfo)
|
||||
// const type = getPlayType(settingState.setting['player.isPlayHighQuality'], musicInfo)
|
||||
|
||||
return getMusicUrl({
|
||||
musicInfo,
|
||||
|
@ -106,8 +106,8 @@ export class StateEvent extends Event {
|
||||
this.emit('componentIdsUpdated', ids)
|
||||
}
|
||||
|
||||
navActiveIdUpdated(index: CommonState['navActiveId']) {
|
||||
this.emit('navActiveIdUpdated', index)
|
||||
navActiveIdUpdated(id: CommonState['navActiveId']) {
|
||||
this.emit('navActiveIdUpdated', id)
|
||||
}
|
||||
|
||||
sourceNamesUpdated(names: CommonState['sourceNames']) {
|
||||
|
@ -5,23 +5,22 @@ import { Icon } from '@/components/common/Icon'
|
||||
import { pop } from '@/navigation'
|
||||
// import { AppColors } from '@/theme'
|
||||
import StatusBar from '@/components/common/StatusBar'
|
||||
import { useComponentIds } from '@/store/common/hook'
|
||||
import { useI18n } from '@/lang'
|
||||
import { createStyle } from '@/utils/tools'
|
||||
import Text from '@/components/common/Text'
|
||||
import { HEADER_HEIGHT as _HEADER_HEIGHT } from '@/config/constant'
|
||||
import { scaleSizeH } from '@/utils/pixelRatio'
|
||||
import commonState from '@/store/common/state'
|
||||
|
||||
const HEADER_HEIGHT = scaleSizeH(_HEADER_HEIGHT)
|
||||
|
||||
export default memo(({ musicInfo }: {
|
||||
musicInfo: LX.Music.MusicInfo
|
||||
}) => {
|
||||
const componentIds = useComponentIds()
|
||||
const t = useI18n()
|
||||
|
||||
const back = () => {
|
||||
void pop(componentIds.comment as string)
|
||||
void pop(commonState.componentIds.comment as string)
|
||||
}
|
||||
|
||||
return (
|
||||
|
@ -31,7 +31,7 @@ export default () => {
|
||||
|
||||
// setWidth(getWindowSise().width * 0.82)
|
||||
|
||||
global.app_event.on('homeNavPagerChanged', handleFixDrawer)
|
||||
global.state_event.on('navActiveIdUpdated', handleFixDrawer)
|
||||
global.app_event.on('changeLoveListVisible', changeVisible)
|
||||
|
||||
// 就放旋转屏幕后的宽度没有更新的问题
|
||||
@ -43,7 +43,7 @@ export default () => {
|
||||
// })
|
||||
|
||||
return () => {
|
||||
global.app_event.off('homeNavPagerChanged', handleFixDrawer)
|
||||
global.state_event.off('navActiveIdUpdated', handleFixDrawer)
|
||||
global.app_event.off('changeLoveListVisible', changeVisible)
|
||||
// changeEvent.remove()
|
||||
}
|
||||
|
@ -27,12 +27,12 @@ export default () => {
|
||||
drawer.current?.closeDrawer()
|
||||
}
|
||||
|
||||
global.app_event.on('homeNavPagerChanged', handleFixDrawer)
|
||||
global.state_event.on('navActiveIdUpdated', handleFixDrawer)
|
||||
global.app_event.on('showSonglistTagList', handleShow)
|
||||
global.app_event.on('hideSonglistTagList', handleHide)
|
||||
|
||||
return () => {
|
||||
global.app_event.off('homeNavPagerChanged', handleFixDrawer)
|
||||
global.state_event.off('navActiveIdUpdated', handleFixDrawer)
|
||||
global.app_event.off('showSonglistTagList', handleShow)
|
||||
global.app_event.off('hideSonglistTagList', handleHide)
|
||||
}
|
||||
|
@ -1,14 +1,12 @@
|
||||
import React from 'react'
|
||||
import Btn from './Btn'
|
||||
import { useComponentIds } from '@/store/common/hook'
|
||||
import { navigations } from '@/navigation'
|
||||
import commonState from '@/store/common/state'
|
||||
|
||||
|
||||
export default () => {
|
||||
const componentIds = useComponentIds()
|
||||
|
||||
const handleShowCommentScreen = () => {
|
||||
navigations.pushCommentScreen(componentIds.playDetail as string)
|
||||
navigations.pushCommentScreen(commonState.componentIds.playDetail as string)
|
||||
}
|
||||
|
||||
return <Btn icon="comment" onPress={handleShowCommentScreen} />
|
||||
|
@ -1,14 +1,12 @@
|
||||
import React from 'react'
|
||||
import Btn from './Btn'
|
||||
import { useComponentIds } from '@/store/common/hook'
|
||||
import { navigations } from '@/navigation'
|
||||
import commonState from '@/store/common/state'
|
||||
|
||||
|
||||
export default () => {
|
||||
const componentIds = useComponentIds()
|
||||
|
||||
const handleShowCommentScreen = () => {
|
||||
navigations.pushCommentScreen(componentIds.playDetail as string)
|
||||
navigations.pushCommentScreen(commonState.componentIds.playDetail as string)
|
||||
}
|
||||
|
||||
return <Btn icon="comment" onPress={handleShowCommentScreen} />
|
||||
|
Loading…
x
Reference in New Issue
Block a user