From 8c1b258877565e34c401d0b55f3dbd9c5d1bc9c7 Mon Sep 17 00:00:00 2001 From: m0_75226990 Date: Wed, 15 Mar 2023 12:02:33 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20uni-usercaptruescreen=20uts=E8=AF=AD?= =?UTF-8?q?=E6=B3=95=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../utssdk/app-ios/index.uts | 24 +++++++------------ .../utssdk/interface.uts | 23 +++++++++++++++++- 2 files changed, 30 insertions(+), 17 deletions(-) diff --git a/uni_modules/uni-usercapturescreen/utssdk/app-ios/index.uts b/uni_modules/uni-usercapturescreen/utssdk/app-ios/index.uts index 68e7ad4..683af64 100644 --- a/uni_modules/uni-usercapturescreen/utssdk/app-ios/index.uts +++ b/uni_modules/uni-usercapturescreen/utssdk/app-ios/index.uts @@ -1,6 +1,6 @@ import { NotificationCenter} from 'Foundation'; import { UIApplication } from "UIKit" -import { OnUserCaptureScreen, OffUserCaptureScreen, UserCaptureScreenCallback } from "../interface.uts" +import { OnUserCaptureScreen, OffUserCaptureScreen, UserCaptureScreenCallback, OnUserCaptureScreenResult } from "../interface.uts" /** @@ -23,7 +23,13 @@ class CaptureScreenTool { // target-action 的方法前需要添加 @objc 前缀 @objc static userDidTakeScreenshot() { // 回调 - this.listener?.({}) + const res: OnUserCaptureScreenResult = { + errCode: 0, + errSubject: "uni-usercapturescreen", + errMsg: "onUserCaptureScreen:ok", + path: null + } + this.listener?.(res) } // 移除监听事件 @@ -33,20 +39,6 @@ class CaptureScreenTool { } } -// /** -// * 开启截图监听 -// */ -// export function onUserCaptureScreen(callback?: UTSCallback) { -// CaptureScreenTool.listenCaptureScreen(callback) -// } - -// /** -// * 关闭截屏监听 -// */ -// export function offUserCaptureScreen(callback?: UTSCallback) { -// CaptureScreenTool.removeListen(callback) -// } - /** * 开启截图监听 */ diff --git a/uni_modules/uni-usercapturescreen/utssdk/interface.uts b/uni_modules/uni-usercapturescreen/utssdk/interface.uts index 6ed4533..528ebb0 100644 --- a/uni_modules/uni-usercapturescreen/utssdk/interface.uts +++ b/uni_modules/uni-usercapturescreen/utssdk/interface.uts @@ -1,4 +1,25 @@ -export type UserCaptureScreenCallback = (res: any) => void +export type OnUserCaptureScreenResult = { + /** + * 错误码 + * 0:成功 + * -1:permission denied + */ + errCode : number, + /** + * 调用API的名称 + */ + errSubject : string, + /** + * 错误的详细信息 + */ + errMsg : string, + /** + * 截屏文件路径(仅Android返回) + */ + path ?: string +} + +export type UserCaptureScreenCallback = (res: OnUserCaptureScreenResult) => void /** * 开启截屏监听 -- GitLab