mirror of
https://github.com/ikun0014/lx-music-mobile.git
synced 2025-07-03 07:12:10 +08:00
修复进入播放详情歌词界面后的屏幕常亮不会被取消的问题
This commit is contained in:
parent
aac3f0581c
commit
57e57f3724
@ -1,11 +1,3 @@
|
||||
### 新增
|
||||
|
||||
- 新增通过歌单链接打开歌单的功能
|
||||
|
||||
### 优化
|
||||
|
||||
- 切换到播放详情歌词界面时将阻止屏幕息屏
|
||||
|
||||
### 修复
|
||||
|
||||
- 修复一个导致崩溃日志写入文件前会导致APP崩溃的莫名其妙问题
|
||||
- 修复进入播放详情歌词界面后的屏幕常亮不会被取消的问题
|
||||
|
@ -12,3 +12,5 @@ global.allList = null
|
||||
global.globalObj = null
|
||||
global.listScrollPosition = {}
|
||||
global.listSort = {}
|
||||
|
||||
global.isScreenKeepAwake = false
|
||||
|
@ -42,8 +42,6 @@ export default memo(() => {
|
||||
|
||||
// const imgWidth = useMemo(() => layout.width * 0.75, [layout.width])
|
||||
const handleScrollToActive = useCallback((index = lineRef.current) => {
|
||||
screenkeepAwake()
|
||||
|
||||
if (scrollViewRef.current && linesRef.current.length) {
|
||||
scrollViewRef.current.scrollToIndex({
|
||||
index,
|
||||
@ -51,10 +49,6 @@ export default memo(() => {
|
||||
viewPosition: 0.4,
|
||||
})
|
||||
}
|
||||
|
||||
return () => {
|
||||
screenUnkeepAwake()
|
||||
}
|
||||
}, [])
|
||||
|
||||
const handleScrollBeginDrag = () => {
|
||||
|
@ -9,13 +9,20 @@ import { useGetter, useDispatch } from '@/store'
|
||||
import PagerView from 'react-native-pager-view'
|
||||
import Pic from './Pic'
|
||||
import Lyric from './Lyric'
|
||||
import { screenkeepAwake, screenUnkeepAwake } from '@/utils/utils'
|
||||
|
||||
// global.iskeep = false
|
||||
export default memo(() => {
|
||||
const theme = useGetter('common', 'theme')
|
||||
const [pageIndex, setPageIndex] = useState(0)
|
||||
|
||||
const onPageSelected = useCallback(({ nativeEvent }) => {
|
||||
setPageIndex(nativeEvent.position)
|
||||
if (nativeEvent.position == 1) {
|
||||
screenkeepAwake()
|
||||
} else {
|
||||
screenUnkeepAwake()
|
||||
}
|
||||
}, [])
|
||||
|
||||
const pic = useMemo(() => <Pic />, [])
|
||||
|
@ -9,6 +9,7 @@ import { compareVer } from '@/utils'
|
||||
// import { setMaxCache } from '@/plugins/player/utils'
|
||||
import { showVersionModal } from '@/navigation'
|
||||
import { VERSION_STATUS } from '@/config/constant'
|
||||
import { screenUnkeepAwake } from '@/utils/utils'
|
||||
|
||||
export const TYPES = {
|
||||
updateSetting: null,
|
||||
@ -107,10 +108,16 @@ export const setComponentId = data => ({
|
||||
type: TYPES.setComponentId,
|
||||
payload: data,
|
||||
})
|
||||
export const removeComponentId = id => ({
|
||||
type: TYPES.removeComponentId,
|
||||
payload: id,
|
||||
})
|
||||
export const removeComponentId = id => (dispatch, getState) => {
|
||||
const { common } = getState()
|
||||
if (common.componentIds.playDetail == id) {
|
||||
screenUnkeepAwake()
|
||||
}
|
||||
dispatch({
|
||||
type: TYPES.removeComponentId,
|
||||
payload: id,
|
||||
})
|
||||
}
|
||||
|
||||
export const setNavActiveIndex = index => ({
|
||||
type: TYPES.setNavActiveIndex,
|
||||
|
@ -9,5 +9,14 @@ export const getSupportedAbis = UtilsModule.getSupportedAbis
|
||||
export const installApk = (filePath, fileProviderAuthority) => UtilsModule.installApk(filePath, fileProviderAuthority)
|
||||
|
||||
|
||||
export const screenkeepAwake = UtilsModule.screenkeepAwake
|
||||
export const screenUnkeepAwake = UtilsModule.screenUnkeepAwake
|
||||
export const screenkeepAwake = () => {
|
||||
if (global.isScreenKeepAwake) return
|
||||
global.isScreenKeepAwake = true
|
||||
UtilsModule.screenkeepAwake()
|
||||
}
|
||||
export const screenUnkeepAwake = () => {
|
||||
// console.log('screenUnkeepAwake')
|
||||
if (!global.isScreenKeepAwake) return
|
||||
global.isScreenKeepAwake = false
|
||||
UtilsModule.screenUnkeepAwake()
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user