interface.uts 1.8 KB
Newer Older
taohebin@dcloud.io's avatar
taohebin@dcloud.io 已提交
1
export interface Uni {
taohebin@dcloud.io's avatar
taohebin@dcloud.io 已提交
2 3 4 5 6 7 8 9 10
	/**
	  * installApk()
	  * @description 
	  * 安装apk
	  * @param {InstallApkOptions} 
	  * @return {void} 
	  * @uniPlatform {
	  *    "app": {
	  *        "android": {
DCloud-yyl's avatar
DCloud-yyl 已提交
11
	  *            "osVer": "5.0",
taohebin@dcloud.io's avatar
taohebin@dcloud.io 已提交
12 13 14 15 16 17 18 19
	  *  		  	 "uniVer": "3.94+",
	  * 			 "unixVer": "3.94+"
	  *        },
	  *        "ios": {
	  *            "osVer": "x",
	  *  		  	 "uniVer": "x",
	  * 			 "unixVer": "x"
	  *        }
DCloud-yyl's avatar
DCloud-yyl 已提交
20 21 22 23 24
	  *    },
	  *  "web": {
      *    "uniVer": "x",
      *    "unixVer": "x"
      *  }
taohebin@dcloud.io's avatar
taohebin@dcloud.io 已提交
25 26 27 28 29 30 31 32 33 34
	  * }
	  * @example
	   ```typescript
		uni.installApk({
			filePath: "/xx/xx/xx.apk",
			complete: (res: any) => {
			  console.log("complete => " + JSON.stringify(res));
			}
		});
	   ```
taohebin@dcloud.io's avatar
taohebin@dcloud.io 已提交
35 36 37 38 39 40 41
	  */
	installApk(options : InstallApkOptions) : void
}
export type InstallApkSuccess = {
	/**
	 * 安装成功消息
	 */
42
	errMsg : string
taohebin@dcloud.io's avatar
taohebin@dcloud.io 已提交
43 44 45
}
export type InstallApkComplete = any
export type InstallApkSuccessCallback = (res : InstallApkSuccess) => void
taohebin@dcloud.io's avatar
taohebin@dcloud.io 已提交
46 47 48 49 50 51 52 53 54 55 56 57
/**
 * 错误码
 * - 1300002 找不到文件
 */
export type InstallApkErrorCode = 1300002
/**
 * 网络请求失败的错误回调参数
 */
export interface InstallApkFail extends IUniError {
	errCode : InstallApkErrorCode
};
export type InstallApkFailCallback = (err : InstallApkFail) => void
taohebin@dcloud.io's avatar
taohebin@dcloud.io 已提交
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80
export type InstallApkCompleteCallback = (res : InstallApkComplete) => void

export type InstallApkOptions = {
	/**
	 * apk文件地址
	 */
	filePath : string,
	/**
	 * 接口调用成功的回调函数
	 * @defaultValue null
	 */
	success ?: InstallApkSuccessCallback | null,
	/**
	 * 接口调用失败的回调函数
	 * @defaultValue null
	 */
	fail ?: InstallApkFailCallback | null,
	/**
	 * 接口调用结束的回调函数(调用成功、失败都会执行)
	 * @defaultValue null
	 */
	complete ?: InstallApkCompleteCallback | null
}