提交 186ead48 编写于 作者: lizhongyi_'s avatar lizhongyi_

Merge branch 'dev' into alpha

* dev:
  Android uni-usercapturescreen 语法调整
  wifi 适配3.7.7
  fix: uni-usercapturescreen iOS 更新
  usercapturescreen统一interface.uts
  内存警告插件 去掉默认值,避免变量未使用的警告
  内存警告插件 方法参数改回 UTSCallback 类型
  内存警告先还原会 utscallback 写法
  uni-wifi interface更新
  uni-wifi新增interface
  内存监控android 按照 3.7.7语法修改
  优化iOS插件示例
  uni-usercapturescreen 插件iOS调整
  Android uni-usercapturescreen 语法调整
  电量:移除成功信息中的错误码
  电量:移除成功信息中的错误码定义
  电量:重构
  Revert "手动修复内存监控 组件 3.7.6之后编译器新语法"
  手动修复内存监控 组件 3.7.6之后编译器新语法

# Conflicts:
#	pages/index/index.vue
#	uni_modules/uni-usercapturescreen/utssdk/app-android/index.uts
#	uni_modules/uni-usercapturescreen/utssdk/app-ios/index.uts
#	uni_modules/uni-usercapturescreen/utssdk/interface.uts
...@@ -44,6 +44,7 @@ ...@@ -44,6 +44,7 @@
uni.connectWifi({ uni.connectWifi({
maunal:false, maunal:false,
SSID:"Xiaomi_20D0", SSID:"Xiaomi_20D0",
BSSID:"",
password:"BBBB", password:"BBBB",
complete:(res)=>{ complete:(res)=>{
console.log(res); console.log(res);
...@@ -138,27 +139,11 @@ ...@@ -138,27 +139,11 @@
var that = this; var that = this;
uni.onUserCaptureScreen(function(res) { uni.onUserCaptureScreen(function(res) {
console.log(res); console.log(res);
if (uni.getSystemInfoSync().platform == "android") {
// 除android 之外的平台,不需要判断返回状态码
if(res.errCode == -1){
// 启动失败
that.permissionGranted = true;
return ;
}else if(res.errCode == 0){
uni.showToast({ uni.showToast({
icon:"none", icon:"none",
title:'捕获截屏事件' title:'捕获截屏事件'
}) })
that.screenImage = res.image that.screenImage = res.path
}
}else{
// 除android 之外的平台,不需要判断返回状态码
uni.showToast({
icon:"none",
title:'捕获截屏事件'
})
}
}); });
if (uni.getSystemInfoSync().platform != "android" || that.permissionGranted) { if (uni.getSystemInfoSync().platform != "android" || that.permissionGranted) {
......
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
}, },
"uni_modules": { "uni_modules": {
"uni-ext-api": { "uni-ext-api": {
"uni": "getBatteryInfo" "uni": ["getBatteryInfo"]
}, },
"dependencies": [], "dependencies": [],
"encrypt": [], "encrypt": [],
......
...@@ -2,14 +2,9 @@ import Context from "android.content.Context"; ...@@ -2,14 +2,9 @@ import Context from "android.content.Context";
import BatteryManager from "android.os.BatteryManager"; import BatteryManager from "android.os.BatteryManager";
import { UTSAndroid } from "io.dcloud.uts"; import { UTSAndroid } from "io.dcloud.uts";
import { GetBatteryInfo, GetBatteryInfoSuccess, GetBatteryInfoFail, GetBatteryInfoOptions } from '../interface.uts'
type GetBatteryInfoOptions = { export const getBatteryInfo : GetBatteryInfo = function (options) {
success?: (res: UTSJSONObject) => void
fail?: (res: UTSJSONObject) => void
complete?: (res: UTSJSONObject) => void
}
export default function getBatteryInfo(options: GetBatteryInfoOptions) {
const context = UTSAndroid.getAppContext(); const context = UTSAndroid.getAppContext();
if (context != null) { if (context != null) {
const manager = context.getSystemService( const manager = context.getSystemService(
...@@ -18,9 +13,7 @@ export default function getBatteryInfo(options: GetBatteryInfoOptions) { ...@@ -18,9 +13,7 @@ export default function getBatteryInfo(options: GetBatteryInfoOptions) {
const level = manager.getIntProperty( const level = manager.getIntProperty(
BatteryManager.BATTERY_PROPERTY_CAPACITY BatteryManager.BATTERY_PROPERTY_CAPACITY
); );
const res = { const res : GetBatteryInfoSuccess = {
errCode: 0,
errSubject: "uni-getBatteryInfo",
errMsg: 'getBatteryInfo:ok', errMsg: 'getBatteryInfo:ok',
level, level,
isCharging: manager.isCharging() isCharging: manager.isCharging()
...@@ -28,10 +21,11 @@ export default function getBatteryInfo(options: GetBatteryInfoOptions) { ...@@ -28,10 +21,11 @@ export default function getBatteryInfo(options: GetBatteryInfoOptions) {
options.success?.(res) options.success?.(res)
options.complete?.(res) options.complete?.(res)
} else { } else {
const res = { const res : GetBatteryInfoFail = {
errSubject: "uni-getBatteryInfo", errSubject: "uni-getBatteryInfo",
errCode: 1001, errCode: 1001,
errMsg: 'getBatteryInfo:fail getAppContext is null' errMsg: 'getBatteryInfo:fail getAppContext is null',
cause: null
} }
options.fail?.(res) options.fail?.(res)
options.complete?.(res) options.complete?.(res)
......
...@@ -2,27 +2,18 @@ ...@@ -2,27 +2,18 @@
import { UIDevice } from "UIKit"; import { UIDevice } from "UIKit";
import { Int } from 'Swift'; import { Int } from 'Swift';
/** import { GetBatteryInfo, GetBatteryInfoSuccess } from '../interface.uts';
* 定义 接口参数
*/
type GetBatteryInfoOptions = {
success?: (res: object) => void;
fail?: (res: object) => void;
complete?: (res: object) => void;
};
/** /**
* 导出 获取电量方法 * 导出 获取电量方法
*/ */
export default function getBatteryInfo(options: GetBatteryInfoOptions) { export const getBatteryInfo : GetBatteryInfo = function (options) {
// 开启电量检测 // 开启电量检测
UIDevice.current.isBatteryMonitoringEnabled = true UIDevice.current.isBatteryMonitoringEnabled = true
// 返回数据 // 返回数据
const res = { const res : GetBatteryInfoSuccess = {
errCode: 0,
errSubject: "uni-getBatteryInfo",
errMsg: "getBatteryInfo:ok", errMsg: "getBatteryInfo:ok",
level: new Int(UIDevice.current.batteryLevel * 100), level: new Int(UIDevice.current.batteryLevel * 100),
isCharging: UIDevice.current.batteryState == UIDevice.BatteryState.charging, isCharging: UIDevice.current.batteryState == UIDevice.BatteryState.charging,
......
type GetBatteryInfoResult = { export type GetBatteryInfoSuccess = {
/**
* 错误码
* 0:成功
* 1001:getAppContext is null
* 1002:navigator.getBattery is unsupported
*/
errCode : number,
/**
* 调用API的名称
*/
errSubject : string,
/**
* 错误的详细信息
*/
errMsg : string, errMsg : string,
/** /**
* 设备电量,范围1 - 100 * 设备电量,范围1 - 100
...@@ -24,7 +10,7 @@ type GetBatteryInfoResult = { ...@@ -24,7 +10,7 @@ type GetBatteryInfoResult = {
isCharging : boolean isCharging : boolean
} }
interface UniError<T> { export type GetBatteryInfoFail = {
/** /**
* 错误码 * 错误码
*/ */
...@@ -40,7 +26,7 @@ interface UniError<T> { ...@@ -40,7 +26,7 @@ interface UniError<T> {
/** /**
* 错误来源 * 错误来源
*/ */
cause : any cause : any | null
} }
...@@ -49,28 +35,27 @@ export type GetBatteryInfoOptions = { ...@@ -49,28 +35,27 @@ export type GetBatteryInfoOptions = {
/** /**
* 接口调用结束的回调函数(调用成功、失败都会执行) * 接口调用结束的回调函数(调用成功、失败都会执行)
*/ */
success ?: (res : GetBatteryInfoResult) => void success ?: (res : GetBatteryInfoSuccess) => void
/** /**
* 接口调用失败的回调函数 * 接口调用失败的回调函数
*/ */
fail ?: (res : UniError) => void fail ?: (res : GetBatteryInfoFail) => void
/** /**
* 接口调用成功的回调 * 接口调用成功的回调
*/ */
complete ?: (res : object) => void complete ?: (res : any) => void
} }
/** /**
* 获取电量信息 * 获取电量信息
* @param {GetBatteryInfoOptions} options * @param {GetBatteryInfoOptions} options
* *
* *
* @tutorial https://uniapp.dcloud.net.cn/api/system/batteryInfo.html * @tutorial https://uniapp.dcloud.net.cn/api/system/batteryInfo.html
* @platforms APP-IOS = ^9.0,APP-ANDROID = ^22 * @platforms APP-IOS = ^9.0,APP-ANDROID = ^22
* @since 3.6.11 * @since 3.6.11
* *
* @assert () => success({errCode: 0, errSubject: "uni-getBatteryInfo", errMsg: "getBatteryInfo:ok", level: 60, isCharging: false }) * @assert () => success({errCode: 0, errSubject: "uni-getBatteryInfo", errMsg: "getBatteryInfo:ok", level: 60, isCharging: false })
* @assert () => fail({errCode: 1001, errSubject: "uni-getBatteryInfo", errMsg: "getBatteryInfo:fail getAppContext is null" }) * @assert () => fail({errCode: 1001, errSubject: "uni-getBatteryInfo", errMsg: "getBatteryInfo:fail getAppContext is null" })
*/ */
export default function getBatteryInfo(options : GetBatteryInfoOptions) : void export type GetBatteryInfo = (options : GetBatteryInfoOptions) => void
\ No newline at end of file
export default function getBatteryInfo(options) { export function getBatteryInfo(options) {
return my.getBatteryInfo(options) return my.getBatteryInfo(options)
} }
export default function getBatteryInfo(options) { export function getBatteryInfo(options) {
return swan.getBatteryInfo(options) return swan.getBatteryInfo(options)
} }
export default function getBatteryInfo(options) { export function getBatteryInfo(options) {
return qq.getBatteryInfo(options) return qq.getBatteryInfo(options)
} }
export default function getBatteryInfo(options) { export function getBatteryInfo(options) {
return wx.getBatteryInfo(options) return wx.getBatteryInfo(options)
} }
export default function getBatteryInfo(options) { export function getBatteryInfo(options) {
if (navigator.getBattery) { if (navigator.getBattery) {
navigator.getBattery().then(battery => { navigator.getBattery().then(battery => {
const res = { const res = {
......
import { UTSAndroid } from "io.dcloud.uts" import { UTSAndroid } from "io.dcloud.uts"
let listeners: UTSCallback[] = [] let listeners: UTSCallback[] = []
const onAppTrimMemoryListener = (res: number) => { const onAppTrimMemoryListener = (ret: number) => {
listeners.forEach(listener => { listeners.forEach(listener => {
let res = {
level:ret
}
listener(res) listener(res)
}) })
} }
@Suppress("DEPRECATION") @Suppress("DEPRECATION")
export function onMemoryWarning(callback: (res: number) => void) { export function onMemoryWarning(callback: UTSCallback) {
if (listeners.length == 0) { if (listeners.length == 0) {
// 仅首次执行底层的实际监听 // 仅首次执行底层的实际监听
UTSAndroid.onAppTrimMemory(onAppTrimMemoryListener) UTSAndroid.onAppTrimMemory(onAppTrimMemoryListener)
...@@ -22,8 +26,9 @@ export function onMemoryWarning(callback: (res: number) => void) { ...@@ -22,8 +26,9 @@ export function onMemoryWarning(callback: (res: number) => void) {
listeners.push(callback) listeners.push(callback)
} }
@Suppress("DEPRECATION") @Suppress("DEPRECATION")
export function offMemoryWarning(callback: UTSCallback | null = null) { export function offMemoryWarning(callback: UTSCallback | null) {
if(callback == null){ if(callback == null){
// 清除全部回调 // 清除全部回调
...@@ -42,3 +47,4 @@ export function offMemoryWarning(callback: UTSCallback | null = null) { ...@@ -42,3 +47,4 @@ export function offMemoryWarning(callback: UTSCallback | null = null) {
UTSAndroid.offAppTrimMemory(onAppTrimMemoryListener) UTSAndroid.offAppTrimMemory(onAppTrimMemoryListener)
} }
} }
...@@ -8,7 +8,8 @@ import File from "java.io.File"; ...@@ -8,7 +8,8 @@ import File from "java.io.File";
import Environment from "android.os.Environment"; import Environment from "android.os.Environment";
import System from 'java.lang.System'; import System from 'java.lang.System';
import WindowManager from 'android.view.WindowManager'; import WindowManager from 'android.view.WindowManager';
import { UserCaptureScreenResult, OnUserCaptureScreenResult, SetUserCaptureScreenOptions, UserCaptureScreenCallback, OnUserCaptureScreen, OffUserCaptureScreen, SetUserCaptureScreen } from "../interface.uts"; import { OnUserCaptureScreenCallbackResult, UserCaptureScreenCallback, OnUserCaptureScreen, OffUserCaptureScreen, SetUserCaptureScreenSuccess, SetUserCaptureScreenOptions, SetUserCaptureScreen } from "../interface.uts";
/** /**
* 文件监听器 * 文件监听器
...@@ -50,10 +51,7 @@ class ScreenFileObserver extends FileObserver { ...@@ -50,10 +51,7 @@ class ScreenFileObserver extends FileObserver {
lastObserverTime = currentTime; lastObserverTime = currentTime;
const screenShotPath = new File(this.screenFile, path).getPath(); const screenShotPath = new File(this.screenFile, path).getPath();
const res : OnUserCaptureScreenResult = { const res : OnUserCaptureScreenCallbackResult = {
errCode: 0,
errMsg: "onUserCaptureScreen:ok",
errSubject: "uni-onUserCaptureScreen",
path: screenShotPath path: screenShotPath
} }
listener?.(res); listener?.(res);
...@@ -68,23 +66,15 @@ class ScreenFileObserver extends FileObserver { ...@@ -68,23 +66,15 @@ class ScreenFileObserver extends FileObserver {
export const onUserCaptureScreen : OnUserCaptureScreen = function (callback : UserCaptureScreenCallback | null) { export const onUserCaptureScreen : OnUserCaptureScreen = function (callback : UserCaptureScreenCallback | null) {
// 检查相关权限是否已授予 // 检查相关权限是否已授予
if (ActivityCompat.checkSelfPermission(UTSAndroid.getAppContext()!, Manifest.permission.READ_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) { if (ActivityCompat.checkSelfPermission(UTSAndroid.getAppContext()!, Manifest.permission.READ_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
// 无权限,申请权限,并且告知用户监听失败 // 无权限,申请权限
ActivityCompat.requestPermissions(UTSAndroid.getUniActivity()!, arrayOf(Manifest.permission.READ_EXTERNAL_STORAGE), 1001); ActivityCompat.requestPermissions(UTSAndroid.getUniActivity()!, arrayOf(Manifest.permission.READ_EXTERNAL_STORAGE), 1001);
// 因权限缺失导致监听失败
const res : OnUserCaptureScreenResult = {
errCode: -1,
errMsg: "onUserCaptureScreen:permission denied",
errSubject: "uni-onUserCaptureScreen"
}
callback?.(res);
return; return;
} }
// 更新监听 // 更新监听
listener = callback; listener = callback;
let directory_screenshot : File; let directory_screenshot : File;
if (Build.MANUFACTURER.toLowerCase() === "xiaomi") { if (Build.MANUFACTURER.toLowerCase() == "xiaomi") {
// @Suppress("DEPRECATION") // @Suppress("DEPRECATION")
directory_screenshot = new File(new File(Environment.getExternalStorageDirectory(), Environment.DIRECTORY_DCIM), "Screenshots"); directory_screenshot = new File(new File(Environment.getExternalStorageDirectory(), Environment.DIRECTORY_DCIM), "Screenshots");
} else { } else {
...@@ -113,11 +103,7 @@ export const offUserCaptureScreen : OffUserCaptureScreen = function (_ : UserCap ...@@ -113,11 +103,7 @@ export const offUserCaptureScreen : OffUserCaptureScreen = function (_ : UserCap
export const setUserCaptureScreen : SetUserCaptureScreen = function (option : SetUserCaptureScreenOptions) { export const setUserCaptureScreen : SetUserCaptureScreen = function (option : SetUserCaptureScreenOptions) {
// 切换到UI线程 // 切换到UI线程
UTSAndroid.getUniActivity()?.runOnUiThread(new SetUserCaptureScreenRunnable(option.enable)); UTSAndroid.getUniActivity()?.runOnUiThread(new SetUserCaptureScreenRunnable(option.enable));
const res : UserCaptureScreenResult = { const res : SetUserCaptureScreenSuccess = {}
errCode: 0,
errMsg: "setUserCaptureScreen:ok",
errSubject: "uni-setUserCaptureScreen"
}
option.success?.(res); option.success?.(res);
option.complete?.(res); option.complete?.(res);
} }
......
...@@ -3,7 +3,7 @@ import { CGRect } from "CoreFoundation"; ...@@ -3,7 +3,7 @@ import { CGRect } from "CoreFoundation";
import { UIApplication, UIView, UITextField, UIScreen, UIDevice } from "UIKit" import { UIApplication, UIView, UITextField, UIScreen, UIDevice } from "UIKit"
import { UTSiOS } from "DCloudUTSFoundation" import { UTSiOS } from "DCloudUTSFoundation"
import { DispatchQueue } from 'Dispatch'; import { DispatchQueue } from 'Dispatch';
import { SetUserCaptureScreenOptions, UserCaptureScreenResult, OnUserCaptureScreen, OffUserCaptureScreen, SetUserCaptureScreen, UserCaptureScreenCallback, OnUserCaptureScreenResult } from "../interface.uts" import { SetUserCaptureScreenOptions, OnUserCaptureScreenCallbackResult, OnUserCaptureScreen, OffUserCaptureScreen, SetUserCaptureScreen, UserCaptureScreenCallback, SetUserCaptureScreenSuccess, SetUserCaptureScreenFail } from "../interface.uts"
/** /**
* 定义监听截屏事件工具类 * 定义监听截屏事件工具类
...@@ -26,11 +26,7 @@ class CaptureScreenTool { ...@@ -26,11 +26,7 @@ class CaptureScreenTool {
// target-action 的方法前需要添加 @objc 前缀 // target-action 的方法前需要添加 @objc 前缀
@objc static userDidTakeScreenshot() { @objc static userDidTakeScreenshot() {
// 回调 // 回调
const res: OnUserCaptureScreenResult = { const res: OnUserCaptureScreenCallbackResult = {
errCode: 0,
errSubject: "uni-usercapturescreen",
errMsg: "onUserCaptureScreen: ok",
path: null
} }
this.listener?.(res) this.listener?.(res)
} }
...@@ -39,13 +35,6 @@ class CaptureScreenTool { ...@@ -39,13 +35,6 @@ class CaptureScreenTool {
static removeListen(callback : UserCaptureScreenCallback | null) { static removeListen(callback : UserCaptureScreenCallback | null) {
this.listener = null this.listener = null
NotificationCenter.default.removeObserver(this) NotificationCenter.default.removeObserver(this)
const res: OnUserCaptureScreenResult = {
errCode: 0,
errSubject: "uni-usercapturescreen",
errMsg: "offUserCaptureScreen: ok",
path: null
}
callback?.(res)
} }
static createSecureView() : UIView | null { static createSecureView() : UIView | null {
...@@ -81,10 +70,7 @@ class CaptureScreenTool { ...@@ -81,10 +70,7 @@ class CaptureScreenTool {
rootView!.frame = rect rootView!.frame = rect
} }
} }
let res: UserCaptureScreenResult = { let res: SetUserCaptureScreenSuccess = {
errCode: 0,
errSubject: "uni-usercapturescreen",
errMsg: "setUserCaptureScreen:ok"
} }
option.success?.(res) option.success?.(res)
option.complete?.(res) option.complete?.(res)
...@@ -106,10 +92,7 @@ class CaptureScreenTool { ...@@ -106,10 +92,7 @@ class CaptureScreenTool {
} }
this.secureView = null this.secureView = null
} }
let res: UserCaptureScreenResult = { let res: SetUserCaptureScreenSuccess = {
errCode: 0,
errSubject: "uni-usercapturescreen",
errMsg: "setUserCaptureScreen:ok"
} }
option.success?.(res) option.success?.(res)
option.complete?.(res) option.complete?.(res)
...@@ -136,7 +119,7 @@ export const offUserCaptureScreen : OffUserCaptureScreen = function (callback : ...@@ -136,7 +119,7 @@ export const offUserCaptureScreen : OffUserCaptureScreen = function (callback :
*/ */
export const setUserCaptureScreen : SetUserCaptureScreen = function (options : SetUserCaptureScreenOptions) { export const setUserCaptureScreen : SetUserCaptureScreen = function (options : SetUserCaptureScreenOptions) {
if (UIDevice.current.systemVersion < "13.0") { if (UIDevice.current.systemVersion < "13.0") {
let res: UserCaptureScreenResult = { let res: SetUserCaptureScreenFail = {
errCode: 12001, errCode: 12001,
errSubject: "uni-usercapturescreen", errSubject: "uni-usercapturescreen",
errMsg: "setUserCaptureScreen:system not support" errMsg: "setUserCaptureScreen:system not support"
...@@ -145,7 +128,7 @@ export const setUserCaptureScreen : SetUserCaptureScreen = function (options : S ...@@ -145,7 +128,7 @@ export const setUserCaptureScreen : SetUserCaptureScreen = function (options : S
options.complete?.(res); options.complete?.(res);
} else if (UIDevice.current.systemVersion == "15.1") { } else if (UIDevice.current.systemVersion == "15.1") {
let res: UserCaptureScreenResult = { let res: SetUserCaptureScreenFail = {
errCode: 12010, errCode: 12010,
errSubject: "uni-usercapturescreen", errSubject: "uni-usercapturescreen",
errMsg: "setUserCaptureScreen:system internal error" errMsg: "setUserCaptureScreen:system internal error"
......
export type UserCaptureScreenResult = { /**
* uni.onUserCaptureScreen/uni.offUserCaptureScreen回调参数
*/
export type OnUserCaptureScreenCallbackResult = {
/**
* 截屏文件路径(仅Android返回)
*/
path ?: string
}
/**
* uni.onUserCaptureScreen/uni.offUserCaptureScreen回调函数定义
*/
export type UserCaptureScreenCallback = (res : OnUserCaptureScreenCallbackResult) => void
/**
* uni.onUserCaptureScreen函数定义
* 开启截屏监听
*
* @param {UserCaptureScreenCallback} callback
* @tutorial https://uniapp.dcloud.net.cn/api/system/capture-screen.html#onusercapturescreen
* @platforms APP-IOS = ^9.0,APP-ANDROID = ^19
* @since 3.6.8
*/
export type OnUserCaptureScreen = (callback : UserCaptureScreenCallback | null) => void
/**
* uni.offUserCaptureScreen函数定义
* 关闭截屏监听
*
* @param {UserCaptureScreenCallback} callback
* @tutorial https://uniapp.dcloud.net.cn/api/system/capture-screen.html#offusercapturescreen
* @platforms APP-IOS = ^9.0,APP-ANDROID = ^19
* @since 3.6.8
*/
export type OffUserCaptureScreen = (callback : UserCaptureScreenCallback | null) => void
/**
* uni.setUserCaptureScreen成功回调参数
*/
export type SetUserCaptureScreenSuccess = {
}
/**
* uni.setUserCaptureScreen失败回调参数
*/
export type SetUserCaptureScreenFail = {
/** /**
* 错误码 * 错误码
* 0:成功 * 0:成功
...@@ -17,26 +63,24 @@ export type UserCaptureScreenResult = { ...@@ -17,26 +63,24 @@ export type UserCaptureScreenResult = {
errMsg : string, errMsg : string,
} }
export type OnUserCaptureScreenResult = { /**
/** * uni.setUserCaptureScreen成功回调函数定义
* 错误码
* 0:成功
* -1:permission denied(仅Android返回)
*/ */
errCode : number, export type SetUserCaptureScreenSuccessCallback = (res : SetUserCaptureScreenSuccess) => void
/**
* 调用API的名称 /**
* uni.setUserCaptureScreen失败回调函数定义
*/ */
errSubject : string, export type SetUserCaptureScreenFailCallback = (res : SetUserCaptureScreenFail) => void
/**
* 错误的详细信息 /**
* uni.setUserCaptureScreen完成回调函数定义
*/ */
errMsg : string, export type SetUserCaptureScreenCompleteCallback = (res : any) => void
/**
* 截屏文件路径(仅Android返回) /**
* uni.setUserCaptureScreen参数
*/ */
path : string | null
}
export type SetUserCaptureScreenOptions = { export type SetUserCaptureScreenOptions = {
/** /**
...@@ -46,45 +90,29 @@ export type SetUserCaptureScreenOptions = { ...@@ -46,45 +90,29 @@ export type SetUserCaptureScreenOptions = {
/** /**
* 接口调用成功的回调函数 * 接口调用成功的回调函数
*/ */
success ?: (res : UserCaptureScreenResult) => void, // success : SetUserCaptureScreenSuccessCallback | null,
success ?: SetUserCaptureScreenSuccessCallback,
/** /**
* 接口调用失败的回调函数 * 接口调用失败的回调函数
*/ */
fail ?: (res : UserCaptureScreenResult) => void, // fail : SetUserCaptureScreenFailCallback | null,
fail ?: SetUserCaptureScreenFailCallback,
/** /**
* 接口调用结束的回调函数(调用成功、失败都会执行) * 接口调用结束的回调函数(调用成功、失败都会执行)
*/ */
complete ?: (res : UserCaptureScreenResult) => void // complete : SetUserCaptureScreenSuccessCallback | SetUserCaptureScreenFailCallback | null
complete ?: SetUserCaptureScreenCompleteCallback
} }
export type UserCaptureScreenCallback = (res : OnUserCaptureScreenResult) => void
/** /**
* 开启截屏监听 * * uni.setUserCaptureScreen函数定义
*
* @param {UserCaptureScreenCallback} callback
* @tutorial https://uniapp.dcloud.net.cn/api/system/capture-screen.html#onusercapturescreen
* @platforms APP-IOS = ^9.0,APP-ANDROID = ^22
* @since 3.6.8
*/
export type OnUserCaptureScreen = (callback : UserCaptureScreenCallback | null) => void
/**
* 关闭截屏监听
*
* @param {UserCaptureScreenCallback} callback
* @tutorial https://uniapp.dcloud.net.cn/api/system/capture-screen.html#offusercapturescreen
* @platforms APP-IOS = ^9.0,APP-ANDROID = ^22
* @since 3.6.8
*/
export type OffUserCaptureScreen = (callback : UserCaptureScreenCallback | null) => void
/**
* 设置防截屏 * 设置防截屏
* *
* @param {SetUserCaptureScreenOptions} options * @param {SetUserCaptureScreenOptions} options
* @tutorial https://uniapp.dcloud.net.cn/api/system/capture-screen.html#setusercapturescreen * @tutorial https://uniapp.dcloud.net.cn/api/system/capture-screen.html#setusercapturescreen
* @platforms APP-IOS = ^9.0,APP-ANDROID = ^22 * @platforms APP-IOS = ^13.0,APP-ANDROID = ^19
* @since 3.7.3 * @since 3.7.3
*/ */
export type SetUserCaptureScreen = (options : SetUserCaptureScreenOptions) => void export type SetUserCaptureScreen = (options : SetUserCaptureScreenOptions) => void
...@@ -94,4 +122,3 @@ interface uni { ...@@ -94,4 +122,3 @@ interface uni {
offUserCaptureScreen : OffUserCaptureScreen, offUserCaptureScreen : OffUserCaptureScreen,
setUserCaptureScreen : SetUserCaptureScreen setUserCaptureScreen : SetUserCaptureScreen
} }
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册