提交 4aea89a3 编写于 作者: DCloud-yyl's avatar DCloud-yyl

临时修复编译报错的问题

上级 88e4d2b1
...@@ -88,7 +88,7 @@ class ScreenFileObserver extends FileObserver { ...@@ -88,7 +88,7 @@ class ScreenFileObserver extends FileObserver {
* 开启截图监听 * 开启截图监听
*/ */
@Suppress("DEPRECATION") @Suppress("DEPRECATION")
export const onUserCaptureScreen : OnUserCaptureScreen = function (callback : UTSCallback) { export const onUserCaptureScreen : OnUserCaptureScreen = function (callback ?: UTSCallback) {
// 检查相关权限是否已经具备 // 检查相关权限是否已经具备
if (ActivityCompat.checkSelfPermission(UTSAndroid.getUniActivity()!, Manifest.permission.READ_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) { if (ActivityCompat.checkSelfPermission(UTSAndroid.getUniActivity()!, Manifest.permission.READ_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
...@@ -99,7 +99,7 @@ export const onUserCaptureScreen : OnUserCaptureScreen = function (callback : UT ...@@ -99,7 +99,7 @@ export const onUserCaptureScreen : OnUserCaptureScreen = function (callback : UT
let ret = { let ret = {
errCode:-1 errCode:-1
} }
callback(ret); callback?.(ret);
return ; return ;
} }
...@@ -120,14 +120,14 @@ export const onUserCaptureScreen : OnUserCaptureScreen = function (callback : UT ...@@ -120,14 +120,14 @@ export const onUserCaptureScreen : OnUserCaptureScreen = function (callback : UT
screenOB!.stopWatching() screenOB!.stopWatching()
} }
//开始监听 //开始监听
screenOB = new ScreenFileObserver(directory_screenshot.path) screenOB = new ScreenFileObserver(directory_screenshot.getPath())
screenOB!.startWatching() screenOB!.startWatching()
// 监听成功 // 监听成功
let ret = { let ret = {
errCode:0 errCode:0
} }
callback(ret); callback?.(ret);
} }
...@@ -135,7 +135,7 @@ export const onUserCaptureScreen : OnUserCaptureScreen = function (callback : UT ...@@ -135,7 +135,7 @@ export const onUserCaptureScreen : OnUserCaptureScreen = function (callback : UT
/** /**
* 关闭截屏监听 * 关闭截屏监听
*/ */
export const offUserCaptureScreen : OffUserCaptureScreen = function (callback : UTSCallback) { export const offUserCaptureScreen : OffUserCaptureScreen = function (callback ?: UTSCallback) {
// android 10以上,关闭监听通过移除文件监听器实现 // android 10以上,关闭监听通过移除文件监听器实现
if (screenOB != null) { if (screenOB != null) {
...@@ -144,7 +144,7 @@ export const offUserCaptureScreen : OffUserCaptureScreen = function (callback : ...@@ -144,7 +144,7 @@ export const offUserCaptureScreen : OffUserCaptureScreen = function (callback :
} }
lastFileObserverTime = 0; lastFileObserverTime = 0;
callback({}); callback?.({});
} }
/** /**
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册