Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
uni-api
提交
911735e0
U
uni-api
项目概览
DCloud
/
uni-api
通知
689
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看板
提交
911735e0
编写于
10月 08, 2024
作者:
DCloud-yyl
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
同步代码@HBuilderX4.29
上级
328b51ff
变更
71
隐藏空白更改
内联
并排
Showing
71 changed file
with
3892 addition
and
66 deletion
+3892
-66
uni_modules/uni-addPhoneContact/changelog.md
uni_modules/uni-addPhoneContact/changelog.md
+0
-0
uni_modules/uni-addPhoneContact/package.json
uni_modules/uni-addPhoneContact/package.json
+94
-0
uni_modules/uni-addPhoneContact/readme.md
uni_modules/uni-addPhoneContact/readme.md
+7
-0
uni_modules/uni-addPhoneContact/utssdk/app-harmony/index.uts
uni_modules/uni-addPhoneContact/utssdk/app-harmony/index.uts
+125
-0
uni_modules/uni-addPhoneContact/utssdk/interface.uts
uni_modules/uni-addPhoneContact/utssdk/interface.uts
+231
-0
uni_modules/uni-addPhoneContact/utssdk/protocol.uts
uni_modules/uni-addPhoneContact/utssdk/protocol.uts
+50
-0
uni_modules/uni-arrayBufferToBase64/changelog.md
uni_modules/uni-arrayBufferToBase64/changelog.md
+0
-0
uni_modules/uni-arrayBufferToBase64/package.json
uni_modules/uni-arrayBufferToBase64/package.json
+94
-0
uni_modules/uni-arrayBufferToBase64/readme.md
uni_modules/uni-arrayBufferToBase64/readme.md
+7
-0
uni_modules/uni-arrayBufferToBase64/utssdk/app-harmony/index.uts
...ules/uni-arrayBufferToBase64/utssdk/app-harmony/index.uts
+11
-0
uni_modules/uni-arrayBufferToBase64/utssdk/interface.uts
uni_modules/uni-arrayBufferToBase64/utssdk/interface.uts
+77
-0
uni_modules/uni-arrayBufferToBase64/utssdk/protocol.uts
uni_modules/uni-arrayBufferToBase64/utssdk/protocol.uts
+10
-0
uni_modules/uni-authentication/changelog.md
uni_modules/uni-authentication/changelog.md
+0
-0
uni_modules/uni-authentication/package.json
uni_modules/uni-authentication/package.json
+112
-0
uni_modules/uni-authentication/readme.md
uni_modules/uni-authentication/readme.md
+7
-0
uni_modules/uni-authentication/utssdk/app-harmony/index.uts
uni_modules/uni-authentication/utssdk/app-harmony/index.uts
+243
-0
uni_modules/uni-authentication/utssdk/interface.uts
uni_modules/uni-authentication/utssdk/interface.uts
+171
-0
uni_modules/uni-authentication/utssdk/protocol.uts
uni_modules/uni-authentication/utssdk/protocol.uts
+60
-0
uni_modules/uni-base64ToArrayBuffer/changelog.md
uni_modules/uni-base64ToArrayBuffer/changelog.md
+0
-0
uni_modules/uni-base64ToArrayBuffer/package.json
uni_modules/uni-base64ToArrayBuffer/package.json
+94
-0
uni_modules/uni-base64ToArrayBuffer/readme.md
uni_modules/uni-base64ToArrayBuffer/readme.md
+7
-0
uni_modules/uni-base64ToArrayBuffer/utssdk/app-harmony/index.uts
...ules/uni-base64ToArrayBuffer/utssdk/app-harmony/index.uts
+11
-0
uni_modules/uni-base64ToArrayBuffer/utssdk/interface.uts
uni_modules/uni-base64ToArrayBuffer/utssdk/interface.uts
+77
-0
uni_modules/uni-base64ToArrayBuffer/utssdk/protocol.uts
uni_modules/uni-base64ToArrayBuffer/utssdk/protocol.uts
+11
-0
uni_modules/uni-clipboard/changelog.md
uni_modules/uni-clipboard/changelog.md
+0
-0
uni_modules/uni-clipboard/package.json
uni_modules/uni-clipboard/package.json
+103
-0
uni_modules/uni-clipboard/readme.md
uni_modules/uni-clipboard/readme.md
+7
-0
uni_modules/uni-clipboard/utssdk/app-harmony/index.uts
uni_modules/uni-clipboard/utssdk/app-harmony/index.uts
+35
-0
uni_modules/uni-clipboard/utssdk/interface.uts
uni_modules/uni-clipboard/utssdk/interface.uts
+203
-0
uni_modules/uni-clipboard/utssdk/protocol.uts
uni_modules/uni-clipboard/utssdk/protocol.uts
+26
-0
uni_modules/uni-createIntersectionObserver/changelog.md
uni_modules/uni-createIntersectionObserver/changelog.md
+0
-0
uni_modules/uni-createIntersectionObserver/package.json
uni_modules/uni-createIntersectionObserver/package.json
+93
-0
uni_modules/uni-createIntersectionObserver/readme.md
uni_modules/uni-createIntersectionObserver/readme.md
+6
-0
uni_modules/uni-createIntersectionObserver/utssdk/app-harmony/index.uts
...i-createIntersectionObserver/utssdk/app-harmony/index.uts
+134
-0
uni_modules/uni-createIntersectionObserver/utssdk/interface.uts
...dules/uni-createIntersectionObserver/utssdk/interface.uts
+152
-0
uni_modules/uni-file/changelog.md
uni_modules/uni-file/changelog.md
+0
-0
uni_modules/uni-file/package.json
uni_modules/uni-file/package.json
+130
-0
uni_modules/uni-file/readme.md
uni_modules/uni-file/readme.md
+6
-0
uni_modules/uni-file/utssdk/app-harmony/index.uts
uni_modules/uni-file/utssdk/app-harmony/index.uts
+221
-0
uni_modules/uni-file/utssdk/interface.uts
uni_modules/uni-file/utssdk/interface.uts
+174
-0
uni_modules/uni-file/utssdk/protocol.uts
uni_modules/uni-file/utssdk/protocol.uts
+52
-0
uni_modules/uni-getLocation-tencent/utssdk/app-ios/info.plist
...modules/uni-getLocation-tencent/utssdk/app-ios/info.plist
+0
-7
uni_modules/uni-getSystemInfo/utssdk/interface.uts
uni_modules/uni-getSystemInfo/utssdk/interface.uts
+1
-1
uni_modules/uni-keyboard/changelog.md
uni_modules/uni-keyboard/changelog.md
+0
-0
uni_modules/uni-keyboard/package.json
uni_modules/uni-keyboard/package.json
+94
-0
uni_modules/uni-keyboard/readme.md
uni_modules/uni-keyboard/readme.md
+6
-0
uni_modules/uni-keyboard/utssdk/app-harmony/index.uts
uni_modules/uni-keyboard/utssdk/app-harmony/index.uts
+28
-0
uni_modules/uni-keyboard/utssdk/interface.uts
uni_modules/uni-keyboard/utssdk/interface.uts
+60
-0
uni_modules/uni-keyboard/utssdk/protocol.uts
uni_modules/uni-keyboard/utssdk/protocol.uts
+1
-0
uni_modules/uni-makePhoneCall/changelog.md
uni_modules/uni-makePhoneCall/changelog.md
+0
-0
uni_modules/uni-makePhoneCall/package.json
uni_modules/uni-makePhoneCall/package.json
+94
-0
uni_modules/uni-makePhoneCall/readme.md
uni_modules/uni-makePhoneCall/readme.md
+7
-0
uni_modules/uni-makePhoneCall/utssdk/app-harmony/index.uts
uni_modules/uni-makePhoneCall/utssdk/app-harmony/index.uts
+54
-0
uni_modules/uni-makePhoneCall/utssdk/interface.uts
uni_modules/uni-makePhoneCall/utssdk/interface.uts
+100
-0
uni_modules/uni-makePhoneCall/utssdk/protocol.uts
uni_modules/uni-makePhoneCall/utssdk/protocol.uts
+11
-0
uni_modules/uni-media/utssdk/app-android/index.uts
uni_modules/uni-media/utssdk/app-android/index.uts
+7
-53
uni_modules/uni-media/utssdk/app-android/utils/MediaUtils.uts
...modules/uni-media/utssdk/app-android/utils/MediaUtils.uts
+64
-1
uni_modules/uni-media/utssdk/app-ios/index.uts
uni_modules/uni-media/utssdk/app-ios/index.uts
+9
-3
uni_modules/uni-media/utssdk/interface.uts
uni_modules/uni-media/utssdk/interface.uts
+24
-1
uni_modules/uni-openDocument/changelog.md
uni_modules/uni-openDocument/changelog.md
+0
-0
uni_modules/uni-openDocument/package.json
uni_modules/uni-openDocument/package.json
+94
-0
uni_modules/uni-openDocument/readme.md
uni_modules/uni-openDocument/readme.md
+6
-0
uni_modules/uni-openDocument/utssdk/app-harmony/index.uts
uni_modules/uni-openDocument/utssdk/app-harmony/index.uts
+69
-0
uni_modules/uni-openDocument/utssdk/interface.uts
uni_modules/uni-openDocument/utssdk/interface.uts
+70
-0
uni_modules/uni-openDocument/utssdk/protocol.uts
uni_modules/uni-openDocument/utssdk/protocol.uts
+1
-0
uni_modules/uni-scanCode/changelog.md
uni_modules/uni-scanCode/changelog.md
+0
-0
uni_modules/uni-scanCode/package.json
uni_modules/uni-scanCode/package.json
+94
-0
uni_modules/uni-scanCode/readme.md
uni_modules/uni-scanCode/readme.md
+6
-0
uni_modules/uni-scanCode/utssdk/app-harmony/index.uts
uni_modules/uni-scanCode/utssdk/app-harmony/index.uts
+77
-0
uni_modules/uni-scanCode/utssdk/interface.uts
uni_modules/uni-scanCode/utssdk/interface.uts
+73
-0
uni_modules/uni-scanCode/utssdk/protocol.uts
uni_modules/uni-scanCode/utssdk/protocol.uts
+1
-0
未找到文件。
uni_modules/uni-addPhoneContact/changelog.md
0 → 100644
浏览文件 @
911735e0
uni_modules/uni-addPhoneContact/package.json
0 → 100644
浏览文件 @
911735e0
{
"id"
:
"uni-addPhoneContact"
,
"displayName"
:
"uni-addPhoneContact"
,
"version"
:
"1.0.0"
,
"description"
:
"uni-addPhoneContact"
,
"keywords"
:
[
"uni-addPhoneContact"
],
"repository"
:
""
,
"engines"
:
{
"HBuilderX"
:
"^3.6.8"
},
"dcloudext"
:
{
"type"
:
"uts"
,
"sale"
:
{
"regular"
:
{
"price"
:
"0.00"
},
"sourcecode"
:
{
"price"
:
"0.00"
}
},
"contact"
:
{
"qq"
:
""
},
"declaration"
:
{
"ads"
:
""
,
"data"
:
""
,
"permissions"
:
""
},
"npmurl"
:
""
},
"uni_modules"
:
{
"dependencies"
:
[],
"uni-ext-api"
:
{
"uni"
:
{
"addPhoneContact"
:
{
"name"
:
"addPhoneContact"
,
"app"
:
{
"js"
:
false
,
"kotlin"
:
false
,
"swift"
:
false
,
"arkts"
:
true
}
}
}
},
"encrypt"
:
[],
"platforms"
:
{
"cloud"
:
{
"tcb"
:
"u"
,
"aliyun"
:
"u"
},
"client"
:
{
"Vue"
:
{
"vue2"
:
"u"
,
"vue3"
:
"u"
},
"App"
:
{
"app-android"
:
"u"
,
"app-ios"
:
"u"
},
"H5-mobile"
:
{
"Safari"
:
"u"
,
"Android Browser"
:
"u"
,
"微信浏览器(Android)"
:
"u"
,
"QQ浏览器(Android)"
:
"u"
},
"H5-pc"
:
{
"Chrome"
:
"u"
,
"IE"
:
"u"
,
"Edge"
:
"u"
,
"Firefox"
:
"u"
,
"Safari"
:
"u"
},
"小程序"
:
{
"微信"
:
"u"
,
"阿里"
:
"u"
,
"百度"
:
"u"
,
"字节跳动"
:
"u"
,
"QQ"
:
"u"
,
"钉钉"
:
"u"
,
"快手"
:
"u"
,
"飞书"
:
"u"
,
"京东"
:
"u"
},
"快应用"
:
{
"华为"
:
"u"
,
"联盟"
:
"u"
}
}
}
}
}
uni_modules/uni-addPhoneContact/readme.md
0 → 100644
浏览文件 @
911735e0
# uni-addPhoneContact
### 开发文档
[
UTS 语法
](
https://uniapp.dcloud.net.cn/tutorial/syntax-uts.html
)
[
UTS 原生插件
](
https://uniapp.dcloud.net.cn/plugin/uts-plugin.html
)
[
Hello UTS
](
https://gitcode.net/dcloud/hello-uts/-/tree/dev
)
uni_modules/uni-addPhoneContact/utssdk/app-harmony/index.uts
0 → 100644
浏览文件 @
911735e0
import { AddPhoneContact, AddPhoneContactOptions, AddPhoneContactSuccess } from '../interface.uts';
import { API_ADD_PHONE_CONTACT, AddPhoneContactApiOptions, AddPhoneContactApiProtocol } from '../protocol.uts';
import { contact } from '@kit.ContactsKit';
import { BusinessError } from '@kit.BasicServicesKit';
import { UTSHarmony } from '@dcloudio/uni-runtime';
export const addPhoneContact: AddPhoneContact = defineAsyncApi<AddPhoneContactOptions, AddPhoneContactSuccess>(
API_ADD_PHONE_CONTACT,
(args: AddPhoneContactOptions, executor: ApiExecutor<AddPhoneContactSuccess>) => {
UTSHarmony.requestSystemPermission(['ohos.permission.WRITE_CONTACTS'], (allRight: boolean) => {
if (allRight) {
const {
photoFilePath,
nickName = '',
lastName = '',
middleName = '',
firstName = '',
remark = '',
mobilePhoneNumber = '',
weChatNumber,
addressCountry = '',
addressState = '',
addressCity = '',
addressStreet = '',
addressPostalCode = '',
organization = '',
url = '',
workPhoneNumber = '',
workFaxNumber = '',
hostNumber = '',
email = '',
title = '',
workAddressCountry = '',
workAddressState = '',
workAddressCity = '',
workAddressStreet = '',
workAddressPostalCode,
homeFaxNumber = '',
homePhoneNumber = '',
homeAddressCountry = '',
homeAddressState = '',
homeAddressCity = '',
homeAddressStreet = '',
homeAddressPostalCode = ''
} = args
const contactInfo: contact.Contact = {
name: {
familyName: lastName!,
middleName: middleName!,
givenName: firstName!,
fullName: lastName! + middleName! + firstName!
},
nickName: {
nickName: nickName!
},
emails: [{
email: email!,
displayName: '邮箱'
}],
phoneNumbers: [{
phoneNumber: homePhoneNumber!,
labelId: contact.PhoneNumber.NUM_HOME
}, {
phoneNumber: mobilePhoneNumber!,
labelId: contact.PhoneNumber.NUM_MOBILE
}, {
phoneNumber: homeFaxNumber!,
labelId: contact.PhoneNumber.NUM_FAX_HOME
}, {
phoneNumber: workFaxNumber!,
labelId: contact.PhoneNumber.NUM_FAX_WORK
}, {
phoneNumber: workPhoneNumber!,
labelId: contact.PhoneNumber.NUM_WORK
}, {
phoneNumber: hostNumber!,
labelId: contact.PhoneNumber.NUM_COMPANY_MAIN
}],
portrait: { uri: photoFilePath! },
postalAddresses: [{
city: homeAddressCity!,
country: homeAddressCountry!,
postcode: homeAddressPostalCode!,
street: homeAddressStreet!,
postalAddress: homeAddressCountry! + homeAddressState! + homeAddressCity + homeAddressStreet,
labelId: contact.PostalAddress.ADDR_HOME
}, {
city: workAddressCity!,
country: workAddressCountry!,
postcode: workAddressPostalCode!,
street: workAddressStreet!,
postalAddress: workAddressCountry! + workAddressState! + workAddressCity + workAddressStreet,
labelId: contact.PostalAddress.ADDR_WORK
}, {
city: addressCity!,
country: addressCountry!,
postcode: addressPostalCode!,
street: addressStreet!,
postalAddress: addressCountry! + addressState! + addressCity + addressStreet,
labelId: contact.PostalAddress.CUSTOM_LABEL
}],
websites: [{ website: url! }],
note: { noteContent: remark! },
organization: {
name: organization!,
title: title!
}
}
contact.addContact(getContext(), contactInfo)
.then((contactId) => {
executor.resolve(contactId)
})
.catch((err: BusinessError) => {
executor.reject(err.message)
})
} else {
executor.reject('Permission denied')
}
}, () => executor.reject('Permission denied'))
},
AddPhoneContactApiProtocol,
AddPhoneContactApiOptions
) as AddPhoneContact
uni_modules/uni-addPhoneContact/utssdk/interface.uts
0 → 100644
浏览文件 @
911735e0
export interface Uni {
/**
* 手机通讯录联系人和联系方式的增加
* @tutorial https://uniapp.dcloud.net.cn/api/system/contact.html
* @tutorial-uni-app https://uniapp.dcloud.net.cn/api/system/contact.html
*
* @uniPlatform {
* "app": {
* "android": {
* "osVer": "5.0",
* "uniVer": "√",
* "unixVer": "x"
* },
* "ios": {
* "osVer": "12.0",
* "uniVer": "√",
* "unixVer": "x"
* },
* "harmony": {
* "osVer": "3.0",
* "uniVer": "4.25",
* "unixVer": "x"
* }
* },
* "web": {
* "uniVer": "x",
* "unixVer": "x"
* }
* "mp":{
* weixin: {
* hostVer: '√',
* uniVer: '√',
* unixVer: 'x'
* },
* alipay: {
* hostVer: '√',
* uniVer: '√',
* unixVer: 'x'
* },
* baidu: {
* hostVer: '√',
* uniVer: '√',
* unixVer: 'x'
* },
* toutiao: {
* hostVer: 'x',
* uniVer: 'x',
* unixVer: 'x'
* },
* lark: {
* hostVer: 'x',
* uniVer: 'x',
* unixVer: 'x'
* },
* qq: {
* hostVer: 'x',
* uniVer: 'x',
* unixVer: 'x'
* },
* kuaishou: {
* hostVer: '√',
* uniVer: '√',
* unixVer: 'x'
* },
* jd: {
* hostVer: 'x',
* uniVer: 'x',
* unixVer: 'x'
* }
* }
* }
*/
addPhoneContact: AddPhoneContact;
}
export type AddPhoneContact = (options: AddPhoneContactOptions) => void;
export type AddPhoneContactSuccess = {};
export type UniError = {
errSubject: string,
errCode: number,
errMsg: string,
data?: object | null,
cause?: any | null
};
export type AddPhoneContactSuccessCallback = (result: AddPhoneContactSuccess) => void;
export type AddPhoneContactFail = UniError;
export type AddPhoneContactFailCallback = (result: AddPhoneContactFail) => void;
export type AddPhoneContactComplete = any;
export type AddPhoneContactCompleteCallback = (result: AddPhoneContactComplete) => void;
export type AddPhoneContactOptions = {
/**
* 头像本地文件路径
*/
photoFilePath?: string | null,
/**
* 昵称
*/
nickName?: string | null,
/**
* 姓氏
*/
lastName?: string | null,
/**
* 中间名
*/
middleName?: string | null,
/**
* 名字
*/
firstName?: string | null,
/**
* 备注
*/
remark?: string | null,
/**
* 手机号
*/
mobilePhoneNumber?: string | null,
/**
* 微信号
*/
weChatNumber?: string | null,
/**
* 联系地址国家
*/
addressCountry?: string | null,
/**
* 联系地址省份
*/
addressState?: string | null,
/**
* 联系地址城市
*/
addressCity?: string | null,
/**
* 联系地址街道
*/
addressStreet?: string | null,
/**
* 联系地址邮政编码
*/
addressPostalCode?: string | null,
/**
* 公司
*/
organization?: string | null,
/**
* 职位
*/
title?: string | null,
/**
* 工作传真
*/
workFaxNumber?: string | null,
/**
* 工作电话
*/
workPhoneNumber?: string | null,
/**
* 公司电话
*/
hostNumber?: string | null,
/**
* 电子邮件
*/
email?: string | null,
/**
* 网站
*/
url?: string | null,
/**
* 工作地址国家
*/
workAddressCountry?: string | null,
/**
* 工作地址省份
*/
workAddressState?: string | null,
/**
* 工作地址城市
*/
workAddressCity?: string | null,
/**
* 工作地址街道
*/
workAddressStreet?: string | null,
/**
* 工作地址邮政编码
*/
workAddressPostalCode?: string | null,
/**
* 住宅传真
*/
homeFaxNumber?: string | null,
/**
* 住宅电话
*/
homePhoneNumber?: string | null,
/**
* 住宅地址国家
*/
homeAddressCountry?: string | null,
/**
* 住宅地址省份
*/
homeAddressState?: string | null,
/**
* 住宅地址城市
*/
homeAddressCity?: string | null,
/**
* 住宅地址街道
*/
homeAddressStreet?: string | null,
/**
* 住宅地址邮政编码
*/
homeAddressPostalCode?: string | null,
/**
* 接口调用成功的回调函数
*/
success?: AddPhoneContactSuccessCallback | null,
/**
* 接口调用失败的回调函数
*/
fail?: AddPhoneContactFailCallback | null,
/**
* 接口调用结束的回调函数(调用成功、失败都会执行)
*/
complete?: AddPhoneContactCompleteCallback | null
};
uni_modules/uni-addPhoneContact/utssdk/protocol.uts
0 → 100644
浏览文件 @
911735e0
import { AddPhoneContactOptions } from './interface.uts';
export const API_ADD_PHONE_CONTACT = 'addPhoneContact'
export const AddPhoneContactApiOptions: ApiOptions<AddPhoneContactOptions> = {
formatArgs: new Map<string, ((firstName: string) => string | undefined)>([
['firstName', function (firstName: string) {
if (!firstName) {
return 'addPhoneContact:fail parameter error: parameter.firstName should not be empty;'
}
return undefined
}]
])
}
export const AddPhoneContactApiProtocol = new Map<string, ProtocolOptions>([
['firstName', { type: 'string', required: true }],
['photoFilePath', { type: 'string' }],
['nickName', { type: 'string' }],
['lastName', { type: 'string' }],
['middleName', { type: 'string' }],
['remark', { type: 'string' }],
['mobilePhoneNumber', { type: 'string' }],
['weChatNumber', { type: 'string' }],
['addressCountry', { type: 'string' }],
['addressState', { type: 'string' }],
['addressCity', { type: 'string' }],
['addressStreet', { type: 'string' }],
['addressPostalCode', { type: 'string' }],
['organization', { type: 'string' }],
['title', { type: 'string' }],
['workFaxNumber', { type: 'string' }],
['workPhoneNumber', { type: 'string' }],
['hostNumber', { type: 'string' }],
['email', { type: 'string' }],
['url', { type: 'string' }],
['workAddressCountry', { type: 'string' }],
['workAddressState', { type: 'string' }],
['workAddressCity', { type: 'string' }],
['workAddressStreet', { type: 'string' }],
['workAddressPostalCode', { type: 'string' }],
['homeFaxNumber', { type: 'string' }],
['homePhoneNumber', { type: 'string' }],
['homeAddressCountry', { type: 'string' }],
['homeAddressState', { type: 'string' }],
['homeAddressCity', { type: 'string' }],
['homeAddressStreet', { type: 'string' }],
['homeAddressPostalCode', { type: 'string' }]
]
);
uni_modules/uni-arrayBufferToBase64/changelog.md
0 → 100644
浏览文件 @
911735e0
uni_modules/uni-arrayBufferToBase64/package.json
0 → 100644
浏览文件 @
911735e0
{
"id"
:
"uni-arrayBufferToBase64"
,
"displayName"
:
"uni-arrayBufferToBase64"
,
"version"
:
"1.0.0"
,
"description"
:
"uni-arrayBufferToBase64"
,
"keywords"
:
[
"uni-arrayBufferToBase64"
],
"repository"
:
""
,
"engines"
:
{
"HBuilderX"
:
"^3.6.8"
},
"dcloudext"
:
{
"type"
:
"uts"
,
"sale"
:
{
"regular"
:
{
"price"
:
"0.00"
},
"sourcecode"
:
{
"price"
:
"0.00"
}
},
"contact"
:
{
"qq"
:
""
},
"declaration"
:
{
"ads"
:
""
,
"data"
:
""
,
"permissions"
:
""
},
"npmurl"
:
""
},
"uni_modules"
:
{
"dependencies"
:
[],
"uni-ext-api"
:
{
"uni"
:
{
"arrayBufferToBase64"
:
{
"name"
:
"arrayBufferToBase64"
,
"app"
:
{
"js"
:
false
,
"kotlin"
:
false
,
"swift"
:
false
,
"arkts"
:
true
}
}
}
},
"encrypt"
:
[],
"platforms"
:
{
"cloud"
:
{
"tcb"
:
"u"
,
"aliyun"
:
"u"
},
"client"
:
{
"Vue"
:
{
"vue2"
:
"u"
,
"vue3"
:
"u"
},
"App"
:
{
"app-android"
:
"u"
,
"app-ios"
:
"u"
},
"H5-mobile"
:
{
"Safari"
:
"u"
,
"Android Browser"
:
"u"
,
"微信浏览器(Android)"
:
"u"
,
"QQ浏览器(Android)"
:
"u"
},
"H5-pc"
:
{
"Chrome"
:
"u"
,
"IE"
:
"u"
,
"Edge"
:
"u"
,
"Firefox"
:
"u"
,
"Safari"
:
"u"
},
"小程序"
:
{
"微信"
:
"u"
,
"阿里"
:
"u"
,
"百度"
:
"u"
,
"字节跳动"
:
"u"
,
"QQ"
:
"u"
,
"钉钉"
:
"u"
,
"快手"
:
"u"
,
"飞书"
:
"u"
,
"京东"
:
"u"
},
"快应用"
:
{
"华为"
:
"u"
,
"联盟"
:
"u"
}
}
}
}
}
uni_modules/uni-arrayBufferToBase64/readme.md
0 → 100644
浏览文件 @
911735e0
# uni-arrayBufferToBase64
### 开发文档
[
UTS 语法
](
https://uniapp.dcloud.net.cn/tutorial/syntax-uts.html
)
[
UTS 原生插件
](
https://uniapp.dcloud.net.cn/plugin/uts-plugin.html
)
[
Hello UTS
](
https://gitcode.net/dcloud/hello-uts/-/tree/dev
)
uni_modules/uni-arrayBufferToBase64/utssdk/app-harmony/index.uts
0 → 100644
浏览文件 @
911735e0
import buffer from '@ohos.buffer';
import { ArrayBufferToBase64 } from '../interface.uts';
import { ArrayBufferToBase64Protocol, API_ARRAY_BUFFER_TO_BASE64 } from '../protocol.uts';
export const arrayBufferToBase64: ArrayBufferToBase64 = defineSyncApi<string>(
API_ARRAY_BUFFER_TO_BASE64,
(arrayBuffer: ArrayBuffer): string => {
return buffer.from(arrayBuffer).toString('base64')
},
ArrayBufferToBase64Protocol
) as ArrayBufferToBase64
uni_modules/uni-arrayBufferToBase64/utssdk/interface.uts
0 → 100644
浏览文件 @
911735e0
export interface Uni {
/**
* 将 ArrayBuffer 对象转成 Base64 字符串
*
* @tutorial https://uniapp.dcloud.net.cn/api/arrayBufferToBase64.html
* @tutorial-uni-app https://uniapp.dcloud.net.cn/api/arrayBufferToBase64.html
*
* @uniPlatform {
* "app": {
* "android": {
* "osVer": "5.0",
* "uniVer": "√",
* "unixVer": "x"
* },
* "ios": {
* "osVer": "5.0",
* "uniVer": "√",
* "unixVer": "x"
* },
* "harmony": {
* "osVer": "3.0",
* "uniVer": "4.23",
* "unixVer": "x"
* }
* },
* "web": {
* "uniVer": "√",
* "unixVer": "4.0"
* },
* "mp":{
* weixin: {
* hostVer: '√',
* uniVer: '√',
* unixVer: 'x'
* },
* alipay: {
* hostVer: '√',
* uniVer: '√',
* unixVer: 'x'
* },
* baidu: {
* hostVer: '√',
* uniVer: '√',
* unixVer: 'x'
* },
* toutiao: {
* hostVer: '√',
* uniVer: '√',
* unixVer: 'x'
* },
* lark: {
* hostVer: '√',
* uniVer: '√',
* unixVer: 'x'
* },
* qq: {
* hostVer: '√',
* uniVer: '√',
* unixVer: 'x'
* },
* kuaishou: {
* hostVer: '√',
* uniVer: '√',
* unixVer: 'x'
* },
* jd: {
* hostVer: '√',
* uniVer: '√',
* unixVer: 'x'
* }
* }
* }
*/
arrayBufferToBase64: ArrayBufferToBase64;
}
export type ArrayBufferToBase64 = (arrayBuffer: ArrayBuffer) => string;
uni_modules/uni-arrayBufferToBase64/utssdk/protocol.uts
0 → 100644
浏览文件 @
911735e0
export const API_ARRAY_BUFFER_TO_BASE64 = 'arrayBufferToBase64'
export const ArrayBufferToBase64Protocol = new Map<string, ProtocolOptions>([
[
'arrayBuffer',
{
type: 'arrayBuffer',
required: true,
}
]
])
uni_modules/uni-authentication/changelog.md
0 → 100644
浏览文件 @
911735e0
uni_modules/uni-authentication/package.json
0 → 100644
浏览文件 @
911735e0
{
"id"
:
"uni-authentication"
,
"displayName"
:
"uni-authentication"
,
"version"
:
"1.0.0"
,
"description"
:
"uni-authentication"
,
"keywords"
:
[
"uni-authentication"
],
"repository"
:
""
,
"engines"
:
{
"HBuilderX"
:
"^3.6.8"
},
"dcloudext"
:
{
"type"
:
"uts"
,
"sale"
:
{
"regular"
:
{
"price"
:
"0.00"
},
"sourcecode"
:
{
"price"
:
"0.00"
}
},
"contact"
:
{
"qq"
:
""
},
"declaration"
:
{
"ads"
:
""
,
"data"
:
""
,
"permissions"
:
""
},
"npmurl"
:
""
},
"uni_modules"
:
{
"dependencies"
:
[],
"uni-ext-api"
:
{
"uni"
:
{
"startSoterAuthentication"
:
{
"name"
:
"startSoterAuthentication"
,
"app"
:
{
"js"
:
false
,
"kotlin"
:
false
,
"swift"
:
false
,
"arkts"
:
true
}
},
"checkIsSupportSoterAuthentication"
:
{
"name"
:
"checkIsSupportSoterAuthentication"
,
"app"
:
{
"js"
:
false
,
"kotlin"
:
false
,
"swift"
:
false
,
"arkts"
:
true
}
},
"checkIsSoterEnrolledInDevice"
:
{
"name"
:
"checkIsSoterEnrolledInDevice"
,
"app"
:
{
"js"
:
false
,
"kotlin"
:
false
,
"swift"
:
false
,
"arkts"
:
true
}
}
}
},
"encrypt"
:
[],
"platforms"
:
{
"cloud"
:
{
"tcb"
:
"u"
,
"aliyun"
:
"u"
},
"client"
:
{
"Vue"
:
{
"vue2"
:
"u"
,
"vue3"
:
"u"
},
"App"
:
{
"app-android"
:
"u"
,
"app-ios"
:
"u"
},
"H5-mobile"
:
{
"Safari"
:
"u"
,
"Android Browser"
:
"u"
,
"微信浏览器(Android)"
:
"u"
,
"QQ浏览器(Android)"
:
"u"
},
"H5-pc"
:
{
"Chrome"
:
"u"
,
"IE"
:
"u"
,
"Edge"
:
"u"
,
"Firefox"
:
"u"
,
"Safari"
:
"u"
},
"小程序"
:
{
"微信"
:
"u"
,
"阿里"
:
"u"
,
"百度"
:
"u"
,
"字节跳动"
:
"u"
,
"QQ"
:
"u"
,
"钉钉"
:
"u"
,
"快手"
:
"u"
,
"飞书"
:
"u"
,
"京东"
:
"u"
},
"快应用"
:
{
"华为"
:
"u"
,
"联盟"
:
"u"
}
}
}
}
}
uni_modules/uni-authentication/readme.md
0 → 100644
浏览文件 @
911735e0
# uni-authentication
### 开发文档
[
UTS 语法
](
https://uniapp.dcloud.net.cn/tutorial/syntax-uts.html
)
[
UTS 原生插件
](
https://uniapp.dcloud.net.cn/plugin/uts-plugin.html
)
[
Hello UTS
](
https://gitcode.net/dcloud/hello-uts/-/tree/dev
)
uni_modules/uni-authentication/utssdk/app-harmony/index.uts
0 → 100644
浏览文件 @
911735e0
import { UTSHarmony } from '@dcloudio/uni-runtime';
import { BusinessError } from '@kit.BasicServicesKit';
import { userAuth } from '@kit.UserAuthenticationKit';
import { promptAction } from '@kit.ArkUI';
import {
StartSoterAuthentication, StartSoterAuthenticationOptions, StartSoterAuthenticationSuccess, SoterAuthMode,
CheckIsSupportSoterAuthentication, CheckIsSupportSoterAuthenticationOptions, CheckIsSupportSoterAuthenticationSuccess,
CheckIsSoterEnrolledInDevice, CheckIsSoterEnrolledInDeviceOptions, CheckIsSoterEnrolledInDeviceSuccess
} from '../interface.uts';
import {
API_START_SOTER_AUTHENTICATION, StartSoterAuthenticationApiOptions, StartSoterAuthenticationApiProtocols,
API_CHECK_IS_SOTER_ENROLLED_IN_DEVICE, CheckIsSoterEnrolledInDeviceApiOptions, CheckIsSoterEnrolledInDeviceProtocols,
API_CHECK_IS_SUPPORT_SOTER_AUTHENTICATION
} from '../protocol.uts';
function getErrorMessage(code: number): string {
switch (code) {
case 201:
return "权限认证失败";
case 401:
return "参数不正确。可能的一个原因: 强制参数未指定";
case userAuth.UserAuthResultCode.FAIL:
return "认证失败";
case userAuth.UserAuthResultCode.GENERAL_ERROR:
return "操作通用错误";
case userAuth.UserAuthResultCode.CANCELED:
return "操作取消";
case userAuth.UserAuthResultCode.TIMEOUT:
return "操作超时";
case userAuth.UserAuthResultCode.TYPE_NOT_SUPPORT:
return "不支持的认证类型";
case userAuth.UserAuthResultCode.TRUST_LEVEL_NOT_SUPPORT:
return "不支持的认证等级";
case userAuth.UserAuthResultCode.BUSY:
return "忙碌状态";
case userAuth.UserAuthResultCode.LOCKED:
return "认证器已锁定";
case userAuth.UserAuthResultCode.NOT_ENROLLED:
return "用户未录入认证信息";
case userAuth.UserAuthResultCode.CANCELED_FROM_WIDGET:
return "切换到自定义身份验证过程";
case 12500013:
return "系统锁屏密码过期";
default:
return '';
}
}
function getUniErrMsg(code: number): number {
switch (code) {
case 201:
return 90002;
case 401:
return 90004;
case userAuth.UserAuthResultCode.FAIL:
return 90009;
case userAuth.UserAuthResultCode.GENERAL_ERROR:
return 90007;
case userAuth.UserAuthResultCode.CANCELED:
return 90008;
case userAuth.UserAuthResultCode.TIMEOUT:
return 90007;
case userAuth.UserAuthResultCode.TYPE_NOT_SUPPORT:
return 90003;
case userAuth.UserAuthResultCode.TRUST_LEVEL_NOT_SUPPORT:
return 90003;
case userAuth.UserAuthResultCode.BUSY:
return 90010;
case userAuth.UserAuthResultCode.LOCKED:
return 90010;
case userAuth.UserAuthResultCode.NOT_ENROLLED:
return 90011;
case userAuth.UserAuthResultCode.CANCELED_FROM_WIDGET:
return userAuth.UserAuthResultCode.CANCELED_FROM_WIDGET;
case 12500013:
return 12500013;
default:
return -1;
}
}
function toUint8Arr(str: string) {
const buffer: number[] = [];
for (let i of str) {
const _code: number = i.charCodeAt(0);
if (_code < 0x80) {
buffer.push(_code);
} else if (_code < 0x800) {
buffer.push(0xc0 + (_code >> 6));
buffer.push(0x80 + (_code & 0x3f));
} else if (_code < 0x10000) {
buffer.push(0xe0 + (_code >> 12));
buffer.push(0x80 + (_code >> 6 & 0x3f));
buffer.push(0x80 + (_code & 0x3f));
}
}
return Uint8Array.from(buffer);
}
export const startSoterAuthentication: StartSoterAuthentication = defineAsyncApi<StartSoterAuthenticationOptions, StartSoterAuthenticationSuccess>(
API_START_SOTER_AUTHENTICATION,
(args: StartSoterAuthenticationOptions, executor: ApiExecutor<StartSoterAuthenticationSuccess>) => {
const authType: userAuth.UserAuthType[] = []
args.requestAuthModes.forEach((item) => {
if (item === 'fingerPrint') {
authType.push(userAuth.UserAuthType.FINGERPRINT)
} else if (item === 'facial') {
authType.push(userAuth.UserAuthType.FACE)
}
})
// uni的字符串challenge转换成鸿蒙的数组challenge
const challengeArr = toUint8Arr(args.challenge ?? '')
const authContent = args.authContent ?? ''
try {
const auth = userAuth.getUserAuthInstance(
{
challenge: challengeArr,
authType,
authTrustLevel: userAuth.AuthTrustLevel.ATL1
} as userAuth.AuthParam,
{
title: authContent
} as userAuth.WidgetParam
);
auth.on("result", {
onResult: (result: userAuth.UserAuthResult) => {
if (result.result === userAuth.UserAuthResultCode.SUCCESS) {
executor.resolve({
errCode: 0,
authMode: result.authType === userAuth.UserAuthType.FINGERPRINT ? 'fingerPrint' : 'facial'
} as StartSoterAuthenticationSuccess);
} else {
const errMsg = getErrorMessage(result.result)
const errCode = getUniErrMsg(result.result)
executor.reject(errMsg, { errCode } as ApiError);
}
}
} as userAuth.IAuthCallback);
if (authContent) {
promptAction.showToast({
message: authContent
} as promptAction.ShowToastOptions)
}
auth.start();
} catch (error) {
const code = (error as BusinessError).code
executor.reject(getErrorMessage(code), { errCode: getUniErrMsg(code) } as ApiError);
}
},
StartSoterAuthenticationApiProtocols,
StartSoterAuthenticationApiOptions
) as StartSoterAuthentication
function fingerPrintAvailable() {
try {
userAuth.getAvailableStatus(userAuth.UserAuthType.FINGERPRINT, userAuth.AuthTrustLevel.ATL1);
return true
} catch (error) {
return false
}
}
function faceAvailable() {
try {
userAuth.getAvailableStatus(userAuth.UserAuthType.FACE, userAuth.AuthTrustLevel.ATL1);
return true
} catch (error) {
return false
}
}
const PERMISSIONS = ['ohos.permission.ACCESS_BIOMETRIC']
export const checkIsSupportSoterAuthentication: CheckIsSupportSoterAuthentication = defineAsyncApi<CheckIsSupportSoterAuthenticationOptions, CheckIsSupportSoterAuthenticationSuccess>(
API_CHECK_IS_SUPPORT_SOTER_AUTHENTICATION,
(args: CheckIsSupportSoterAuthenticationOptions, executor: ApiExecutor<CheckIsSupportSoterAuthenticationSuccess>) => {
UTSHarmony.requestSystemPermission(PERMISSIONS, (allRight: boolean) => {
if (allRight) {
try {
const supportMode: SoterAuthMode[] = []
if (fingerPrintAvailable()) supportMode.push('fingerPrint')
if (faceAvailable()) supportMode.push('facial')
return executor.resolve({ supportMode, errMsg: '' } as CheckIsSupportSoterAuthenticationSuccess)
} catch (error) {
const code = (error as BusinessError).code
executor.reject(getErrorMessage(code), { errCode: getUniErrMsg(code) } as ApiError);
}
} else {
executor.reject(getErrorMessage(201))
}
}, () => {
executor.reject(getErrorMessage(201))
})
}
) as CheckIsSupportSoterAuthentication
function getFingerPrintEnrolledState() {
userAuth.getEnrolledState(userAuth.UserAuthType.FINGERPRINT);
return true
}
function getFaceEnrolledState() {
userAuth.getEnrolledState(userAuth.UserAuthType.FACE);
return true
}
function harmonyCheckIsSoterEnrolledInDevice(checkAuthMode: SoterAuthMode): boolean {
if (checkAuthMode === 'fingerPrint') {
return getFingerPrintEnrolledState()
} else if (checkAuthMode === 'facial') {
return getFaceEnrolledState()
}
return false
}
export const checkIsSoterEnrolledInDevice: CheckIsSoterEnrolledInDevice = defineAsyncApi<CheckIsSoterEnrolledInDeviceOptions, CheckIsSoterEnrolledInDeviceSuccess>(
API_CHECK_IS_SOTER_ENROLLED_IN_DEVICE,
(args: CheckIsSoterEnrolledInDeviceOptions, executor: ApiExecutor<CheckIsSoterEnrolledInDeviceSuccess>) => {
UTSHarmony.requestSystemPermission(PERMISSIONS, (allRight: boolean) => {
if (allRight) {
try {
const isEnrolled = harmonyCheckIsSoterEnrolledInDevice(args.checkAuthMode)
executor.resolve({
isEnrolled,
errMsg: ''
} as CheckIsSoterEnrolledInDeviceSuccess)
} catch (error) {
const code = (error as BusinessError).code
executor.reject(getErrorMessage(code), { errCode: getUniErrMsg(code) } as ApiError);
}
} else {
executor.reject(getErrorMessage(201))
}
}, () => {
executor.reject(getErrorMessage(201))
})
},
CheckIsSoterEnrolledInDeviceProtocols,
CheckIsSoterEnrolledInDeviceApiOptions
) as CheckIsSoterEnrolledInDevice
uni_modules/uni-authentication/utssdk/interface.uts
0 → 100644
浏览文件 @
911735e0
export interface Uni {
/**
* 开始 SOTER 生物认证
*
* 文档: [http://uniapp.dcloud.io/api/system/authentication?id=startsoterauthentication](http://uniapp.dcloud.io/api/system/authentication?id=startsoterauthentication)
*/
startSoterAuthentication: StartSoterAuthentication;
/**
* 获取本机支持的 SOTER 生物认证方式
*
* 文档: [http://uniapp.dcloud.io/api/system/authentication?id=checkissupportsoterauthentication](http://uniapp.dcloud.io/api/system/authentication?id=checkissupportsoterauthentication)
*/
checkIsSupportSoterAuthentication: CheckIsSupportSoterAuthentication;
/**
* 获取设备内是否录入如指纹等生物信息
*
* 文档: [http://uniapp.dcloud.io/api/system/authentication?id=checkissoterenrolledindevice](http://uniapp.dcloud.io/api/system/authentication?id=checkissoterenrolledindevice)
*/
checkIsSoterEnrolledInDevice: CheckIsSoterEnrolledInDevice;
}
export type StartSoterAuthentication = (options: StartSoterAuthenticationOptions) => void;
/**
* 生物认证方式
*/
export type SoterAuthMode =
/**
* 指纹识别
*/
'fingerPrint' |
/**
* 人脸识别(暂未支持)
*/
'facial' |
/**
* 声纹识别(暂未支持)
*/
'speech';
export type StartSoterAuthenticationSuccess = {
/**
* 错误码
*/
errCode: number,
/**
* 生物认证方式
* - fingerPrint: 指纹识别
* - facial: 人脸识别(暂未支持)
* - speech: 声纹识别(暂未支持)
*/
authMode: SoterAuthMode,
/**
* 在设备安全区域(TEE)内获得的本机安全信息以及本次认证信息
*/
resultJSON?: string | null,
/**
* 用SOTER安全密钥对 resultJSON 的签名(SHA256 with RSA/PSS, saltlen=20)
*/
resultJSONSignature?: string | null,
/**
* 接口调用结果
*/
errMsg: string
};
export type StartSoterAuthenticationSuccessCallback = (result: StartSoterAuthenticationSuccess) => void;
export type StartSoterAuthenticationFail = UniError;
export type UniError = {
errSubject: string,
errCode: number,
errMsg: string,
data?: object | null,
cause?: any | null
};
export type StartSoterAuthenticationFailCallback = (result: StartSoterAuthenticationFail) => void;
export type StartSoterAuthenticationComplete = any;
export type StartSoterAuthenticationCompleteCallback = (result: StartSoterAuthenticationComplete) => void;
export type StartSoterAuthenticationOptions = {
/**
* 请求使用的可接受的生物认证方式
*/
requestAuthModes: SoterAuthMode[],
/**
* 挑战因子
*/
challenge?: string | null,
/**
* 验证描述,即识别过程中显示在界面上的对话框提示内容
*/
authContent?: string | null,
/**
* 接口调用成功的回调函数
*/
success?: StartSoterAuthenticationSuccessCallback | null,
/**
* 接口调用失败的回调函数
*/
fail?: StartSoterAuthenticationFailCallback | null,
/**
* 接口调用结束的回调函数(调用成功、失败都会执行)
*/
complete?: StartSoterAuthenticationCompleteCallback | null
};
export type CheckIsSupportSoterAuthentication = (options: CheckIsSupportSoterAuthenticationOptions) => void;
export type CheckIsSupportSoterAuthenticationSuccess = {
/**
* 接口调用成功的回调函数
*/
supportMode: SoterAuthMode[],
/**
* 接口调用结果
*/
errMsg: string
};
export type CheckIsSupportSoterAuthenticationSuccessCallback = (result: CheckIsSupportSoterAuthenticationSuccess) => void;
export type CheckIsSupportSoterAuthenticationFail = UniError;
export type CheckIsSupportSoterAuthenticationFailCallback = (result: CheckIsSupportSoterAuthenticationFail) => void;
export type CheckIsSupportSoterAuthenticationComplete = any;
export type CheckIsSupportSoterAuthenticationCompleteCallback = (result: CheckIsSupportSoterAuthenticationComplete) => void;
export type CheckIsSupportSoterAuthenticationOptions = {
/**
* 接口调用成功的回调函数
*/
success?: CheckIsSupportSoterAuthenticationSuccessCallback | null,
/**
* 接口调用失败的回调函数
*/
fail?: CheckIsSupportSoterAuthenticationFailCallback | null,
/**
* 接口调用结束的回调函数(调用成功、失败都会执行)
*/
complete?: CheckIsSupportSoterAuthenticationCompleteCallback | null
};
export type CheckIsSoterEnrolledInDevice = (options: CheckIsSoterEnrolledInDeviceOptions) => void;
export type CheckIsSoterEnrolledInDeviceSuccess = {
/**
* 是否已录入信息
* @type boolean
*/
isEnrolled: boolean,
/**
* 错误信息
*/
errMsg: string
};
export type CheckIsSoterEnrolledInDeviceSuccessCallback = (result: CheckIsSoterEnrolledInDeviceSuccess) => void;
export type CheckIsSoterEnrolledInDeviceFail = UniError;
export type CheckIsSoterEnrolledInDeviceFailCallback = (result: CheckIsSoterEnrolledInDeviceFail) => void;
export type CheckIsSoterEnrolledInDeviceComplete = any;
export type CheckIsSoterEnrolledInDeviceCompleteCallback = (result: CheckIsSoterEnrolledInDeviceComplete) => void;
export type CheckIsSoterEnrolledInDeviceOptions = {
/**
* 生物认证方式
* - fingerPrint: 指纹识别
* - facial: 人脸识别(暂未支持)
* - speech: 声纹识别(暂未支持)
*/
checkAuthMode: SoterAuthMode,
/**
* 接口调用成功的回调函数
*/
success?: CheckIsSoterEnrolledInDeviceSuccessCallback | null,
/**
* 接口调用失败的回调函数
*/
fail?: CheckIsSoterEnrolledInDeviceFailCallback | null,
/**
* 接口调用结束的回调函数(调用成功、失败都会执行)
*/
complete?: CheckIsSoterEnrolledInDeviceCompleteCallback | null
};
uni_modules/uni-authentication/utssdk/protocol.uts
0 → 100644
浏览文件 @
911735e0
import { StartSoterAuthenticationOptions, CheckIsSoterEnrolledInDeviceOptions, SoterAuthMode } from './interface.uts';
export const API_START_SOTER_AUTHENTICATION = 'startSoterAuthentication'
export const StartSoterAuthenticationApiOptions: ApiOptions<StartSoterAuthenticationOptions> = {
formatArgs: new Map<string, ((value: string) => string | undefined)>([
['requestAuthModes', function (value: string) {
if (!value.includes('fingerPrint') && !value.includes('facial')) {
return 'requestAuthModes 填写错误'
}
return undefined
}]
])
}
export const StartSoterAuthenticationApiProtocols = new Map<string, ProtocolOptions>([
[
'requestAuthModes',
{
type: 'array',
required: true
}
],
[
'challenge',
{
type: 'string'
}
],
[
'authContent',
{
type: 'string'
}
]
])
export const API_CHECK_IS_SOTER_ENROLLED_IN_DEVICE = 'checkIsSoterEnrolledInDevice'
export const checkAuthModes: SoterAuthMode[] = ['fingerPrint', 'facial', 'speech']
export const CheckIsSoterEnrolledInDeviceApiOptions: ApiOptions<CheckIsSoterEnrolledInDeviceOptions> = {
formatArgs: new Map<string, ((value: string) => string | undefined)>([
['checkAuthMode', function (value: string) {
if (!checkAuthModes.includes(value as SoterAuthMode)) {
return 'checkAuthMode 填写错误'
}
return undefined
}]
])
}
export const CheckIsSoterEnrolledInDeviceProtocols = new Map<string, ProtocolOptions>([
[
'checkAuthMode',
{
type: 'string'
}
]
])
export const API_CHECK_IS_SUPPORT_SOTER_AUTHENTICATION = 'checkIsSupportSoterAuthentication'
uni_modules/uni-base64ToArrayBuffer/changelog.md
0 → 100644
浏览文件 @
911735e0
uni_modules/uni-base64ToArrayBuffer/package.json
0 → 100644
浏览文件 @
911735e0
{
"id"
:
"uni-base64ToArrayBuffer"
,
"displayName"
:
"uni-base64ToArrayBuffer"
,
"version"
:
"1.0.0"
,
"description"
:
"uni-base64ToArrayBuffer"
,
"keywords"
:
[
"uni-base64ToArrayBuffer"
],
"repository"
:
""
,
"engines"
:
{
"HBuilderX"
:
"^3.6.8"
},
"dcloudext"
:
{
"type"
:
"uts"
,
"sale"
:
{
"regular"
:
{
"price"
:
"0.00"
},
"sourcecode"
:
{
"price"
:
"0.00"
}
},
"contact"
:
{
"qq"
:
""
},
"declaration"
:
{
"ads"
:
""
,
"data"
:
""
,
"permissions"
:
""
},
"npmurl"
:
""
},
"uni_modules"
:
{
"dependencies"
:
[],
"uni-ext-api"
:
{
"uni"
:
{
"base64ToArrayBuffer"
:
{
"name"
:
"base64ToArrayBuffer"
,
"app"
:
{
"js"
:
false
,
"kotlin"
:
false
,
"swift"
:
false
,
"arkts"
:
true
}
}
}
},
"encrypt"
:
[],
"platforms"
:
{
"cloud"
:
{
"tcb"
:
"u"
,
"aliyun"
:
"u"
},
"client"
:
{
"Vue"
:
{
"vue2"
:
"u"
,
"vue3"
:
"u"
},
"App"
:
{
"app-android"
:
"u"
,
"app-ios"
:
"u"
},
"H5-mobile"
:
{
"Safari"
:
"u"
,
"Android Browser"
:
"u"
,
"微信浏览器(Android)"
:
"u"
,
"QQ浏览器(Android)"
:
"u"
},
"H5-pc"
:
{
"Chrome"
:
"u"
,
"IE"
:
"u"
,
"Edge"
:
"u"
,
"Firefox"
:
"u"
,
"Safari"
:
"u"
},
"小程序"
:
{
"微信"
:
"u"
,
"阿里"
:
"u"
,
"百度"
:
"u"
,
"字节跳动"
:
"u"
,
"QQ"
:
"u"
,
"钉钉"
:
"u"
,
"快手"
:
"u"
,
"飞书"
:
"u"
,
"京东"
:
"u"
},
"快应用"
:
{
"华为"
:
"u"
,
"联盟"
:
"u"
}
}
}
}
}
uni_modules/uni-base64ToArrayBuffer/readme.md
0 → 100644
浏览文件 @
911735e0
# uni-base64ToArrayBuffer
### 开发文档
[
UTS 语法
](
https://uniapp.dcloud.net.cn/tutorial/syntax-uts.html
)
[
UTS 原生插件
](
https://uniapp.dcloud.net.cn/plugin/uts-plugin.html
)
[
Hello UTS
](
https://gitcode.net/dcloud/hello-uts/-/tree/dev
)
uni_modules/uni-base64ToArrayBuffer/utssdk/app-harmony/index.uts
0 → 100644
浏览文件 @
911735e0
import buffer from '@ohos.buffer';
import { Base64ToArrayBuffer } from '../interface.uts';
import { Base64ToArrayBufferProtocol, API_BASE64_TO_ARRAY_BUFFER } from '../protocol.uts';
export const base64ToArrayBuffer: Base64ToArrayBuffer = defineSyncApi<ArrayBuffer>(
API_BASE64_TO_ARRAY_BUFFER,
(base64: string): ArrayBuffer => {
return buffer.from(base64, 'base64').buffer
},
Base64ToArrayBufferProtocol
) as Base64ToArrayBuffer
uni_modules/uni-base64ToArrayBuffer/utssdk/interface.uts
0 → 100644
浏览文件 @
911735e0
export interface Uni {
/**
* 将 Base64 字符串转成 ArrayBuffer 对象
*
* @tutorial https://uniapp.dcloud.net.cn/api/base64ToArrayBuffer.html
* @tutorial-uni-app https://uniapp.dcloud.net.cn/api/base64ToArrayBuffer.html
*
* @uniPlatform {
* "app": {
* "android": {
* "osVer": "5.0",
* "uniVer": "√",
* "unixVer": "x"
* },
* "ios": {
* "osVer": "5.0",
* "uniVer": "√",
* "unixVer": "x"
* },
* "harmony": {
* "osVer": "3.0",
* "uniVer": "4.23",
* "unixVer": "x"
* }
* },
* "web": {
* "uniVer": "√",
* "unixVer": "4.0"
* },
* "mp":{
* weixin: {
* hostVer: '√',
* uniVer: '√',
* unixVer: 'x'
* },
* alipay: {
* hostVer: '√',
* uniVer: '√',
* unixVer: 'x'
* },
* baidu: {
* hostVer: '√',
* uniVer: '√',
* unixVer: 'x'
* },
* toutiao: {
* hostVer: '√',
* uniVer: '√',
* unixVer: 'x'
* },
* lark: {
* hostVer: '√',
* uniVer: '√',
* unixVer: 'x'
* },
* qq: {
* hostVer: '√',
* uniVer: '√',
* unixVer: 'x'
* },
* kuaishou: {
* hostVer: '√',
* uniVer: '√',
* unixVer: 'x'
* },
* jd: {
* hostVer: '√',
* uniVer: '√',
* unixVer: 'x'
* }
* }
* }
*/
base64ToArrayBuffer: Base64ToArrayBuffer;
}
export type Base64ToArrayBuffer = (base64: string) => ArrayBuffer;
uni_modules/uni-base64ToArrayBuffer/utssdk/protocol.uts
0 → 100644
浏览文件 @
911735e0
export const API_BASE64_TO_ARRAY_BUFFER = 'base64ToArrayBuffer'
export const Base64ToArrayBufferProtocol = new Map<string, ProtocolOptions>([
[
'base64',
{
type: 'string',
required: true,
}
]
])
uni_modules/uni-clipboard/changelog.md
0 → 100644
浏览文件 @
911735e0
uni_modules/uni-clipboard/package.json
0 → 100644
浏览文件 @
911735e0
{
"id"
:
"uni-clipboard"
,
"displayName"
:
"uni-clipboard"
,
"version"
:
"1.0.0"
,
"description"
:
"uni-clipboard"
,
"keywords"
:
[
"uni-clipboard"
],
"repository"
:
""
,
"engines"
:
{
"HBuilderX"
:
"^3.6.8"
},
"dcloudext"
:
{
"type"
:
"uts"
,
"sale"
:
{
"regular"
:
{
"price"
:
"0.00"
},
"sourcecode"
:
{
"price"
:
"0.00"
}
},
"contact"
:
{
"qq"
:
""
},
"declaration"
:
{
"ads"
:
""
,
"data"
:
""
,
"permissions"
:
""
},
"npmurl"
:
""
},
"uni_modules"
:
{
"dependencies"
:
[],
"uni-ext-api"
:
{
"uni"
:
{
"getClipboardData"
:
{
"name"
:
"getClipboardData"
,
"app"
:
{
"js"
:
false
,
"kotlin"
:
false
,
"swift"
:
false
,
"arkts"
:
true
}
},
"setClipboardData"
:
{
"name"
:
"setClipboardData"
,
"app"
:
{
"js"
:
false
,
"kotlin"
:
false
,
"swift"
:
false
,
"arkts"
:
true
}
}
}
},
"encrypt"
:
[],
"platforms"
:
{
"cloud"
:
{
"tcb"
:
"u"
,
"aliyun"
:
"u"
},
"client"
:
{
"Vue"
:
{
"vue2"
:
"u"
,
"vue3"
:
"u"
},
"App"
:
{
"app-android"
:
"u"
,
"app-ios"
:
"u"
},
"H5-mobile"
:
{
"Safari"
:
"u"
,
"Android Browser"
:
"u"
,
"微信浏览器(Android)"
:
"u"
,
"QQ浏览器(Android)"
:
"u"
},
"H5-pc"
:
{
"Chrome"
:
"u"
,
"IE"
:
"u"
,
"Edge"
:
"u"
,
"Firefox"
:
"u"
,
"Safari"
:
"u"
},
"小程序"
:
{
"微信"
:
"u"
,
"阿里"
:
"u"
,
"百度"
:
"u"
,
"字节跳动"
:
"u"
,
"QQ"
:
"u"
,
"钉钉"
:
"u"
,
"快手"
:
"u"
,
"飞书"
:
"u"
,
"京东"
:
"u"
},
"快应用"
:
{
"华为"
:
"u"
,
"联盟"
:
"u"
}
}
}
}
}
uni_modules/uni-clipboard/readme.md
0 → 100644
浏览文件 @
911735e0
# uni-clipboard
### 开发文档
[
UTS 语法
](
https://uniapp.dcloud.net.cn/tutorial/syntax-uts.html
)
[
UTS 原生插件
](
https://uniapp.dcloud.net.cn/plugin/uts-plugin.html
)
[
Hello UTS
](
https://gitcode.net/dcloud/hello-uts/-/tree/dev
)
uni_modules/uni-clipboard/utssdk/app-harmony/index.uts
0 → 100644
浏览文件 @
911735e0
import { clipboard } from '@dcloudio/uni-runtime';
import { SetClipboardData, GetClipboardData, SetClipboardDataOptions, SetClipboardDataSuccess, GetClipboardDataOptions, GetClipboardDataSuccess } from '../interface.uts';
import { API_GET_CLIPBOARD_DATA, API_SET_CLIPBOARD_DATA, SetClipboardDataApiOptions, SetClipboardDataProtocol } from '../protocol.uts';
export { SetClipboardData, GetClipboardData, SetClipboardDataOptions, SetClipboardDataSuccess, GetClipboardDataOptions, GetClipboardDataSuccess }
interface ClipboardModuleGetStringOptions {
result: string
data: string
}
export const getClipboardData: GetClipboardData = defineAsyncApi<GetClipboardDataOptions, GetClipboardDataSuccess>(
API_GET_CLIPBOARD_DATA,
(_: GetClipboardDataOptions, res: ApiExecutor<GetClipboardDataSuccess>) => {
clipboard.getString((ret: ClipboardModuleGetStringOptions) => {
if (ret.result === 'success') {
res.resolve({
data: ret.data,
} as GetClipboardDataSuccess)
} else {
res.reject('getClipboardData:fail')
}
})
}
) as GetClipboardData
export const setClipboardData: SetClipboardData = defineAsyncApi<SetClipboardDataOptions, SetClipboardDataSuccess>(
API_SET_CLIPBOARD_DATA,
(options: SetClipboardDataOptions, res: ApiExecutor<SetClipboardDataSuccess>) => {
clipboard.setString(options.data)
res.resolve()
},
SetClipboardDataProtocol,
SetClipboardDataApiOptions
) as SetClipboardData
uni_modules/uni-clipboard/utssdk/interface.uts
0 → 100644
浏览文件 @
911735e0
export interface Uni {
/**
* 设置系统剪贴板的内容
*
* @tutorial https://uniapp.dcloud.net.cn/api/system/clipboard.html#setclipboarddata
* @tutorial-uni-app https://uniapp.dcloud.net.cn/api/system/clipboard.html#setclipboarddata
* @uniPlatform {
* "app": {
* "android": {
* "osVer": "5.0",
* "uniVer": "√",
* "unixVer": "x"
* },
* "ios": {
* "osVer": "12.0",
* "uniVer": "√",
* "unixVer": "x"
* },
* "harmony": {
* "osVer": "3.0",
* "uniVer": "4.23",
* "unixVer": "x"
* }
* },
* "mp": {
* "weixin": {
* "hostVer": "√",
* "uniVer": "√",
* "unixVer": "x"
* },
* "alipay": {
* "hostVer": "√",
* "uniVer": "√",
* "unixVer": "x"
* },
* "baidu": {
* "hostVer": "√",
* "uniVer": "√",
* "unixVer": "x"
* },
* "toutiao": {
* "hostVer": "√",
* "uniVer": "√",
* "unixVer": "x"
* },
* "lark": {
* "hostVer": "√",
* "uniVer": "√",
* "unixVer": "x"
* },
* "qq": {
* "hostVer": "√",
* "uniVer": "√",
* "unixVer": "x"
* },
* "kuaishou": {
* "hostVer": "√",
* "uniVer": "√",
* "unixVer": "x"
* },
* "jd": {
* "hostVer": "√",
* "uniVer": "√",
* "unixVer": "x"
* }
* },
* "web": {
* "uniVer": "√",
* "unixVer": "4.0"
* }
* }
*/
setClipboardData: SetClipboardData;
/**
* 获得系统剪贴板的内容
*
* @tutorial https://uniapp.dcloud.net.cn/api/system/clipboard.html#getclipboarddata
* @tutorial-uni-app https://uniapp.dcloud.net.cn/api/system/clipboard.html#getclipboarddata
* @uniPlatform {
* "app": {
* "android": {
* "osVer": "5.0",
* "uniVer": "√",
* "unixVer": "x"
* },
* "ios": {
* "osVer": "12.0",
* "uniVer": "√",
* "unixVer": "x"
* },
* "harmony": {
* "osVer": "3.0",
* "uniVer": "4.23",
* "unixVer": "x"
* }
* },
* "mp": {
* "weixin": {
* "hostVer": "√",
* "uniVer": "√",
* "unixVer": "x"
* },
* "alipay": {
* "hostVer": "√",
* "uniVer": "√",
* "unixVer": "x"
* },
* "baidu": {
* "hostVer": "√",
* "uniVer": "√",
* "unixVer": "x"
* },
* "toutiao": {
* "hostVer": "√",
* "uniVer": "√",
* "unixVer": "x"
* },
* "lark": {
* "hostVer": "√",
* "uniVer": "√",
* "unixVer": "√"
* },
* "qq": {
* "hostVer": "√",
* "uniVer": "√",
* "unixVer": "x"
* },
* "kuaishou": {
* "hostVer": "√",
* "uniVer": "√",
* "unixVer": "x"
* },
* "jd": {
* "hostVer": "√",
* "uniVer": "√",
* "unixVer": "x"
* }
* },
* "web": {
* "uniVer": "√",
* "unixVer": "4.0"
* }
* }
*/
getClipboardData: GetClipboardData;
}
export type SetClipboardData = (options: SetClipboardDataOptions) => void;
export type SetClipboardDataSuccess = {};
export type SetClipboardDataSuccessCallback = (result: SetClipboardDataSuccess) => void;
export type SetClipboardDataFail = UniError;
export type SetClipboardDataFailCallback = (result: SetClipboardDataFail) => void;
export type SetClipboardDataComplete = any;
export type SetClipboardDataCompleteCallback = (result: SetClipboardDataComplete) => void;
export type SetClipboardDataOptions = {
/**
* 需要设置的内容
*/
data: string,
/**
* 是否弹出提示,默认弹出提示
* @type boolean
*/
showToast?: boolean | null,
/**
* 成功返回的回调函数
*/
success?: SetClipboardDataSuccessCallback | null,
/**
* 失败的回调函数
*/
fail?: SetClipboardDataFailCallback | null,
/**
* 结束的回调函数(调用成功、失败都会执行)
*/
complete?: SetClipboardDataCompleteCallback | null
};
export type GetClipboardData = (options: GetClipboardDataOptions) => void;
export type GetClipboardDataSuccess = {
/**
* 剪贴板的内容
*/
data: string
};
export type GetClipboardDataSuccessCallback = (result: GetClipboardDataSuccess) => void;
export type GetClipboardDataFail = UniError;
export type GetClipboardDataFailCallback = (result: GetClipboardDataFail) => void;
export type GetClipboardDataComplete = any;
export type GetClipboardDataCompleteCallback = (result: GetClipboardDataComplete) => void;
export type GetClipboardDataOptions = {
/**
* 成功返回的回调函数
*/
success?: GetClipboardDataSuccessCallback | null,
/**
* 失败的回调函数
*/
fail?: GetClipboardDataFailCallback | null,
/**
* 结束的回调函数(调用成功、失败都会执行)
*/
complete?: GetClipboardDataCompleteCallback | null
};
uni_modules/uni-clipboard/utssdk/protocol.uts
0 → 100644
浏览文件 @
911735e0
import { SetClipboardDataOptions } from './interface.uts';
export const API_GET_CLIPBOARD_DATA = 'getClipboardData'
export const API_SET_CLIPBOARD_DATA = 'setClipboardData'
export const SetClipboardDataApiOptions: ApiOptions<SetClipboardDataOptions> = {
formatArgs: new Map<string, boolean>([
['showToast', true]
])
}
export const SetClipboardDataProtocol = new Map<string, ProtocolOptions>([
[
'data',
{
type: 'string',
required: true,
}
],
[
'showToast',
{
type: 'boolean'
}
]
])
uni_modules/uni-createIntersectionObserver/changelog.md
0 → 100644
浏览文件 @
911735e0
uni_modules/uni-createIntersectionObserver/package.json
0 → 100644
浏览文件 @
911735e0
{
"id"
:
"uni-createIntersectionObserver"
,
"displayName"
:
"uni-createIntersectionObserver"
,
"version"
:
"1.0.0"
,
"description"
:
"uni-createIntersectionObserver"
,
"keywords"
:
[
"uni-createIntersectionObserver"
],
"repository"
:
""
,
"engines"
:
{
"HBuilderX"
:
"^3.6.8"
},
"dcloudext"
:
{
"type"
:
"uts"
,
"sale"
:
{
"regular"
:
{
"price"
:
"0.00"
},
"sourcecode"
:
{
"price"
:
"0.00"
}
},
"contact"
:
{
"qq"
:
""
},
"declaration"
:
{
"ads"
:
""
,
"data"
:
""
,
"permissions"
:
""
},
"npmurl"
:
""
},
"uni_modules"
:
{
"encrypt"
:
[],
"uni-ext-api"
:
{
"uni"
:
{
"createIntersectionObserver"
:
{
"name"
:
"createIntersectionObserver"
,
"app"
:
{
"js"
:
false
,
"kotlin"
:
false
,
"swift"
:
false
,
"arkts"
:
true
}
}
}
},
"platforms"
:
{
"cloud"
:
{
"tcb"
:
"u"
,
"aliyun"
:
"u"
},
"client"
:
{
"Vue"
:
{
"vue2"
:
"u"
,
"vue3"
:
"u"
},
"App"
:
{
"app-android"
:
"u"
,
"app-ios"
:
"u"
},
"H5-mobile"
:
{
"Safari"
:
"u"
,
"Android Browser"
:
"u"
,
"微信浏览器(Android)"
:
"u"
,
"QQ浏览器(Android)"
:
"u"
},
"H5-pc"
:
{
"Chrome"
:
"u"
,
"IE"
:
"u"
,
"Edge"
:
"u"
,
"Firefox"
:
"u"
,
"Safari"
:
"u"
},
"小程序"
:
{
"微信"
:
"u"
,
"阿里"
:
"u"
,
"百度"
:
"u"
,
"字节跳动"
:
"u"
,
"QQ"
:
"u"
,
"钉钉"
:
"u"
,
"快手"
:
"u"
,
"飞书"
:
"u"
,
"京东"
:
"u"
},
"快应用"
:
{
"华为"
:
"u"
,
"联盟"
:
"u"
}
}
}
}
}
uni_modules/uni-createIntersectionObserver/readme.md
0 → 100644
浏览文件 @
911735e0
# uni-createIntersectionObserver
### 开发文档
[
UTS 语法
](
https://uniapp.dcloud.net.cn/tutorial/syntax-uts.html
)
[
UTS API插件
](
https://uniapp.dcloud.net.cn/plugin/uts-plugin.html
)
[
UTS 组件插件
](
https://uniapp.dcloud.net.cn/plugin/uts-component.html
)
[
Hello UTS
](
https://gitcode.net/dcloud/hello-uts
)
uni_modules/uni-createIntersectionObserver/utssdk/app-harmony/index.uts
0 → 100644
浏览文件 @
911735e0
import {
resolveComponentInstance,
extend,
isFunction,
getCurrentPageVm,
getPageIdByVm,
addIntersectionObserver,
removeIntersectionObserver,
} from '@dcloudio/uni-runtime'
import { CreateIntersectionObserver, CreateIntersectionObserverOptions, ObserveCallback, IntersectionObserver } from '../interface.uts'
export { CreateIntersectionObserver, CreateIntersectionObserverOptions, ObserveCallback, IntersectionObserver }
interface AddIntersectionObserverArgs {
reqId: number
component: ComponentPublicInstance
options: ServiceIntersectionObserverOptions
callback: ObserveCallback
}
interface RemoveIntersectionObserverArgs {
reqId: number
component: ComponentPublicInstance
}
interface RequestComponentObserverOptions {
selector?: string
rootMargin?: string
relativeToSelector?: string
}
interface ServiceIntersectionObserverOptions extends CreateIntersectionObserverOptions, RequestComponentObserverOptions { }
interface Margins {
/** 节点布局区域的下边界 */
bottom?: number,
/** 节点布局区域的左边界 */
left?: number,
/** 节点布局区域的右边界 */
right?: number,
/** 节点布局区域的上边界 */
top?: number
}
const defaultOptions = {
thresholds: [0],
initialRatio: 0,
observeAll: false,
} as CreateIntersectionObserverOptions
let reqComponentObserverId = 1
function normalizeRootMargin(margins: Margins | null = {}) {
if (!margins) margins = {}
const top = Number(margins.top) || 0
const right = Number(margins.right) || 0
const bottom = Number(margins.bottom) || 0
const left = Number(margins.left) || 0
return `${top}px ${right}px ${bottom}px ${left}px`
}
class ServiceIntersectionObserver {
private _reqId?: number
private _pageId: number
private _component: ComponentPublicInstance
private _options: ServiceIntersectionObserverOptions
constructor(
component: ComponentPublicInstance,
options?: CreateIntersectionObserverOptions
) {
this._pageId = getPageIdByVm(component)!
this._component = component
if (options) {
if (typeof options.thresholds === 'undefined') options.thresholds = defaultOptions.thresholds
if (typeof options.initialRatio === 'undefined') options.initialRatio = defaultOptions.initialRatio
if (typeof options.observeAll === 'undefined') options.observeAll = defaultOptions.observeAll
}
this._options = (options ?? defaultOptions) as ServiceIntersectionObserverOptions
}
relativeTo(selector: string, margins?: Margins) {
this._options.relativeToSelector = selector
this._options.rootMargin = normalizeRootMargin(margins)
return this
}
relativeToViewport(margins?: Margins) {
this._options.relativeToSelector = undefined
this._options.rootMargin = normalizeRootMargin(margins)
return this
}
observe(
selector: string,
callback: ObserveCallback
) {
if (!isFunction(callback)) {
return
}
this._options.selector = selector
this._reqId = reqComponentObserverId++
addIntersectionObserver(
{
reqId: this._reqId,
component: this._component,
options: this._options,
callback,
} as AddIntersectionObserverArgs,
this._pageId
)
}
disconnect() {
this._reqId &&
removeIntersectionObserver(
{ reqId: this._reqId, component: this._component } as RemoveIntersectionObserverArgs,
this._pageId
)
}
}
export const createIntersectionObserver = defineSyncApi<IntersectionObserver>(
'createIntersectionObserver',
(context: ComponentPublicInstance | null, options?: CreateIntersectionObserverOptions) => {
let _options: ComponentPublicInstance | CreateIntersectionObserverOptions | null = options
context = resolveComponentInstance(context)
if (context && !getPageIdByVm(context)) {
_options = context
context = null
}
if (context) {
return new ServiceIntersectionObserver(context as ComponentPublicInstance, _options as CreateIntersectionObserverOptions)
}
return new ServiceIntersectionObserver(getCurrentPageVm()!, _options as CreateIntersectionObserverOptions)
}
) as CreateIntersectionObserver
uni_modules/uni-createIntersectionObserver/utssdk/interface.uts
0 → 100644
浏览文件 @
911735e0
export interface Uni {
/**
* 创建并返回一个 IntersectionObserver 对象实例
*
* @tutorial https://uniapp.dcloud.net.cn/api/ui/intersection-observer.html#createintersectionobserver
* @tutorial-uni-app https://uniapp.dcloud.net.cn/api/ui/intersection-observer.html#createintersectionobserver
* @uniPlatform {
* "app": {
* "android": {
* "osVer": "5.0",
* "uniVer": "√",
* "unixVer": "x"
* },
* "ios": {
* "osVer": "12.0",
* "uniVer": "√",
* "unixVer": "x"
* },
* "harmony": {
* "osVer": "3.0",
* "uniVer": "4.23",
* "unixVer": "x"
* }
* },
* "mp": {
* "weixin": {
* "hostVer": "√",
* "uniVer": "√",
* "unixVer": "x"
* },
* "alipay": {
* "hostVer": "√",
* "uniVer": "√",
* "unixVer": "x"
* },
* "baidu": {
* "hostVer": "√",
* "uniVer": "√",
* "unixVer": "x"
* },
* "toutiao": {
* "hostVer": "√",
* "uniVer": "√",
* "unixVer": "x"
* },
* "lark": {
* "hostVer": "√",
* "uniVer": "√",
* "unixVer": "x"
* },
* "qq": {
* "hostVer": "√",
* "uniVer": "√",
* "unixVer": "x"
* },
* "kuaishou": {
* "hostVer": "√",
* "uniVer": "√",
* "unixVer": "x"
* },
* "jd": {
* "hostVer": "√",
* "uniVer": "√",
* "unixVer": "x"
* }
* },
* "web": {
* "uniVer": "√",
* "unixVer": "4.0"
* }
* }
*/
createIntersectionObserver: CreateIntersectionObserver;
}
export type CreateIntersectionObserver = (component: any, options: CreateIntersectionObserverOptions) => IntersectionObserver;
export interface CreateIntersectionObserverOptions {
/**
* 所有阈值
*/
thresholds?: (any[]) | null,
/**
* 初始的相交比例
*/
initialRatio?: number | null,
/**
* 是否同时观测多个参照节点(而非一个)
*/
observeAll?: boolean | null
};
export type ObserveNodeRect = {
/**
* left
*/
left: number,
/**
* right
*/
right: number,
/**
* top
*/
top: number,
/**
* bottom
*/
bottom: number
};
export type ObserveResult = {
/**
* 相交比例
*/
intersectionRatio: number,
/**
* 相交区域的边界
*/
intersectionRect: any,
/**
* 目标节点布局区域的边界
*/
boundingClientRect: ObserveNodeRect,
/**
* 参照区域的边界
*/
relativeRect: ObserveNodeRect,
/**
* 相交检测时的时间戳
*/
time: number
};
export type ObserveCallback = (result: ObserveResult) => void;
export interface IntersectionObserver {
/**
* 使用选择器指定一个节点,作为参照区域之一
*/
relativeTo(selector: string, margins?: any): IntersectionObserver;
/**
* 指定页面显示区域作为参照区域之一
*/
relativeToViewport(margins?: any): IntersectionObserver;
/**
* 指定目标节点并开始监听相交状态变化情况
*/
observe(targetSelector: string, callback: ObserveCallback): void;
/**
* 停止监听
*/
disconnect(): void;
}
uni_modules/uni-file/changelog.md
0 → 100644
浏览文件 @
911735e0
uni_modules/uni-file/package.json
0 → 100644
浏览文件 @
911735e0
{
"id"
:
"uni-file"
,
"displayName"
:
"uni-file"
,
"version"
:
"1.0.0"
,
"description"
:
"uni-file"
,
"keywords"
:
[
"uni-file"
],
"repository"
:
""
,
"engines"
:
{
"HBuilderX"
:
"^3.6.8"
},
"dcloudext"
:
{
"type"
:
"uts"
,
"sale"
:
{
"regular"
:
{
"price"
:
"0.00"
},
"sourcecode"
:
{
"price"
:
"0.00"
}
},
"contact"
:
{
"qq"
:
""
},
"declaration"
:
{
"ads"
:
""
,
"data"
:
""
,
"permissions"
:
""
},
"npmurl"
:
""
},
"uni_modules"
:
{
"dependencies"
:
[],
"uni-ext-api"
:
{
"uni"
:
{
"saveFile"
:
{
"name"
:
"saveFile"
,
"app"
:
{
"js"
:
false
,
"kotlin"
:
false
,
"swift"
:
false
,
"arkts"
:
true
}
},
"getSavedFileList"
:
{
"name"
:
"getSavedFileList"
,
"app"
:
{
"js"
:
false
,
"kotlin"
:
false
,
"swift"
:
false
,
"arkts"
:
true
}
},
"getSavedFileInfo"
:
{
"name"
:
"getSavedFileInfo"
,
"app"
:
{
"js"
:
false
,
"kotlin"
:
false
,
"swift"
:
false
,
"arkts"
:
true
}
},
"removeSavedFile"
:
{
"name"
:
"removeSavedFile"
,
"app"
:
{
"js"
:
false
,
"kotlin"
:
false
,
"swift"
:
false
,
"arkts"
:
true
}
},
"getFileInfo"
:
{
"name"
:
"getFileInfo"
,
"app"
:
{
"js"
:
false
,
"kotlin"
:
false
,
"swift"
:
false
,
"arkts"
:
true
}
}
}
},
"encrypt"
:
[],
"platforms"
:
{
"cloud"
:
{
"tcb"
:
"u"
,
"aliyun"
:
"u"
},
"client"
:
{
"Vue"
:
{
"vue2"
:
"y"
,
"vue3"
:
"y"
},
"App"
:
{
"app-android"
:
"y"
,
"app-ios"
:
"u"
},
"H5-mobile"
:
{
"Safari"
:
"u"
,
"Android Browser"
:
"u"
,
"微信浏览器(Android)"
:
"u"
,
"QQ浏览器(Android)"
:
"u"
},
"H5-pc"
:
{
"Chrome"
:
"u"
,
"IE"
:
"u"
,
"Edge"
:
"u"
,
"Firefox"
:
"u"
,
"Safari"
:
"u"
},
"小程序"
:
{
"微信"
:
"u"
,
"阿里"
:
"u"
,
"百度"
:
"u"
,
"字节跳动"
:
"u"
,
"QQ"
:
"u"
,
"钉钉"
:
"u"
,
"快手"
:
"u"
,
"飞书"
:
"u"
,
"京东"
:
"u"
},
"快应用"
:
{
"华为"
:
"u"
,
"联盟"
:
"u"
}
}
}
}
}
uni_modules/uni-file/readme.md
0 → 100644
浏览文件 @
911735e0
# uni-scanCode
### 开发文档
[
UTS 语法
](
https://uniapp.dcloud.net.cn/tutorial/syntax-uts.html
)
[
UTS API插件
](
https://uniapp.dcloud.net.cn/plugin/uts-plugin.html
)
[
UTS 组件插件
](
https://uniapp.dcloud.net.cn/plugin/uts-component.html
)
[
Hello UTS
](
https://gitcode.net/dcloud/hello-uts
)
uni_modules/uni-file/utssdk/app-harmony/index.uts
0 → 100644
浏览文件 @
911735e0
import {
API_SAVE_FILE,
API_GET_SAVED_FILE_LIST,
API_GET_SAVED_FILE_INFO,
API_REMOVE_SAVED_FILE,
API_GET_FILE_INFO
} from '../protocol.uts'
import {
SaveFile,
SaveFileOptions,
SaveFileSuccess,
SaveFileFail,
GetSavedFileList,
GetSavedFileListOptions,
SavedFileListItem,
GetSavedFileListSuccess,
GetSavedFileListFail,
GetSavedFileInfo,
GetSavedFileInfoOptions,
GetSavedFileInfoSuccess,
GetSavedFileInfoFail,
RemoveSavedFile,
RemoveSavedFileOptions,
RemoveSavedFileSuccess,
RemoveSavedFileFail,
GetFileInfo,
GetFileInfoOptions,
GetFileInfoSuccess,
GetFileInfoFail
} from '../interface.uts'
import {
getEnv,
getRealPath,
} from '@dcloudio/uni-runtime'
import fs from '@ohos.file.fs'
import { ListFileOptions } from '@ohos.file.fs'
import Hash from '@ohos.file.hash';
export {
SaveFile,
SaveFileOptions,
SaveFileSuccess,
SaveFileFail,
GetSavedFileList,
SavedFileListItem,
GetSavedFileListOptions,
GetSavedFileListSuccess,
GetSavedFileListFail,
GetSavedFileInfo,
GetSavedFileInfoOptions,
GetSavedFileInfoSuccess,
GetSavedFileInfoFail,
RemoveSavedFile,
RemoveSavedFileOptions,
RemoveSavedFileSuccess,
RemoveSavedFileFail,
GetFileInfo,
GetFileInfoOptions,
GetFileInfoSuccess,
GetFileInfoFail
}
function getSavedDir(appId: string) {
return getEnv().USER_DATA_PATH + '/' + appId + '/saved'
}
let savedIndex: [string, number] = ['0', 0]
function getSavedFileName(filePath: string) {
const ext = filePath.split('/').pop()?.split('.').slice(1).join('.')
let fileName = Date.now() + ''
if (savedIndex[0] === fileName) {
savedIndex[1]++
if (savedIndex[1] > 0) {
fileName += '-' + savedIndex[1]
}
} else {
savedIndex[0] = fileName
savedIndex[1] = 0
}
if (ext) {
fileName += '.' + ext
}
return fileName
}
function getFsPath(filePath: string) {
filePath = getRealPath(filePath) as string
if (!/^file:/.test(filePath)) {
return filePath
}
const rawPath = filePath.replace(/^file:\/\//, '')
if (rawPath[0] === '/') {
return rawPath
}
return filePath
}
export const saveFile: SaveFile = defineAsyncApi<SaveFileOptions, SaveFileSuccess>(
API_SAVE_FILE,
function (options: SaveFileOptions, exec: ApiExecutor<SaveFileSuccess>) {
const tempFilePath = getRealPath(options.tempFilePath) as string;
const savedPath = getSavedDir(APP_ID)
if (!fs.accessSync(savedPath)) {
fs.mkdirSync(savedPath, true)
}
let srcFile: fs.File
try {
srcFile = fs.openSync(tempFilePath, fs.OpenMode.READ_ONLY)
} catch (error) {
exec.reject((error as Error).message)
return
}
const savedFilePath = savedPath + '/' + getSavedFileName(tempFilePath);
fs.copyFile(srcFile.fd, savedFilePath, (err) => {
fs.closeSync(srcFile)
if (err) {
exec.reject(err.message)
} else {
exec.resolve({
savedFilePath: 'file://' + savedFilePath
} as SaveFileSuccess)
}
})
}
) as SaveFile
export const getSavedFileList: GetSavedFileList = defineAsyncApi<GetSavedFileListOptions, GetSavedFileListSuccess>(
API_GET_SAVED_FILE_LIST,
function (options: GetSavedFileListOptions, exec: ApiExecutor<GetSavedFileListSuccess>) {
const savedPath = getSavedDir(APP_ID)
if (!fs.accessSync(savedPath)) {
exec.resolve({
fileList: []
} as GetSavedFileListSuccess)
}
fs.listFile(savedPath, {} as ListFileOptions, (err, fileList) => {
if (err) {
exec.reject(err.message)
} else {
exec.resolve({
fileList: fileList.map((filePath: string) => {
const fullPath = savedPath + '/' + filePath
const stat = fs.statSync(fullPath)
if (!stat.isFile()) {
return null
}
return {
filePath: 'file://' + fullPath,
size: stat.size,
createTime: stat.ctime
} as SavedFileListItem
}).filter((item) => !!item)
} as GetSavedFileListSuccess)
}
})
}
) as GetSavedFileList
export const getSavedFileInfo: GetSavedFileInfo = defineAsyncApi<GetSavedFileInfoOptions, GetSavedFileInfoSuccess>(
API_GET_SAVED_FILE_INFO,
function (options: GetSavedFileInfoOptions, exec: ApiExecutor<GetSavedFileInfoSuccess>) {
const savedFilePath = getFsPath(options.filePath);
if (!fs.accessSync(savedFilePath)) {
exec.reject('file not exist')
return
}
const stat = fs.statSync(savedFilePath)
if (!stat.isFile()) {
exec.reject('file not exist')
}
exec.resolve({
size: stat.size,
createTime: stat.ctime
} as GetSavedFileInfoSuccess)
}
) as GetSavedFileInfo
export const removeSavedFile: RemoveSavedFile = defineAsyncApi<RemoveSavedFileOptions, RemoveSavedFileSuccess>(
API_REMOVE_SAVED_FILE,
function (options: RemoveSavedFileOptions, exec: ApiExecutor<RemoveSavedFileSuccess>) {
const savedFilePath = getFsPath(options.filePath);
if (!fs.accessSync(savedFilePath)) {
exec.reject('file not exist')
return
}
fs.unlink(savedFilePath, (err) => {
if (err) {
exec.reject(err.message)
} else {
exec.resolve()
}
})
}
) as RemoveSavedFile
const SupportedHashAlgorithm = ['md5', 'sha1']
export const getFileInfo: GetFileInfo = defineAsyncApi<GetFileInfoOptions, GetFileInfoSuccess>(
API_GET_FILE_INFO,
function (options: GetFileInfoOptions, exec: ApiExecutor<GetFileInfoSuccess>) {
const filePath = getFsPath(options.filePath);
const digestAlgorithm = options.digestAlgorithm && SupportedHashAlgorithm.includes(options.digestAlgorithm) ? options.digestAlgorithm : 'md5'
if (!fs.accessSync(filePath)) {
exec.reject('file not exist')
return
}
const stat = fs.statSync(filePath)
if (!stat.isFile()) {
exec.reject('file not exist')
}
Hash.hash(filePath, digestAlgorithm, (err, hash) => {
if (err) {
exec.reject(err.message)
} else {
exec.resolve({
size: stat.size,
digest: hash
} as GetFileInfoSuccess)
}
})
}
) as GetFileInfo
uni_modules/uni-file/utssdk/interface.uts
0 → 100644
浏览文件 @
911735e0
export type SaveFileSuccess = {
savedFilePath: string;
};
export type SaveFileSuccessCallback = (res: SaveFileSuccess) => void;
export type SaveFileFail = {};
export type SaveFileFailCallback = (res: SaveFileFail) => void;
export type SaveFileCompleteCallback = (res: any) => void;
export type SaveFileOptions = {
tempFilePath: string;
success?: SaveFileSuccessCallback | null;
fail?: SaveFileFailCallback | null;
complete?: SaveFileCompleteCallback | null;
};
export type GetFileInfoSuccess = {
digest: string;
size: number;
};
export type GetFileInfoSuccessCallback = (res: GetFileInfoSuccess) => void;
export type GetFileInfoFail = {};
export type GetFileInfoFailCallback = (res: GetFileInfoFail) => void;
export type GetFileInfoCompleteCallback = (res: any) => void;
export type GetFileInfoOptions = {
filePath: string;
digestAlgorithm?: string | null;
success?: GetFileInfoSuccessCallback | null;
fail?: GetFileInfoFailCallback | null;
complete?: GetFileInfoCompleteCallback | null;
};
export type GetSavedFileInfoSuccess = {
size: number;
createTime: number;
};
export type GetSavedFileInfoSuccessCallback = (res: GetSavedFileInfoSuccess) => void;
export type GetSavedFileInfoFail = {};
export type GetSavedFileInfoFailCallback = (res: GetSavedFileInfoFail) => void;
export type GetSavedFileInfoCompleteCallback = (res: any) => void;
export type GetSavedFileInfoOptions = {
filePath: string;
success?: GetSavedFileInfoSuccessCallback | null;
fail?: GetSavedFileInfoFailCallback | null;
complete?: GetSavedFileInfoCompleteCallback | null;
};
export type RemoveSavedFileSuccess = {};
export type RemoveSavedFileSuccessCallback = (res: RemoveSavedFileSuccess) => void;
export type RemoveSavedFileFail = {};
export type RemoveSavedFileFailCallback = (res: RemoveSavedFileFail) => void;
export type RemoveSavedFileCompleteCallback = (res: any) => void;
export type RemoveSavedFileOptions = {
filePath: string;
success?: RemoveSavedFileSuccessCallback | null;
fail?: RemoveSavedFileFailCallback | null;
complete?: RemoveSavedFileCompleteCallback | null;
};
export type SavedFileListItem = {
filePath: string;
size: number;
createTime: number;
};
export type GetSavedFileListSuccess = {
fileList: SavedFileListItem[];
};
export type GetSavedFileListSuccessCallback = (res: GetSavedFileListSuccess) => void;
export type GetSavedFileListFail = {};
export type GetSavedFileListFailCallback = (res: GetSavedFileListFail) => void;
export type GetSavedFileListCompleteCallback = (res: any) => void;
export type GetSavedFileListOptions = {
success?: GetSavedFileListSuccessCallback | null;
fail?: GetSavedFileListFailCallback | null;
complete?: GetSavedFileListCompleteCallback | null;
};
export type SaveFile = (options?: SaveFileOptions | null) => void;
export type GetFileInfo = (options?: GetFileInfoOptions | null) => void;
export type GetSavedFileInfo = (options?: GetSavedFileInfoOptions | null) => void;
export type RemoveSavedFile = (options?: RemoveSavedFileOptions | null) => void;
export type GetSavedFileList = (options?: GetSavedFileListOptions | null) => void;
export interface Uni {
/**
* 保存文件
* @uniPlatform {
* "app": {
* "harmony": {
* "osVer": "3.0",
* "uniVer": "4.25",
* "unixVer": "x"
* }
* },
* "web": {
* "uniVer": "x",
* "unixVer": "x"
* }
* }
* @uniVueVersion 2,3 //支持的vue版本
*/
saveFile(options?: SaveFileOptions | null): void;
/**
* 获取本地已保存的文件列表
* @uniPlatform {
* "app": {
* "harmony": {
* "osVer": "3.0",
* "uniVer": "4.25",
* "unixVer": "x"
* }
* },
* "web": {
* "uniVer": "x",
* "unixVer": "x"
* }
* }
* @uniVueVersion 2,3 //支持的vue版本
*/
getSavedFileList(options?: GetSavedFileListOptions | null): void;
/**
* 获取已保存到本地的文件信息
* @uniPlatform {
* "app": {
* "harmony": {
* "osVer": "3.0",
* "uniVer": "4.25",
* "unixVer": "x"
* }
* },
* "web": {
* "uniVer": "x",
* "unixVer": "x"
* }
* }
* @uniVueVersion 2,3 //支持的vue版本
*/
getSavedFileInfo(options?: GetSavedFileInfoOptions | null): void;
/**
* 删除已保存的文件
* @uniPlatform {
* "app": {
* "harmony": {
* "osVer": "3.0",
* "uniVer": "4.25",
* "unixVer": "x"
* }
* },
* "web": {
* "uniVer": "x",
* "unixVer": "x"
* }
* }
* @uniVueVersion 2,3 //支持的vue版本
*/
removeSavedFile(options?: RemoveSavedFileOptions | null): void;
/**
* 获取文件信息
* @uniPlatform {
* "app": {
* "harmony": {
* "osVer": "3.0",
* "uniVer": "4.25",
* "unixVer": "x"
* }
* },
* "web": {
* "uniVer": "x",
* "unixVer": "x"
* }
* }
* @uniVueVersion 2,3 //支持的vue版本
*/
getFileInfo(options?: GetFileInfoOptions | null): void;
}
uni_modules/uni-file/utssdk/protocol.uts
0 → 100644
浏览文件 @
911735e0
export const API_SAVE_FILE = 'saveFile'
export const API_GET_FILE_INFO = 'getFileInfo'
export const API_GET_SAVED_FILE_INFO = 'getSavedFileInfo'
export const API_GET_SAVED_FILE_LIST = 'getSavedFileList'
export const API_REMOVE_SAVED_FILE = 'removeSavedFile'
export const SaveFileApiProtocol = new Map<string, ProtocolOptions>([
[
'tempFilePath',
{
type: 'string',
required: true
}
]
])
export const GetFileInfoApiProtocol = new Map<string, ProtocolOptions>([
[
'filePath',
{
type: 'string',
required: true
}
],
[
'digestAlgorithm',
{
type: 'string',
required: false
}
]
])
export const GetSavedFileInfoApiProtocol = new Map<string, ProtocolOptions>([
[
'filePath',
{
type: 'string',
required: true
}
]
])
export const RemoveSavedFileApiProtocol = new Map<string, ProtocolOptions>([
[
'filePath',
{
type: 'string',
required: true
}
]
])
uni_modules/uni-getLocation-tencent/utssdk/app-ios/info.plist
浏览文件 @
911735e0
...
...
@@ -2,13 +2,6 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist
version=
"1.0"
>
<dict>
<key>
TencentLBSAPIKey
</key>
<string>
WZCBZ-OLPCU-TJJVJ-4LZTE-SSG5O-6JFEM
</string>
<key>
UIBackgroundModes
</key>
<array>
<string>
location
</string>
</array>
<key>
NSLocationAlwaysAndWhenInUseUsageDescription
</key>
<string>
允许使用定位权限吗
</string>
<key>
NSLocationAlwaysUsageDescription
</key>
...
...
uni_modules/uni-getSystemInfo/utssdk/interface.uts
浏览文件 @
911735e0
...
...
@@ -2109,8 +2109,8 @@ export type GetWindowInfoResult = {
/**
* 窗口上边缘的 y 值,单位为px
*
* @uniPlatform
* @deprecated 已废弃,仅为了向下兼容保留
* @uniPlatform
* {
* "app": {
* "android": {
...
...
uni_modules/uni-keyboard/changelog.md
0 → 100644
浏览文件 @
911735e0
uni_modules/uni-keyboard/package.json
0 → 100644
浏览文件 @
911735e0
{
"id"
:
"uni-exit"
,
"displayName"
:
"uni-exit"
,
"version"
:
"1.0.0"
,
"description"
:
"uni-exit"
,
"keywords"
:
[
"uni-exit"
],
"repository"
:
""
,
"engines"
:
{
"HBuilderX"
:
"^3.6.8"
},
"dcloudext"
:
{
"type"
:
"uts"
,
"sale"
:
{
"regular"
:
{
"price"
:
"0.00"
},
"sourcecode"
:
{
"price"
:
"0.00"
}
},
"contact"
:
{
"qq"
:
""
},
"declaration"
:
{
"ads"
:
""
,
"data"
:
""
,
"permissions"
:
""
},
"npmurl"
:
""
},
"uni_modules"
:
{
"dependencies"
:
[],
"uni-ext-api"
:
{
"uni"
:
{
"hideKeyboard"
:
{
"name"
:
"hideKeyboard"
,
"app"
:
{
"js"
:
false
,
"kotlin"
:
false
,
"swift"
:
false
,
"arkts"
:
true
}
}
}
},
"encrypt"
:
[],
"platforms"
:
{
"cloud"
:
{
"tcb"
:
"u"
,
"aliyun"
:
"u"
},
"client"
:
{
"Vue"
:
{
"vue2"
:
"y"
,
"vue3"
:
"y"
},
"App"
:
{
"app-android"
:
"y"
,
"app-ios"
:
"u"
},
"H5-mobile"
:
{
"Safari"
:
"u"
,
"Android Browser"
:
"u"
,
"微信浏览器(Android)"
:
"u"
,
"QQ浏览器(Android)"
:
"u"
},
"H5-pc"
:
{
"Chrome"
:
"u"
,
"IE"
:
"u"
,
"Edge"
:
"u"
,
"Firefox"
:
"u"
,
"Safari"
:
"u"
},
"小程序"
:
{
"微信"
:
"u"
,
"阿里"
:
"u"
,
"百度"
:
"u"
,
"字节跳动"
:
"u"
,
"QQ"
:
"u"
,
"钉钉"
:
"u"
,
"快手"
:
"u"
,
"飞书"
:
"u"
,
"京东"
:
"u"
},
"快应用"
:
{
"华为"
:
"u"
,
"联盟"
:
"u"
}
}
}
}
}
uni_modules/uni-keyboard/readme.md
0 → 100644
浏览文件 @
911735e0
# uni-keyboard
### 开发文档
[
UTS 语法
](
https://uniapp.dcloud.net.cn/tutorial/syntax-uts.html
)
[
UTS API插件
](
https://uniapp.dcloud.net.cn/plugin/uts-plugin.html
)
[
UTS 组件插件
](
https://uniapp.dcloud.net.cn/plugin/uts-component.html
)
[
Hello UTS
](
https://gitcode.net/dcloud/hello-uts
)
uni_modules/uni-keyboard/utssdk/app-harmony/index.uts
0 → 100644
浏览文件 @
911735e0
import { UTSHarmony } from "@dcloudio/uni-runtime"
import {
API_HIDE_KEYBOARD
} from '../protocol.uts'
import {
HideKeyboardOptions,
HideKeyboardSuccess,
HideKeyboardFail,
HideKeyboard
} from '../interface.uts'
import inputMethod from '@ohos.inputMethod';
export {
HideKeyboardOptions,
HideKeyboardSuccess,
HideKeyboardFail,
}
export const hideKeyboard: HideKeyboard = defineAsyncApi<HideKeyboardOptions, HideKeyboardSuccess>(
API_HIDE_KEYBOARD,
function (options: HideKeyboardOptions, exec: ApiExecutor<HideKeyboardSuccess>) {
inputMethod.getController().hideTextInput().then(() => {
exec.resolve()
}, (err: Error) => {
exec.reject(err.message)
})
}
) as HideKeyboard
uni_modules/uni-keyboard/utssdk/interface.uts
0 → 100644
浏览文件 @
911735e0
/**
* uni.hideKeyboard成功回调参数
*/
export type HideKeyboardSuccess = {}
export type HideKeyboardFail = {}
/**
* uni.hideKeyboard成功回调函数定义
*/
export type HideKeyboardSuccessCallback = (res: HideKeyboardSuccess) => void
/**
* uni.hideKeyboard失败回调函数定义
*/
export type HideKeyboardFailCallback = (res: HideKeyboardFail) => void
/**
* uni.hideKeyboard完成回调函数定义
*/
export type HideKeyboardCompleteCallback = (res: any) => void
/**
* uni.hideKeyboard参数定义
*/
export type HideKeyboardOptions = {
/**
* 接口调用成功的回调函数
*/
success?: HideKeyboardSuccessCallback | null,
/**
* 接口调用失败的回调函数
*/
fail?: HideKeyboardFailCallback | null,
/**
* 接口调用结束的回调函数(调用成功、失败都会执行)
*/
complete?: HideKeyboardCompleteCallback | null
}
export interface Uni {
/**
* 隐藏键盘
* @uniPlatform {
* "app": {
* "harmony": {
* "osVer": "3.0",
* "uniVer": "4.23",
* "unixVer": "x"
* }
* },
* "web": {
* "uniVer": "√",
* "unixVer": "4.0"
* }
* }
* @uniVueVersion 2,3 //支持的vue版本
*/
hideKeyboard(options?: HideKeyboardOptions | null): void;
}
export type HideKeyboard = (options?: HideKeyboardOptions | null) => void;
uni_modules/uni-keyboard/utssdk/protocol.uts
0 → 100644
浏览文件 @
911735e0
export const API_HIDE_KEYBOARD = 'hideKeyboard'
uni_modules/uni-makePhoneCall/changelog.md
0 → 100644
浏览文件 @
911735e0
uni_modules/uni-makePhoneCall/package.json
0 → 100644
浏览文件 @
911735e0
{
"id"
:
"uni-makePhoneCall"
,
"displayName"
:
"uni-makePhoneCall"
,
"version"
:
"1.0.0"
,
"description"
:
"uni-makePhoneCall"
,
"keywords"
:
[
"uni-makePhoneCall"
],
"repository"
:
""
,
"engines"
:
{
"HBuilderX"
:
"^3.6.8"
},
"dcloudext"
:
{
"type"
:
"uts"
,
"sale"
:
{
"regular"
:
{
"price"
:
"0.00"
},
"sourcecode"
:
{
"price"
:
"0.00"
}
},
"contact"
:
{
"qq"
:
""
},
"declaration"
:
{
"ads"
:
""
,
"data"
:
""
,
"permissions"
:
""
},
"npmurl"
:
""
},
"uni_modules"
:
{
"dependencies"
:
[],
"uni-ext-api"
:
{
"uni"
:
{
"makePhoneCall"
:
{
"name"
:
"makePhoneCall"
,
"app"
:
{
"js"
:
false
,
"kotlin"
:
false
,
"swift"
:
false
,
"arkts"
:
true
}
}
}
},
"encrypt"
:
[],
"platforms"
:
{
"cloud"
:
{
"tcb"
:
"u"
,
"aliyun"
:
"u"
},
"client"
:
{
"Vue"
:
{
"vue2"
:
"u"
,
"vue3"
:
"u"
},
"App"
:
{
"app-android"
:
"u"
,
"app-ios"
:
"u"
},
"H5-mobile"
:
{
"Safari"
:
"u"
,
"Android Browser"
:
"u"
,
"微信浏览器(Android)"
:
"u"
,
"QQ浏览器(Android)"
:
"u"
},
"H5-pc"
:
{
"Chrome"
:
"u"
,
"IE"
:
"u"
,
"Edge"
:
"u"
,
"Firefox"
:
"u"
,
"Safari"
:
"u"
},
"小程序"
:
{
"微信"
:
"u"
,
"阿里"
:
"u"
,
"百度"
:
"u"
,
"字节跳动"
:
"u"
,
"QQ"
:
"u"
,
"钉钉"
:
"u"
,
"快手"
:
"u"
,
"飞书"
:
"u"
,
"京东"
:
"u"
},
"快应用"
:
{
"华为"
:
"u"
,
"联盟"
:
"u"
}
}
}
}
}
uni_modules/uni-makePhoneCall/readme.md
0 → 100644
浏览文件 @
911735e0
# uni-makePhoneCall
### 开发文档
[
UTS 语法
](
https://uniapp.dcloud.net.cn/tutorial/syntax-uts.html
)
[
UTS 原生插件
](
https://uniapp.dcloud.net.cn/plugin/uts-plugin.html
)
[
Hello UTS
](
https://gitcode.net/dcloud/hello-uts/-/tree/dev
)
uni_modules/uni-makePhoneCall/utssdk/app-harmony/index.uts
0 → 100644
浏览文件 @
911735e0
import { UTSHarmony } from '@dcloudio/uni-runtime';
import { BusinessError } from '@kit.BasicServicesKit'
import call from '@ohos.telephony.call'
import { MakePhoneCall, MakePhoneCallOptions, MakePhoneCallSuccess } from '../interface.uts';
import { API_MAKE_PHONE_CALL, MakePhoneCallProtocol } from '../protocol.uts';
export { MakePhoneCall, MakePhoneCallOptions, MakePhoneCallSuccess }
function isPromise(res: any) {
if ((typeof res === "object" || typeof res === "function") && typeof (res as Promise<void>).then === "function") {
return true;
}
return false
}
function dial(number: string, confirm = true) {
if (!confirm && typeof call.dial === 'function') {
return new Promise<void>((resolve, reject) => {
UTSHarmony.requestSystemPermission(['ohos.permission.PLACE_CALL'], (allRight: boolean) => {
if (allRight) {
call
.dial(number)
.then(() => {
resolve()
})
.catch(reject)
} else {
reject('permission denied')
}
}, () => {
reject('permission denied')
})
})
} else {
return call.makeCall(number)
}
}
export const makePhoneCall: MakePhoneCall = defineAsyncApi<MakePhoneCallOptions, MakePhoneCallSuccess>(
API_MAKE_PHONE_CALL,
(options: MakePhoneCallOptions, res: ApiExecutor<MakePhoneCallSuccess>) => {
const dialRes = dial(options.phoneNumber) as unknown as Promise<void>
if (isPromise(dialRes)) {
dialRes
.then(res.resolve)
.catch((err: BusinessError<void>) => {
res.reject(err.message)
})
} else {
res.resolve()
}
},
MakePhoneCallProtocol
) as MakePhoneCall
uni_modules/uni-makePhoneCall/utssdk/interface.uts
0 → 100644
浏览文件 @
911735e0
export interface Uni {
/**
* 拨打电话
*
* @tutorial https://uniapp.dcloud.net.cn/api/system/phone.html#makephonecall
* @tutorial-uni-app https://uniapp.dcloud.net.cn/api/system/phone.html#makephonecall
* @uniPlatform {
* "app": {
* "android": {
* "osVer": "5.0",
* "uniVer": "√",
* "unixVer": "x"
* },
* "ios": {
* "osVer": "12.0",
* "uniVer": "√",
* "unixVer": "x"
* },
* "harmony": {
* "osVer": "3.0",
* "uniVer": "4.23",
* "unixVer": "x"
* }
* },
* "mp": {
* "weixin": {
* "hostVer": "√",
* "uniVer": "√",
* "unixVer": "x"
* },
* "alipay": {
* "hostVer": "√",
* "uniVer": "√",
* "unixVer": "x"
* },
* "baidu": {
* "hostVer": "√",
* "uniVer": "√",
* "unixVer": "x"
* },
* "toutiao": {
* "hostVer": "√",
* "uniVer": "√",
* "unixVer": "x"
* },
* "lark": {
* "hostVer": "√",
* "uniVer": "√",
* "unixVer": "√"
* },
* "qq": {
* "hostVer": "√",
* "uniVer": "√",
* "unixVer": "x"
* },
* "kuaishou": {
* "hostVer": "√",
* "uniVer": "√",
* "unixVer": "x"
* },
* "jd": {
* "hostVer": "√",
* "uniVer": "√",
* "unixVer": "x"
* }
* },
* "web": {
* "uniVer": "√",
* "unixVer": "4.0"
* }
* }
*/
makePhoneCall: MakePhoneCall;
}
export type MakePhoneCall = (options: MakePhoneCallOptions) => void;
export type MakePhoneCallSuccess = {};
export type MakePhoneCallSuccessCallback = (result: MakePhoneCallSuccess) => void;
export type MakePhoneCallFail = UniError;
export type MakePhoneCallFailCallback = (result: MakePhoneCallFail) => void;
export type MakePhoneCallComplete = any;
export type MakePhoneCallCompleteCallback = (result: MakePhoneCallComplete) => void;
export type MakePhoneCallOptions = {
/**
* 需要拨打的电话号码
*/
phoneNumber: string,
/**
* 成功返回的回调函数
*/
success?: MakePhoneCallSuccessCallback | null,
/**
* 失败的回调函数
*/
fail?: MakePhoneCallFailCallback | null,
/**
* 结束的回调函数(调用成功、失败都会执行)
*/
complete?: MakePhoneCallCompleteCallback | null
};
uni_modules/uni-makePhoneCall/utssdk/protocol.uts
0 → 100644
浏览文件 @
911735e0
export const API_MAKE_PHONE_CALL = 'makePhoneCall'
export const MakePhoneCallProtocol = new Map<string, ProtocolOptions>([
[
'phoneNumber',
{
type: 'string',
required: true,
}
]
])
uni_modules/uni-media/utssdk/app-android/index.uts
浏览文件 @
911735e0
...
...
@@ -17,7 +17,7 @@ import {
} from "../unierror.uts"
import { chooseMediaImage, chooseMediaVideo } from "./utils/ChooseMediaUtils.uts"
import { transcodeImage, transcodeVideo } from './utils/CompressUtils.uts'
import { getVideoMetadata } from "./utils/MediaUtils.uts"
import { getVideoMetadata
, copyFile
} from "./utils/MediaUtils.uts"
import Intent from 'android.content.Intent';
import Manifest from 'android.Manifest';
import Build from 'android.os.Build';
...
...
@@ -258,10 +258,16 @@ class ImageInfoTarget extends CustomTarget<File> {
function getExif(src : string, options : GetImageInfoOptions, bitmapOption : BitmapFactory.Options | null) {
var exifInfo : ExifInterface | null = null
if(bitmapOption == null) {
bitmapOption = new BitmapFactory.Options();
bitmapOption.inJustDecodeBounds = true;
}
if (src.startsWith(ASSETS_PATH)) {
exifInfo = new ExifInterface(UTSAndroid.getUniActivity()!.getAssets().open(src.replace(ASSETS_PATH, "")));
BitmapFactory.decodeStream(UTSAndroid.getUniActivity()!.getAssets().open(src.replace(ASSETS_PATH, "")), null, bitmapOption)
} else if (new File(src).exists()) {
exifInfo = new ExifInterface(src)
BitmapFactory.decodeFile(src, bitmapOption)
} else {
let imageInfoCallback = new MediaErrorImpl(1101003, UniError_GetImageInfo);
options.fail?.(imageInfoCallback)
...
...
@@ -269,11 +275,6 @@ function getExif(src : string, options : GetImageInfoOptions, bitmapOption : Bit
return
}
try {
if (bitmapOption == null) {
bitmapOption = new BitmapFactory.Options();
bitmapOption.inJustDecodeBounds = true;
BitmapFactory.decodeFile(src, bitmapOption)
}
let width = bitmapOption!.outWidth
let height = bitmapOption!.outHeight
let mimeType : string = bitmapOption!.outMimeType
...
...
@@ -326,53 +327,6 @@ function getExif(src : string, options : GetImageInfoOptions, bitmapOption : Bit
}
}
function copyFile(fromFilePath : string, toFilePath : string) : boolean {
var fis : InputStream | null = null
try {
if (fromFilePath.startsWith(ASSETS_PATH)) {
fis = UTSAndroid.getUniActivity()!.getAssets().open(fromFilePath.replace(ASSETS_PATH, ""));
} else {
let fromFile = new File(fromFilePath)
if (!fromFile.exists()) {
return false;
}
if (!fromFile.isFile()) {
return false
}
if (!fromFile.canRead()) {
return false;
}
fis = new FileInputStream(fromFile);
}
if (fis == null) {
return false
}
} catch (e) {
return false;
}
let toFile = new File(toFilePath)
if (!toFile.getParentFile().exists()) {
toFile.getParentFile().mkdirs()
}
if (!toFile.exists()) {
toFile.createNewFile()
}
try {
let fos = new FileOutputStream(toFile)
let byteArrays = ByteArray(1024)
var c = fis!!.read(byteArrays)
while (c > 0) {
fos.write(byteArrays, 0, c)
c = fis!!.read(byteArrays)
}
fis!!.close()
fos.close()
return true
} catch (e) {
return false;
}
}
export const saveImageToPhotosAlbum : SaveImageToPhotosAlbum = function (options : SaveImageToPhotosAlbumOptions) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
let requestPermissionList : Array<string> = [Manifest.permission.WRITE_EXTERNAL_STORAGE]
...
...
uni_modules/uni-media/utssdk/app-android/utils/MediaUtils.uts
浏览文件 @
911735e0
...
...
@@ -5,12 +5,18 @@ import {
UniError_GetVideoInfo,
MediaErrorImpl
} from "../../unierror.uts"
import File from 'java.io.File';
import MediaMetadataRetriever from 'android.media.MediaMetadataRetriever';
import BigDecimal from 'java.math.BigDecimal';
import MediaExtractor from 'android.media.MediaExtractor';
import MediaFormat from 'android.media.MediaFormat';
import TextUtils from 'android.text.TextUtils';
import FileOutputStream from 'java.io.FileOutputStream';
import FileInputStream from 'java.io.FileInputStream';
import InputStream from 'java.io.InputStream';
const ASSETS_PATH = '/android_asset/'
export function getVideoMetadata(src : string) : any {
let videoInfo : GetVideoInfoSuccess = {
...
...
@@ -19,7 +25,16 @@ export function getVideoMetadata(src : string) : any {
height: 0,
width: 0
}
let path = UTSAndroid.convert2AbsFullPath(src)
var path = UTSAndroid.convert2AbsFullPath(src)
if (path.startsWith("/android_asset/")) {
var mediaCachePath = UTSAndroid.getAppCachePath() + "uni-media/_" + System.currentTimeMillis()
if (copyFile(path, mediaCachePath)) {
path = mediaCachePath
} else {
let error = new MediaErrorImpl(1101010, UniError_GetVideoInfo);
return error
}
}
let videoFile = new File(path)
if (!videoFile.exists()) {
let error = new MediaErrorImpl(1101003, UniError_GetVideoInfo);
...
...
@@ -97,4 +112,52 @@ export function getVideoMetadata(src : string) : any {
let error = new MediaErrorImpl(1101010, UniError_GetVideoInfo);
return error
}
}
export function copyFile(fromFilePath : string, toFilePath : string) : boolean {
var fis : InputStream | null = null
try {
if (fromFilePath.startsWith(ASSETS_PATH)) {
fis = UTSAndroid.getUniActivity()!.getAssets().open(fromFilePath.replace(ASSETS_PATH, ""));
} else {
let fromFile = new File(fromFilePath)
if (!fromFile.exists()) {
return false;
}
if (!fromFile.isFile()) {
return false
}
if (!fromFile.canRead()) {
return false;
}
fis = new FileInputStream(fromFile);
}
if (fis == null) {
return false
}
} catch (e) {
return false;
}
let toFile = new File(toFilePath)
if (!toFile.getParentFile().exists()) {
toFile.getParentFile().mkdirs()
}
if (!toFile.exists()) {
toFile.createNewFile()
}
try {
let fos = new FileOutputStream(toFile)
let byteArrays = ByteArray(1024)
var c = fis!!.read(byteArrays)
while (c > 0) {
fos.write(byteArrays, 0, c)
c = fis!!.read(byteArrays)
}
fis!!.close()
fos.close()
return true
} catch (e) {
return false;
}
}
\ No newline at end of file
uni_modules/uni-media/utssdk/app-ios/index.uts
浏览文件 @
911735e0
...
...
@@ -175,9 +175,15 @@ export const getImageInfo : GetImageInfo = function (options : GetImageInfoOptio
if (options.src.length > 0) {
if (isNetUrl(options.src)) {
UTSiOS.loadImage(options.src, (image, data) => {
if (data != null && image != null) {
const type = getImageFormat(data!);
const path = saveImage(data!, type);
if (image != null) {
let imageData : Data | null = null;
if(data != null){
imageData = data;
}else{
imageData = image!.jpegData(compressionQuality= 1.0);
}
const type = getImageFormat(imageData!);
const path = saveImage(imageData!, type);
if (path.count > 0) {
DispatchQueue.main.async(execute = () : void => {
let successCallback : GetImageInfoSuccess = {
...
...
uni_modules/uni-media/utssdk/interface.uts
浏览文件 @
911735e0
...
...
@@ -115,7 +115,6 @@ export type ChooseImageOptions = {
count ?: (number) | null,
/**
* original 原图,compressed 压缩图,默认二者都有
* @type string | string []
* @defaultValue ['original','compressed']
* @uniPlatform {
* "app":{
...
...
@@ -250,6 +249,30 @@ export type PreviewImageOptions = {
urls : Array<string.ImageURIString>,
/**
* 是否显示长按菜单
*
* @uniPlatform {
* "app": {
* "android": {
* "osVer": "5.0",
* "uniVer": "√",
* "unixVer": "x"
* },
* "ios": {
* "osVer": "10.0",
* "uniVer": "√",
* "unixVer": "x"
* },
* "harmony": {
* "osVer": "3.0",
* "uniVer": "4.23",
* "unixVer": "x"
* }
* },
* "web": {
* "uniVer": "√",
* "unixVer": "4.0"
* }
* }
*/
showmenu ?: boolean | null,
/**
...
...
uni_modules/uni-openDocument/changelog.md
0 → 100644
浏览文件 @
911735e0
uni_modules/uni-openDocument/package.json
0 → 100644
浏览文件 @
911735e0
{
"id"
:
"uni-openDocument"
,
"displayName"
:
"uni-openDocument"
,
"version"
:
"1.0.0"
,
"description"
:
"uni-openDocument"
,
"keywords"
:
[
"uni-openDocument"
],
"repository"
:
""
,
"engines"
:
{
"HBuilderX"
:
"^3.6.8"
},
"dcloudext"
:
{
"type"
:
"uts"
,
"sale"
:
{
"regular"
:
{
"price"
:
"0.00"
},
"sourcecode"
:
{
"price"
:
"0.00"
}
},
"contact"
:
{
"qq"
:
""
},
"declaration"
:
{
"ads"
:
""
,
"data"
:
""
,
"permissions"
:
""
},
"npmurl"
:
""
},
"uni_modules"
:
{
"dependencies"
:
[],
"uni-ext-api"
:
{
"uni"
:
{
"openDocument"
:
{
"name"
:
"openDocument"
,
"app"
:
{
"js"
:
false
,
"kotlin"
:
false
,
"swift"
:
false
,
"arkts"
:
true
}
}
}
},
"encrypt"
:
[],
"platforms"
:
{
"cloud"
:
{
"tcb"
:
"u"
,
"aliyun"
:
"u"
},
"client"
:
{
"Vue"
:
{
"vue2"
:
"y"
,
"vue3"
:
"y"
},
"App"
:
{
"app-android"
:
"y"
,
"app-ios"
:
"u"
},
"H5-mobile"
:
{
"Safari"
:
"u"
,
"Android Browser"
:
"u"
,
"微信浏览器(Android)"
:
"u"
,
"QQ浏览器(Android)"
:
"u"
},
"H5-pc"
:
{
"Chrome"
:
"u"
,
"IE"
:
"u"
,
"Edge"
:
"u"
,
"Firefox"
:
"u"
,
"Safari"
:
"u"
},
"小程序"
:
{
"微信"
:
"u"
,
"阿里"
:
"u"
,
"百度"
:
"u"
,
"字节跳动"
:
"u"
,
"QQ"
:
"u"
,
"钉钉"
:
"u"
,
"快手"
:
"u"
,
"飞书"
:
"u"
,
"京东"
:
"u"
},
"快应用"
:
{
"华为"
:
"u"
,
"联盟"
:
"u"
}
}
}
}
}
uni_modules/uni-openDocument/readme.md
0 → 100644
浏览文件 @
911735e0
# uni-openDocument
### 开发文档
[
UTS 语法
](
https://uniapp.dcloud.net.cn/tutorial/syntax-uts.html
)
[
UTS API插件
](
https://uniapp.dcloud.net.cn/plugin/uts-plugin.html
)
[
UTS 组件插件
](
https://uniapp.dcloud.net.cn/plugin/uts-component.html
)
[
Hello UTS
](
https://gitcode.net/dcloud/hello-uts
)
uni_modules/uni-openDocument/utssdk/app-harmony/index.uts
0 → 100644
浏览文件 @
911735e0
import {
API_OPEN_DOCUMENT
} from '../protocol.uts'
import {
OpenDocumentFail,
OpenDocumentSuccess,
OpenDocumentOptions,
OpenDocument
} from '../interface.uts'
import {
getAbilityContext
} from '@dcloudio/uni-runtime'
import fileUri from '@ohos.file.fileuri';
import Want from '@ohos.app.ability.Want';
import wantConstant from '@ohos.app.ability.wantConstant';
import common from '@ohos.app.ability.common';
export {
OpenDocumentFail,
OpenDocumentSuccess,
OpenDocumentOptions,
}
function getContentType(filePath: string, fileType?: string | null): string | void {
const suffix = fileType || filePath.split('.').pop();
if (!suffix) {
return;
}
switch (suffix) {
case 'doc':
case 'docx':
return 'application/msword';
case 'xls':
case 'xlsx':
return 'application/vnd.ms-excel';
case 'ppt':
case 'pptx':
return 'application/vnd.ms-powerpoint';
case 'pdf':
return 'application/pdf';
default:
return;
}
}
export const openDocument: OpenDocument = defineAsyncApi<OpenDocumentOptions, OpenDocumentSuccess>(
API_OPEN_DOCUMENT,
function (options: OpenDocumentOptions, exec: ApiExecutor<OpenDocumentSuccess>) {
const filePath = options.filePath
const uri = fileUri.getUriFromPath(filePath.replace(/^file:\/\//, ''));
const fileContentType = getContentType(filePath, options.fileType);
if (!fileContentType) {
exec.reject('file type not supported');
return
}
const want: Want = {
flags: wantConstant.Flags.FLAG_AUTH_WRITE_URI_PERMISSION | wantConstant.Flags.FLAG_AUTH_READ_URI_PERMISSION | wantConstant.Flags.FLAG_AUTH_PERSISTABLE_URI_PERMISSION,
action: 'ohos.want.action.sendData',
uri: uri,
type: fileContentType as string
}
const abilityContext = getAbilityContext() as common.UIAbilityContext
abilityContext.startAbility(want).then(() => {
exec.resolve({} as OpenDocumentSuccess)
}, (err: Error) => {
exec.reject(err.message);
})
}
) as OpenDocument
uni_modules/uni-openDocument/utssdk/interface.uts
0 → 100644
浏览文件 @
911735e0
/**
* uni.openDocument成功回调参数
*/
export type OpenDocumentSuccess = {}
export type OpenDocumentFail = {}
/**
* uni.openDocument成功回调函数定义
*/
export type OpenDocumentSuccessCallback = (res: OpenDocumentSuccess) => void
/**
* uni.openDocument失败回调函数定义
*/
export type OpenDocumentFailCallback = (res: OpenDocumentFail) => void
/**
* uni.openDocument完成回调函数定义
*/
export type OpenDocumentCompleteCallback = (res: any) => void
export type OpenDocumentSupportedTypes = 'doc' | 'xls' | 'ppt' | 'pdf' | 'docx' | 'xlsx' | 'pptx'
/**
* uni.openDocument参数定义
*/
export type OpenDocumentOptions = {
/**
* 文件路径,仅支持本地路径
*/
filePath: string,
/**
* 文件类型,指定文件类型打开文件,有效值 doc, xls, ppt, pdf, docx, xlsx, pptx
*/
fileType?: OpenDocumentSupportedTypes | null,
/**
* 接口调用成功的回调函数
*/
success?: OpenDocumentSuccessCallback | null,
/**
* 接口调用失败的回调函数
*/
fail?: OpenDocumentFailCallback | null,
/**
* 接口调用结束的回调函数(调用成功、失败都会执行)
*/
complete?: OpenDocumentCompleteCallback | null
}
export interface Uni {
/**
* 打开文档
* @uniPlatform {
* "app": {
* "harmony": {
* "osVer": "3.0",
* "uniVer": "4.23",
* "unixVer": "x"
* }
* },
* "web": {
* "uniVer": "x",
* "unixVer": "x"
* }
* }
* @uniVueVersion 2,3 //支持的vue版本
*/
openDocument(options?: OpenDocumentOptions | null): void;
}
export type OpenDocument = (options?: OpenDocumentOptions | null) => void;
uni_modules/uni-openDocument/utssdk/protocol.uts
0 → 100644
浏览文件 @
911735e0
export const API_OPEN_DOCUMENT = 'openDocument'
uni_modules/uni-scanCode/changelog.md
0 → 100644
浏览文件 @
911735e0
uni_modules/uni-scanCode/package.json
0 → 100644
浏览文件 @
911735e0
{
"id"
:
"uni-scanCode"
,
"displayName"
:
"uni-scanCode"
,
"version"
:
"1.0.0"
,
"description"
:
"uni-scanCode"
,
"keywords"
:
[
"uni-scanCode"
],
"repository"
:
""
,
"engines"
:
{
"HBuilderX"
:
"^3.6.8"
},
"dcloudext"
:
{
"type"
:
"uts"
,
"sale"
:
{
"regular"
:
{
"price"
:
"0.00"
},
"sourcecode"
:
{
"price"
:
"0.00"
}
},
"contact"
:
{
"qq"
:
""
},
"declaration"
:
{
"ads"
:
""
,
"data"
:
""
,
"permissions"
:
""
},
"npmurl"
:
""
},
"uni_modules"
:
{
"dependencies"
:
[],
"uni-ext-api"
:
{
"uni"
:
{
"scanCode"
:
{
"name"
:
"scanCode"
,
"app"
:
{
"js"
:
false
,
"kotlin"
:
false
,
"swift"
:
false
,
"arkts"
:
true
}
}
}
},
"encrypt"
:
[],
"platforms"
:
{
"cloud"
:
{
"tcb"
:
"u"
,
"aliyun"
:
"u"
},
"client"
:
{
"Vue"
:
{
"vue2"
:
"y"
,
"vue3"
:
"y"
},
"App"
:
{
"app-android"
:
"y"
,
"app-ios"
:
"u"
},
"H5-mobile"
:
{
"Safari"
:
"u"
,
"Android Browser"
:
"u"
,
"微信浏览器(Android)"
:
"u"
,
"QQ浏览器(Android)"
:
"u"
},
"H5-pc"
:
{
"Chrome"
:
"u"
,
"IE"
:
"u"
,
"Edge"
:
"u"
,
"Firefox"
:
"u"
,
"Safari"
:
"u"
},
"小程序"
:
{
"微信"
:
"u"
,
"阿里"
:
"u"
,
"百度"
:
"u"
,
"字节跳动"
:
"u"
,
"QQ"
:
"u"
,
"钉钉"
:
"u"
,
"快手"
:
"u"
,
"飞书"
:
"u"
,
"京东"
:
"u"
},
"快应用"
:
{
"华为"
:
"u"
,
"联盟"
:
"u"
}
}
}
}
}
uni_modules/uni-scanCode/readme.md
0 → 100644
浏览文件 @
911735e0
# uni-scanCode
### 开发文档
[
UTS 语法
](
https://uniapp.dcloud.net.cn/tutorial/syntax-uts.html
)
[
UTS API插件
](
https://uniapp.dcloud.net.cn/plugin/uts-plugin.html
)
[
UTS 组件插件
](
https://uniapp.dcloud.net.cn/plugin/uts-component.html
)
[
Hello UTS
](
https://gitcode.net/dcloud/hello-uts
)
uni_modules/uni-scanCode/utssdk/app-harmony/index.uts
0 → 100644
浏览文件 @
911735e0
import {
API_SCAN_CODE
} from '../protocol.uts'
import {
ScanCodeFail,
ScanCodeSuccess,
ScanCodeOptions,
ScanCodeSupportedTypes,
ScanCode
} from '../interface.uts'
import {
getAbilityContext
} from '@dcloudio/uni-runtime'
import { scanCore, scanBarcode } from '@kit.ScanKit';
export {
ScanCodeFail,
ScanCodeSuccess,
ScanCodeOptions,
}
let supportedScanTypesMap: Map<ScanCodeSupportedTypes, scanCore.ScanType>
function initScanTypesMapOnce() {
if (supportedScanTypesMap) {
return
}
supportedScanTypesMap = new Map<ScanCodeSupportedTypes, scanCore.ScanType>([
['barCode', scanCore.ScanType.CODABAR_CODE],
['qrCode', scanCore.ScanType.QR_CODE],
['datamatrix', scanCore.ScanType.DATAMATRIX_CODE],
['pdf417', scanCore.ScanType.PDF417_CODE]
]);
}
function getUniScanType(scanType: scanCore.ScanType): ScanCodeSupportedTypes {
for (const [key, value] of supportedScanTypesMap.entries()) {
if (value === scanType) {
return key;
}
}
return 'qrCode';
}
export const scanCode: ScanCode = defineAsyncApi<ScanCodeOptions, ScanCodeSuccess>(
API_SCAN_CODE,
function (options: ScanCodeOptions, exec: ApiExecutor<ScanCodeSuccess>) {
if (!canIUse('SystemCapability.Multimedia.Scan.ScanBarcode')) {
exec.reject('not support');
return
}
initScanTypesMapOnce();
let scanTypes: scanCore.ScanType[] = [scanCore.ScanType.ALL];
if (options.scanType && Array.isArray(options.scanType) && options.scanType.length > 0) {
scanTypes = options.scanType.filter((type) => {
return supportedScanTypesMap.has(type);
}).map((type) => {
return supportedScanTypesMap.get(type)!;
})
}
const scanOptions: scanBarcode.ScanOptions = {
scanTypes,
enableMultiMode: true,
enableAlbum: !options.onlyFromCamera
};
scanBarcode.startScanForResult(getAbilityContext()!, scanOptions, (err, data) => {
if (err) {
exec.reject(err.message);
return;
}
exec.resolve({
result: data.originalValue,
scanType: getUniScanType(data.scanType),
} as ScanCodeSuccess)
})
}
) as ScanCode
uni_modules/uni-scanCode/utssdk/interface.uts
0 → 100644
浏览文件 @
911735e0
/**
* uni.scanCode成功回调参数
*/
export type ScanCodeSuccess = {
result: string,
scanType: ScanCodeSupportedTypes
}
export type ScanCodeFail = {}
/**
* uni.scanCode成功回调函数定义
*/
export type ScanCodeSuccessCallback = (res: ScanCodeSuccess) => void
/**
* uni.scanCode失败回调函数定义
*/
export type ScanCodeFailCallback = (res: ScanCodeFail) => void
/**
* uni.scanCode完成回调函数定义
*/
export type ScanCodeCompleteCallback = (res: any) => void
export type ScanCodeSupportedTypes = 'barCode' | 'qrCode' | 'datamatrix' | 'pdf417'
/**
* uni.scanCode参数定义
*/
export type ScanCodeOptions = {
/**
* 是否只能从相机扫码,不允许从相册选择图片
*/
onlyFromCamera?: boolean | null,
/**
* 扫码类型
*/
scanType?: ScanCodeSupportedTypes[] | null,
/**
* 接口调用成功的回调函数
*/
success?: ScanCodeSuccessCallback | null,
/**
* 接口调用失败的回调函数
*/
fail?: ScanCodeFailCallback | null,
/**
* 接口调用结束的回调函数(调用成功、失败都会执行)
*/
complete?: ScanCodeCompleteCallback | null
}
export interface Uni {
/**
* 扫码
* @uniPlatform {
* "app": {
* "harmony": {
* "osVer": "3.0",
* "uniVer": "4.23",
* "unixVer": "x"
* }
* },
* "web": {
* "uniVer": "x",
* "unixVer": "x"
* }
* }
* @uniVueVersion 2,3 //支持的vue版本
*/
scanCode(options?: ScanCodeOptions | null): void;
}
export type ScanCode = (options?: ScanCodeOptions | null) => void;
uni_modules/uni-scanCode/utssdk/protocol.uts
0 → 100644
浏览文件 @
911735e0
export const API_SCAN_CODE = 'scanCode'
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录