mirror of
https://github.com/ikun0014/lx-music-mobile.git
synced 2025-07-03 06:32:10 +08:00
添加在启用桌面歌词时对悬浮层权限的检查
This commit is contained in:
parent
05ecb62907
commit
9fbd04133a
@ -103,6 +103,14 @@ public class LyricModule extends ReactContextBaseJavaModule {
|
||||
promise.resolve(null);
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void checkOverlayPermission(Promise promise) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && !Settings.canDrawOverlays(reactContext)) {
|
||||
promise.reject(new Exception("Permission denied"));
|
||||
}
|
||||
promise.resolve(null);
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void openOverlayPermissionActivity(Promise promise) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && !Settings.canDrawOverlays(reactContext)) {
|
||||
|
@ -1,7 +1,12 @@
|
||||
### 优化
|
||||
|
||||
- 优化设置界面的输入框输入机制,现在只要键盘收起即可自动保存输入的内容
|
||||
- 添加在启用桌面歌词时对悬浮层权限的检查,这应该可以修复某些设备上点击启用桌面歌词时不显示无权限弹窗也不显示桌面歌词的情况
|
||||
|
||||
### 变更
|
||||
|
||||
- 不再自动聚焦定时退出、调整位置弹窗内的输入框,这应该可以修复某些设备无法在这两个地方弹出键盘的问题
|
||||
|
||||
### 修复
|
||||
|
||||
- 修复启用桌面歌词时的权限提示弹窗会导致应用报错的问题
|
||||
|
@ -8,7 +8,7 @@ import CheckBoxItem from '../components/CheckBoxItem'
|
||||
|
||||
import { useTranslation } from '@/plugins/i18n'
|
||||
import { toast } from '@/utils/tools'
|
||||
import { openOverlayPermissionActivity } from '@/utils/lyricDesktop'
|
||||
import { checkOverlayPermission, openOverlayPermissionActivity } from '@/utils/lyricDesktop'
|
||||
|
||||
export default memo(() => {
|
||||
const { t } = useTranslation()
|
||||
@ -19,6 +19,7 @@ export default memo(() => {
|
||||
const handleChangeEnableDesktopLyric = useCallback(async isEnable => {
|
||||
if (isEnable) {
|
||||
try {
|
||||
await checkOverlayPermission()
|
||||
await setIsShowDesktopLyric(isEnable)
|
||||
} catch (err) {
|
||||
setVisibleTips(true)
|
||||
@ -31,13 +32,11 @@ export default memo(() => {
|
||||
const handleTipsCancel = useCallback(() => {
|
||||
toast(t('disagree_tip'), 'long')
|
||||
setVisibleTips(false)
|
||||
isEnableDesktopLyric(false)
|
||||
}, [isEnableDesktopLyric, t])
|
||||
}, [t])
|
||||
const handleTipsConfirm = useCallback(() => {
|
||||
setVisibleTips(false)
|
||||
openOverlayPermissionActivity()
|
||||
isEnableDesktopLyric(false)
|
||||
}, [isEnableDesktopLyric])
|
||||
}, [])
|
||||
|
||||
return (
|
||||
<View style={{ marginTop: 5, marginBottom: 15 }}>
|
||||
|
@ -128,6 +128,10 @@ export const setLyricTextPosition = (textX, textY) => {
|
||||
return LyricModule.setLyricTextPosition(getTextPositionX(textX), getTextPositionY(textY))
|
||||
}
|
||||
|
||||
export const checkOverlayPermission = () => {
|
||||
return LyricModule.checkOverlayPermission()
|
||||
}
|
||||
|
||||
export const openOverlayPermissionActivity = () => {
|
||||
return LyricModule.openOverlayPermissionActivity()
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user