interface.uts 4.2 KB
Newer Older
1 2 3
/**
	* uni.onUserCaptureScreen/uni.offUserCaptureScreen回调参数
	*/
4
export type OnUserCaptureScreenCallbackResult = {
5
	/**
6
		* 截屏文件路径(仅Android返回)
7
		*/
8
	path ?: string
9 10
}

11 12 13
/**
	* uni.onUserCaptureScreen/uni.offUserCaptureScreen回调函数定义
	*/
14
export type UserCaptureScreenCallback = (res : OnUserCaptureScreenCallbackResult) => void
15 16

export type OnUserCaptureScreen = (callback : UserCaptureScreenCallback | null) => void
17

18
export type OffUserCaptureScreen = (callback : UserCaptureScreenCallback | null) => void
19

20 21 22 23 24 25
/**
	* uni.setUserCaptureScreen成功回调参数
	*/
export type SetUserCaptureScreenSuccess = {
}

26

27
/**
28 29
	* uni.setUserCaptureScreen成功回调函数定义
	*/
30 31 32
export type SetUserCaptureScreenSuccessCallback = (res : SetUserCaptureScreenSuccess) => void

/**
33 34
	* uni.setUserCaptureScreen失败回调函数定义
	*/
35
export type SetUserCaptureScreenFailCallback = (res : UniError) => void
36 37

/**
38 39
	* uni.setUserCaptureScreen完成回调函数定义
	*/
40 41 42 43 44
export type SetUserCaptureScreenCompleteCallback = (res : any) => void

/**
	* uni.setUserCaptureScreen参数
	*/
lizhongyi_'s avatar
lizhongyi_ 已提交
45

46
export type SetUserCaptureScreenOptions = {
47
	/**
48 49
	* true: 允许用户截屏 false: 不允许用户截屏,防止用户截屏到应用页面内容
	*/
50
	enable : boolean;
51
	/**
52 53
	* 接口调用成功的回调函数
	*/
54
	// success : SetUserCaptureScreenSuccessCallback | null,
55
	success ?: SetUserCaptureScreenSuccessCallback,
56
	/**
57 58
	* 接口调用失败的回调函数
	*/
59
	// fail : SetUserCaptureScreenFailCallback | null,
60
	fail ?: SetUserCaptureScreenFailCallback,
61
	/**
62 63
	* 接口调用结束的回调函数(调用成功、失败都会执行)
	*/
64
	// complete : SetUserCaptureScreenSuccessCallback | SetUserCaptureScreenFailCallback | null
65
	complete ?: SetUserCaptureScreenCompleteCallback
66 67 68 69 70 71 72 73 74 75 76 77 78 79
}

/**
 * 错误码
 * - 12001 "setUserCaptureScreen:system not support"
 * - 12010 "setUserCaptureScreen:system internal error"
 */
export type SetUserCaptureScreenErrorCode = 12001 | 12010;
/**
 * SetUserCaptureScreen 的错误回调参数
 */
export interface SetUserCaptureScreenFail extends IUniError {
  errCode : SetUserCaptureScreenErrorCode
};
80

81
export type SetUserCaptureScreen = (options : SetUserCaptureScreenOptions) => void
82

83 84
export interface Uni {
	/**
DCloud_iOS_WZT's avatar
DCloud_iOS_WZT 已提交
85 86 87
	 * 开启截屏监听
	 *
	 * @param {UserCaptureScreenCallback} callback
88 89
	 * @tutorial https://uniapp.dcloud.net.cn/api/system/capture-screen.html#onusercapturescreen
	 * @uniPlatform {
lizhongyi_'s avatar
lizhongyi_ 已提交
90
	 *    "app": {
91 92 93 94 95 96
	 *        "android": {
	 *            "osVer": "4.4.4",
	 *            "uniVer": "3.7.7",
	 *            "unixVer": "3.9.0"
	 *        },
	 *        "ios": {
DCloud_iOS_WZT's avatar
DCloud_iOS_WZT 已提交
97
	 *            "osVer": "12.0",
98
	 *            "uniVer": "3.7.7",
DCloud_iOS_WZT's avatar
DCloud_iOS_WZT 已提交
99
	 *            "unixVer": "4.11"
100 101 102 103
	 *   	  }
	 *    }
	 * }
	 * @uniVersion 3.7.7
104 105
	 * @uniVueVersion 2,3  //支持的vue版本
	 * @autotest { expectCallback: true }
106
	 */
lizhongyi_'s avatar
lizhongyi_ 已提交
107
	onUserCaptureScreen(callback : UserCaptureScreenCallback | null) : void,
108
	/**
DCloud_iOS_WZT's avatar
DCloud_iOS_WZT 已提交
109 110 111
	 * 关闭截屏监听
	 *
	 * @param {UserCaptureScreenCallback} callback
112 113
	 * @tutorial https://uniapp.dcloud.net.cn/api/system/capture-screen.html#offusercapturescreen
	 * @uniPlatform {
lizhongyi_'s avatar
lizhongyi_ 已提交
114
	 *    "app": {
115 116 117 118 119 120
	 *        "android": {
	 *            "osVer": "4.4.4",
	 *            "uniVer": "3.7.7",
	 *            "unixVer": "3.9.0"
	 *        },
	 *        "ios": {
DCloud_iOS_WZT's avatar
DCloud_iOS_WZT 已提交
121
	 *            "osVer": "12.0",
122
	 *            "uniVer": "3.7.7",
DCloud_iOS_WZT's avatar
DCloud_iOS_WZT 已提交
123
	 *            "unixVer": "4.11"
124 125 126 127
	 *   	  }
	 *    }
	 * }
	 * @uniVersion 3.7.7
128 129
	 * @uniVueVersion 2,3  //支持的vue版本
	 * @autotest { expectCallback: true }
130
	 */
lizhongyi_'s avatar
lizhongyi_ 已提交
131
	offUserCaptureScreen(callback : UserCaptureScreenCallback | null) : void,
132
	/**
DCloud_iOS_WZT's avatar
DCloud_iOS_WZT 已提交
133 134 135
	 * 设置防截屏
	 *
	 * @param {SetUserCaptureScreenOptions} options
136 137
	 * @tutorial https://uniapp.dcloud.net.cn/api/system/capture-screen.html#setusercapturescreen
	 * @uniPlatform {
lizhongyi_'s avatar
lizhongyi_ 已提交
138
	 *    "app": {
139 140 141 142 143 144 145 146
	 *        "android": {
	 *            "osVer": "4.4.4",
	 *            "uniVer": "3.7.7",
	 *            "unixVer": "3.9.0"
	 *        },
	 *        "ios": {
	 *            "osVer": "13.0",
	 *            "uniVer": "3.7.7",
DCloud_iOS_WZT's avatar
DCloud_iOS_WZT 已提交
147
	 *            "unixVer": "4.11"
148 149 150 151 152 153
	 *   	  }
	 *    }
	 * }
	 * @uniVersion 3.7.7
	 * @uniVueVersion 2,3  //支持的vue版本
	 */
lizhongyi_'s avatar
lizhongyi_ 已提交
154
	setUserCaptureScreen(options : SetUserCaptureScreenOptions) : void
DCloud_iOS_WZT's avatar
DCloud_iOS_WZT 已提交
155
}