Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
uni-api
提交
5558eb58
U
uni-api
项目概览
DCloud
/
uni-api
通知
670
Star
23
Fork
12
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
3
列表
看板
标记
里程碑
合并请求
1
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
U
uni-api
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
3
Issue
3
列表
看板
标记
里程碑
合并请求
1
合并请求
1
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
5558eb58
编写于
11月 09, 2023
作者:
lizhongyi_
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'dev' of
https://gitcode.net/dcloud/uni-api
into dev
上级
5169abcb
f88c1223
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
263 addition
and
14 deletion
+263
-14
manifest.json
manifest.json
+1
-1
uni_modules/uni-exit/utssdk/app-android/index.uts
uni_modules/uni-exit/utssdk/app-android/index.uts
+1
-1
uni_modules/uni-exit/utssdk/app-ios/index.uts
uni_modules/uni-exit/utssdk/app-ios/index.uts
+3
-3
uni_modules/uni-exit/utssdk/interface.uts
uni_modules/uni-exit/utssdk/interface.uts
+16
-1
uni_modules/uni-exit/utssdk/unierror.uts
uni_modules/uni-exit/utssdk/unierror.uts
+17
-0
uni_modules/uni-installApk/utssdk/index.d.ts
uni_modules/uni-installApk/utssdk/index.d.ts
+78
-0
uni_modules/uni-usercapturescreen/index.d.ts
uni_modules/uni-usercapturescreen/index.d.ts
+147
-8
未找到文件。
manifest.json
浏览文件 @
5558eb58
{
{
"name"
:
"uni-api"
,
"name"
:
"uni-api"
,
"appid"
:
"__UNI__
ED9218B
"
,
"appid"
:
"__UNI__
8BF79AC
"
,
"description"
:
"uts插件示例"
,
"description"
:
"uts插件示例"
,
"versionName"
:
"1.0.0"
,
"versionName"
:
"1.0.0"
,
"versionCode"
:
"100"
,
"versionCode"
:
"100"
,
...
...
uni_modules/uni-exit/utssdk/app-android/index.uts
浏览文件 @
5558eb58
import { ExitOptions, ExitSuccess, Exit
CompleteCallback, Exit
} from "../interface.uts"
import { ExitOptions, ExitSuccess, Exit } from "../interface.uts"
/**
/**
...
...
uni_modules/uni-exit/utssdk/app-ios/index.uts
浏览文件 @
5558eb58
import { ExitOptions, Exit
FailCallback, ExitCompleteCallback, Exit
} from "../interface.uts"
import { ExitOptions, Exit} from "../interface.uts"
import {
UniErrorSubject, UniErrors
} from "../unierror.uts"
import {
ExitFailImpl
} from "../unierror.uts"
/**
/**
...
@@ -7,7 +7,7 @@ import { UniErrorSubject, UniErrors } from "../unierror.uts"
...
@@ -7,7 +7,7 @@ import { UniErrorSubject, UniErrors } from "../unierror.uts"
* iOS平台不支持,触发错误回调
* iOS平台不支持,触发错误回调
*/
*/
export const exit : Exit = function (options: ExitOptions | null) {
export const exit : Exit = function (options: ExitOptions | null) {
let err = new
UniError(UniErrorSubject, 12001, UniErrors.get(12001)!
);
let err = new
ExitFailImpl(12001
);
options?.fail?.(err)
options?.fail?.(err)
options?.complete?.(err)
options?.complete?.(err)
}
}
uni_modules/uni-exit/utssdk/interface.uts
浏览文件 @
5558eb58
...
@@ -5,6 +5,21 @@ export type ExitSuccess = {
...
@@ -5,6 +5,21 @@ export type ExitSuccess = {
errMsg: string
errMsg: string
}
}
/**
* 错误码
* - 12001: 系统不支持
* - 12002: 未知错误
*/
export type ExitErrorCode = 12001 | 12002
/**
* uni.exit失败回调参数
*/
export interface IExitError extends IUniError {
errCode: ExitErrorCode
}
export type ExitFail = IExitError
/**
/**
* uni.exit成功回调函数定义
* uni.exit成功回调函数定义
*/
*/
...
@@ -12,7 +27,7 @@ export type ExitSuccessCallback = (res: ExitSuccess) => void
...
@@ -12,7 +27,7 @@ export type ExitSuccessCallback = (res: ExitSuccess) => void
/**
/**
* uni.exit失败回调函数定义
* uni.exit失败回调函数定义
*/
*/
export type ExitFailCallback = (res:
UniError
) => void
export type ExitFailCallback = (res:
ExitFail
) => void
/**
/**
* uni.exit完成回调函数定义
* uni.exit完成回调函数定义
*/
*/
...
...
uni_modules/uni-exit/utssdk/unierror.uts
浏览文件 @
5558eb58
import { ExitErrorCode, IExitError } from "./interface.uts"
/**
/**
* 错误主题
* 错误主题
*/
*/
...
@@ -18,3 +20,18 @@ export const UniErrors:Map<number, string> = new Map([
...
@@ -18,3 +20,18 @@ export const UniErrors:Map<number, string> = new Map([
*/
*/
[12002, 'unknown error']
[12002, 'unknown error']
]);
]);
/**
* ExitFail的实现
*/
export class ExitFailImpl extends UniError implements IExitError {
override errCode: ExitErrorCode
constructor (
errCode: ExitErrorCode
) {
super()
this.errSubject = UniErrorSubject
this.errCode = errCode
this.errMsg = UniErrors[errCode] ?? "";
}
}
uni_modules/uni-installApk/utssdk/index.d.ts
0 → 100644
浏览文件 @
5558eb58
declare
namespace
UniNamespace
{
interface
InstallApkSuccess
{
/**
* 安装成功消息
*/
errMsg
:
string
}
type
InstallApkErrorCode
=
1300002
interface
InstallApkFail
{
errCode
:
InstallApkErrorCode
}
type
InstallApkComplete
=
any
type
InstallApkSuccessCallback
=
(
res
:
InstallApkSuccess
)
=>
void
type
InstallApkFailCallback
=
(
err
:
InstallApkFail
)
=>
void
type
InstallApkCompleteCallback
=
(
res
:
InstallApkComplete
)
=>
void
interface
InstallApkOptions
{
/**
* apk文件地址
*/
filePath
:
string
,
/**
* 接口调用成功的回调函数
* @defaultValue null
*/
success
?:
InstallApkSuccessCallback
|
null
,
/**
* 接口调用失败的回调函数
* @defaultValue null
*/
fail
?:
InstallApkFailCallback
|
null
,
/**
* 接口调用结束的回调函数(调用成功、失败都会执行)
* @defaultValue null
*/
complete
?:
InstallApkCompleteCallback
|
null
}
}
declare
interface
Uni
{
/**
* installApk()
* @description
* 安装apk
* @param {InstallApkOptions}
* @return {void}
* @uniPlatform {
* "app": {
* "android": {
* "osVer": "4.4",
* "uniVer": "3.94+",
* "unixVer": "3.94+"
* },
* "ios": {
* "osVer": "x",
* "uniVer": "x",
* "unixVer": "x"
* }
* }
* }
* @example
```typescript
uni.installApk({
filePath: "/xx/xx/xx.apk",
complete: (res: any) => {
console.log("complete => " + JSON.stringify(res));
}
});
```
*/
installApk
(
options
:
UniNamespace
.
InstallApkOptions
)
:
void
}
uni_modules/uni-usercapturescreen/index.d.ts
浏览文件 @
5558eb58
declare
namespace
UniNamespace
{
declare
namespace
UniNamespace
{
type
OnUserCaptureScreenCallback
=
(
res
?:
{
errMsg
:
string
})
=>
void
/**
* uni.onUserCaptureScreen/uni.offUserCaptureScreen回调参数
*/
type
OnUserCaptureScreenCallbackResult
=
{
/**
* 截屏文件路径(仅Android返回)
*/
path
?:
string
}
/**
* uni.onUserCaptureScreen/uni.offUserCaptureScreen回调函数定义
*/
type
UserCaptureScreenCallback
=
(
res
:
OnUserCaptureScreenCallbackResult
)
=>
void
type
OnUserCaptureScreen
=
(
callback
:
UserCaptureScreenCallback
|
null
)
=>
void
type
OffUserCaptureScreen
=
(
callback
:
UserCaptureScreenCallback
|
null
)
=>
void
/**
* uni.setUserCaptureScreen成功回调参数
*/
type
SetUserCaptureScreenSuccess
=
{
}
/**
* uni.setUserCaptureScreen成功回调函数定义
*/
type
SetUserCaptureScreenSuccessCallback
=
(
res
:
SetUserCaptureScreenSuccess
)
=>
void
/**
* 错误码
* - 12001 "setUserCaptureScreen:system not support"
* - 12010 "setUserCaptureScreen:system internal error"
*/
type
SetUserCaptureScreenErrorCode
=
12001
|
12010
;
/**
* SetUserCaptureScreen 的错误回调参数
*/
interface
SetUserCaptureScreenFail
{
errCode
:
SetUserCaptureScreenErrorCode
}
/**
* uni.setUserCaptureScreen失败回调函数定义
*/
type
SetUserCaptureScreenFailCallback
=
(
res
:
SetUserCaptureScreenFail
)
=>
void
/**
* uni.setUserCaptureScreen完成回调函数定义
*/
type
SetUserCaptureScreenCompleteCallback
=
(
res
:
any
)
=>
void
/**
* uni.setUserCaptureScreen参数
*/
type
SetUserCaptureScreenOptions
=
{
/**
* true: 允许用户截屏 false: 不允许用户截屏,防止用户截屏到应用页面内容
*/
enable
:
boolean
;
/**
* 接口调用成功的回调函数
*/
// success : SetUserCaptureScreenSuccessCallback | null,
success
?:
SetUserCaptureScreenSuccessCallback
,
/**
* 接口调用失败的回调函数
*/
// fail : SetUserCaptureScreenFailCallback | null,
fail
?:
SetUserCaptureScreenFailCallback
,
/**
* 接口调用结束的回调函数(调用成功、失败都会执行)
*/
// complete : SetUserCaptureScreenSuccessCallback | SetUserCaptureScreenFailCallback | null
complete
?:
SetUserCaptureScreenCompleteCallback
}
type
SetUserCaptureScreen
=
(
options
:
SetUserCaptureScreenOptions
)
=>
void
}
}
declare
interface
Uni
{
declare
interface
Uni
{
/**
/**
*
监听用户主动截屏事件,用户使用系统截屏按键截屏时触发此事件。
*
开启截屏监听
*
*
* 文档: [https://uniapp.dcloud.net.cn/api/system/capture-screen.html#onusercapturescreen](https://uniapp.dcloud.net.cn/api/system/capture-screen.html#onusercapturescreen)
* @param {UserCaptureScreenCallback} callback
* @tutorial https://uniapp.dcloud.net.cn/api/system/capture-screen.html#onusercapturescreen
* @uniPlatform {
* "app": {
* "android": {
* "osVer": "4.4.4",
* "uniVer": "3.7.7",
* "unixVer": "3.9.0"
* },
* "ios": {
* "osVer": "9.0",
* "uniVer": "3.7.7",
* "unixVer": "3.9.0"
* }
* }
* }
* @uniVersion 3.7.7
* @uniVueVersion 2,3 //支持的vue版本
* @autotest { expectCallback: true }
*/
*/
onUserCaptureScreen
(
callback
:
UniNamespace
.
OnUserCaptureScreenCallback
):
void
;
onUserCaptureScreen
(
callback
:
UniNamespace
.
UserCaptureScreenCallback
|
null
)
:
void
,
/**
/**
*
用户主动截屏事件。取消事件监听。
*
关闭截屏监听
*
*
* 文档: [https://uniapp.dcloud.net.cn/api/system/capture-screen.html#offusercapturescreen](https://uniapp.dcloud.net.cn/api/system/capture-screen.html#offusercapturescreen)
* @param {UserCaptureScreenCallback} callback
* @tutorial https://uniapp.dcloud.net.cn/api/system/capture-screen.html#offusercapturescreen
* @uniPlatform {
* "app": {
* "android": {
* "osVer": "4.4.4",
* "uniVer": "3.7.7",
* "unixVer": "3.9.0"
* },
* "ios": {
* "osVer": "9.0",
* "uniVer": "3.7.7",
* "unixVer": "3.9.0"
* }
* }
* }
* @uniVersion 3.7.7
* @uniVueVersion 2,3 //支持的vue版本
* @autotest { expectCallback: true }
*/
*/
offUserCaptureScreen
(
callback
:
UniNamespace
.
OnUserCaptureScreenCallback
):
void
;
offUserCaptureScreen
(
callback
:
UniNamespace
.
UserCaptureScreenCallback
|
null
)
:
void
,
}
/**
* 设置防截屏
*
* @param {SetUserCaptureScreenOptions} options
* @tutorial https://uniapp.dcloud.net.cn/api/system/capture-screen.html#setusercapturescreen
* @uniPlatform {
* "app": {
* "android": {
* "osVer": "4.4.4",
* "uniVer": "3.7.7",
* "unixVer": "3.9.0"
* },
* "ios": {
* "osVer": "13.0",
* "uniVer": "3.7.7",
* "unixVer": "3.9.0"
* }
* }
* }
* @uniVersion 3.7.7
* @uniVueVersion 2,3 //支持的vue版本
*/
setUserCaptureScreen
(
options
:
UniNamespace
.
SetUserCaptureScreenOptions
)
:
void
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录