diff --git a/.editorconfig b/.editorconfig
new file mode 100644
index 0000000000000000000000000000000000000000..1a3af920b098c1460143e5f5ef5174933e03cb54
--- /dev/null
+++ b/.editorconfig
@@ -0,0 +1,9 @@
+root = true
+
+[*]
+charset = utf-8
+end_of_line = lf
+indent_style = space
+indent_size = 2
+trim_trailing_whitespace = true
+insert_final_newline = true
diff --git a/.gitignore b/.gitignore
index 4ad7b3d6dc1866b2cfbf34371fce162b9461ca41..f2126b3be1e90e9ea4198685c9f1c01c9f6afd61 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,15 @@
/unpackage
/.hbuilderx
/.vite
-.DS_Store
\ No newline at end of file
+.DS_Store
+<<<<<<< HEAD
+
+=======
+>>>>>>> dev
+env.js
+jest.config.js
+autotest.reporter.js
+autotest.utils.js
+pages/autotest/
+node_modules/
+vite.config.js
\ No newline at end of file
diff --git a/.hbuilderx/launch.json b/.hbuilderx/launch.json
index ad7c2a6be83a79900b8cac13428e51381e113455..cc4f2a1a439679c447b2f3bbe509db8e8c8870c5 100644
--- a/.hbuilderx/launch.json
+++ b/.hbuilderx/launch.json
@@ -14,8 +14,9 @@
},
{
"bundleId" : "io.dcloud.test123456",
- "certificateFile" : "/Users/lizhongyi/Desktop/文件/证书/dev_123.p12",
- "certificateProfileFile" : "/Users/lizhongyi/Desktop/文件/证书/io_dcloud_test123456.mobileprovision",
+ "certificateFile" : "/Users/lizhongyi/Desktop/newProfiles/dev_123.p12",
+ "certificateProfileFile" : "/Users/lizhongyi/Desktop/newProfiles/wildcard.mobileprovision",
+ "runSignStatus" : 1,
"type" : "uni-app:app-ios"
}
]
diff --git a/App.uvue b/App.uvue
new file mode 100644
index 0000000000000000000000000000000000000000..a1ead0e7dbceb3636d82303392c1df1e6b9f7a24
--- /dev/null
+++ b/App.uvue
@@ -0,0 +1,44 @@
+
+
+
\ No newline at end of file
diff --git a/jest.config.js b/jest.config.js
deleted file mode 100644
index a54d98aa885205fac0907af57739237f3a96af78..0000000000000000000000000000000000000000
--- a/jest.config.js
+++ /dev/null
@@ -1,11 +0,0 @@
-module.exports = {
- testTimeout: 10000,
- reporters: [
- 'default'
- ],
- watchPathIgnorePatterns: ['/node_modules/', '/dist/', '/.git/'],
- moduleFileExtensions: ['js', 'json'],
- rootDir: __dirname,
- testMatch: ["/pages/**/*test.[jt]s?(x)"],
- testPathIgnorePatterns: ['/node_modules/']
-}
diff --git a/main.uts b/main.uts
new file mode 100644
index 0000000000000000000000000000000000000000..89d8f152127b8105c47b6ef81680535f4dbbb40c
--- /dev/null
+++ b/main.uts
@@ -0,0 +1,9 @@
+import App from './App'
+
+import { createSSRApp } from 'vue'
+export function createApp() {
+ const app = createSSRApp(App)
+ return {
+ app
+ }
+}
\ No newline at end of file
diff --git a/manifest.json b/manifest.json
index 1932231622c1913f146f5403b48c72a749a88f09..00c791648f04722c7fa535d0b412975bc39c8f52 100644
--- a/manifest.json
+++ b/manifest.json
@@ -1,72 +1,56 @@
{
- "name": "uni-api",
- "appid": "__UNI__ED9218B",
- "description": "",
- "versionName": "1.0.0",
- "versionCode": "100",
- "transformPx": false,
- /* 5+App特有相关 */
- "app-plus": {
- "usingComponents": true,
- "nvueStyleCompiler": "uni-app",
- "compilerVersion": 3,
- "splashscreen": {
- "alwaysShowBeforeRender": true,
- "waiting": true,
- "autoclose": true,
- "delay": 0
- },
- /* 模块配置 */
- "modules": {},
- /* 应用发布信息 */
- "distribute": {
- /* android打包配置 */
- "android": {
- "permissions": [
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- ""
- ]
- },
- /* ios打包配置 */
- "ios": {},
- /* SDK配置 */
- "sdkConfigs": {}
- }
- },
- /* 快应用特有相关 */
- "quickapp": {},
- /* 小程序特有相关 */
- "mp-weixin": {
- "appid": "",
- "setting": {
- "urlCheck": false
- },
- "usingComponents": true
- },
- "mp-alipay": {
- "usingComponents": true
- },
- "mp-baidu": {
- "usingComponents": true
- },
- "mp-toutiao": {
- "usingComponents": true
- },
- "uniStatistics": {
- "enable": false
- },
- "vueVersion": "2"
+ "name": "uni-api",
+ "appid": "__UNI__8BF79AC",
+ "description": "uts插件示例",
+ "versionName": "1.0.0",
+ "versionCode": "100",
+ "transformPx": false,
+ /* uni-app x 特有相关 */
+ // "uni-app-x": {},
+ /* uni-app特有相关 */
+ "app-plus": {
+ "usingComponents": true,
+ "nvueStyleCompiler": "uni-app",
+ "compilerVersion": 3,
+ "splashscreen": {
+ "alwaysShowBeforeRender": true,
+ "waiting": true,
+ "autoclose": true,
+ "delay": 0
+ },
+ /* 模块配置 */
+ "modules": {},
+ /* 应用发布信息 */
+ "distribute": {
+ /* android打包配置 */
+ "android": {},
+ /* ios打包配置 */
+ "ios": {},
+ /* SDK配置 */
+ "sdkConfigs": {}
+ }
+ },
+ /* 快应用特有相关 */
+ "quickapp": {},
+ /* 小程序特有相关 */
+ "mp-weixin": {
+ "appid": "",
+ "setting": {
+ "urlCheck": false
+ },
+ "usingComponents": true
+ },
+ "mp-alipay": {
+ "usingComponents": true
+ },
+ "mp-baidu": {
+ "usingComponents": true
+ },
+ "mp-toutiao": {
+ "usingComponents": true
+ },
+ "uniStatistics": {
+ "enable": false
+ },
+ "vueVersion": "3"
}
diff --git a/pages.json b/pages.json
index 24f82b827fe2c372169caf32fe7b9b2b28fa4037..6b058a78a8022bffc1842eddf82e1e2a39244841 100644
--- a/pages.json
+++ b/pages.json
@@ -1,17 +1,24 @@
-{
- "pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages
- {
- "path": "pages/index/index",
- "style": {
- "navigationBarTitleText": "uni-app"
- }
- }
- ],
- "globalStyle": {
- "navigationBarTextStyle": "black",
- "navigationBarTitleText": "uni-app",
- "navigationBarBackgroundColor": "#F8F8F8",
- "backgroundColor": "#F8F8F8"
- },
- "uniIdRouter": {}
+{
+ "pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages
+ {
+ "path": "pages/index/index",
+ "style": {
+ "navigationBarTitleText": "uni-api"
+ }
+ },
+ {
+ "path": "pages/test/test",
+ "style": {
+ "navigationBarTitleText": "测试示例",
+ "enablePullDownRefresh": false
+ }
+ }
+ ],
+ "globalStyle": {
+ "navigationBarTextStyle": "black",
+ "navigationBarTitleText": "uni-app",
+ "navigationBarBackgroundColor": "#F8F8F8",
+ "backgroundColor": "#F8F8F8"
+ },
+ "uniIdRouter": {}
}
diff --git a/pages/index/index.nvue b/pages/index/index.nvue
new file mode 100644
index 0000000000000000000000000000000000000000..9e69fe2576991e0e8484e8d591331c09a53ea43d
--- /dev/null
+++ b/pages/index/index.nvue
@@ -0,0 +1,62 @@
+
+
+
+
+
+
+ {{title}}
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/pages/index/index.uvue b/pages/index/index.uvue
new file mode 100644
index 0000000000000000000000000000000000000000..9e69fe2576991e0e8484e8d591331c09a53ea43d
--- /dev/null
+++ b/pages/index/index.uvue
@@ -0,0 +1,62 @@
+
+
+
+
+
+
+ {{title}}
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/pages/test/test.uvue b/pages/test/test.uvue
new file mode 100644
index 0000000000000000000000000000000000000000..cdec1a4d60473152a178a6c9ec075b05a4bb8a4b
--- /dev/null
+++ b/pages/test/test.uvue
@@ -0,0 +1,28 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/pages/index/index.vue b/pages/test/test.vue
similarity index 51%
rename from pages/index/index.vue
rename to pages/test/test.vue
index f64e148578503d6c5cbc4b004ab9acff01ac86a3..1c4825d882b6dc4df8065e2378108f03c3d7924d 100644
--- a/pages/index/index.vue
+++ b/pages/test/test.vue
@@ -1,277 +1,388 @@
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
diff --git a/static/test.apk b/static/test.apk
new file mode 100644
index 0000000000000000000000000000000000000000..19c5e6c121de52104c6349f81a05f7c8c5fd4f91
Binary files /dev/null and b/static/test.apk differ
diff --git a/uni_modules/uni-exit/changelog.md b/uni_modules/uni-exit/changelog.md
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/uni_modules/uni-exit/package.json b/uni_modules/uni-exit/package.json
new file mode 100644
index 0000000000000000000000000000000000000000..88b270db3eeaea1b18e311d5e3f34f83da23dff4
--- /dev/null
+++ b/uni_modules/uni-exit/package.json
@@ -0,0 +1,93 @@
+{
+ "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": {
+ "exit": {
+ "name": "exit",
+ "app": {
+ "js": true,
+ "kotlin": true,
+ "swift": 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"
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/uni_modules/uni-exit/readme.md b/uni_modules/uni-exit/readme.md
new file mode 100644
index 0000000000000000000000000000000000000000..5f87433aa739aad67b3ae079031ca79c7961d1a3
--- /dev/null
+++ b/uni_modules/uni-exit/readme.md
@@ -0,0 +1,6 @@
+# uni-quit
+### 开发文档
+[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)
\ No newline at end of file
diff --git a/uni_modules/uni-exit/utssdk/app-android/index.uts b/uni_modules/uni-exit/utssdk/app-android/index.uts
new file mode 100644
index 0000000000000000000000000000000000000000..6019d642b2fb52c69992da92e1543813eb898702
--- /dev/null
+++ b/uni_modules/uni-exit/utssdk/app-android/index.uts
@@ -0,0 +1,15 @@
+import { ExitOptions, ExitSuccess, Exit } from "../interface.uts"
+
+
+/**
+ * 实现uni.exit
+ */
+export const exit : Exit = function (options: ExitOptions | null) {
+ let ret : ExitSuccess ={
+ errMsg: "exit:ok"
+ }
+ options?.success?.(ret)
+ options?.complete?.(ret)
+ UTSAndroid.exit()
+}
+
diff --git a/uni_modules/uni-exit/utssdk/app-ios/index.uts b/uni_modules/uni-exit/utssdk/app-ios/index.uts
new file mode 100644
index 0000000000000000000000000000000000000000..5be055badece05c639c6499763ec0b26db86fd07
--- /dev/null
+++ b/uni_modules/uni-exit/utssdk/app-ios/index.uts
@@ -0,0 +1,13 @@
+import { ExitOptions, Exit} from "../interface.uts"
+import { ExitFailImpl } from "../unierror.uts"
+
+
+/**
+ * 实现uni.exit
+ * iOS平台不支持,触发错误回调
+ */
+export const exit : Exit = function (options: ExitOptions | null) {
+ let err = new ExitFailImpl(12001);
+ options?.fail?.(err)
+ options?.complete?.(err)
+}
diff --git a/uni_modules/uni-exit/utssdk/interface.uts b/uni_modules/uni-exit/utssdk/interface.uts
new file mode 100644
index 0000000000000000000000000000000000000000..923b4ff3c45108b089c29ab768e1ac288f3e2226
--- /dev/null
+++ b/uni_modules/uni-exit/utssdk/interface.uts
@@ -0,0 +1,78 @@
+/**
+ * uni.exit成功回调参数
+ */
+export type ExitSuccess = {
+ errMsg: string
+}
+
+/**
+ * 错误码
+ * - 12001: 系统不支持
+ * - 12002: 未知错误
+ */
+export type ExitErrorCode = 12001 | 12002
+
+/**
+ * uni.exit失败回调参数
+ */
+export interface IExitError extends IUniError {
+ errCode: ExitErrorCode
+}
+export type ExitFail = IExitError
+
+/**
+ * uni.exit成功回调函数定义
+ */
+export type ExitSuccessCallback = (res: ExitSuccess) => void
+/**
+ * uni.exit失败回调函数定义
+ */
+export type ExitFailCallback = (res: ExitFail) => void
+/**
+ * uni.exit完成回调函数定义
+ */
+export type ExitCompleteCallback = (res: any) => void
+
+/**
+ * uni.exit参数定义
+ */
+export type ExitOptions = {
+ /**
+ * 接口调用成功的回调函数
+ */
+ success?: ExitSuccessCallback | null,
+ /**
+ * 接口调用失败的回调函数
+ */
+ fail?: ExitFailCallback | null,
+ /**
+ * 接口调用结束的回调函数(调用成功、失败都会执行)
+ */
+ complete?: ExitCompleteCallback | null
+}
+
+
+export interface Uni {
+
+ /**
+ * 退出当前应用
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "4.4.4",
+ * "uniVer": "3.8.15",
+ * "unixVer": "3.9.0"
+ * },
+ * "ios": {
+ * "osVer": "x",
+ * "uniVer": "x",
+ * "unixVer": "x"
+ * }
+ * }
+ * }
+ * @uniVueVersion 2,3 //支持的vue版本
+ */
+ exit(options?: ExitOptions | null):void;
+}
+
+export type Exit = (options?: ExitOptions | null) => void;
diff --git a/uni_modules/uni-exit/utssdk/unierror.uts b/uni_modules/uni-exit/utssdk/unierror.uts
new file mode 100644
index 0000000000000000000000000000000000000000..9b74feb0dce8a92485b9279bfd5c1e542d18d218
--- /dev/null
+++ b/uni_modules/uni-exit/utssdk/unierror.uts
@@ -0,0 +1,37 @@
+import { ExitErrorCode, IExitError } from "./interface.uts"
+
+/**
+ * 错误主题
+ */
+export const UniErrorSubject = 'uni-exit';
+
+
+/**
+ * 错误码
+ * @UniError
+ */
+export const UniErrors:Map = new Map([
+ /**
+ * 系统不支持
+ */
+ [12001, 'system not support'],
+ /**
+ * 未知错误
+ */
+ [12002, 'unknown error']
+]);
+
+/**
+ * ExitFail的实现
+ */
+export class ExitFailImpl extends UniError implements IExitError {
+ override errCode: ExitErrorCode
+ constructor (
+ errCode: ExitErrorCode
+ ) {
+ super()
+ this.errSubject = UniErrorSubject
+ this.errCode = errCode
+ this.errMsg = UniErrors[errCode] ?? "";
+ }
+}
diff --git a/uni_modules/uni-getAppAuthorizeSetting/changelog.md b/uni_modules/uni-getAppAuthorizeSetting/changelog.md
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/uni_modules/uni-getAppAuthorizeSetting/package.json b/uni_modules/uni-getAppAuthorizeSetting/package.json
new file mode 100644
index 0000000000000000000000000000000000000000..885069ae07ecd80230675ebb3d3c951d22642af1
--- /dev/null
+++ b/uni_modules/uni-getAppAuthorizeSetting/package.json
@@ -0,0 +1,93 @@
+{
+ "id": "uni-getAppAuthorizeSetting",
+ "displayName": "uni-getAppAuthorizeSetting",
+ "version": "1.0.0",
+ "description": "uni-getAppAuthorizeSetting",
+ "keywords": [
+ "uni-getAppAuthorizeSetting"
+],
+ "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": {
+ "getAppAuthorizeSetting": {
+ "name": "getAppAuthorizeSetting",
+ "app": {
+ "js": false,
+ "kotlin": true,
+ "swift": false
+ }
+ }
+ }
+ },
+ "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"
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/uni_modules/uni-getAppAuthorizeSetting/readme.md b/uni_modules/uni-getAppAuthorizeSetting/readme.md
new file mode 100644
index 0000000000000000000000000000000000000000..90371d3a944c654d73c5534c40ff04656d5b90b2
--- /dev/null
+++ b/uni_modules/uni-getAppAuthorizeSetting/readme.md
@@ -0,0 +1,6 @@
+# uni-getAppAuthorizeSetting
+### 开发文档
+[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)
\ No newline at end of file
diff --git a/uni_modules/uni-getAppAuthorizeSetting/utssdk/app-android/index.uts b/uni_modules/uni-getAppAuthorizeSetting/utssdk/app-android/index.uts
new file mode 100644
index 0000000000000000000000000000000000000000..0d246090d4548d1de33fd3452b4a586aeddd8e38
--- /dev/null
+++ b/uni_modules/uni-getAppAuthorizeSetting/utssdk/app-android/index.uts
@@ -0,0 +1,76 @@
+import { GetAppAuthorizeSetting, GetAppAuthorizeSettingResult } from "../interface.uts";
+import UTSAndroid from 'io.dcloud.uts.UTSAndroid';
+import PackageManager from 'android.content.pm.PackageManager';
+import Manifest from 'android.Manifest';
+import NotificationManagerCompat from 'androidx.core.app.NotificationManagerCompat';
+
+export const getAppAuthorizeSetting : GetAppAuthorizeSetting = function () : GetAppAuthorizeSettingResult {
+ const context = UTSAndroid.getUniActivity()!!;
+
+ const cameraPermission = [Manifest.permission.CAMERA];
+ const cameraGranted = UTSAndroid.checkSystemPermissionGranted(context, cameraPermission);
+ let cameraResult = cameraGranted ? "authorized" : "denied";
+ if (!cameraGranted && !hasDefinedInManifest(Manifest.permission.CAMERA)) {
+ cameraResult = "config error";
+ }
+
+ const locationPermission = [Manifest.permission.ACCESS_COARSE_LOCATION];
+ const coarseLocationGranted = UTSAndroid.checkSystemPermissionGranted(context, locationPermission);
+ let coarseLocationResult = coarseLocationGranted ? "authorized" : "denied";
+ if (!coarseLocationGranted && !hasDefinedInManifest(Manifest.permission.ACCESS_COARSE_LOCATION)) {
+ coarseLocationResult = "config error";
+ }
+
+ const fineLocationPermission = [Manifest.permission.ACCESS_FINE_LOCATION];
+ const fineLocationGranted = UTSAndroid.checkSystemPermissionGranted(context, fineLocationPermission);
+ let accuracy = coarseLocationGranted ? "reduced" : "unsupported";
+ if (coarseLocationGranted && fineLocationGranted) {
+ accuracy = "full";
+ }
+
+ const recordAudioPermission = [Manifest.permission.RECORD_AUDIO];
+
+ const recordAudioGranted = UTSAndroid.checkSystemPermissionGranted(context, recordAudioPermission);
+ let recordAudioResult = recordAudioGranted ? "authorized" : "denied";
+ if (!recordAudioGranted && !hasDefinedInManifest(Manifest.permission.RECORD_AUDIO)) {
+ recordAudioResult = "config error";
+ }
+
+ const compat = NotificationManagerCompat.from(context);
+ const notificationResult = compat.areNotificationsEnabled() ? "authorized": "denied"
+
+ let result : GetAppAuthorizeSettingResult = {
+ cameraAuthorized: cameraResult,
+ locationAuthorized: coarseLocationResult,
+ locationAccuracy: accuracy,
+ microphoneAuthorized: recordAudioResult,
+ notificationAuthorized: notificationResult,
+ albumAuthorized: null,
+ bluetoothAuthorized: null,
+ locationReducedAccuracy: null,
+ notificationAlertAuthorized: null,
+ notificationBadgeAuthorized: null,
+ notificationSoundAuthorized: null,
+ phoneCalendarAuthorized: null
+ }
+
+ return result
+};
+
+const hasDefinedInManifest = function (permission : string) : boolean {
+ try {
+ const context = UTSAndroid.getAppContext()!!;
+ const packageInfo = context.getPackageManager().getPackageInfo(context.getApplicationInfo().packageName, PackageManager.GET_PERMISSIONS);
+ if (packageInfo != null) {
+ for (const requestPermission in packageInfo.requestedPermissions) {
+ if (permission == requestPermission) {
+ return true;
+ }
+ }
+ }
+ } catch (e : Exception) {
+ return false
+ }
+
+ return false;
+}
\ No newline at end of file
diff --git a/uni_modules/uni-getAppAuthorizeSetting/utssdk/app-ios/index.uts b/uni_modules/uni-getAppAuthorizeSetting/utssdk/app-ios/index.uts
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/uni_modules/uni-getAppAuthorizeSetting/utssdk/interface.uts b/uni_modules/uni-getAppAuthorizeSetting/utssdk/interface.uts
new file mode 100644
index 0000000000000000000000000000000000000000..58d5a42d3b0c1c8f4cfa2ea3b40eb1eb4f96e24c
--- /dev/null
+++ b/uni_modules/uni-getAppAuthorizeSetting/utssdk/interface.uts
@@ -0,0 +1,233 @@
+export interface Uni {
+ /**
+ * getAppAuthorizeSetting()
+ * @description
+ * 获取 APP 授权设置。
+ * @param {void}
+ * @return {GetAppAuthorizeSettingResult}
+ * @tutorial http://uniapp.dcloud.io/api/system/getappauthorizesetting
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "4.4",
+ * "uniVer": "√",
+ * "unixVer": "3.9+"
+ * },
+ * "ios": {
+ * "osVer": "9.0",
+ * "uniVer": "√",
+ * "unixVer": "x"
+ * }
+ * }
+ * }
+ * @example
+ ```typescript
+ uni.getAppAuthorizeSetting()
+ ```
+ */
+ getAppAuthorizeSetting(): GetAppAuthorizeSettingResult;
+}
+
+
+export type GetAppAuthorizeSetting = () => GetAppAuthorizeSettingResult;
+export type GetAppAuthorizeSettingResult = {
+ /**
+ * 允许 App 使用相册的开关(仅 iOS 支持)
+ * - authorized: 已经获得授权,无需再次请求授权
+ * - denied: 请求授权被拒绝,无法再次请求授权;(此情况需要引导用户打开系统设置,在设置页中打开权限)
+ * - not determined: 尚未请求授权,会在App下一次调用系统相应权限时请求;(仅 iOS 会出现。此种情况下引导用户打开系统设置,不展示开关)
+ * @type 'authorized' | 'denied' | 'not determined'
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "x",
+ * "uniVer": "x",
+ * "unixVer": "x"
+ * },
+ * "ios": {
+ * "osVer": "9.0",
+ * "uniVer": "√",
+ * "unixVer": "x"
+ * }
+ * }
+ * }
+ */
+ albumAuthorized: string | null,
+ /**
+ * 允许 App 使用蓝牙的开关(仅 iOS 支持)
+ * - authorized: 已经获得授权,无需再次请求授权
+ * - denied: 请求授权被拒绝,无法再次请求授权;(此情况需要引导用户打开系统设置,在设置页中打开权限)
+ * - not determined: 尚未请求授权,会在App下一次调用系统相应权限时请求;(仅 iOS 会出现。此种情况下引导用户打开系统设置,不展示开关)
+ * - config error: Android平台没有该值;iOS平台:表示没有在 `manifest.json -> App模块配置` 中配置 `BlueTooth(低功耗蓝牙)` 模块
+ * @type 'authorized' | 'denied' | 'not determined' | 'config error'
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "x",
+ * "uniVer": "x",
+ * "unixVer": "x"
+ * },
+ * "ios": {
+ * "osVer": "9.0",
+ * "uniVer": "√",
+ * "unixVer": "x"
+ * }
+ * }
+ * }
+ */
+ bluetoothAuthorized: string | null,
+ /**
+ * 允许 App 使用摄像头的开关
+ * - authorized: 已经获得授权,无需再次请求授权
+ * - denied: 请求授权被拒绝,无法再次请求授权;(此情况需要引导用户打开系统设置,在设置页中打开权限)
+ * - not determined: 尚未请求授权,会在App下一次调用系统相应权限时请求;(仅 iOS 会出现。此种情况下引导用户打开系统设置,不展示开关)
+ * - config error: Android平台:表示没有授予 `android.permission.CAMERA` 权限;iOS平台没有该值
+ * @type 'authorized' | 'denied' | 'not determined' | 'config error'
+ */
+ cameraAuthorized: string,
+ /**
+ * 允许 App 使用定位的开关
+ * - authorized: 已经获得授权,无需再次请求授权
+ * - denied: 请求授权被拒绝,无法再次请求授权;(此情况需要引导用户打开系统设置,在设置页中打开权限)
+ * - not determined: 尚未请求授权,会在App下一次调用系统相应权限时请求;(仅 iOS 会出现。此种情况下引导用户打开系统设置,不展示开关)
+ * - config error: Android平台:表示没有授予 `android.permission.ACCESS_COARSE_LOCATION` 权限;iOS平台:表示没有在 `manifest.json -> App模块配置` 中配置 `Geolocation(定位)` 模块
+ * @type 'authorized' | 'denied' | 'not determined' | 'config error'
+ */
+ locationAuthorized: string,
+ /**
+ * 定位准确度。true 表示模糊定位,false 表示精确定位
+ * - reduced: 模糊定位
+ * - full: 精准定位
+ * - unsupported: 不支持(包括用户拒绝定位权限和没有在 `manifest.json -> App模块配置` 中配置 `Geolocation(定位)` 模块)
+ * @type 'reduced' | 'full' | 'unsupported'
+ */
+ locationAccuracy: string | null,
+ /**
+ * 定位准确度(推荐使用 locationAccuracy 属性)。true 表示模糊定位,false 表示精确定位(仅 iOS 支持)
+ * @type boolean
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "x",
+ * "uniVer": "x",
+ * "unixVer": "x"
+ * },
+ * "ios": {
+ * "osVer": "9.0",
+ * "uniVer": "√",
+ * "unixVer": "x"
+ * }
+ * }
+ * }
+ */
+ locationReducedAccuracy: boolean | null,
+ /**
+ * 允许 App 使用麦克风的开关
+ * - authorized: 已经获得授权,无需再次请求授权
+ * - denied: 请求授权被拒绝,无法再次请求授权;(此情况需要引导用户打开系统设置,在设置页中打开权限)
+ * - not determined: 尚未请求授权,会在App下一次调用系统相应权限时请求;(仅 iOS 会出现。此种情况下引导用户打开系统设置,不展示开关)
+ * - config error: Android平台:表示没有授予 `android.permission.RECORD_AUDIO` 权限;iOS平台没有该值
+ * @type 'authorized' | 'denied' | 'not determined' | 'config error'
+ */
+ microphoneAuthorized: string,
+ /**
+ * 允许 App 通知的开关
+ * - authorized: 已经获得授权,无需再次请求授权
+ * - denied: 请求授权被拒绝,无法再次请求授权;(此情况需要引导用户打开系统设置,在设置页中打开权限)
+ * - not determined: 尚未请求授权,会在App下一次调用系统相应权限时请求;(仅 iOS 会出现。此种情况下引导用户打开系统设置,不展示开关)
+ * - config error: Android平台没有该值;iOS平台:表示没有在 `manifest.json -> App模块配置` 中配置 `Push(推送)` 模块
+ * @type 'authorized' | 'denied' | 'not determined' | 'config error'
+ */
+ notificationAuthorized: string,
+ /**
+ * 允许 App 通知带有提醒的开关(仅 iOS 10.0+ 支持)
+ * - authorized: 已经获得授权,无需再次请求授权
+ * - denied: 请求授权被拒绝,无法再次请求授权;(此情况需要引导用户打开系统设置,在设置页中打开权限)
+ * - not determined: 尚未请求授权,会在App下一次调用系统相应权限时请求;(仅 iOS 会出现。此种情况下引导用户打开系统设置,不展示开关)
+ * - config error: 没有在 `manifest.json -> App模块配置` 中配置 `Push(推送)` 模块
+ * @type 'authorized' | 'denied' | 'not determined' | 'config error'
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "x",
+ * "uniVer": "x",
+ * "unixVer": "x"
+ * },
+ * "ios": {
+ * "osVer": "10.0",
+ * "uniVer": "√",
+ * "unixVer": "x"
+ * }
+ * }
+ * }
+ */
+ notificationAlertAuthorized: string | null,
+ /**
+ * 允许 App 通知带有标记的开关(仅 iOS 10.0+ 支持)
+ * - authorized: 已经获得授权,无需再次请求授权
+ * - denied: 请求授权被拒绝,无法再次请求授权;(此情况需要引导用户打开系统设置,在设置页中打开权限)
+ * - not determined: 尚未请求授权,会在App下一次调用系统相应权限时请求;(仅 iOS 会出现。此种情况下引导用户打开系统设置,不展示开关)
+ * - config error: 没有在 `manifest.json -> App模块配置` 中配置 `Push(推送)` 模块
+ * @type 'authorized' | 'denied' | 'not determined' | 'config error'
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "x",
+ * "uniVer": "x",
+ * "unixVer": "x"
+ * },
+ * "ios": {
+ * "osVer": "10.0",
+ * "uniVer": "√",
+ * "unixVer": "x"
+ * }
+ * }
+ * }
+ */
+ notificationBadgeAuthorized: string | null,
+ /**
+ * 允许 App 通知带有声音的开关(仅 iOS 10.0+ 支持)
+ * - authorized: 已经获得授权,无需再次请求授权
+ * - denied: 请求授权被拒绝,无法再次请求授权;(此情况需要引导用户打开系统设置,在设置页中打开权限)
+ * - not determined: 尚未请求授权,会在App下一次调用系统相应权限时请求;(仅 iOS 会出现。此种情况下引导用户打开系统设置,不展示开关)
+ * - config error: 没有在 `manifest.json -> App模块配置` 中配置 `Push(推送)` 模块
+ * @type 'authorized' | 'denied' | 'not determined' | 'config error'
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "x",
+ * "uniVer": "x",
+ * "unixVer": "x"
+ * },
+ * "ios": {
+ * "osVer": "10.0",
+ * "uniVer": "√",
+ * "unixVer": "x"
+ * }
+ * }
+ * }
+ */
+ notificationSoundAuthorized: string | null,
+ /**
+ * 允许读写日历的开关(仅微信小程序支持)
+ * - authorized: 已经获得授权,无需再次请求授权
+ * - denied: 请求授权被拒绝,无法再次请求授权;(此情况需要引导用户打开系统设置,在设置页中打开权限)
+ * - not determined: 尚未请求授权,会在App下一次调用系统相应权限时请求;(仅 iOS 会出现。此种情况下引导用户打开系统设置,不展示开关)
+ * @type 'authorized' | 'denied' | 'not determined'
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "x",
+ * "uniVer": "x",
+ * "unixVer": "x"
+ * },
+ * "ios": {
+ * "osVer": "x",
+ * "uniVer": "x",
+ * "unixVer": "x"
+ * }
+ * }
+ * }
+ */
+ phoneCalendarAuthorized: string | null
+};
diff --git a/uni_modules/uni-getAppBaseInfo/changelog.md b/uni_modules/uni-getAppBaseInfo/changelog.md
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/uni_modules/uni-getAppBaseInfo/package.json b/uni_modules/uni-getAppBaseInfo/package.json
new file mode 100644
index 0000000000000000000000000000000000000000..1785b04eabefc808d2705657649c48079d6fe76d
--- /dev/null
+++ b/uni_modules/uni-getAppBaseInfo/package.json
@@ -0,0 +1,93 @@
+{
+ "id": "uni-getAppBaseInfo",
+ "displayName": "uni-getAppBaseInfo",
+ "version": "1.0.0",
+ "description": "uni-getAppBaseInfo",
+ "keywords": [
+ "uni-getAppBaseInfo"
+],
+ "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": {
+ "getAppBaseInfo": {
+ "name": "getAppBaseInfo",
+ "app": {
+ "js": false,
+ "kotlin": true,
+ "swift": 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"
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/uni_modules/uni-getAppBaseInfo/readme.md b/uni_modules/uni-getAppBaseInfo/readme.md
new file mode 100644
index 0000000000000000000000000000000000000000..131fa3d3957712b26e5e6b94eadb21e47b954caf
--- /dev/null
+++ b/uni_modules/uni-getAppBaseInfo/readme.md
@@ -0,0 +1,5 @@
+# uni-getAppBaseInfo
+### 开发文档
+[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)
\ No newline at end of file
diff --git a/uni_modules/uni-getAppBaseInfo/utssdk/app-android/device/AppBaseInfoDeviceUtil.uts b/uni_modules/uni-getAppBaseInfo/utssdk/app-android/device/AppBaseInfoDeviceUtil.uts
new file mode 100644
index 0000000000000000000000000000000000000000..3e54c93d53e0d895195aab1aa3ed9473a8040945
--- /dev/null
+++ b/uni_modules/uni-getAppBaseInfo/utssdk/app-android/device/AppBaseInfoDeviceUtil.uts
@@ -0,0 +1,76 @@
+
+import { UTSAndroid as Device} from "io.dcloud.uts";
+import PackageManager from 'android.content.pm.PackageManager';
+import Context from 'android.content.Context';
+import PackageInfo from 'android.content.pm.PackageInfo';
+import UiModeManager from 'android.app.UiModeManager';
+import Activity from 'android.app.Activity';
+export class AppBaseInfoDeviceUtil{
+
+ public static getAppID(): string {
+ return Device.getAppId();
+ }
+
+ public static getAppName(context: Context): string {
+ let packageManager = context.getPackageManager();
+ return packageManager.getApplicationLabel(context.getApplicationInfo()).toString()
+ }
+
+ public static getPackageName(context: Context): string {
+ return context.getPackageName();
+ }
+
+ public static getAppVersionName(): string {
+ return Device.getAppVersion()["name"].toString();
+ }
+
+ public static getAppVersionCode(): string {
+ return Device.getAppVersion()["code"].toString();
+ }
+
+ public static getHostVersion(context: Context): string {
+ let packageManager = context.getPackageManager();
+ let applicationInfo = packageManager.getPackageInfo(context.getPackageName(), PackageManager.GET_ACTIVITIES);
+ return applicationInfo.versionName;
+ }
+
+ public static getHostCode(context: Context): string {
+ let packageManager = context.getPackageManager();
+ let applicationInfo = packageManager.getPackageInfo(context.getPackageName(), PackageManager.GET_ACTIVITIES);
+ return applicationInfo.versionCode+"";
+ }
+
+ public static isSystemNightMode(activity: Activity): boolean {
+ let uiModeManager = activity.getSystemService(Context.UI_MODE_SERVICE) as UiModeManager;
+ return uiModeManager.getNightMode() == UiModeManager.MODE_NIGHT_YES;
+ }
+
+ public static getOsLanguage(context: Context): string {
+ return Device.getLanguageInfo(context)["osLanguage"].toString();
+ }
+
+ public static getOsLanguageNormal(context: Context): string {
+ const LOCALE_ZH_HANS = 'zh-Hans'
+ const LOCALE_ZH_HANT = 'zh-Hant'
+ let locale = Device.getLanguageInfo(context)["appLanguage"].toString();
+ if (locale.indexOf('zh') === 0) {
+ if (locale.indexOf('-hans') > -1) {
+ return LOCALE_ZH_HANS;
+ }
+ if (locale.indexOf('-hant') > -1) {
+ return LOCALE_ZH_HANT;
+ }
+ if (locale.includes("-tw") || locale.includes("-hk") || locale.includes("-mo") || locale.includes("-cht")) {
+ return LOCALE_ZH_HANT;
+ }
+
+ return LOCALE_ZH_HANS;
+ } else {
+ return locale;
+ }
+ }
+
+ public static getAppInnerVersion(): string {
+ return Device.getInnerVersion();
+ }
+}
\ No newline at end of file
diff --git a/uni_modules/uni-getAppBaseInfo/utssdk/app-android/index.uts b/uni_modules/uni-getAppBaseInfo/utssdk/app-android/index.uts
new file mode 100644
index 0000000000000000000000000000000000000000..ba6ea2cdeb4ecf4e2f40ed3e89ed1c9e27b343a1
--- /dev/null
+++ b/uni_modules/uni-getAppBaseInfo/utssdk/app-android/index.uts
@@ -0,0 +1,152 @@
+import UTSAndroid from 'io.dcloud.uts.UTSAndroid';
+import { AppBaseInfoDeviceUtil } from './device/AppBaseInfoDeviceUtil.uts';
+
+import {
+ GetAppBaseInfoOptions,
+ GetAppBaseInfo,
+ GetAppBaseInfoResult
+} from '../interface.uts'
+
+
+
+export const getAppBaseInfo : GetAppBaseInfo = (config : GetAppBaseInfoOptions | null) : GetAppBaseInfoResult => {
+ let filter : Array = [];
+ if (config != null && config.filter != null) {
+ filter = config.filter;
+ }
+
+ if (config == null || filter.length == 0) {
+ const defaultFilter = [
+ "appId",
+ "appName",
+ "appVersion",
+ "appVersionCode",
+ "appLanguage",
+ "language",
+ "version",
+ "appWgtVersion",
+ "hostLanguage",
+ "hostVersion",
+ "hostName",
+ "hostPackageName",
+ "hostSDKVersion",
+ "hostTheme",
+ "isUniAppX",
+ "uniCompileVersion",
+ "uniPlatform",
+ "uniRuntimeVersion",
+ "uniCompileVersionCode",
+ "uniRuntimeVersionCode"
+ ];
+ filter = defaultFilter;
+ }
+ return getBaseInfo(filter);
+}
+
+function getBaseInfo(filterArray : Array) : GetAppBaseInfoResult {
+ const activity = UTSAndroid.getUniActivity()!;
+ let result : GetAppBaseInfoResult = {};
+ if (filterArray.indexOf("appId") != -1) {
+ result.appId = AppBaseInfoDeviceUtil.getAppID();
+ }
+ if (filterArray.indexOf("appName") != -1) {
+ result.appName = UTSAndroid.getAppName();
+ }
+ if (UTSAndroid.isUniMp()) {
+ if (filterArray.indexOf("hostPackageName") != -1) {
+ result.hostPackageName = AppBaseInfoDeviceUtil.getPackageName(activity);
+ }
+ if (filterArray.indexOf("hostVersion") != -1) {
+ result.hostVersion = AppBaseInfoDeviceUtil.getHostVersion(activity);
+ }
+ if (filterArray.indexOf("hostName") != -1) {
+ result.hostName = AppBaseInfoDeviceUtil.getAppName(activity);
+ }
+ if (filterArray.indexOf("hostTheme") != -1) {
+ result.hostTheme = AppBaseInfoDeviceUtil.isSystemNightMode(activity) ? "dark" : "light";
+ }
+ if (filterArray.indexOf("hostLanguage") != -1) {
+ result.hostLanguage = AppBaseInfoDeviceUtil.getOsLanguage(activity);
+ }
+ if (filterArray.indexOf("appVersion") != -1) {
+ result.appVersion = AppBaseInfoDeviceUtil.getAppVersionName();
+ }
+ if (filterArray.indexOf("appVersionCode") != -1) {
+ result.appVersionCode = AppBaseInfoDeviceUtil.getAppVersionCode();
+ }
+ } else {
+ if (filterArray.indexOf("appVersion") != -1) {
+ result.appVersion = UTSAndroid.getAppVersion()["name"].toString();
+ }
+ if (filterArray.indexOf("appVersionCode") != -1) {
+ result.appVersionCode = UTSAndroid.getAppVersion()["code"].toString();
+ }
+ }
+ if (filterArray.indexOf("appLanguage") != -1) {
+ result.appLanguage = AppBaseInfoDeviceUtil.getOsLanguageNormal(activity);
+ }
+ if (filterArray.indexOf("language") != -1) {
+ result.language = AppBaseInfoDeviceUtil.getOsLanguage(activity);
+ }
+ if (filterArray.indexOf("version") != -1) {
+ result.version = AppBaseInfoDeviceUtil.getAppInnerVersion();
+ }
+ if (filterArray.indexOf("appWgtVersion") != -1) {
+ result.appWgtVersion = AppBaseInfoDeviceUtil.getAppVersionName();
+ }
+ if (filterArray.indexOf("isUniAppX") != -1) {
+ result.isUniAppX = UTSAndroid.isUniAppX();
+ }
+
+ if (filterArray.indexOf("uniCompileVersion") != -1) {
+ result.uniCompileVersion = UTSAndroid.getUniCompileVersion();
+ }
+
+ if (filterArray.indexOf("uniPlatform") != -1) {
+ result.uniPlatform = "app";
+ }
+
+ if (filterArray.indexOf("uniRuntimeVersion") != -1) {
+ result.uniRuntimeVersion = UTSAndroid.getUniRuntimeVersion();
+ }
+
+ if (filterArray.indexOf("uniCompileVersionCode") != -1) {
+ result.uniCompileVersionCode = convertVersionCode(UTSAndroid.getUniCompileVersion());
+ }
+
+ if (filterArray.indexOf("uniRuntimeVersionCode") != -1) {
+ result.uniRuntimeVersionCode = convertVersionCode(UTSAndroid.getUniRuntimeVersion());
+ }
+
+ return result;
+}
+
+const convertVersionCode = function(version: string): number {
+ let str = "";
+ let radixLength = 2;
+ let findDot = false;
+ const dotChar = ".".get(0);
+ for (let i = 0; i < version.length; i++) {
+ const char = version.get(i);
+ if(findDot){
+ if(char.isDigit()){
+ str += char;
+ }
+ radixLength --;
+ if(radixLength == 0){
+ break;
+ }
+ }else{
+ if(char.isDigit()){
+ str += char;
+ }else{
+ if(char == dotChar){
+ findDot = true;
+ str += char;
+ }
+ }
+ }
+ }
+
+ return parseFloat(str);
+}
\ No newline at end of file
diff --git a/uni_modules/uni-getAppBaseInfo/utssdk/app-ios/device/AppBaseInfoDeviceUtil.uts b/uni_modules/uni-getAppBaseInfo/utssdk/app-ios/device/AppBaseInfoDeviceUtil.uts
new file mode 100644
index 0000000000000000000000000000000000000000..2ac9ffd4a5b51a5a00c6d9ef1f98f980a3dbd627
--- /dev/null
+++ b/uni_modules/uni-getAppBaseInfo/utssdk/app-ios/device/AppBaseInfoDeviceUtil.uts
@@ -0,0 +1,74 @@
+import { UTSiOS } from "DCloudUTSFoundation";
+
+export class AppBaseInfoDeviceUtil {
+
+ public static getAppID() : string {
+ return UTSiOS.getAppId();
+ }
+
+ public static getAppName() : string {
+ return UTSiOS.getAppName();
+ }
+
+ public static getHostName() : string {
+ return UTSiOS.getHostName();
+ }
+
+ public static getHostTheme() : string {
+ return UTSiOS.getHostTheme();
+ }
+
+ public static getHostLanguage() : string {
+ return UTSiOS.getHostLanguage();
+ }
+
+ public static getHostVersion() : string {
+ return UTSiOS.getHostVersion();
+ }
+
+ public static getHostPackageName() : string {
+ return UTSiOS.getHostPackageName();
+ }
+
+ public static getAppVersion() : string {
+ return UTSiOS.getAppVersion();
+ }
+
+ public static getAppVersionCode() : string {
+ return UTSiOS.getAppVersionCode();
+ }
+
+ public static getAppWgtVersion() : string {
+ return UTSiOS.getAppWgtVersion();
+ }
+
+ public static getOsLanguage() : string {
+ return UTSiOS.getOsLanguage();
+ }
+
+ public static getOsLanguageNormal() : string {
+ const LOCALE_ZH_HANS = 'zh-Hans'
+ const LOCALE_ZH_HANT = 'zh-Hant'
+ let locale = UTSiOS.getOsLanguage();
+ if (locale.indexOf('zh') == 0) {
+ if (locale.indexOf('-hans') > -1) {
+ return LOCALE_ZH_HANS;
+ }
+ if (locale.indexOf('-hant') > -1) {
+ return LOCALE_ZH_HANT;
+ }
+ if (locale.includes("-tw") || locale.includes("-hk") || locale.includes("-mo") || locale.includes("-cht")) {
+ return LOCALE_ZH_HANT;
+ }
+
+ return LOCALE_ZH_HANS;
+ } else {
+ return locale;
+ }
+ }
+
+ public static getAppInnerVersion() : string {
+ return UTSiOS.getInnerVersion();
+ }
+
+}
\ No newline at end of file
diff --git a/uni_modules/uni-getAppBaseInfo/utssdk/app-ios/index.uts b/uni_modules/uni-getAppBaseInfo/utssdk/app-ios/index.uts
new file mode 100644
index 0000000000000000000000000000000000000000..5f65682785e7c494d05cdb6446983eefa3b60fa6
--- /dev/null
+++ b/uni_modules/uni-getAppBaseInfo/utssdk/app-ios/index.uts
@@ -0,0 +1,84 @@
+import { AppBaseInfoDeviceUtil } from './device/AppBaseInfoDeviceUtil.uts';
+import { UTSiOS } from "DCloudUTSFoundation";
+import {
+ GetAppBaseInfoOptions,
+ GetAppBaseInfo,
+ GetAppBaseInfoResult
+} from '../interface.uts'
+
+export const getAppBaseInfo : GetAppBaseInfo = (config : GetAppBaseInfoOptions | null) : GetAppBaseInfoResult => {
+ let filter : Array = [];
+ if (config != null && config!.filter != null) {
+ filter = config!.filter;
+ }
+
+ if (config == null || filter.length == 0) {
+ const defaultFilter = [
+ "appId",
+ "appName",
+ "appVersion",
+ "appVersionCode",
+ "appLanguage",
+ "language",
+ "version",
+ "appWgtVersion",
+ "hostLanguage",
+ "hostVersion",
+ "hostName",
+ "hostPackageName",
+ "hostSDKVersion",
+ "hostTheme",
+ ];
+ filter = defaultFilter;
+ }
+ return getBaseInfo(filter);
+}
+
+function getBaseInfo(filterArray : Array) : GetAppBaseInfoResult {
+ let result : GetAppBaseInfoResult = {};
+ if (filterArray.indexOf("appId") != -1) {
+ result.appId = AppBaseInfoDeviceUtil.getAppID();
+ }
+ if (filterArray.indexOf("appName") != -1) {
+ result.appName = AppBaseInfoDeviceUtil.getAppName();
+ }
+ if (UTSiOS.isUniMp()) {
+ if (filterArray.indexOf("hostPackageName") != -1) {
+ result.hostPackageName = AppBaseInfoDeviceUtil.getHostPackageName();
+ }
+ if (filterArray.indexOf("hostVersion") != -1) {
+ result.hostVersion = AppBaseInfoDeviceUtil.getHostVersion();
+ }
+ if (filterArray.indexOf("hostName") != -1) {
+ result.hostName = AppBaseInfoDeviceUtil.getHostName();
+ }
+ if (filterArray.indexOf("hostTheme") != -1) {
+ result.hostTheme = AppBaseInfoDeviceUtil.getHostTheme();
+ }
+ if (filterArray.indexOf("hostLanguage") != -1) {
+ result.hostLanguage = AppBaseInfoDeviceUtil.getHostLanguage();
+ }
+ }
+
+ if (filterArray.indexOf("appVersion") != -1) {
+ result.appVersion = AppBaseInfoDeviceUtil.getAppVersion();
+ }
+ if (filterArray.indexOf("appVersionCode") != -1) {
+ result.appVersionCode = AppBaseInfoDeviceUtil.getAppVersionCode();
+ }
+
+ if (filterArray.indexOf("appLanguage") != -1) {
+ result.appLanguage = AppBaseInfoDeviceUtil.getOsLanguageNormal();
+ }
+ if (filterArray.indexOf("language") != -1) {
+ result.language = AppBaseInfoDeviceUtil.getOsLanguage();
+ }
+ if (filterArray.indexOf("version") != -1) {
+ result.version = AppBaseInfoDeviceUtil.getAppInnerVersion();
+ }
+ if (filterArray.indexOf("appWgtVersion") != -1) {
+ result.appWgtVersion = AppBaseInfoDeviceUtil.getAppWgtVersion();
+ }
+
+ return result;
+}
\ No newline at end of file
diff --git a/uni_modules/uni-getAppBaseInfo/utssdk/interface.uts b/uni_modules/uni-getAppBaseInfo/utssdk/interface.uts
new file mode 100644
index 0000000000000000000000000000000000000000..f7408b505a8b786a435d142b1640f53619cb7f58
--- /dev/null
+++ b/uni_modules/uni-getAppBaseInfo/utssdk/interface.uts
@@ -0,0 +1,233 @@
+export type GetAppBaseInfoOptions = {
+ /**
+ * @description 过滤字段的字符串数组,假如要获取指定字段,传入此数组。
+ */
+ filter: Array
+};
+
+export type GetAppBaseInfoResult = {
+ /**
+ * manifest.json 中应用appid,即DCloud appid。
+ */
+ appId?: string,
+ /**
+ * `manifest.json` 中应用名称。
+ */
+ appName?: string,
+ /**
+ * `manifest.json` 中应用版本名称。
+ */
+ appVersion?: string,
+ /**
+ * `manifest.json` 中应用版本名号。
+ */
+ appVersionCode?: string,
+ /**
+ * 应用设置的语言en、zh-Hans、zh-Hant、fr、es
+ */
+ appLanguage?: string,
+ /**
+ * 应用设置的语言
+ */
+ language?: string,
+ /**
+ * 引擎版本号。已废弃,仅为了向下兼容保留
+ * @deprecated 已废弃,仅为了向下兼容保留
+ */
+ version?: string,
+ /**
+ * 应用资源(wgt)的版本名称。
+ *
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "5.0",
+ * "uniVer": "√",
+ * "unixVer": "x"
+ * },
+ * "ios": {
+ * "osVer": "9.0",
+ * "uniVer": "√",
+ * "unixVer": "x"
+ * }
+ * }
+ * }
+ */
+ appWgtVersion?: string,
+ /**
+ * 小程序宿主语言
+ *
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "5.0",
+ * "uniVer": "√",
+ * "unixVer": "x"
+ * },
+ * "ios": {
+ * "osVer": "9.0",
+ * "uniVer": "√",
+ * "unixVer": "x"
+ * }
+ * }
+ * }
+ */
+ hostLanguage?: string,
+ /**
+ * App、小程序宿主版本。
+ *
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "5.0",
+ * "uniVer": "√",
+ * "unixVer": "x"
+ * },
+ * "ios": {
+ * "osVer": "9.0",
+ * "uniVer": "√",
+ * "unixVer": "x"
+ * }
+ * }
+ * }
+ */
+ hostVersion?: string,
+ /**
+ * 小程序宿主名称
+ *
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "5.0",
+ * "uniVer": "√",
+ * "unixVer": "x"
+ * },
+ * "ios": {
+ * "osVer": "9.0",
+ * "uniVer": "√",
+ * "unixVer": "x"
+ * }
+ * }
+ * }
+ */
+ hostName?: string,
+ /**
+ * 小程序宿主包名
+ *
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "5.0",
+ * "uniVer": "√",
+ * "unixVer": "x"
+ * },
+ * "ios": {
+ * "osVer": "9.0",
+ * "uniVer": "√",
+ * "unixVer": "x"
+ * }
+ * }
+ * }
+ */
+ hostPackageName?: string,
+ /**
+ * uni小程序SDK版本、小程序客户端基础库版本
+ *
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "5.0",
+ * "uniVer": "√",
+ * "unixVer": "x"
+ * },
+ * "ios": {
+ * "osVer": "9.0",
+ * "uniVer": "√",
+ * "unixVer": "x"
+ * }
+ * }
+ * }
+ */
+ hostSDKVersion?: string,
+ /**
+ * 系统当前主题,取值为light或dark。微信小程序全局配置"darkmode":true时才能获取,否则为 undefined (不支持小游戏)
+ *
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "5.0",
+ * "uniVer": "√",
+ * "unixVer": "x"
+ * },
+ * "ios": {
+ * "osVer": "9.0",
+ * "uniVer": "√",
+ * "unixVer": "x"
+ * }
+ * }
+ * }
+ */
+ hostTheme?: string,
+ /**
+ * 是否uni-app x
+ */
+ isUniAppX ?: boolean,
+ /**
+ * uni 编译器版本
+ */
+ uniCompileVersion ?: string,
+ /**
+ * uni-app 运行平台。如:`app`、`mp-weixin`、`web`
+ */
+ uniPlatform ?: string,
+ /**
+ * uni 运行时版本
+ */
+ uniRuntimeVersion ?: string,
+ /**
+ * uni 编译器版本号
+ */
+ uniCompileVersionCode?: number,
+ /**
+ * uni 运行时版本号
+ */
+ uniRuntimeVersionCode?: number,
+}
+
+/**
+ * @param{GetAppBaseInfoOptions} [options=包含所有字段的过滤对象] 过滤的字段对象, 不传参数默认为获取全部字段。
+ */
+export type GetAppBaseInfo = (options?: GetAppBaseInfoOptions | null) => GetAppBaseInfoResult;
+
+
+export interface Uni {
+ /**
+ * GetAppBaseInfo(Object object)
+ * @description
+ * 获取app基本信息
+ * @param {GetAppBaseInfoOptions} options [options=包含所有字段的过滤对象] 过滤的字段对象, 不传参数默认为获取全部字段。
+ * @return {object}
+ * @tutorial https://uniapp.dcloud.net.cn/api/system/getAppBaseInfo.html
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "4.4",
+ * "uniVer": "√",
+ * "unixVer": "3.9+"
+ * },
+ * "ios": {
+ * "osVer": "9.0",
+ * "uniVer": "√",
+ * "unixVer": "x"
+ * }
+ * }
+ * }
+ * @example
+ ```typescript
+ uni.getAppBaseInfo({
+ filter:[]
+ })
+ ```
+ */
+ getAppBaseInfo(options?: GetAppBaseInfoOptions | null): GetAppBaseInfoResult;
+}
diff --git a/uni_modules/uni-getDeviceInfo/changelog.md b/uni_modules/uni-getDeviceInfo/changelog.md
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/uni_modules/uni-getDeviceInfo/package.json b/uni_modules/uni-getDeviceInfo/package.json
new file mode 100644
index 0000000000000000000000000000000000000000..829829c4bf57034c620371d08147b8479dd6922d
--- /dev/null
+++ b/uni_modules/uni-getDeviceInfo/package.json
@@ -0,0 +1,93 @@
+{
+ "id": "uni-getDeviceInfo",
+ "displayName": "uni-getDeviceInfo",
+ "version": "1.0.0",
+ "description": "uni-getDeviceInfo",
+ "keywords": [
+ "uni-getDeviceInfo"
+ ],
+ "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": {
+ "getDeviceInfo": {
+ "name": "getDeviceInfo",
+ "app": {
+ "js": false,
+ "kotlin": true,
+ "swift": 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"
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/uni_modules/uni-getDeviceInfo/readme.md b/uni_modules/uni-getDeviceInfo/readme.md
new file mode 100644
index 0000000000000000000000000000000000000000..3e334985e6adf19dc6d31c1586f09e8e18b807bf
--- /dev/null
+++ b/uni_modules/uni-getDeviceInfo/readme.md
@@ -0,0 +1,5 @@
+# uni-getDeviceInfo
+### 开发文档
+[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)
\ No newline at end of file
diff --git a/uni_modules/uni-getDeviceInfo/utssdk/app-android/device/DeviceUtil.uts b/uni_modules/uni-getDeviceInfo/utssdk/app-android/device/DeviceUtil.uts
new file mode 100644
index 0000000000000000000000000000000000000000..47bf8b49fa207eba8fbb63506fa294467b317b43
--- /dev/null
+++ b/uni_modules/uni-getDeviceInfo/utssdk/app-android/device/DeviceUtil.uts
@@ -0,0 +1,382 @@
+import Activity from 'android.app.Activity';
+import Configuration from 'android.content.res.Configuration';
+import Context from 'android.content.Context';
+import UiModeManager from 'android.app.UiModeManager';
+import WindowManager from 'android.view.WindowManager';
+import DisplayMetrics from 'android.util.DisplayMetrics';
+import Build from 'android.os.Build';
+import File from 'java.io.File';
+
+import { EmulatorCheckUtil } from './EmulatorCheckUtil.uts'
+import TextUtils from 'android.text.TextUtils';
+
+import { UTSAndroid as Device } from "io.dcloud.uts";
+import BufferedReader from 'java.io.BufferedReader';
+import InputStreamReader from 'java.io.InputStreamReader';
+import Exception from 'java.lang.Exception';
+import KotlinArray from 'kotlin.Array'
+
+
+export class DeviceUtil {
+
+ private static customOS: string | null = null
+ private static customOSVersion: string | null = null
+
+ private static readonly rootRelatedDirs = [
+ "/su", "/su/bin/su", "/sbin/su",
+ "/data/local/xbin/su", "/data/local/bin/su", "/data/local/su",
+ "/system/xbin/su",
+ "/system/bin/su", "/system/sd/xbin/su", "/system/bin/failsafe/su",
+ "/system/bin/cufsdosck", "/system/xbin/cufsdosck", "/system/bin/cufsmgr",
+ "/system/xbin/cufsmgr", "/system/bin/cufaevdd", "/system/xbin/cufaevdd",
+ "/system/bin/conbb", "/system/xbin/conbb"];
+
+
+ /**
+ * HarmonyOS 系统输出的
+ * 格式:2.0.0
+ */
+ private static KEY_HARMONYOS_VERSION_NAME = "hw_sc.build.platform.version";
+
+ /**
+ * EMUI系统输出的
+ * 格式:EmotionUI_8.0.0
+ */
+ private static KEY_EMUI_VERSION_NAME = "ro.build.version.emui";
+
+ /**
+ * MagicUI系统输出的
+ * 格式:3.1.0
+ */
+ private static KEY_MAGICUI_VERSION = "ro.build.version.magic";
+
+ /**
+ * MIUI系统输出的
+ * 格式:V12
+ */
+ private static KEY_MIUI_VERSION_NAME = "ro.miui.ui.version.name";
+
+ /**
+ * OPPO手机ColorOS系统输出的
+ * 格式:9
+ */
+ private static KEY_COLOROS_VERSION_NAME = "ro.build.version.opporom";
+
+ /**
+ * VIVO手机系统输出的
+ * name格式:funtouch
+ * version格式: 9
+ */
+ private static KEY_VIVO_VERSION_NAME = "ro.vivo.os.name";
+ private static KEY_VIVO_VERSION = "ro.vivo.os.version";
+
+ /**
+ * OonPlus手机系统输出的
+ * 格式:Hydrogen OS 11.0.7.10.KB05
+ */
+ private static KEY_ONEPLUS_VERSION_NAME = "ro.rom.version";
+
+ /**
+ * 魅族手机系统输出的
+ */
+ private static KEY_FLYME_VERSION_NAME = "ro.build.display.id";
+
+ /**
+ * nubia手机系统输出的
+ */
+ private static KEY_NUBIA_VERSION_NAME = "ro.build.nubia.rom.name";
+ private static KEY_NUBIA_VERSION_CODE = "ro.build.nubia.rom.code";
+
+
+
+ public static getOrientation(activity: Activity): string {
+ const activityOrientation = activity.getResources().getConfiguration().orientation;
+ let outOrientation = "portrait";
+ if (activityOrientation == Configuration.ORIENTATION_LANDSCAPE) {
+ outOrientation = "landscape";
+ }
+ return outOrientation;
+ }
+
+ /**
+ * 获取屏幕像素比
+ */
+ public static getScaledDensity(activity: Activity): number {
+ const windowManager = activity.getSystemService(Context.WINDOW_SERVICE) as WindowManager;
+ const displayMetrics = new DisplayMetrics();
+
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
+ windowManager.getDefaultDisplay().getRealMetrics(displayMetrics);
+ } else {
+ windowManager.getDefaultDisplay().getMetrics(displayMetrics);
+ }
+ return displayMetrics.scaledDensity;
+ }
+
+ public static getSystemUIModeType(activity: Activity): string {
+
+ let uiModeManager = activity.getSystemService(Context.UI_MODE_SERVICE) as UiModeManager;
+ let modeType = "unknown";
+
+ switch (uiModeManager.getCurrentModeType()) {
+ case Configuration.UI_MODE_TYPE_TELEVISION:
+ modeType = "tv";
+ break;
+ case Configuration.UI_MODE_TYPE_WATCH:
+ modeType = "watch";
+ break;
+ case Configuration.UI_MODE_TYPE_NORMAL:
+ if (DeviceUtil.isTablet(activity)) {
+ modeType = "pad";
+ } else {
+ modeType = "phone";
+ }
+ break;
+ case Configuration.UI_MODE_TYPE_DESK:
+ modeType = "pc";
+ break;
+ case Configuration.UI_MODE_TYPE_UNDEFINED:
+ modeType = "undefined";
+ break;
+ case Configuration.UI_MODE_TYPE_CAR:
+ modeType = "car";
+ break;
+ case Configuration.UI_MODE_TYPE_VR_HEADSET:
+ modeType = "vr";
+ break;
+ case Configuration.UI_MODE_TYPE_APPLIANCE:
+ modeType = "appliance";
+ break;
+ }
+
+ return modeType;
+ }
+
+
+ /**
+ * 是否root
+ */
+ public static hasRootPrivilege(): boolean {
+ let hasRootDir = false;
+ let rootDirs = DeviceUtil.rootRelatedDirs;
+ let dirCount = rootDirs.length;
+ let i = 0;
+ while (i < dirCount) {
+ let dir = rootDirs[i];
+ if ((new File(dir)).exists()) {
+ hasRootDir = true;
+ break;
+ }
+ i++;
+ }
+
+
+ return Build.TAGS != null && Build.TAGS.includes("test-keys") || hasRootDir;
+ }
+
+ public static isSimulator(context: Context): boolean {
+ return EmulatorCheckUtil.getSingleInstance().emulatorCheck(context);
+ }
+
+
+ public static getDeviceID(context: Context): string {
+ return Device.getDeviceID(context);
+ }
+
+
+ public static getOsLanguage(context: Context): string {
+ return Device.getLanguageInfo(context)["osLanguage"].toString();
+ }
+
+ public static getOsLanguageNormal(context: Context): string {
+ const LOCALE_ZH_HANS = 'zh-Hans'
+ const LOCALE_ZH_HANT = 'zh-Hant'
+ let locale = Device.getLanguageInfo(context)["appLanguage"].toString();
+ if (locale.indexOf('zh') === 0) {
+ if (locale.indexOf('-hans') > -1) {
+ return LOCALE_ZH_HANS;
+ }
+ if (locale.indexOf('-hant') > -1) {
+ return LOCALE_ZH_HANT;
+ }
+ if (locale.includes("-tw") || locale.includes("-hk") || locale.includes("-mo") || locale.includes("-cht")) {
+ return LOCALE_ZH_HANT;
+ }
+
+ return LOCALE_ZH_HANS;
+ } else {
+ return locale;
+ }
+ }
+
+ public static getAppInnerVersion(): string {
+ return Device.getInnerVersion();
+ }
+
+ public static getOaid(): string {
+ return Device.getOAID();
+ }
+
+
+ /**
+ * 是否为平板 不是太准确
+ */
+ public static isTablet(activity: Activity): boolean {
+ return (activity.getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_LARGE;
+ }
+
+
+
+ private static setCustomInfo(phoneBrand: string) {
+ try {
+ switch (DeviceUtil.deleteSpaceAndToUpperCase(phoneBrand)) {
+ case "HUAWEI":
+ if (DeviceUtil.isHarmonyOS()) {
+ DeviceUtil.customOSVersion = DeviceUtil.getSystemPropertyValue(DeviceUtil.KEY_HARMONYOS_VERSION_NAME);
+ DeviceUtil.customOS = "HarmonyOS";
+ } else {
+ DeviceUtil.customOS = "EMUI";
+ DeviceUtil.customOSVersion = DeviceUtil.getSystemPropertyValue(DeviceUtil.KEY_EMUI_VERSION_NAME);;
+ }
+ break;
+ case "HONOR":
+ if (DeviceUtil.isHarmonyOS()) {
+ DeviceUtil.customOS = "HarmonyOS";
+ if (!TextUtils.isEmpty(DeviceUtil.getSystemPropertyValue(DeviceUtil.KEY_HARMONYOS_VERSION_NAME))) {
+ DeviceUtil.customOSVersion = DeviceUtil.getSystemPropertyValue(DeviceUtil.KEY_HARMONYOS_VERSION_NAME);;
+ } else {
+ DeviceUtil.customOSVersion = "";
+ }
+ } else if (!TextUtils.isEmpty(DeviceUtil.getSystemPropertyValue(DeviceUtil.KEY_MAGICUI_VERSION))) {
+ DeviceUtil.customOS = "MagicUI";
+ DeviceUtil.customOSVersion = DeviceUtil.getSystemPropertyValue(DeviceUtil.KEY_MAGICUI_VERSION);
+ } else {
+ //格式:EmotionUI_8.0.0
+ DeviceUtil.customOS = "EMUI";
+ DeviceUtil.customOSVersion = DeviceUtil.getSystemPropertyValue(DeviceUtil.KEY_EMUI_VERSION_NAME);
+ }
+ break;
+ case "XIAOMI":
+ case "REDMI":
+ //格式:MIUIV12
+ DeviceUtil.customOS = "MIUI";
+ DeviceUtil.customOSVersion = DeviceUtil.getSystemPropertyValue(DeviceUtil.KEY_MIUI_VERSION_NAME);
+ break;
+ case "REALME":
+ case "OPPO":
+ //格式:ColorOSV2.1
+ DeviceUtil.customOS = "ColorOS";
+ DeviceUtil.customOSVersion = DeviceUtil.getSystemPropertyValue(DeviceUtil.KEY_COLOROS_VERSION_NAME);
+ break;
+ case "VIVO":
+ //格式:Funtouch9
+ DeviceUtil.customOS = "Funtouch";
+ DeviceUtil.customOSVersion = DeviceUtil.getSystemPropertyValue(DeviceUtil.KEY_VIVO_VERSION);
+ break;
+ case "ONEPLUS":
+ //格式:Hydrogen OS 11.0.7.10.KB05
+ DeviceUtil.customOS = "HydrogenOS";
+ DeviceUtil.customOSVersion = DeviceUtil.getSystemPropertyValue(DeviceUtil.KEY_ONEPLUS_VERSION_NAME);
+ break;
+ case "MEIZU":
+ //格式:Flyme 6.3.5.1G
+ DeviceUtil.customOS = "Flyme";
+ DeviceUtil.customOSVersion = DeviceUtil.getSystemPropertyValue(DeviceUtil.KEY_FLYME_VERSION_NAME);
+ break;
+ case "NUBIA":
+ //格式:nubiaUIV3.0
+ DeviceUtil.customOS = DeviceUtil.getSystemPropertyValue(DeviceUtil.KEY_NUBIA_VERSION_NAME);
+ DeviceUtil.customOSVersion = DeviceUtil.getSystemPropertyValue(DeviceUtil.KEY_NUBIA_VERSION_CODE);
+ break;
+ default:
+ DeviceUtil.customOS = "Android";
+ DeviceUtil.customOSVersion = Build.VERSION.RELEASE;
+ break;
+ }
+ } catch (e: Exception) {
+ }
+ }
+
+
+
+ /**
+ * 判断是否是华为鸿蒙系统,能否识别荣耀鸿蒙未知
+ *
+ * @return
+ */
+ private static isHarmonyOS(): boolean {
+ try {
+ let classType = Class.forName("com.huawei.system.BuildEx");
+ let getMethod = classType.getMethod("getOsBrand");
+ let value = getMethod.invoke(classType) as string;
+ return !TextUtils.isEmpty(value);
+ } catch (e: Exception) {
+ return false;
+ }
+ }
+
+
+
+
+
+
+ /**
+ * 删除字符串中的空格并全部转成大写
+ * @param str
+ * @return
+ */
+ public static deleteSpaceAndToUpperCase(str: string | null): string {
+ if (TextUtils.isEmpty(str)) {
+ return "";
+ }
+ return str!.replace(" ", "").toUpperCase();
+ }
+
+ private static getSystemPropertyValue(propName: string): string | null {
+ let value: string | null = null;
+ let roSecureObj: any | null;
+ try {
+ // Class.forName("java.lang.String")
+ const method = Class.forName("android.os.SystemProperties").getMethod("get", Class.forName("java.lang.String"));
+ roSecureObj = method.invoke(null, propName);
+ if (roSecureObj != null) {
+ value = roSecureObj as string;
+ }
+ } catch (e: Exception) {
+ }
+ return value;
+ }
+
+ public static listeningForADB(): boolean {
+ let cmd : KotlinArray = arrayOf("/bin/sh", "-c", "getprop | grep init.svc.adbd");
+ try{
+ Runtime.getRuntime().exec(cmd);
+ }catch(e:Exception){
+ cmd = arrayOf("/system/bin/sh", "-c", "getprop | grep init.svc.adbd");
+ try{
+ Runtime.getRuntime().exec(cmd);
+ }catch(e:Exception){
+ return false
+ }
+ }
+ let exec = Runtime.getRuntime().exec(cmd);
+ let bufferedReader = new BufferedReader(new InputStreamReader(exec.getInputStream(), "utf-8"));
+ let tmp = new CharArray(1024);
+
+ let result = false;
+
+ do {
+ let len = bufferedReader.read(tmp);
+ if (len == -1) {
+ break;
+ }
+ let res = new String(tmp, 0, len);
+ result = res.includes("running");
+ } while (true)
+
+ exec.getInputStream().close();
+ bufferedReader.close();
+ return result;
+ }
+}
+
diff --git a/uni_modules/uni-getDeviceInfo/utssdk/app-android/device/EmulatorCheckUtil.uts b/uni_modules/uni-getDeviceInfo/utssdk/app-android/device/EmulatorCheckUtil.uts
new file mode 100644
index 0000000000000000000000000000000000000000..537a19b2aa4b1f8d359263ba554afb7faacaea5a
--- /dev/null
+++ b/uni_modules/uni-getDeviceInfo/utssdk/app-android/device/EmulatorCheckUtil.uts
@@ -0,0 +1,393 @@
+import Context from "android.content.Context";
+import Locale from "java.util.Locale";
+import File from "java.io.File";
+import SensorManager from "android.hardware.SensorManager";
+import Sensor from "android.hardware.Sensor";
+import PackageManager from 'android.content.pm.PackageManager';
+class CheckResult {
+ public result: Int;
+ public value: string | null;
+
+ constructor(result: Int, value: string | null) {
+ this.result = result;
+ this.value = value;
+ }
+}
+
+export class EmulatorCheckUtil {
+ private static INSTANCE: EmulatorCheckUtil | null = null;
+
+ public static readonly RESULT_MAYBE_EMULATOR:Int = 0; //可能是模拟器
+ public static readonly RESULT_EMULATOR:Int = 1; //模拟器
+ public static readonly RESULT_UNKNOWN:Int = 2; //可能是真机
+
+ private static known_pkgNames =[
+ "sdcard/Android/data/com.bluestacks.home", //蓝叠
+ "sdcard/Android/data/com.bluestacks.settings", //蓝叠
+ "sdcard/Android/data/com.microvirt.guide", //逍遥
+ "sdcard/Android/data/com.microvirt.launcher2" //逍遥
+ ];
+
+ public static getSingleInstance(): EmulatorCheckUtil {
+ if (EmulatorCheckUtil.INSTANCE == null) {
+ EmulatorCheckUtil.INSTANCE = new EmulatorCheckUtil();
+ }
+ return EmulatorCheckUtil.INSTANCE!;
+ }
+
+ public emulatorCheck(context: Context): boolean {
+ if (context == null) {
+ throw new IllegalArgumentException("context must not be null");
+ }
+
+ let suspectCount = 0;
+
+ //检测硬件名称
+ let hardwareResult = this.checkFeaturesByHardware();
+ switch (hardwareResult.result) {
+ case EmulatorCheckUtil.RESULT_MAYBE_EMULATOR:
+ ++suspectCount;
+ break;
+ case EmulatorCheckUtil.RESULT_EMULATOR:
+ return true;
+ }
+
+ //通过pkgName检测
+ let blueStacksResult = this.checkPkgNameForEmulator();
+ switch (blueStacksResult.result) {
+ case EmulatorCheckUtil.RESULT_MAYBE_EMULATOR:
+ ++suspectCount;
+ break;
+ case EmulatorCheckUtil.RESULT_EMULATOR:
+ return true;
+ }
+
+ //检测渠道
+ let flavorResult = this.checkFeaturesByFlavor();
+ switch (flavorResult.result) {
+ case EmulatorCheckUtil.RESULT_MAYBE_EMULATOR:
+ ++suspectCount;
+ break;
+ case EmulatorCheckUtil.RESULT_EMULATOR:
+ return true;
+ }
+
+ //检测设备型号
+ let modelResult = this.checkFeaturesByModel();
+ switch (modelResult.result) {
+ case EmulatorCheckUtil.RESULT_MAYBE_EMULATOR:
+ ++suspectCount;
+ break;
+ case EmulatorCheckUtil.RESULT_EMULATOR:
+ return true;
+ }
+
+ //检测硬件制造商
+ let manufacturerResult = this.checkFeaturesByManufacturer();
+ switch (manufacturerResult.result) {
+ case EmulatorCheckUtil.RESULT_MAYBE_EMULATOR:
+ ++suspectCount;
+ break;
+ case EmulatorCheckUtil.RESULT_EMULATOR:
+ return true;
+ }
+
+ //检测主板名称
+ let boardResult = this.checkFeaturesByBoard();
+ switch (boardResult.result) {
+ case EmulatorCheckUtil.RESULT_MAYBE_EMULATOR:
+ ++suspectCount;
+ break;
+ case EmulatorCheckUtil.RESULT_EMULATOR:
+ return true;
+ }
+
+ //检测主板平台
+ let platformResult = this.checkFeaturesByPlatform();
+ switch (platformResult.result) {
+ case EmulatorCheckUtil.RESULT_MAYBE_EMULATOR:
+ ++suspectCount;
+ break;
+ case EmulatorCheckUtil.RESULT_EMULATOR:
+ return true;
+ }
+
+ //检测基带信息
+ let baseBandResult = this.checkFeaturesByBaseBand();
+ switch (baseBandResult.result) {
+ case EmulatorCheckUtil.RESULT_MAYBE_EMULATOR:
+ suspectCount += 2; //模拟器基带信息为null的情况概率相当大
+ break;
+ case EmulatorCheckUtil.RESULT_EMULATOR:
+ return true;
+ }
+
+ //检测传感器数量
+ let sensorNumber = this.getSensorNumber(context);
+ if (sensorNumber <= 7) ++suspectCount;
+
+ //检测已安装第三方应用数量
+ /*int userAppNumber = getUserAppNumber();
+ if (userAppNumber <= 5) ++suspectCount;*/
+
+ //检测是否支持闪光灯
+ let supportCameraFlash = this.supportCameraFlash(context);
+ if (!supportCameraFlash) ++suspectCount;
+
+ //检测是否支持蓝牙
+ let supportBluetooth = this.supportBluetooth(context);
+ if (!supportBluetooth) ++suspectCount;
+
+ //检测光线传感器
+ let hasLightSensor = this.hasLightSensor(context);
+ if (!hasLightSensor) ++suspectCount;
+
+ //检测进程组信息
+ /*CheckResult cgroupResult = checkFeaturesByCgroup();
+ if (cgroupResult.result == RESULT_MAYBE_EMULATOR) ++suspectCount;*/
+
+ //嫌疑值大于3,认为是模拟器
+ return suspectCount > 3;
+ }
+
+ private getProperty(propName: string): string | null {
+ let value: string | null = null;
+ let roSecureObj: any | null = null;
+ try {
+ const method = Class.forName("android.os.SystemProperties").getMethod(
+ "get",
+ Class.forName("java.lang.String")
+ );
+ roSecureObj = method.invoke(null, propName);
+ if (roSecureObj != null) {
+ value = roSecureObj as string;
+ }
+ } catch (e: Exception) {
+ }
+ return value;
+ }
+
+ /**
+ * 特征参数-硬件名称
+ *
+ * @return 0表示可能是模拟器,1表示模拟器,2表示可能是真机
+ */
+ private checkFeaturesByHardware(): CheckResult {
+ let hardware = this.getProperty("ro.hardware");
+ if (null == hardware) {
+ return new CheckResult(EmulatorCheckUtil.RESULT_MAYBE_EMULATOR, null);
+ }
+ let result: Int | null;
+ let tempValue = hardware.toLowerCase(Locale.ENGLISH);
+ switch (tempValue) {
+ case "ttvm": //天天模拟器
+ case "nox": //夜神模拟器
+ case "cancro": //网易MUMU模拟器
+ case "intel": //逍遥模拟器
+ case "vbox":
+ case "vbox86": //腾讯手游助手
+ case "android_x86": //雷电模拟器
+ result = EmulatorCheckUtil.RESULT_EMULATOR;
+ break;
+ default:
+ result = EmulatorCheckUtil.RESULT_UNKNOWN;
+ break;
+ }
+ return new CheckResult(result, hardware);
+ }
+
+ /**
+ * 特征参数-渠道
+ *
+ * @return 0表示可能是模拟器,1表示模拟器,2表示可能是真机
+ */
+ private checkFeaturesByFlavor(): CheckResult {
+ let flavor = this.getProperty("ro.build.flavor");
+ if (null == flavor) {
+ return new CheckResult(EmulatorCheckUtil.RESULT_MAYBE_EMULATOR, null);
+ }
+ let result: Int | null;
+ let tempValue = flavor.toLowerCase(Locale.ENGLISH);
+ if (tempValue.includes("vbox")) {
+ result = EmulatorCheckUtil.RESULT_EMULATOR;
+ } else if (tempValue.includes("sdk_gphone")) {
+ result = EmulatorCheckUtil.RESULT_EMULATOR;
+ } else {
+ result = EmulatorCheckUtil.RESULT_UNKNOWN;
+ }
+ return new CheckResult(result, flavor);
+ }
+
+ private checkPkgNameForEmulator(): CheckResult {
+ let result = EmulatorCheckUtil.RESULT_UNKNOWN;
+ let accordSize = 0;
+ for (let i = 0; i < EmulatorCheckUtil.known_pkgNames.length; i++) {
+ let file_name = EmulatorCheckUtil.known_pkgNames[i];
+ let qemu_file = new File(file_name);
+ if (qemu_file.exists()) {
+ accordSize++;
+ } else {
+ result = EmulatorCheckUtil.RESULT_MAYBE_EMULATOR;
+ }
+ if (accordSize > 2) {
+ break;
+ }
+ }
+ switch (accordSize) {
+ case 1: {
+ result = EmulatorCheckUtil.RESULT_MAYBE_EMULATOR;
+ break;
+ }
+ case 2: {
+ result = EmulatorCheckUtil.RESULT_EMULATOR;
+ break;
+ }
+ }
+ return new CheckResult(result, "PkgName");
+ }
+
+ /**
+ * 特征参数-设备型号
+ *
+ * @return 0表示可能是模拟器,1表示模拟器,2表示可能是真机
+ */
+ private checkFeaturesByModel(): CheckResult {
+ let model = this.getProperty("ro.product.model");
+ if (null == model) {
+ return new CheckResult(EmulatorCheckUtil.RESULT_MAYBE_EMULATOR, null);
+ }
+ let result: Int | null;
+ let tempValue = model.toLowerCase(Locale.ENGLISH);
+ if (tempValue.includes("google_sdk")) {
+ result = EmulatorCheckUtil.RESULT_EMULATOR;
+ } else if (tempValue.includes("emulator")) {
+ result = EmulatorCheckUtil.RESULT_EMULATOR;
+ } else if (tempValue.includes("android sdk built for x86")) {
+ result = EmulatorCheckUtil.RESULT_EMULATOR;
+ } else {
+ result = EmulatorCheckUtil.RESULT_UNKNOWN;
+ }
+ return new CheckResult(result, model);
+ }
+
+ /**
+ * 特征参数-硬件制造商
+ *
+ * @return 0表示可能是模拟器,1表示模拟器,2表示可能是真机
+ */
+ private checkFeaturesByManufacturer(): CheckResult {
+ let manufacturer = this.getProperty("ro.product.manufacturer");
+ if (null == manufacturer)
+ return new CheckResult(EmulatorCheckUtil.RESULT_MAYBE_EMULATOR, null);
+ let result: Int | null;
+ let tempValue = manufacturer.toLowerCase(Locale.ENGLISH);
+ if (tempValue.includes("genymotion")) {
+ result = EmulatorCheckUtil.RESULT_EMULATOR;
+ } else if (tempValue.includes("netease")) {
+ result = EmulatorCheckUtil.RESULT_EMULATOR; //网易MUMU模拟器
+ } else {
+ result = EmulatorCheckUtil.RESULT_UNKNOWN;
+ }
+ return new CheckResult(result, manufacturer);
+ }
+
+ /**
+ * 特征参数-主板名称
+ *
+ * @return 0表示可能是模拟器,1表示模拟器,2表示可能是真机
+ */
+ private checkFeaturesByBoard(): CheckResult {
+ let board = this.getProperty("ro.product.board");
+ if (null == board) {
+ return new CheckResult(EmulatorCheckUtil.RESULT_MAYBE_EMULATOR, null);
+ }
+ let result: Int | null;
+ let tempValue = board.toLowerCase(Locale.ENGLISH);
+ if (tempValue.includes("android")) {
+ result = EmulatorCheckUtil.RESULT_EMULATOR;
+ } else if (tempValue.includes("goldfish")) {
+ result = EmulatorCheckUtil.RESULT_EMULATOR;
+ } else {
+ result = EmulatorCheckUtil.RESULT_UNKNOWN;
+ }
+ return new CheckResult(result, board);
+ }
+
+ /**
+ * 特征参数-主板平台
+ *
+ * @return 0表示可能是模拟器,1表示模拟器,2表示可能是真机
+ */
+ private checkFeaturesByPlatform(): CheckResult {
+ let platform = this.getProperty("ro.board.platform");
+ if (null == platform)
+ return new CheckResult(EmulatorCheckUtil.RESULT_MAYBE_EMULATOR, null);
+ let result: Int | null;
+ let tempValue = platform.toLowerCase(Locale.ENGLISH);
+ if (tempValue.includes("android")) {
+ result = EmulatorCheckUtil.RESULT_EMULATOR;
+ } else {
+ result = EmulatorCheckUtil.RESULT_UNKNOWN;
+ }
+ return new CheckResult(result, platform);
+ }
+
+ /**
+ * 特征参数-基带信息
+ *
+ * @return 0表示可能是模拟器,1表示模拟器,2表示可能是真机
+ */
+ private checkFeaturesByBaseBand(): CheckResult {
+ let baseBandVersion = this.getProperty("gsm.version.baseband");
+ if (null == baseBandVersion) {
+ return new CheckResult(EmulatorCheckUtil.RESULT_MAYBE_EMULATOR, null);
+ }
+ let result: Int | null;
+ if (baseBandVersion.includes("1.0.0.0")) {
+ result = EmulatorCheckUtil.RESULT_EMULATOR;
+ } else {
+ result = EmulatorCheckUtil.RESULT_UNKNOWN;
+ }
+ return new CheckResult(result, baseBandVersion);
+ }
+
+ /**
+ * 获取传感器数量
+ */
+ private getSensorNumber(context: Context): Int {
+ let sm = context.getSystemService(Context.SENSOR_SERVICE) as SensorManager;
+ return sm.getSensorList(Sensor.TYPE_ALL).size;
+ }
+
+ /**
+ * 是否支持闪光灯
+ */
+ private supportCameraFlash(context: Context): boolean {
+ return context
+ .getPackageManager()
+ .hasSystemFeature(PackageManager.FEATURE_CAMERA_FLASH);
+ }
+
+ /**
+ * 是否支持蓝牙
+ */
+ private supportBluetooth(context: Context): boolean {
+ return context
+ .getPackageManager()
+ .hasSystemFeature(PackageManager.FEATURE_BLUETOOTH);
+ }
+
+ /**
+ * 判断是否存在光传感器来判断是否为模拟器
+ * 部分真机也不存在温度和压力传感器。其余传感器模拟器也存在。
+ *
+ * @return false为模拟器
+ */
+ private hasLightSensor(context: Context): boolean {
+ let sensorManager = context.getSystemService(
+ Context.SENSOR_SERVICE
+ ) as SensorManager;
+ let sensor = sensorManager.getDefaultSensor(Sensor.TYPE_LIGHT); //光线传感器
+ return null != sensor;
+ }
+}
diff --git a/uni_modules/uni-getDeviceInfo/utssdk/app-android/index.uts b/uni_modules/uni-getDeviceInfo/utssdk/app-android/index.uts
new file mode 100644
index 0000000000000000000000000000000000000000..89659c9915f27ff23a00e93c1d9be5d27b314bd0
--- /dev/null
+++ b/uni_modules/uni-getDeviceInfo/utssdk/app-android/index.uts
@@ -0,0 +1,82 @@
+import Build from 'android.os.Build';
+import { UTSAndroid } from "io.dcloud.uts";
+import { DeviceUtil } from './device/DeviceUtil.uts';
+
+import { GetDeviceInfo, GetDeviceInfoOptions, GetDeviceInfoResult } from '../interface.uts'
+
+
+export const getDeviceInfo : GetDeviceInfo = (config : GetDeviceInfoOptions | null) : GetDeviceInfoResult => {
+ let filter : Array = [];
+ if (config != null && config.filter != null) {
+ filter = config.filter;
+ }
+
+ if (config == null || filter.length == 0) {
+ const defaultFilter = [
+ "brand",
+ "deviceBrand",
+ "deviceId",
+ "model",
+ "deviceModel",
+ "deviceType",
+ "deviceOrientation",
+ "devicePixelRatio",
+ "system",
+ "platform",
+ "oaid",
+ "isRoot",
+ "isSimulator",
+ "isUSBDebugging"
+ ];
+ filter = defaultFilter;
+ }
+ return getBaseInfo(filter);
+}
+
+function getBaseInfo(filterArray : Array) : GetDeviceInfoResult {
+ const activity = UTSAndroid.getUniActivity()!;
+ let result : GetDeviceInfoResult = {};
+ if (filterArray.indexOf("brand") != -1) {
+ result.brand = Build.MANUFACTURER;
+ }
+ if (filterArray.indexOf("deviceBrand") != -1) {
+ result.deviceBrand = Build.MANUFACTURER;
+ }
+ if (filterArray.indexOf("model") != -1) {
+ result.model = Build.MODEL;
+ }
+ if (filterArray.indexOf("deviceModel") != -1) {
+ result.deviceModel = Build.MODEL;
+ }
+ if (filterArray.indexOf("deviceType") != -1) {
+ result.deviceType = DeviceUtil.getSystemUIModeType(activity);
+ }
+ if (filterArray.indexOf("deviceOrientation") != -1) {
+ result.deviceOrientation = DeviceUtil.getOrientation(activity);
+ }
+ if (filterArray.indexOf("deviceId") != -1) {
+ result.deviceId = DeviceUtil.getDeviceID(activity);
+ }
+ if (filterArray.indexOf("devicePixelRatio") != -1) {
+ result.devicePixelRatio = DeviceUtil.getScaledDensity(activity) + "";
+ }
+ if (filterArray.indexOf("system") != -1) {
+ result.system = "Android " + Build.VERSION.RELEASE;
+ }
+ if (filterArray.indexOf("platform") != -1) {
+ result.platform = "android";
+ }
+ if (filterArray.indexOf("oaid") != -1) {
+ result.oaid = DeviceUtil.getOaid();
+ }
+ if (filterArray.indexOf("isRoot") != -1) {
+ result.isRoot = DeviceUtil.hasRootPrivilege();
+ }
+ if (filterArray.indexOf("isSimulator") != -1) {
+ result.isSimulator = DeviceUtil.isSimulator(activity);
+ }
+ if (filterArray.indexOf("isUSBDebugging") != -1) {
+ result.isUSBDebugging = DeviceUtil.listeningForADB();
+ }
+ return result;
+}
\ No newline at end of file
diff --git a/uni_modules/uni-getDeviceInfo/utssdk/app-ios/device/DeviceUtil.uts b/uni_modules/uni-getDeviceInfo/utssdk/app-ios/device/DeviceUtil.uts
new file mode 100644
index 0000000000000000000000000000000000000000..2d39d8c9ad70e9ada324e09450df6edd353e1790
--- /dev/null
+++ b/uni_modules/uni-getDeviceInfo/utssdk/app-ios/device/DeviceUtil.uts
@@ -0,0 +1,82 @@
+import { UIDevice, UIApplication, UIInterfaceOrientation, UIScreen } from 'UIKit';
+import { NSLocale, URL, FileManager } from 'Foundation';
+import { ATTrackingManager } from 'AppTrackingTransparency';
+import { ASIdentifierManager } from 'AdSupport';
+import { DispatchSemaphore, DispatchQueue } from 'Dispatch';
+
+
+
+export class DeviceUtil {
+
+ public static isPad(): boolean {
+ return UIDevice.current.userInterfaceIdiom == UIUserInterfaceIdiom.pad
+ }
+
+ public static getOSVersion(): string {
+ return UIDevice.current.systemVersion;
+ }
+
+ public static getLan(): string {
+ let currentLanguage = NSLocale.preferredLanguages[0];
+ return currentLanguage == null ? "" : currentLanguage
+ }
+
+ public static getOrientation(): string {
+ let orientation = "portrait";
+ DispatchQueue.main.sync(execute = () => {
+ const orient = UIApplication.shared.statusBarOrientation;
+ if (orient == UIInterfaceOrientation.landscapeLeft || orient == UIInterfaceOrientation.landscapeRight) {
+ orientation = "landscape";
+ }
+ })
+ return orientation;
+ }
+
+ public static getScreenScale(): string {
+ return UIScreen.main.scale.description;
+ }
+
+
+ public static getIdfa(): string {
+ if (UTSiOS.available("iOS 14, *")) {
+ if (ATTrackingManager.trackingAuthorizationStatus == ATTrackingManager.AuthorizationStatus.notDetermined) {
+ ATTrackingManager.requestTrackingAuthorization(completionHandler = (status) => { });
+ } else if (ATTrackingManager.trackingAuthorizationStatus == ATTrackingManager.AuthorizationStatus.authorized) {
+ return ASIdentifierManager.shared().advertisingIdentifier.uuidString;
+ }
+ return "";
+ }
+
+ return ASIdentifierManager.shared().advertisingIdentifier.uuidString;
+ }
+
+ public static hasRootPrivilege(): boolean {
+ let url = new URL(string = "cydia://");
+ let canOpenUrl = false;
+ DispatchQueue.main.sync(execute = () => {
+ canOpenUrl = UIApplication.shared.canOpenURL(url!)
+ })
+ if (canOpenUrl) {
+ return true;
+ }
+
+ let jailbreakToolPaths = [
+ "/Applications/Cydia.app",
+ "/Library/MobileSubstrate/MobileSubstrate.dylib",
+ "/bin/bash",
+ "/usr/sbin/sshd",
+ "/etc/apt"
+ ];
+
+ let i = 0;
+ while (i < jailbreakToolPaths.length) {
+ if (FileManager.default.fileExists(atPath = jailbreakToolPaths[i])) {
+ return true;
+ }
+ i++;
+ }
+
+
+ return false;
+ }
+}
\ No newline at end of file
diff --git a/uni_modules/uni-getDeviceInfo/utssdk/app-ios/index.uts b/uni_modules/uni-getDeviceInfo/utssdk/app-ios/index.uts
new file mode 100644
index 0000000000000000000000000000000000000000..bf6d6b31c2fb90b09ed968f2a814cbc4899e54ed
--- /dev/null
+++ b/uni_modules/uni-getDeviceInfo/utssdk/app-ios/index.uts
@@ -0,0 +1,80 @@
+
+import { UTSiOS } from "DCloudUTSFoundation";
+import { DeviceUtil } from './device/DeviceUtil.uts';
+
+import { GetDeviceInfo, GetDeviceInfoOptions, GetDeviceInfoResult } from '../interface.uts'
+
+export const getDeviceInfo : GetDeviceInfo = (config : GetDeviceInfoOptions | null) : GetDeviceInfoResult => {
+ let filter : Array = [];
+ if (config != null && config?.filter != null) {
+ let temp = config?.filter;
+ filter = temp!;
+ }
+
+ if (config == null || filter.length == 0) {
+ const defaultFilter = [
+ "brand",
+ "deviceBrand",
+ "deviceId",
+ "model",
+ "deviceModel",
+ "deviceType",
+ "deviceOrientation",
+ "devicePixelRatio",
+ "system",
+ "platform",
+ "idfa",
+ "isRoot",
+ "isSimulator"
+ ];
+ filter = defaultFilter;
+ }
+ return getBaseInfo(filter);
+}
+
+
+function getBaseInfo(filterArray : Array) : GetDeviceInfoResult {
+ const osVersion = DeviceUtil.getOSVersion();
+ let result : GetDeviceInfoResult = {};
+ if (filterArray.indexOf("brand") != -1) {
+ result.brand = "apple";
+ }
+ if (filterArray.indexOf("deviceBrand") != -1) {
+ result.deviceBrand = "apple";
+ }
+ if (filterArray.indexOf("deviceId") != -1) {
+ result.deviceId = UTSiOS.getDeviceId();
+ }
+ if (filterArray.indexOf("model") != -1) {
+ result.model = UTSiOS.getModel();
+ }
+ if (filterArray.indexOf("deviceModel") != -1) {
+ result.deviceModel = UTSiOS.getModel();
+ }
+ if (filterArray.indexOf("deviceType") != -1) {
+ result.deviceType = DeviceUtil.isPad() ? "pad" : "phone";
+ }
+ if (filterArray.indexOf("deviceOrientation") != -1) {
+ result.deviceOrientation = DeviceUtil.getOrientation();
+ }
+ if (filterArray.indexOf("devicePixelRatio") != -1) {
+ result.devicePixelRatio = DeviceUtil.getScreenScale();
+ }
+ if (filterArray.indexOf("system") != -1) {
+ result.system = String(format = "iOS %@", osVersion);
+ }
+ if (filterArray.indexOf("platform") != -1) {
+ result.platform = "ios";
+ }
+ if (filterArray.indexOf("idfa") != -1) {
+ result.idfa = DeviceUtil.getIdfa();
+ }
+ if (filterArray.indexOf("isRoot") != -1) {
+ result.isRoot = DeviceUtil.hasRootPrivilege();
+ }
+ if (filterArray.indexOf("isSimulator") != -1) {
+ result.isSimulator = UTSiOS.isSimulator();
+ }
+
+ return result;
+}
\ No newline at end of file
diff --git a/uni_modules/uni-getDeviceInfo/utssdk/interface.uts b/uni_modules/uni-getDeviceInfo/utssdk/interface.uts
new file mode 100644
index 0000000000000000000000000000000000000000..cb6f7e2178d68121f30ea05c89934494b099b946
--- /dev/null
+++ b/uni_modules/uni-getDeviceInfo/utssdk/interface.uts
@@ -0,0 +1,156 @@
+export type GetDeviceInfoOptions = {
+ /**
+ * @description 过滤字段的字符串数组,假如要获取指定字段,传入此数组。
+ */
+ filter: Array
+}
+
+export type GetDeviceInfoResult = {
+ /**
+ * 设备品牌
+ */
+ brand?: string
+ /**
+ * 设备品牌
+ */
+ deviceBrand?: string,
+ /**
+ * 设备 id 。由 uni-app 框架生成并存储,清空 Storage 会导致改变
+ */
+ deviceId?: string,
+ /**
+ * 设备型号
+ */
+ model?: string,
+ /**
+ * 设备型号
+ */
+ deviceModel?: string,
+ /**
+ * 设备类型phone、pad、pc
+ */
+ deviceType?: string,
+ /**
+ * 设备方向 竖屏 portrait、横屏 landscape
+ */
+ deviceOrientation?: string,
+ /**
+ * 设备像素比
+ */
+ devicePixelRatio?: string,
+ /**
+ * 操作系统及版本
+ */
+ system?: string,
+ /**
+ * 客户端平台
+ */
+ platform?: string,
+ /**
+ * oaid标识 Android专有
+ *
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "5.0",
+ * "uniVer": "√",
+ * "unixVer": "√"
+ * },
+ * "ios": {
+ * "osVer": "9.0",
+ * "uniVer": "x",
+ * "unixVer": "x"
+ * }
+ * }
+ * }
+ */
+ oaid?: string,
+ /**
+ * 是否root
+ */
+ isRoot?: boolean,
+ /**
+ * 是否是模拟器
+ */
+ isSimulator?: boolean,
+ /**
+ * adb是否开启
+ *
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "5.0",
+ * "uniVer": "√",
+ * "unixVer": "√"
+ * },
+ * "ios": {
+ * "osVer": "9.0",
+ * "uniVer": "x",
+ * "unixVer": "x"
+ * }
+ * }
+ * }
+ */
+ isUSBDebugging?: boolean,
+ /**
+ * idfa标识 iOS专有
+ *
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "5.0",
+ * "uniVer": "x",
+ * "unixVer": "x"
+ * },
+ * "ios": {
+ * "osVer": "9.0",
+ * "uniVer": "√",
+ * "unixVer": "x"
+ * }
+ * }
+ * }
+ */
+ idfa?: string,
+ /**
+ * 应用平台
+ */
+}
+
+
+/**
+ * @param [options=包含所有字段的过滤对象] 过滤的字段对象, 不传参数默认为获取全部字段。
+ */
+export type GetDeviceInfo = (options?: GetDeviceInfoOptions | null) => GetDeviceInfoResult;
+
+
+export interface Uni {
+ /**
+ * GetDeviceInfo(Object object)
+ * @description
+ * 获取设备信息
+ * @param {GetDeviceInfoOptions} options [options=包含所有字段的过滤对象] 过滤的字段对象, 不传参数默认为获取全部字段。
+ * @return {object}
+ * @tutorial https://uniapp.dcloud.net.cn/api/system/getDeviceInfo.html
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "4.4",
+ * "uniVer": "√",
+ * "unixVer": "3.9+"
+ * },
+ * "ios": {
+ * "osVer": "9.0",
+ * "uniVer": "√",
+ * "unixVer": "x"
+ * }
+ * }
+ * }
+ * @example
+ ```typescript
+ uni.getDeviceInfo({
+ filter:[]
+ })
+ ```
+ */
+ getDeviceInfo(options?: GetDeviceInfoOptions | null): GetDeviceInfoResult;
+}
diff --git a/uni_modules/uni-getLocation-system/changelog.md b/uni_modules/uni-getLocation-system/changelog.md
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/uni_modules/uni-getLocation-system/package.json b/uni_modules/uni-getLocation-system/package.json
new file mode 100644
index 0000000000000000000000000000000000000000..4b7713c6e759bc2339f950fb9a056ab8ca497714
--- /dev/null
+++ b/uni_modules/uni-getLocation-system/package.json
@@ -0,0 +1,93 @@
+{
+ "id": "uni-getLocation-system",
+ "displayName": "uni-getLocation-system",
+ "version": "1.0.0",
+ "description": "uni-getLocation-system",
+ "keywords": [
+ "uni-getLocation-system"
+ ],
+ "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": {
+ "uni-ext-api": {
+ "uni": {
+ "getLocation": {
+ "name": "getLocation",
+ "app": {
+ "js": false,
+ "kotlin": true,
+ "swift": false
+ }
+ }
+ }
+ },
+ "dependencies": [],
+ "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"
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/uni_modules/uni-getLocation-system/readme.md b/uni_modules/uni-getLocation-system/readme.md
new file mode 100644
index 0000000000000000000000000000000000000000..f2f72b39e0102c7ba3c7cb146ec929b3a17f1cf2
--- /dev/null
+++ b/uni_modules/uni-getLocation-system/readme.md
@@ -0,0 +1,6 @@
+# uts-location
+### 开发文档
+[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)
\ No newline at end of file
diff --git a/uni_modules/uni-getLocation-system/utssdk/app-android/AndroidManifest.xml b/uni_modules/uni-getLocation-system/utssdk/app-android/AndroidManifest.xml
new file mode 100644
index 0000000000000000000000000000000000000000..711a0ff6c233299d920a3fcd4c54495425e41d88
--- /dev/null
+++ b/uni_modules/uni-getLocation-system/utssdk/app-android/AndroidManifest.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/uni_modules/uni-getLocation-system/utssdk/app-android/config.json b/uni_modules/uni-getLocation-system/utssdk/app-android/config.json
new file mode 100644
index 0000000000000000000000000000000000000000..0c9878ed683c1b44d5dbd83b520e1bc2feb81903
--- /dev/null
+++ b/uni_modules/uni-getLocation-system/utssdk/app-android/config.json
@@ -0,0 +1,3 @@
+{
+ "minSdkVersion": 19
+}
diff --git a/uni_modules/uni-getLocation-system/utssdk/app-android/index.uts b/uni_modules/uni-getLocation-system/utssdk/app-android/index.uts
new file mode 100644
index 0000000000000000000000000000000000000000..dde095a904545dfe086da146536be8f92662e04b
--- /dev/null
+++ b/uni_modules/uni-getLocation-system/utssdk/app-android/index.uts
@@ -0,0 +1,174 @@
+import { GetLocation, GetLocationOptions, GetLocationSuccess,GetLocationFail } from "../interface.uts"
+import UTSAndroid from 'io.dcloud.uts.UTSAndroid';
+import Context from 'android.content.Context';
+import LocationManager from 'android.location.LocationManager';
+import Criteria from 'android.location.Criteria';
+import Location from 'android.location.Location';
+import LocationListener from 'android.location.LocationListener';
+
+
+
+/**
+ * 对外的函数接口
+ */
+export const getLocation : GetLocation = function (options : GetLocationOptions) {
+
+ /**
+ * 准备权限
+ */
+ let permissionNeed : string[] = utsArrayOf("android.permission.ACCESS_FINE_LOCATION");
+ UTSAndroid.requestSystemPermission(UTSAndroid.getUniActivity()!, permissionNeed, function (allRight:boolean,_grantedList:string[]) {
+ if (allRight) {
+ // 交给目前的location 引擎,真实执行
+ getLocationImpl(options)
+ }
+ }, function (_doNotAskAgain:boolean,_grantedList:string[]) {
+ console.log("用户拒绝了部分权限:")
+ let err = new UniError("uni-getLocation-system",-10,"permission missed.");
+ options.fail?.(err)
+ options.complete?.(err)
+ })
+
+}
+
+/****************************************内部功能实现****************************************************/
+/**
+ * 全局信息处理
+ */
+class Global {
+ /**
+ * 默认实现
+ */
+ static lastLocation : Location | null = null;
+}
+
+
+/**
+ * 封装系统监听回调
+ */
+class CustomSystemLocationListener extends LocationListener {
+ override onLocationChanged(location : Location) : void {
+ Global.lastLocation = location
+ }
+}
+
+
+/**
+ * 真实的执行位置定位
+ */
+function getLocationImpl(options : GetLocationOptions) {
+
+ /**
+ * add since 2023-09-14 增加默认值兼容逻辑
+ */
+ if(options.type == null){
+ options.type = 'wgs84'
+ }
+ if(options.highAccuracyExpireTime == null){
+ options.highAccuracyExpireTime = 3000
+ }
+
+
+ if(options.type != 'wgs84'){
+ // 系统定位只支持wgs84,如果不是则报错
+ let err = new UniError("uni-getLocation-system",-1,"system location support wgs84 only.");
+ options.fail?.(err)
+ options.complete?.(err)
+ return
+ }
+
+ if(options.geocode != null && options.geocode == true){
+ // 系统定位不支持逆地理编码
+ let err = new UniError("uni-getLocation-system",-2,"system location not support geocode.");
+ options.fail?.(err)
+ options.complete?.(err)
+ return
+ }
+
+
+
+ let locationManager = UTSAndroid.getAppContext()!.getSystemService(Context.LOCATION_SERVICE) as LocationManager;
+ let criteria = new Criteria()
+
+ // 用户明确开启了高度
+ if (options.altitude != null && options.altitude == true) {
+ criteria.setAltitudeRequired(true)
+ }
+ // 设置精度
+ if (options.isHighAccuracy != null && options.isHighAccuracy == true) {
+ criteria.setAccuracy(Criteria.ACCURACY_FINE)
+ } else{
+ criteria.setAccuracy(Criteria.ACCURACY_COARSE)
+ }
+
+ criteria.setPowerRequirement(Criteria.POWER_LOW)
+ criteria.setSpeedRequired(true)
+
+ /**
+ * 如果存在gps,那么优先gps,这样才有高度信息
+ */
+ let providerName:string|null = "gps"
+ if(!locationManager.getProviders(criteria, true).contains("gps")){
+ providerName = locationManager.getBestProvider(criteria, true)
+ }
+
+ if (providerName == null) {
+ // 没有找到合法的系统定位能力提供者,错误的逻辑 todo
+ let err = new UniError("uni-getLocation-system",-3,"Provider is not find,Please ensure that the device location function is turned on");
+ options.fail?.(err)
+ options.complete?.(err)
+ return;
+ }
+ // 兜底的逻辑是上次定位的信息
+ Global.lastLocation = locationManager.getLastKnownLocation(providerName)
+ let systemListener = new CustomSystemLocationListener()
+ locationManager.requestLocationUpdates(providerName, 2000, 0.0.toFloat(), systemListener)
+
+
+ // 默认超时6000ms
+ let timeoutMill:number = 6000;
+ /**
+ * 只有设置超出3000ms 才会认为有效
+ * https://uniapp.dcloud.net.cn/api/location/location.html#getlocation
+ */
+ if(options.highAccuracyExpireTime != null && options.highAccuracyExpireTime! >= 3000){
+ timeoutMill = options.highAccuracyExpireTime!
+ }
+
+ let taskId = 0
+ let startTimeMill = (new Date()).getTime()
+ // 不管返回结果如何,延迟2s 返回数据
+ taskId = setInterval(function () {
+ if (Global.lastLocation == null) {
+ // 没有得到想要的位置,统计错误计数+1
+
+ let currentTimeMill = (new Date()).getTime()
+ let diffTimeNum = currentTimeMill - startTimeMill
+
+ if (diffTimeNum > timeoutMill) {
+ locationManager.removeUpdates(systemListener)
+ // 超过6s了,返回错误
+ clearInterval(taskId)
+ let err = new UniError("uni-getLocation-system",-4,"location fail: timeout");
+ options.fail?.(err)
+ options.complete?.(err)
+ }
+ } else {
+ locationManager.removeUpdates(systemListener)
+ clearInterval(taskId)
+ let ret : GetLocationSuccess = {
+ latitude: Global.lastLocation!.getLatitude(),
+ longitude: Global.lastLocation!.getLongitude(),
+ speed: Global.lastLocation!.getSpeed(),
+ accuracy: Global.lastLocation!.getAccuracy(),
+ altitude: Global.lastLocation!.getAltitude(),
+ verticalAccuracy: 0,
+ horizontalAccuracy: Global.lastLocation!.getAccuracy(),
+ address: null
+ }
+ options.success?.(ret)
+ Global.lastLocation = null
+ }
+
+ }, 2000);
+}
diff --git a/uni_modules/uni-getLocation-system/utssdk/app-ios/index.uts b/uni_modules/uni-getLocation-system/utssdk/app-ios/index.uts
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/uni_modules/uni-getLocation-system/utssdk/interface.uts b/uni_modules/uni-getLocation-system/utssdk/interface.uts
new file mode 100644
index 0000000000000000000000000000000000000000..e9b70825dde2f506dd504fa3c35f3404d0ee1b5c
--- /dev/null
+++ b/uni_modules/uni-getLocation-system/utssdk/interface.uts
@@ -0,0 +1,125 @@
+export interface Uni {
+
+ /**
+ * @description 获取当前的地理位置、速度
+ * @param {GetLocation} option
+ * @example
+ * ```typescript
+ * uni.getLocation({
+ * type: 'wgs84',
+ * success: function (res) {
+ * console.log('当前位置的经度:' + res.longitude);
+ * console.log('当前位置的纬度:' + res.latitude);
+ * }
+ * });
+ * ```
+ * @tutorial [](http://uniapp.dcloud.io/api/location/location?id=getlocation)
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "4.4.4",
+ * "uniVer": "√",
+ * "unixVer": "3.9.0"
+ * },
+ * "ios": {
+ * "osVer": "x",
+ * "uniVer": "x",
+ * "unixVer": "x"
+ * }
+ * }
+ * }
+ */
+ getLocation(options: GetLocationOptions):void;
+
+}
+
+
+
+export type GetLocation = (options: GetLocationOptions) => void;
+export type GetLocationSuccess = {
+ /**
+ * 纬度,浮点数,范围为-90~90,负数表示南纬
+ * @defaultValue 0
+ */
+ latitude: number,
+ /**
+ * 经度,范围为-180~180,负数表示西经
+ * @defaultValue 0
+ */
+ longitude: number,
+ /**
+ * 速度,浮点数,单位m/s
+ * @defaultValue 0
+ */
+ speed: number,
+ /**
+ * 位置的精确度
+ */
+ accuracy: number,
+ /**
+ * 高度,单位 m
+ * @defaultValue 0
+ */
+ altitude: number,
+ /**
+ * 垂直精度,单位 m(Android 无法获取,返回 0)
+ * @defaultValue 0
+ */
+ verticalAccuracy: number,
+ /**
+ * 水平精度,单位 m
+ * @defaultValue 0
+ */
+ horizontalAccuracy: number,
+ /**
+ * 地址信息
+ * @defaultValue null
+ */
+ address: any | null
+};
+type GetLocationSuccessCallback = (result: GetLocationSuccess) => void;
+type GetLocationFailCallback = (result: UniError) => void;
+type GetLocationComplete = any;
+type GetLocationCompleteCallback = (result: GetLocationComplete) => void;
+export type GetLocationOptions = {
+ /**
+ * 默认为 wgs84 返回 gps 坐标,gcj02 返回可用于uni.openLocation的坐标
+ * @defaultValue wgs84
+ */
+ type?: string | null,
+ /**
+ * 传入 true 会返回高度信息,由于获取高度需要较高精确度,会减慢接口返回速度
+ * @type boolean
+ * @defaultValue false
+ */
+ altitude?: boolean | null,
+ /**
+ * 传入 true 会解析地址
+ * @type boolean
+ * @defaultValue false
+ */
+ geocode?: boolean | null,
+ /**
+ * 高精度定位超时时间(ms),指定时间内返回最高精度,该值3000ms以上高精度定位才有效果
+ * @defaultValue 3000
+ */
+ highAccuracyExpireTime?: number | null,
+ /**
+ * 开启高精度定位
+ * @type boolean
+ * @defaultValue false
+ */
+ isHighAccuracy?: boolean | null,
+ /**
+ * 接口调用成功的回调函数
+ */
+ success?: GetLocationSuccessCallback | null,
+ /**
+ * 接口调用失败的回调函数
+ */
+ fail?: GetLocationFailCallback | null,
+ /**
+ * 接口调用结束的回调函数(调用成功、失败都会执行)
+ */
+ complete?: GetLocationCompleteCallback | null
+};
diff --git a/uni_modules/uni-getLocation-tencent/changelog.md b/uni_modules/uni-getLocation-tencent/changelog.md
new file mode 100644
index 0000000000000000000000000000000000000000..e016b093be5a8e8848f780c89f2c6c99017078fd
--- /dev/null
+++ b/uni_modules/uni-getLocation-tencent/changelog.md
@@ -0,0 +1,4 @@
+## 1.0.1(2023-10-23)
+更新android自定义基座操作步骤
+## 1.0.0(2023-09-11)
+基于腾讯定位服务,实现uni.getLocation 获取定位功能
diff --git a/uni_modules/uni-getLocation-tencent/package.json b/uni_modules/uni-getLocation-tencent/package.json
new file mode 100644
index 0000000000000000000000000000000000000000..1a9c44bdc549338bebc17d7ee13a2259ecc0e6ed
--- /dev/null
+++ b/uni_modules/uni-getLocation-tencent/package.json
@@ -0,0 +1,90 @@
+{
+ "id": "uni-getLocation-tencent",
+ "displayName": "uni-getLocation-tencent",
+ "version": "1.0.1",
+ "description": "基于腾讯定位服务,实现uni.getLocation 获取定位功能",
+ "keywords": [
+ "uni-getLocation-tencent"
+ ],
+ "repository": "",
+ "engines": {
+ "HBuilderX": "^3.8.12"
+ },
+ "dcloudext": {
+ "type": "uts",
+ "sale": {
+ "regular": {
+ "price": "0.00"
+ },
+ "sourcecode": {
+ "price": "0.00"
+ }
+ },
+ "contact": {
+ "qq": ""
+ },
+ "declaration": {
+ "ads": "无",
+ "data": "插件使用的 腾讯定位SDK会采集数据,详情可参考:https://lbs.qq.com/",
+ "permissions": "\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n"
+ },
+ "npmurl": ""
+ },
+ "uni_modules": {
+ "uni-ext-api": {
+ "uni": [
+ "getLocation"
+ ]
+ },
+ "dependencies": [],
+ "encrypt": [],
+ "platforms": {
+ "cloud": {
+ "tcb": "y",
+ "aliyun": "y"
+ },
+ "client": {
+ "Vue": {
+ "vue2": "y",
+ "vue3": "y"
+ },
+ "App": {
+ "app-android": {
+ "minVersion": "19"
+ },
+ "app-ios": {
+ "minVersion": "9"
+ }
+ },
+ "H5-mobile": {
+ "Safari": "n",
+ "Android Browser": "n",
+ "微信浏览器(Android)": "n",
+ "QQ浏览器(Android)": "n"
+ },
+ "H5-pc": {
+ "Chrome": "n",
+ "IE": "n",
+ "Edge": "n",
+ "Firefox": "n",
+ "Safari": "n"
+ },
+ "小程序": {
+ "微信": "n",
+ "阿里": "n",
+ "百度": "n",
+ "字节跳动": "n",
+ "QQ": "n",
+ "钉钉": "n",
+ "快手": "n",
+ "飞书": "n",
+ "京东": "n"
+ },
+ "快应用": {
+ "华为": "n",
+ "联盟": "n"
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/uni_modules/uni-getLocation-tencent/readme.md b/uni_modules/uni-getLocation-tencent/readme.md
new file mode 100644
index 0000000000000000000000000000000000000000..87169df0fed3ff45650ae2487e6cac8c75c972bc
--- /dev/null
+++ b/uni_modules/uni-getLocation-tencent/readme.md
@@ -0,0 +1,44 @@
+# uts-tencentgeolocation腾讯定位插件使用文档
+
+## Android 平台
+
+1. 申请腾讯地图key
+
+[申请网址](https://lbs.qq.com/mobile/androidMapSDK/developerGuide/getKey)
+
+2. 配置key到插件中
+
+修改项目根目录下 AndroidManifest.xml
+``
+
+3. 制作自定义基座运行后生效
+
+## iOS 平台
+
+1.申请腾讯地图key
+
+[申请网址](https://lbs.qq.com/mobile/androidMapSDK/developerGuide/getKey)
+
+2.配置key到插件中
+
+将申请的key配置到插件目录下 app-ios -> info.plist 中 TencentLBSAPIKey 对应的值
+
+```xml
+TencentLBSAPIKey
+您申请的Key
+```
+
+3.配置访问位置权限描述信息
+
+选中工程中的 manifest.json -> App权限配置 -> iOS隐私信息访问的许可描述,分别配置下列权限描述信息
+
+- NSLocationAlwaysUsageDescription
+- NSLocationWhenInUseUsageDescription
+- NSLocationAlwaysAndWhenInUseUsageDescription
+
+4.制作自定义基座运行后生效
+
+## 相关开发文档
+
+- [UTS 语法](https://uniapp.dcloud.net.cn/tutorial/syntax-uts.html)
+- [UTS 原生插件](https://uniapp.dcloud.net.cn/plugin/uts-plugin.html)
diff --git a/uni_modules/uni-getLocation-tencent/utssdk/app-android/AndroidManifest.xml b/uni_modules/uni-getLocation-tencent/utssdk/app-android/AndroidManifest.xml
new file mode 100644
index 0000000000000000000000000000000000000000..3b88fd195d6d32bb34cbe06be73a475659c9f327
--- /dev/null
+++ b/uni_modules/uni-getLocation-tencent/utssdk/app-android/AndroidManifest.xml
@@ -0,0 +1,31 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/uni_modules/uni-getLocation-tencent/utssdk/app-android/config.json b/uni_modules/uni-getLocation-tencent/utssdk/app-android/config.json
new file mode 100644
index 0000000000000000000000000000000000000000..f7f9ab61cde5d32e0947692c782bf94458af5ea1
--- /dev/null
+++ b/uni_modules/uni-getLocation-tencent/utssdk/app-android/config.json
@@ -0,0 +1,7 @@
+{
+ "dependencies": [
+ "com.tencent.map.geolocation:TencentLocationSdk-openplatform:7.3.0"
+ ],
+ "minSdkVersion": "19"
+}
+
diff --git a/uni_modules/uni-getLocation-tencent/utssdk/app-android/index.uts b/uni_modules/uni-getLocation-tencent/utssdk/app-android/index.uts
new file mode 100644
index 0000000000000000000000000000000000000000..df2647730f5f3fdfb152b0acf647f7c73182dba0
--- /dev/null
+++ b/uni_modules/uni-getLocation-tencent/utssdk/app-android/index.uts
@@ -0,0 +1,204 @@
+import {
+ UTSAndroid
+} from "io.dcloud.uts";
+
+import ActivityCompat from "androidx.core.app.ActivityCompat";
+import Manifest from "android.Manifest";
+import Looper from "android.os.Looper";
+import TencentLocationManager from "com.tencent.map.geolocation.TencentLocationManager";
+import TencentLocationListener from "com.tencent.map.geolocation.TencentLocationListener";
+import TencentLocation from "com.tencent.map.geolocation.TencentLocation";
+import TencentLocationRequest from "com.tencent.map.geolocation.TencentLocationRequest";
+import PackageManager from "android.content.pm.PackageManager";
+import Class from 'java.lang.Class';
+import Exception from 'java.lang.Exception';
+
+import { GetLocation, GetLocationOptions, GetLocationSuccess,GetLocationFail } from "../interface.uts"
+
+
+
+export const getLocation : GetLocation = function (options : GetLocationOptions) {
+
+ if(!checkHasIntegration()){
+ // 当前没有集成腾讯sdk,提示需要打包
+ let ret = new UniError("uni-getLocation-tencent",-10,"需要打自定义基座");
+
+ options.fail?.(ret)
+ options.complete?.(ret)
+ return;
+ }
+ if (!checkLocationConfig()) {
+ let ret = new UniError("uni-getLocation-tencent",-20,"未通过配置预校验,通常是app key 配置错误");
+ options.fail?.(ret)
+ options.complete?.(ret)
+ return;
+ }
+
+ /**
+ * 准备权限
+ */
+ let permissionNeed = ["android.permission.ACCESS_FINE_LOCATION"];
+ UTSAndroid.requestSystemPermission(UTSAndroid.getUniActivity()!, permissionNeed, function (allRight:boolean,_grantedList:string[]) {
+ if (allRight) {
+ // 交给目前的location 引擎,真实执行
+ getLocationImpl(options)
+ }
+ }, function (_doNotAskAgain:boolean,_grantedList:string[]) {
+ console.log("用户拒绝了部分权限:")
+ let ret = new UniError("uni-getLocation-tencent",-30,"permission missed.");
+ options.fail?.(ret)
+ options.complete?.(ret)
+ })
+
+
+}
+
+
+/****************************************内部功能实现****************************************************/
+
+
+/**
+ * 定位监听结果包装类
+ */
+class LocationOptionsWapper {
+
+ hostOption : GetLocationOptions;
+
+ constructor(option : GetLocationOptions) {
+ this.hostOption = option
+ }
+
+ onLocationChanged(location : TencentLocation, _error : Int,
+ _reason : string) {
+
+ let ret : GetLocationSuccess = {
+ latitude: location.latitude,
+ longitude: location.longitude,
+ speed: 0,
+ accuracy: location.accuracy,
+ altitude: location.altitude,
+ verticalAccuracy: 0,
+ horizontalAccuracy: location.accuracy,
+ address: location.address
+ }
+
+ this.hostOption.success?.(ret)
+ // 包装数据结构返回
+ }
+
+
+ onStatusUpdate(_name : string, _status : Int, _desc : string) {
+ // 定位状态发生变化
+ }
+};
+
+
+/**
+ * Tencent 定位监听实现类
+ */
+class SingleLocationListener extends TencentLocationListener {
+
+
+ hostOptionWraper : LocationOptionsWapper;
+
+ constructor(option : LocationOptionsWapper) {
+ super();
+ this.hostOptionWraper = option
+ }
+
+ override onLocationChanged(location : TencentLocation, error : Int,
+ reason : string) : void {
+ this.hostOptionWraper.onLocationChanged(location, error, reason);
+ }
+
+ override onStatusUpdate(name : string, status : Int, desc : string) : void {
+ this.hostOptionWraper.onStatusUpdate(name, status, desc);
+ }
+
+}
+/**
+ * 判断当前的基座是否已经集成了sdk, 即是否是自定义基座
+ */
+function checkHasIntegration() : boolean {
+
+ let hasIntegration = true
+ try {
+ let xClass = Class.forName("com.tencent.map.geolocation.TencentLocationListener")
+ } catch (e : Exception) {
+ hasIntegration = false;
+ }
+
+ if (!hasIntegration) {
+ return false;
+ }
+
+ return true
+}
+/**
+ * 检查定位的相关配置是否正确
+ */
+function checkLocationConfig() : boolean {
+
+ let packageName = UTSAndroid.getAppContext()!.getPackageName();
+ let appInfo = UTSAndroid.getAppContext()!.getPackageManager()!.getApplicationInfo(packageName, PackageManager.GET_META_DATA)
+
+ let metaData = appInfo.metaData
+ if (metaData == null) {
+ return false;
+ }
+ let adId = metaData.getString("TencentMapSDK")
+ if (adId == null) {
+ return false;
+ }
+ let splitArray = adId!.split("-")
+ let keyCharNum = splitArray.size
+
+ if (keyCharNum > 5) {
+ // 存在超过5个-,说明是符合规则的appkey
+ return true;
+ }
+ // 不符合校验规则,打回
+ return false;
+}
+
+
+/**
+ * 腾讯地图获取定位信息
+ * 参考文档:https://lbs.qq.com/mobile/androidLocationSDK/androidGeoGuide/androidGeoAdapt
+ */
+function getLocationImpl(locationOptions : GetLocationOptions) {
+
+ if(locationOptions.type != null && locationOptions.type!.toUpperCase() != 'GCJ-02' && locationOptions.type!.toUpperCase() != 'GCJ02'){
+ // 腾讯定位只支持GCJ-02,如果不是则报错
+ let ret = new UniError("uni-getLocation-tencent",-1,"GCJ-02 support only.");
+ locationOptions.fail?.(ret)
+ locationOptions.complete?.(ret)
+ return
+ }
+
+ let mLocationManager = TencentLocationManager.getInstance(UTSAndroid.getAppContext());
+ // 定位监听器封装
+ let locationOptionWrapper = new LocationOptionsWapper(locationOptions);
+ let mLocationListener = new SingleLocationListener(locationOptionWrapper);
+ // 发起单次请求
+ let locationRequest = TencentLocationRequest.create()
+ // 是否需要逆地理编码
+ if (locationOptions.geocode != null && locationOptions.geocode == true) {
+ locationRequest.setRequestLevel(TencentLocationRequest.REQUEST_LEVEL_NAME);
+ } else {
+ locationRequest.setRequestLevel(TencentLocationRequest.REQUEST_LEVEL_GEO);
+ }
+ // 是否开启了高精度
+ if (locationOptions.isHighAccuracy != null && locationOptions.isHighAccuracy == true) {
+ locationRequest.setAllowGPS(true)
+ }
+ /**
+ * 高度信息,腾讯没有明确的api设置
+ */
+ if (locationOptions.altitude != null && locationOptions.altitude == true) {
+ locationRequest.setAllowGPS(true)
+ }
+
+ mLocationManager.requestSingleFreshLocation(locationRequest, mLocationListener, Looper.getMainLooper());
+
+}
diff --git a/uni_modules/uni-getLocation-tencent/utssdk/app-ios/config.json b/uni_modules/uni-getLocation-tencent/utssdk/app-ios/config.json
new file mode 100644
index 0000000000000000000000000000000000000000..721b81e0240705a87ec0761aa9eb6f4e188769cb
--- /dev/null
+++ b/uni_modules/uni-getLocation-tencent/utssdk/app-ios/config.json
@@ -0,0 +1,3 @@
+{
+ "deploymentTarget": "9"
+}
\ No newline at end of file
diff --git a/uni_modules/uni-getLocation-tencent/utssdk/interface.uts b/uni_modules/uni-getLocation-tencent/utssdk/interface.uts
new file mode 100644
index 0000000000000000000000000000000000000000..ca1ce9300640c8510da574018aaaa6bf42feb2e8
--- /dev/null
+++ b/uni_modules/uni-getLocation-tencent/utssdk/interface.uts
@@ -0,0 +1,85 @@
+export interface Uni {
+ /**
+ * 获取当前的地理位置、速度
+ *
+ * @tutorial http://uniapp.dcloud.io/api/location/location?id=getlocation
+ */
+ getLocation(options: GetLocationOptions) : void;
+}
+
+export type GetLocation = (options: GetLocationOptions) => void;
+export type GetLocationSuccess = {
+ /**
+ * 纬度,浮点数,范围为-90~90,负数表示南纬
+ */
+ latitude: number,
+ /**
+ * 经度,范围为-180~180,负数表示西经
+ */
+ longitude: number,
+ /**
+ * 速度,浮点数,单位m/s
+ */
+ speed: number,
+ /**
+ * 位置的精确度
+ */
+ accuracy: number,
+ /**
+ * 高度,单位 m
+ */
+ altitude: number,
+ /**
+ * 垂直精度,单位 m(Android 无法获取,返回 0)
+ */
+ verticalAccuracy: number,
+ /**
+ * 水平精度,单位 m
+ */
+ horizontalAccuracy: number,
+ /**
+ * 地址信息
+ */
+ address: any | null
+};
+type GetLocationSuccessCallback = (result: GetLocationSuccess) => void;
+type GetLocationFailCallback = (result: UniError) => void;
+type GetLocationComplete = any;
+type GetLocationCompleteCallback = (result: GetLocationComplete) => void;
+export type GetLocationOptions = {
+ /**
+ * 默认为 wgs84 返回 gps 坐标,gcj02 返回可用于uni.openLocation的坐标
+ */
+ type?: string | null,
+ /**
+ * 传入 true 会返回高度信息,由于获取高度需要较高精确度,会减慢接口返回速度
+ * @type boolean
+ */
+ altitude?: boolean | null,
+ /**
+ * 传入 true 会解析地址
+ * @type boolean
+ */
+ geocode?: boolean | null,
+ /**
+ * 高精度定位超时时间(ms),指定时间内返回最高精度,该值3000ms以上高精度定位才有效果
+ */
+ highAccuracyExpireTime?: number | null,
+ /**
+ * 开启高精度定位
+ * @type boolean
+ */
+ isHighAccuracy?: boolean | null,
+ /**
+ * 接口调用成功的回调函数
+ */
+ success?: GetLocationSuccessCallback | null,
+ /**
+ * 接口调用失败的回调函数
+ */
+ fail?: GetLocationFailCallback | null,
+ /**
+ * 接口调用结束的回调函数(调用成功、失败都会执行)
+ */
+ complete?: GetLocationCompleteCallback | null
+};
diff --git a/uni_modules/uni-getNetworkType/changelog.md b/uni_modules/uni-getNetworkType/changelog.md
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/uni_modules/uni-getNetworkType/package.json b/uni_modules/uni-getNetworkType/package.json
new file mode 100644
index 0000000000000000000000000000000000000000..23fe862dee6b9c5e16e5d1843d9c9b5353f17e96
--- /dev/null
+++ b/uni_modules/uni-getNetworkType/package.json
@@ -0,0 +1,93 @@
+{
+ "id": "uni-getNetworkType",
+ "displayName": "uni-getNetworkType",
+ "version": "1.0.0",
+ "description": "uni-getNetworkType",
+ "keywords": [
+ "uni-getNetworkType"
+],
+ "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": {
+ "getNetworkType": {
+ "name": "getNetworkType",
+ "app": {
+ "js": false,
+ "kotlin": true,
+ "swift": false
+ }
+ }
+ }
+ },
+ "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"
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/uni_modules/uni-getNetworkType/readme.md b/uni_modules/uni-getNetworkType/readme.md
new file mode 100644
index 0000000000000000000000000000000000000000..b34eae0a5fc6456d3b3250a550fb36454ae321f5
--- /dev/null
+++ b/uni_modules/uni-getNetworkType/readme.md
@@ -0,0 +1,6 @@
+# uni-getNetworkType
+### 开发文档
+[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)
\ No newline at end of file
diff --git a/uni_modules/uni-getNetworkType/utssdk/app-android/AndroidManifest.xml b/uni_modules/uni-getNetworkType/utssdk/app-android/AndroidManifest.xml
new file mode 100644
index 0000000000000000000000000000000000000000..51cd01312ae93069b05bb505eb8564b092f251c3
--- /dev/null
+++ b/uni_modules/uni-getNetworkType/utssdk/app-android/AndroidManifest.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
diff --git a/uni_modules/uni-getNetworkType/utssdk/app-android/index.uts b/uni_modules/uni-getNetworkType/utssdk/app-android/index.uts
new file mode 100644
index 0000000000000000000000000000000000000000..5ecde35baad42a8ee9cf5f497f2c5c176d8db32f
--- /dev/null
+++ b/uni_modules/uni-getNetworkType/utssdk/app-android/index.uts
@@ -0,0 +1,102 @@
+import { GetNetworkTypeOptions, GetNetworkType, GetNetworkTypeSuccess } from "../interface.uts";
+import UTSAndroid from 'io.dcloud.uts.UTSAndroid';
+import Context from 'android.content.Context';
+import ConnectivityManager from 'android.net.ConnectivityManager';
+import TelephonyManager from 'android.telephony.TelephonyManager';
+import Build from 'android.os.Build';
+
+
+export const getNetworkType : GetNetworkType = function (options : GetNetworkTypeOptions) {
+ const context = UTSAndroid.getUniActivity()!!;
+ const connectivityManager = context.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager;
+
+ if (connectivityManager != null) {
+ if (Build.VERSION.SDK_INT >= 23) {
+ const permissions = ["android.permission.ACCESS_NETWORK_STATE"];
+ if (!UTSAndroid.checkSystemPermissionGranted(context, permissions)) {
+ const result : GetNetworkTypeSuccess = {
+ networkType: "none"
+ }
+ options?.success?.(result);
+ options?.complete?.(result);
+ return
+ }
+ }
+ const activeNetworkInfo = connectivityManager.getActiveNetworkInfo();
+
+ if (activeNetworkInfo != null) {
+ if (activeNetworkInfo.getType() == ConnectivityManager.TYPE_WIFI) {
+ const result : GetNetworkTypeSuccess = {
+ networkType: "wifi"
+ }
+ options?.success?.(result);
+ options?.complete?.(result);
+ } else if (activeNetworkInfo.getType() == ConnectivityManager.TYPE_MOBILE) {
+ let type = "unknown";
+ const subtype = activeNetworkInfo.getSubtype();
+ switch (subtype) {
+ case TelephonyManager.NETWORK_TYPE_CDMA:
+ case TelephonyManager.NETWORK_TYPE_EDGE:
+ case TelephonyManager.NETWORK_TYPE_GPRS:
+ case 7://电信2g 努比亚
+ type = "2g";
+ break;
+ case TelephonyManager.NETWORK_TYPE_EVDO_0:
+ case TelephonyManager.NETWORK_TYPE_EVDO_A:
+ case 12://level9以上支持 TelephonyManager.NETWORK_TYPE_EVDO_B = 12
+ case 14://电信 努比亚
+ //3G 电信
+ type = "3g";
+ break;
+ case TelephonyManager.NETWORK_TYPE_HSDPA:
+ case TelephonyManager.NETWORK_TYPE_UMTS:
+ //3G 联通
+ type = "3g";
+ break;
+ case 17:
+ case 18:
+ //3G 移动(目前华为系统切换到3g时候为此值)
+ type = "3g";
+ break;
+ case 13: //level11 以上支持TelephonyManager.NETWORK_TYPE_LTE = 13
+ case 11: //level8以上支持TelephonyManager.NETWORK_TYPE_IDEN=11
+ case TelephonyManager.NETWORK_TYPE_HSUPA:
+ case TelephonyManager.NETWORK_TYPE_HSPA:
+ case 15://stype == TelephonyManager.NETWORK_TYPE_HSPAP
+ type = "4g";
+ break;
+ case TelephonyManager.NETWORK_TYPE_NR: {
+ type = "5g";
+ break;
+ }
+ default://对于case之外的反馈到js,js层收集之后回馈5+进行填补完善
+ type = "" + subtype;
+ break;
+ }
+ const result : GetNetworkTypeSuccess = {
+ networkType: type
+ }
+ options?.success?.(result);
+ options?.complete?.(result);
+ } else {
+ const result : GetNetworkTypeSuccess = {
+ networkType: "unknown"
+ }
+ options?.success?.(result);
+ options?.complete?.(result);
+ }
+ }else{
+ const result : GetNetworkTypeSuccess = {
+ networkType: "none"
+ }
+ options?.success?.(result);
+ options?.complete?.(result);
+ }
+ } else {
+ const result : GetNetworkTypeSuccess = {
+ networkType: "none"
+ }
+ options?.success?.(result);
+ options?.complete?.(result);
+ }
+};
\ No newline at end of file
diff --git a/uni_modules/uni-getNetworkType/utssdk/app-ios/index.uts b/uni_modules/uni-getNetworkType/utssdk/app-ios/index.uts
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/uni_modules/uni-getNetworkType/utssdk/interface.uts b/uni_modules/uni-getNetworkType/utssdk/interface.uts
new file mode 100644
index 0000000000000000000000000000000000000000..5b3fbe1db0ad2e138719433cc34b9df5bd1ce9d0
--- /dev/null
+++ b/uni_modules/uni-getNetworkType/utssdk/interface.uts
@@ -0,0 +1,63 @@
+export interface Uni {
+ /**
+ * getNetworkType()
+ * @description
+ * 获取网络类型
+ * @param {GetNetworkTypeOptions} options
+ * @return {void}
+ * @tutorial http://uniapp.dcloud.io/api/system/network?id=getnetworktype
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "4.4",
+ * "uniVer": "√",
+ * "unixVer": "3.9+"
+ * },
+ * "ios": {
+ * "osVer": "9.0",
+ * "uniVer": "√",
+ * "unixVer": "x"
+ * }
+ * }
+ * }
+ * @example
+ ```typescript
+ uni.getNetworkType({
+ success(res){
+ console.log(res);
+ }
+ });
+ ```
+ */
+ getNetworkType(options: GetNetworkTypeOptions): void;
+}
+
+export type GetNetworkType = (options: GetNetworkTypeOptions) => void;
+export type GetNetworkTypeSuccess = {
+ /**
+ * 网络类型
+ */
+ networkType: string
+};
+export type GetNetworkTypeSuccessCallback = (result: GetNetworkTypeSuccess) => void;
+export type GetNetworkTypeFail = UniError;
+export type GetNetworkTypeFailCallback = (result: GetNetworkTypeFail) => void;
+export type GetNetworkTypeComplete = any;
+export type GetNetworkTypeCompleteCallback = (result: GetNetworkTypeComplete) => void;
+export type GetNetworkTypeOptions = {
+ /**
+ * 接口调用成功的回调函数
+ * @defaultValue null
+ */
+ success?: GetNetworkTypeSuccessCallback | null,
+ /**
+ * 接口调用失败的回调函数
+ * @defaultValue null
+ */
+ fail?: GetNetworkTypeFailCallback | null,
+ /**
+ * 接口调用结束的回调函数(调用成功、失败都会执行)
+ * @defaultValue null
+ */
+ complete?: GetNetworkTypeCompleteCallback | null
+};
diff --git a/uni_modules/uni-getSystemInfo/changelog.md b/uni_modules/uni-getSystemInfo/changelog.md
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/uni_modules/uni-getSystemInfo/package.json b/uni_modules/uni-getSystemInfo/package.json
new file mode 100644
index 0000000000000000000000000000000000000000..2a56778c2aead29c1730806451efbbd0db080878
--- /dev/null
+++ b/uni_modules/uni-getSystemInfo/package.json
@@ -0,0 +1,109 @@
+{
+ "id": "uni-getSystemInfo",
+ "displayName": "uni-getSystemInfo",
+ "version": "1.0.0",
+ "description": "uni-getSystemInfo",
+ "keywords": [
+ "uni-getSystemInfo"
+],
+ "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": {
+ "getSystemInfo": {
+ "name": "getSystemInfo",
+ "app": {
+ "js": false,
+ "kotlin": true,
+ "swift": false
+ }
+ },
+ "getSystemInfoSync":{
+ "name": "getSystemInfoSync",
+ "app": {
+ "js": false,
+ "kotlin": true,
+ "swift": false
+ }
+ },
+ "getWindowInfo":{
+ "name": "getWindowInfo",
+ "app": {
+ "js": false,
+ "kotlin": true,
+ "swift": false
+ }
+ }
+ }
+ },
+ "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"
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/uni_modules/uni-getSystemInfo/readme.md b/uni_modules/uni-getSystemInfo/readme.md
new file mode 100644
index 0000000000000000000000000000000000000000..0c4f58dc70b8f0e8a1cf670fd7b3554dab89b6b4
--- /dev/null
+++ b/uni_modules/uni-getSystemInfo/readme.md
@@ -0,0 +1,6 @@
+# uni-getSystemInfo
+### 开发文档
+[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)
\ No newline at end of file
diff --git a/uni_modules/uni-getSystemInfo/utssdk/app-android/device/SystemInfoDeviceUtil.uts b/uni_modules/uni-getSystemInfo/utssdk/app-android/device/SystemInfoDeviceUtil.uts
new file mode 100644
index 0000000000000000000000000000000000000000..6c4bc47645ae95bf5dcf77224719ac8520de67fc
--- /dev/null
+++ b/uni_modules/uni-getSystemInfo/utssdk/app-android/device/SystemInfoDeviceUtil.uts
@@ -0,0 +1,330 @@
+import Activity from 'android.app.Activity';
+import Configuration from 'android.content.res.Configuration';
+import Context from 'android.content.Context';
+import UiModeManager from 'android.app.UiModeManager';
+import WindowManager from 'android.view.WindowManager';
+import DisplayMetrics from 'android.util.DisplayMetrics';
+import Build from 'android.os.Build';
+import File from 'java.io.File';
+
+import TextUtils from 'android.text.TextUtils';
+
+import { UTSAndroid as Device } from "io.dcloud.uts";
+import BufferedReader from 'java.io.BufferedReader';
+import InputStreamReader from 'java.io.InputStreamReader';
+import UTSAndroid from 'io.dcloud.uts.UTSAndroid';
+
+
+export class DeviceUtil {
+
+ private static customOS : string | null = null
+ private static customOSVersion : string | null = null
+
+ private static readonly rootRelatedDirs = [
+ "/su", "/su/bin/su", "/sbin/su",
+ "/data/local/xbin/su", "/data/local/bin/su", "/data/local/su",
+ "/system/xbin/su",
+ "/system/bin/su", "/system/sd/xbin/su", "/system/bin/failsafe/su",
+ "/system/bin/cufsdosck", "/system/xbin/cufsdosck", "/system/bin/cufsmgr",
+ "/system/xbin/cufsmgr", "/system/bin/cufaevdd", "/system/xbin/cufaevdd",
+ "/system/bin/conbb", "/system/xbin/conbb"];
+
+
+ /**
+ * HarmonyOS 系统输出的
+ * 格式:2.0.0
+ */
+ private static KEY_HARMONYOS_VERSION_NAME = "hw_sc.build.platform.version";
+
+ /**
+ * EMUI系统输出的
+ * 格式:EmotionUI_8.0.0
+ */
+ private static KEY_EMUI_VERSION_NAME = "ro.build.version.emui";
+
+ /**
+ * MagicUI系统输出的
+ * 格式:3.1.0
+ */
+ private static KEY_MAGICUI_VERSION = "ro.build.version.magic";
+
+ /**
+ * MIUI系统输出的
+ * 格式:V12
+ */
+ private static KEY_MIUI_VERSION_NAME = "ro.miui.ui.version.name";
+
+ /**
+ * OPPO手机ColorOS系统输出的
+ * 格式:9
+ */
+ private static KEY_COLOROS_VERSION_NAME = "ro.build.version.opporom";
+
+ /**
+ * VIVO手机系统输出的
+ * name格式:funtouch
+ * version格式: 9
+ */
+ private static KEY_VIVO_VERSION_NAME = "ro.vivo.os.name";
+ private static KEY_VIVO_VERSION = "ro.vivo.os.version";
+
+ /**
+ * OonPlus手机系统输出的
+ * 格式:Hydrogen OS 11.0.7.10.KB05
+ */
+ private static KEY_ONEPLUS_VERSION_NAME = "ro.rom.version";
+
+ /**
+ * 魅族手机系统输出的
+ */
+ private static KEY_FLYME_VERSION_NAME = "ro.build.display.id";
+
+ /**
+ * nubia手机系统输出的
+ */
+ private static KEY_NUBIA_VERSION_NAME = "ro.build.nubia.rom.name";
+ private static KEY_NUBIA_VERSION_CODE = "ro.build.nubia.rom.code";
+
+
+
+ public static getOrientation(activity : Activity) : string {
+ const activityOrientation = activity.getResources().getConfiguration().orientation;
+ let outOrientation = "portrait";
+ if (activityOrientation == Configuration.ORIENTATION_LANDSCAPE) {
+ outOrientation = "landscape";
+ }
+ return outOrientation;
+ }
+
+ public static getAppVersionCode():number{
+ const activity = UTSAndroid.getUniActivity()!!;
+ const packageInfo = activity.getPackageManager().getPackageInfo(activity.getPackageName(), 0);
+ return packageInfo.versionCode;
+ }
+
+ /**
+ * 获取屏幕像素比
+ */
+ public static getScaledDensity(activity : Activity) : number {
+ const windowManager = activity.getSystemService(Context.WINDOW_SERVICE) as WindowManager;
+ const displayMetrics = new DisplayMetrics();
+
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
+ windowManager.getDefaultDisplay().getRealMetrics(displayMetrics);
+ } else {
+ windowManager.getDefaultDisplay().getMetrics(displayMetrics);
+ }
+ return displayMetrics.scaledDensity;
+ }
+
+ public static getScreenWidth() : number {
+ return UTSAndroid.getScreenInfo()["screenWidth"] as Int;
+ }
+
+ public static getScreenHeight() : number {
+ return UTSAndroid.getScreenInfo()["screenHeight"] as Int;
+ }
+
+ public static getStatusBarHeight():number {
+ return UTSAndroid.getStatusBarHeight();
+ }
+
+ public static getRomName():string{
+ DeviceUtil.setCustomInfo(Build.MANUFACTURER);
+ return DeviceUtil.customOS ?? "";
+ }
+ public static getRomVersion():string{
+ DeviceUtil.setCustomInfo(Build.MANUFACTURER);
+ return DeviceUtil.customOSVersion ?? "";
+ }
+
+ public static getSystemUIModeType(activity : Activity) : string {
+
+ let uiModeManager = activity.getSystemService(Context.UI_MODE_SERVICE) as UiModeManager;
+ let modeType = "unknown";
+
+ switch (uiModeManager.getCurrentModeType()) {
+ case Configuration.UI_MODE_TYPE_TELEVISION:
+ modeType = "tv";
+ break;
+ case Configuration.UI_MODE_TYPE_WATCH:
+ modeType = "watch";
+ break;
+ case Configuration.UI_MODE_TYPE_NORMAL:
+ if (DeviceUtil.isTablet(activity)) {
+ modeType = "pad";
+ } else {
+ modeType = "phone";
+ }
+ break;
+ case Configuration.UI_MODE_TYPE_DESK:
+ modeType = "pc";
+ break;
+ case Configuration.UI_MODE_TYPE_UNDEFINED:
+ modeType = "undefined";
+ break;
+ case Configuration.UI_MODE_TYPE_CAR:
+ modeType = "car";
+ break;
+ case Configuration.UI_MODE_TYPE_VR_HEADSET:
+ modeType = "vr";
+ break;
+ case Configuration.UI_MODE_TYPE_APPLIANCE:
+ modeType = "appliance";
+ break;
+ }
+
+ return modeType;
+ }
+
+
+ public static getOsLanguageNormal(context : Context) : string {
+ const LOCALE_ZH_HANS = 'zh-Hans'
+ const LOCALE_ZH_HANT = 'zh-Hant'
+ let locale = Device.getLanguageInfo(context)["appLanguage"].toString();
+ if (locale.indexOf('zh') === 0) {
+ if (locale.indexOf('-hans') > -1) {
+ return LOCALE_ZH_HANS;
+ }
+ if (locale.indexOf('-hant') > -1) {
+ return LOCALE_ZH_HANT;
+ }
+ if (locale.includes("-tw") || locale.includes("-hk") || locale.includes("-mo") || locale.includes("-cht")) {
+ return LOCALE_ZH_HANT;
+ }
+
+ return LOCALE_ZH_HANS;
+ } else {
+ return locale;
+ }
+ }
+
+ /**
+ * 是否为平板 不是太准确
+ */
+ public static isTablet(activity : Activity) : boolean {
+ return (activity.getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_LARGE;
+ }
+
+
+
+ private static setCustomInfo(phoneBrand : string) {
+ try {
+ switch (DeviceUtil.deleteSpaceAndToUpperCase(phoneBrand)) {
+ case "HUAWEI":
+ if (DeviceUtil.isHarmonyOS()) {
+ DeviceUtil.customOSVersion = DeviceUtil.getSystemPropertyValue(DeviceUtil.KEY_HARMONYOS_VERSION_NAME);
+ DeviceUtil.customOS = "HarmonyOS";
+ } else {
+ DeviceUtil.customOS = "EMUI";
+ DeviceUtil.customOSVersion = DeviceUtil.getSystemPropertyValue(DeviceUtil.KEY_EMUI_VERSION_NAME);;
+ }
+ break;
+ case "HONOR":
+ if (DeviceUtil.isHarmonyOS()) {
+ DeviceUtil.customOS = "HarmonyOS";
+ if (!TextUtils.isEmpty(DeviceUtil.getSystemPropertyValue(DeviceUtil.KEY_HARMONYOS_VERSION_NAME))) {
+ DeviceUtil.customOSVersion = DeviceUtil.getSystemPropertyValue(DeviceUtil.KEY_HARMONYOS_VERSION_NAME);;
+ } else {
+ DeviceUtil.customOSVersion = "";
+ }
+ } else if (!TextUtils.isEmpty(DeviceUtil.getSystemPropertyValue(DeviceUtil.KEY_MAGICUI_VERSION))) {
+ DeviceUtil.customOS = "MagicUI";
+ DeviceUtil.customOSVersion = DeviceUtil.getSystemPropertyValue(DeviceUtil.KEY_MAGICUI_VERSION);
+ } else {
+ //格式:EmotionUI_8.0.0
+ DeviceUtil.customOS = "EMUI";
+ DeviceUtil.customOSVersion = DeviceUtil.getSystemPropertyValue(DeviceUtil.KEY_EMUI_VERSION_NAME);
+ }
+ break;
+ case "XIAOMI":
+ case "REDMI":
+ //格式:MIUIV12
+ DeviceUtil.customOS = "MIUI";
+ DeviceUtil.customOSVersion = DeviceUtil.getSystemPropertyValue(DeviceUtil.KEY_MIUI_VERSION_NAME);
+ break;
+ case "REALME":
+ case "OPPO":
+ //格式:ColorOSV2.1
+ DeviceUtil.customOS = "ColorOS";
+ DeviceUtil.customOSVersion = DeviceUtil.getSystemPropertyValue(DeviceUtil.KEY_COLOROS_VERSION_NAME);
+ break;
+ case "VIVO":
+ //格式:Funtouch9
+ DeviceUtil.customOS = "Funtouch";
+ DeviceUtil.customOSVersion = DeviceUtil.getSystemPropertyValue(DeviceUtil.KEY_VIVO_VERSION);
+ break;
+ case "ONEPLUS":
+ //格式:Hydrogen OS 11.0.7.10.KB05
+ DeviceUtil.customOS = "HydrogenOS";
+ DeviceUtil.customOSVersion = DeviceUtil.getSystemPropertyValue(DeviceUtil.KEY_ONEPLUS_VERSION_NAME);
+ break;
+ case "MEIZU":
+ //格式:Flyme 6.3.5.1G
+ DeviceUtil.customOS = "Flyme";
+ DeviceUtil.customOSVersion = DeviceUtil.getSystemPropertyValue(DeviceUtil.KEY_FLYME_VERSION_NAME);
+ break;
+ case "NUBIA":
+ //格式:nubiaUIV3.0
+ DeviceUtil.customOS = DeviceUtil.getSystemPropertyValue(DeviceUtil.KEY_NUBIA_VERSION_NAME);
+ DeviceUtil.customOSVersion = DeviceUtil.getSystemPropertyValue(DeviceUtil.KEY_NUBIA_VERSION_CODE);
+ break;
+ default:
+ DeviceUtil.customOS = "Android";
+ DeviceUtil.customOSVersion = Build.VERSION.RELEASE;
+ break;
+ }
+ } catch (e : Exception) {
+ }
+ }
+
+
+
+ /**
+ * 判断是否是华为鸿蒙系统,能否识别荣耀鸿蒙未知
+ *
+ * @return
+ */
+ private static isHarmonyOS() : boolean {
+ try {
+ let classType = Class.forName("com.huawei.system.BuildEx");
+ let getMethod = classType.getMethod("getOsBrand");
+ let value = getMethod.invoke(classType) as string;
+ return !TextUtils.isEmpty(value);
+ } catch (e : Exception) {
+ return false;
+ }
+ }
+
+
+
+
+
+
+ /**
+ * 删除字符串中的空格并全部转成大写
+ * @param str
+ * @return
+ */
+ public static deleteSpaceAndToUpperCase(str : string | null) : string {
+ if (TextUtils.isEmpty(str)) {
+ return "";
+ }
+ return str!.replace(" ", "").toUpperCase();
+ }
+
+ private static getSystemPropertyValue(propName : string) : string | null {
+ let value : string | null = null;
+ let roSecureObj : any | null;
+ try {
+ // Class.forName("java.lang.String")
+ const method = Class.forName("android.os.SystemProperties").getMethod("get", Class.forName("java.lang.String"));
+ roSecureObj = method.invoke(null, propName);
+ if (roSecureObj != null) {
+ value = roSecureObj as string;
+ }
+ } catch (e : Exception) {
+ }
+ return value;
+ }
+}
\ No newline at end of file
diff --git a/uni_modules/uni-getSystemInfo/utssdk/app-android/index.uts b/uni_modules/uni-getSystemInfo/utssdk/app-android/index.uts
new file mode 100644
index 0000000000000000000000000000000000000000..9ad2c57bc39f06d40bafa8968b3d5796b6a26760
--- /dev/null
+++ b/uni_modules/uni-getSystemInfo/utssdk/app-android/index.uts
@@ -0,0 +1,249 @@
+import { GetSystemInfoOptions, GetSystemInfo, GetSystemInfoResult, SafeArea, SafeAreaInsets, GetSystemInfoSync, GetWindowInfo, GetWindowInfoResult } from "../interface.uts";
+import UTSAndroid from 'io.dcloud.uts.UTSAndroid';
+import PackageManager from 'android.content.pm.PackageManager';
+import Build from 'android.os.Build';
+import { DeviceUtil } from './device/SystemInfoDeviceUtil.uts'
+import CountDownLatch from 'java.util.concurrent.CountDownLatch';
+import Looper from 'android.os.Looper';
+import Handler from 'android.os.Handler';
+
+export const getSystemInfo : GetSystemInfo = function (options : GetSystemInfoOptions) {
+ const result = getSystemInfoSync();
+ const success = options.success;
+ const complete = options.complete;
+ success?.(result);
+ complete?.(result);
+}
+
+
+export const getSystemInfoSync : GetSystemInfoSync = function () : GetSystemInfoResult {
+ const runnable = function(): GetSystemInfoResult | null{
+ try {
+ const activity = UTSAndroid.getUniActivity()!!;
+
+ const appId = UTSAndroid.getAppId();
+ const appLanguage = DeviceUtil.getOsLanguageNormal(activity);
+ const appName = UTSAndroid.getAppName();
+ const appVersion = UTSAndroid.getAppVersion()["name"].toString();
+ const appVersionCode = UTSAndroid.getAppVersion()["code"].toString();
+ const appWgtVersion = !UTSAndroid.isUniAppX()? UTSAndroid.getAppVersion()["name"].toString() : null;
+ const brand = Build.MANUFACTURER.toLowerCase();
+ const browserName = UTSAndroid.getWebViewInfo(activity)["kernel"].toString();
+ const browserVersion = UTSAndroid.getWebViewInfo(activity)["version"].toString();
+ const deviceId = UTSAndroid.getDeviceID(activity);
+ const deviceModel = Build.MODEL;
+ const deviceType = DeviceUtil.getSystemUIModeType(activity);
+ const devicePixelRatio = DeviceUtil.getScaledDensity(activity);
+ const deviceOrientation = DeviceUtil.getOrientation(activity);
+ const language = UTSAndroid.getLanguageInfo(activity)["osLanguage"].toString();
+ const osName = "android";
+ const osVersion = Build.VERSION.RELEASE;
+ const osLanguage = UTSAndroid.getLanguageInfo(activity)["osLanguage"].toString();
+ const osTheme = UTSAndroid.getOsTheme();
+ const pixelRatio = DeviceUtil.getScaledDensity(activity)
+ const screenWidth = DeviceUtil.getScreenWidth();
+ const screenHeight = DeviceUtil.getScreenHeight();
+ const statusBarHeight = DeviceUtil.getStatusBarHeight();
+ const system = "Android " + Build.VERSION.RELEASE;
+ const ua = UTSAndroid.getWebViewInfo(activity)["ua"].toString();
+ const uniCompileVersion = UTSAndroid.getUniCompileVersion();
+ const uniPlatform = "app";
+ const uniRuntimeVersion = UTSAndroid.getUniRuntimeVersion();
+ const uniCompileVersionCode = convertVersionCode(uniCompileVersion);
+ const uniRuntimeVersionCode = convertVersionCode(uniRuntimeVersion);
+ const version = UTSAndroid.getInnerVersion();
+ const romName = DeviceUtil.getRomName();
+ const romVersion = DeviceUtil.getRomVersion();
+ const windowWidth = screenWidth;
+ const windowHeight = UTSAndroid.getWindowHeight();
+ const windowTop = 0;
+ const windowBottom = 0;
+ const safeAreaInsetsTop = UTSAndroid.getSafeAreaInsets()["top"].toString().toInt();
+ const safeAreaInsets : SafeAreaInsets = {
+ left: 0,
+ top: safeAreaInsetsTop,
+ right: 0,
+ bottom: 0
+ }
+
+ const safeArea : SafeArea = {
+ left: safeAreaInsets.left,
+ right: windowWidth - safeAreaInsets.right,
+ top: safeAreaInsets.top,
+ bottom: windowHeight - safeAreaInsets.bottom,
+ width: windowWidth - safeAreaInsets.left - safeAreaInsets.right,
+ height: windowHeight - safeAreaInsets.top - safeAreaInsets.bottom
+ }
+ const osAndroidAPILevel = Build.VERSION.SDK_INT;
+ const oaid = UTSAndroid.getOAID();
+
+ const result = {
+ SDKVersion: "",
+ appId: appId,
+ appLanguage: appLanguage,
+ appName: appName,
+ appVersion: appVersion,
+ appVersionCode: appVersionCode,
+ appWgtVersion: appWgtVersion,
+ brand: brand,
+ browserName: browserName,
+ browserVersion: browserVersion,
+ deviceId: deviceId,
+ deviceBrand: brand,
+ deviceModel: deviceModel,
+ deviceType: deviceType,
+ devicePixelRatio: devicePixelRatio,
+ deviceOrientation: deviceOrientation,
+ language: language,
+ model: deviceModel,
+ osName: osName,
+ osVersion: osVersion,
+ osLanguage: osLanguage,
+ osTheme: osTheme,
+ pixelRatio: pixelRatio,
+ platform: osName,
+ screenWidth: screenWidth,
+ screenHeight: screenHeight,
+ statusBarHeight: statusBarHeight,
+ system: system,
+ ua: ua,
+ uniCompileVersion: uniCompileVersion,
+ uniPlatform: uniPlatform,
+ uniRuntimeVersion: uniRuntimeVersion,
+ uniCompileVersionCode: uniCompileVersionCode,
+ uniRuntimeVersionCode: uniRuntimeVersionCode,
+ version: version,
+ romName: romName,
+ romVersion: romVersion,
+ windowWidth: windowWidth,
+ windowHeight: windowHeight,
+ windowTop: windowTop,
+ windowBottom: windowBottom,
+ safeAreaInsets: safeAreaInsets,
+ safeArea: safeArea,
+ oaid: oaid,
+ osAndroidAPILevel: osAndroidAPILevel,
+ } as GetSystemInfoResult;
+ return result;
+ } catch (e : Exception) {
+ return null;
+ }
+ }
+
+ let result : GetSystemInfoResult | null = null;
+ if(Looper.myLooper() == Looper.getMainLooper()){
+ result = runnable();
+ }else{
+ const latch = new CountDownLatch(1);
+ new RunnableTask(Looper.getMainLooper(), () => {
+ result = runnable();
+ latch.countDown();
+ }).execute();
+ latch.await();
+ }
+
+ return result!!;
+};
+
+
+export const getWindowInfo: GetWindowInfo = function(): GetWindowInfoResult {
+ const activity = UTSAndroid.getUniActivity()!!;
+ const pixelRatio = DeviceUtil.getScaledDensity(activity)
+ const screenWidth = DeviceUtil.getScreenWidth();
+ const screenHeight = DeviceUtil.getScreenHeight();
+ const statusBarHeight = DeviceUtil.getStatusBarHeight();
+ const windowWidth = screenWidth;
+ const windowHeight = UTSAndroid.getWindowHeight();
+ const windowTop = 0;
+ const windowBottom = 0;
+ const safeAreaInsetsTop = UTSAndroid.getSafeAreaInsets()["top"] as Int;
+ const safeAreaInsets : SafeAreaInsets = {
+ left: 0,
+ top: safeAreaInsetsTop,
+ right: 0,
+ bottom: 0
+ }
+ const safeArea : SafeArea = {
+ left: safeAreaInsets.left,
+ right: windowWidth - safeAreaInsets.right,
+ top: safeAreaInsets.top,
+ bottom: windowHeight - safeAreaInsets.bottom,
+ width: windowWidth - safeAreaInsets.left - safeAreaInsets.right,
+ height: windowHeight - safeAreaInsets.top - safeAreaInsets.bottom
+ }
+ const screenTop = windowTop;
+
+ let result = {
+ pixelRatio: pixelRatio,
+ screenWidth: screenWidth,
+ screenHeight: screenHeight,
+ windowWidth: windowWidth,
+ windowHeight: windowHeight,
+ statusBarHeight: statusBarHeight,
+ windowTop: windowTop,
+ windowBottom: windowBottom,
+ safeArea: safeArea,
+ safeAreaInsets: safeAreaInsets,
+ screenTop: screenTop
+ } as GetWindowInfoResult;
+ return result;
+};
+
+const convertVersionCode = function(version: string): number {
+ let str = "";
+ let radixLength = 2;
+ let findDot = false;
+ const dotChar = ".".get(0);
+ for (let i = 0; i < version.length; i++) {
+ const char = version.get(i);
+ if(findDot){
+ if(char.isDigit()){
+ str += char;
+ }
+ radixLength --;
+ if(radixLength == 0){
+ break;
+ }
+ }else{
+ if(char.isDigit()){
+ str += char;
+ }else{
+ if(char == dotChar){
+ findDot = true;
+ str += char;
+ }
+ }
+ }
+ }
+
+ return parseFloat(str);
+}
+
+const getHostVersion = function () : string {
+ const context = UTSAndroid.getAppContext()!!;
+ let packageManager = context.getPackageManager();
+ let applicationInfo = packageManager.getPackageInfo(context.getPackageName(), PackageManager.GET_ACTIVITIES);
+ return applicationInfo.versionName;
+}
+
+class RunnableTask extends Runnable {
+ private callback : () => void | null;
+ private looper : Looper | null = null;
+ constructor(looper : Looper | null, callback : () => void) {
+ super();
+ this.looper = looper;
+ this.callback = callback
+ }
+
+ override run() {
+ this.callback?.()
+ }
+
+ public execute() {
+ if (this.looper == null) {
+ this.run();
+ } else {
+ new Handler(this.looper!!).post(this);
+ }
+ }
+}
\ No newline at end of file
diff --git a/uni_modules/uni-getSystemInfo/utssdk/app-ios/index.uts b/uni_modules/uni-getSystemInfo/utssdk/app-ios/index.uts
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/uni_modules/uni-getSystemInfo/utssdk/interface.uts b/uni_modules/uni-getSystemInfo/utssdk/interface.uts
new file mode 100644
index 0000000000000000000000000000000000000000..2ec4dba25098ad8699e96e46d03a767f2bdb1395
--- /dev/null
+++ b/uni_modules/uni-getSystemInfo/utssdk/interface.uts
@@ -0,0 +1,455 @@
+export interface Uni {
+ /**
+ * getSystemInfo()
+ * @description
+ * 异步获取系统信息
+ * @param {GetSystemInfoOptions} options
+ * @return {void}
+ * @tutorial http://uniapp.dcloud.io/api/system/info?id=getsysteminfo
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "4.4",
+ * "uniVer": "√",
+ * "unixVer": "3.9+"
+ * },
+ * "ios": {
+ * "osVer": "9.0",
+ * "uniVer": "√",
+ * "unixVer": "x"
+ * }
+ * }
+ * }
+ * @example
+ ```typescript
+ uni.getSystemInfo({
+ success(e) {
+ console.log("success :",e);
+ },
+ complete(e) {
+ console.log("complete :",e);
+ }
+ })
+ ```
+ */
+ getSystemInfo(options: GetSystemInfoOptions): void;
+
+ /**
+ * getSystemInfoSync()
+ * @description
+ * 同步获取系统信息
+ * @param {void}
+ * @return {GetSystemInfoResult}
+ * @tutorial http://uniapp.dcloud.io/api/system/info?id=getsysteminfosync
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "4.4",
+ * "uniVer": "√",
+ * "unixVer": "3.9+"
+ * },
+ * "ios": {
+ * "osVer": "9.0",
+ * "uniVer": "√",
+ * "unixVer": "x"
+ * }
+ * }
+ * }
+ * @example
+ ```typescript
+ uni.getSystemInfoSync()
+ ```
+ */
+ getSystemInfoSync(): GetSystemInfoResult;
+
+ /**
+ * getWindowInfo()
+ * @description
+ * 同步获取窗口信息
+ * @param {void}
+ * @return {GetWindowInfoResult} result
+ * @tutorial http://uniapp.dcloud.io/api/system/getWindowInfo.html
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "4.4",
+ * "uniVer": "√",
+ * "unixVer": "3.9+"
+ * },
+ * "ios": {
+ * "osVer": "9.0",
+ * "uniVer": "√",
+ * "unixVer": "x"
+ * }
+ * }
+ * }
+ * @example
+ ```typescript
+ uni.getWindowInfo()
+ ```
+ */
+ getWindowInfo(): GetWindowInfoResult;
+}
+
+export type GetSystemInfo = (options: GetSystemInfoOptions) => void;
+export type GetSystemInfoSync = () => GetSystemInfoResult;
+export type GetWindowInfo = () => GetWindowInfoResult;
+export type SafeArea = {
+ /**
+ * 安全区域左上角横坐标
+ */
+ left: number,
+ /**
+ * 安全区域右下角横坐标
+ */
+ right: number,
+ /**
+ * 安全区域左上角纵坐标
+ */
+ top: number,
+ /**
+ * 安全区域右下角纵坐标
+ */
+ bottom: number,
+ /**
+ * 安全区域的宽度,单位逻辑像素
+ */
+ width: number,
+ /**
+ * 安全区域的高度,单位逻辑像素
+ */
+ height: number
+};
+export type SafeAreaInsets = {
+ /**
+ * 安全区域左侧插入位置
+ */
+ left: number,
+ /**
+ * 安全区域右侧插入位置
+ */
+ right: number,
+ /**
+ * 安全区顶部插入位置
+ */
+ top: number,
+ /**
+ * 安全区域底部插入位置
+ */
+ bottom: number
+};
+export type GetSystemInfoResult = {
+ /**
+ * 客户端基础库版本
+ */
+ SDKVersion: string,
+ /**
+ * `manifest.json` 中应用appid。
+ */
+ appId: string,
+ /**
+ * 应用设置的语言。
+ */
+ appLanguage: string,
+ /**
+ * `manifest.json` 中应用名称。
+ */
+ appName: string,
+ /**
+ * `manifest.json` 中应用版本名称。
+ */
+ appVersion: string,
+ /**
+ * `manifest.json` 中应用版本名号。
+ */
+ appVersionCode: string,
+ /**
+ * 应用资源(wgt)的版本名称。
+ *
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "4.4",
+ * "uniVer": "√",
+ * "unixVer": "x"
+ * },
+ * "ios": {
+ * "osVer": "9.0",
+ * "uniVer": "√",
+ * "unixVer": "x"
+ * }
+ * }
+ * }
+ */
+ appWgtVersion: string | null,
+ /**
+ * 手机品牌。
+ */
+ brand: string,
+ /**
+ * 浏览器名称。`App` 端是系统 webview 的名字,比如 wkwebview、chrome。小程序端为空
+ */
+ browserName: string,
+ /**
+ * 浏览器版本、webview 版本。
+ */
+ browserVersion: string,
+ /**
+ * 设备 ID
+ */
+ deviceId: string,
+ /**
+ * 设备品牌。如:`apple`、`huawei`。
+ */
+ deviceBrand: string,
+ /**
+ * 设备型号
+ */
+ deviceModel: string,
+ /**
+ * 设备类型。`phone`、`pad`、`pc`
+ */
+ deviceType: string,
+ /**
+ * 设备像素比
+ */
+ devicePixelRatio: number,
+ /**
+ * 设备方向。如:`竖屏 portrait`、`横屏 landscape`
+ * - portrait: 竖屏
+ * - landscape: 横屏
+ * @type 'portrait' | 'landscape'
+ */
+ deviceOrientation: string,
+ /**
+ * 程序设置的语言
+ */
+ language: string,
+ /**
+ * 手机型号
+ */
+ model: string,
+ /**
+ * ios、android、windows、mac、linux
+ */
+ osName: string,
+ /**
+ * 操作系统版本。如 ios 版本,andriod 版本
+ */
+ osVersion: string,
+ /**
+ * 操作系统语言
+ */
+ osLanguage: string,
+ /**
+ * 操作系统主题 light、dark。
+ *
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "4.4",
+ * "uniVer": "√",
+ * "unixVer": "x"
+ * },
+ * "ios": {
+ * "osVer": "9.0",
+ * "uniVer": "√",
+ * "unixVer": "x"
+ * }
+ * }
+ * }
+ */
+ osTheme: string | null,
+ /**
+ * 设备像素比
+ */
+ pixelRatio: number,
+ /**
+ * 客户端平台
+ */
+ platform: string,
+ /**
+ * 屏幕宽度
+ */
+ screenWidth: number,
+ /**
+ * 屏幕高度
+ */
+ screenHeight: number,
+ /**
+ * 状态栏的高度
+ */
+ statusBarHeight: number,
+ /**
+ * 操作系统版本
+ */
+ system: string,
+ /**
+ * 在竖屏正方向下的安全区域
+ */
+ safeArea: SafeArea,
+ /**
+ * 在竖屏正方向下的安全区域插入位置
+ */
+ safeAreaInsets: SafeAreaInsets,
+ /**
+ * 用户标识。小程序端为空
+ */
+ ua: string,
+ /**
+ * uni 编译器版本
+ */
+ uniCompileVersion: string,
+ /**
+ * uni-app 运行平台。如:`app`、`mp-weixin`、`web`
+ */
+ uniPlatform: string,
+ /**
+ * uni 运行时版本
+ */
+ uniRuntimeVersion: string,
+ /**
+ * uni 编译器版本号
+ */
+ uniCompileVersionCode: number,
+ /**
+ * uni 运行时版本号
+ */
+ uniRuntimeVersionCode: number,
+ /**
+ * 引擎版本号。已废弃,仅为了向下兼容保留
+ * @deprecated 已废弃,仅为了向下兼容保留
+ */
+ version: string,
+ /**
+ * rom 名称。Android 部分机型获取不到值。iOS 恒为 `ios`
+ */
+ romName: string,
+ /**
+ * rom 版本号。Android 部分机型获取不到值。iOS 恒为 `ios 版本号`
+ */
+ romVersion: string,
+ /**
+ * 可使用窗口宽度
+ */
+ windowWidth: number,
+ /**
+ * 可使用窗口高度
+ */
+ windowHeight: number,
+ /**
+ * 可使用窗口的顶部位置
+ */
+ windowTop: number,
+ /**
+ * 可使用窗口的底部位置
+ */
+ windowBottom: number,
+ /**
+ * oaid
+ *
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "4.4",
+ * "uniVer": "√",
+ * "unixVer": "√"
+ * },
+ * "ios": {
+ * "osVer": "x",
+ * "uniVer": "x",
+ * "unixVer": "x"
+ * }
+ * }
+ * }
+ */
+ oaid: string | null
+ /**
+ * Android 系统API库的版本。
+ *
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "4.4",
+ * "uniVer": "√",
+ * "unixVer": "√"
+ * },
+ * "ios": {
+ * "osVer": "x",
+ * "uniVer": "x",
+ * "unixVer": "x"
+ * }
+ * }
+ * }
+ */
+ osAndroidAPILevel: number | null
+};
+export type GetSystemInfoSuccessCallback = (result: GetSystemInfoResult) => void;
+type GetSystemInfoFail = UniError;
+type GetSystemInfoFailCallback = (result: GetSystemInfoFail) => void;
+export type GetSystemInfoComplete = any;
+export type GetSystemInfoCompleteCallback = (result: GetSystemInfoComplete) => void;
+export type GetSystemInfoOptions = {
+ /**
+ * 接口调用成功的回调函数
+ * @defaultValue null
+ */
+ success?: GetSystemInfoSuccessCallback | null,
+ /**
+ * 接口调用失败的回调函数
+ * @defaultValue null
+ */
+ fail?: GetSystemInfoFailCallback | null,
+ /**
+ * 接口调用结束的回调函数(调用成功、失败都会执行)
+ * @defaultValue null
+ */
+ complete?: GetSystemInfoCompleteCallback | null
+};
+
+export type GetWindowInfoResult = {
+ /**
+ * 设备像素比
+ */
+ pixelRatio: number,
+ /**
+ * 屏幕宽度
+ */
+ screenWidth: number,
+ /**
+ * 屏幕高度
+ */
+ screenHeight: number,
+ /**
+ * 可使用窗口宽度
+ */
+ windowWidth: number,
+ /**
+ * 可使用窗口高度
+ */
+ windowHeight: number,
+ /**
+ * 状态栏的高度
+ */
+ statusBarHeight: number,
+ /**
+ * 可使用窗口的顶部位置
+ */
+ windowTop: number,
+ /**
+ * 可使用窗口的底部位置
+ */
+ windowBottom: number,
+ /**
+ * 在竖屏正方向下的安全区域
+ */
+ safeArea: SafeArea,
+ /**
+ * 在竖屏正方向下的安全区域插入位置
+ */
+ safeAreaInsets: SafeAreaInsets,
+ /**
+ * 窗口上边缘的 y 值
+ */
+ screenTop: number
+};
diff --git a/uni_modules/uni-getSystemSetting/changelog.md b/uni_modules/uni-getSystemSetting/changelog.md
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/uni_modules/uni-getSystemSetting/package.json b/uni_modules/uni-getSystemSetting/package.json
new file mode 100644
index 0000000000000000000000000000000000000000..855c47a9c4a161c09acac5626b0899e9f28c422c
--- /dev/null
+++ b/uni_modules/uni-getSystemSetting/package.json
@@ -0,0 +1,93 @@
+{
+ "id": "uni-getSystemSetting",
+ "displayName": "uni-getSystemSetting",
+ "version": "1.0.0",
+ "description": "uni-getSystemSetting",
+ "keywords": [
+ "uni-getSystemSetting"
+ ],
+ "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": {
+ "getSystemSetting": {
+ "name": "getSystemSetting",
+ "app": {
+ "js": false,
+ "kotlin": true,
+ "swift": 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"
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/uni_modules/uni-getSystemSetting/readme.md b/uni_modules/uni-getSystemSetting/readme.md
new file mode 100644
index 0000000000000000000000000000000000000000..19608ef97259bb800e47c2a1b2c1157e4279cc55
--- /dev/null
+++ b/uni_modules/uni-getSystemSetting/readme.md
@@ -0,0 +1,5 @@
+# uni-getSystemSetting
+### 开发文档
+[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)
\ No newline at end of file
diff --git a/uni_modules/uni-getSystemSetting/utssdk/app-android/device/DeviceUtil.uts b/uni_modules/uni-getSystemSetting/utssdk/app-android/device/DeviceUtil.uts
new file mode 100644
index 0000000000000000000000000000000000000000..eea7ee8bb3fcc6af87106c32c3070e3856a63bc3
--- /dev/null
+++ b/uni_modules/uni-getSystemSetting/utssdk/app-android/device/DeviceUtil.uts
@@ -0,0 +1,60 @@
+import WifiManager from 'android.net.wifi.WifiManager';
+import Configuration from 'android.content.res.Configuration';
+import Context from 'android.content.Context';
+import LocationManager from 'android.location.LocationManager';
+import BluetoothManager from 'android.bluetooth.BluetoothManager';
+import PackageManager from 'android.content.pm.PackageManager';
+import Manifest from 'android.Manifest';
+import Build from 'android.os.Build';
+import Settings from 'android.provider.Settings';
+export class DeviceUtil{
+ /**
+ * 设备蓝牙是否开启
+ * @param context .
+ * @return .
+ * @throws Exception 如果没开启蓝牙权限就有异常
+ */
+ public static blueToothEnable(context: Context): boolean {
+ if (Build.VERSION.SDK_INT >= 23 && context.checkSelfPermission(Manifest.permission.BLUETOOTH) == PackageManager.PERMISSION_DENIED) {
+ throw new Exception();
+ }
+ let bluetoothManager = context.getSystemService(Context.BLUETOOTH_SERVICE) as BluetoothManager;
+ let defaultAdapter = bluetoothManager.getAdapter();
+ return defaultAdapter.isEnabled();
+ }
+
+
+
+ public static locationEnable(context: Context): boolean {
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P){
+ let locationManager = context.getSystemService(Context.LOCATION_SERVICE) as LocationManager;
+ if (locationManager == null) {
+ return false;
+ }
+ return locationManager.isLocationEnabled();
+ }else{
+ const mode = Settings.Secure.getInt(context.getContentResolver(), Settings.Secure.LOCATION_MODE,
+ Settings.Secure.LOCATION_MODE_OFF);
+ return (mode != Settings.Secure.LOCATION_MODE_OFF);
+ }
+ }
+
+ public static wifiEnable(context: Context): boolean {
+ let wifiManager = context.getApplicationContext().getSystemService(Context.WIFI_SERVICE) as WifiManager;
+ let wifiState = wifiManager.getWifiState();
+ return wifiState == WifiManager.WIFI_STATE_ENABLED;
+ }
+
+
+ public static deviceOrientation(context: Context): string {
+ let configuration = context.getResources().getConfiguration();
+ let orientation = configuration.orientation;
+
+ if (orientation == Configuration.ORIENTATION_PORTRAIT) {
+ return "portrait";
+ } else if (orientation == Configuration.ORIENTATION_LANDSCAPE) {
+ return "landscape";
+ }
+ return "";
+ }
+}
\ No newline at end of file
diff --git a/uni_modules/uni-getSystemSetting/utssdk/app-android/index.uts b/uni_modules/uni-getSystemSetting/utssdk/app-android/index.uts
new file mode 100644
index 0000000000000000000000000000000000000000..d5f51de28df435bafdb07121b32dc7f0043c529f
--- /dev/null
+++ b/uni_modules/uni-getSystemSetting/utssdk/app-android/index.uts
@@ -0,0 +1,26 @@
+import { UTSAndroid } from "io.dcloud.uts";
+import { DeviceUtil } from './device/DeviceUtil.uts';
+
+import { GetSystemSetting, GetSystemSettingResult } from '../interface.uts'
+import Exception from 'java.lang.Exception';
+
+export const getSystemSetting : GetSystemSetting = () : GetSystemSettingResult => {
+ let context = UTSAndroid.getAppContext();
+ let result : GetSystemSettingResult = {
+ deviceOrientation : DeviceUtil.deviceOrientation(context!),
+ locationEnabled : DeviceUtil.locationEnable(context!),
+ };
+ try {
+ let blueToothEnable = DeviceUtil.blueToothEnable(context!);
+ result.bluetoothEnabled = blueToothEnable;
+ } catch (e : Exception) {
+ result.bluetoothError = "Missing permissions required by BluetoothAdapter.isEnabled: android.permission.BLUETOOTH";
+ }
+
+ try {
+ result.wifiEnabled = DeviceUtil.wifiEnable(context!);
+ } catch (e : Exception) {
+ result.wifiError = "Missing permissions required by WifiManager.isWifiEnabled: android.permission.ACCESS_WIFI_STATE";
+ }
+ return result;
+}
\ No newline at end of file
diff --git a/uni_modules/uni-getSystemSetting/utssdk/app-ios/index.uts b/uni_modules/uni-getSystemSetting/utssdk/app-ios/index.uts
new file mode 100644
index 0000000000000000000000000000000000000000..5e2a49eae275cb08c6e2080732cf2be13691b370
--- /dev/null
+++ b/uni_modules/uni-getSystemSetting/utssdk/app-ios/index.uts
@@ -0,0 +1,31 @@
+import { GetSystemSetting, GetSystemSettingResult } from '../interface.uts'
+import { UTSiOS } from "DCloudUTSFoundation";
+
+export const getSystemSetting : GetSystemSetting = () : GetSystemSettingResult => {
+ let setting : Map = UTSiOS.getSystemSetting();
+ let result : GetSystemSettingResult = {
+ deviceOrientation: "portrait",
+ locationEnabled : false
+ };
+ if (setting.has("bluetoothEnabled")) {
+ result.bluetoothEnabled = setting.get("bluetoothEnabled") as boolean;
+ }
+
+ if (setting.has("bluetoothError")) {
+ result.bluetoothError = setting.get("bluetoothError") as string;
+ }
+
+ if (setting.has("locationEnabled")) {
+ result.locationEnabled = setting.get("locationEnabled") as boolean;
+ }
+
+ if (setting.has("wifiEnabled")) {
+ result.wifiEnabled = setting.get("wifiEnabled") as boolean;
+ }
+
+ if (setting.has("deviceOrientation")) {
+ result.deviceOrientation = setting.get("deviceOrientation") as string;
+ }
+
+ return result;
+}
\ No newline at end of file
diff --git a/uni_modules/uni-getSystemSetting/utssdk/interface.uts b/uni_modules/uni-getSystemSetting/utssdk/interface.uts
new file mode 100644
index 0000000000000000000000000000000000000000..ed1460cb0d44b0a7c08653f212b9541bd98c4c79
--- /dev/null
+++ b/uni_modules/uni-getSystemSetting/utssdk/interface.uts
@@ -0,0 +1,61 @@
+
+
+export type GetSystemSettingResult = {
+ /**
+ * 蓝牙是否开启
+ */
+ bluetoothEnabled?: boolean,
+ /**
+ * 蓝牙的报错信息
+ */
+ bluetoothError?: string,
+ /**
+ * 位置是否开启
+ */
+ locationEnabled : boolean,
+ /**
+ * wifi是否开启
+ */
+ wifiEnabled?: boolean,
+ /**
+ * wifi的报错信息
+ */
+ wifiError?: string,
+ /**
+ * 设备方向
+ */
+ deviceOrientation : string
+}
+
+
+export type GetSystemSetting = () => GetSystemSettingResult
+
+
+export interface Uni {
+ /**
+ * GetSystemSetting()
+ * @description
+ * 获取系统设置
+ * @return {object}
+ * @tutorial https://uniapp.dcloud.net.cn/api/system/getsystemsetting.html
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "4.4",
+ * "uniVer": "√",
+ * "unixVer": "3.9+"
+ * },
+ * "ios": {
+ * "osVer": "9.0",
+ * "uniVer": "√",
+ * "unixVer": "x"
+ * }
+ * }
+ * }
+ * @example
+ ```typescript
+ uni.getSystemSetting()
+ ```
+ */
+ getSystemSetting(): GetSystemSettingResult;
+}
diff --git a/uni_modules/uni-getbatteryinfo/changelog.md b/uni_modules/uni-getbatteryinfo/changelog.md
index 1a6be2cec42ff7bfdf36e6e1d11b9579723dc135..03f2110d87b74dec98a92f48f4e18b227cff4fad 100644
--- a/uni_modules/uni-getbatteryinfo/changelog.md
+++ b/uni_modules/uni-getbatteryinfo/changelog.md
@@ -1,5 +1,12 @@
+## 1.3.1(2023-09-15)
+app端适配使用UniError
+
+## 1.3.0(2023-05-30)
+新增 同步获取电量api
+
## 1.2.0(2022-10-17)
实现百度小程序/支付宝小程序/QQ小程序获取电量
+
## 1.1.0(2022-10-17)
实现ios平台获取电量
diff --git a/uni_modules/uni-getbatteryinfo/package.json b/uni_modules/uni-getbatteryinfo/package.json
index 0731fe3a54e5924d05c34a1bf58d5bc2fe6e1642..0fc760c92199662311d098a5213e48fd6c81c37f 100644
--- a/uni_modules/uni-getbatteryinfo/package.json
+++ b/uni_modules/uni-getbatteryinfo/package.json
@@ -1,14 +1,14 @@
{
"id": "uni-getbatteryinfo",
"displayName": "uni-getbatteryinfo",
- "version": "1.2.0",
+ "version": "1.3.1",
"description": "使用uts开发,实现在多个平台获取电池电量功能",
"keywords": [
"battery"
],
"repository": "",
"engines": {
- "HBuilderX": "^3.6.0"
+ "HBuilderX": "^3.9.0"
},
"dcloudext": {
"type": "uts",
@@ -32,7 +32,12 @@
},
"uni_modules": {
"uni-ext-api": {
- "uni": ["getBatteryInfo"]
+ "uni": {
+ "getBatteryInfo": "getBatteryInfo",
+ "getBatteryInfoSync": {
+ "web": false
+ }
+ }
},
"dependencies": [],
"encrypt": [],
diff --git a/uni_modules/uni-getbatteryinfo/utssdk/app-android/index.uts b/uni_modules/uni-getbatteryinfo/utssdk/app-android/index.uts
index 319368c02692c8ac451d996ee2f64a31aa8c0048..5ae056d96e3d41349089f07a07c6bfbb6fd30864 100644
--- a/uni_modules/uni-getbatteryinfo/utssdk/app-android/index.uts
+++ b/uni_modules/uni-getbatteryinfo/utssdk/app-android/index.uts
@@ -1,10 +1,18 @@
import Context from "android.content.Context";
import BatteryManager from "android.os.BatteryManager";
-import { UTSAndroid } from "io.dcloud.uts";
-import { GetBatteryInfo, GetBatteryInfoSuccess, GetBatteryInfoFail, GetBatteryInfoOptions } from '../interface.uts'
+import { GetBatteryInfo, GetBatteryInfoOptions, GetBatteryInfoSuccess, GetBatteryInfoResult,GetBatteryInfoSync } from '../interface.uts'
+import IntentFilter from 'android.content.IntentFilter';
+import Intent from 'android.content.Intent';
+
+import { GetBatteryInfoFailImpl } from '../unierror';
+
+/**
+ * 异步获取电量
+ */
+export const getBatteryInfo : GetBatteryInfo = function (options : GetBatteryInfoOptions) {
+
-export const getBatteryInfo : GetBatteryInfo = function (options) {
const context = UTSAndroid.getAppContext();
if (context != null) {
const manager = context.getSystemService(
@@ -12,22 +20,65 @@ export const getBatteryInfo : GetBatteryInfo = function (options) {
) as BatteryManager;
const level = manager.getIntProperty(
BatteryManager.BATTERY_PROPERTY_CAPACITY
- );
+ );
+
+ let ifilter = new IntentFilter(Intent.ACTION_BATTERY_CHANGED);
+ let batteryStatus = context.registerReceiver(null, ifilter);
+ let status = batteryStatus?.getIntExtra(BatteryManager.EXTRA_STATUS, -1);
+ let isCharging = status == BatteryManager.BATTERY_STATUS_CHARGING || status == BatteryManager.BATTERY_STATUS_FULL;
+
const res : GetBatteryInfoSuccess = {
errMsg: 'getBatteryInfo:ok',
level,
- isCharging: manager.isCharging()
+ isCharging: isCharging
}
options.success?.(res)
options.complete?.(res)
- } else {
- const res : GetBatteryInfoFail = {
- errSubject: "uni-getBatteryInfo",
- errCode: 1001,
- errMsg: 'getBatteryInfo:fail getAppContext is null',
- cause: null
- }
+ } else {
+ let res = new GetBatteryInfoFailImpl(1001);
options.fail?.(res)
options.complete?.(res)
}
-}
\ No newline at end of file
+}
+
+/**
+ * 同步获取电量示例
+ */
+export const getBatteryInfoSync : GetBatteryInfoSync = function (): GetBatteryInfoResult {
+
+ const context = UTSAndroid.getAppContext();
+ if (context != null) {
+
+
+ const manager = context.getSystemService(
+ Context.BATTERY_SERVICE
+ ) as BatteryManager;
+ const level = manager.getIntProperty(
+ BatteryManager.BATTERY_PROPERTY_CAPACITY
+ );
+
+ let ifilter = new IntentFilter(Intent.ACTION_BATTERY_CHANGED);
+ let batteryStatus = context.registerReceiver(null, ifilter);
+ let status = batteryStatus?.getIntExtra(BatteryManager.EXTRA_STATUS, -1);
+ let isCharging = status == BatteryManager.BATTERY_STATUS_CHARGING || status == BatteryManager.BATTERY_STATUS_FULL;
+
+ const res : GetBatteryInfoResult = {
+ level: level,
+ isCharging: isCharging
+ };
+
+ return res;
+ }
+ else {
+ /**
+ * 无有效上下文
+ */
+ const res : GetBatteryInfoResult = {
+ level: -1,
+ isCharging: false
+ };
+ return res;
+ }
+
+
+}
diff --git a/uni_modules/uni-getbatteryinfo/utssdk/app-ios/config.json b/uni_modules/uni-getbatteryinfo/utssdk/app-ios/config.json
new file mode 100644
index 0000000000000000000000000000000000000000..721b81e0240705a87ec0761aa9eb6f4e188769cb
--- /dev/null
+++ b/uni_modules/uni-getbatteryinfo/utssdk/app-ios/config.json
@@ -0,0 +1,3 @@
+{
+ "deploymentTarget": "9"
+}
\ No newline at end of file
diff --git a/uni_modules/uni-getbatteryinfo/utssdk/app-ios/index.uts b/uni_modules/uni-getbatteryinfo/utssdk/app-ios/index.uts
index 755250ff9d42c91ed820889b8103ef9ce850c881..de45bdc454fef51d0f63de5581140db8c2809c7c 100644
--- a/uni_modules/uni-getbatteryinfo/utssdk/app-ios/index.uts
+++ b/uni_modules/uni-getbatteryinfo/utssdk/app-ios/index.uts
@@ -1,9 +1,7 @@
// 引用 iOS 原生平台 api
import { UIDevice } from "UIKit";
-import { Int } from 'Swift';
-
-import { GetBatteryInfo, GetBatteryInfoSuccess } from '../interface.uts';
+import { GetBatteryInfo, GetBatteryInfoSuccess, GetBatteryInfoResult, GetBatteryInfoSync } from '../interface.uts';
/**
* 导出 获取电量方法
*/
@@ -15,9 +13,22 @@ export const getBatteryInfo : GetBatteryInfo = function (options) {
// 返回数据
const res : GetBatteryInfoSuccess = {
errMsg: "getBatteryInfo:ok",
- level: new Int(UIDevice.current.batteryLevel * 100),
+ level: Number(UIDevice.current.batteryLevel * 100),
isCharging: UIDevice.current.batteryState == UIDevice.BatteryState.charging,
};
options.success?.(res);
options.complete?.(res);
+}
+
+export const getBatteryInfoSync : GetBatteryInfoSync = function (): GetBatteryInfoResult {
+
+ // 开启电量检测
+ UIDevice.current.isBatteryMonitoringEnabled = true
+
+ // 返回数据
+ const res : GetBatteryInfoResult = {
+ level: Number(UIDevice.current.batteryLevel * 100),
+ isCharging: UIDevice.current.batteryState == UIDevice.BatteryState.charging,
+ };
+ return res;
}
\ No newline at end of file
diff --git a/uni_modules/uni-getbatteryinfo/index.d.ts b/uni_modules/uni-getbatteryinfo/utssdk/index.d.ts
similarity index 88%
rename from uni_modules/uni-getbatteryinfo/index.d.ts
rename to uni_modules/uni-getbatteryinfo/utssdk/index.d.ts
index 60b511f68f86e4fff522ee27ff04f3d5713a9645..9f0b83c4e53a1a27957eb4b291cf3b1fc032f7d8 100644
--- a/uni_modules/uni-getbatteryinfo/index.d.ts
+++ b/uni_modules/uni-getbatteryinfo/utssdk/index.d.ts
@@ -34,4 +34,9 @@ declare interface Uni {
* 文档: [https://uniapp.dcloud.net.cn/api/system/batteryInfo.html](https://uniapp.dcloud.net.cn/api/system/batteryInfo.html)
*/
getBatteryInfo(option?: UniNamespace.GetBatteryInfoOption): void;
+
+ /**
+ * 同步获取电池电量信息
+ */
+ getBatteryInfoSync(): UniNamespace.GetBatteryInfoSuccessCallbackResult;
}
diff --git a/uni_modules/uni-getbatteryinfo/utssdk/interface.uts b/uni_modules/uni-getbatteryinfo/utssdk/interface.uts
index 7d3bbf103e608a021aadc8418a44342f7371c316..79130b5dac27150d68fbf533ab06186612d70975 100644
--- a/uni_modules/uni-getbatteryinfo/utssdk/interface.uts
+++ b/uni_modules/uni-getbatteryinfo/utssdk/interface.uts
@@ -1,61 +1,130 @@
export type GetBatteryInfoSuccess = {
- errMsg : string,
- /**
- * 设备电量,范围1 - 100
- */
- level : number,
- /**
- * 是否正在充电中
- */
- isCharging : boolean
+ errMsg : string,
+ /**
+ * 设备电量,范围1 - 100
+ */
+ level : number,
+ /**
+ * 是否正在充电中
+ */
+ isCharging : boolean
}
-export type GetBatteryInfoFail = {
- /**
- * 错误码
- */
- errCode : number,
- /**
- * 调用API的名称
- */
- errSubject : string,
- /**
- * 错误的详细信息
- */
- errMsg : string,
- /**
- * 错误来源
- */
- cause : any | null
-}
-
-
-
export type GetBatteryInfoOptions = {
- /**
- * 接口调用结束的回调函数(调用成功、失败都会执行)
- */
- success ?: (res : GetBatteryInfoSuccess) => void
- /**
- * 接口调用失败的回调函数
- */
- fail ?: (res : GetBatteryInfoFail) => void
- /**
- * 接口调用成功的回调
- */
- complete ?: (res : any) => void
-}
+ /**
+ * 接口调用结束的回调函数(调用成功、失败都会执行)
+ */
+ success ?: (res : GetBatteryInfoSuccess) => void
+ /**
+ * 接口调用失败的回调函数
+ */
+ fail ?: (res : UniError) => void
+ /**
+ * 接口调用成功的回调
+ */
+ complete ?: (res : any) => void
+}
+
+export type GetBatteryInfoResult = {
+ /**
+ * 设备电量,范围1 - 100
+ */
+ level : number,
+ /**
+ * 是否正在充电中
+ */
+ isCharging : boolean
+}
+
+/**
+ * 错误码
+ * - 1001 getAppContext is null
+ */
+export type GetBatteryInfoErrorCode = 1001 ;
+/**
+ * GetBatteryInfo 的错误回调参数
+ */
+export interface GetBatteryInfoFail extends IUniError {
+ errCode : GetBatteryInfoErrorCode
+};
/**
* 获取电量信息
* @param {GetBatteryInfoOptions} options
-*
+*
*
* @tutorial https://uniapp.dcloud.net.cn/api/system/batteryInfo.html
* @platforms APP-IOS = ^9.0,APP-ANDROID = ^22
* @since 3.6.11
-*
+*
* @assert () => success({errCode: 0, errSubject: "uni-getBatteryInfo", errMsg: "getBatteryInfo:ok", level: 60, isCharging: false })
* @assert () => fail({errCode: 1001, errSubject: "uni-getBatteryInfo", errMsg: "getBatteryInfo:fail getAppContext is null" })
*/
-export type GetBatteryInfo = (options : GetBatteryInfoOptions) => void
\ No newline at end of file
+export type GetBatteryInfo = (options : GetBatteryInfoOptions) => void
+
+
+export type GetBatteryInfoSync = () => GetBatteryInfoResult
+
+interface Uni {
+
+ /**
+ * 获取电池电量信息
+ * @description 获取电池电量信息
+ * @param {GetBatteryInfoOptions} options
+ * @example
+ * ```typescript
+ * uni.getBatteryInfo({
+ * success(res) {
+ * console.log(res);
+ * }
+ * })
+ * ```
+ * @remark
+ * - 该接口需要同步调用
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "4.4.4",
+ * "uniVer": "3.6.11",
+ * "unixVer": "3.9.0"
+ * },
+ * "ios": {
+ * "osVer": "9.0",
+ * "uniVer": "3.6.11",
+ * "unixVer": "x"
+ * }
+ * }
+ * }
+ * @uniVueVersion 2,3 //支持的vue版本
+ *
+ */
+ getBatteryInfo (options : GetBatteryInfoOptions) : void,
+ /**
+ * 同步获取电池电量信息
+ * @description 获取电池电量信息
+ * @example
+ * ```typescript
+ * uni.getBatteryInfo()
+ * ```
+ * @remark
+ * - 该接口需要同步调用
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "4.4.4",
+ * "uniVer": "3.6.11",
+ * "unixVer": "3.9.0"
+ * },
+ * "ios": {
+ * "osVer": "9.0",
+ * "uniVer": "3.6.11",
+ * "unixVer": "x"
+ * }
+ * }
+ * }
+ * @uniVueVersion 2,3 //支持的vue版本
+ *
+ */
+ getBatteryInfoSync():GetBatteryInfoResult
+
+}
diff --git a/uni_modules/uni-getbatteryinfo/utssdk/mp-alipay/index.js b/uni_modules/uni-getbatteryinfo/utssdk/mp-alipay/index.js
index 4fdced2ee3aa9d80eafdffdc5f06d522c7a1f08a..473f1a07d3f5b227f9bb1caa1099ddfd99d254da 100644
--- a/uni_modules/uni-getbatteryinfo/utssdk/mp-alipay/index.js
+++ b/uni_modules/uni-getbatteryinfo/utssdk/mp-alipay/index.js
@@ -1,3 +1,6 @@
export function getBatteryInfo(options) {
return my.getBatteryInfo(options)
}
+export function getBatteryInfoSync(options) {
+ return my.getBatteryInfoSync(options)
+}
diff --git a/uni_modules/uni-getbatteryinfo/utssdk/mp-baidu/index.js b/uni_modules/uni-getbatteryinfo/utssdk/mp-baidu/index.js
index 5944a774bdc27de75cbe441c1af274dfef4ab8ac..1ee373a514964b33fd47e1bd59170fb22661c0d9 100644
--- a/uni_modules/uni-getbatteryinfo/utssdk/mp-baidu/index.js
+++ b/uni_modules/uni-getbatteryinfo/utssdk/mp-baidu/index.js
@@ -1,3 +1,6 @@
export function getBatteryInfo(options) {
return swan.getBatteryInfo(options)
}
+export function getBatteryInfoSync(options) {
+ return swan.getBatteryInfoSync(options)
+}
diff --git a/uni_modules/uni-getbatteryinfo/utssdk/mp-qq/index.js b/uni_modules/uni-getbatteryinfo/utssdk/mp-qq/index.js
index 06287bc468d46e1c12f79e455a934fcbea7c52c5..6eabfcff9737dcd28de56bdb67dbb9c96287dcb8 100644
--- a/uni_modules/uni-getbatteryinfo/utssdk/mp-qq/index.js
+++ b/uni_modules/uni-getbatteryinfo/utssdk/mp-qq/index.js
@@ -1,3 +1,6 @@
export function getBatteryInfo(options) {
return qq.getBatteryInfo(options)
}
+export function getBatteryInfoSync(options) {
+ return qq.getBatteryInfoSync(options)
+}
diff --git a/uni_modules/uni-getbatteryinfo/utssdk/mp-weixin/index.js b/uni_modules/uni-getbatteryinfo/utssdk/mp-weixin/index.js
index 5124b3de21a08a351d2d7eb631aaf96a600aa147..3bdfa9184b26d8df7a53aa9eb61c1ef37d66a8a9 100644
--- a/uni_modules/uni-getbatteryinfo/utssdk/mp-weixin/index.js
+++ b/uni_modules/uni-getbatteryinfo/utssdk/mp-weixin/index.js
@@ -1,3 +1,6 @@
export function getBatteryInfo(options) {
return wx.getBatteryInfo(options)
}
+export function getBatteryInfoSync(options) {
+ return wx.getBatteryInfoSync(options)
+}
diff --git a/uni_modules/uni-getbatteryinfo/utssdk/unierror.uts b/uni_modules/uni-getbatteryinfo/utssdk/unierror.uts
new file mode 100644
index 0000000000000000000000000000000000000000..511c66cc0f6627e4e5e72b478fec1163c56ce92c
--- /dev/null
+++ b/uni_modules/uni-getbatteryinfo/utssdk/unierror.uts
@@ -0,0 +1,34 @@
+import { GetBatteryInfoErrorCode, GetBatteryInfoFail } from "./interface.uts"
+/**
+ * 错误主题
+ */
+export const UniErrorSubject = 'uni-getBatteryInfo';
+
+
+/**
+ * 错误信息
+ * @UniError
+ */
+export const UniErrors : Map = new Map([
+ /**
+ * 错误码及对应的错误信息
+ */
+ [1001, 'getBatteryInfo:fail getAppContext is null'],
+]);
+
+
+/**
+ * 错误对象实现
+ */
+export class GetBatteryInfoFailImpl extends UniError implements GetBatteryInfoFail {
+
+ /**
+ * 错误对象构造函数
+ */
+ constructor(errCode : GetBatteryInfoErrorCode) {
+ super();
+ this.errSubject = UniErrorSubject;
+ this.errCode = errCode;
+ this.errMsg = UniErrors[errCode] ?? "";
+ }
+}
\ No newline at end of file
diff --git a/uni_modules/uni-installApk/changelog.md b/uni_modules/uni-installApk/changelog.md
new file mode 100644
index 0000000000000000000000000000000000000000..d67eb701ef976498949ebb5d5eec4b9531e0834e
--- /dev/null
+++ b/uni_modules/uni-installApk/changelog.md
@@ -0,0 +1,10 @@
+## 1.0.4(2023-12-08)
+兼容asset目录文件的处理
+## 1.0.3(2023-10-27)
+遵循UniError规范
+## 1.0.2(2023-10-27)
+修改文档
+## 1.0.1(2023-10-27)
+支持js层调用
+## 1.0.0(2023-10-26)
+安装apk的插件
diff --git a/uni_modules/uni-installApk/package.json b/uni_modules/uni-installApk/package.json
new file mode 100644
index 0000000000000000000000000000000000000000..2270fe2ab7e79516176a637fa9536ccfc1a60111
--- /dev/null
+++ b/uni_modules/uni-installApk/package.json
@@ -0,0 +1,93 @@
+{
+ "id": "uni-installApk",
+ "displayName": "uni-installApk",
+ "version": "1.0.4",
+ "description": "uni-installApk",
+ "keywords": [
+ "uni-installApk"
+ ],
+ "repository": "",
+ "engines": {
+ "HBuilderX": "^3.94"
+ },
+ "dcloudext": {
+ "type": "uts",
+ "sale": {
+ "regular": {
+ "price": "0.00"
+ },
+ "sourcecode": {
+ "price": "0.00"
+ }
+ },
+ "contact": {
+ "qq": ""
+ },
+ "declaration": {
+ "ads": "无",
+ "data": "无",
+ "permissions": "android.permission.REQUEST_INSTALL_PACKAGES"
+ },
+ "npmurl": ""
+ },
+ "uni_modules": {
+ "dependencies": [],
+ "uni-ext-api": {
+ "uni": {
+ "installApk": {
+ "name": "installApk",
+ "app": {
+ "js": true,
+ "kotlin": true,
+ "swift": false
+ }
+ }
+ }
+ },
+ "encrypt": [],
+ "platforms": {
+ "cloud": {
+ "tcb": "y",
+ "aliyun": "y"
+ },
+ "client": {
+ "Vue": {
+ "vue2": "y",
+ "vue3": "y"
+ },
+ "App": {
+ "app-android": "y",
+ "app-ios": "n"
+ },
+ "H5-mobile": {
+ "Safari": "n",
+ "Android Browser": "n",
+ "微信浏览器(Android)": "n",
+ "QQ浏览器(Android)": "n"
+ },
+ "H5-pc": {
+ "Chrome": "n",
+ "IE": "n",
+ "Edge": "n",
+ "Firefox": "n",
+ "Safari": "n"
+ },
+ "小程序": {
+ "微信": "n",
+ "阿里": "n",
+ "百度": "n",
+ "字节跳动": "n",
+ "QQ": "n",
+ "钉钉": "n",
+ "快手": "n",
+ "飞书": "n",
+ "京东": "n"
+ },
+ "快应用": {
+ "华为": "n",
+ "联盟": "n"
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/uni_modules/uni-installApk/readme.md b/uni_modules/uni-installApk/readme.md
new file mode 100644
index 0000000000000000000000000000000000000000..898834d79b542157a264adc6401bce2076c7768e
--- /dev/null
+++ b/uni_modules/uni-installApk/readme.md
@@ -0,0 +1,37 @@
+# uni-installApk
+
+## 使用说明
+
+Android平台安装Apk
+
+**注意: 3.95以下需要自定义基座**
+
+### uni.installApk(options : InstallApkOptions):void
+
+安装apk
+
+参数说明
+
+```
+type InstallApkOptions = {
+ /**
+ * apk文件地址
+ */
+ filePath : string,
+ /**
+ * 接口调用成功的回调函数
+ * @defaultValue null
+ */
+ success ?: (res : any) => void,
+ /**
+ * 接口调用失败的回调函数
+ * @defaultValue null
+ */
+ fail ?: (err : any) => void,
+ /**
+ * 接口调用结束的回调函数(调用成功、失败都会执行)
+ * @defaultValue null
+ */
+ complete ?: (res : any) => void,
+}
+```
\ No newline at end of file
diff --git a/uni_modules/uni-installApk/utssdk/app-android/AndroidManifest.xml b/uni_modules/uni-installApk/utssdk/app-android/AndroidManifest.xml
new file mode 100644
index 0000000000000000000000000000000000000000..5cf3ce22599398429807a3305a5a549277079dc2
--- /dev/null
+++ b/uni_modules/uni-installApk/utssdk/app-android/AndroidManifest.xml
@@ -0,0 +1,5 @@
+
+
+
+
\ No newline at end of file
diff --git a/uni_modules/uni-installApk/utssdk/app-android/index.uts b/uni_modules/uni-installApk/utssdk/app-android/index.uts
new file mode 100644
index 0000000000000000000000000000000000000000..64e7b6bdc7698fee1d7ddce32329aede1e619ed7
--- /dev/null
+++ b/uni_modules/uni-installApk/utssdk/app-android/index.uts
@@ -0,0 +1,83 @@
+import { InstallApkOptions, InstallApkSuccess } from "../interface.uts"
+import { InstallApkFailImpl } from "../unierror.uts"
+import Intent from 'android.content.Intent';
+import Build from 'android.os.Build';
+import File from 'java.io.File';
+import FileProvider from 'androidx.core.content.FileProvider';
+import Context from 'android.content.Context';
+import Uri from 'android.net.Uri';
+import FileOutputStream from 'java.io.FileOutputStream';
+
+export function installApk(options : InstallApkOptions) : void {
+ const context = UTSAndroid.getAppContext() as Context
+ var filePath = UTSAndroid.convert2AbsFullPath(options.filePath)
+ var apkFile : File | null = null;
+ if (filePath.startsWith("/android_asset/")) {
+ filePath = filePath.replace("/android_asset/", "")
+ apkFile = copyAssetFileToPrivateDir(context, filePath)
+ } else {
+ apkFile = new File(filePath)
+ }
+
+ if (apkFile != null && !apkFile.exists() && !apkFile.isFile()) {
+ let error = new InstallApkFailImpl(1300002);
+ options.fail?.(error)
+ options.complete?.(error)
+ return
+ }
+ const intent = new Intent()
+ intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
+ intent.setAction(Intent.ACTION_VIEW)
+
+ if (Build.VERSION.SDK_INT >= 24) {
+ const authority = context.getPackageName() + ".dc.fileprovider"
+ const apkUri = FileProvider.getUriForFile(context, authority, apkFile!!)
+ intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
+ intent.setDataAndType(apkUri, "application/vnd.android.package-archive");
+ } else {
+ intent.setDataAndType(Uri.fromFile(apkFile!!), "application/vnd.android.package-archive");
+ }
+
+ context.startActivity(intent)
+ const success : InstallApkSuccess = {
+ errMsg: "success"
+ }
+ options.success?.(success)
+ options.complete?.(success)
+}
+
+
+function copyAssetFileToPrivateDir(context : Context, fileName : string) : File | null {
+ try {
+ const destPath = context.getCacheDir().getPath() + "/apks/" + fileName
+ const outFile = new File(destPath)
+ const parentFile = outFile.getParentFile()
+ if (parentFile != null) {
+ if (!parentFile.exists()) {
+ parentFile.mkdirs()
+ }
+ }
+ if (!outFile.exists()) {
+ outFile.createNewFile()
+ }
+ const inputStream = context.getAssets().open(fileName)
+ const outputStream = new FileOutputStream(outFile)
+ let buffer = new ByteArray(1024);
+ do {
+ let len = inputStream.read(buffer);
+ if (len == -1) {
+ break;
+ }
+ outputStream.write(buffer, 0, len)
+ } while (true)
+
+ inputStream.close()
+ outputStream.close()
+
+ return outFile
+ } catch (e : Exception) {
+ e.printStackTrace()
+ }
+
+ return null
+}
diff --git a/uni_modules/uni-installApk/utssdk/app-ios/index.uts b/uni_modules/uni-installApk/utssdk/app-ios/index.uts
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/uni_modules/uni-installApk/utssdk/index.d.ts b/uni_modules/uni-installApk/utssdk/index.d.ts
new file mode 100644
index 0000000000000000000000000000000000000000..ad24effbc1e07f4f30aa894e39cb3d388350dabe
--- /dev/null
+++ b/uni_modules/uni-installApk/utssdk/index.d.ts
@@ -0,0 +1,78 @@
+declare namespace UniNamespace {
+
+interface InstallApkSuccess {
+ /**
+ * 安装成功消息
+ */
+ errMsg : string
+}
+
+type InstallApkErrorCode = 1300002
+interface InstallApkFail {
+ errCode : InstallApkErrorCode
+}
+
+type InstallApkComplete = any
+
+type InstallApkSuccessCallback = (res : InstallApkSuccess) => void
+type InstallApkFailCallback = (err : InstallApkFail) => void
+type InstallApkCompleteCallback = (res : InstallApkComplete) => void
+
+interface InstallApkOptions {
+ /**
+ * apk文件地址
+ */
+ filePath : string,
+ /**
+ * 接口调用成功的回调函数
+ * @defaultValue null
+ */
+ success ?: InstallApkSuccessCallback | null,
+ /**
+ * 接口调用失败的回调函数
+ * @defaultValue null
+ */
+ fail ?: InstallApkFailCallback | null,
+ /**
+ * 接口调用结束的回调函数(调用成功、失败都会执行)
+ * @defaultValue null
+ */
+ complete ?: InstallApkCompleteCallback | null
+}
+
+}
+
+
+declare interface Uni {
+ /**
+ * installApk()
+ * @description
+ * 安装apk
+ * @param {InstallApkOptions}
+ * @return {void}
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "4.4",
+ * "uniVer": "3.94+",
+ * "unixVer": "3.94+"
+ * },
+ * "ios": {
+ * "osVer": "x",
+ * "uniVer": "x",
+ * "unixVer": "x"
+ * }
+ * }
+ * }
+ * @example
+ ```typescript
+ uni.installApk({
+ filePath: "/xx/xx/xx.apk",
+ complete: (res: any) => {
+ console.log("complete => " + JSON.stringify(res));
+ }
+ });
+ ```
+ */
+ installApk(options : UniNamespace.InstallApkOptions) : void
+}
diff --git a/uni_modules/uni-installApk/utssdk/interface.uts b/uni_modules/uni-installApk/utssdk/interface.uts
new file mode 100644
index 0000000000000000000000000000000000000000..35edfcd7eaeddfd4f192803385829389bac78689
--- /dev/null
+++ b/uni_modules/uni-installApk/utssdk/interface.uts
@@ -0,0 +1,76 @@
+export interface Uni {
+ /**
+ * installApk()
+ * @description
+ * 安装apk
+ * @param {InstallApkOptions}
+ * @return {void}
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "4.4",
+ * "uniVer": "3.94+",
+ * "unixVer": "3.94+"
+ * },
+ * "ios": {
+ * "osVer": "x",
+ * "uniVer": "x",
+ * "unixVer": "x"
+ * }
+ * }
+ * }
+ * @example
+ ```typescript
+ uni.installApk({
+ filePath: "/xx/xx/xx.apk",
+ complete: (res: any) => {
+ console.log("complete => " + JSON.stringify(res));
+ }
+ });
+ ```
+ */
+ installApk(options : InstallApkOptions) : void
+}
+export type InstallApkSuccess = {
+ /**
+ * 安装成功消息
+ */
+ errMsg : string
+}
+export type InstallApkComplete = any
+export type InstallApkSuccessCallback = (res : InstallApkSuccess) => void
+/**
+ * 错误码
+ * - 1300002 找不到文件
+ */
+export type InstallApkErrorCode = 1300002
+/**
+ * 网络请求失败的错误回调参数
+ */
+export interface InstallApkFail extends IUniError {
+ errCode : InstallApkErrorCode
+};
+export type InstallApkFailCallback = (err : InstallApkFail) => void
+export type InstallApkCompleteCallback = (res : InstallApkComplete) => void
+
+export type InstallApkOptions = {
+ /**
+ * apk文件地址
+ */
+ filePath : string,
+ /**
+ * 接口调用成功的回调函数
+ * @defaultValue null
+ */
+ success ?: InstallApkSuccessCallback | null,
+ /**
+ * 接口调用失败的回调函数
+ * @defaultValue null
+ */
+ fail ?: InstallApkFailCallback | null,
+ /**
+ * 接口调用结束的回调函数(调用成功、失败都会执行)
+ * @defaultValue null
+ */
+ complete ?: InstallApkCompleteCallback | null
+}
\ No newline at end of file
diff --git a/uni_modules/uni-installApk/utssdk/unierror.uts b/uni_modules/uni-installApk/utssdk/unierror.uts
new file mode 100644
index 0000000000000000000000000000000000000000..a10c730d262388e3a2f945208c69f2cc66bee40c
--- /dev/null
+++ b/uni_modules/uni-installApk/utssdk/unierror.uts
@@ -0,0 +1,25 @@
+import { InstallApkErrorCode, InstallApkFail } from "./interface.uts"
+
+/**
+ * 错误主题
+ */
+export const UniErrorSubject = 'uni-installApk';
+/**
+ * 错误码
+ * @UniError
+ */
+export const UniErrors : Map = new Map([
+ /**
+ * 找不到文件
+ */
+ [1300002, 'No such file'],
+]);
+
+export class InstallApkFailImpl extends UniError implements InstallApkFail {
+ constructor(errCode : InstallApkErrorCode) {
+ super();
+ this.errSubject = UniErrorSubject;
+ this.errCode = errCode;
+ this.errMsg = UniErrors[errCode] ?? "";
+ }
+}
\ No newline at end of file
diff --git a/uni_modules/uni-media/changelog.md b/uni_modules/uni-media/changelog.md
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/uni_modules/uni-media/package.json b/uni_modules/uni-media/package.json
new file mode 100644
index 0000000000000000000000000000000000000000..ffef8e134a2c8dc6022855bba96f8bcb5d449a09
--- /dev/null
+++ b/uni_modules/uni-media/package.json
@@ -0,0 +1,167 @@
+{
+ "id": "uni-media",
+ "displayName": "uni-media",
+ "version": "1.0.0",
+ "description": "uni-media",
+ "keywords": [
+ "uni-media"
+ ],
+ "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": {
+ "uni-ext-api": {
+ "uni": {
+ "chooseImage": {
+ "name": "chooseImage",
+ "app": {
+ "js": false,
+ "kotlin": true,
+ "swift": false
+ }
+ },
+ "previewImage": {
+ "name": "previewImage",
+ "app": {
+ "js": false,
+ "kotlin": true,
+ "swift": false
+ }
+ },
+ "closePreviewImage": {
+ "name": "closePreviewImage",
+ "app": {
+ "js": false,
+ "kotlin": true,
+ "swift": false
+ }
+ },
+ "getImageInfo": {
+ "name": "getImageInfo",
+ "app": {
+ "js": false,
+ "kotlin": true,
+ "swift": false
+ }
+ },
+ "saveImageToPhotosAlbum": {
+ "name": "saveImageToPhotosAlbum",
+ "app": {
+ "js": false,
+ "kotlin": true,
+ "swift": false
+ }
+ },
+ "compressImage": {
+ "name": "compressImage",
+ "app": {
+ "js": false,
+ "kotlin": true,
+ "swift": false
+ }
+ },
+ "chooseVideo": {
+ "name": "chooseVideo",
+ "app": {
+ "js": false,
+ "kotlin": true,
+ "swift": false
+ }
+ },
+ "saveVideoToPhotosAlbum": {
+ "name": "saveVideoToPhotosAlbum",
+ "app": {
+ "js": false,
+ "kotlin": true,
+ "swift": false
+ }
+ },
+ "getVideoInfo": {
+ "name": "getVideoInfo",
+ "app": {
+ "js": false,
+ "kotlin": true,
+ "swift": false
+ }
+ },
+ "compressVideo": {
+ "name": "compressVideo",
+ "app": {
+ "js": false,
+ "kotlin": true,
+ "swift": false
+ }
+ }
+ }
+ },
+ "dependencies": [
+ "uni-prompt"
+ ],
+ "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"
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/uni_modules/uni-media/readme.md b/uni_modules/uni-media/readme.md
new file mode 100644
index 0000000000000000000000000000000000000000..a283ad8b59ff18a42b90480f35121f403ac2d4c4
--- /dev/null
+++ b/uni_modules/uni-media/readme.md
@@ -0,0 +1,6 @@
+# uni-chooseImage
+### 开发文档
+[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)
\ No newline at end of file
diff --git a/uni_modules/uni-media/utssdk/ChooseImageUtils.uts b/uni_modules/uni-media/utssdk/ChooseImageUtils.uts
new file mode 100644
index 0000000000000000000000000000000000000000..acd0aa10d2f549b68e8e28d154e9559fee7e4d99
--- /dev/null
+++ b/uni_modules/uni-media/utssdk/ChooseImageUtils.uts
@@ -0,0 +1,73 @@
+import { ChooseImageOptions, ChooseVideoOptions } from "./interface.uts"
+import {
+ UniError_ChooseImage, UniError_ChooseVideo, UniError_SaveImageToPhotosAlbum, UniError_SaveVideoToPhotosAlbum,
+ UniErrors
+} from "./unierror.uts"
+export const CODE_CAMERA_ERROR = 11;
+export const CODE_GALLERY_ERROR = 12;
+export const CODE_GET_IMAGE_INFO_CODE = 13
+
+export function uniChooseImage(options : ChooseImageOptions, onSourceTypeSelect : (count : number, compressed : boolean, index : number) => void) {
+ let count = options.count != null ? (options.count! <= 0 ? 9 : options.count) : 9
+ // 默认为 false
+ let compressed = false;
+ if ((options.sizeType) != null) {
+ compressed = options.sizeType!.indexOf("original") < 0
+ }
+ /* source type 乱传如何处理 */
+ let sourceType : Array = (options.sourceType != null && options.sourceType!.length > 0) ? options.sourceType! : ["album", "camera"];
+ let itemList = ["拍摄", "从相册选择"]
+ if (sourceType.length == 1) {
+ if (sourceType.indexOf("album") >= 0) {
+ onSourceTypeSelect?.(count!, compressed, 1)
+ } else if (sourceType.indexOf("camera") >= 0) {
+ onSourceTypeSelect?.(count!, compressed, 0)
+ }
+ return
+ }
+ if (sourceType.length == 2) {
+ uni.showActionSheet({
+ itemList: itemList,
+ success: (e) => {
+ onSourceTypeSelect?.(count!, compressed, e.tapIndex!)
+ },
+ fail: (e) => {
+ let error : UniError = { "errSubject": UniError_ChooseImage, "errCode": 1101001, "errMsg": UniErrors[1101001]! }
+ options.fail?.(error)
+ options.complete?.(error)
+ }
+ })
+ }
+}
+
+export function uniChooseVideo(options : ChooseVideoOptions, onSourceTypeSelect : (count : number, compressed : boolean, index : number) => void) {
+ let count = 1
+ // 默认为 false
+ let compressed = options.compressed != null ? options.compressed! : true;
+
+ /* source type 乱传如何处理 */
+ let sourceType : Array = (options.sourceType != null && options.sourceType!.length > 0) ? options.sourceType! : ["album", "camera"];
+ let itemList = ["拍摄", "从相册选择"]
+ if (sourceType.length == 1) {
+ if (sourceType.indexOf("album") >= 0) {
+ onSourceTypeSelect?.(count!, compressed, 1)
+ } else if (sourceType.indexOf("camera") >= 0) {
+ onSourceTypeSelect?.(count!, compressed, 0)
+ }
+ return
+ }
+
+ if (sourceType.length == 2) {
+ uni.showActionSheet({
+ itemList: itemList,
+ success: (e) => {
+ onSourceTypeSelect?.(count!, compressed, e.tapIndex!)
+ },
+ fail: (e) => {
+ let error : UniError = { "errSubject": UniError_ChooseVideo, "errCode": 1101001, "errMsg": UniErrors[1101001]! }
+ options.fail?.(error)
+ options.complete?.(error)
+ }
+ })
+ }
+}
\ No newline at end of file
diff --git a/uni_modules/uni-media/utssdk/app-android/AndroidManifest.xml b/uni_modules/uni-media/utssdk/app-android/AndroidManifest.xml
new file mode 100644
index 0000000000000000000000000000000000000000..156a948a1b15c31fef1183788e2d475623a2b4d2
--- /dev/null
+++ b/uni_modules/uni-media/utssdk/app-android/AndroidManifest.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/uni_modules/uni-media/utssdk/app-android/config.json b/uni_modules/uni-media/utssdk/app-android/config.json
new file mode 100644
index 0000000000000000000000000000000000000000..1a9e9238affa90778e875710656c82fd726d7032
--- /dev/null
+++ b/uni_modules/uni-media/utssdk/app-android/config.json
@@ -0,0 +1,7 @@
+{
+ "dependencies": [
+ "com.github.bumptech.glide:glide:4.9.0",
+ "androidx.recyclerview:recyclerview:1.0.0",
+ "androidx.appcompat:appcompat:1.0.0"
+ ]
+}
\ No newline at end of file
diff --git a/uni_modules/uni-media/utssdk/app-android/index.uts b/uni_modules/uni-media/utssdk/app-android/index.uts
new file mode 100644
index 0000000000000000000000000000000000000000..f325d99588f6ef35f8e0493cbeb63d07c70eac92
--- /dev/null
+++ b/uni_modules/uni-media/utssdk/app-android/index.uts
@@ -0,0 +1,613 @@
+import { getUniActivity } from "io.dcloud.uts.android";
+import {
+ ChooseImageOptions, ChooseImage, ChooseImageSuccessCallback,
+ PreviewImageOptions, PreviewImage, LongPressActionsOptions, PreviewImageSuccessCallback, LongPressActionsSuccessData,
+ ClosePreviewImage, ClosePreviewImageSuccessCallback, ClosePreviewImageOptions,
+ GetImageInfo, GetImageInfoOptions, GetImageInfoSuccessCallback,
+ SaveImageToPhotosAlbum, SaveImageToPhotosAlbumOptions, SaveImageToPhotosAlbumSuccessCallback,
+ CompressImage, CompressImageSuccessCallback, CompressImageFailCallback, CompressImageOptions,
+ ChooseVideo, ChooseVideoOptions, ChooseVideoFailCallback, ChooseVideoSuccessCallback,
+ GetVideoInfo, GetVideoInfoOptions, GetVideoInfoSuccessCallback,
+ SaveVideoToPhotosAlbum, SaveVideoToPhotosAlbumOptions, SaveVideoToPhotosAlbumSuccessCallback,
+ CompressVideo, CompressVideoOptions, CompressVideoFailCallback, CompressVideoSuccessCallback
+} from "../interface.uts"
+import {
+ UniError_PreviewImage, UniError_GetImageInfo, UniError_SaveImageToPhotosAlbum, UniError_SaveVideoToPhotosAlbum,
+ UniErrors
+} from "../unierror.uts"
+import { CODE_CAMERA_ERROR, CODE_GALLERY_ERROR, CODE_GET_IMAGE_INFO_CODE } from "../ChooseImageUtils.uts"
+import { chooseMediaImage, chooseMediaVideo } from "./utils/ChooseMediaUtils.uts"
+import { transcodeImage, transcodeVideo } from './utils/CompressUtils.uts'
+import { getVideoMetadata } from "./utils/MediaUtils.uts"
+import Intent from 'android.content.Intent';
+import UTSAndroid from 'io.dcloud.uts.UTSAndroid';
+import Manifest from 'android.Manifest';
+import Build from 'android.os.Build';
+import File from 'java.io.File';
+import Uri from 'android.net.Uri';
+import ArrayList from 'java.util.ArrayList';
+
+import Glide from 'com.bumptech.glide.Glide';
+import CustomTarget from 'com.bumptech.glide.request.target.CustomTarget';
+import Drawable from 'android.graphics.drawable.Drawable';
+import Transition from 'com.bumptech.glide.request.transition.Transition';
+import ExifInterface from 'android.media.ExifInterface';
+import BitmapFactory from 'android.graphics.BitmapFactory';
+import TextUtils from 'android.text.TextUtils';
+import FileInputStream from 'java.io.FileInputStream';
+import FileOutputStream from 'java.io.FileOutputStream';
+import Environment from 'android.os.Environment';
+import LongClickEventManager from 'io.dcloud.uts.nativeObj.photoview.LongClickEventManager';
+import JSONObject from 'org.json.JSONObject';
+import ActivityManager from 'io.dcloud.uts.nativeObj.photoview.ActivityManager';
+import MediaMetadataRetriever from 'android.media.MediaMetadataRetriever';
+import MediaStore from 'android.provider.MediaStore';
+import ContentValues from 'android.content.ContentValues';
+import Exception from 'java.lang.Exception';
+import BufferedOutputStream from 'java.io.BufferedOutputStream';
+import ByteArrayInputStream from 'java.io.ByteArrayInputStream';
+// import { actionSheetImpl, ShowActionSheetOptions, closeActionSheet } from "./showActionSheet.uts";
+
+
+/**
+ * 图片压缩目前采用原java代码压缩方式
+ */
+
+
+export const chooseImage : ChooseImage = function (option : ChooseImageOptions) {
+ chooseMediaImage(option)
+}
+
+export const previewImage : PreviewImage = function (options : PreviewImageOptions) {
+ if (options.urls.length > 0) {
+ let values : ArrayList = new ArrayList()
+ let oroginalValues : ArrayList = new ArrayList()
+ options.urls.forEach((original) => {
+ let localPath = original
+ if (!localPath.startsWith("data:image") && !isNetPath(localPath)) {
+ localPath = UTSAndroid.convert2AbsFullPath(localPath)
+ }
+ values.add(localPath)
+ oroginalValues.add(original)
+ })
+ let intent = new Intent()
+ intent.setClassName(getUniActivity()!, "io.dcloud.uts.nativeObj.photoview.PhotoActivity");
+ intent.putExtra("image_urlList", values);
+ intent.putExtra("original_image_urlArray", oroginalValues)
+ var current = 0;
+ if (options.current != null) {
+ try {
+ current = (options.current!.toString()).toInt()
+ if (current < 0) {
+ current = 0
+ }
+ } catch (e) {
+
+ }
+ }
+ intent.putExtra("image_current_index", current)
+ intent.putExtra("image_loop", options.loop != null ? options.loop! : false);
+ if (options.indicator != null) {
+ intent.putExtra("image_indicator", options.indicator!);
+ }
+ intent.putExtra("image_photo", true);
+ var callbackId = System.currentTimeMillis() + ":"
+ intent.putExtra("preview_callback", callbackId);
+ // uts目前无法支持嵌套方法,长按事件暂时不支持
+ // LongClickEventManager.getInstance().addOnlongClickListener(callbackId, new LongClick(options))
+ getUniActivity()!.startActivity(intent)
+ let success : PreviewImageSuccessCallback = { errMsg: 'ok', "errSubject": UniError_PreviewImage }
+ options.success?.(success)
+ options.complete?.(success)
+ } else {
+ let error : UniError = { "errCode": 1101002, "errMsg": UniErrors[1101002]!, "errSubject": UniError_PreviewImage }
+ options.fail?.(error)
+ options.complete?.(error)
+ }
+}
+
+class LongClick implements LongClickEventManager.OnLongClickListener {
+ options : PreviewImageOptions
+ constructor(options : PreviewImageOptions) {
+ this.options = options
+ }
+ override onLongClickListener(values : JSONObject) {
+ var itemList : Array | null = null
+ var itemColor : string | null = null
+ var hasLongPressAction = false;
+ if (this.options.longPressActions != null && this.options.longPressActions!.itemList != null && this.options.longPressActions!.itemList!.length > 0) {
+ itemList = this.options.longPressActions!.itemList!
+ hasLongPressAction = true
+ } else {
+ itemList = ["保存"]
+ }
+ if (this.options.longPressActions != null && this.options.longPressActions!.itemColor != null) {
+ itemColor = this.options.longPressActions!.itemColor!
+ }
+ // let actionOption : ShowActionSheetOptions = {
+ // "itemList": itemList!,
+ // "itemColor": itemColor == null ? "" : itemColor!,
+ // success: (e) => {
+ // if (hasLongPressAction) {
+ // let success : LongPressActionsSuccessData = {
+ // "index": values.optInt("index"),
+ // "tapIndex": e.tapIndex!
+ // }
+ // this.options.longPressActions?.success?.(success)
+ // this.options.longPressActions?.complete?.(success)
+ // return
+ // }
+ // let saveOption : SaveImageToPhotosAlbumOptions = {
+ // "filePath": values.optString("url"),
+ // success: (e) => {
+ // uni.showToast({
+ // title: "uni.previewImage.save.success",
+ // position: "bottom"
+ // })
+ // },
+ // fail: (e) => {
+ // uni.showToast({
+ // title: "uni.previewImage.save.fail",
+ // position: "bottom"
+ // })
+ // },
+ // complete: (e) => {
+ // }
+ // }
+ // loadFile(saveOption, false)
+ // },
+ // fail: (e) => {
+ // if (hasLongPressAction) {
+ // let fail = {
+ // "errMsg": "user cancel"
+ // }
+ // this.options.longPressActions?.fail?.(fail)
+ // this.options.longPressActions?.complete?.(fail)
+ // }
+ // }
+ // }
+ // let activity = ActivityManager.getInstance().getRunningActivity("io.dcloud.uts.nativeObj.photoview.PhotoActivity")
+ // actionSheetImpl(activity, actionOption)
+ // uni.showActionSheet()
+ }
+}
+
+function isNetPath(url : string) : boolean {
+ if (url.startsWith("http://") || url.startsWith("https://") || url.startsWith("rtmp://") || url.startsWith("rtsp://")) {
+ return true;
+ }
+ return false;
+}
+
+export const closePreviewImage : ClosePreviewImage = function (options : ClosePreviewImageOptions) {
+ // 可能存在执行关闭的时候 action sheet 正在显示
+ // closeActionSheet()
+ let activity = ActivityManager.getInstance().getRunningActivity("io.dcloud.uts.nativeObj.photoview.PhotoActivity")
+ if (activity != null) {
+ activity.onBackPressed()
+ }
+ let callback : ClosePreviewImageSuccessCallback = {
+ errMsg: "ok"
+ }
+ options.success?.(callback)
+ options.complete?.(callback)
+}
+
+export const getImageInfo : GetImageInfo = function (options : GetImageInfoOptions) {
+ if (isNetPath(options.src)) {
+ Glide.with(getUniActivity()!).asFile().load(options.src).into(new ImageInfoTarget(options))
+ } else {
+ var path = ""
+ if (options.src.length > 0) {
+ path = UTSAndroid.convert2AbsFullPath(options.src)
+ getExif(path, options, null)
+ } else {
+ let imageInfoCallback : UniError = { "errCode": 1101003, "errMsg": UniErrors[1101003]!, "errSubject": UniError_GetImageInfo }
+ options.fail?.(imageInfoCallback)
+ options.complete?.(imageInfoCallback)
+ }
+ }
+}
+
+class ImageInfoTarget extends CustomTarget {
+ options : GetImageInfoOptions
+
+ constructor(options : GetImageInfoOptions) {
+ super();
+ this.options = options
+ }
+
+ override onResourceReady(resource : File, transition : Transition> | null) {
+ let bitmapOption = new BitmapFactory.Options();
+ bitmapOption.inJustDecodeBounds = true;
+ BitmapFactory.decodeFile(resource.getPath(), bitmapOption)
+ let mimeType : string = bitmapOption.outMimeType
+ if (!TextUtils.isEmpty(mimeType) && mimeType.contains("/")) {
+ mimeType = mimeType.substring(mimeType.indexOf("/") + 1)
+ }
+ // 拼接保存路径
+ let path = UTSAndroid.getAppTempPath()! + "imageInfo/" + System.currentTimeMillis()
+ if (!TextUtils.isEmpty(mimeType)) {
+ path += "." + mimeType
+ } else {
+ path += ".jpg"
+ }
+ if (copyFile(resource.getPath(), path)) {
+ getExif(path, this.options, bitmapOption)
+ } else {
+ let imageInfoCallback : UniError = { "errCode": 1101004, "errMsg": UniErrors[1101004]!, "errSubject": UniError_GetImageInfo }
+ this.options.fail?.(imageInfoCallback)
+ this.options.complete?.(imageInfoCallback)
+ }
+ }
+
+ override onLoadCleared(placeholder : Drawable | null) {
+ }
+
+ override onLoadFailed(errorDrawable : Drawable | null) {
+ let imageInfoCallback : UniError = { "errCode": 1101004, "errMsg": UniErrors[1101004]!, "errSubject": UniError_GetImageInfo }
+ this.options.fail?.(imageInfoCallback)
+ this.options.complete?.(imageInfoCallback)
+ }
+}
+
+function getExif(src : string, options : GetImageInfoOptions, bitmapOption : BitmapFactory.Options | null) {
+ if (!new File(src).exists()) {
+ let imageInfoCallback : UniError = { "errCode": 1101003, "errMsg": UniErrors[1101003]!, "errSubject": UniError_GetImageInfo }
+ options.fail?.(imageInfoCallback)
+ options.complete?.(imageInfoCallback)
+ return
+ }
+ try {
+ let exifInfo = new ExifInterface(src);
+ 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
+ if (!TextUtils.isEmpty(mimeType) && mimeType.contains("/")) {
+ mimeType = mimeType.substring(mimeType.indexOf("/") + 1)
+ }
+ let orientation = exifInfo.getAttribute(ExifInterface.TAG_ORIENTATION);
+ let orientationStr = ""
+ switch (orientation) {
+ case "2":
+ orientationStr = "up-mirrored";
+ break;
+ case "3":
+ orientationStr = "down";
+ break;
+ case "4":
+ orientationStr = "down-mirrored";
+ break;
+ case "5":
+ orientationStr = "left-mirrored";
+ break;
+ case "6":
+ orientationStr = "right";
+ break;
+ case "7":
+ orientationStr = "right-mirrored";
+ break;
+ case "8":
+ orientationStr = "left";
+ break;
+ case "0":
+ case "1":
+ default:
+ orientationStr = "up";
+ break;
+ }
+ let imageInfoCallback : GetImageInfoSuccessCallback = {
+ "width": width,
+ "height": height,
+ "path": "file://" + src,
+ "orientation": orientationStr,
+ "type": TextUtils.isEmpty(mimeType) ? "unknown" : mimeType
+ }
+ options.success?.(imageInfoCallback)
+ options.complete?.(imageInfoCallback)
+ } catch (e:Exception) {
+ let imageInfoCallback : UniError = { "errCode": 1101010, "errMsg": UniErrors[1101010]!+e.toString(), "errSubject": UniError_GetImageInfo }
+ options.fail?.(imageInfoCallback)
+ options.complete?.(imageInfoCallback)
+ }
+}
+
+
+function copyFile(fromFilePath : string, toFilePath : string) : boolean {
+ let fromFile = new File(fromFilePath)
+ if (!fromFile.exists()) {
+ return false;
+ }
+ if (!fromFile.isFile()) {
+ return false
+ }
+ if (!fromFile.canRead()) {
+ return false;
+ }
+ let toFile = new File(toFilePath)
+ if (!toFile.getParentFile().exists()) {
+ toFile.getParentFile().mkdirs()
+ }
+ if (!toFile.exists()) {
+ toFile.createNewFile()
+ }
+ try {
+ let fis = new FileInputStream(fromFile)
+ 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 = [Manifest.permission.WRITE_EXTERNAL_STORAGE]
+ UTSAndroid.requestSystemPermission(UTSAndroid.getUniActivity()!, requestPermissionList, (a : boolean, b : string[]) => {
+ loadFile(options, true)
+ }, (a : boolean, b : string[]) => {
+ let error : UniError = {
+ "errCode": 1101005,
+ "errMsg": UniErrors[1101005]!,
+ "errSubject": UniError_SaveImageToPhotosAlbum
+ }
+ options.fail?.(error)
+ options.complete?.(error)
+ })
+ } else {
+ loadFile(options, true)
+ }
+}
+
+function loadFile(options : SaveImageToPhotosAlbumOptions, saveToAlbum : boolean) {
+ if (isNetPath(options.filePath)) {
+ Glide.with(getUniActivity()!).asFile().load(options.filePath).into(new SaveToAlbumTarget(options, saveToAlbum))
+ } else {
+ if (TextUtils.isEmpty(options.filePath)) {
+ let error : UniError = {
+ "errCode": 1101003,
+ "errMsg": UniErrors[1101003]!,
+ "errSubject": UniError_SaveImageToPhotosAlbum
+ }
+ options.fail?.(error)
+ options.complete?.(error)
+ return
+ }
+ let originalPath = UTSAndroid.convert2AbsFullPath(options.filePath)
+ if (!new File(originalPath).exists()) {
+ let error : UniError = {
+ "errCode": 1101003,
+ "errMsg": UniErrors[1101003]!,
+ "errSubject": UniError_SaveImageToPhotosAlbum
+ }
+ options.fail?.(error)
+ options.complete?.(error)
+ return
+ }
+ let path = DCIM_PATH + originalPath.substring(originalPath.lastIndexOf("/") + 1)
+ if (copyFileToPublicPath(originalPath, path, false)) {
+ if (saveToAlbum) {
+ sendSaveToAlbumBroad(path)
+ }
+ let success : SaveImageToPhotosAlbumSuccessCallback = {
+ "path": path
+ }
+ options.success?.(success)
+ options.complete?.(success)
+ } else {
+ let error : UniError = {
+ "errCode": 1101006,
+ "errMsg": UniErrors[1101006]!,
+ "errSubject": UniError_SaveImageToPhotosAlbum
+ }
+ options.fail?.(error)
+ options.complete?.(error)
+ }
+ }
+}
+
+function copyFileToPublicPath(fromFilePath : string, toFilePath : string, isVideo : boolean) : boolean {
+ if (Build.VERSION.SDK_INT < Build.VERSION_CODES.Q) {
+ try {
+ return copyFile(fromFilePath, toFilePath)
+ } catch (e) {
+ return false
+ }
+ }
+ if ((Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q && UTSAndroid.getUniActivity()!.getApplicationInfo().targetSdkVersion >= 29) || (Build.VERSION.SDK_INT >= 30)) {
+ try {
+ var fis = new FileInputStream(fromFilePath)
+ if (fis == null) {
+ return false
+ }
+ var mimeType : string | null = null
+ if (isVideo) {
+ var retriever = new MediaMetadataRetriever()
+ retriever.setDataSource(fromFilePath)
+ mimeType = retriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_MIMETYPE);
+ } else {
+ let opt = new BitmapFactory.Options();
+ opt.inJustDecodeBounds = true;
+ BitmapFactory.decodeFile(fromFilePath, opt)
+ mimeType = opt.outMimeType;
+ }
+ if (mimeType == null) {
+ return false
+ }
+ var uri = MediaStore.Files.getContentUri(MediaStore.VOLUME_EXTERNAL)
+ if (mimeType!.startsWith("image/")) {
+ uri = MediaStore.Images.Media.EXTERNAL_CONTENT_URI
+ } else if (mimeType!.startsWith("video/")) {
+ uri = MediaStore.Video.Media.EXTERNAL_CONTENT_URI
+ } else if (mimeType!.startsWith("audio/")) {
+ uri = MediaStore.Audio.Media.EXTERNAL_CONTENT_URI
+ }
+ var resolver = UTSAndroid.getUniActivity()!.getContentResolver()
+ var contentValue = new ContentValues()
+ let fileName = fromFilePath.substring(fromFilePath.lastIndexOf("/") + 1)
+ contentValue.put(MediaStore.Files.FileColumns.DISPLAY_NAME, fileName)
+ contentValue.put(MediaStore.Files.FileColumns.MIME_TYPE, mimeType!)
+ contentValue.put(MediaStore.Files.FileColumns.TITLE, fileName)
+ contentValue.put(MediaStore.Images.Media.RELATIVE_PATH, "DCIM/Camera/")
+ let insertUri = resolver.insert(uri, contentValue)
+ if (insertUri == null) {
+ return false
+ }
+ let fos = resolver.openOutputStream(insertUri)
+ if (fos == null) {
+ return false
+ }
+ var byteArrays = ByteArray(102400 * 2)
+ var c = fis.read(byteArrays)
+ while (c > 0) {
+ fos!.write(byteArrays, 0, c)
+ c = fis.read(byteArrays)
+ }
+ fos!.close()
+ fis.close()
+ return true
+ } catch (e : Exception) {
+ e.printStackTrace();
+ return false
+ }
+ } else {
+ try {
+ return copyFile(fromFilePath, toFilePath)
+ } catch (e) {
+ return false
+ }
+ }
+}
+
+function sendSaveToAlbumBroad(src : string) {
+ let intent = new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE, Uri.parse("file://" + src))
+ getUniActivity()!.sendBroadcast(intent)
+}
+
+let DCIM_PATH = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DCIM).getAbsolutePath() + "/Camera/"
+class SaveToAlbumTarget extends CustomTarget {
+ options : SaveImageToPhotosAlbumOptions
+ saveToAlbum : boolean
+ constructor(options : SaveImageToPhotosAlbumOptions, saveToAlbum : boolean) {
+ super();
+ this.options = options
+ this.saveToAlbum = saveToAlbum
+ }
+
+ override onResourceReady(resource : File, transition : Transition> | null) {
+ let bitmapOption = new BitmapFactory.Options();
+ bitmapOption.inJustDecodeBounds = true;
+ BitmapFactory.decodeFile(resource.getPath(), bitmapOption)
+ let mimeType : string | null = bitmapOption.outMimeType
+ if (!TextUtils.isEmpty(mimeType) && mimeType!.contains("/")) {
+ mimeType = mimeType!.substring(mimeType!.indexOf("/") + 1)
+ }
+
+ // 拼接保存路径
+ let path = DCIM_PATH + System.currentTimeMillis()
+ if (!TextUtils.isEmpty(mimeType)) {
+ path += "." + mimeType
+ } else {
+ path += ".jpg"
+ }
+ if (copyFileToPublicPath(resource.getPath(), path, false)) {
+ if (this.saveToAlbum) {
+ sendSaveToAlbumBroad(path)
+ }
+ let success : SaveImageToPhotosAlbumSuccessCallback = {
+ "path": path
+ }
+ this.options.success?.(success)
+ this.options.complete?.(success)
+ } else {
+ let imageInfoCallback : UniError = { "errCode": 1101004, "errMsg": UniErrors[1101004]!, "errSubject": UniError_SaveImageToPhotosAlbum }
+ this.options.fail?.(imageInfoCallback)
+ this.options.complete?.(imageInfoCallback)
+ }
+ }
+
+ override onLoadCleared(placeholder : Drawable | null) {
+ }
+
+ override onLoadFailed(errorDrawable : Drawable | null) {
+ let imageInfoCallback : UniError = { "errCode": 1101004, "errMsg": UniErrors[1101004]!, "errSubject": UniError_SaveImageToPhotosAlbum }
+ this.options.fail?.(imageInfoCallback)
+ this.options.complete?.(imageInfoCallback)
+ }
+}
+
+export const compressImage : CompressImage = function (options : CompressImageOptions) {
+ transcodeImage(options)
+}
+
+export const chooseVideo : ChooseVideo = function (options : ChooseVideoOptions) {
+ chooseMediaVideo(options)
+}
+
+
+export const getVideoInfo : GetVideoInfo = function (options : GetVideoInfoOptions) {
+ let result = getVideoMetadata(options.src)
+ if (result instanceof GetVideoInfoSuccessCallback) {
+ options.success?.(result as GetVideoInfoSuccessCallback)
+ } else if (result instanceof UniError)
+ options.fail?.(result as UniError)
+ options.complete?.(result)
+}
+
+
+export const saveVideoToPhotosAlbum : SaveVideoToPhotosAlbum = function (options : SaveVideoToPhotosAlbumOptions) {
+ if (TextUtils.isEmpty(options.filePath)) {
+ let error : UniError = {
+ "errCode": 1101003,
+ "errMsg": UniErrors[1101003]!,
+ "errSubject": UniError_SaveVideoToPhotosAlbum
+ }
+ options.fail?.(error)
+ options.complete?.(error)
+ return
+ }
+ let originalPath = UTSAndroid.convert2AbsFullPath(options.filePath)
+ if (!new File(originalPath).exists()) {
+ let error : UniError = {
+ "errCode": 1101003,
+ "errMsg": UniErrors[1101003]!,
+ "errSubject": UniError_SaveVideoToPhotosAlbum
+ }
+ options.fail?.(error)
+ options.complete?.(error)
+ return
+ }
+ let path = DCIM_PATH + originalPath.substring(originalPath.lastIndexOf("/") + 1)
+ if (copyFileToPublicPath(originalPath, path, true)) {
+ sendSaveToAlbumBroad(path)
+ let success : SaveVideoToPhotosAlbumSuccessCallback = {
+ // "path": path
+ }
+ options.success?.(success)
+ options.complete?.(success)
+ } else {
+ let error : UniError = {
+ "errCode": 1101006,
+ "errMsg": UniErrors[1101006]!,
+ "errSubject": UniError_SaveVideoToPhotosAlbum
+ }
+ options.fail?.(error)
+ options.complete?.(error)
+ }
+}
+
+export const compressVideo : CompressVideo = function (options : CompressVideoOptions) {
+ transcodeVideo(options)
+}
\ No newline at end of file
diff --git a/uni_modules/uni-media/utssdk/app-android/libs/nativeobj-preview-release.aar b/uni_modules/uni-media/utssdk/app-android/libs/nativeobj-preview-release.aar
new file mode 100644
index 0000000000000000000000000000000000000000..50b20482c6092006bd2913eaeef07f2b4e6de7d3
Binary files /dev/null and b/uni_modules/uni-media/utssdk/app-android/libs/nativeobj-preview-release.aar differ
diff --git a/uni_modules/uni-media/utssdk/app-android/res/anim/slide_in_bottom.xml b/uni_modules/uni-media/utssdk/app-android/res/anim/slide_in_bottom.xml
new file mode 100644
index 0000000000000000000000000000000000000000..5c0de2a5b0eccc3918e7aa01ab20bfe09d3adadb
--- /dev/null
+++ b/uni_modules/uni-media/utssdk/app-android/res/anim/slide_in_bottom.xml
@@ -0,0 +1,4 @@
+
+
\ No newline at end of file
diff --git a/uni_modules/uni-media/utssdk/app-android/res/anim/slide_out_top.xml b/uni_modules/uni-media/utssdk/app-android/res/anim/slide_out_top.xml
new file mode 100644
index 0000000000000000000000000000000000000000..7fba593bf0140d08929aca1cf789ad65c9d3a301
--- /dev/null
+++ b/uni_modules/uni-media/utssdk/app-android/res/anim/slide_out_top.xml
@@ -0,0 +1,4 @@
+
+
\ No newline at end of file
diff --git a/uni_modules/uni-media/utssdk/app-android/res/drawable/dialog_bg_rounded.xml b/uni_modules/uni-media/utssdk/app-android/res/drawable/dialog_bg_rounded.xml
new file mode 100644
index 0000000000000000000000000000000000000000..8a05570ccb67dc626f7908b1de7de17380f9ba19
--- /dev/null
+++ b/uni_modules/uni-media/utssdk/app-android/res/drawable/dialog_bg_rounded.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/uni_modules/uni-media/utssdk/app-android/res/drawable/dialog_bg_rounded_night.xml b/uni_modules/uni-media/utssdk/app-android/res/drawable/dialog_bg_rounded_night.xml
new file mode 100644
index 0000000000000000000000000000000000000000..b976cd2923ce13c6dcc30b33023325175c964e0a
--- /dev/null
+++ b/uni_modules/uni-media/utssdk/app-android/res/drawable/dialog_bg_rounded_night.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/uni_modules/uni-media/utssdk/app-android/res/layout/action_sheet.xml b/uni_modules/uni-media/utssdk/app-android/res/layout/action_sheet.xml
new file mode 100644
index 0000000000000000000000000000000000000000..dafe2acc4f77cb09ddaaedbb73c38c9b02e70612
--- /dev/null
+++ b/uni_modules/uni-media/utssdk/app-android/res/layout/action_sheet.xml
@@ -0,0 +1,60 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/uni_modules/uni-media/utssdk/app-android/res/layout/action_sheet_night.xml b/uni_modules/uni-media/utssdk/app-android/res/layout/action_sheet_night.xml
new file mode 100644
index 0000000000000000000000000000000000000000..87c48b77f5d956250b9f0986fd1bfc222a51f045
--- /dev/null
+++ b/uni_modules/uni-media/utssdk/app-android/res/layout/action_sheet_night.xml
@@ -0,0 +1,60 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/uni_modules/uni-media/utssdk/app-android/res/layout/recyclerview_layout.xml b/uni_modules/uni-media/utssdk/app-android/res/layout/recyclerview_layout.xml
new file mode 100644
index 0000000000000000000000000000000000000000..cdbeeed3400ced711663dfd3e8a2967fd2dbc778
--- /dev/null
+++ b/uni_modules/uni-media/utssdk/app-android/res/layout/recyclerview_layout.xml
@@ -0,0 +1,27 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/uni_modules/uni-media/utssdk/app-android/res/layout/recyclerview_layout_night.xml b/uni_modules/uni-media/utssdk/app-android/res/layout/recyclerview_layout_night.xml
new file mode 100644
index 0000000000000000000000000000000000000000..43751b2cca080ac7f0fb206224c299c881791bb8
--- /dev/null
+++ b/uni_modules/uni-media/utssdk/app-android/res/layout/recyclerview_layout_night.xml
@@ -0,0 +1,24 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/uni_modules/uni-media/utssdk/app-android/res/values-zh/strings.xml b/uni_modules/uni-media/utssdk/app-android/res/values-zh/strings.xml
new file mode 100644
index 0000000000000000000000000000000000000000..18aeb020f5ef279466bfd634a100580f32dcd936
--- /dev/null
+++ b/uni_modules/uni-media/utssdk/app-android/res/values-zh/strings.xml
@@ -0,0 +1,4 @@
+
+ Configuration
+ 取消
+
diff --git a/uni_modules/uni-media/utssdk/app-android/res/values/colors.xml b/uni_modules/uni-media/utssdk/app-android/res/values/colors.xml
new file mode 100644
index 0000000000000000000000000000000000000000..a206cb7cdda0ef6b5b967e9e886a96033cfe460b
--- /dev/null
+++ b/uni_modules/uni-media/utssdk/app-android/res/values/colors.xml
@@ -0,0 +1,46 @@
+
+
+
+ #FFFFFF
+ #efefef
+
+ #DEDEDE
+ #FFFFFF
+
+ #1C1C1C
+ #272727
+
+
+
+ #000000
+ #F6F6F6
+
+
+ #696969
+ #D8D8D8
+
+
+ #F6F6F6
+ #1c1c1c
+
+
+ #000000
+ #CFCFCF
+
+ #808080
+ #CFCFCF
+
+ #E0E0E0
+ #303030
+
+ #E3E3E3
+ #303030
+
+ #4A5E86
+ #7388a2
+
+ #a5a5a5
+ #a5a5a5
+
+
+
\ No newline at end of file
diff --git a/uni_modules/uni-media/utssdk/app-android/res/values/strings.xml b/uni_modules/uni-media/utssdk/app-android/res/values/strings.xml
new file mode 100644
index 0000000000000000000000000000000000000000..9d84d4991016f203d38ec63a724ab959ce899c2d
--- /dev/null
+++ b/uni_modules/uni-media/utssdk/app-android/res/values/strings.xml
@@ -0,0 +1,5 @@
+
+
+ Configuration
+ Cancel
+
\ No newline at end of file
diff --git a/uni_modules/uni-media/utssdk/app-android/res/values/styles.xml b/uni_modules/uni-media/utssdk/app-android/res/values/styles.xml
new file mode 100644
index 0000000000000000000000000000000000000000..8fd963b14853d9dacaa9e1b838666f3026e9a9dd
--- /dev/null
+++ b/uni_modules/uni-media/utssdk/app-android/res/values/styles.xml
@@ -0,0 +1,7 @@
+
+
+
+
diff --git a/uni_modules/uni-media/utssdk/app-android/utils/ChooseMediaUtils.uts b/uni_modules/uni-media/utssdk/app-android/utils/ChooseMediaUtils.uts
new file mode 100644
index 0000000000000000000000000000000000000000..723b1e0e474dd2242b5badfb2742e28f3a60d091
--- /dev/null
+++ b/uni_modules/uni-media/utssdk/app-android/utils/ChooseMediaUtils.uts
@@ -0,0 +1,439 @@
+import {
+ ChooseImageOptions, ChooseImageSuccessCallback, ChooseImageCropOptions,
+ ChooseVideoOptions, ChooseVideoSuccessCallback,
+ GetVideoInfoSuccessCallback,
+} from "../../interface.uts"
+import {
+ UniError_ChooseImage, UniError_ChooseVideo,
+ UniErrors
+} from "../../unierror.uts"
+import { getVideoMetadata } from "./MediaUtils.uts"
+import { uniChooseImage, CODE_CAMERA_ERROR, CODE_GALLERY_ERROR, CODE_GET_IMAGE_INFO_CODE, uniChooseVideo } from "../../ChooseImageUtils.uts"
+import { getUniActivity } from "io.dcloud.uts.android";
+import Intent from 'android.content.Intent';
+import UTSAndroid from 'io.dcloud.uts.UTSAndroid';
+import File from 'java.io.File';
+import MediaStore from 'android.provider.MediaStore';
+import IMGEditActivity from "io.dcloud.uts.gallery.imageedit.IMGEditActivity";
+import Media from "io.dcloud.uts.dmcbig.mediapicker.entity.Media";
+import Uri from 'android.net.Uri';
+import Parcelable from 'android.os.Parcelable';
+import FileProvider from 'androidx.core.content.FileProvider';
+import Build from 'android.os.Build';
+import Manifest from 'android.Manifest';
+import Listener from 'io.dcloud.uts.androidtranscoder.MediaTranscoder.Listener';
+import MediaTranscoder from 'io.dcloud.uts.androidtranscoder.MediaTranscoder';
+import MediaFormatStrategyPresets from 'io.dcloud.uts.androidtranscoder.format.MediaFormatStrategyPresets';
+import CompressUtil from 'io.dcloud.uts.util.CompressUtil';
+
+const GALLERY_MEDIA_PICKER_RESULT = 1004;
+
+export function chooseMediaImage(option : ChooseImageOptions) {
+ uniChooseImage(option, function (count : number, compressed : boolean, index : number) {
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
+ let requestPermissionList : Array = [Manifest.permission.CAMERA]
+ if (index == 1) {
+ requestPermissionList = [Manifest.permission.READ_EXTERNAL_STORAGE]
+ if (getUniActivity()!.getApplicationInfo().targetSdkVersion >= 33) {
+ requestPermissionList = ["android.permission.READ_MEDIA_IMAGES"]
+ }
+ }
+ UTSAndroid.requestSystemPermission(UTSAndroid.getUniActivity()!, requestPermissionList, (a : boolean, b : string[]) => {
+ if (index == 0) {
+ openCameraForImage(option, compressed)
+ } else {
+ openAlbumForImage(option, count, 100)
+ }
+ }, (a : boolean, b : string[]) => {
+ // 失败回调
+ let error : UniError = { "errSubject": UniError_ChooseImage, "errCode": 1101005, "errMsg": UniErrors[1101005]! }
+ option.fail?.(error)
+ option.complete?.(error)
+ })
+ } else {
+ if (index == 0) {
+ openCameraForImage(option, compressed)
+ } else if (index == 1) {
+ openAlbumForImage(option, count, 101)
+ }
+ }
+ })
+}
+
+var cropFunction : ((requestCode : Int, resultCode : Int, data ?: Intent) => void) | null = null
+var takeCameraFunction : ((requestCode : Int, resultCode : Int, data ?: Intent) => void) | null = null
+
+function openCameraForImage(option : ChooseImageOptions, compressed : boolean) {
+ const cameraCode = 22;
+ const IMAGE_CAPTURE_EDIT = 5011;
+ if (cropFunction != null) {
+ UTSAndroid.offAppActivityResult(cropFunction!)
+ }
+ if (takeCameraFunction != null) {
+ UTSAndroid.offAppActivityResult(takeCameraFunction!)
+ }
+ let cameraPath = (UTSAndroid.getAppTempPath()! + "camera/" + System.currentTimeMillis() + ".jpg") // .jpg为默认配置
+ try {
+ let picFile = new File(cameraPath);
+ if (!picFile.getParentFile().exists()) {
+ picFile.getParentFile().mkdirs()
+ }
+
+ cropFunction = (requestCode : Int, resultCode : Int, data ?: Intent) => {
+ if (requestCode == IMAGE_CAPTURE_EDIT) {
+ UTSAndroid.offAppActivityResult(cropFunction!)
+ if (resultCode == -1) {
+ let success : ChooseImageSuccessCallback = {
+ "errSubject": "uni-chooseImage",
+ "tempFilePaths": ["file://" + cameraPath],
+ "errMsg": "chooseImage:ok",
+ "tempFiles": [{ "path": "file://" + cameraPath, "size": picFile.length() }]
+ }
+ option.success?.(success)
+ option.complete?.(success)
+ } else {
+ let error : UniError = { "errSubject": UniError_ChooseImage, "errCode": 1101007, "errMsg": UniErrors[1101007]! }
+ option.fail?.(error)
+ option.complete?.(error)
+ }
+ }
+ }
+
+ takeCameraFunction = (requestCode : Int, resultCode : Int, data ?: Intent) => {
+ if (cameraCode == requestCode) {
+ UTSAndroid.offAppActivityResult(takeCameraFunction!)
+ if (resultCode == -1) {
+ if (picFile.exists()) {
+ // 图片裁切, 宽高都存在,且都大于0
+ if (option.crop != null && option.crop!.height != null && option.crop!.width != null && option.crop!.height! > 0 && option.crop!.width > 0) {
+ let media = new Media(cameraPath,
+ "",
+ System.currentTimeMillis(),
+ MediaStore.Files.FileColumns.MEDIA_TYPE_IMAGE,
+ 1,
+ /* IMGEditActivity.CAMERA_SCENE, */ -1001,
+ picFile.getParent());
+ let cropIntent = new Intent(getUniActivity(), IMGEditActivity().javaClass)
+ let mUri = Uri.parse("file://" + media.path);
+ cropIntent.putExtra("IMAGE_URI", mUri);
+ cropIntent.putExtra("IMAGE_MEDIA_ID", media.id);
+ cropIntent.putExtra("IMAGE_INDEX", 0); // 传入当前的index,修改结束后方便替换
+ cropIntent.putExtra("IMAGE_CROP", JSON.stringify(option.crop!!));
+ UTSAndroid.onAppActivityResult(cropFunction!)
+ cropIntent.putExtra(/* IMGEditActivity.EXTRA_IMAGE_SAVE_PATH */"IMAGE_SAVE_PATH", media.path);
+ getUniActivity()!!.startActivityForResult(cropIntent, IMAGE_CAPTURE_EDIT.toInt());
+ getUniActivity()!!.overridePendingTransition(0, 0);
+ } else {
+ if (compressed) {
+ cameraPath = CompressUtil.compressImage(cameraPath, cameraPath, false, getUniActivity()!!)
+ picFile = new File(cameraPath)
+ }
+ let success : ChooseImageSuccessCallback = {
+ "errSubject": "uni-chooseImage",
+ "tempFilePaths": ["file://" + cameraPath],
+ "errMsg": "chooseImage:ok",
+ "tempFiles": [{ "path": "file://" + cameraPath, "size": picFile.length() }]
+ }
+ option.success?.(success)
+ option.complete?.(success)
+ }
+ } else {
+ let error : UniError = { "errSubject": UniError_ChooseImage, "errCode": 1101008, "errMsg": UniErrors[1101008]! }
+ option.fail?.(error)
+ option.complete?.(error)
+ }
+ } else {
+ let error : UniError = { "errSubject": UniError_ChooseImage, "errCode": 1101008, "errMsg": UniErrors[1101008]! }
+ option.fail?.(error)
+ option.complete?.(error)
+ }
+ }
+ }
+ UTSAndroid.onAppActivityResult(takeCameraFunction!)
+ let picUri : Uri = FileProvider.getUriForFile(getUniActivity()!, getUniActivity()!.packageName + ".dc.fileprovider", picFile);
+ let intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
+ intent.putExtra(MediaStore.EXTRA_OUTPUT, picUri);
+ getUniActivity()?.startActivityForResult(intent, cameraCode.toInt())
+ } catch (e : Exception) { }
+}
+
+var albumFunction : ((requestCode : Int, resultCode : Int, data ?: Intent) => void) | null = null
+
+/**
+ *
+ * option
+ * count
+ * type PICKER_IMAGE = 100 PICKER_VIDEO = 102 PICKER_IMAGE_VIDEO = 101
+ */
+function openAlbumForImage(option : ChooseImageOptions, count : number, type : number) {
+ if (albumFunction != null) {
+ UTSAndroid.offAppActivityResult(albumFunction!)
+ }
+ albumFunction = (requestCode : Int, resultCode : Int, data ?: Intent) => {
+ if (requestCode == GALLERY_MEDIA_PICKER_RESULT) {
+ UTSAndroid.offAppActivityResult(albumFunction!)
+ let picPaths : Array = []
+ let picTempPathJson : Array = []
+ if (data != null) {
+ let selectMediaResult : kotlin.collections.ArrayList | null = data!!.getParcelableArrayListExtra("select_result");
+ if (selectMediaResult != null) {
+ selectMediaResult.forEach((current) => {
+ let path = (current as Media).path;
+ picPaths.push("file://" + (current as Media).path);
+ let tempPathJson = {}
+ tempPathJson["path"] = "file://" + path
+ try {
+ tempPathJson["size"] = new File(path).length()
+ } catch (e) { }
+ picTempPathJson.push(tempPathJson)
+ })
+ }
+ }
+ if (picPaths.length > 0) {
+ let success : ChooseImageSuccessCallback = {
+ "errSubject": "uni-chooseImage",
+ "tempFilePaths": picPaths,
+ "errMsg": "chooseImage:ok",
+ "tempFiles": picTempPathJson
+ }
+ option.success?.(success)
+ option.complete?.(success)
+ } else {
+ let error : UniError = { "errSubject": UniError_ChooseImage, "errCode": 1101001, "errMsg": UniErrors[1101001]! }
+ option.fail?.(error)
+ option.complete?.(error)
+ }
+ }
+ }
+ UTSAndroid.onAppActivityResult(albumFunction!)
+ openGalleryActivity(count, type, false, option.sizeType, option.crop);
+}
+
+export function chooseMediaVideo(options : ChooseVideoOptions) {
+ uniChooseVideo(options, (count : number, compressed : boolean, index : number) => {
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
+ let requestPermissionList : Array = [Manifest.permission.CAMERA]
+ if (index == 1) {
+ requestPermissionList = [Manifest.permission.READ_EXTERNAL_STORAGE]
+ if (getUniActivity()!.getApplicationInfo().targetSdkVersion >= 33) {
+ requestPermissionList = ["android.permission.READ_MEDIA_VIDEO"]
+ }
+ }
+ UTSAndroid.requestSystemPermission(UTSAndroid.getUniActivity()!, requestPermissionList, (a : boolean, b : string[]) => {
+ if (index == 0) {
+ openCameraForVideo(options, compressed)
+ } else {
+ openAlbumForVideo(options, count, 102, compressed)
+ }
+ }, (a : boolean, b : string[]) => {
+ // 失败回调
+ if (index == 0) {
+ let error : UniError = { "errSubject": UniError_ChooseVideo, "errCode": 1101005, "errMsg": UniErrors[1101005]! }
+ options.fail?.(error)
+ options.complete?.(error)
+ } else {
+ let error : UniError = { "errSubject": UniError_ChooseVideo, "errCode": 1101005, "errMsg": UniErrors[1101005]! }
+ options.fail?.(error)
+ options.complete?.(error)
+ }
+ })
+ } else {
+ if (index == 0) {
+ openCameraForVideo(options, compressed)
+ } else if (index == 1) {
+ openAlbumForVideo(options, count, 102, compressed)
+ }
+ }
+ })
+}
+
+var takeVideoFunction : ((requestCode : Int, resultCode : Int, data ?: Intent) => void) | null = null
+
+function openCameraForVideo(option : ChooseVideoOptions, compressed : boolean) {
+ const cameraCode = 22;
+
+ if (takeVideoFunction != null) {
+ UTSAndroid.offAppActivityResult(takeVideoFunction!)
+ }
+ let cameraPath = (UTSAndroid.getAppTempPath()! + "camera/" + System.currentTimeMillis() + ".mp4") // .mp4为默认配置
+ try {
+ let picFile = new File(cameraPath);
+ if (!picFile.getParentFile().exists()) {
+ picFile.getParentFile().mkdirs()
+ }
+ takeVideoFunction = (requestCode : Int, resultCode : Int, data ?: Intent) => {
+ if (cameraCode == requestCode) {
+ UTSAndroid.offAppActivityResult(takeVideoFunction!)
+ if (resultCode == -1) {
+ if (picFile.exists()) {
+ if (compressed) {
+ // cameraPath = CompressUtil.compressImage(cameraPath, cameraPath, false, getUniActivity()!!)
+ // picFile = new File(cameraPath)
+ let outPath = (UTSAndroid.getAppTempPath()! + "camera/" + System.currentTimeMillis() + ".mp4")
+ MediaTranscoder.getInstance().transcodeVideo(cameraPath, outPath, MediaFormatStrategyPresets.createAndroid720pStrategy(2, 1.0), new MediaTranscoderListener(option, cameraPath, outPath))
+ } else {
+ var metadata : GetVideoInfoSuccessCallback | null = null
+ let result = getVideoMetadata(cameraPath)
+ if (result instanceof GetVideoInfoSuccessCallback) {
+ metadata = result as GetVideoInfoSuccessCallback
+ }
+ let success : ChooseVideoSuccessCallback = {
+ tempFilePath: "file://" + cameraPath,
+ width: metadata == null ? 0 : metadata!.width,
+ height: metadata == null ? 0 : metadata!.height,
+ size: metadata == null ? 0 : metadata!.size,
+ duration: metadata == null ? 0 : metadata!.duration,
+ }
+ option.success?.(success)
+ option.complete?.(success)
+ }
+ } else {
+ let error : UniError = { "errSubject": UniError_ChooseVideo, "errCode": 1101008, "errMsg": UniErrors[1101008]! }
+ option.fail?.(error)
+ option.complete?.(error)
+ }
+ } else {
+ let error : UniError = { "errSubject": UniError_ChooseVideo, "errCode": 1101008, "errMsg": UniErrors[1101008]! }
+ option.fail?.(error)
+ option.complete?.(error)
+ }
+ }
+ }
+ UTSAndroid.onAppActivityResult(takeVideoFunction!)
+ let picUri : Uri = FileProvider.getUriForFile(getUniActivity()!, getUniActivity()!.packageName + ".dc.fileprovider", picFile);
+ let intent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE);
+ intent.putExtra(MediaStore.EXTRA_OUTPUT, picUri);
+ if (option.maxDuration != null && option.maxDuration! > 0) {
+ intent.putExtra(MediaStore.EXTRA_DURATION_LIMIT, option.maxDuration!);
+ }
+ if (option.camera != null && option.camera! == "front") {
+ intent.putExtra("android.intent.extras.CAMERA_FACING", 1);//前置摄像
+ } else {
+ intent.putExtra("android.intent.extras.CAMERA_FACING", 0);//后置摄像
+ }
+ getUniActivity()?.startActivityForResult(intent, cameraCode.toInt())
+ } catch (e : Exception) { }
+}
+
+class MediaTranscoderListener implements Listener {
+ option : ChooseVideoOptions
+ inPath : string
+ outPath : string
+ constructor(option : ChooseVideoOptions, inPath : string, outPath : string) {
+ this.option = option
+ this.inPath = inPath
+ this.outPath = outPath
+ }
+ override onTranscodeProgress(progress : Double) {
+
+ }
+
+ override onTranscodeCompleted() {
+ this.deleteInPath()
+ var metadata : GetVideoInfoSuccessCallback | null = null
+ let result = getVideoMetadata(this.outPath)
+ if (result instanceof GetVideoInfoSuccessCallback) {
+ metadata = result as GetVideoInfoSuccessCallback
+ }
+ let success : ChooseVideoSuccessCallback = {
+ tempFilePath: "file://" + this.outPath,
+ width: metadata == null ? 0 : metadata!.width,
+ height: metadata == null ? 0 : metadata!.height,
+ size: metadata == null ? 0 : metadata!.size,
+ duration: metadata == null ? 0 : metadata!.duration,
+ }
+ this.option.success?.(success)
+ this.option.complete?.(success)
+ }
+
+ override onTranscodeCanceled() {
+ this.deleteInPath()
+ let error : UniError = { "errSubject": UniError_ChooseVideo, "errCode": 1101004, "errMsg": UniErrors[1101004]! }
+ this.option.fail?.(error)
+ this.option.complete?.(error)
+ }
+
+ override onTranscodeFailed(exception : Exception) {
+ this.deleteInPath()
+ let error : UniError = { "errSubject": UniError_ChooseVideo, "errCode": 1101010, "errMsg": UniErrors[1101010]! + exception.toString() }
+ this.option.fail?.(error)
+ this.option.complete?.(error)
+ }
+
+ deleteInPath() {
+ let file = new File(this.inPath)
+ if (file.exists()) {
+ file.delete()
+ }
+ }
+}
+
+var openAlbumFunction : ((requestCode : Int, resultCode : Int, data ?: Intent) => void) | null = null
+
+function openAlbumForVideo(option : ChooseVideoOptions, count : number, type : number, compressed : boolean) {
+ if (openAlbumFunction != null) {
+ UTSAndroid.offAppActivityResult(openAlbumFunction!)
+ }
+ openAlbumFunction = (requestCode : Int, resultCode : Int, data ?: Intent) => {
+ if (requestCode == GALLERY_MEDIA_PICKER_RESULT) {
+ UTSAndroid.offAppActivityResult(openAlbumFunction!)
+ let picPaths = ""
+ if (data != null) {
+ let selectMediaResult : kotlin.collections.ArrayList | null = data!!.getParcelableArrayListExtra("select_result");
+ if (selectMediaResult != null && selectMediaResult!.size > 0) {
+ picPaths = (selectMediaResult![0] as Media).path
+ }
+ }
+ if (picPaths.isEmpty()) {
+ let error : UniError = { "errSubject": UniError_ChooseVideo, "errCode": 1101001, "errMsg": UniErrors[1101001]! }
+ option.fail?.(error)
+ option.complete?.(error)
+ } else {
+ var metadata : GetVideoInfoSuccessCallback | null = null
+ let result = getVideoMetadata(picPaths)
+ if (result instanceof GetVideoInfoSuccessCallback) {
+ metadata = result as GetVideoInfoSuccessCallback
+ }
+ let success : ChooseVideoSuccessCallback = {
+ tempFilePath: "file://" + picPaths,
+ width: metadata == null ? 0 : metadata!.width,
+ height: metadata == null ? 0 : metadata!.height,
+ size: metadata == null ? 0 : metadata!.size,
+ duration: metadata == null ? 0 : metadata!.duration,
+ }
+ option.success?.(success)
+ option.complete?.(success)
+ }
+ }
+ }
+ UTSAndroid.onAppActivityResult(openAlbumFunction!)
+ openGalleryActivity(count, type, compressed, null, null);
+}
+
+function openGalleryActivity(count : number, type : number, compressed : boolean, sizeType : (string[]) | null, crop : ChooseImageCropOptions | null) {
+ let selected : Array = [];// 已选中的图片
+ let maximum = -1;
+ let editable = true; // 是否可编辑,对应editable
+ let doneBtnText = "" // 完成按钮文字可编辑
+ // let compressed = false; // 视频压缩,对应“videoCompress”
+
+ let albumIntent = new Intent()
+ albumIntent.setClassName(getUniActivity()!!, "io.dcloud.uts.dmcbig.mediapicker.PickerActivity");
+ albumIntent.putExtra(/* SELECT_MODE = */"select_mode",/* PICKER_IMAGE_VIDEO = */type)
+ albumIntent.putExtra(/* SINGLE_SELECT = */"single_select", false)
+ albumIntent.putExtra(/* COMPRESSED = */"COMPRESSED", compressed)
+ albumIntent.putExtra(/* MAX_SELECT_COUNT = */"max_select_count", count)
+ // albumIntent.putExtra(/* DEFAULT_SELECTED_LIST = */"default_list",null); // 暂未对非uni的属性进行支持
+ // albumIntent.putExtra(/* SELECTED_MAX_CALLBACK_ID = */"select_max_cb_id","") // 暂未对非uni的属性进行支持
+ // albumIntent.putExtra(/* DONE_BUTTON_TEXT = */"done_button_text","") // 暂未对非uni的属性进行支持
+ if (sizeType != null) {
+ albumIntent.putExtra(/* PickerConfig.SIZE_TYPE */"size_type", JSON.stringify(sizeType!))
+ }
+ albumIntent.putExtra(/* DOC_PATH = */"doc_path", UTSAndroid.getAppTempPath()! + "gallery/")
+ albumIntent.putExtra(/* IMAGE_EDITABLE = */"image_editable", true);
+ if (crop != null && crop!.height != null && crop!.width != null && crop!.height! > 0 && crop!.width > 0) {
+ albumIntent.putExtra(/* IMAGE_CROP = */"image_crop", JSON.stringify(crop))
+ albumIntent.putExtra(/* MAX_SELECT_COUNT = */"max_select_count", 1) // 编辑模式下只能选中一个
+ }
+ getUniActivity()!!.startActivityForResult(albumIntent, GALLERY_MEDIA_PICKER_RESULT.toInt())
+}
\ No newline at end of file
diff --git a/uni_modules/uni-media/utssdk/app-android/utils/CompressUtils.uts b/uni_modules/uni-media/utssdk/app-android/utils/CompressUtils.uts
new file mode 100644
index 0000000000000000000000000000000000000000..496eeba8cd0845073e9d19a46b57ee1df3f5e86d
--- /dev/null
+++ b/uni_modules/uni-media/utssdk/app-android/utils/CompressUtils.uts
@@ -0,0 +1,299 @@
+import {
+ CompressImageSuccessCallback, CompressImageOptions,
+ CompressVideoOptions, CompressVideoSuccessCallback
+} from "../../interface.uts"
+import {
+ UniError_ChooseImage, UniError_ChooseVideo, UniError_CompressVideo,UniError_CompressImage,
+ UniErrors
+} from "../../unierror.uts"
+import { uniChooseImage, CODE_CAMERA_ERROR, CODE_GALLERY_ERROR, CODE_GET_IMAGE_INFO_CODE } from "../../ChooseImageUtils.uts"
+import TextUtils from 'android.text.TextUtils';
+import UTSAndroid from 'io.dcloud.uts.UTSAndroid';
+import File from 'java.io.File';
+import BitmapFactory from 'android.graphics.BitmapFactory';
+import Bitmap from 'android.graphics.Bitmap';
+import Matrix from 'android.graphics.Matrix';
+import FileOutputStream from 'java.io.FileOutputStream';
+import ExifInterface from 'io.dcloud.uts.util.ExifInterface';
+import Field from 'java.lang.reflect.Field';
+import MediaTranscoder from 'io.dcloud.uts.androidtranscoder.MediaTranscoder';
+import MediaFormatStrategyPresets from 'io.dcloud.uts.androidtranscoder.format.MediaFormatStrategyPresets';
+import Listener from 'io.dcloud.uts.androidtranscoder.MediaTranscoder.Listener';
+
+// export function threadCompress() {
+// }
+export function transcodeImage(options : CompressImageOptions) {
+ if (options.src.length == 0) {
+ let fail : UniError = { "errCode": 1101003, "errMsg": UniErrors[1101003]!, "errSubject": UniError_CompressImage }
+ options.fail?.(fail)
+ options.complete?.(fail)
+ return
+ }
+ let compressOption = new CompressOptions()
+ compressOption.src = UTSAndroid.convert2AbsFullPath(options.src)
+ let srcFile = new File(compressOption.src)
+ if (!srcFile.exists()) {
+ let fail : UniError = { "errCode": 1101003, "errMsg": UniErrors[1101003]!, "errSubject": UniError_CompressImage }
+ options.fail?.(fail)
+ options.complete?.(fail)
+ return
+ }
+ if (options.quality != null && options.quality! > 0) {
+ compressOption.quality = options.quality!
+ }
+ if (options.rotate != null && options.rotate! >= 0) {
+ compressOption.rotate = options.rotate!
+ }
+ var widthStr = ""
+ var heightStr = ""
+ if (options.compressedWidth != null) {
+ compressOption.width = options.compressedWidth!
+ } else {
+ widthStr = TextUtils.isEmpty(options.width) ? "auto" : options.width!
+ }
+ if (options.compressedHeight != null) {
+ compressOption.height = options.compressedHeight!
+ } else {
+ heightStr = TextUtils.isEmpty(options.height) ? "auto" : options.height!
+ }
+ if (compressOption.width <= 0 || compressOption.height <= 0) {
+ getHeightAndWidth(compressOption, widthStr, heightStr)
+ }
+ let bitmapOptions = new BitmapFactory.Options()
+ bitmapOptions.inJustDecodeBounds = false;
+ if (srcFile.length() > 1500000) {
+ bitmapOptions.inSampleSize = 2
+ } else {
+ bitmapOptions.inSampleSize = 1
+ }
+ var srcBitmap : Bitmap | null = null
+ try {
+ srcBitmap = BitmapFactory.decodeFile(compressOption.src, bitmapOptions)
+ } catch (e) {
+ }
+ if (srcBitmap == null) {
+ let fail : UniError = { "errCode": 1101009, "errMsg": UniErrors[1101009]!, "errSubject": UniError_CompressImage }
+ options.fail?.(fail)
+ options.complete?.(fail)
+ return
+ }
+
+ if (compressOption.isZoom && compressOption.width > 0 && compressOption.height > 0) {
+ let matrix = new Matrix()
+ let scaleW = compressOption.width / srcBitmap.getWidth()
+ let scaleH = compressOption.height / srcBitmap.getHeight()
+ matrix.setScale(scaleW.toFloat(), scaleH.toFloat())
+ srcBitmap = Bitmap.createBitmap(srcBitmap!, 0, 0, srcBitmap.getWidth(), srcBitmap.getHeight(), matrix, false)
+ }
+ if (compressOption.rotate > 0) {
+ let matrix = new Matrix()
+ matrix.postRotate(compressOption.rotate.toFloat())
+ srcBitmap = Bitmap.createBitmap(srcBitmap!, 0, 0, srcBitmap.getWidth(), srcBitmap.getHeight(), matrix, false)
+ }
+ // 保存
+ let destPath = UTSAndroid.getAppTempPath()! + "compress/" + System.currentTimeMillis() + ".jpg"
+ let destFile = new File(destPath)
+ if (!destFile.getParentFile().exists()) {
+ destFile.getParentFile().mkdirs()
+ }
+ try {
+ let fos = new FileOutputStream(destFile)
+ srcBitmap!.compress(Bitmap.CompressFormat.JPEG, compressOption.quality.toInt(), fos);
+ fos.close()
+ if (!srcBitmap!.isRecycled()) {
+ srcBitmap!.recycle()
+ }
+ saveExif(options.src, destPath)
+ let success : CompressImageSuccessCallback = { "tempFilePath": "file://" + destPath }
+ options.success?.(success)
+ options.complete?.(success)
+ } catch (ex) {
+ let fail : UniError = { "errCode": 1101009, "errMsg": UniErrors[1101009]!, "errSubject": UniError_CompressImage }
+ options.fail?.(fail)
+ options.complete?.(fail)
+ }
+}
+
+function saveExif(oldFilePath : string, newFilePath : string) {
+ try {
+ let oldExif = new ExifInterface(oldFilePath);
+ let newExif = new ExifInterface(newFilePath);
+ let cls = oldExif.javaClass;
+ let fields = cls.getFields();
+ fields.forEach((field : Field) => {
+ let fieldName = field.getName();
+ if (!TextUtils.isEmpty(fieldName) && fieldName.startsWith("TAG")) {
+ var o = field.get(cls);
+ if (o != null) {
+ var fieldValue = o.toString();
+ var attribute = oldExif.getAttribute(fieldValue);
+ if (attribute != null) {
+ newExif.setAttribute(fieldValue, attribute);
+ }
+ }
+ }
+ })
+ // for (Field field : fields) {
+
+ // }
+ newExif.saveAttributes();
+ } catch (e) {
+
+ }
+}
+
+function getHeightAndWidth(compressOption : CompressOptions, widthStr : string, heightStr : string) {
+ let bopt = new BitmapFactory.Options()
+ bopt.inJustDecodeBounds = true
+ BitmapFactory.decodeFile(compressOption.src, bopt)
+ let bitmapWidth = bopt.outWidth
+ let bitmapHeight = bopt.outHeight
+ if (bitmapHeight <= 0 || bitmapWidth <= 0) {
+ return
+ }
+ if (widthStr.toLowerCase() == "auto" && heightStr.toLowerCase() == "auto") {
+ compressOption.isZoom = false
+ compressOption.width = bitmapWidth
+ compressOption.height = bitmapHeight
+ } else if (widthStr.toLowerCase() == "auto") {
+ compressOption.isZoom = true
+ compressOption.height = str2Float(heightStr, bitmapHeight, bitmapHeight)
+ compressOption.width = bitmapWidth * compressOption.height / bitmapHeight
+ } else if (heightStr.toLowerCase() == "auto") {
+ compressOption.isZoom = true
+ compressOption.width = str2Float(widthStr, bitmapWidth, bitmapWidth)
+ compressOption.height = bitmapHeight * compressOption.width / bitmapWidth
+ } else {
+ compressOption.isZoom = true
+ compressOption.width = str2Float(widthStr, bitmapWidth, bitmapWidth)
+ compressOption.height = str2Float(heightStr, bitmapHeight, bitmapHeight)
+ }
+}
+
+function str2Float(valuestr : string, realValue : number, defValue : number) : number {
+ if (TextUtils.isEmpty(valuestr)) {
+ return defValue
+ }
+ valuestr = valuestr.toLowerCase()
+ if (valuestr.endsWith("px")) {
+ valuestr == valuestr.substring(0, valuestr.length - 2);
+ }
+ try {
+ return Integer.parseInt(valuestr)
+ } catch (e) {
+ if (valuestr.endsWith("%")) {
+ valuestr = valuestr.substring(0, valuestr.length - 1)
+ }
+ try {
+ return realValue * Integer.parseInt(valuestr) / 100
+ } catch (e) {
+ return defValue
+ }
+ }
+}
+
+class CompressOptions {
+ src : string = ""
+ dst : string = ""
+ format : string = ""
+ quality : number = 80
+ width : number = 0
+ height : number = 0
+ rotate : number = 0
+ isZoom : boolean = false
+}
+
+export function transcodeVideo(options : CompressVideoOptions) {
+ let inPath = UTSAndroid.convert2AbsFullPath(options.src)
+ let inFile = new File(inPath)
+ if (!inFile.exists()) {
+ let fail : UniError = { "errCode": 1101003, "errMsg": UniErrors[1101003]!, "errSubject": UniError_CompressVideo }
+ options.fail?.(fail)
+ options.complete?.(fail)
+ return
+ }
+ var compressLevel = 1
+ switch (options.quality) {
+ case "low":
+ compressLevel = 3
+ break
+ case "medium":
+ compressLevel = 2
+ break
+ default:
+ compressLevel = 1
+ break
+ }
+
+ var resolution = options.resolution?.toDouble();
+
+ if (resolution == null) {
+ resolution = 1.0
+ } else if (resolution! > 1 || resolution! <= 0) {
+ resolution = 1.0
+ }
+ let fileName = getFileName(inPath);
+ let outPath = UTSAndroid.getAppTempPath()! + "compress/" + (fileName == "" ? (System.currentTimeMillis() + ".mp4") : fileName)
+ let outFile = new File(outPath)
+ if (!outFile.getParentFile().exists()) {
+ outFile.getParentFile().mkdirs()
+ }
+
+ MediaTranscoder.getInstance().transcodeVideo(inPath, outPath, MediaFormatStrategyPresets.createAndroid720pStrategy(compressLevel, resolution!), new MediaTranscoderListener(inPath, outPath, options))
+}
+
+function getFileName(path : string) : string {
+ const array = path.split("/")
+ if (array.length > 0) {
+ return array[array.length - 1]
+ }
+ return ""
+}
+
+class MediaTranscoderListener implements Listener {
+ inPath : string
+ outPath : string
+ options : CompressVideoOptions
+ constructor(inPath : string, outPath : string, options : CompressVideoOptions) {
+ this.inPath = inPath
+ this.outPath = outPath;
+ this.options = options
+ }
+ override onTranscodeProgress(progress : Double) {
+
+ }
+
+ override onTranscodeCompleted() {
+ let outFile = new File(this.outPath)
+ if (outFile.exists()) {
+ let success : CompressVideoSuccessCallback = {
+ tempFilePath: "file://" + this.outPath,
+ size: outFile.length()
+ }
+ this.options.success?.(success)
+ this.options.complete?.(success)
+ } else {
+ let error : UniError = {
+ "errSubject": UniError_CompressVideo, "errCode": 1101004, "errMsg": UniErrors[1101004]!
+ }
+ this.options.fail?.(error)
+ this.options.complete?.(error)
+ }
+ }
+
+ override onTranscodeCanceled() {
+ let error : UniError = {
+ "errSubject": UniError_CompressVideo, "errCode": 1101004, "errMsg": UniErrors[1101004]!
+ }
+ this.options.fail?.(error)
+ this.options.complete?.(error)
+ }
+
+ override onTranscodeFailed(exception : Exception) {
+ let error : UniError = {
+ "errSubject": UniError_CompressVideo, "errCode": 1101010, "errMsg": UniErrors[1101010]! + exception.toString()
+ }
+ this.options.fail?.(error)
+ this.options.complete?.(error)
+ }
+}
\ No newline at end of file
diff --git a/uni_modules/uni-media/utssdk/app-android/utils/MediaUtils.uts b/uni_modules/uni-media/utssdk/app-android/utils/MediaUtils.uts
new file mode 100644
index 0000000000000000000000000000000000000000..4822b2d5685e602efe3569105a1c49735fcd8e60
--- /dev/null
+++ b/uni_modules/uni-media/utssdk/app-android/utils/MediaUtils.uts
@@ -0,0 +1,104 @@
+import {
+ ChooseImageOptions, ChooseImageSuccessCallback,
+ ChooseVideoOptions, ChooseVideoSuccessCallback,
+ GetVideoInfoOptions, GetVideoInfoSuccessCallback,
+} from "../../interface.uts"
+import {
+ UniError_GetVideoInfo,
+ UniErrors
+} from "../../unierror.uts"
+import { uniChooseImage, CODE_CAMERA_ERROR, CODE_GALLERY_ERROR, CODE_GET_IMAGE_INFO_CODE, uniChooseVideo } from "../../ChooseImageUtils.uts"
+import UTSAndroid from 'io.dcloud.uts.UTSAndroid';
+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';
+
+export function getVideoMetadata(src : string) : any {
+ let videoInfo : GetVideoInfoSuccessCallback = {
+ duration: 0,
+ size: 0,
+ height: 0,
+ width: 0
+ }
+ let path = UTSAndroid.convert2AbsFullPath(src)
+ let videoFile = new File(path)
+ if (!videoFile.exists()) {
+ let error : UniError = { "errSubject": UniError_GetVideoInfo, "errCode": 1101003, "errMsg": UniErrors[1101003]! }
+ return error
+ }
+ videoInfo.size = videoFile.length()
+ try {
+ let retriever = new MediaMetadataRetriever()
+ retriever.setDataSource(path)
+ let durationStr : string | null = retriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_DURATION)
+ let width : number | null = retriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_VIDEO_WIDTH)?.toFloat()
+ let height : number | null = retriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_VIDEO_HEIGHT)?.toFloat()
+ let rotation : string | null = retriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_VIDEO_ROTATION)
+ if ("90" == rotation || "270" == rotation) {
+ videoInfo.width = height != null ? height! : 0
+ videoInfo.height = width != null ? width : 0
+ } else {
+ videoInfo.width = width != null ? width : 0
+ videoInfo.height = height != null ? height : 0
+ }
+ switch (rotation) {
+ case "90":
+ rotation = "right";
+ break;
+ case "270":
+ rotation = "left";
+ break;
+ case "180":
+ rotation = "down";
+ break;
+ default:
+ rotation = "up";
+ break;
+ }
+ var duration : number = 0
+ if (durationStr != null) {
+ try {
+ duration = durationStr.toFloat()
+ } catch (e) {
+ }
+ }
+ let big : BigDecimal = BigDecimal.valueOf(duration.toDouble() / 1000).setScale(2, BigDecimal.ROUND_HALF_UP)
+ videoInfo.duration = big.toFloat()
+ videoInfo.orientation = rotation!
+ let mimeType : string | null = retriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_MIMETYPE);
+ videoInfo.type = mimeType
+ let bitrateStr = retriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_BITRATE);
+ var bitrate : number | null = null
+ try {
+ if (bitrateStr != null) {
+ bitrate = (bitrateStr.toFloat() / 1000).toInt()
+ }
+ } catch (e) { }
+ videoInfo.bitrate = bitrate
+ var fpsNum : number | null = null
+ let fps : string | null = retriever.extractMetadata(32);
+ if (TextUtils.isEmpty(fps)) {
+ let extractor = new MediaExtractor()
+ extractor.setDataSource(path)
+ let trackCount = extractor.getTrackCount();
+ for (var i = 0; i < trackCount; i++) {
+ let mediaFormat = extractor.getTrackFormat(i.toInt());
+ let mimeType = mediaFormat.getString(MediaFormat.KEY_MIME);
+ if (!TextUtils.isEmpty(mimeType) && mimeType!!.startsWith("video/")) {
+ let frame = mediaFormat.getInteger(MediaFormat.KEY_FRAME_RATE);
+ fpsNum = frame
+ }
+ }
+ } else {
+ try { fpsNum = Math.ceil(((fps!!).toFloat() / (duration)) * 1000) } catch (e) { } // 沿用1.0设计,向上取整
+ }
+ videoInfo.fps = fpsNum
+ return videoInfo
+ } catch (e) {
+ let error : UniError = { "errSubject": UniError_GetVideoInfo, "errCode": 1101010, "errMsg": UniErrors[1101010]! + e.toString() }
+ return error
+ }
+}
\ No newline at end of file
diff --git a/uni_modules/uni-media/utssdk/app-android/utils/showActionSheet.uts b/uni_modules/uni-media/utssdk/app-android/utils/showActionSheet.uts
new file mode 100644
index 0000000000000000000000000000000000000000..00cc519907412a46e43eb26301b5c8913eee1134
--- /dev/null
+++ b/uni_modules/uni-media/utssdk/app-android/utils/showActionSheet.uts
@@ -0,0 +1,311 @@
+import AlertDialog from 'android.app.AlertDialog';
+import Activity from 'android.app.Activity';
+import Gravity from 'android.view.Gravity';
+import { UTSAndroid } from "io.dcloud.uts";
+
+import ViewGroup from 'android.view.ViewGroup';
+import View from 'android.view.View';
+import Color from 'android.graphics.Color';
+import ColorDrawable from 'android.graphics.drawable.ColorDrawable';
+
+import R from 'io.dcloud.uts.image.R';
+import TextView from 'android.widget.TextView';
+import LayoutInflater from 'android.view.LayoutInflater';
+
+import AppCompatTextView from 'androidx.appcompat.widget.AppCompatTextView';
+import LinearLayoutCompat from 'androidx.appcompat.widget.LinearLayoutCompat';
+
+import LinearLayoutManager from 'androidx.recyclerview.widget.LinearLayoutManager';
+import RecyclerView from 'androidx.recyclerview.widget.RecyclerView';
+
+
+
+// import { ShowActionSheetOptions, ShowActionSheetSuccess,ShowActionSheetFail} from '../interface.uts'
+
+
+export type ShowActionSheetOptions = {
+ /**
+ * 菜单标题
+ */
+ title : string | null,
+ /**
+ * 警示文案(同菜单标题, app无效)
+ */
+ alertText : string | null,
+ /**
+ * 按钮的文字数组
+ */
+ itemList : string[],
+ /**
+ * 按钮的文字颜色,字符串格式(iOS默认为系统控件颜色)
+ */
+ itemColor : string | null,
+ /**
+ * 接口调用成功的回调函数
+ */
+ success : ((result : ShowActionSheetSuccess) => void) | null,
+ /**
+ * 接口调用失败的回调函数
+ */
+ fail : ((result : ShowActionSheetFail) => void) | null,
+ /**
+ * 接口调用结束的回调函数(调用成功、失败都会执行)
+ */
+ complete : ((result : any) => void) | null
+}
+
+export type ShowActionSheetSuccess = {
+ tapIndex : number
+}
+export type ShowActionSheetFail = {
+ errCode : number,
+ errMsg : string,
+ errSubject : string
+}
+
+let uniActionSheet : UniActionSheet | null = null
+
+/**
+ * 弹出功能入口
+ */
+export function actionSheetImpl(activity : Activity, style : ShowActionSheetOptions) {
+ if (uniActionSheet != null) {
+ uniActionSheet?.dismiss()
+ }
+ uniActionSheet = new UniActionSheet(activity, style)
+ uniActionSheet?.show()
+}
+
+export function closeActionSheet() {
+ if (uniActionSheet != null) {
+ uniActionSheet!.dismiss()
+ }
+}
+
+
+/**
+ * UniActionSheet
+ * 功能实现
+ */
+export class UniActionSheet {
+
+ /**
+ * 宿主activity
+ */
+ hostActivity : Activity
+ /**
+ * 宿主样式
+ */
+ hostStyle : ShowActionSheetOptions
+ /**
+ * 标题组件
+ */
+ title : AppCompatTextView
+ /**
+ * 取消按钮
+ */
+ cancel : AppCompatTextView
+ /**
+ * 列表 recycler
+ */
+ myRecyclerView : RecyclerView
+ /**
+ * 列表 recycler Adapter
+ */
+ recyclerviewAdapter : ItemAdapter
+ /**
+ * title 组件
+ */
+ lineTitle : LinearLayoutCompat
+ /**
+ * 内容组件
+ */
+ lineContent : LinearLayoutCompat
+ /**
+ * 取消组件
+ */
+ lineCancel : LinearLayoutCompat
+ /**
+ * 构建后的dialog
+ */
+ alertDialog : AlertDialog
+
+ constructor(activity : Activity, style : ShowActionSheetOptions) {
+ this.hostActivity = activity
+ this.hostStyle = style
+
+ let adb = AlertDialog.Builder(this.hostActivity);
+
+ let v : View
+ if (UTSAndroid.getAppDarkMode()) {
+ v = LayoutInflater.from(this.hostActivity).inflate(R.layout.action_sheet_night, null)
+ } else {
+ v = LayoutInflater.from(this.hostActivity).inflate(R.layout.action_sheet, null)
+ }
+
+
+ this.title = v.findViewById(R.id.tvTitle)
+ this.cancel = v.findViewById(R.id.tvCancelAction)
+ this.lineTitle = v.findViewById(R.id.line_title)
+ this.lineContent = v.findViewById(R.id.line_content)
+ this.lineCancel = v.findViewById(R.id.line_cancel)
+ this.myRecyclerView = v.findViewById(R.id.myRecyclerview)
+ this.myRecyclerView.layoutManager = LinearLayoutManager(this.hostActivity)
+
+
+ if (style.title != null) {
+ this.lineTitle.setVisibility(View.VISIBLE)
+ this.title.setText(style.title)
+ }
+
+ // 构造最终的展示组件
+ adb.setView(v)
+ this.alertDialog = adb.create()
+ this.cancel.setOnClickListener(new CancelClickListener(this.alertDialog, this.hostStyle));
+
+ this.recyclerviewAdapter = new ItemAdapter(this.alertDialog, style)
+ this.myRecyclerView.adapter = this.recyclerviewAdapter
+ this.recyclerviewAdapter.notifyDataSetChanged()
+ }
+
+ /**
+ * 弹出actionsheet
+ */
+ show() {
+ this.alertDialog.window!.attributes.windowAnimations = R.style.DialogAnimations_SmileWindow
+ this.alertDialog.setCancelable(true)
+ this.alertDialog.window!.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.BOTTOM)
+ this.alertDialog.window!.setBackgroundDrawable(ColorDrawable(Color.TRANSPARENT))
+ this.alertDialog.show()
+ }
+
+
+ dismiss() {
+ this.alertDialog.dismiss()
+ }
+
+}
+
+/**
+ * 列表选项点击事件监听
+ */
+class ItemClickListener extends View.OnClickListener {
+
+ host : AlertDialog
+ hostStyle : ShowActionSheetOptions
+ hostIndex : number
+
+ constructor(dialog : AlertDialog, style : ShowActionSheetOptions, index : number) {
+ super()
+ this.host = dialog
+ this.hostStyle = style
+ this.hostIndex = index
+ }
+
+ override onClick(v ?: View) : void {
+
+ var res : ShowActionSheetSuccess = {
+ tapIndex: this.hostIndex
+ }
+
+ this.hostStyle.success?.(res)
+ this.hostStyle.complete?.(res)
+
+ this.host.dismiss()
+
+ }
+}
+
+/**
+ * 取消按钮点击事件
+ */
+class CancelClickListener extends View.OnClickListener {
+
+ host : AlertDialog
+ hostStyle : ShowActionSheetOptions
+
+ constructor(dialog : AlertDialog, style : ShowActionSheetOptions) {
+ super()
+ this.host = dialog
+ this.hostStyle = style
+ }
+
+ override onClick(v ?: View) : void {
+
+ const res : ShowActionSheetFail = {
+ errCode: 0,
+ errSubject: 'uni-prompt',
+ errMsg: 'showActionSheet:fail cancel'
+ }
+ this.hostStyle.fail?.(res)
+ this.hostStyle.complete?.(res)
+
+ this.host.dismiss()
+
+ }
+}
+
+
+/**
+ * 列表数据适配器
+ */
+class ItemAdapter extends RecyclerView.Adapter{
+
+
+ mItemList : Array
+ hostStyle : ShowActionSheetOptions
+ hostDialog : AlertDialog
+
+ constructor(dialog : AlertDialog, style : ShowActionSheetOptions) {
+ super()
+ this.hostDialog = dialog
+ this.mItemList = style.itemList
+ this.hostStyle = style
+ }
+
+ /**
+ * view 持有容器
+ */
+ ViewHolder = class extends RecyclerView.ViewHolder {
+
+ itemName : TextView;
+ constructor(view : View) {
+ super(view);
+ itemName = view.findViewById(R.id.tvName) as TextView;
+ }
+ }
+
+ override onCreateViewHolder(
+ parent : ViewGroup,
+ viewType : Int
+ ) : ViewHolder {
+
+ let view : View
+ if (UTSAndroid.getAppDarkMode()) {
+ view =
+ LayoutInflater.from(parent.context).inflate(R.layout.recyclerview_layout_night, parent, false)
+ } else {
+ view =
+ LayoutInflater.from(parent.context).inflate(R.layout.recyclerview_layout, parent, false)
+ }
+
+ return ViewHolder(view)
+ }
+
+ override onBindViewHolder(holder : ViewHolder, position : Int) {
+ let perContent : String = mItemList[position]
+ holder.itemName.setText(perContent)
+ if (this.hostStyle.itemColor != null) {
+ try {
+ holder.itemName.setTextColor(Color.parseColor(this.hostStyle.itemColor))
+ } catch (e) {
+ }
+ }
+ holder.itemName.setOnClickListener(new ItemClickListener(this.hostDialog, this.hostStyle, position));
+ }
+
+ override getItemCount() : Int {
+ return mItemList.size
+ }
+
+}
\ No newline at end of file
diff --git a/uni_modules/uni-media/utssdk/app-ios/index.uts b/uni_modules/uni-media/utssdk/app-ios/index.uts
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/uni_modules/uni-media/utssdk/interface.uts b/uni_modules/uni-media/utssdk/interface.uts
new file mode 100644
index 0000000000000000000000000000000000000000..80a348f790d845abed1935c72255a766c797cdbb
--- /dev/null
+++ b/uni_modules/uni-media/utssdk/interface.uts
@@ -0,0 +1,794 @@
+
+
+export type ChooseImageSuccessCallback = {
+ /**
+ * 调用API的名称
+ */
+ errSubject : string,
+ errMsg : string,
+ tempFilePaths : Array,
+ tempFiles : any
+}
+
+export type ChooseImageCropOptions = {
+ /**
+ * 裁剪的宽度,单位为px,用于计算裁剪宽高比。
+ */
+ width : number;
+ /**
+ * 裁剪的高度,单位为px,用于计算裁剪宽高比。
+ */
+ height : number;
+ /**
+ * 取值范围为1-100,数值越小,质量越低(仅对jpg格式有效)。默认值为80。
+ * @defaultValue 80
+ */
+ quality : (number) | null;
+ /**
+ * 是否将width和height作为裁剪保存图片真实的像素值。默认值为true。注:设置为false时在裁剪编辑界面显示图片的像素值,设置为true时不显示。
+ * @type boolean
+ */
+ resize : (boolean) | null;
+}
+
+export type ChooseImageOptions = {
+ /**
+ * 最多可以选择的图片张数,app端不限制,微信小程序最多可支持20个。
+ * @defaultValue 9
+ */
+ count ?: (number) | null,
+ /**
+ * original 原图,compressed 压缩图,默认二者都有
+ * @type string | string []
+ * @defaultValue ['original','compressed']
+ */
+ sizeType ?: (string[]) | null,
+ /**
+ * album 从相册选图,camera 使用相机,默认二者都有
+ * @defaultValue ['album','camera']
+ */
+ sourceType ?: (string[]) | null,
+ /**
+ * 根据文件拓展名过滤,每一项都不能是空字符串。默认不过滤。仅H5支持
+ */
+ extension ?: (string[]) | null,
+ /**
+ * 图像裁剪参数,设置后 sizeType 失效。
+ */
+ crop ?: (ChooseImageCropOptions) | null,
+ /**
+ * 成功则返回图片的本地文件路径列表 tempFilePaths
+ */
+ success ?: ((callback : ChooseImageSuccessCallback) => void) | null,
+ /**
+ * 接口调用失败的回调函数
+ */
+ fail ?: ((callback : UniError) => void) | null,
+ /**
+ * 接口调用结束的回调函数(调用成功、失败都会执行)
+ */
+ complete ?: ((callback : any) => void) | null
+}
+
+export type ChooseImage = (options : ChooseImageOptions) => void
+
+export type PreviewImageSuccessCallback = {
+ errSubject : string,
+ errMsg : string
+}
+
+export type LongPressActionsSuccessData = {
+ /**
+ * 接口调用失败的回调函数
+ */
+ tapIndex : number,
+ /**
+ * 接口调用结束的回调函数(调用成功、失败都会执行)
+ */
+ index : number
+};
+export type LongPressActionsOptions = {
+ /**
+ * 按钮的文字数组
+ */
+ itemList : string[],
+ /**
+ * 按钮的文字颜色,字符串格式,默认为"#000000"
+ */
+ itemColor : string | null,
+ /**
+ * 接口调用成功的回调函数
+ */
+ success : ((result : LongPressActionsSuccessData) => void) | null,
+ /**
+ * 接口调用失败的回调函数
+ */
+ fail : ((result : any) => void) | null,
+ /**
+ * 接口调用结束的回调函数(调用成功、失败都会执行)
+ */
+ complete : ((result : any) => void) | null
+};
+
+export type PreviewImageOptions = {
+ /**
+ * 当前显示图片的链接,不填则默认为 urls 的第一张
+ */
+ count ?: string | null,
+ /**
+ * current 为当前显示图片的链接/索引值,不填或填写的值无效则为 urls 的第一张。App平台在 1.9.5至1.9.8之间,current为必填。不填会报错
+ * @type string | number
+ */
+ current ?: any | null,
+ /**
+ * 需要预览的图片链接列表
+ */
+ urls : string[],
+ /**
+ * 图片指示器样式
+ * - default: 底部圆点指示器
+ * - number: 顶部数字指示器
+ * - none: 不显示指示器
+ * @type 'default' | 'number' | 'none'
+ */
+ indicator ?: string | null,
+ /**
+ * 是否可循环预览
+ * @type boolean
+ */
+ loop ?: boolean | null,
+ /**
+ * 长按图片显示操作菜单,如不填默认为保存相册,1.9.5 起支持。
+ */
+ longPressActions ?: LongPressActionsOptions | null,
+ /**
+ * 接口调用成功的回调函数
+ */
+ success ?: ((result : PreviewImageSuccessCallback) => void) | null,
+ /**
+ * 接口调用失败的回调函数
+ */
+ fail ?: ((result : UniError) => void) | null,
+ /**
+ * 接口调用结束的回调函数(调用成功、失败都会执行)
+ */
+ complete ?: ((result : any) => void) | null
+};
+
+export type PreviewImage = (options : PreviewImageOptions) => void;
+
+export type ClosePreviewImage = (options : ClosePreviewImageOptions) => void;
+export type ClosePreviewImageSuccessCallback = {
+ /**
+ * 错误信息
+ */
+ errMsg : string
+};
+
+export type ClosePreviewImageOptions = {
+ /**
+ * 接口调用成功的回调函数
+ */
+ success ?: ((result : ClosePreviewImageSuccessCallback) => void) | null,
+ /**
+ * 接口调用失败的回调函数
+ */
+ fail ?: ((result : UniError) => void) | null,
+ /**
+ * 接口调用结束的回调函数(调用成功、失败都会执行)
+ */
+ complete ?: ((result : any) => void) | null
+};
+
+export type GetImageInfo = (options : GetImageInfoOptions) => void;
+export type GetImageInfoSuccessCallback = {
+ /**
+ * 图片宽度,单位px
+ */
+ width : number,
+ /**
+ * 图片高度,单位px
+ */
+ height : number,
+ /**
+ * 返回图片的本地路径
+ */
+ path : string,
+ /**
+ * 返回图片的方向
+ */
+ orientation : string | null,
+ /**
+ * 返回图片的格式
+ */
+ type : string | null
+};
+
+export type GetImageInfoOptions = {
+ /**
+ * 图片的路径,可以是相对路径,临时文件路径,存储文件路径,网络图片路径
+ */
+ src : string,
+ /**
+ * 接口调用成功的回调函数
+ */
+ success ?: ((result : GetImageInfoSuccessCallback) => void) | null,
+ /**
+ * 接口调用失败的回调函数
+ */
+ fail ?: ((result : UniError) => void) | null,
+ /**
+ * 接口调用结束的回调函数(调用成功、失败都会执行)
+ */
+ complete ?: ((result : any) => void) | null
+};
+
+export type SaveImageToPhotosAlbum = (options : SaveImageToPhotosAlbumOptions) => void;
+
+export type SaveImageToPhotosAlbumSuccessCallback = {
+ /**
+ * 保存到相册的图片路径
+ */
+ path : string
+};
+
+export type SaveImageToPhotosAlbumOptions = {
+ /**
+ * 图片文件路径,可以是临时文件路径也可以是永久文件路径,不支持网络图片路径
+ */
+ filePath : string,
+ /**
+ * 接口调用成功的回调函数
+ */
+ success ?: ((result : SaveImageToPhotosAlbumSuccessCallback) => void) | null,
+ /**
+ * 接口调用失败的回调函数
+ */
+ fail ?: ((result : UniError) => void) | null,
+ /**
+ * 接口调用结束的回调函数(调用成功、失败都会执行)
+ */
+ complete ?: ((result : any) => void) | null
+};
+export type CompressImage = (options : CompressImageOptions) => void;
+export type CompressImageSuccessCallback = {
+ /**
+ * 压缩后图片的临时文件路径
+ */
+ tempFilePath : string
+};
+export type CompressImageOptions = {
+ /**
+ * 图片路径,图片的路径,可以是相对路径、临时文件路径、存储文件路径
+ */
+ src : string,
+ /**
+ * 压缩质量,范围0~100,数值越小,质量越低,压缩率越高(仅对jpg有效)
+ */
+ quality ?: number | null,
+ /**
+ * 旋转度数,范围0~360
+ */
+ rotate ?: number | null,
+ /**
+ * 缩放图片的宽度
+ */
+ width ?: string | null,
+ /**
+ * 缩放图片的高度
+ */
+ height ?: string | null,
+ /**
+ * 压缩后图片的高度,单位为px,若不填写则默认以compressedWidth为准等比缩放
+ */
+ compressedHeight ?: number | null,
+ /**
+ * 压缩后图片的宽度,单位为px,若不填写则默认以compressedHeight为准等比缩放。
+ */
+ compressedWidth ?: number | null,
+ /**
+ * 接口调用成功的回调函数
+ */
+ success ?: ((result : CompressImageSuccessCallback) => void) | null,
+ /**
+ * 接口调用失败的回调函数
+ */
+ fail ?: ((result : UniError) => void) | null,
+ /**
+ * 接口调用结束的回调函数(调用成功、失败都会执行)
+ */
+ complete ?: ((result : any) => void) | null
+};
+
+export type ChooseVideoSuccessCallback = {
+ /**
+ * 选定视频的临时文件路径
+ */
+ tempFilePath : string,
+ /**
+ * 选定的视频文件,仅H5支持
+ */
+ // tempFile: File|null,
+ /**
+ * 选定视频的时间长度
+ */
+ duration : number,
+ /**
+ * 选定视频的数据量大小
+ */
+ size : number,
+ /**
+ * 返回选定视频的长
+ */
+ height : number,
+ /**
+ * 返回选定视频的宽
+ */
+ width : number,
+ /**
+ * 包含扩展名的文件名称(仅H5支持)
+ */
+ // name: string | null
+};
+
+export type ChooseVideoOptions = {
+ /**
+ * album 从相册选视频,camera 使用相机拍摄,默认为:['album', 'camera']
+ */
+ sourceType ?: (string[]) | null,
+ /**
+ * 是否压缩所选的视频源文件,默认值为true,需要压缩
+ * @type boolean
+ */
+ compressed ?: boolean | null,
+ /**
+ * 拍摄视频最长拍摄时间,单位秒。最长支持 60 秒
+ */
+ maxDuration ?: number | null,
+ /**
+ * 摄像切换
+ * - front: 前置摄像头
+ * - back: 后置摄像头
+ * @type 'front' | 'back'
+ */
+ camera ?: string | null,
+ /**
+ * 根据文件拓展名过滤,每一项都不能是空字符串。默认不过滤。
+ */
+ extension ?: (string[]) | null,
+ /**
+ * 接口调用成功,返回视频文件的临时文件路径,详见返回参数说明
+ */
+ success ?: ((result : ChooseVideoSuccessCallback) => void) | null,
+ /**
+ * 接口调用失败的回调函数
+ */
+ fail ?: ((result : UniError) => void) | null,
+ /**
+ * 接口调用结束的回调函数(调用成功、失败都会执行)
+ */
+ complete ?: ((result : any) => void) | null
+};
+
+export type ChooseVideo = (options : ChooseVideoOptions) => void;
+
+export type GetVideoInfoSuccessCallback = {
+ /**
+ * 画面方向
+ */
+ orientation : string | null,
+ /**
+ * 视频格式
+ */
+ type : string | null,
+ /**
+ * 视频长度
+ */
+ duration : number,
+ /**
+ * 视频大小,单位 kB
+ */
+ size : number,
+ /**
+ * 视频的长,单位 px
+ */
+ height : number,
+ /**
+ * 视频的宽,单位 px
+ */
+ width : number,
+ /**
+ * 视频帧率
+ */
+ fps : number | null,
+ /**
+ * 视频码率,单位 kbps
+ */
+ bitrate : number | null
+};
+
+export type GetVideoInfoOptions = {
+ /**
+ * 视频文件路径,可以是临时文件路径也可以是永久文件路径
+ */
+ src : string,
+ /**
+ * 接口调用成功的回调函数
+ */
+ success ?: ((result : GetVideoInfoSuccessCallback) => void) | null,
+ /**
+ * 接口调用失败的回调函数
+ */
+ fail ?: ((result : UniError) => void) | null,
+ /**
+ * 接口调用结束的回调函数(调用成功、失败都会执行)
+ */
+ complete ?: ((result : any) => void) | null
+};
+
+export type GetVideoInfo = (options : GetVideoInfoOptions) => void;
+
+export type SaveVideoToPhotosAlbumSuccessCallback = {};
+
+export type SaveVideoToPhotosAlbumOptions = {
+ /**
+ * 视频文件路径,可以是临时文件路径也可以是永久文件路径
+ */
+ filePath : string,
+ /**
+ * 接口调用成功的回调函数
+ */
+ success ?: ((result : SaveVideoToPhotosAlbumSuccessCallback) => void) | null,
+ /**
+ * 接口调用失败的回调函数
+ */
+ fail ?: ((result : UniError) => void) | null,
+ /**
+ * 接口调用结束的回调函数(调用成功、失败都会执行)
+ */
+ complete ?: ((result : any) => void) | null
+};
+
+export type SaveVideoToPhotosAlbum = (options : SaveVideoToPhotosAlbumOptions) => void;
+
+export type CompressVideoSuccessCallback = {
+ /**
+ * 压缩后的临时文件地址
+ */
+ tempFilePath : string,
+ /**
+ * 压缩后的大小,单位 kB
+ */
+ size : number
+};
+
+export type CompressVideoOptions = {
+ /**
+ * 视频文件路径,可以是临时文件路径也可以是永久文件路径
+ */
+ src : string,
+ /**
+ * 压缩质量
+ * - low: 低
+ * - medium: 中
+ * - high: 高
+ * @type 'low' | 'medium' | 'high'
+ */
+ quality ?: string | null,
+ /**
+ * 码率,单位 kbps
+ */
+ bitrate ?: number | null,
+ /**
+ * 帧率
+ */
+ fps ?: number | null,
+ /**
+ * 相对于原视频的分辨率比例,取值范围(0, 1]
+ */
+ resolution ?: number | null,
+ /**
+ * 接口调用成功的回调函数
+ */
+ success ?: ((result : CompressVideoSuccessCallback) => void) | null,
+ /**
+ * 接口调用失败的回调函数
+ */
+ fail ?: ((result : UniError) => void) | null,
+ /**
+ * 接口调用结束的回调函数(调用成功、失败都会执行)
+ */
+ complete ?: ((result : any) => void) | null
+};
+
+export type CompressVideo = (options : CompressVideoOptions) => void;
+
+export interface Uni {
+ /**
+ * 从本地相册选择图片或使用相机拍照
+ * @description 从本地相册选择图片或使用相机拍照
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "4.4",
+ * "uniVer": "√",
+ * "unixVer": "3.9+"
+ * }
+ * }
+ * }
+ * @uniVueVersion 2,3
+ * @example
+ * ```typescript
+ * uni.chooseImage({
+ * count:3,
+ * success(e){
+ * console.log(JSON.stringify(e))
+ * }
+ * })
+ * ```
+ * @tutorial http://uniapp.dcloud.io/api/media/image?id=chooseimage
+ * @autotest {
+ generated:false
+ }
+ */
+ chooseImage(options : ChooseImageOptions) : void;
+ /**
+ * 预览图片
+ * @description 预览图片
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "4.4",
+ * "uniVer": "√",
+ * "unixVer": "3.9+"
+ * }
+ * }
+ * }
+ * @uniVueVersion 2,3
+ * @example
+ * ```typescript
+ * uni.previewImage({
+ * urls:['/static/a.jpg','/static/b.jpg'],
+ * success(e){
+ * console.log(JSON.stringify(e))
+ * }
+ * })
+ * ```
+ * @tutorial http://uniapp.dcloud.io/api/media/image?id=previewimage
+ * @autotest {
+ generated:false
+ }
+ */
+ previewImage(options : PreviewImageOptions) : void;
+ /**
+ * 关闭图片预览
+ * @description 关闭图片预览
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "4.4",
+ * "uniVer": "√",
+ * "unixVer": "3.9+"
+ * }
+ * }
+ * }
+ * @uniVueVersion 2,3
+ * @example
+ * ```typescript
+ * uni.closePreviewImage({
+ * success(e){
+ * console.log(JSON.stringify(e))
+ * }
+ * })
+ * ```
+ * @tutorial http://uniapp.dcloud.io/api/media/image?id=closepreviewimage
+ * @autotest {
+ generated:false
+ }
+ */
+ closePreviewImage(options : ClosePreviewImageOptions) : void;
+ /**
+ * 获取图片信息
+ * @description 获取图片信息
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "4.4",
+ * "uniVer": "√",
+ * "unixVer": "3.9+"
+ * }
+ * }
+ * }
+ * @uniVueVersion 2,3
+ * @example
+ * ```typescript
+ * uni.getImageInfo({
+ * src:'/static/a.jpg',
+ * success(e){
+ * console.log(JSON.stringify(e))
+ * },
+ * })
+ * ```
+ * @tutorial http://uniapp.dcloud.io/api/media/image?id=getimageinfo
+ * @autotest {
+ generated:false,
+ case:[
+ {
+ input:[{"src":"/static/a.jpg"}]
+ }
+ ]
+ }
+ */
+ getImageInfo(options : GetImageInfoOptions) : void;
+ /**
+ * 保存图片到系统相册
+ * @description 保存图片到系统相册
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "4.4",
+ * "uniVer": "√",
+ * "unixVer": "3.9+"
+ * }
+ * }
+ * }
+ * @uniVueVersion 2,3
+ * @example
+ * ```typescript
+ * uni.saveImageToPhotosAlbum({
+ * filePath:'/static/a.jpg',
+ * success(e){
+ * console.log(JSON.stringify(e))
+ * },
+ * })
+ * ```
+ * @tutorial http://uniapp.dcloud.io/api/media/image?id=saveimagetophotosalbum
+ * @autotest {
+ generated:false,
+ case:[
+ {
+ input:[{"filePath":"/static/a.jpg"}]
+ }
+ ]
+ }
+ */
+ saveImageToPhotosAlbum(options : SaveImageToPhotosAlbumOptions) : void;
+ /**
+ * 压缩图片
+ * @description 压缩图片
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "4.4",
+ * "uniVer": "√",
+ * "unixVer": "3.9+"
+ * }
+ * }
+ * }
+ * @uniVueVersion 2,3
+ * @example
+ * ```typescript
+ * uni.compressImage({
+ * src:'/static/a.jpg',
+ * quality:80,
+ * success(e){
+ * console.log(JSON.stringify(e))
+ * },
+ * })
+ * ```
+ * @tutorial http://uniapp.dcloud.io/api/media/image?id=compressimage
+ * @autotest {
+ generated:false,
+ case:[
+ {
+ input:[{"src":"/static/d.jpg"},{"rotate","30"}]
+ }
+ ]
+ }
+ */
+ compressImage(options : CompressImageOptions) : void;
+ /**
+ * 拍摄视频或从手机相册中选视频,返回视频的临时文件路径。
+ * @description 拍摄视频或从手机相册中选视频,返回视频的临时文件路径。
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "4.4",
+ * "uniVer": "√",
+ * "unixVer": "3.9+"
+ * }
+ * }
+ * }
+ * @uniVueVersion 2,3
+ * @example
+ * ```typescript
+ * uni.chooseVideo({
+ * success(e){
+ * console.log(JSON.stringify(e))
+ * },
+ * })
+ * ```
+ * @tutorial http://uniapp.dcloud.io/api/media/video?id=choosevideo
+ *
+ */
+ chooseVideo(options : ChooseVideoOptions) : void;
+ /**
+ * 获取视频详细信息
+ * @description 获取视频详细信息
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "4.4",
+ * "uniVer": "√",
+ * "unixVer": "3.9+"
+ * }
+ * }
+ * }
+ * @uniVueVersion 2,3
+ * @example
+ * ```typescript
+ * uni.GetVideoInfo({
+ * src:"/static/a.mp4",
+ * success(e){
+ * console.log(JSON.stringify(e))
+ * },
+ * })
+ * ```
+ * @tutorial http://uniapp.dcloud.io/api/media/video?id=getvideoinfo
+ *
+ */
+ getVideoInfo(options : GetVideoInfoOptions) : void;
+ /**
+ * 保存视频到系统相册
+ * @description 保存视频到系统相册
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "4.4",
+ * "uniVer": "√",
+ * "unixVer": "3.9+"
+ * }
+ * }
+ * }
+ * @uniVueVersion 2,3
+ * @example
+ * ```typescript
+ * uni.saveVideoToPhotosAlbum({
+ * filePath:"/static/a.mp4",
+ * success(e){
+ * console.log(JSON.stringify(e))
+ * },
+ * })
+ * ```
+ * @tutorial http://uniapp.dcloud.io/api/media/video?id=savevideotophotosalbum
+ *
+ */
+ saveVideoToPhotosAlbum(options : SaveVideoToPhotosAlbumOptions) : void;
+ /**
+ * 压缩视频
+ * @description 压缩视频
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "4.4",
+ * "uniVer": "√",
+ * "unixVer": "3.9+"
+ * }
+ * }
+ * }
+ * @uniVueVersion 2,3
+ * @example
+ * ```typescript
+ * uni.compressVideo({
+ * src:"/static/a.mp4",
+ * quality:"low",
+ * success(e){
+ * console.log(JSON.stringify(e))
+ * },
+ * })
+ * ```
+ * @tutorial http://uniapp.dcloud.io/api/media/video?id=compressvideo
+ *
+ */
+ compressVideo(options : CompressVideoOptions) : void;
+}
\ No newline at end of file
diff --git a/uni_modules/uni-media/utssdk/unierror.uts b/uni_modules/uni-media/utssdk/unierror.uts
new file mode 100644
index 0000000000000000000000000000000000000000..24ddb6bc3c3eed4ad158a9e514bef97cb4dd6c89
--- /dev/null
+++ b/uni_modules/uni-media/utssdk/unierror.uts
@@ -0,0 +1,58 @@
+/**
+ * 错误主题
+ */
+export const UniError_PreviewImage = 'uni-previewImage';
+export const UniError_GetImageInfo = "uni-getImageInfo"
+export const UniError_SaveImageToPhotosAlbum = "uni-saveImageToPhotosAlbum"
+export const UniError_SaveVideoToPhotosAlbum = "uni-saveVideoToPhotosAlbum"
+export const UniError_ChooseImage = "uni-chooseImage"
+export const UniError_ChooseVideo = "uni-chooseVideo"
+export const UniError_CompressImage = "uni-compressImage"
+export const UniError_CompressVideo = "uni-compressVideo"
+export const UniError_GetVideoInfo = "uni-getVideoInfo"
+/**
+ * 错误码
+ * @UniError
+ */
+export const UniErrors : Map = new Map([
+ /**
+ * 用户取消
+ */
+ [1101001, 'user cancel'],
+ /**
+ * urls至少包含一张图片地址
+ */
+ [1101002, 'fail parameter error: parameter.urls should have at least 1 item'],
+ /**
+ * 文件不存在
+ */
+ [1101003, "file not find"],
+ /**
+ * 图片加载失败
+ */
+ [1101004, "Failed to load resource"],
+ /**
+ * 未获取权限
+ */
+ [1101005, "No Permission"],
+ /**
+ * 保存异常
+ */
+ [1101006, "save error"],
+ /**
+ * 图片裁剪失败
+ */
+ [1101007, "crop error"],
+ /**
+ * 拍照或录像失败
+ */
+ [1101008, 'camera error'],
+ /**
+ * 图片压缩失败
+ */
+ [1101009, "image output failed"],
+ /**
+ * 其他错误
+ */
+ [1101010, "unexpect error:"]
+]);
\ No newline at end of file
diff --git a/uni_modules/uni-memorywarning/package.json b/uni_modules/uni-memorywarning/package.json
index aa015a936ea73d8161f8d52e97c5bb3da080584c..9bda0f8f3a00c636c1afcc32507cf221ac38d8ea 100644
--- a/uni_modules/uni-memorywarning/package.json
+++ b/uni_modules/uni-memorywarning/package.json
@@ -5,7 +5,7 @@
"description": "UTS 实现内存警告监听",
"keywords": [
"onMemoryWarning"
-],
+ ],
"repository": "",
"engines": {
"HBuilderX": "^3.6.11"
@@ -31,18 +31,16 @@
"npmurl": ""
},
"uni_modules": {
- "uni-ext-api":{
- "uni": {
- "onMemoryWarning": "onMemoryWarning",
- "offMemoryWarning":"offMemoryWarning"
- },
- "mp-weixin":false,
- "mp-alipay":false,
- "mp-baidu":false,
- "mp-qq":false,
- "mp-kuaishou":false,
- "mp-jd":false
- },
+ "uni-ext-api": {
+ "uni": {
+ "onMemoryWarning": {
+ "web": false
+ },
+ "offMemoryWarning": {
+ "web": false
+ }
+ }
+ },
"dependencies": [],
"encrypt": [],
"platforms": {
@@ -58,10 +56,10 @@
"App": {
"app-android": {
"minVersion": "19"
- },
+ },
"app-ios": {
"minVersion": "9"
- }
+ }
},
"H5-mobile": {
"Safari": "n",
@@ -94,4 +92,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/uni_modules/uni-memorywarning/utssdk/app-android/index.uts b/uni_modules/uni-memorywarning/utssdk/app-android/index.uts
index a28f12af07ade2f6be38f7c00ee4aaeb7fa8cceb..ec4a9106ec63f5468ba459e4566fe23449865f03 100644
--- a/uni_modules/uni-memorywarning/utssdk/app-android/index.uts
+++ b/uni_modules/uni-memorywarning/utssdk/app-android/index.uts
@@ -1,20 +1,20 @@
import { UTSAndroid } from "io.dcloud.uts"
+import { OnMemoryWarning, OffMemoryWarning, MemoryWarningCallback, MemoryWarningCallbackResult } from "../interface.uts"
-
-let listeners: UTSCallback[] = []
+let listeners: MemoryWarningCallback[] = []
const onAppTrimMemoryListener = (ret: number) => {
listeners.forEach(listener => {
- let res = {
- level:ret
- }
- listener(res)
+ let res: MemoryWarningCallbackResult = {
+ level:ret
+ }
+ listener(res)
})
}
@Suppress("DEPRECATION")
-export function onMemoryWarning(callback: UTSCallback) {
+export const onMemoryWarning : OnMemoryWarning = function (callback: MemoryWarningCallback) {
if (listeners.length == 0) {
// 仅首次执行底层的实际监听
UTSAndroid.onAppTrimMemory(onAppTrimMemoryListener)
@@ -28,7 +28,7 @@ export function onMemoryWarning(callback: UTSCallback) {
@Suppress("DEPRECATION")
-export function offMemoryWarning(callback: UTSCallback | null) {
+export const offMemoryWarning : OffMemoryWarning = function (callback: MemoryWarningCallback | null) {
if(callback == null){
// 清除全部回调
diff --git a/uni_modules/uni-memorywarning/utssdk/app-ios/index.uts b/uni_modules/uni-memorywarning/utssdk/app-ios/index.uts
index e4dc943ebbcd8df81034a7b0ba4929f2a00b29be..5f4f37bfdc3f0e3bf20a5c98d9a90852b1b0171b 100644
--- a/uni_modules/uni-memorywarning/utssdk/app-ios/index.uts
+++ b/uni_modules/uni-memorywarning/utssdk/app-ios/index.uts
@@ -1,56 +1,47 @@
import { NotificationCenter } from 'Foundation';
import { UIApplication } from "UIKit"
import { Selector } from "ObjectiveC"
+import { OnMemoryWarning, OffMemoryWarning, MemoryWarningCallback, MemoryWarningCallbackResult } from "../interface.uts"
class MemoryWarningTool {
- static listeners: UTSCallback[] = []
-
+ static listener: MemoryWarningCallback | null = null
// 监听内存警告
- static listenMemoryWarning(callback: UTSCallback) {
-
+ static listenMemoryWarning(callback: MemoryWarningCallback) {
+
// 只有首次才需要注册监听事件
- if (this.listeners.length == 0) {
+ if (this.listener == null) {
// 注册监听内存警告通知事件及设置回调方法
// target-action 回调方法需要通过 Selector("方法名") 构建
const method = Selector("receiveMemoryWarning")
NotificationCenter.default.addObserver(this, selector = method, name = UIApplication.didReceiveMemoryWarningNotification, object = null)
}
- this.listeners.push(callback)
+ this.listener = callback
}
-
+
// 内存警告回调的方法
// target-action 的方法前需要添加 @objc 前缀
@objc static receiveMemoryWarning() {
// 触发回调
- this.listeners.forEach(listener => {
- listener({})
- })
+ let res: MemoryWarningCallbackResult = {
+ level: 0
+ };
+ this.listener?.(res);
}
-
+
// 移除监听事件
- static removeListen(callback: UTSCallback | null) {
- // 移除所有监听
- if (callback == null) {
- this.listeners = []
- // 移除监听事件
- NotificationCenter.default.removeObserver(this)
- return
- }
-
- // 清除指定回调
- const index = this.listeners.indexOf(callback!)
- if (index > -1) {
- this.listeners.splice(index, 1)
- }
+ static removeListen(callback: MemoryWarningCallback | null) {
+ this.listener = null;
+ NotificationCenter.default.removeObserver(this)
}
}
+
// 开启监听内存警告
-export function onMemoryWarning(callback: UTSCallback) {
+export const onMemoryWarning : OnMemoryWarning = function (callback: MemoryWarningCallback) {
MemoryWarningTool.listenMemoryWarning(callback)
}
// 关闭监听内存警告
-export function offMemoryWarning(callback: UTSCallback | null) {
+export const offMemoryWarning : OffMemoryWarning = function (callback: MemoryWarningCallback | null) {
MemoryWarningTool.removeListen(callback)
-}
\ No newline at end of file
+}
diff --git a/uni_modules/uni-memorywarning/utssdk/index.d.ts b/uni_modules/uni-memorywarning/utssdk/index.d.ts
new file mode 100644
index 0000000000000000000000000000000000000000..fbad2381541932af0d66eb7abc0bfb22bbdb1d36
--- /dev/null
+++ b/uni_modules/uni-memorywarning/utssdk/index.d.ts
@@ -0,0 +1,71 @@
+declare namespace UniNamespace {
+
+interface MemoryWarningCallbackResult {
+ /**
+ * 内存警告等级(仅安卓平台有效,iOS始终是0)
+ */
+ level: number
+}
+
+/**
+ * uni.onMemoryWarning/uni.offMemoryWarning回调函数定义
+ */
+type MemoryWarningCallback = (res: MemoryWarningCallbackResult) => void
+
+type OnMemoryWarning = (callback: MemoryWarningCallback) => void
+
+type OffMemoryWarning = (callback : MemoryWarningCallback | null) => void
+
+}
+
+
+declare interface Uni {
+ /**
+ * 开启监听内存警告
+ *
+ * @param {MemoryWarningCallback} callback
+ * @tutorial https://uniapp.dcloud.net.cn/api/system/memory.html#onmemorywarning
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "4.4.4",
+ * "uniVer": "3.7.7",
+ * "unixVer": "3.9.0"
+ * },
+ * "ios": {
+ * "osVer": "9.0",
+ * "uniVer": "3.7.7",
+ * "unixVer": "3.9.0"
+ * }
+ * }
+ * }
+ * @uniVersion 3.7.7
+ * @uniVueVersion 2,3 //支持的vue版本
+ * @autotest { expectCallback: true }
+ */
+ onMemoryWarning(callback: UniNamespace.MemoryWarningCallback) : void,
+ /**
+ * 取消监听内存不足告警事件
+ *
+ * @param {MemoryWarningCallback} callback
+ * @tutorial https://uniapp.dcloud.net.cn/api/system/memory.html#offmemorywarning
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "4.4.4",
+ * "uniVer": "3.7.7",
+ * "unixVer": "3.9.0"
+ * },
+ * "ios": {
+ * "osVer": "9.0",
+ * "uniVer": "3.7.7",
+ * "unixVer": "3.9.0"
+ * }
+ * }
+ * }
+ * @uniVersion 3.7.7
+ * @uniVueVersion 2,3 //支持的vue版本
+ * @autotest { expectCallback: true }
+ */
+ offMemoryWarning(callback : UniNamespace.MemoryWarningCallback | null) : void
+}
diff --git a/uni_modules/uni-memorywarning/utssdk/interface.uts b/uni_modules/uni-memorywarning/utssdk/interface.uts
new file mode 100644
index 0000000000000000000000000000000000000000..1e3250e8dbf5da28517666206eae16748871dd28
--- /dev/null
+++ b/uni_modules/uni-memorywarning/utssdk/interface.uts
@@ -0,0 +1,69 @@
+/**
+ * uni.onMemoryWarning/uni.offMemoryWarning回调参数
+ */
+export type MemoryWarningCallbackResult = {
+ /**
+ * 内存警告等级(仅安卓平台有效,iOS始终是0)
+ */
+ level: number
+}
+
+/**
+ * uni.onMemoryWarning/uni.offMemoryWarning回调函数定义
+ */
+export type MemoryWarningCallback = (res: MemoryWarningCallbackResult) => void
+
+export type OnMemoryWarning = (callback: MemoryWarningCallback) => void
+
+export type OffMemoryWarning = (callback : MemoryWarningCallback | null) => void
+
+export interface Uni {
+ /**
+ * 开启监听内存警告
+ *
+ * @param {MemoryWarningCallback} callback
+ * @tutorial https://uniapp.dcloud.net.cn/api/system/memory.html#onmemorywarning
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "4.4.4",
+ * "uniVer": "3.7.7",
+ * "unixVer": "3.9.0"
+ * },
+ * "ios": {
+ * "osVer": "9.0",
+ * "uniVer": "3.7.7",
+ * "unixVer": "x"
+ * }
+ * }
+ * }
+ * @uniVersion 3.7.7
+ * @uniVueVersion 2,3 //支持的vue版本
+ * @autotest { expectCallback: true }
+ */
+ onMemoryWarning(callback: MemoryWarningCallback) : void,
+ /**
+ * 取消监听内存不足告警事件
+ *
+ * @param {MemoryWarningCallback} callback
+ * @tutorial https://uniapp.dcloud.net.cn/api/system/memory.html#offmemorywarning
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "4.4.4",
+ * "uniVer": "3.7.7",
+ * "unixVer": "3.9.0"
+ * },
+ * "ios": {
+ * "osVer": "9.0",
+ * "uniVer": "3.7.7",
+ * "unixVer": "x"
+ * }
+ * }
+ * }
+ * @uniVersion 3.7.7
+ * @uniVueVersion 2,3 //支持的vue版本
+ * @autotest { expectCallback: true }
+ */
+ offMemoryWarning(callback : MemoryWarningCallback | null) : void
+}
diff --git a/uni_modules/uni-network/changelog.md b/uni_modules/uni-network/changelog.md
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/uni_modules/uni-network/package.json b/uni_modules/uni-network/package.json
new file mode 100644
index 0000000000000000000000000000000000000000..2897cb750ba0c072aed6128a968884004bee8456
--- /dev/null
+++ b/uni_modules/uni-network/package.json
@@ -0,0 +1,109 @@
+{
+ "id": "uni-network",
+ "displayName": "uni-network",
+ "version": "1.0.0",
+ "description": "uni-network",
+ "keywords": [
+ "uni-network"
+ ],
+ "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": {
+ "request": {
+ "name": "request",
+ "app": {
+ "js": false,
+ "kotlin": true,
+ "swift": true
+ }
+ },
+ "uploadFile": {
+ "name": "uploadFile",
+ "app": {
+ "js": false,
+ "kotlin": true,
+ "swift": false
+ }
+ },
+ "downloadFile": {
+ "name": "downloadFile",
+ "app": {
+ "js": false,
+ "kotlin": true,
+ "swift": false
+ }
+ }
+ }
+ },
+ "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"
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/uni_modules/uni-network/readme.md b/uni_modules/uni-network/readme.md
new file mode 100644
index 0000000000000000000000000000000000000000..15dba64816abb1ec06a269a9d0683efd7433c8ac
--- /dev/null
+++ b/uni_modules/uni-network/readme.md
@@ -0,0 +1,6 @@
+# uni-network
+### 开发文档
+[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)
\ No newline at end of file
diff --git a/uni_modules/uni-network/utssdk/app-android/config.json b/uni_modules/uni-network/utssdk/app-android/config.json
new file mode 100644
index 0000000000000000000000000000000000000000..fcfc9c4a8d0fcd5e82bf401d8892c0089879a5ee
--- /dev/null
+++ b/uni_modules/uni-network/utssdk/app-android/config.json
@@ -0,0 +1,6 @@
+{
+ "dependencies": [
+ "com.squareup.okhttp3:okhttp:3.12.12"
+ ],
+ "minSdkVersion": "19"
+}
diff --git a/uni_modules/uni-network/utssdk/app-android/index.uts b/uni_modules/uni-network/utssdk/app-android/index.uts
new file mode 100644
index 0000000000000000000000000000000000000000..7fe4a4602dc1eb9bae576bc6900be9f037790343
--- /dev/null
+++ b/uni_modules/uni-network/utssdk/app-android/index.uts
@@ -0,0 +1,440 @@
+import { RequestOptions, RequestSuccess, RequestTask, UploadFileOptions, UploadFile, UploadTask, OnProgressUpdateResult, UploadFileSuccess, UploadFileProgressUpdateCallback, DownloadFile, DownloadTask, DownloadFileOptions, OnProgressDownloadResult, DownloadFileProgressUpdateCallback, DownloadFileSuccess } from '../interface'
+import { RequestFailImpl, UploadFileFailImpl, DownloadFileFailImpl, getErrcode } from '../unierror';
+import { NetworkManager, NetworkRequestListener, NetworkUploadFileListener, NetworkDownloadFileListener } from './network/NetworkManager.uts'
+import Pattern from 'java.util.regex.Pattern';
+import Locale from 'java.util.Locale';
+import TextUtils from 'android.text.TextUtils';
+import { StatusCode } from './network/StatusCode.uts'
+import Key from 'kotlinx.coroutines.CoroutineExceptionHandler.Key';
+import JSONObject from 'com.alibaba.fastjson.JSONObject';
+import ArrayList from 'java.util.ArrayList';
+import ProgressListener from 'android.os.RecoverySystem.ProgressListener';
+import Handler from 'android.os.Handler';
+import Looper from 'android.os.Looper';
+import UTSAndroid from 'io.dcloud.uts.UTSAndroid';
+import Class from 'java.lang.Class';
+import Type from 'java.lang.reflect.Type';
+
+let charsetPattern = Pattern.compile('charset=([a-z0-9-]+)')
+
+class RunnableTask extends Runnable {
+ private callback : () => void | null;
+ private looper : Looper | null = null;
+ constructor(looper : Looper | null, callback : () => void) {
+ super();
+ this.looper = looper;
+ this.callback = callback
+ }
+
+ override run() {
+ this.callback?.()
+ }
+
+ public execute() {
+ if (this.looper == null) {
+ this.run();
+ } else {
+ new Handler(this.looper!!).post(this);
+ }
+ }
+}
+
+
+class RequestNetworkListener extends NetworkRequestListener {
+ private param : RequestOptions | null = null;
+ private headers : UTSJSONObject = {};
+ private looper : Looper | null = null;
+ private type : Type | null = null;
+ private clzName : string | null = null;
+ constructor(param : RequestOptions, type : Type, clzName : string) {
+ super();
+ this.param = param;
+ this.type = type;
+ this.clzName = clzName;
+ this.looper = Looper.myLooper();
+ }
+ override onStart() : void {
+ }
+
+ override onHeadersReceived(statusCode : number, headers : MutableMap>) : void {
+ let simpleHeaders = {};
+ if (headers != null) {
+ let it = headers.iterator();
+ while (it.hasNext()) {
+ let entry = it.next();
+ let key = entry.key;
+ let value = entry.value;
+
+ let tmpKey = '_';
+ if (key == null) {
+ key = tmpKey;
+ }
+
+ if (value.size == 0) {
+ continue;
+ } else if (value.size == 1) {
+ simpleHeaders[key] = value.get(0);
+ } else {
+ simpleHeaders[key] = value.toString();
+ }
+ }
+ }
+ this.headers = simpleHeaders;
+ }
+
+ override onProgress(progress : number) : void {
+ }
+
+ override onComplete(option : UTSJSONObject) : void {
+ let kParam = this.param;
+ let result = {};
+ if (kParam != null) {
+ if (option == null || '-1' == option['statusCode']) {
+ // result['statusText'] = 'ERR_CONNECT_FAILED';
+ // result['errMsg'] = option['errorMsg'];
+ if (this.headers != null) {
+ result['header'] = this.headers;
+ }
+ let exception = option['cause']! as Exception;
+ let cause = exception.cause.toString();
+ let errMsg = option['errorMsg']! as string;
+ let errCode = (option['errorCode']! as string).toInt();
+ if (errMsg.contains("timeout")) {
+ errCode = 5;
+ errMsg = "time out";
+ } else if (cause.contains("Connection refused")) {
+ errCode = 1000;
+ errMsg = "server system error";
+ } else if (cause.contains("Network is unreachable")) {
+ errCode = 600003;
+ errMsg = "network interrupted error";
+ } else if (cause.contains("invalid URL")) {
+ errCode = 600009;
+ errMsg = "invalid URL";
+ } else {
+ errCode = 602001;
+ errMsg = "request system error";
+ }
+
+ let failResult = new RequestFailImpl(getErrcode(errCode));
+ failResult.cause = new Error(cause);
+ new RunnableTask(this.looper, () => {
+ if (kParam != null) {
+ let fail = kParam.fail;
+ if (fail != null) {
+ fail(failResult);
+ }
+ let complete = kParam.complete;
+ if (complete != null) {
+ complete(failResult);
+ }
+ }
+ }).execute();
+ } else {
+ result['statusCode'] = option['statusCode'];
+ if (option['originalData'] == null) {
+ if ("java.lang.Object".equals(this.clzName, true)) {
+ let errMsg = option['errorMsg'];
+ if (errMsg != null) {
+ let errMsgJson = JSON.parse((option['errorMsg']! as string));
+ if (errMsgJson != null) {
+ result['data'] = errMsgJson;
+ } else {
+ result['data'] = errMsg;
+ }
+ } else {
+ result['data'] = "error";
+ }
+ } else {
+ let errMsg = option['errorMsg'];
+ if (errMsg != null) {
+ let errMsgJson = JSON.parse(errMsg as string, this.type);
+ if (errMsgJson != null) {
+ result['data'] = errMsgJson;
+ } else {
+ let failResult = new RequestFailImpl(getErrcode(100002));
+ new RunnableTask(this.looper, () => {
+ if (kParam != null) {
+ let fail = kParam.fail;
+ if (fail != null) {
+ fail(failResult);
+ }
+ let complete = kParam.complete;
+ if (complete != null) {
+ complete(failResult);
+ }
+ }
+ }).execute();
+ return;
+ }
+ }
+ }
+ } else {
+ let charset = "";
+ let headers = this.headers.toJSONObject() as JSONObject;
+ if (headers != null) {
+ for (key in headers.keys) {
+ if (key.equals("Content-Type", true)) {
+ charset = headers[key] as string;
+ }
+ }
+ }
+
+ let strData = this.readAsString(option['originalData'] as ByteArray, charset);
+
+ let type = kParam.responseType != null ? kParam.responseType : kParam.dataType;
+ if (type == null) {
+ type = charset;
+ }
+ if (kParam.method == "HEAD") {
+ type = "";
+ }
+
+ const data = this.parseData(strData, type);
+ if (data == null) {
+ let failResult = new RequestFailImpl(getErrcode(100001));
+
+ new RunnableTask(this.looper, () => {
+ if (kParam != null) {
+ let fail = kParam.fail;
+ if (fail != null) {
+ fail(failResult);
+ }
+ let complete = kParam.complete;
+ if (complete != null) {
+ complete(failResult);
+ }
+ }
+ }).execute();
+ return;
+ }
+
+ result['data'] = data;
+ }
+ result['statusText'] = StatusCode.getStatus(option['statusCode'] as string);
+ if (this.headers != null) {
+ result['header'] = this.headers;
+ }
+
+ let tmp : RequestSuccess = {
+ data: result['data'] as T,
+ statusCode: (result['statusCode'] as string).toInt(),
+ header: result['header']!,
+ cookies: []
+ };
+ new RunnableTask(this.looper, () => {
+ if (kParam != null) {
+ let success = kParam.success;
+ if (success != null) {
+ success(tmp);
+ }
+ let complete = kParam.complete;
+ if (complete != null) {
+ complete(tmp);
+ }
+ }
+ }).execute();
+ }
+ }
+ }
+
+ private readAsString(byteArray : ByteArray, type : string) : string {
+ let charsetType = "utf-8";
+
+ if (type != null) {
+ let matcher = charsetPattern.matcher(type.toLowerCase(Locale.ENGLISH));
+ if (matcher.find()) {
+ charsetType = matcher.group(1);
+ }
+ }
+
+ try {
+ return new String(byteArray, charset(charsetType));
+ } catch (e : Exception) {
+ return new String(byteArray);
+ }
+ }
+
+ private parseData(data : string, type : string) : any | null {
+ if ("java.lang.Object".equals(this.clzName, true)) {
+ if (type.contains("json")) {
+ return JSON.parse(data);
+ } else if (type == 'jsonp') {
+ if (TextUtils.isEmpty(data)) {
+ return {};
+ }
+ let start = data.indexOf('(') + 1;
+ let end = data.indexOf(')');
+ if (start == 0 || start >= end) {
+ return {};
+ }
+ let tmp = data.substring(start, end);
+ return JSON.parse(tmp);
+ } else {
+ return data;
+ }
+ } else {
+ return JSON.parse(data, this.type);
+ }
+ }
+}
+
+
+class UploadNetworkListener implements NetworkUploadFileListener {
+ private param : UploadFileOptions | null = null;
+ public progressListeners = new ArrayList();
+ private looper : Looper | null = null;
+ constructor(param : UploadFileOptions) {
+ this.param = param;
+ this.looper = Looper.myLooper();
+ }
+
+ onProgress(progressUpdate : OnProgressUpdateResult) {
+ if (this.progressListeners.size != 0) {
+ new RunnableTask(this.looper, () => {
+ for (let i : Int = 0; i < this.progressListeners.size; i++) {
+ let listener = this.progressListeners.get(i);
+ listener(progressUpdate);
+ }
+ }).execute();
+ }
+ }
+
+ onComplete(option : UTSJSONObject) {
+ let kParam = this.param;
+ if (kParam != null) {
+ const errorMsg = option["errorMsg"];
+ let errCode = (option['statusCode']! as string).toInt();
+ if (errorMsg != null) {
+ let failResult = new UploadFileFailImpl(getErrcode(errCode));
+
+ new RunnableTask(this.looper, () => {
+ if (kParam != null) {
+ let fail = kParam.fail;
+ if (fail != null) {
+ fail(failResult);
+ }
+ let complete = kParam.complete;
+ if (complete != null) {
+ complete(failResult);
+ }
+ }
+ }).execute();
+
+ } else {
+ let kData = option["data"];
+ let data = "";
+ if (kData != null) {
+ data = kData as string;
+ }
+ let successResult : UploadFileSuccess = {
+ data: data,
+ statusCode: errCode
+ }
+ new RunnableTask(this.looper, () => {
+ if (kParam != null) {
+ let success = kParam.success;
+ if (success != null) {
+ success(successResult);
+ }
+ let complete = kParam.complete;
+ if (complete != null) {
+ complete(successResult);
+ }
+ }
+ }).execute();
+ }
+ }
+
+ }
+}
+class DownloadNetworkListener implements NetworkDownloadFileListener {
+ private param : DownloadFileOptions | null = null;
+ public progressListeners = new ArrayList();
+ private looper : Looper | null = null;
+ constructor(param : DownloadFileOptions) {
+ this.param = param;
+ this.looper = Looper.myLooper();
+ }
+
+ onProgress(progressUpdate : OnProgressDownloadResult) {
+ if (this.progressListeners.size != 0) {
+ new RunnableTask(this.looper, () => {
+ for (let i : Int = 0; i < this.progressListeners.size; i++) {
+ let listener = this.progressListeners.get(i);
+ listener(progressUpdate);
+ }
+ }).execute();
+ }
+ }
+ onComplete(option : UTSJSONObject) {
+ let kParam = this.param;
+ if (kParam != null) {
+ let statusCode = (option['statusCode']! as string).toInt();
+ let errMsg = option['errorMsg'];
+ if (errMsg != null) {
+ let errCode = (option['errorCode']! as string).toInt();
+ let failResult = new DownloadFileFailImpl(getErrcode(errCode));
+ failResult.errMsg = errMsg as string;
+ let exception = option['cause'];
+ if(exception != null){
+ let cause = (exception as Exception).cause.toString();
+ failResult.cause = new Error(cause);
+ }
+
+ new RunnableTask(this.looper, () => {
+ if (kParam != null) {
+ let fail = kParam.fail;
+ if (fail != null) {
+ fail(failResult);
+ }
+ let complete = kParam.complete;
+ if (complete != null) {
+ complete(failResult);
+ }
+ }
+ }).execute();
+ } else {
+ let kTempFilePath = option["tempFilePath"];
+ let tempFilePath = "";
+ if (kTempFilePath != null) {
+ tempFilePath = kTempFilePath as string;
+ }
+ let successResult : DownloadFileSuccess = {
+ tempFilePath: tempFilePath,
+ statusCode: statusCode
+ }
+
+ new RunnableTask(this.looper, () => {
+ if (kParam != null) {
+ let success = kParam.success;
+ if (success != null) {
+ success(successResult);
+ }
+ let complete = kParam.complete;
+ if (complete != null) {
+ complete(successResult);
+ }
+ }
+ }).execute();
+ }
+ }
+ }
+}
+
+
+@UTSAndroid.keyword("inline")
+@UTSAndroid.keyword('reified')
+export function request(options : RequestOptions) : RequestTask | null {
+ const type = UTSAndroid.getGenericType();
+ const clzName = UTSAndroid.getGenericClassName();
+ return NetworkManager.getInstance().request(options, new RequestNetworkListener(options, type, clzName));
+}
+
+export const uploadFile : UploadFile = (options : UploadFileOptions) : UploadTask | null => {
+ return NetworkManager.getInstance().uploadFile(options, new UploadNetworkListener(options));
+}
+
+export const downloadFile : DownloadFile = (options : DownloadFileOptions) : DownloadTask | null => {
+ return NetworkManager.getInstance().downloadFile(options, new DownloadNetworkListener(options));
+}
\ No newline at end of file
diff --git a/uni_modules/uni-network/utssdk/app-android/network/NetworkManager.uts b/uni_modules/uni-network/utssdk/app-android/network/NetworkManager.uts
new file mode 100644
index 0000000000000000000000000000000000000000..9cc016af9a4e9f3a88840e456abbcad41126913a
--- /dev/null
+++ b/uni_modules/uni-network/utssdk/app-android/network/NetworkManager.uts
@@ -0,0 +1,430 @@
+import { RequestOptions, RequestTask, UploadTask, UploadFileOptions, OnProgressUpdateResult, UploadFileProgressUpdateCallback, OnProgressDownloadResult, DownloadTask, DownloadFileOptions, DownloadFileProgressUpdateCallback } from '../../interface.uts'
+import OkHttpClient from 'okhttp3.OkHttpClient';
+import Protocol from 'okhttp3.Protocol';
+import TimeUnit from 'java.util.concurrent.TimeUnit';
+import Collections from 'java.util.Collections';
+import { OKDns } from './OKDns.uts';
+import Uri from 'android.net.Uri';
+import ConnectionPool from 'okhttp3.ConnectionPool';
+import Request from 'okhttp3.Request';
+import Call from 'okhttp3.Call';
+import Response from 'okhttp3.Response';
+import Headers from 'okhttp3.Headers';
+import Callback from 'okhttp3.Callback';
+import ExecutorService from 'java.util.concurrent.ExecutorService';
+import Executors from 'java.util.concurrent.Executors';
+import RequestBody from 'okhttp3.RequestBody';
+import MediaType from 'okhttp3.MediaType';
+import Dispatcher from 'okhttp3.Dispatcher';
+import IOException from 'java.io.IOException';
+import List from 'java.util.List';
+import InputStream from 'java.io.InputStream';
+import ByteArrayOutputStream from 'java.io.ByteArrayOutputStream';
+import BufferedReader from 'java.io.BufferedReader';
+import InputStreamReader from 'java.io.InputStreamReader';
+import OkHostnameVerifier from 'okhttp3.internal.tls.OkHostnameVerifier';
+import { SSLFactoryManager } from './tls/SSLFactoryManager.uts';
+import { SSLConfig } from './tls/SSLConfig.uts';
+import { CookieInterceptor } from './interceptor/CookieInterceptor.uts'
+import UTSAndroid from 'io.dcloud.uts.UTSAndroid';
+import MultipartBody from 'okhttp3.MultipartBody';
+import JSONObject from 'com.alibaba.fastjson.JSONObject';
+import { UploadController } from './upload/UploadController.uts';
+import ArrayList from 'java.util.ArrayList';
+import { DownloadController } from './download/DownloadController.uts';
+
+class NetworkRequestListener {
+ public onStart(): void { }
+
+ public onProgress(progress: number): void { }
+
+ public onComplete(option: UTSJSONObject): void { }
+
+ public onHeadersReceived(statusCode: number, headers: MutableMap>): void { }
+}
+
+interface NetworkUploadFileListener {
+ progressListeners: ArrayList;
+ onProgress(progressUpdate: OnProgressUpdateResult): void;
+ onComplete(option: UTSJSONObject): void;
+}
+
+interface NetworkDownloadFileListener {
+ progressListeners: ArrayList;
+ onProgress(progressUpdate: OnProgressDownloadResult): void;
+ onComplete(option: UTSJSONObject): void;
+}
+
+
+class NetworkRequestTaskImpl implements RequestTask {
+ private call: Call | null = null;
+ constructor(call: Call) {
+ this.call = call;
+ }
+
+ public abort() {
+ if (this.call != null) {
+ this.call?.cancel();
+ }
+ }
+}
+
+
+
+
+class NetworkManager {
+
+ private static instance: NetworkManager | null = null;
+
+ private static connectPool: ConnectionPool | null = null;
+
+ /**
+ * request的线程池
+ */
+ private requestExecutorService: ExecutorService | null = null;
+
+ public static getInstance(): NetworkManager {
+ if (this.instance == null) {
+ this.instance = new NetworkManager();
+ }
+ return this.instance!;
+ }
+
+
+
+ public request(param: RequestOptions, listener: NetworkRequestListener): RequestTask | null {
+ if (listener != null) {
+ listener.onStart();
+ }
+ let client = this.createRequestClient(param!);
+ let request = this.createRequest(param!, listener!);
+ if (request == null) {
+ return null;
+ }
+ let call: Call = client.newCall(request);
+
+ call.enqueue(new SimpleCallback(listener));
+
+ let task = new NetworkRequestTaskImpl(call);
+ return task;
+ }
+
+ public createRequestClient(param: RequestOptions): OkHttpClient {
+ let clientBuilder = OkHttpClient.Builder();
+ const timeout: Long = param.timeout != null ? param.timeout!.toLong() : 60000;
+ clientBuilder.connectTimeout(timeout, TimeUnit.MILLISECONDS);
+ clientBuilder.readTimeout(timeout, TimeUnit.MILLISECONDS);
+ clientBuilder.writeTimeout(timeout, TimeUnit.MILLISECONDS);
+ clientBuilder.callTimeout(timeout, TimeUnit.MILLISECONDS);
+ clientBuilder.protocols(Collections.singletonList(Protocol.HTTP_1_1));
+
+ clientBuilder.addInterceptor(new CookieInterceptor());
+
+
+
+ if (param.firstIpv4 != null) {
+ let firstIpv4 = param.firstIpv4!;
+ if (firstIpv4) {
+ let okDns = new OKDns();
+ clientBuilder.dns(okDns);
+ }
+ }
+ // let requestHost = Uri.parse(param.url).getHost();
+
+ //todo tls暂时搁置
+ //todo 把call保存起来, 存储到task里面,等待调用。
+ // let tlsOption: UTSJSONObject = param.tls;
+ // if (tlsOption != null) {
+ // let sslConfig = new SSLConfig();
+ // sslConfig.setKeystore(tlsOption['keystore']);
+ // sslConfig.setStorePass(tlsOption['storePass']);
+ // let caArray:JSONArray = tlsOption['ca'];
+ // let caParam:Array = null;
+ // if (caArray != null){
+ // caParam = caArray.toArray(emptyArray());
+ // }
+ // sslConfig.setCa(caParam);
+
+ // clientBuilder.sslSocketFactory(SSLFactoryManager.getInstance().getSSLSocketFactory(sslConfig));
+ // clientBuilder.hostnameVerifier(OkHostnameVerifier.INSTANCE);
+ // }
+
+ if (NetworkManager.connectPool == null) {
+ NetworkManager.connectPool = new ConnectionPool();
+ }
+
+ clientBuilder.connectionPool(NetworkManager.connectPool);
+
+ if (this.requestExecutorService == null) {
+ this.requestExecutorService = Executors.newFixedThreadPool(10);
+ }
+
+ clientBuilder.dispatcher(new Dispatcher(this.requestExecutorService));
+
+ return clientBuilder.build();
+ }
+
+ public createRequest(param: RequestOptions, listener: NetworkRequestListener): Request | null {
+
+ let requestBilder = new Request.Builder();
+ try {
+ requestBilder.url(param.url);
+ } catch (e: Exception) {
+ let option = {};
+ option['statusCode'] = '-1';
+ option['errorCode'] = '600009';
+ option['errorMsg'] = "invalid URL";
+ option['cause'] = e;
+ if (listener != null) {
+ listener.onComplete(option);
+ }
+ return null;
+ }
+
+ let ua = UTSAndroid.getWebViewInfo(UTSAndroid.getAppContext()!)["ua"].toString();
+ requestBilder.header("User-Agent", ua);
+
+ if (param.header == null) {
+ param.header = {}
+ }
+
+ let contentType = "application/x-www-form-urlencoded; charset=UTF-8";
+ let hasContentType = false;
+ let headers = param.header!.toJSONObject() as JSONObject;
+ for (key in headers.keys) {
+ if (key.equals("Content-Type", true)) {
+ contentType = "" + headers![key]!;
+ hasContentType = true;
+ }
+ requestBilder.header(key, "" + headers[key]);
+ }
+
+ if (!hasContentType) {
+ if (!"GET".equals(param.method)) {
+ contentType = "application/json";
+ }
+ }
+
+ if ("POST".equals(param.method) || "PUT".equals(param.method) || "PATCH".equals(param.method) || "DELETE".equals(param.method)) {
+ if (param.data != null && listener != null) {
+ listener.onProgress(0);
+ }
+
+ let body: string = "";
+ if (param.data != null) {
+ if (typeof(param.data) == 'string') {
+ body = param.data as string;
+ } else if (param.data instanceof UTSJSONObject){
+ if(contentType.indexOf("application/x-www-form-urlencoded") == 0){
+ const data = param.data as UTSJSONObject;
+ const map:Map = data.toMap();
+ const bodyArray = new Array();
+ map.forEach((value, key)=>{
+ bodyArray.push(key + "="+ value);
+ })
+ body = bodyArray.join("&");
+ }else{
+ body = JSON.stringify(param.data);
+ }
+ }
+ }
+ let requestBody = RequestBody.create(MediaType.parse(contentType), body);
+ requestBilder.method(param.method, requestBody);
+ if (listener != null) {
+ listener.onProgress(100);
+ }
+ } else if ("HEAD".equals(param.method)) {
+ requestBilder.head();
+ }else if ("OPTIONS".equals(param.method)) {
+ requestBilder.method(param.method, null);
+ } else if (param.method == null || "GET".equals(param.method)){
+ const data = param.data;
+ if (data != null) {
+ let json: UTSJSONObject | null = null;
+ if (typeof(data) == 'string') {
+ json = JSON.parseObject(data as string);
+ }else if(data instanceof UTSJSONObject) {
+ json = data;
+ }
+ if (json != null){
+ let url = param.url;
+ try {
+ requestBilder.url(this.stringifyQuery(url, json));
+ } catch (e: Exception) {
+ let option = {};
+ option['statusCode'] = '-1';
+ option['errorCode'] = '600009';
+ option['errorMsg'] = "invalid URL";
+ option['cause'] = e;
+ if (listener != null) {
+ listener.onComplete(option);
+ }
+ return null;
+ }
+ }
+ }
+ }
+
+
+ return requestBilder.build();
+ }
+
+ /**
+ * data拼接到url上
+ */
+ private stringifyQuery(url: string, data: UTSJSONObject) : string{
+ let newUrl = url;
+ //http:xxx/xxx?a=b&c=d#123
+ let str = url.split('#')
+ let hash = ''
+ if(str.length > 1){
+ hash = str[1] //123
+ }
+ str = str[0].split('?')
+ let query = ''
+ if(str.length > 1){
+ query = str[1] //a=b&c=d
+ }
+ newUrl = str[0] // http:xxx/xxx
+ const pairs = query.split('&')
+ const queryMap = new Map();
+ pairs.forEach((item, _)=>{
+ const temp = item.split('=')
+ if(temp.length > 1){
+ queryMap[temp[0]] = temp[1]
+ }
+ });
+ const dataMap: Map = data.toMap();
+ dataMap.forEach((value, key)=>{
+ if (value instanceof UTSJSONObject || value instanceof Array){
+ queryMap[key] = JSON.stringify(value);
+ }else{
+ queryMap[key] = "" + value;
+ }
+ })
+ let queryStr = "";
+ queryMap.forEach((value, key)=>{
+ queryStr += key + "=" + value + "&"
+ });
+ queryStr = queryStr.slice(0, -1);
+ if(queryStr.length > 0){
+ newUrl += "?" + queryStr;
+ }
+ if(hash.length > 0){
+ newUrl += "#" + hash;
+ }
+ return newUrl;
+ }
+
+
+ public uploadFile(options: UploadFileOptions, listener: NetworkUploadFileListener): UploadTask | null {
+ return UploadController.getInstance().uploadFile(options, listener);
+ }
+
+ public downloadFile(options: DownloadFileOptions, listener: NetworkDownloadFileListener): DownloadTask | null {
+ return DownloadController.getInstance().downloadFile(options, listener);
+ }
+
+
+}
+
+class SimpleCallback implements Callback {
+ private listener?: NetworkRequestListener = null;
+ constructor(listener: NetworkRequestListener) {
+ this.listener = listener;
+ }
+
+ override onResponse(call: Call, response: Response): void {
+ let headers: Headers = response.headers();
+ let headerMap = headers.toMultimap();
+ let code = response.code();
+ let option = {};
+ option["statusCode"] = code + "";
+
+ let pListener = this.listener;
+
+ if (pListener != null) {
+ pListener.onHeadersReceived(code, headerMap);
+ }
+
+ let rawStream = response.body()!.byteStream()!;
+ if (response.isSuccessful()) {
+ option['originalData'] = this.readInputStreamAsBytes(rawStream, this.listener);
+ } else {
+ option['errorMsg'] = this.readInputStream(rawStream, this.listener);
+ }
+
+ if (pListener != null) {
+ pListener.onComplete(option);
+ }
+ }
+ override onFailure(call: Call, e: IOException): void {
+ let pListener = this.listener;
+ let option = {};
+ option['statusCode'] = '-1';
+ option['errorCode'] = '602001';
+ option['errorMsg'] = e.message;
+ option['cause'] = e;
+ if (pListener != null) {
+ pListener.onComplete(option);
+ }
+ }
+
+
+ private readInputStreamAsBytes(inputSteam?: InputStream, listener?: NetworkRequestListener): ByteArray | null {
+ if (inputSteam == null) {
+ return null;
+ }
+ let buffer = new ByteArrayOutputStream();
+
+ let readCount = 0;
+ let data = new ByteArray(2048);
+
+ do {
+ let len = inputSteam.read(data, 0, data.size);
+ if (len == -1) {
+ break;
+ }
+ buffer.write(data, 0, len);
+ readCount += len;
+ if (listener != null) {
+ listener.onProgress(readCount);
+ }
+
+ } while (true);
+
+ buffer.flush();
+ return buffer.toByteArray();
+ }
+
+ private readInputStream(inputSteam?: InputStream, listener?: NetworkRequestListener): string | null {
+ if (inputSteam == null) {
+ return null;
+ }
+
+ let builder = new StringBuilder();
+ let localBufferedReader = new BufferedReader(new InputStreamReader(inputSteam));
+ let data = new CharArray(2048);
+ do {
+ let len = localBufferedReader.read(data);
+ if (len == -1) {
+ break;
+ }
+ builder.append(data, 0, len);
+ if (listener != null) {
+ listener.onProgress(builder.length);
+ }
+ } while (true);
+ localBufferedReader.close();
+
+ return builder.toString();
+ }
+}
+
+
+export {
+ NetworkManager,
+ NetworkRequestListener,
+ NetworkUploadFileListener,
+ NetworkDownloadFileListener
+}
\ No newline at end of file
diff --git a/uni_modules/uni-network/utssdk/app-android/network/OKDns.uts b/uni_modules/uni-network/utssdk/app-android/network/OKDns.uts
new file mode 100644
index 0000000000000000000000000000000000000000..94d68c58b4b6a60a1eac059c4268fdb08292b2d6
--- /dev/null
+++ b/uni_modules/uni-network/utssdk/app-android/network/OKDns.uts
@@ -0,0 +1,32 @@
+import Dns from 'okhttp3.Dns';
+import UnknownHostException from 'java.net.UnknownHostException';
+import InetAddress from 'java.net.InetAddress';
+import Inet4Address from 'java.net.Inet4Address';
+
+export class OKDns implements Dns {
+
+ public override lookup(hostName: string): kotlin.collections.MutableList {
+ if (hostName == null) {
+ throw UnknownHostException("hostname == null");
+ } else {
+ try {
+ let inetAddressesList: Array = [];
+ let inetAddresses = InetAddress.getAllByName(hostName);
+ for (inetAddress in inetAddresses) {
+ if (inetAddress instanceof Inet4Address) {
+ inetAddressesList.unshift(inetAddress)
+ } else {
+ inetAddressesList.push(inetAddress);
+ }
+ }
+ return inetAddressesList;
+ } catch (e: Exception) {
+ let unknownHostException = new UnknownHostException("error");
+ unknownHostException.initCause(e);
+ throw unknownHostException;
+ }
+
+ }
+ }
+}
+
diff --git a/uni_modules/uni-network/utssdk/app-android/network/StatusCode.uts b/uni_modules/uni-network/utssdk/app-android/network/StatusCode.uts
new file mode 100644
index 0000000000000000000000000000000000000000..7b96af14541a28e79a6dd7daf2549f0c951f98aa
--- /dev/null
+++ b/uni_modules/uni-network/utssdk/app-android/network/StatusCode.uts
@@ -0,0 +1,80 @@
+
+
+
+class StatusCode {
+ public static statusCodeMap : Map | null = null;
+
+ private static initStatusCodeMap() {
+ let map = new Map();
+ this.statusCodeMap = map;
+ map.set('100', "Continue");
+ map.set('101', "Switching Protocol");
+ map.set('200', "OK");
+ map.set('201', "Created");
+ map.set('202', "Accepted");
+ map.set('203', "Non-Authoritative Information");
+ map.set('204', "No Content");
+ map.set('205', "Reset Content");
+ map.set('206', "Partial Content");
+ map.set('300', "Multiple Choice");
+ map.set('301', "Moved Permanently");
+ map.set('302', "Found");
+ map.set('303', "See Other");
+ map.set('304', "Not Modified");
+ map.set('305', "Use Proxy");
+ map.set('306', "unused");
+ map.set('307', "Temporary Redirect");
+ map.set('308', "Permanent Redirect");
+ map.set('400', "Bad Request");
+ map.set('401', "Unauthorized");
+ map.set('402', "Payment Required");
+ map.set('403', "Forbidden");
+ map.set('404', "Not Found");
+ map.set('405', "Method Not Allowed");
+ map.set('406', "Not Acceptable");
+ map.set('407', "Proxy Authentication Required");
+ map.set('408', "Request Timeout");
+ map.set('409', "Conflict");
+ map.set('410', "Gone");
+ map.set('411', "Length Required");
+ map.set('412', "Precondition Failed");
+ map.set('413', "Payload Too Large");
+ map.set('414', "URI Too Long");
+ map.set('415', "Unsupported Media Type");
+ map.set('416', "Requested Range Not Satisfiable");
+ map.set('417', "Expectation Failed");
+ map.set('418', "I'm a teapot");
+ map.set('421', "Misdirected Request");
+ map.set('426', "Upgrade Required");
+ map.set('428', "Precondition Required");
+ map.set('429', "Too Many Requests");
+ map.set('431', "Request Header Fields Too Large");
+ map.set('500', "Internal Server Error");
+ map.set('501', "Not Implemented");
+ map.set('502', "Bad Gateway");
+ map.set('503', "Service Unavailable");
+ map.set('504', "Gateway Timeout");
+ map.set('505', "HTTP Version Not Supported");
+ map.set('506', "Variant Also Negotiates");
+ map.set('507', "Variant Also Negotiates");
+ map.set('511', "Network Authentication Required");
+ }
+
+ public static getStatus(code : string) : string {
+ let map = this.statusCodeMap;
+ if (map == null) {
+ this.initStatusCodeMap();
+ }
+ let tmp = this.statusCodeMap!;
+ if (!(tmp.has(code))) {
+ return 'unknown status';
+ } else {
+ return tmp.get(code)! as string;
+ }
+ }
+}
+
+
+export {
+ StatusCode
+}
diff --git a/uni_modules/uni-network/utssdk/app-android/network/download/DownloadController.uts b/uni_modules/uni-network/utssdk/app-android/network/download/DownloadController.uts
new file mode 100644
index 0000000000000000000000000000000000000000..5b64c7016710f754f7c2e1f0262dc176bea30905
--- /dev/null
+++ b/uni_modules/uni-network/utssdk/app-android/network/download/DownloadController.uts
@@ -0,0 +1,462 @@
+import { DownloadFileOptions, DownloadTask, DownloadFileProgressUpdateCallback, OnProgressDownloadResult } from '../../../interface.uts';
+import { NetworkDownloadFileListener } from '../NetworkManager.uts'
+import OkHttpClient from 'okhttp3.OkHttpClient';
+import TimeUnit from 'java.util.concurrent.TimeUnit';
+import ExecutorService from 'java.util.concurrent.ExecutorService';
+import Executors from 'java.util.concurrent.Executors';
+import Dispatcher from 'okhttp3.Dispatcher';
+import Callback from 'okhttp3.Callback';
+import Response from 'okhttp3.Response';
+import Request from 'okhttp3.Request';
+import UTSAndroid from 'io.dcloud.uts.UTSAndroid';
+import Call from 'okhttp3.Call';
+import IOException from 'java.io.IOException';
+import ResponseBody from 'okhttp3.ResponseBody';
+import File from 'java.io.File';
+import BufferedSink from 'okio.BufferedSink';
+import BufferedSource from 'okio.BufferedSource';
+import Okio from 'okio.Okio';
+import TextUtils from 'android.text.TextUtils';
+import StringTokenizer from 'java.util.StringTokenizer';
+import MimeTypeMap from 'android.webkit.MimeTypeMap';
+import URLDecoder from 'java.net.URLDecoder';
+import CookieManager from 'android.webkit.CookieManager';
+import KotlinArray from 'kotlin.Array';
+import Context from 'android.content.Context';
+import Environment from 'android.os.Environment';
+
+class NetworkDownloadTaskImpl implements DownloadTask {
+ private call : Call | null = null;
+ private listener : NetworkDownloadFileListener | null = null;
+ constructor(call : Call, listener : NetworkDownloadFileListener) {
+ this.call = call;
+ this.listener = listener;
+ }
+
+ public abort() {
+ if (this.call != null) {
+ this.call?.cancel();
+ }
+ }
+
+ public onProgressUpdate(option : DownloadFileProgressUpdateCallback) {
+ const kListener = this.listener;
+ if (kListener != null) {
+ kListener.progressListeners.add(option);
+ }
+ }
+}
+
+
+
+export class DownloadController {
+ private static instance : DownloadController | null = null
+
+ /**
+ * 上传的线程池
+ */
+ private downloadExecutorService : ExecutorService | null = null;
+
+ public static getInstance() : DownloadController {
+ if (this.instance == null) {
+ this.instance = new DownloadController();
+ }
+ return this.instance!;
+ }
+
+ public downloadFile(options : DownloadFileOptions, listener : NetworkDownloadFileListener) : DownloadTask | null {
+ const client = this.createDownloadClient(options);
+ let request = this.createDownloadRequest(options, listener);
+ if (request == null) {
+ return null;
+ }
+ let call : Call = client.newCall(request);
+ call.enqueue(new SimpleDownloadCallback(listener, options.filePath ?? ""));
+
+ let task = new NetworkDownloadTaskImpl(call, listener);
+
+ return task;
+ }
+
+
+
+
+ private createDownloadClient(option : DownloadFileOptions) : OkHttpClient {
+
+ let clientBuilder = OkHttpClient.Builder();
+ const timeout : Long = option.timeout != null ? option.timeout!.toLong() : 120000;
+ clientBuilder.connectTimeout(timeout, TimeUnit.MILLISECONDS);
+ clientBuilder.readTimeout(timeout, TimeUnit.MILLISECONDS);
+ clientBuilder.writeTimeout(timeout, TimeUnit.MILLISECONDS);
+ clientBuilder.callTimeout(timeout, TimeUnit.MILLISECONDS);
+
+ if (this.downloadExecutorService == null) {
+ this.downloadExecutorService = Executors.newFixedThreadPool(10);
+ }
+
+ clientBuilder.dispatcher(new Dispatcher(this.downloadExecutorService));
+
+ return clientBuilder.build();
+ }
+
+ private createDownloadRequest(options : DownloadFileOptions, listener : NetworkDownloadFileListener) : Request | null {
+ let requestBilder = new Request.Builder();
+ try {
+ requestBilder.url(options.url);
+ } catch (e : Exception) {
+ let option = {};
+ option['statusCode'] = '-1';
+ option['errorCode'] = '-1';
+ option['errorMsg'] = "invalid URL";
+ option['cause'] = e;
+ if (listener != null) {
+ listener.onComplete(option);
+ }
+ return null;
+ }
+
+ let ua = UTSAndroid.getWebViewInfo(UTSAndroid.getAppContext()!)["ua"].toString();
+ requestBilder.header("User-Agent", ua);
+
+ const headers = options.header?.toMap();
+ if (headers != null) {
+ for (entry in headers) {
+ const key = entry.key;
+ const value = entry.value;
+
+ if (value != null) {
+ requestBilder.addHeader(key, "" + value);
+ } else {
+ continue;
+ }
+ }
+ }
+
+ return requestBilder.build();
+ }
+
+}
+
+class SimpleDownloadCallback implements Callback {
+ private downloadFilePath = "/download/";
+ private listener : NetworkDownloadFileListener | null = null;
+ private specifyPath = "";
+ constructor(listener : NetworkDownloadFileListener, specifyPath : string) {
+ this.listener = listener;
+ this.specifyPath = specifyPath;
+ }
+
+
+ override onFailure(call : Call, exception : IOException) {
+ let option = {};
+ option['statusCode'] = '-1';
+ option['errorCode'] = '-1';
+ option['errorMsg'] = exception.message;
+ option['cause'] = exception;
+ this.listener?.onComplete(option);
+ }
+ override onResponse(call : Call, response : Response) {
+ if (response.isSuccessful()) {
+ const source = response.body()?.source()
+ if (source != null) {
+ this.setCookie(response);
+ const tempFile = this.getTempFile()
+ let tempSink : BufferedSink | null = null;
+ let tempSource : BufferedSource | null = null;
+ let targetSink : BufferedSink | null = null;
+ try {
+ tempSink = Okio.buffer(Okio.sink(tempFile));
+ let totalBytesRead : Long = 0;
+ const contentLength = response.body()!!.contentLength();
+ const bufferSize : Int = 8 * 1024;
+ const buffer = ByteArray(bufferSize);
+
+
+ do {
+ let bytesRead = source.read(buffer);
+ if (bytesRead == -1) {
+ break;
+ }
+
+
+ tempSink.write(buffer, 0, bytesRead)
+ totalBytesRead += bytesRead.toLong();
+ const progress = (totalBytesRead.toFloat() / contentLength) * 100
+ let downloadProgressUpdate : OnProgressDownloadResult = {
+ progress: progress,
+ totalBytesWritten: totalBytesRead,
+ totalBytesExpectedToWrite: contentLength
+ }
+ this.listener?.onProgress(downloadProgressUpdate);
+
+ } while (true)
+
+ tempSink.flush()
+
+ tempSource = Okio.buffer(Okio.source(tempFile));
+ let targetFile = this.getFile(response)
+ targetSink = Okio.buffer(Okio.sink(targetFile));
+ targetSink.writeAll(tempSource);
+ targetSink.flush();
+
+ let option = {};
+ option['statusCode'] = response.code() + "";
+ if (targetFile.exists()) {
+ option['tempFilePath'] = targetFile.getPath();
+ }
+ this.listener?.onComplete(option);
+ } finally {
+ tempSink?.close()
+ targetSink?.close()
+ tempSource?.close()
+ tempFile.delete()
+ }
+ }
+
+ } else {
+ let option = {};
+ const code = response.code() + "";
+ const errorMsg = response.body()?.string();
+ option['statusCode'] = code;
+ option['errorCode'] = code;
+ option['errorMsg'] = errorMsg;
+ option['cause'] = null;
+ this.listener?.onComplete(option);
+ }
+ }
+
+ setCookie(response : Response) {
+ const setCookie = response.header("Set-Cookie")
+ if (!TextUtils.isEmpty(setCookie)) {
+ CookieManager.getInstance().setCookie(response.request().url().toString(), setCookie);
+ }
+ }
+
+ getTempFile() : File {
+ return new File(UTSAndroid.getAppContext()!.getExternalCacheDir(), "temp_" + System.currentTimeMillis())
+ }
+
+
+ getRealPath() : string {
+ var path = UTSAndroid.getAppTempPath() ?? "";
+ return path + this.downloadFilePath;
+ }
+
+ getFile(response : Response) : File {
+ let targetPath = "";
+ if (this.specifyPath != "") {
+ const sourcePath = UTSAndroid.convert2AbsFullPath("/");
+ const sourceFileDir = new File(sourcePath);
+ if (this.isDescendant(sourceFileDir, new File(this.specifyPath))) {
+ let option = {};
+ option['statusCode'] = '-1';
+ option['errorCode'] = '602001';
+ option['errorMsg'] = "This path is not supported";
+ option['cause'] = null;
+ this.listener?.onComplete(option);
+ return new File("")
+ }
+
+ const pos = this.specifyPath.lastIndexOf("/")
+ if (pos == this.specifyPath.length - 1) {
+ //如果filePath是目录
+ if (this.isAbsolute(this.specifyPath)) {
+ targetPath = this.specifyPath;
+ } else {
+ targetPath = UTSAndroid.getAppTempPath()!! + "/" + this.specifyPath
+ }
+ } else {
+ let path = "";
+ if (this.isAbsolute(this.specifyPath)) {
+ path = this.specifyPath;
+ } else {
+ path = UTSAndroid.getAppTempPath()!! + "/" + this.specifyPath;
+ }
+
+ const file = new File(path)
+ const parentFile = file.getParentFile()
+ if (parentFile != null) {
+ if (!parentFile.exists()) {
+ parentFile.mkdirs()
+ }
+ }
+ if (file.exists() && file.isDirectory()) {
+ let option = {};
+ option['statusCode'] = '-1';
+ option['errorCode'] = '602001';
+ option['errorMsg'] = "The target file path is already a directory file, and file creation failed.";
+ option['cause'] = null;
+ this.listener?.onComplete(option);
+ }
+
+ if (!file.exists()) {
+ try {
+ file.createNewFile()
+ } catch (exception : Exception) {
+ let option = {};
+ option['statusCode'] = '-1';
+ option['errorCode'] = '602001';
+ option['errorMsg'] = exception.message;
+ option['cause'] = exception;
+ this.listener?.onComplete(option);
+ }
+ }
+ return file
+ }
+ } else {
+ targetPath = this.getRealPath();
+ }
+
+
+ let fileName = "";
+ let remoteFileName = response.header("content-disposition");
+ if (!TextUtils.isEmpty(remoteFileName)) {
+ // form-data; name="file"; filename="xxx.pdf"
+ const segments : KotlinArray | null = this.stringSplit(remoteFileName, ";")
+ if (segments != null) {
+ for (let i : Int = 0; i < segments.size; i++) {
+ const segment = segments[i];
+ if (segment != null) {
+ if (segment.contains("filename")) {
+ const pair = this.stringSplit(segment.trim(), "=") //目前认为只存在一个键值对
+ if (pair != null) {
+ let key = pair[0];
+ let value = pair[1];
+ if (key != null) {
+ key = key.replace("\"", "");
+ }
+ if (value != null) {
+ value = value.replace("\"", "");
+ }
+
+ if (!TextUtils.isEmpty(key) && !TextUtils.isEmpty(value) && key!.equals("filename", true)) {
+ if (value != null) {
+ fileName = value;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ if (TextUtils.isEmpty(fileName)) {
+ let path = response.request().url().encodedPath()
+ let pos = path.lastIndexOf('/')
+ if (pos >= 0) {
+ path = path.substring(pos + 1)
+ if (path.indexOf('.') >= 0) { //存在后缀,则认为成功
+ if (path.contains("?")) {
+ path = path.substring(0, path.indexOf("?"))
+ }
+ fileName = path
+ }
+ }
+ }
+
+
+ if (TextUtils.isEmpty(fileName)) {
+ fileName = System.currentTimeMillis().toString()
+ const contentType = response.header("content-type")
+ let type = MimeTypeMap.getSingleton().getExtensionFromMimeType(contentType);
+ if (type != null) {
+ fileName += "." + type;
+ }
+ }
+
+ fileName = URLDecoder.decode(fileName, "UTF-8")
+ fileName = fileName.replace(File.separator.toRegex(), "")
+ if (fileName.contains("?")) {
+ fileName = fileName.replace("\\?".toRegex(), "0")
+ }
+ if (fileName.length > 80) {
+ const subFileName : String = fileName.substring(0, 80)
+ fileName = subFileName + System.currentTimeMillis()
+ }
+
+ targetPath += fileName
+
+ if (new File(targetPath).exists()) {
+ const index = targetPath.lastIndexOf(".");
+ let tFileName = targetPath;
+ let tFileType = "";
+ if (index >= 0) {
+ tFileName = targetPath.substring(0, index)
+ tFileType = targetPath.substring(index)
+ }
+
+ var number = 1
+ while (new File(targetPath).exists()) {
+ targetPath = tFileName + "(" + number + ")" + tFileType;
+ number++
+ }
+ }
+
+ const file = new File(targetPath)
+ const parentFile = file.getParentFile()
+ if (parentFile != null) {
+ if (!parentFile.exists()) {
+ parentFile.mkdirs()
+ }
+ }
+ if (!file.exists()) {
+ try {
+ file.createNewFile()
+ } catch (exception : Exception) {
+ let option = {};
+ option['statusCode'] = '-1';
+ option['errorCode'] = '602001';
+ option['errorMsg'] = exception.message;
+ option['cause'] = exception;
+ this.listener?.onComplete(option);
+ }
+ }
+ return file
+ }
+
+ isAbsolute(path : string) : boolean {
+ const context = UTSAndroid.getAppContext()!! as Context;
+ if (path.startsWith(context.getFilesDir().getParent())) {
+ return true;
+ }
+
+ const exPath = context.getExternalFilesDir(null)?.getParent();
+ if (exPath != null && path.startsWith(exPath)) {
+ return true;
+ }
+
+ return false;
+ }
+
+ /**
+ * 判断两个文件的上下级关系
+ */
+ isDescendant(parent : File, child : File) : boolean {
+ //有可能开发者传入的是/sdcard 或者/storage/emulated/ 这样的文件路径, 所以要用软连接的实际文件路径进行对比.
+ if (child.getCanonicalPath() == parent.getCanonicalPath()) {
+ return true;
+ }
+ let parentFile = child.getParentFile();
+
+ if (parentFile == null) {
+ return false;
+ }
+ return this.isDescendant(parent, parentFile);
+ }
+
+
+ stringSplit(str : String | null, delim : String | null) : KotlinArray | null {
+ if (!TextUtils.isEmpty(str) && !TextUtils.isEmpty(delim)) {
+ const stringTokenizer = new StringTokenizer(str, delim, false);
+ const result = arrayOfNulls(stringTokenizer.countTokens())
+ var index : Int = 0
+ while (stringTokenizer.hasMoreElements()) {
+ result[index] = stringTokenizer.nextToken().trim()
+ index += 1
+ }
+ return result
+ }
+ return null
+ }
+}
\ No newline at end of file
diff --git a/uni_modules/uni-network/utssdk/app-android/network/interceptor/CookieInterceptor.uts b/uni_modules/uni-network/utssdk/app-android/network/interceptor/CookieInterceptor.uts
new file mode 100644
index 0000000000000000000000000000000000000000..9baef0cd7c2995f434a788d7620ad1f59e8c671a
--- /dev/null
+++ b/uni_modules/uni-network/utssdk/app-android/network/interceptor/CookieInterceptor.uts
@@ -0,0 +1,82 @@
+import Interceptor from 'okhttp3.Interceptor';
+import Response from 'okhttp3.Response';
+import CookieHandler from 'java.net.CookieHandler';
+import TreeMap from 'java.util.TreeMap';
+import Headers from 'okhttp3.Headers';
+import Request from 'okhttp3.Request';
+class CookieInterceptor implements Interceptor {
+
+ override intercept(chain : Interceptor.Chain) : Response {
+ let request = chain.request()
+ let headerCookie = request.header("cookie")
+ let uri = request.url().uri()
+ let cookieHandler = CookieHandler.getDefault()
+ if (headerCookie == null) {
+ let requestBuilder = request.newBuilder()
+ try {
+ let currentHeaders = this.toMap(request.headers())
+ let localCookie = cookieHandler.get(uri, currentHeaders)
+ this.addCookies(requestBuilder, localCookie)
+ } catch (e : Exception) {
+ }
+ request = requestBuilder.build()
+ }
+
+ let response = chain.proceed(request)
+
+ try {
+ cookieHandler.put(uri, this.toMap(response.headers()))
+ } catch (e : Exception) {
+ }
+
+ return response
+ }
+
+ private toMap(headers : Headers) : MutableMap> {
+ let result : MutableMap> = new TreeMap(String.CASE_INSENSITIVE_ORDER)
+ let size = headers.size()
+ for (let i:Int = 0; i < size; i++) {
+ let name = headers.name(i)
+ let values = result[name]
+ if (values == null) {
+ values = arrayListOf()
+ result[name] = values
+ }
+ values.add(headers.value(i))
+ }
+ return result
+ }
+
+ private addCookies(builder : Request.Builder, localCookie : MutableMap>) : void {
+
+ let totalList = mutableListOf()
+ let flagList = mutableListOf()
+ for (key in localCookie.keys) {
+ if (flagList.size == 2) {
+ break
+ }
+ if ("cookie".equals(key, true) || "cookie2".equals(key, true)) {
+ flagList.add(key)
+ let cookieList = localCookie[key]
+ if (!cookieList.isNullOrEmpty()) {
+ totalList.addAll(cookieList)
+ }
+ }
+ }
+ let headerStr = new StringBuilder()
+ for (let str in totalList) {
+ headerStr.append(str)
+ headerStr.append("; ")
+ }
+ if (headerStr.toString().endsWith("; ")) {
+ headerStr.deleteRange(headerStr.length - 2, headerStr.length - 1)
+ }
+ if (!headerStr.toString().isEmpty()){
+ builder.addHeader("Cookie", headerStr.toString())
+ }
+ }
+}
+
+export {
+ CookieInterceptor
+}
\ No newline at end of file
diff --git a/uni_modules/uni-network/utssdk/app-android/network/tls/SSLConfig.uts b/uni_modules/uni-network/utssdk/app-android/network/tls/SSLConfig.uts
new file mode 100644
index 0000000000000000000000000000000000000000..e7787f20eb6c72291ce8710e8998720cd28d91be
--- /dev/null
+++ b/uni_modules/uni-network/utssdk/app-android/network/tls/SSLConfig.uts
@@ -0,0 +1,48 @@
+import Arrays from 'java.util.Arrays';
+import KotlinArray from 'kotlin.Array'
+
+class SSLConfig {
+
+ private keystore ?: string = null;
+ private storePass ?: string = null;
+ private ca ?: KotlinArray = null;
+
+ public getKeystore() : string | null {
+ return this.keystore;
+ }
+
+ public setKeystore(ks : string) {
+ if (ks == null) {
+ ks = "";
+ }
+ this.keystore = ks;
+ }
+
+ public getStorePass() : string | null {
+ return this.storePass;
+ }
+
+ public setStorePass(sp : string) {
+ if (sp == null) {
+ sp = "";
+ }
+ this.storePass = sp;
+ }
+
+
+ public getCa() : KotlinArray | null {
+ return this.ca;
+ }
+
+ public setCa(ca : KotlinArray) {
+ if (ca == null) {
+ ca = emptyArray();
+ }
+ this.ca = ca;
+ }
+}
+
+
+export {
+ SSLConfig
+}
\ No newline at end of file
diff --git a/uni_modules/uni-network/utssdk/app-android/network/tls/SSLFactoryManager.uts b/uni_modules/uni-network/utssdk/app-android/network/tls/SSLFactoryManager.uts
new file mode 100644
index 0000000000000000000000000000000000000000..1d2fdcbbcd1dfb7dd7e45448cdd445817ea26176
--- /dev/null
+++ b/uni_modules/uni-network/utssdk/app-android/network/tls/SSLFactoryManager.uts
@@ -0,0 +1,65 @@
+import SSLSocketFactory from 'javax.net.ssl.SSLSocketFactory';
+import { SSLConfig } from './SSLConfig.uts'
+import SSLContext from 'javax.net.ssl.SSLContext';
+import KeyStore from 'java.security.KeyStore';
+import KeyManagerFactory from 'javax.net.ssl.KeyManagerFactory';
+import CertificateFactory from 'java.security.cert.CertificateFactory';
+import TextUtils from 'android.text.TextUtils';
+
+
+class SSLFactoryManager {
+ private static instance?: SSLFactoryManager = null;
+
+ private cacheSSLFactory: Map = new Map();
+
+ public static getInstance(): SSLFactoryManager {
+ if (this.instance == null) {
+ this.instance = SSLFactoryManager();
+ }
+ return this.instance!;
+ }
+
+ public getSSLSocketFactory(sslConfig: SSLConfig): SSLSocketFactory | null {
+ if (sslConfig == null) {
+ return null;
+ }
+
+
+ if (this.cacheSSLFactory.has(sslConfig)){
+ let sslFactory = this.cacheSSLFactory.get(sslConfig);
+ if (sslConfig != null){
+ return sslFactory;
+ }
+ }
+
+
+ try{
+ let sslContext = SSLContext.getInstance('TLS');
+ let keyStore = KeyStore.getInstance('PKCS12');
+ let keyManagerFactory = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm());
+
+ if (!TextUtils.isEmpty(sslConfig.getKeystore()) && !TextUtils.isEmpty(sslConfig.getStorePass())){
+ //todo 1. 这里需要解析keystore
+ // 2. 如果是文件需要转换一下路径,然后读出来。
+ // resolve : 原生层会提供bundleurl和运行模式的接口。
+
+ }else{
+ keyManagerFactory = null;
+ }
+
+ let certificateFactory = CertificateFactory.getInstance('X.509');
+ let caKeyStore = KeyStore.getInstance('PKCS12');
+
+
+
+ }catch(e : Exception){
+
+ }
+
+ return null;
+ }
+}
+
+export {
+ SSLFactoryManager
+}
\ No newline at end of file
diff --git a/uni_modules/uni-network/utssdk/app-android/network/upload/InputStreamRequestBody.uts b/uni_modules/uni-network/utssdk/app-android/network/upload/InputStreamRequestBody.uts
new file mode 100644
index 0000000000000000000000000000000000000000..0925757344b06910324e256f7c32991250634d86
--- /dev/null
+++ b/uni_modules/uni-network/utssdk/app-android/network/upload/InputStreamRequestBody.uts
@@ -0,0 +1,47 @@
+import RequestBody from 'okhttp3.RequestBody';
+import MediaType from 'okhttp3.MediaType';
+import InputStream from 'java.io.InputStream';
+import BufferedSink from 'okio.BufferedSink';
+import Source from 'okio.Source';
+import Okio from 'okio.Okio';
+import Util from 'okhttp3.internal.Util';
+
+
+
+export class InputStreamRequestBody extends RequestBody {
+ private mediaType : MediaType | null = null;
+ private length : Long = -1;
+ private inputStream : InputStream | null = null;
+
+ constructor(mediaType : MediaType, length : Long, inputStream : InputStream) {
+ super()
+ this.mediaType = mediaType;
+ this.length = length;
+ this.inputStream = inputStream;
+ }
+
+
+ override contentLength() : Long {
+ return this.length;
+ }
+
+ override contentType() : MediaType {
+ const type = this.mediaType;
+ if (type == null) {
+ return MediaType.parse("application/octet-stream")!;
+ } else {
+ return type;
+ }
+ }
+
+ override writeTo(sink : BufferedSink) {
+ let source : Source | null = null;
+ try {
+ source = Okio.source(this.inputStream);
+ sink.writeAll(source);
+ } catch (e) {
+ }
+ Util.closeQuietly(source);
+ }
+
+}
\ No newline at end of file
diff --git a/uni_modules/uni-network/utssdk/app-android/network/upload/ProgressRequestBody.uts b/uni_modules/uni-network/utssdk/app-android/network/upload/ProgressRequestBody.uts
new file mode 100644
index 0000000000000000000000000000000000000000..f025825b7fba8a04b310e5539e8ae617d92a2a40
--- /dev/null
+++ b/uni_modules/uni-network/utssdk/app-android/network/upload/ProgressRequestBody.uts
@@ -0,0 +1,62 @@
+import RequestBody from 'okhttp3.RequestBody';
+import MediaType from 'okhttp3.MediaType';
+import BufferedSink from 'okio.BufferedSink';
+import ForwardingSink from 'okio.ForwardingSink';
+import Sink from 'okio.Sink';
+import Buffer from 'okio.Buffer';
+import Okio from 'okio.Okio';
+
+export interface UploadProgressListener {
+ onProgress(bytesWritten : number, contentLength : number) : void;
+}
+
+class CountingSink extends ForwardingSink {
+ private listener : UploadProgressListener | null = null;
+ private bytesWritten : number = 0;
+ private total : number = 0;
+ constructor(sink : Sink, total : number, listener : UploadProgressListener) {
+ super(sink)
+ this.listener = listener;
+ this.total = total;
+ }
+
+ override write(source : Buffer, byteCount : Long) {
+ super.write(source, byteCount);
+ this.bytesWritten += byteCount;
+ this.listener?.onProgress(this.bytesWritten, this.total);
+ }
+
+}
+
+
+export class ProgressRequestBody extends RequestBody {
+ private requestBody : RequestBody | null = null;
+ private listener : UploadProgressListener | null = null;
+ constructor(requestBody : RequestBody, listener : UploadProgressListener) {
+ super();
+ this.requestBody = requestBody;
+ this.listener = listener;
+ }
+
+
+ override contentLength() : Long {
+ return this.requestBody?.contentLength() ?? 0;
+ }
+
+ override contentType() : MediaType {
+ const body = this.requestBody;
+ if (body == null) {
+ return MediaType.parse("application/octet-stream")!;
+ } else {
+ return body.contentType()!;
+ }
+ }
+
+ override writeTo(sink : BufferedSink) {
+ const countingSink = new CountingSink(sink, this.contentLength(), this.listener!);
+ const bufferedSink = Okio.buffer(countingSink);
+ this.requestBody?.writeTo(bufferedSink);
+ bufferedSink.flush();
+ }
+
+}
\ No newline at end of file
diff --git a/uni_modules/uni-network/utssdk/app-android/network/upload/UploadController.uts b/uni_modules/uni-network/utssdk/app-android/network/upload/UploadController.uts
new file mode 100644
index 0000000000000000000000000000000000000000..22c366779781b323b3f2adfb8924682af8d7a16c
--- /dev/null
+++ b/uni_modules/uni-network/utssdk/app-android/network/upload/UploadController.uts
@@ -0,0 +1,378 @@
+import { UploadFileOptions, UploadTask, UploadFileProgressUpdateCallback, UploadFileOptionFiles, OnProgressUpdateResult } from '../../../interface.uts';
+import { NetworkUploadFileListener } from '../NetworkManager.uts'
+import OkHttpClient from 'okhttp3.OkHttpClient';
+import TimeUnit from 'java.util.concurrent.TimeUnit';
+import ExecutorService from 'java.util.concurrent.ExecutorService';
+import Executors from 'java.util.concurrent.Executors';
+import RequestBody from 'okhttp3.RequestBody';
+import MediaType from 'okhttp3.MediaType';
+import UTSAndroid from 'io.dcloud.uts.UTSAndroid';
+import MultipartBody from 'okhttp3.MultipartBody';
+import Call from 'okhttp3.Call';
+import Dispatcher from 'okhttp3.Dispatcher';
+import Request from 'okhttp3.Request';
+import MimeTypeMap from 'android.webkit.MimeTypeMap';
+import TextUtils from 'android.text.TextUtils';
+import File from 'java.io.File';
+import Uri from 'android.net.Uri';
+import InputStream from 'java.io.InputStream';
+import MediaStore from 'android.provider.MediaStore';
+import FileInputStream from 'java.io.FileInputStream';
+import { InputStreamRequestBody } from './InputStreamRequestBody.uts';
+import { UploadProgressListener, ProgressRequestBody } from './ProgressRequestBody.uts'
+import Callback from 'okhttp3.Callback';
+import Response from 'okhttp3.Response';
+import IOException from 'java.io.IOException';
+import Retention from 'java.lang.annotation.Retention';
+import URI from 'java.net.URI';
+import Build from 'android.os.Build';
+import Environment from 'android.os.Environment';
+import UUID from 'java.util.UUID';
+
+
+class FileInformation {
+ public inputStream : InputStream | null = null;
+ public size : Long = -1;
+ public mime : string | null = null;
+ public name : string | null = null;
+}
+
+class NetworkUploadTaskImpl implements UploadTask {
+ private call : Call | null = null;
+ private listener : NetworkUploadFileListener | null = null;
+ constructor(call : Call, listener : NetworkUploadFileListener) {
+ this.call = call;
+ this.listener = listener;
+ }
+
+ public abort() {
+ if (this.call != null) {
+ this.call?.cancel();
+ }
+ }
+
+ public onProgressUpdate(option : UploadFileProgressUpdateCallback) {
+ const kListener = this.listener;
+ if (kListener != null) {
+ kListener.progressListeners.add(option);
+ }
+ }
+}
+
+class NetworkUploadProgressListener implements UploadProgressListener {
+ private listener : NetworkUploadFileListener | null = null;
+ constructor(listener : NetworkUploadFileListener) {
+ this.listener = listener;
+ }
+
+ onProgress(bytesWritten : number, contentLength : number) {
+ const progress = (bytesWritten.toFloat() / contentLength) * 100
+ const progressUpdate : OnProgressUpdateResult = {
+ progress: progress.toInt(),
+ totalBytesSent: bytesWritten,
+ totalBytesExpectedToSend: contentLength
+ }
+
+ this.listener?.onProgress(progressUpdate);
+ }
+}
+
+class UploadController {
+ private static instance : UploadController | null = null
+
+ /**
+ * 上传的线程池
+ */
+ private uploadExecutorService : ExecutorService | null = null;
+
+ public static getInstance() : UploadController {
+ if (this.instance == null) {
+ this.instance = new UploadController();
+ }
+ return this.instance!;
+ }
+
+ public uploadFile(options : UploadFileOptions, listener : NetworkUploadFileListener) : UploadTask | null {
+ const client = this.createUploadClient(options);
+
+ let request = this.createUploadRequest(options, listener);
+ if (request == null) {
+ return null;
+ }
+ let call : Call = client.newCall(request);
+ call.enqueue(new SimpleUploadCallback(listener));
+
+ let task = new NetworkUploadTaskImpl(call, listener);
+
+ return task;
+ }
+
+ private createUploadClient(option : UploadFileOptions) : OkHttpClient {
+
+ let clientBuilder = OkHttpClient.Builder();
+ const timeout : Long = option.timeout != null ? option.timeout!.toLong() : 120000;
+ clientBuilder.connectTimeout(timeout, TimeUnit.MILLISECONDS);
+ clientBuilder.readTimeout(timeout, TimeUnit.MILLISECONDS);
+ clientBuilder.writeTimeout(timeout, TimeUnit.MILLISECONDS);
+ clientBuilder.callTimeout(timeout, TimeUnit.MILLISECONDS);
+
+ if (this.uploadExecutorService == null) {
+ this.uploadExecutorService = Executors.newFixedThreadPool(10);
+ }
+
+ clientBuilder.dispatcher(new Dispatcher(this.uploadExecutorService));
+
+ return clientBuilder.build();
+ }
+
+
+ private createUploadRequest(options : UploadFileOptions, listener : NetworkUploadFileListener) : Request | null {
+ let requestBilder = new Request.Builder();
+ try {
+ requestBilder.url(options.url);
+ } catch (e : Exception) {
+ let option = {};
+ option['statusCode'] = '-1';
+ option['errorCode'] = '-1';
+ option['errorMsg'] = "invalid URL";
+ option['cause'] = "invalid URL";
+ if (listener != null) {
+ listener.onComplete(option);
+ }
+ return null;
+ }
+
+ let multiPartBody = (new MultipartBody.Builder("----" + UUID.randomUUID().toString())).setType(MultipartBody.FORM);
+
+ const formData = options.formData?.toMap();
+ if (formData != null) {
+ for (entry in formData) {
+ const key = entry.key;
+ const value = entry.value;
+ if (value != null) {
+ multiPartBody.addFormDataPart(key, "" + value);
+ } else {
+ continue;
+ }
+ }
+ }
+
+ const tempFiles = options.files;
+ if (tempFiles != null && tempFiles!.length > 0) {
+ const files : UploadFileOptionFiles[] = tempFiles;
+ for (let i = 0; i < files.length; i++) {
+ const file = files[i];
+ const path = file.uri;
+ const fileInformation = this.getFileInformation(path)
+ const name = file.name ?? "file";
+
+ const inputStream = fileInformation?.inputStream;
+ if (fileInformation != null && inputStream != null) {
+ let requestBody = new InputStreamRequestBody(MediaType.parse(fileInformation.mime ?? "*/*")!, fileInformation.size, inputStream);
+ multiPartBody.addFormDataPart(name, fileInformation.name, requestBody);
+ } else {
+ let option = {};
+ option['statusCode'] = '-1';
+ option['errorCode'] = '-1';
+ option['errorMsg'] = "Illegal file";
+ option['cause'] = "Illegal file";
+ if (listener != null) {
+ listener.onComplete(option);
+ }
+ return null;
+ }
+ }
+ } else {
+ const filePath = options.filePath;
+ if (filePath == null) {
+ let option = {};
+ option['statusCode'] = '-1';
+ option['errorCode'] = '-1';
+ option['errorMsg'] = "filePath is null";
+ option['cause'] = "filePath is null";
+ if (listener != null) {
+ listener.onComplete(option);
+ }
+ return null;
+ }
+
+ const fileInformation = this.getFileInformation(filePath);
+ const name = options.name ?? "file";
+
+ const inputStream = fileInformation?.inputStream;
+ if (fileInformation != null && inputStream != null) {
+ let requestBody = new InputStreamRequestBody(MediaType.parse(fileInformation.mime ?? "*/*")!, fileInformation.size, inputStream);
+ multiPartBody.addFormDataPart(name, fileInformation.name, requestBody);
+ } else {
+ let option = {};
+ option['statusCode'] = '-1';
+ option['errorCode'] = '-1';
+ option['errorMsg'] = "Illegal file";
+ option['cause'] = "Illegal file";
+ if (listener != null) {
+ listener.onComplete(option);
+ }
+ return null;
+ }
+ }
+
+
+ let ua = UTSAndroid.getWebViewInfo(UTSAndroid.getAppContext()!)["ua"].toString();
+ requestBilder.header("User-Agent", ua);
+
+ const headers = options.header?.toMap();
+ if (headers != null) {
+ for (entry in headers) {
+ const key = entry.key;
+ const value = entry.value;
+
+ if (value != null) {
+ requestBilder.addHeader(key, "" + value);
+ } else {
+ continue;
+ }
+ }
+ }
+
+ requestBilder.post(new ProgressRequestBody(multiPartBody.build(), new NetworkUploadProgressListener(listener)));
+
+ return requestBilder.build();
+ }
+
+
+ /**
+ * 获取文件信息对象
+ */
+ private getFileInformation(uri : string) : FileInformation | null {
+ let result : FileInformation | null = null;
+ if (uri.startsWith("content://")) {
+ const contentUri = Uri.parse(uri);
+ const context = UTSAndroid.getAppContext();
+ let cursor = context!.getContentResolver().query(contentUri, null, null, null, null);
+ if (cursor != null) {
+ cursor.moveToFirst();
+ let fileInformation = new FileInformation();
+ fileInformation.inputStream = context.getContentResolver().openInputStream(contentUri);
+ fileInformation.size = cursor.getInt(cursor.getColumnIndex(MediaStore.Images.Media.SIZE)).toLong();
+ fileInformation.name = cursor.getString(cursor.getColumnIndex(MediaStore.Images.Media.DISPLAY_NAME));
+ fileInformation.mime = cursor.getString(cursor.getColumnIndex(MediaStore.Images.Media.MIME_TYPE))
+ result = fileInformation;
+ cursor.close()
+ }
+ } else {
+ if (!uri.startsWith("file://")) {
+ // 如果不是file://开头的,就说明是相对路径。
+ uri = UTSAndroid.convert2AbsFullPath(uri)
+ } else {
+ uri = uri.substring("file://".length)
+ }
+
+ let file = new File(uri);
+ let fileInputStream = new FileInputStream(file);
+ let size = file.length();
+ let name = file.getName();
+ let mime = this.getMimeType(name);
+
+ let fileInformation = new FileInformation();
+ fileInformation.inputStream = fileInputStream;
+ fileInformation.size = size;
+ fileInformation.name = name;
+ fileInformation.mime = mime;
+ result = fileInformation;
+ }
+
+ return result;
+ }
+
+ private checkPrivatePath(path : string) : boolean {
+ if (Build.VERSION.SDK_INT > 29 && Environment.isExternalStorageManager()) {
+ return true;
+ }
+
+ if (path.startsWith("file://")) {
+ path = path.replace("file://", "");
+ }
+ const context = UTSAndroid.getAppContext()!;
+ let cache = context.getExternalCacheDir();
+ let sPrivateExternalDir = ""
+ if (cache == null) {
+ sPrivateExternalDir = Environment.getExternalStorageDirectory().getPath() + "/Android/data/" + context.getPackageName();
+ } else {
+ sPrivateExternalDir = cache.getParent();
+ }
+ const sPrivateDir = context.getFilesDir().getParent();
+
+ if (sPrivateExternalDir.startsWith("/") && !path.startsWith("/")) {
+ path = "/" + path;
+ }
+
+ if ((path.contains(sPrivateDir) || path.contains(sPrivateExternalDir))//表示应用私有路径
+ || this.isAssetFile(path) //表示apk的assets路径文件
+ || Build.VERSION.SDK_INT < Build.VERSION_CODES.Q//表示当前手机属于可正常访问路径系统
+ ) {
+ //文件路径在私有路径下或手机系统版符合非分区存储逻辑
+ return true;
+ }
+
+ return false;
+ }
+
+ private isAssetFile(filePath : string) : boolean {
+ let isAsset = false;
+ if (filePath.startsWith("apps/")) {
+ isAsset = true;
+ } else if (filePath.startsWith("/android_asset/") || filePath.startsWith("android_asset/")) {
+ isAsset = true;
+ }
+ return isAsset;
+ }
+
+
+ /**
+ * 获取文件mime
+ */
+ private getMimeType(filename : string) : string {
+ let map = MimeTypeMap.getSingleton()
+ var extType = MimeTypeMap.getFileExtensionFromUrl(filename)
+ if (extType == null && filename.lastIndexOf(".") >= 0) {
+ extType = filename.substring(filename.lastIndexOf(".") + 1)
+ }
+ let ret = map.getMimeTypeFromExtension(extType);
+ if (TextUtils.isEmpty(ret)) {
+ if (TextUtils.isEmpty(extType)) {
+ ret = "*/*"
+ } else {
+ ret = "application/" + extType
+ }
+ }
+
+ return ret!;
+ }
+}
+
+class SimpleUploadCallback implements Callback {
+ private listener : NetworkUploadFileListener | null = null;
+ constructor(listener : NetworkUploadFileListener) {
+ this.listener = listener;
+ }
+
+
+ override onFailure(call : Call, exception : IOException) {
+ let option = {};
+ option['statusCode'] = '-1';
+ option['errorCode'] = '-1';
+ option['errorMsg'] = exception.message;
+ option['cause'] = exception.message;
+ this.listener?.onComplete(option);
+ }
+ override onResponse(call : Call, response : Response) {
+ const result = {};
+ result["statusCode"] = response.code() + "";
+ result["data"] = response.body()?.string();
+ this.listener?.onComplete(result);
+ }
+}
+
+export {
+ UploadController
+}
\ No newline at end of file
diff --git a/uni_modules/uni-network/utssdk/app-ios/CodingHandler.swift b/uni_modules/uni-network/utssdk/app-ios/CodingHandler.swift
new file mode 100644
index 0000000000000000000000000000000000000000..979052708eb26e5391d3858f188a8cbd80d6534d
--- /dev/null
+++ b/uni_modules/uni-network/utssdk/app-ios/CodingHandler.swift
@@ -0,0 +1,41 @@
+//
+// CodingHandler.swift
+//
+// Created by TaoHebin on 2023/3/6.
+//
+
+import Foundation
+
+
+func cleanUTF8(data:Data?) -> Data? {
+ if let data = data {
+ let cd = iconv_open("UTF-8", "UTF-8")
+ var one = 1
+ let argPointer = withUnsafeMutablePointer(to: &one) {$0}
+ iconvctl(cd, ICONV_SET_DISCARD_ILSEQ, argPointer)
+ var inbytesleft:Int = data.count
+ var outbytesleft:Int = data.count
+
+ var inbuf = data.withUnsafeBytes { (buffer : UnsafeRawBufferPointer) in
+ let src:UnsafeMutablePointer? = UnsafeMutablePointer.allocate(capacity:buffer.count)
+ memset(src, 0, buffer.count)
+ memcpy(src, buffer.baseAddress, buffer.count)
+ return src
+ }
+ let outbuf:UnsafeMutablePointer? = UnsafeMutablePointer.allocate(capacity:data.count)
+ var outPtr = outbuf
+ if iconv(cd, &inbuf, &inbytesleft, &outPtr, &outbytesleft) == -1{
+ return nil
+ }
+
+ var result : Data? = nil
+ if let outbuf = outbuf{
+ result = Data(bytes: outbuf, count: data.count)
+ }
+ iconv_close(cd)
+ outbuf?.deallocate()
+ return result
+ }else{
+ return nil
+ }
+}
diff --git a/uni_modules/uni-network/utssdk/app-ios/index.uts b/uni_modules/uni-network/utssdk/app-ios/index.uts
new file mode 100644
index 0000000000000000000000000000000000000000..e3eeb48d02ec3bada413fbb3aa16cfc18ce30ff3
--- /dev/null
+++ b/uni_modules/uni-network/utssdk/app-ios/index.uts
@@ -0,0 +1,175 @@
+import { Request, RequestOptions, RequestSuccess, RequestFail, RequestTask } from './interface';
+import { NetworkManager, NetworkRequestListener } from './network/NetworkManager.uts'
+import { Data, HTTPURLResponse, NSError, NSNumber , ComparisonResult } from 'Foundation';
+import { StatusCode } from './network/StatusCode.uts';
+
+class SimpleNetworkListener extends NetworkRequestListener {
+ private param : RequestOptions | null = null;
+ private headers : Map | null = null;
+ private received : number = 0;
+ private data : Data = new Data();
+ constructor(param : RequestOptions) {
+ this.param = param;
+ super();
+ }
+
+ public override onStart() : void {
+ }
+
+ public override onHeadersReceived(statusCode : number, headers : Map) : void {
+ this.headers = headers;
+ }
+ public override onDataReceived(data : Data) : void {
+ this.received += data.count;
+ this.data.append(data);
+ }
+
+ public override onFinished(response : HTTPURLResponse) : void {
+ try {
+ let headers = response.allHeaderFields as Map;
+ let kParam = this.param;
+ let result = {};
+ result['statusCode'] = response.statusCode;
+ result['statusText'] = StatusCode.getStatus(new String(response.statusCode));
+ if (headers != null) {
+ result['header'] = headers;
+ }
+ let strData = this.readStringFromData(this.data, response.textEncodingName);
+
+
+ let type = kParam?.responseType != null ? kParam?.responseType : kParam?.dataType;
+
+ if (type == null && headers != null) {
+
+ for (entry in headers){
+ let key = entry.key;
+ if (key.caseInsensitiveCompare("Content-Type") == ComparisonResult.orderedSame) {
+ type = headers[key] as string;
+ }
+ }
+ }
+
+
+ result['data'] = this.parseData(this.data, strData, type);
+
+ let tmp : RequestSuccess = {
+ data: result['data']!,
+ statusCode: (new NSNumber(value = response.statusCode)),
+ header: result['header'] ?? "",
+ cookies: []
+ };
+ let success = kParam?.success;
+ let complete = kParam?.complete;
+ success?.(tmp);
+ complete?.(tmp);
+
+ } catch (e) {
+ }
+ }
+
+ public override onFail(error : NSError) : void {
+
+ let kParam = this.param;
+ let result = {};
+ let code = (error as NSError).code;
+ // result['data'] = error.localizedDescription + "(" + new String(code) + ")";
+ // result['errorMsg'] = error.localizedDescription + "(" + new String(code) + ")";
+ // result['statusText'] = StatusCode.getStatus(new String(code) + "");
+ // if (this.headers != null) {
+ // result['header'] = this.headers;
+ // }
+
+ let errCode = code;
+ let errMsg = error.localizedDescription;
+ if (code == -1001) {
+ errCode = 5;
+ } else if (code == -1004) {
+ errCode = 1000;
+ } else if (code == -1009) {
+ errCode = 600003;
+ } else if (code == -1000 || code == -1002 || code == -1003) {
+ errMsg = 'ERR_INVALID_REQUEST';
+ }
+
+
+ // let failResult : RequestFail = {
+ // errSubject: "uni-request",
+ // errMsg: errMsg,
+ // errCode: errCode,
+ // };
+ let failResult : RequestFail = new UniError("uni-request", Number.from(errCode), errMsg);
+
+ let fail = kParam?.fail;
+ let complete = kParam?.complete;
+ fail?.(failResult);
+ complete?.(failResult);
+ }
+
+
+ private readStringFromData(data : Data, type : string | null) : string | null {
+ let result : string | null = null;
+ let finalType = type;
+ if (finalType == null || finalType!.length == 0) {
+ finalType = "utf-8";
+ }
+
+ let cfEncoding = CFStringConvertIANACharSetNameToEncoding(finalType as CFString);
+ if (cfEncoding != kCFStringEncodingInvalidId) {
+ let stringEncoding = CFStringConvertEncodingToNSStringEncoding(cfEncoding);
+ let encode = new String.Encoding(rawValue = stringEncoding);
+ result = new String(data = data, encoding = encode);
+ }
+ return result;
+ }
+
+ private parseData(data : Data | null, dataStr : string | null, type : string | null) : any | null {
+ if (type != null && type!.contains("json")) {
+ if (dataStr == null || dataStr!.length == 0) {
+ return {};
+ }
+ return this.parseJson(dataStr!);
+ } else if (type == 'jsonp') {
+ if (dataStr == null || dataStr!.length == 0) {
+ return {};
+ }
+ let start = dataStr!.indexOf('(');
+ let end = dataStr!.indexOf(')');
+ if (start == 0 || start >= end) {
+ return {};
+ }
+ start += 1;
+ let tmp = dataStr!.slice(start, end);
+ return this.parseJson(tmp);
+ } else {
+ //dataStr如果解码失败是空的时候,还需要继续尝试解码。极端情况,服务器不是utf8的,所以字符解码会出现乱码,所以特殊处理一下非utf8的字符。
+ if (data == null) {
+ return data;
+ }
+
+ let currentStr : string | null = dataStr;
+ //todo 等uts支持swift文件混编的时候,再进行处理。
+ // if (currentStr == null) {
+ // let data = cleanUTF8(data);
+ // if (data != null) {
+ // currentStr = new String(data = data, encoding = String.Encoding.utf8);
+ // }
+ // }
+
+ if (currentStr == null) {
+ currentStr = new String(data = data!, encoding = String.Encoding.ascii);
+ }
+
+ return currentStr;
+ }
+ }
+
+
+ private parseJson(str : string) : any | null{
+ return JSON.parse(str);
+ }
+}
+
+
+export const request : Request = (param : RequestOptions) : RequestTask | null => {
+ return NetworkManager.getInstance().request(param, new SimpleNetworkListener(param));
+}
\ No newline at end of file
diff --git a/uni_modules/uni-network/utssdk/app-ios/interface.uts b/uni_modules/uni-network/utssdk/app-ios/interface.uts
new file mode 100644
index 0000000000000000000000000000000000000000..334a16790ae5d752dec4ce9d5b8581638bef6808
--- /dev/null
+++ b/uni_modules/uni-network/utssdk/app-ios/interface.uts
@@ -0,0 +1,574 @@
+
+export type Request = (param: RequestOptions) => RequestTask | null;
+
+/**
+ * 网络请求参数
+ */
+export type RequestOptions = {
+ /**
+ * 开发者服务器接口地址
+ */
+ url: string,
+ /**
+ * 请求的参数 Object|String类型
+ * @type {RequestDataOptions}
+ * @defaultValue null
+ */
+ data?: any | null,
+ /**
+ * 设置请求的 header,header 中不能设置 Referer
+ * @defaultValue null
+ */
+ header?: UTSJSONObject,
+ /**
+ * 请求类型 默认值GET
+ * GET|POST|PUT|DELETE|HEAD|OPTIONS
+ * @type {RequestMethod}
+ * @defaultValue "GET"
+ */
+ method?: "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "HEAD" | "OPTIONS"| null,
+ /**
+ * 超时时间,单位 ms
+ * @defaultValue 60000
+ */
+ timeout?: number | null,
+ /**
+ * 如果设为 json,会对返回的数据进行一次 JSON.parse,非 json 不会进行 JSON.parse
+ * @defaultValue "json"
+ * @deprecated 不支持
+ * @autodoc false
+ */
+ dataType?: string | null,
+ /**
+ * 设置响应的数据类型。
+ *
+ * @deprecated 不支持
+ * @autodoc false
+ */
+ responseType?: string | null,
+ /**
+ * 验证 ssl 证书
+ * @deprecated 不支持
+ * @autodoc false
+ */
+ sslVerify?: boolean | null,
+ /**
+ * 跨域请求时是否携带凭证(cookies)
+ *
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "4.4",
+ * "uniVer": "√",
+ * "unixVer": "x"
+ * },
+ * "ios": {
+ * "osVer": "9.0",
+ * "uniVer": "√",
+ * "unixVer": "x"
+ * }
+ * }
+ * }
+ */
+ withCredentials?: boolean | null,
+ /**
+ * DNS解析时优先使用ipv4
+ * @defaultValue false
+ */
+ firstIpv4?: boolean | null,
+ /**
+ * 网络请求成功回调。
+ * @defaultValue null
+ */
+ success?: RequestSuccessCallback | null,
+ /**
+ * 网络请求失败回调。
+ * @defaultValue null
+ */
+ fail?: RequestFailCallback | null,
+ /**
+ * 网络请求完成回调,成功或者失败都会调用。
+ * @defaultValue null
+ */
+ complete?: RequestCompleteCallback | null
+}
+
+export type RequestSuccess = {
+ /**
+ * 开发者服务器返回的数据
+ * @type {RequestDataOptions}
+ */
+ data: any | null,
+ /**
+ * 开发者服务器返回的 HTTP 状态码
+ */
+ statusCode: number,
+ /**
+ * 开发者服务器返回的 HTTP Response Header
+ */
+ header: any,
+ /**
+ * 开发者服务器返回的 cookies,格式为字符串数组
+ */
+ cookies: Array
+}
+
+export type RequestFail = UniError;
+export type RequestSuccessCallback = (option: RequestSuccess) => void;
+export type RequestFailCallback = (option: RequestFail) => void;
+export type RequestCompleteCallback = (option: any) => void;
+
+
+export interface RequestTask {
+ /**
+ * abort()
+ * @description
+ * 中断网络请求。
+ * @param {void}
+ * @return {void}
+ * @tutorial https://uniapp.dcloud.net.cn/api/request/request.html#request
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "4.4",
+ * "uniVer": "√",
+ * "unixVer": "3.9+"
+ * },
+ * "ios": {
+ * "osVer": "9.0",
+ * "uniVer": "√",
+ * "unixVer": "3.9+"
+ * }
+ * }
+ * }
+ * @example
+ ```typescript
+ var requestTask = uni.request({
+ url: 'http://192.168.12.106:8080/postHalo', //仅为示例,并非真实接口地址。
+ complete: ()=> {}
+ });
+ requestTask.abort();
+ ```
+ */
+ abort(): void
+}
+
+
+//===============================上传==================================
+
+
+export type UploadFile = (options: UploadFileOptions) => UploadTask | null;
+export type UploadFileOptionFiles = {
+ /**
+ * multipart 提交时,表单的项目名,默认为 file,如果 name 不填或填的值相同,可能导致服务端读取文件时只能读取到一个文件。
+ */
+ name: string | null,
+ /**
+ * 要上传文件资源的路径
+ */
+ uri: string,
+ /**
+ * 要上传的文件对象,仅H5(2.6.15+)支持
+ *
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "4.4",
+ * "uniVer": "√",
+ * "unixVer": "x"
+ * },
+ * "ios": {
+ * "osVer": "9.0",
+ * "uniVer": "√",
+ * "unixVer": "x"
+ * }
+ * }
+ * }
+ */
+ file: any | null
+};
+export type UploadFileSuccess = {
+ /**
+ * 开发者服务器返回的数据
+ */
+ data: string,
+ /**
+ * 开发者服务器返回的 HTTP 状态码
+ */
+ statusCode: number
+};
+export type UploadFileSuccessCallback = (result: UploadFileSuccess) => void;
+export type UploadFileFail = UniError;
+export type UploadFileFailCallback = (result: UploadFileFail) => void;
+
+export type UploadFileCompleteCallback = (result: any) => void;
+export type UploadFileOptions = {
+ /**
+ * 开发者服务器 url
+ */
+ url: string,
+ /**
+ * 要上传文件资源的路径
+ */
+ filePath?: string | null,
+ /**
+ * 文件对应的 key , 开发者在服务器端通过这个 key 可以获取到文件二进制内容
+ */
+ name?: string | null,
+ /**
+ * 需要上传的文件列表。
+ */
+ files?: (UploadFileOptionFiles[]) | null,
+ /**
+ * HTTP 请求 Header, header 中不能设置 Referer
+ */
+ header?: UTSJSONObject | null,
+ /**
+ * HTTP 请求中其他额外的 form data
+ */
+ formData?: UTSJSONObject | null,
+ /**
+ * 超时时间,单位 ms
+ */
+ timeout?: number | null,
+ /**
+ * 成功返回的回调函数
+ */
+ success?: UploadFileSuccessCallback | null,
+ /**
+ * 失败的回调函数
+ */
+ fail?: UploadFileFailCallback | null,
+ /**
+ * 结束的回调函数(调用成功、失败都会执行)
+ */
+ complete?: UploadFileCompleteCallback | null
+};
+export type OnProgressUpdateResult = {
+ /**
+ * 上传进度百分比
+ */
+ progress: number,
+ /**
+ * 已经上传的数据长度,单位 Bytes
+ */
+ totalBytesSent: number,
+ /**
+ * 预期需要上传的数据总长度,单位 Bytes
+ */
+ totalBytesExpectedToSend: number
+};
+
+export type UploadFileProgressUpdateCallback = (result: OnProgressUpdateResult) => void
+export interface UploadTask {
+ /**
+ * abort()
+ * @description
+ * 中断上传任务。
+ * @param {void}
+ * @return {void}
+ * @tutorial https://uniapp.dcloud.net.cn/api/request/network-file.html#uploadfile
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "4.4",
+ * "uniVer": "√",
+ * "unixVer": "3.9+"
+ * },
+ * "ios": {
+ * "osVer": "9.0",
+ * "uniVer": "√",
+ * "unixVer": "x"
+ * }
+ * }
+ * }
+ * @example
+ ```typescript
+ var uploadTask = uni.uploadFile({
+ url: 'http://192.168.12.106:8080/uploadFile', //仅为示例,并非真实接口地址。
+ complete: ()=> {}
+ });
+ uploadTask.abort();
+ ```
+ */
+ abort(): void,
+ /**
+ * onProgressUpdate()
+ * @description
+ * 监听上传进度变化。
+ * @param {UploadFileProgressUpdateCallback} callback
+ * @return {void}
+ * @tutorial https://uniapp.dcloud.net.cn/api/request/network-file.html#uploadfile
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "4.4",
+ * "uniVer": "√",
+ * "unixVer": "3.9+"
+ * },
+ * "ios": {
+ * "osVer": "9.0",
+ * "uniVer": "√",
+ * "unixVer": "x"
+ * }
+ * }
+ * }
+ * @example
+ ```typescript
+ uploadTask.onProgressUpdate((res) => {
+ console.log('上传进度' + res.progress);
+ console.log('已经上传的数据长度' + res.totalBytesSent);
+ console.log('预期需要上传的数据总长度' + res.totalBytesExpectedToSend);
+ });
+ ```
+ */
+ onProgressUpdate(callback: UploadFileProgressUpdateCallback): void,
+};
+
+//===============================下载==================================
+
+export type DownloadFile = (options: DownloadFileOptions) => DownloadTask | null;
+export type DownloadFileSuccess = {
+ /**
+ * 临时文件路径,下载后的文件会存储到一个临时文件
+ */
+ tempFilePath: string,
+ /**
+ * 开发者服务器返回的 HTTP 状态码
+ */
+ statusCode: number
+};
+export type DownloadFileSuccessCallback = (result: DownloadFileSuccess) => void;
+export type DownloadFileFail = UniError;
+export type DownloadFileFailCallback = (result: DownloadFileFail) => void;
+export type DownloadFileComplete = any;
+export type DownloadFileCompleteCallback = (result: DownloadFileComplete) => void;
+export type DownloadFileOptions = {
+ /**
+ * 下载资源的 url
+ */
+ url: string,
+ /**
+ * HTTP 请求 Header,header 中不能设置 Referer
+ */
+ header?: UTSJSONObject | null,
+ /**
+ * 超时时间,单位 ms
+ */
+ timeout?: number | null,
+ /**
+ * 下载成功后以 tempFilePath 的形式传给页面,res = {tempFilePath: '文件的临时路径'}
+ */
+ success?: DownloadFileSuccessCallback | null,
+ /**
+ * 失败的回调函数
+ */
+ fail?: DownloadFileFailCallback | null,
+ /**
+ * 结束的回调函数(调用成功、失败都会执行)
+ */
+ complete?: DownloadFileCompleteCallback | null
+};
+export type OnProgressDownloadResult = {
+ /**
+ * 下载进度百分比
+ */
+ progress: number,
+ /**
+ * 已经下载的数据长度,单位 Bytes
+ */
+ totalBytesWritten: number,
+ /**
+ * 预期需要下载的数据总长度,单位 Bytes
+ */
+ totalBytesExpectedToWrite: number
+};
+export type DownloadFileProgressUpdateCallback = (result: OnProgressDownloadResult) => void;
+export interface DownloadTask {
+ /**
+ * abort()
+ * @description
+ * 中断下载任务。
+ * @param {void}
+ * @return {void}
+ * @tutorial https://uniapp.dcloud.net.cn/api/request/network-file.html#downloadfile
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "4.4",
+ * "uniVer": "√",
+ * "unixVer": "3.9+"
+ * },
+ * "ios": {
+ * "osVer": "9.0",
+ * "uniVer": "√",
+ * "unixVer": "x"
+ * }
+ * }
+ * }
+ * @example
+ ```typescript
+ var downloadTask = uni.downloadFile({
+ url: 'https://www.example.com/file/test', //仅为示例,并非真实接口地址。
+ complete: ()=> {}
+ });
+ downloadTask.abort();
+ ```
+ */
+ abort(): void,
+ /**
+ * onProgressUpdate()
+ * @description
+ * 监听下载进度变化。
+ * @param {DownloadFileProgressUpdateCallback} callback
+ * @return {void}
+ * @tutorial https://uniapp.dcloud.net.cn/api/request/network-file.html#downloadfile
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "4.4",
+ * "uniVer": "√",
+ * "unixVer": "3.9+"
+ * },
+ * "ios": {
+ * "osVer": "9.0",
+ * "uniVer": "√",
+ * "unixVer": "x"
+ * }
+ * }
+ * }
+ * @example
+ ```typescript
+ downloadTask.onProgressUpdate((res) => {
+ console.log('下载进度' + res.progress);
+ console.log('已经下载的数据长度' + res.totalBytesWritten);
+ console.log('预期需要下载的数据总长度' + res.totalBytesExpectedToWrite);
+ });
+ ```
+ */
+ onProgressUpdate(callback: DownloadFileProgressUpdateCallback): void,
+};
+
+
+export interface Uni {
+ /**
+ * Request()
+ * @description
+ * 发起网络请求。
+ * @param {RequestOptions} options
+ * @return {RequestTask | null}
+ * @tutorial https://uniapp.dcloud.net.cn/api/request/request.html
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "4.4",
+ * "uniVer": "√",
+ * "unixVer": "3.9+"
+ * },
+ * "ios": {
+ * "osVer": "9.0",
+ * "uniVer": "√",
+ * "unixVer": "3.9+"
+ * }
+ * }
+ * }
+ * @example
+ ```typescript
+ uni.request({
+ url: "http://192.168.12.106:8080/postHalo",
+ dataType: "json",
+ responseType: "json",
+ method: "POST",
+ data: {
+ platform: "ios",
+ },
+ // header: {
+ // "Content-Type": "application/json",
+ // },
+ timeout: 6000,
+ sslVerify: false,
+ withCredentials: false,
+ firstIpv4: false,
+ success(res) {
+ console.log("success :", res.data);
+ },
+ fail(e) {
+ console.log(e);
+ },
+ complete(res) {
+ console.log("complete :", res);
+ },
+ });
+ ```
+ */
+ request: Request,
+ /**
+ * UploadFile()
+ * @description
+ * 将本地资源上传到开发者服务器。
+ * @param {UploadFileOptions} options
+ * @return {UploadTask | null}
+ * @tutorial https://uniapp.dcloud.net.cn/api/request/network-file.html#uploadfile
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "4.4",
+ * "uniVer": "√",
+ * "unixVer": "3.9+"
+ * },
+ * "ios": {
+ * "osVer": "9.0",
+ * "uniVer": "√",
+ * "unixVer": "x"
+ * }
+ * }
+ * }
+ * @example
+ ```typescript
+ uni.uploadFile({
+ url: 'http://192.168.12.106:8080/uploadFile', //仅为示例,非真实的接口地址
+ filePath: "/static/logo.png",
+ name: 'file',
+ formData: {
+ 'user': 'test'
+ },
+ success: (uploadFileRes) => {
+ console.log(uploadFileRes.data);
+ }
+ });
+ ```
+ */
+ uploadFile: UploadFile,
+ /**
+ * DownloadFile()
+ * @description
+ * 下载文件资源到本地,客户端直接发起一个 HTTP GET 请求,返回文件的本地临时路径。
+ * @param {DownloadFileOptions} options
+ * @return {DownloadTask | null}
+ * @tutorial https://uniapp.dcloud.net.cn/api/request/network-file.html#downloadfile
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "4.4",
+ * "uniVer": "√",
+ * "unixVer": "3.9+"
+ * },
+ * "ios": {
+ * "osVer": "9.0",
+ * "uniVer": "√",
+ * "unixVer": "x"
+ * }
+ * }
+ * }
+ * @example
+ ```typescript
+ uni.downloadFile({
+ url: "http://192.168.12.106:8080/downloadfile",
+ success(e) {
+ console.log("success111 :", e);
+ }
+ });
+ ```
+ */
+ downloadFile: DownloadFile
+}
diff --git a/uni_modules/uni-network/utssdk/app-ios/network/NetworkManager.uts b/uni_modules/uni-network/utssdk/app-ios/network/NetworkManager.uts
new file mode 100644
index 0000000000000000000000000000000000000000..b8ced5bbb5d72fe14ec116581c382a5ea3185d0f
--- /dev/null
+++ b/uni_modules/uni-network/utssdk/app-ios/network/NetworkManager.uts
@@ -0,0 +1,174 @@
+import { RequestOptions, RequestTask } from '../interface.uts'
+import { UTSiOS } from "DCloudUTSFoundation";
+import { URLSessionDataDelegate, URL, CharacterSet, URLSession, URLSessionConfiguration, OperationQueue, URLSessionTask, URLResponse, URLSessionDataTask, URLAuthenticationChallengeSender, URLAuthenticationChallenge, URLCredential, URLSessionTaskMetrics, Data, HTTPURLResponse, NSError, URLRequest, ComparisonResult } from 'Foundation';
+
+class NetworkRequestListener {
+ public onStart() : void { }
+
+ public onHeadersReceived(statusCode : number, headers : Map) : void { }
+
+ public onDataReceived(data : Data) : void { }
+
+ public onFinished(response : HTTPURLResponse) : void { }
+
+ public onFail(error : NSError) : void { }
+}
+
+class NetworkRequestTaskImpl implements RequestTask {
+ private task : URLSessionDataTask | null = null;
+ constructor(task : URLSessionDataTask | null) {
+ this.task = task;
+ super();
+ }
+
+ public abort() {
+ this.task?.cancel()
+ }
+}
+
+class NetworkManager implements URLSessionDataDelegate {
+ private static instance : NetworkManager | null = null;
+
+ private session : URLSession | null = null;
+
+ private taskMap : Map = new Map();
+
+ public static getInstance() : NetworkManager {
+ if (this.instance == null) {
+ this.instance = new NetworkManager();
+ }
+ return this.instance!;
+ }
+
+
+ public request(param : RequestOptions, listener : NetworkRequestListener) : RequestTask | null {
+ let request = this.createRequest(param);
+ if (request == null) {
+ let error = new NSError(domain = "invalid URL", code = 600009);
+ listener.onFail(error);
+ return null;
+ }
+
+ if (this.session == null) {
+ let urlSessionConfig = URLSessionConfiguration.default;
+
+ this.session = new URLSession(configuration = urlSessionConfig, delegate = this, delegateQueue = OperationQueue.main);
+ }
+ let task = this.session?.dataTask(with = request!);
+ task?.resume();
+ if (task != null) {
+ this.taskMap.set(task!, listener);
+ }
+ let requestTask = new NetworkRequestTaskImpl(task);
+ return requestTask;
+ }
+
+
+ public createRequest(param : RequestOptions) : URLRequest | null {
+ let url = new URL(string = param.url);
+ if (url == null) {
+ return null
+ }
+
+
+ let timeout = param.timeout == null ? 60000 : param.timeout;
+ let timeoutInterval = new Double(timeout!) / 1000;
+
+ let request = new URLRequest(url = url!, cachePolicy = URLRequest.CachePolicy.useProtocolCachePolicy, timeoutInterval = timeoutInterval);
+ request.httpShouldHandleCookies = true;
+ let method = param.method;
+ if (method == null || method!.trimmingCharacters(in = CharacterSet.whitespacesAndNewlines).count == 0) {
+ method = "GET";
+ }
+ request.httpMethod = method!;
+
+ let ua = UTSiOS.getUserAgent();
+ request.setValue(ua, forHTTPHeaderField = "User-Agent");
+
+ if (param.header == null) {
+ param.header = {}
+ }
+
+
+ let headers = param.header?.toMap() as Map;
+ let hasContentType = false;
+ if (headers != null) {
+ for (entry in headers) {
+ let key = entry.key;
+ if (key.caseInsensitiveCompare("Content-Type") == ComparisonResult.orderedSame) {
+ hasContentType = true;
+ }
+ if (typeof(entry.value) == 'string') {
+ request.setValue((entry.value) as string, forHTTPHeaderField = key);
+ }
+ }
+ }
+
+ if (!hasContentType) {
+ if ("GET" != param.method) {
+ request.setValue("application/json", forHTTPHeaderField = "Content-Type");
+ }
+ }
+
+
+ if (param.data != null) {
+ let body : Data | null = null;
+ if (typeof(param.data) == 'string') {
+ body = (param.data as string).data(using = String.Encoding.utf8);
+ } else {
+ body = JSON.stringify(param.data)?.data(using = String.Encoding.utf8);
+ }
+ if (body == null) {
+ return null;
+ }
+
+ request.httpBody = body;
+ }
+
+ return request;
+ }
+
+
+ //mark --- URLSessionDataDelegate
+
+ urlSession(session : URLSession, @argumentLabel("") task : URLSessionTask, @argumentLabel("didSendBodyData") bytesSent : Int64, @argumentLabel("") totalBytesSent : Int64, @argumentLabel("") totalBytesExpectedToSend : Int64) {
+ //todo 原生的onDataSent貌似没实现 ,考虑删掉这个回调。
+ }
+ urlSession(session : URLSession, @argumentLabel("") dataTask : URLSessionDataTask, @argumentLabel("didReceive") response : URLResponse, @argumentLabel("") @escaping completionHandler : (dis : URLSession.ResponseDisposition) => void) {
+ // response开始的时候的header回调
+ let listener = this.taskMap.get(dataTask);
+ if (listener != null) {
+ let httpResponse : HTTPURLResponse = response as HTTPURLResponse;
+ let statusCode = new NSNumber(value = httpResponse.statusCode);
+ listener?.onHeadersReceived(statusCode, httpResponse.allHeaderFields as Map);
+ }
+
+ completionHandler(URLSession.ResponseDisposition.allow);
+ }
+
+ urlSession(session : URLSession, @argumentLabel("") dataTask : URLSessionDataTask, @argumentLabel("didReceive") data : Data) {
+ let listener = this.taskMap.get(dataTask);
+ listener?.onDataReceived(data);
+ }
+
+ urlSession(session : URLSession, @argumentLabel("") task : URLSessionTask, @argumentLabel("didCompleteWithError") error : NSError | null) {
+ let listener = this.taskMap.get(task);
+
+ if (error != null) {
+ listener?.onFail(error as NSError);
+ } else {
+ listener?.onFinished(task.response as HTTPURLResponse);
+ }
+ this.taskMap.delete(task);
+ }
+ //todo 暂时证书验证先不实现。
+ // urlSession( session: URLSession, @argumentLabel("didReceive") challenge: URLAuthenticationChallenge, @escaping completionHandler:(dis:URLSession.AuthChallengeDisposition, credentiual:URLCredential)=>void) {
+ // console.log("didReceivechallenge");
+ // }
+}
+
+
+export {
+ NetworkManager,
+ NetworkRequestListener
+}
\ No newline at end of file
diff --git a/uni_modules/uni-network/utssdk/app-ios/network/StatusCode.uts b/uni_modules/uni-network/utssdk/app-ios/network/StatusCode.uts
new file mode 100644
index 0000000000000000000000000000000000000000..7af0669eb6d51d87faf59f52540a02e116e35c26
--- /dev/null
+++ b/uni_modules/uni-network/utssdk/app-ios/network/StatusCode.uts
@@ -0,0 +1,81 @@
+
+
+
+class StatusCode {
+ private static statusCodeMap : Map | null = null;
+
+ private static initStatusCodeMap() {
+ let map = new Map();
+ map.set('100', "Continue");
+ map.set('101', "Switching Protocol");
+ map.set('200', "OK");
+ map.set('201', "Created");
+ map.set('202', "Accepted");
+ map.set('203', "Non-Authoritative Information");
+ map.set('204', "No Content");
+ map.set('205', "Reset Content");
+ map.set('206', "Partial Content");
+ map.set('300', "Multiple Choice");
+ map.set('301', "Moved Permanently");
+ map.set('302', "Found");
+ map.set('303', "See Other");
+ map.set('304', "Not Modified");
+ map.set('305', "Use Proxy");
+ map.set('306', "unused");
+ map.set('307', "Temporary Redirect");
+ map.set('308', "Permanent Redirect");
+ map.set('400', "Bad Request");
+ map.set('401', "Unauthorized");
+ map.set('402', "Payment Required");
+ map.set('403', "Forbidden");
+ map.set('404', "Not Found");
+ map.set('405', "Method Not Allowed");
+ map.set('406', "Not Acceptable");
+ map.set('407', "Proxy Authentication Required");
+ map.set('408', "Request Timeout");
+ map.set('409', "Conflict");
+ map.set('410', "Gone");
+ map.set('411', "Length Required");
+ map.set('412', "Precondition Failed");
+ map.set('413', "Payload Too Large");
+ map.set('414', "URI Too Long");
+ map.set('415', "Unsupported Media Type");
+ map.set('416', "Requested Range Not Satisfiable");
+ map.set('417', "Expectation Failed");
+ map.set('418', "I'm a teapot");
+ map.set('421', "Misdirected Request");
+ map.set('426', "Upgrade Required");
+ map.set('428', "Precondition Required");
+ map.set('429', "Too Many Requests");
+ map.set('431', "Request Header Fields Too Large");
+ map.set('500', "Internal Server Error");
+ map.set('501', "Not Implemented");
+ map.set('502', "Bad Gateway");
+ map.set('503', "Service Unavailable");
+ map.set('504', "Gateway Timeout");
+ map.set('505', "HTTP Version Not Supported");
+ map.set('506', "Variant Also Negotiates");
+ map.set('507', "Variant Also Negotiates");
+ map.set('511', "Network Authentication Required");
+ this.statusCodeMap = map;
+ }
+
+ public static getStatus(code : string) : string {
+ let map = this.statusCodeMap;
+ if (map == null) {
+ this.initStatusCodeMap();
+ }
+ let tmp = this.statusCodeMap!;
+
+ if (!(tmp.has(code))) {
+ return 'unknown status';
+ } else {
+ return tmp.get(code)! as string;
+ }
+ }
+}
+
+
+export {
+ StatusCode
+}
diff --git a/uni_modules/uni-network/utssdk/interface.types.uts b/uni_modules/uni-network/utssdk/interface.types.uts
new file mode 100644
index 0000000000000000000000000000000000000000..84815e5882d66648c952106c4806aeccdd81607e
--- /dev/null
+++ b/uni_modules/uni-network/utssdk/interface.types.uts
@@ -0,0 +1,205 @@
+
+export type RequestDataOptions =
+ /**
+ * @description json对象
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "4.4",
+ * "uniVer": "√",
+ * "unixVer": "3.9+"
+ * },
+ * "ios": {
+ * "osVer": "9.0",
+ * "uniVer": "√",
+ * "unixVer": "3.9+"
+ * }
+ * }
+ * }
+ */
+ Object
+ /**
+ * @description 字符串
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "4.4",
+ * "uniVer": "√",
+ * "unixVer": "3.9+"
+ * },
+ * "ios": {
+ * "osVer": "9.0",
+ * "uniVer": "√",
+ * "unixVer": "3.9+"
+ * }
+ * }
+ * }
+ */
+ | String
+ /**
+ * @description ArrayBuffer
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "x",
+ * "uniVer": "√",
+ * "unixVer": "x"
+ * },
+ * "ios": {
+ * "osVer": "x",
+ * "uniVer": "√",
+ * "unixVer": "x"
+ * }
+ * }
+ * }
+ */
+ | ArrayBuffer;
+
+
+
+export type RequestMethod =
+ /**
+ * @description GET
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "4.4",
+ * "uniVer": "√",
+ * "unixVer": "3.9+"
+ * },
+ * "ios": {
+ * "osVer": "9.0",
+ * "uniVer": "√",
+ * "unixVer": "3.9+"
+ * }
+ * }
+ * }
+ */
+ GET
+ /**
+ * @description POST
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "4.4",
+ * "uniVer": "√",
+ * "unixVer": "3.9+"
+ * },
+ * "ios": {
+ * "osVer": "9.0",
+ * "uniVer": "√",
+ * "unixVer": "3.9+"
+ * }
+ * }
+ * }
+ */
+ | POST
+ /**
+ * @description PUT
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "4.4",
+ * "uniVer": "√",
+ * "unixVer": "3.9+"
+ * },
+ * "ios": {
+ * "osVer": "9.0",
+ * "uniVer": "√",
+ * "unixVer": "3.9+"
+ * }
+ * }
+ * }
+ */
+ | PUT
+ /**
+ * @description DELETE
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "4.4",
+ * "uniVer": "√",
+ * "unixVer": "3.9+"
+ * },
+ * "ios": {
+ * "osVer": "9.0",
+ * "uniVer": "√",
+ * "unixVer": "3.9+"
+ * }
+ * }
+ * }
+ */
+ | DELETE
+ /**
+ * @description CONNECT
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "4.4",
+ * "uniVer": "√",
+ * "unixVer": "3.9+"
+ * },
+ * "ios": {
+ * "osVer": "9.0",
+ * "uniVer": "√",
+ * "unixVer": "3.9+"
+ * }
+ * }
+ * }
+ */
+ | CONNECT
+ /**
+ * @description HEAD
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "4.4",
+ * "uniVer": "√",
+ * "unixVer": "3.9+"
+ * },
+ * "ios": {
+ * "osVer": "9.0",
+ * "uniVer": "√",
+ * "unixVer": "3.9+"
+ * }
+ * }
+ * }
+ */
+ | HEAD
+ /**
+ * @description OPTIONS
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "4.4",
+ * "uniVer": "√",
+ * "unixVer": "3.9+"
+ * },
+ * "ios": {
+ * "osVer": "9.0",
+ * "uniVer": "√",
+ * "unixVer": "3.9+"
+ * }
+ * }
+ * }
+ */
+ | OPTIONS
+ /**
+ * @description TRACE
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "4.4",
+ * "uniVer": "√",
+ * "unixVer": "3.9+"
+ * },
+ * "ios": {
+ * "osVer": "9.0",
+ * "uniVer": "√",
+ * "unixVer": "3.9+"
+ * }
+ * }
+ * }
+ */
+ | TRACE;
+
diff --git a/uni_modules/uni-network/utssdk/interface.uts b/uni_modules/uni-network/utssdk/interface.uts
new file mode 100644
index 0000000000000000000000000000000000000000..8c194d33413e08924b9110684dff069e7273028f
--- /dev/null
+++ b/uni_modules/uni-network/utssdk/interface.uts
@@ -0,0 +1,637 @@
+export type Request = (param: RequestOptions) => RequestTask | null;
+
+/**
+ * 网络请求参数
+ */
+export type RequestOptions = {
+ /**
+ * 开发者服务器接口地址
+ */
+ url: string,
+ /**
+ * 请求的参数 UTSJSONObject|string类型
+ * @type {RequestDataOptions}
+ * @defaultValue null
+ */
+ data?: any | null,
+ /**
+ * 设置请求的 header,header 中不能设置 Referer
+ * @defaultValue null
+ */
+ header?: UTSJSONObject | null,
+ /**
+ * 请求方法
+ * 如果设置的值不在取值范围内,会以GET方法进行请求。
+ * @type {RequestMethod}
+ * @defaultValue "GET"
+ */
+ method?: RequestMethod | null,
+ /**
+ * 超时时间,单位 ms
+ * @defaultValue 60000
+ */
+ timeout?: number | null,
+ /**
+ * 如果设为 json,会对返回的数据进行一次 JSON.parse,非 json 不会进行 JSON.parse
+ * @defaultValue "json"
+ * @deprecated 不支持
+ * @autodoc false
+ */
+ dataType?: string | null,
+ /**
+ * 设置响应的数据类型。
+ *
+ * @deprecated 不支持
+ * @autodoc false
+ */
+ responseType?: string | null,
+ /**
+ * 验证 ssl 证书
+ *
+ * @deprecated 不支持
+ * @autodoc false
+ */
+ sslVerify?: boolean | null,
+ /**
+ * 跨域请求时是否携带凭证(cookies)
+ *
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "4.4",
+ * "uniVer": "√",
+ * "unixVer": "x"
+ * },
+ * "ios": {
+ * "osVer": "9.0",
+ * "uniVer": "√",
+ * "unixVer": "x"
+ * }
+ * }
+ * }
+ *
+ */
+ withCredentials?: boolean | null,
+ /**
+ * DNS解析时优先使用ipv4
+ * @defaultValue false
+ */
+ firstIpv4?: boolean | null,
+ /**
+ * 网络请求成功回调。
+ * @defaultValue null
+ */
+ success?: RequestSuccessCallback | null,
+ /**
+ * 网络请求失败回调。
+ * @defaultValue null
+ */
+ fail?: RequestFailCallback | null,
+ /**
+ * 网络请求完成回调,成功或者失败都会调用。
+ * @defaultValue null
+ */
+ complete?: RequestCompleteCallback | null
+}
+
+export type RequestSuccess = {
+ /**
+ * 开发者服务器返回的数据
+ * @type {RequestDataOptions}
+ */
+ data: T | null,
+ /**
+ * 开发者服务器返回的 HTTP 状态码
+ */
+ statusCode: number,
+ /**
+ * 开发者服务器返回的 HTTP Response Header
+ */
+ header: any,
+ /**
+ * 开发者服务器返回的 cookies,格式为字符串数组
+ */
+ cookies: Array
+}
+
+/**
+ * 请求方法
+ * - GET GET方法请求一个指定资源的表示形式,使用 GET 的请求应该只被用于获取数据。
+ * - POST POST方法用于将实体提交到指定的资源,通常导致在服务器上的状态变化或副作用。
+ * - PUT PUT方法用有效载荷请求替换目标资源的所有当前表示。
+ * - PATCH PATCH方法用于对资源应用部分修改。
+ * - DELETE DELETE方法删除指定的资源。
+ * - HEAD HEAD方法请求一个与GET请求的响应相同的响应,但没有响应体。
+ * - OPTIONS OPTIONS 方法用于描述目标资源的通信选项。
+ */
+export type RequestMethod = "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "HEAD" | "OPTIONS";
+
+/**
+ * 错误码
+ * - 5 接口超时
+ * - 1000 服务端系统错误
+ * - 100001 json数据解析错误
+ * - 100002 错误信息json解析失败
+ * - 600000 未知的网络错误
+ * - 600003 网络中断
+ * - 600009 URL格式不合法
+ * - 600010 请求的 data 序列化失败
+ * - 602001 request系统错误
+ */
+export type RequestErrorCode = 5 | 1000 | 100001 | 100002 | 600000 | 600003 | 600009 | 600010 | 602001;
+/**
+ * 网络请求失败的错误回调参数
+ */
+export interface RequestFail extends IUniError{
+ errCode: RequestErrorCode
+};
+export type RequestSuccessCallback = (option: RequestSuccess) => void;
+export type RequestFailCallback = (option: RequestFail) => void;
+export type RequestCompleteCallback = (option: any) => void;
+
+
+export interface RequestTask {
+ /**
+ * abort()
+ * @description
+ * 中断网络请求。
+ * @param {void}
+ * @return {void}
+ * @tutorial https://uniapp.dcloud.net.cn/api/request/request.html#request
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "4.4",
+ * "uniVer": "√",
+ * "unixVer": "3.9+"
+ * },
+ * "ios": {
+ * "osVer": "9.0",
+ * "uniVer": "√",
+ * "unixVer": "x"
+ * }
+ * }
+ * }
+ * @example
+ ```typescript
+ var requestTask = uni.request({
+ url: 'http://192.168.12.106:8080/postHalo', //仅为示例,并非真实接口地址。
+ complete: ()=> {}
+ });
+ requestTask.abort();
+ ```
+ */
+ abort(): void
+}
+
+//===============================上传==================================
+
+
+export type UploadFile = (options: UploadFileOptions) => UploadTask | null;
+export type UploadFileOptionFiles = {
+ /**
+ * multipart 提交时,表单的项目名,默认为 file,如果 name 不填或填的值相同,可能导致服务端读取文件时只能读取到一个文件。
+ * @defaultValue "file"
+ */
+ name: string | null,
+ /**
+ * 要上传文件资源的路径
+ */
+ uri: string,
+ /**
+ * 要上传的文件对象
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "4.4",
+ * "uniVer": "√",
+ * "unixVer": "x"
+ * },
+ * "ios": {
+ * "osVer": "9.0",
+ * "uniVer": "√",
+ * "unixVer": "x"
+ * }
+ * }
+ * }
+ */
+ file: any | null
+};
+export type UploadFileSuccess = {
+ /**
+ * 开发者服务器返回的数据
+ */
+ data: string,
+ /**
+ * 开发者服务器返回的 HTTP 状态码
+ */
+ statusCode: number
+};
+export type UploadFileSuccessCallback = (result: UploadFileSuccess) => void;
+/**
+ * 上传文件失败的错误回调参数
+ */
+export interface UploadFileFail extends IUniError{
+ errCode: RequestErrorCode
+};
+export type UploadFileFailCallback = (result: UploadFileFail) => void;
+
+export type UploadFileCompleteCallback = (result: any) => void;
+export type UploadFileOptions = {
+ /**
+ * 开发者服务器 url
+ */
+ url: string,
+ /**
+ * 要上传文件资源的路径
+ * @defaultValue null
+ */
+ filePath?: string | null,
+ /**
+ * 文件对应的 key , 开发者在服务器端通过这个 key 可以获取到文件二进制内容
+ * @defaultValue null
+ */
+ name?: string | null,
+ /**
+ * 需要上传的文件列表。
+ * @defaultValue null
+ */
+ files?: (UploadFileOptionFiles[]) | null,
+ /**
+ * HTTP 请求 Header, header 中不能设置 Referer
+ * @defaultValue null
+ */
+ header?: UTSJSONObject | null,
+ /**
+ * HTTP 请求中其他额外的 form data
+ * @defaultValue null
+ */
+ formData?: UTSJSONObject | null,
+ /**
+ * 超时时间,单位 ms
+ * @defaultValue 120000
+ */
+ timeout?: number | null,
+ /**
+ * 成功返回的回调函数
+ * @defaultValue null
+ */
+ success?: UploadFileSuccessCallback | null,
+ /**
+ * 失败的回调函数
+ * @defaultValue null
+ */
+ fail?: UploadFileFailCallback | null,
+ /**
+ * 结束的回调函数(调用成功、失败都会执行)
+ * @defaultValue null
+ */
+ complete?: UploadFileCompleteCallback | null
+};
+export type OnProgressUpdateResult = {
+ /**
+ * 上传进度百分比
+ */
+ progress: number,
+ /**
+ * 已经上传的数据长度,单位 Bytes
+ */
+ totalBytesSent: number,
+ /**
+ * 预期需要上传的数据总长度,单位 Bytes
+ */
+ totalBytesExpectedToSend: number
+};
+
+export type UploadFileProgressUpdateCallback = (result: OnProgressUpdateResult) => void
+export interface UploadTask {
+ /**
+ * abort()
+ * @description
+ * 中断上传任务。
+ * @param {void}
+ * @return {void}
+ * @tutorial https://uniapp.dcloud.net.cn/api/request/network-file.html#uploadfile
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "4.4",
+ * "uniVer": "√",
+ * "unixVer": "3.9+"
+ * },
+ * "ios": {
+ * "osVer": "9.0",
+ * "uniVer": "√",
+ * "unixVer": "x"
+ * }
+ * }
+ * }
+ * @example
+ ```typescript
+ var uploadTask = uni.uploadFile({
+ url: 'http://192.168.12.106:8080/uploadFile', //仅为示例,并非真实接口地址。
+ complete: ()=> {}
+ });
+ uploadTask.abort();
+ ```
+ */
+ abort(): void,
+ /**
+ * onProgressUpdate()
+ * @description
+ * 监听上传进度变化。
+ * @param {UploadFileProgressUpdateCallback} callback
+ * @return {void}
+ * @tutorial https://uniapp.dcloud.net.cn/api/request/network-file.html#uploadfile
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "4.4",
+ * "uniVer": "√",
+ * "unixVer": "3.9+"
+ * },
+ * "ios": {
+ * "osVer": "9.0",
+ * "uniVer": "√",
+ * "unixVer": "x"
+ * }
+ * }
+ * }
+ * @example
+ ```typescript
+ uploadTask.onProgressUpdate((res) => {
+ console.log('上传进度' + res.progress);
+ console.log('已经上传的数据长度' + res.totalBytesSent);
+ console.log('预期需要上传的数据总长度' + res.totalBytesExpectedToSend);
+ });
+ ```
+ */
+ onProgressUpdate(callback: UploadFileProgressUpdateCallback): void,
+};
+
+//===============================下载==================================
+
+export type DownloadFile = (options: DownloadFileOptions) => DownloadTask | null;
+export type DownloadFileSuccess = {
+ /**
+ * 临时文件路径,下载后的文件会存储到一个临时文件
+ */
+ tempFilePath: string,
+ /**
+ * 开发者服务器返回的 HTTP 状态码
+ */
+ statusCode: number
+};
+export type DownloadFileSuccessCallback = (result: DownloadFileSuccess) => void;
+/**
+ * 下载文件失败的错误回调参数
+ */
+export interface DownloadFileFail extends IUniError{
+ errCode: RequestErrorCode
+};
+export type DownloadFileFailCallback = (result: DownloadFileFail) => void;
+export type DownloadFileComplete = any;
+export type DownloadFileCompleteCallback = (result: DownloadFileComplete) => void;
+export type DownloadFileOptions = {
+ /**
+ * 下载资源的 url
+ */
+ url: string,
+ /**
+ * HTTP 请求 Header,header 中不能设置 Referer
+ * @defaultValue null
+ */
+ header?: UTSJSONObject | null,
+ /**
+ * 指定文件下载路径
+ * 支持相对路径与绝对路径,例:
+ * `/imgs/pic.png`、`/storage/emulated/0/Android/data/io.dcloud.HBuilder/apps/HBuilder/temp/imgs/pic.png`
+ * 并且支持指定下载目录,例:
+ * `/imgs/`
+ * @defaultValue null
+ */
+ filePath?: string | null,
+ /**
+ * 超时时间,单位 ms
+ * @defaultValue 120000
+ */
+ timeout?: number | null,
+ /**
+ * 下载成功后以 tempFilePath 的形式传给页面,res = {tempFilePath: '文件的临时路径'}
+ * @defaultValue null
+ */
+ success?: DownloadFileSuccessCallback | null,
+ /**
+ * 失败的回调函数
+ * @defaultValue null
+ */
+ fail?: DownloadFileFailCallback | null,
+ /**
+ * 结束的回调函数(调用成功、失败都会执行)
+ * @defaultValue null
+ */
+ complete?: DownloadFileCompleteCallback | null
+};
+export type OnProgressDownloadResult = {
+ /**
+ * 下载进度百分比
+ */
+ progress: number,
+ /**
+ * 已经下载的数据长度,单位 Bytes
+ */
+ totalBytesWritten: number,
+ /**
+ * 预期需要下载的数据总长度,单位 Bytes
+ */
+ totalBytesExpectedToWrite: number
+};
+export type DownloadFileProgressUpdateCallback = (result: OnProgressDownloadResult) => void;
+export interface DownloadTask {
+ /**
+ * abort()
+ * @description
+ * 中断下载任务。
+ * @param {void}
+ * @return {void}
+ * @tutorial https://uniapp.dcloud.net.cn/api/request/network-file.html#downloadfile
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "4.4",
+ * "uniVer": "√",
+ * "unixVer": "3.9+"
+ * },
+ * "ios": {
+ * "osVer": "9.0",
+ * "uniVer": "√",
+ * "unixVer": "x"
+ * }
+ * }
+ * }
+ * @example
+ ```typescript
+ var downloadTask = uni.downloadFile({
+ url: 'https://www.example.com/file/test', //仅为示例,并非真实接口地址。
+ complete: ()=> {}
+ });
+ downloadTask.abort();
+ ```
+ */
+ abort(): void,
+ /**
+ * onProgressUpdate()
+ * @description
+ * 监听下载进度变化。
+ * @param {DownloadFileProgressUpdateCallback} callback
+ * @return {void}
+ * @tutorial https://uniapp.dcloud.net.cn/api/request/network-file.html#downloadfile
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "4.4",
+ * "uniVer": "√",
+ * "unixVer": "3.9+"
+ * },
+ * "ios": {
+ * "osVer": "9.0",
+ * "uniVer": "√",
+ * "unixVer": "x"
+ * }
+ * }
+ * }
+ * @example
+ ```typescript
+ downloadTask.onProgressUpdate((res) => {
+ console.log('下载进度' + res.progress);
+ console.log('已经下载的数据长度' + res.totalBytesWritten);
+ console.log('预期需要下载的数据总长度' + res.totalBytesExpectedToWrite);
+ });
+ ```
+ */
+ onProgressUpdate(callback: DownloadFileProgressUpdateCallback): void,
+};
+
+
+export interface Uni {
+ /**
+ * Request()
+ * @description
+ * 发起网络请求。
+ * @param {RequestOptions} options
+ * @return {RequestTask | null}
+ * @tutorial https://uniapp.dcloud.net.cn/api/request/request.html
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "4.4",
+ * "uniVer": "√",
+ * "unixVer": "3.9+"
+ * },
+ * "ios": {
+ * "osVer": "9.0",
+ * "uniVer": "√",
+ * "unixVer": "x"
+ * }
+ * }
+ * }
+ * @example
+ ```typescript
+ uni.request({
+ url: "http://192.168.12.106:8080/postHalo",
+ dataType: "json",
+ responseType: "json",
+ method: "POST",
+ data: {
+ platform: "ios",
+ },
+ // header: {
+ // "Content-Type": "application/json",
+ // },
+ timeout: 6000,
+ sslVerify: false,
+ withCredentials: false,
+ firstIpv4: false,
+ success(res) {
+ console.log("success :", res.data);
+ },
+ fail(e) {
+ console.log(e);
+ },
+ complete(res) {
+ console.log("complete :", res);
+ },
+ });
+ ```
+ */
+ request(param: RequestOptions): RequestTask | null;
+ /**
+ * UploadFile()
+ * @description
+ * 将本地资源上传到开发者服务器。
+ * @param {UploadFileOptions} options
+ * @return {UploadTask | null}
+ * @tutorial https://uniapp.dcloud.net.cn/api/request/network-file.html#uploadfile
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "4.4",
+ * "uniVer": "√",
+ * "unixVer": "3.9+"
+ * },
+ * "ios": {
+ * "osVer": "9.0",
+ * "uniVer": "√",
+ * "unixVer": "x"
+ * }
+ * }
+ * }
+ * @example
+ ```typescript
+ uni.uploadFile({
+ url: 'http://192.168.12.106:8080/uploadFile', //仅为示例,非真实的接口地址
+ filePath: "/static/logo.png",
+ name: 'file',
+ formData: {
+ 'user': 'test'
+ },
+ success: (uploadFileRes) => {
+ console.log(uploadFileRes.data);
+ }
+ });
+ ```
+ */
+ uploadFile(options: UploadFileOptions): UploadTask | null;
+ /**
+ * DownloadFile()
+ * @description
+ * 下载文件资源到本地,客户端直接发起一个 HTTP GET 请求,返回文件的本地临时路径。
+ * @param {DownloadFileOptions} options
+ * @return {DownloadTask | null}
+ * @tutorial https://uniapp.dcloud.net.cn/api/request/network-file.html#downloadfile
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "4.4",
+ * "uniVer": "√",
+ * "unixVer": "3.9+"
+ * },
+ * "ios": {
+ * "osVer": "9.0",
+ * "uniVer": "√",
+ * "unixVer": "x"
+ * }
+ * }
+ * }
+ * @example
+ ```typescript
+ uni.downloadFile({
+ url: "http://192.168.12.106:8080/downloadfile",
+ success(e) {
+ console.log("success111 :", e);
+ }
+ });
+ ```
+ */
+ downloadFile(options: DownloadFileOptions): DownloadTask | null;
+}
diff --git a/uni_modules/uni-network/utssdk/unierror.uts b/uni_modules/uni-network/utssdk/unierror.uts
new file mode 100644
index 0000000000000000000000000000000000000000..b1df42bc05295367d4ca377c2d0ce3ddbae58a55
--- /dev/null
+++ b/uni_modules/uni-network/utssdk/unierror.uts
@@ -0,0 +1,86 @@
+import { RequestErrorCode, RequestFail, UploadFileFail, DownloadFileFail } from "./interface.uts"
+
+/**
+ * 错误主题
+ */
+export const UniErrorSubject = 'uni-request';
+/**
+ * 错误码
+ * @UniError
+ */
+export const UniErrors : Map = new Map([
+
+ /**
+ * 接口超时
+ */
+ [5, 'time out'],
+ /**
+ * 服务端系统错误
+ */
+ [1000, 'server system error'],
+ /**
+ * json数据解析错误
+ */
+ [100001, 'invalid json'],
+ /**
+ * 错误信息json解析失败
+ */
+ [100002, 'error message invalid json'],
+ /**
+ * 未知的网络错误
+ */
+ [600000, 'unknown network error'],
+ /**
+ * 网络中断
+ */
+ [600003, 'network interrupted error'],
+ /**
+ * URL 格式不合法
+ */
+ [600009, 'invalid URL'],
+ /**
+ * 请求的 data 序列化失败
+ */
+ [600010, 'invalid request data'],
+
+ /**
+ * request系统错误
+ */
+ [602001, 'request system error']
+]);
+
+
+export function getErrcode(errCode : number) : RequestErrorCode {
+ const res = UniErrors[errCode];
+ return res == null ? 602001 : errCode;
+}
+
+
+export class RequestFailImpl extends UniError implements RequestFail {
+ constructor(errCode : RequestErrorCode) {
+ super();
+ this.errSubject = UniErrorSubject;
+ this.errCode = errCode;
+ this.errMsg = UniErrors[errCode] ?? "";
+ }
+}
+
+
+export class UploadFileFailImpl extends UniError implements UploadFileFail {
+ constructor(errCode : RequestErrorCode) {
+ super();
+ this.errSubject = "uni-uploadFile";
+ this.errCode = errCode;
+ this.errMsg = UniErrors[errCode] ?? "";
+ }
+}
+
+
+export class DownloadFileFailImpl extends UniError implements DownloadFileFail {
+ constructor(errCode : RequestErrorCode) {
+ super();
+ this.errSubject = "uni-downloadFile";
+ this.errCode = errCode;
+ this.errMsg = UniErrors[errCode] ?? "";
+ }
+}
\ No newline at end of file
diff --git a/uni_modules/uni-prompt/changelog.md b/uni_modules/uni-prompt/changelog.md
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/uni_modules/uni-prompt/package.json b/uni_modules/uni-prompt/package.json
new file mode 100644
index 0000000000000000000000000000000000000000..15dae6d655d11f595123c6bd5522c694273ef96f
--- /dev/null
+++ b/uni_modules/uni-prompt/package.json
@@ -0,0 +1,134 @@
+{
+ "id": "uni-prompt",
+ "displayName": "uni-prompt",
+ "version": "1.0.0",
+ "description": "uni-prompt",
+ "keywords": [
+ "uni-prompt"
+ ],
+ "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": {
+ "uni-ext-api": {
+ "uni": {
+ "showToast": {
+ "name": "showToast",
+ "app": {
+ "js": false,
+ "kotlin": true,
+ "swift": true
+ }
+ },
+ "hideToast": {
+ "name": "hideToast",
+ "app": {
+ "js": false,
+ "kotlin": true,
+ "swift": true
+ }
+ },
+ "showLoading": {
+ "name": "showLoading",
+ "app": {
+ "js": false,
+ "kotlin": true,
+ "swift": true
+ }
+ },
+ "hideLoading": {
+ "name": "hideLoading",
+ "app": {
+ "js": false,
+ "kotlin": true,
+ "swift": true
+ }
+ },
+ "showModal": {
+ "name": "showModal",
+ "app": {
+ "js": false,
+ "kotlin": true,
+ "swift": true
+ }
+ },
+ "showActionSheet": {
+ "name": "showActionSheet",
+ "app": {
+ "js": false,
+ "kotlin": true,
+ "swift": true
+ }
+ }
+ }
+ },
+ "dependencies": [],
+ "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"
+ }
+ }
+ }
+ }
+}
+
diff --git a/uni_modules/uni-prompt/readme.md b/uni_modules/uni-prompt/readme.md
new file mode 100644
index 0000000000000000000000000000000000000000..d080f9fd411f7f27962f068c1ccade4a75d24b9c
--- /dev/null
+++ b/uni_modules/uni-prompt/readme.md
@@ -0,0 +1,6 @@
+# uni-prompt
+### 开发文档
+[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)
\ No newline at end of file
diff --git a/uni_modules/uni-prompt/utssdk/app-android/AndroidManifest.xml b/uni_modules/uni-prompt/utssdk/app-android/AndroidManifest.xml
new file mode 100644
index 0000000000000000000000000000000000000000..c55e98b98a9eb44532c232ba4db558dd77f12e64
--- /dev/null
+++ b/uni_modules/uni-prompt/utssdk/app-android/AndroidManifest.xml
@@ -0,0 +1,4 @@
+
+
+
diff --git a/uni_modules/uni-prompt/utssdk/app-android/WaitingView.uts b/uni_modules/uni-prompt/utssdk/app-android/WaitingView.uts
new file mode 100644
index 0000000000000000000000000000000000000000..2378944ab7ace4d26632e0e2af286f8fb3b9c776
--- /dev/null
+++ b/uni_modules/uni-prompt/utssdk/app-android/WaitingView.uts
@@ -0,0 +1,313 @@
+// import Context from 'android.content.Context';
+import LayoutInflater from 'android.view.LayoutInflater';
+import R from 'io.dcloud.uts.prompt.R';
+import ViewGroup from 'android.view.ViewGroup';
+import LinearLayout from 'android.widget.LinearLayout';
+import Activity from 'android.app.Activity';
+import TextView from 'android.widget.TextView';
+import PopupWindow from 'android.widget.PopupWindow';
+import Build from 'android.os.Build';
+import Gravity from 'android.view.Gravity';
+import Color from 'android.graphics.Color';
+import Handler from 'android.os.Handler';
+import Looper from 'android.os.Looper';
+import string from 'android.R.string';
+import View from 'android.view.View';
+import MotionEvent from 'android.view.MotionEvent';
+import JSONObject from 'com.alibaba.fastjson.JSONObject';
+import ProgressBar from 'android.widget.ProgressBar';
+import BitmapFactory from 'android.graphics.BitmapFactory';
+import bool from 'android.R.bool';
+import Bitmap from 'android.graphics.Bitmap';
+import ImageView from 'android.widget.ImageView';
+import { UTSAndroid } from "io.dcloud.uts";
+import FileInputStream from 'java.io.FileInputStream';
+import File from 'java.io.File';
+import ByteArrayOutputStream from 'java.io.ByteArrayOutputStream';
+import InputStream from 'java.io.InputStream';
+import array from 'android.R.array';
+import Dialog from 'android.app.Dialog';
+
+export class WaitingView extends Dialog{
+
+ private context?: Activity
+ private style: JSONObject
+
+ private waitingView: ViewGroup
+ private waitingRootView: LinearLayout
+ private textView: TextView
+ private mProgressBar: ProgressBar
+ private seaparatorView: View
+ private mImageView: ImageView
+
+ private height: Int = -2
+ private width: Int = -2
+ private mask: boolean = false
+ private title: string = ""
+
+ screenWidth: Int
+ ScreenHeight: Int
+ density: number = 0
+
+ // json数据
+ private padding: Int = 0
+ private textSize: Int = 0
+
+
+ private loadingdDisplay = ""
+ private loadingHeight = 0
+ private LoadingIcon: string = ""
+ private mBitmap: Bitmap | null = null;
+
+
+ constructor(context?: Activity, style: UTSJSONObject) {
+
+ super(context!,R.style.loadingDialog);
+
+ this.context = context;
+ this.style = style.toJSONObject() as JSONObject
+ this.screenWidth = context?.getResources()?.getDisplayMetrics()!.widthPixels
+ this.ScreenHeight = context?.getResources()?.getDisplayMetrics()!.heightPixels
+ this.density = context?.getResources()?.getDisplayMetrics()!.density
+ this.waitingView = LayoutInflater.from(context).inflate(R.layout.dcloud_loadingview, null, false) as ViewGroup
+ this.waitingRootView = this.waitingView.findViewById(R.id.dcloud_pd_root)
+ this.mProgressBar = this.waitingView.findViewById(R.id.dcloud_pb_loading)
+ this.textView = this.waitingView.findViewById(R.id.dcloud_tv_loading)
+ this.seaparatorView = this.waitingView.findViewById(R.id.dcloud_view_seaparator)
+ this.mImageView = this.waitingView.findViewById(R.id.dcloud_iv_loading)
+
+ this.textView.setMaxLines(2)
+
+ this.handlerArguments()
+
+ let llp = (this.waitingRootView).getLayoutParams() as LinearLayout.LayoutParams
+ llp.width = this.width > 0 ? (this.width * this.density).toInt() : this.width
+ llp.height = -2
+ this.waitingRootView.setLayoutParams(llp)
+
+ this.initView()
+ this.makeBitmap()
+
+ setContentView(waitingView)
+ }
+
+ handlerArguments() {
+ if (this.style["height"] != null) {
+ this.height = parseInt(this.style["height"] as string).toInt()
+ }
+ if (this.style["width"] != null) {
+ this.width = parseInt(this.style["width"] as string).toInt()
+ }
+ if (this.style["modal"] != null) {
+ this.mask = this.style["modal"] as boolean
+ }
+ this.title = this.style.get("name") as string
+ if (this.style["loading"] != null) {
+ let loading = this.style["loading"] as JSONObject
+ this.loadingdDisplay = loading["display"] as string
+ if (loading["icon"] != null) {
+ this.LoadingIcon = loading["icon"] as string
+ }
+ if (loading["height"] != null) {
+ this.loadingHeight = parseInt(loading["height"] as string).toInt()
+ }
+ }
+ if ("block" == this.loadingdDisplay) {
+ this.waitingRootView.setOrientation(LinearLayout.VERTICAL)
+ } else if ("inline" == this.loadingdDisplay) {
+ this.waitingRootView.setOrientation(LinearLayout.HORIZONTAL)
+ } else if ("none" == this.loadingdDisplay) {
+ this.seaparatorView.setVisibility(View.GONE)
+ this.mProgressBar.setVisibility(View.GONE)
+ }
+ }
+
+ initView() {
+ // 初始化默认参数
+ // this.textView.setTextColor(0xffffffff)
+ this.textView.setTextColor(Color.WHITE)
+ this.textView.setGravity(Gravity.CENTER)
+ this.textView.setText(this.title)
+ this.textView.setTextSize(0, (16 * this.density).toFloat())
+
+ if(this.title.length < 1){
+ // 没有文本需要展示
+ this.textView.setVisibility(View.GONE)
+ this.waitingRootView.setPadding((10 * this.density).toInt(), (40 * this.density).toInt(), (10 * this.density).toInt(), (30 * this.density).toInt())
+ }else{
+ // 既有loading,也有文本
+ this.waitingRootView.setPadding((10 * this.density).toInt(), (20 * this.density).toInt(), (10 * this.density).toInt(), (20 * this.density).toInt())
+ }
+
+ let drawable = this.context?.getResources()!!.getDrawable(R.drawable.uts_dcloud_circle_white_progress)
+ if (this.loadingHeight > 0) {
+ this.mProgressBar.setLayoutParams(new LinearLayout.LayoutParams((this.loadingHeight * this.density).toInt(), (this.loadingHeight * this.density).toInt()))
+ } else {
+ let height = (drawable.getIntrinsicHeight() * 0.3).toInt()
+ this.mProgressBar.setLayoutParams(new LinearLayout.LayoutParams(height, height))
+ }
+
+ this.mProgressBar.setIndeterminateDrawable(drawable)
+ this.waitingRootView.setFocusable(true)
+ this.waitingRootView.setAlpha(0.9.toFloat())
+ }
+
+
+ override onTouchEvent(ev: MotionEvent): Boolean{
+ if(this.mask){
+ /**
+ * 明确说明了要遮罩 拦截
+ */
+ return super.onTouchEvent(ev)
+ }
+
+ let event=MotionEvent.obtain(ev.downTime, ev.eventTime, ev.action,
+ ev.rawX, ev.rawY,
+ ev.pressure, ev.size, ev.metaState, ev.xPrecision, ev.yPrecision, ev.deviceId, ev.edgeFlags)
+
+ return passThrough(event)
+ }
+ /**
+ * 决定是否要透传点击事件
+ */
+ passThrough(ev: MotionEvent): Boolean{
+ if(this.context == null){
+ return false
+ }
+ return this.context!.dispatchTouchEvent(ev)
+ }
+
+
+ showWaiting() {
+ this.setCanceledOnTouchOutside(false)
+ this.show()
+ }
+
+ close() {
+ this.dismiss()
+ if (this.mBitmap != null) {
+ this.mBitmap = null;
+ }
+ }
+
+ makeBitmap() {
+ if (this.LoadingIcon != null) {
+ // let mBitmap: Bitmap | null = null;
+ let imageBytes: ByteArray | null = null
+ if (this.LoadingIcon == "successIcon") {
+ imageBytes = this.inputStreamToArray(this.context?.getResources()!!.getAssets().open("uniappsuccess_icon.png"))
+ } else if (this.LoadingIcon == "errorIcon") {
+ imageBytes = this.inputStreamToArray(this.context?.getResources()!!.getAssets().open("uniapperror_icon.png"))
+ } else if (this.LoadingIcon.length > 0) {
+ let path: string = ""
+ if (this.LoadingIcon.startsWith("file://")) {
+ path = this.LoadingIcon.replace("file://", "")
+ } else {
+ path = UTSAndroid.getResourcePath(this.LoadingIcon)
+ }
+ if (path != null && path.length > 0) {
+ try {
+ let fis: FileInputStream = new FileInputStream(new File(path));
+ imageBytes = this.inputStreamToArray(fis);
+ fis.close()
+ } catch (e: Throwable) {
+ }
+ }
+ } else {
+ return
+ }
+ if (imageBytes == null || imageBytes.size == 0) {
+ return
+ }
+ let option = new BitmapFactory.Options()
+ option.inJustDecodeBounds = true
+ BitmapFactory.decodeByteArray(imageBytes, 0, imageBytes.size, option)
+ let width = option.outWidth
+ let height = option.outHeight
+
+ option.inSampleSize = this.getBestScale(height)
+ option.inJustDecodeBounds = false;
+ this.mBitmap = BitmapFactory.decodeByteArray(imageBytes, 0, imageBytes.size, option)
+
+ this.mProgressBar.setVisibility(View.GONE)
+ this.mImageView.setVisibility(View.VISIBLE)
+ this.mImageView.setImageBitmap(this.mBitmap)
+
+ if (width % height != 0) {
+ return
+ }
+
+ var lp: ViewGroup.LayoutParams = this.mImageView.getLayoutParams()
+ if (lp != null) {
+ if (this.loadingHeight > 0) {
+ lp.height = (this.loadingHeight * this.density).toInt()
+ lp.width = (this.loadingHeight * this.density).toInt()
+ } else {
+ lp.width = this.mBitmap!!.getHeight()
+ lp.height = this.mBitmap!!.getHeight()
+ }
+ this.mImageView.setLayoutParams(lp)
+ }
+ }
+ }
+
+ getBestScale(height: Int): Int {
+ let sampleSize: Int = 1;
+ let maxEdge = Math.min(this.screenWidth, this.ScreenHeight) - 10 * 2 * this.density
+ if (maxEdge > 0 && height > maxEdge) {
+ sampleSize = (height / maxEdge).toInt()
+ }
+ return sampleSize
+ }
+
+ inputStreamToArray(inputStream: InputStream): ByteArray | null {
+ try {
+ let bos: ByteArrayOutputStream = new ByteArrayOutputStream()
+ let bytes: ByteArray = new ByteArray(1024)
+
+ do {
+ let length = inputStream.read(bytes)
+ if (length != -1) {
+ bos.write(bytes, 0, length)
+ } else {
+ break
+ }
+ } while (true)
+ bos.close()
+ return bos.toByteArray()
+ } catch (e: Throwable) {
+ return null;
+ }
+ }
+}
+
+class MainThreadRunnable implements Runnable {
+
+ pop: PopupWindow
+
+ constructor(pop: PopupWindow) {
+ this.pop = pop
+ }
+
+ override run() {
+ this.pop.dismiss()
+ }
+}
+
+class WaitingDismissListener implements PopupWindow.OnDismissListener {
+ override onDismiss() {
+ }
+}
+
+class TouchInterceptorListener implements View.OnTouchListener {
+
+ interceptor: boolean
+
+ constructor(interceptor: boolean) {
+ this.interceptor = interceptor
+ }
+
+ override onTouch(v: View, event: MotionEvent): boolean {
+ return this.interceptor
+ }
+}
\ No newline at end of file
diff --git a/uni_modules/uni-prompt/utssdk/app-android/assets/uniapperror_icon.png b/uni_modules/uni-prompt/utssdk/app-android/assets/uniapperror_icon.png
new file mode 100644
index 0000000000000000000000000000000000000000..4743b25e1284270fee6ba8fefdb5265f6c451a93
Binary files /dev/null and b/uni_modules/uni-prompt/utssdk/app-android/assets/uniapperror_icon.png differ
diff --git a/uni_modules/uni-prompt/utssdk/app-android/assets/uniappsuccess_icon.png b/uni_modules/uni-prompt/utssdk/app-android/assets/uniappsuccess_icon.png
new file mode 100644
index 0000000000000000000000000000000000000000..c1f5bd7c5293dcc37284f30b215ff2a3779c316f
Binary files /dev/null and b/uni_modules/uni-prompt/utssdk/app-android/assets/uniappsuccess_icon.png differ
diff --git a/uni_modules/uni-prompt/utssdk/app-android/config.json b/uni_modules/uni-prompt/utssdk/app-android/config.json
new file mode 100644
index 0000000000000000000000000000000000000000..79042414cf5dc44a269529c97f1667bc88b10274
--- /dev/null
+++ b/uni_modules/uni-prompt/utssdk/app-android/config.json
@@ -0,0 +1,7 @@
+{
+ "dependencies": [
+ "androidx.recyclerview:recyclerview:1.0.0",
+ "androidx.appcompat:appcompat:1.0.0"
+ ]
+}
+
diff --git a/uni_modules/uni-prompt/utssdk/app-android/index.uts b/uni_modules/uni-prompt/utssdk/app-android/index.uts
new file mode 100644
index 0000000000000000000000000000000000000000..819c790b20041c8b1d071ccd9dff296ca1481058
--- /dev/null
+++ b/uni_modules/uni-prompt/utssdk/app-android/index.uts
@@ -0,0 +1,52 @@
+import { ShowLoadingOptions,ShowLoading,HideLoading} from "../interface.uts"
+import { ShowToastOptions,ShowToast,HideToast} from "../interface.uts"
+import { ShowActionSheetOptions,ShowActionSheet} from "../interface.uts"
+import { ShowModalOptions,ShowModal} from "../interface.uts"
+
+import * as ToastModule from "./showToast.uts"
+import * as ModalModule from "./showModal.uts"
+import * as ActionSheetModule from "./showActionSheet.uts"
+
+import UTSAndroid from 'io.dcloud.uts.UTSAndroid';
+
+export const showToast : ShowToast = function (options : ShowToastOptions) {
+
+ // 指定在ui线程执行
+ UTSAndroid.dispatchAsync('main',function(res){
+ ToastModule.showToastImpl(options)
+ },null)
+
+}
+
+export const hideToast : HideToast = function () {
+ UTSAndroid.dispatchAsync('main',function(res){
+ ToastModule.hideToastImpl()
+ },null)
+
+}
+
+export const showLoading : ShowLoading = function (options : ShowLoadingOptions) {
+ UTSAndroid.dispatchAsync('main',function(res){
+ ToastModule.showLoadingImpl(options)
+ },null)
+}
+
+export const hideLoading : HideLoading = function () {
+ UTSAndroid.dispatchAsync('main',function(res){
+ ToastModule.hideLoadingImpl()
+ },null)
+}
+
+export const showModal : ShowModal = function (options : ShowModalOptions) {
+ UTSAndroid.dispatchAsync('main',function(res){
+ ModalModule.showModalImpl(options)
+ },null)
+}
+
+export const showActionSheet : ShowActionSheet = function (options : ShowActionSheetOptions) {
+ UTSAndroid.dispatchAsync('main',function(res){
+ ActionSheetModule.actionSheetImpl(options)
+ },null)
+}
+
+
diff --git a/uni_modules/uni-prompt/utssdk/app-android/res/anim/uts_as_slide_in_bottom.xml b/uni_modules/uni-prompt/utssdk/app-android/res/anim/uts_as_slide_in_bottom.xml
new file mode 100644
index 0000000000000000000000000000000000000000..60d98e1994c248fbc3a79a5fee7248a18575eb17
--- /dev/null
+++ b/uni_modules/uni-prompt/utssdk/app-android/res/anim/uts_as_slide_in_bottom.xml
@@ -0,0 +1,4 @@
+
+
\ No newline at end of file
diff --git a/uni_modules/uni-prompt/utssdk/app-android/res/anim/uts_as_slide_out_top.xml b/uni_modules/uni-prompt/utssdk/app-android/res/anim/uts_as_slide_out_top.xml
new file mode 100644
index 0000000000000000000000000000000000000000..d359072a26b37fe0f0aef0ededc6f3e1fbd1380e
--- /dev/null
+++ b/uni_modules/uni-prompt/utssdk/app-android/res/anim/uts_as_slide_out_top.xml
@@ -0,0 +1,4 @@
+
+
\ No newline at end of file
diff --git a/uni_modules/uni-prompt/utssdk/app-android/res/drawable/actionsheet_bg_rounded.xml b/uni_modules/uni-prompt/utssdk/app-android/res/drawable/actionsheet_bg_rounded.xml
new file mode 100644
index 0000000000000000000000000000000000000000..461906f7ecb36acd8fac0ba03001a6ac5fb47977
--- /dev/null
+++ b/uni_modules/uni-prompt/utssdk/app-android/res/drawable/actionsheet_bg_rounded.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/uni_modules/uni-prompt/utssdk/app-android/res/drawable/actionsheet_bg_rounded_night.xml b/uni_modules/uni-prompt/utssdk/app-android/res/drawable/actionsheet_bg_rounded_night.xml
new file mode 100644
index 0000000000000000000000000000000000000000..59485433ee69390d3ca07f7b23277e7914040236
--- /dev/null
+++ b/uni_modules/uni-prompt/utssdk/app-android/res/drawable/actionsheet_bg_rounded_night.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/uni_modules/uni-prompt/utssdk/app-android/res/drawable/actionsheet_button_select_total.xml b/uni_modules/uni-prompt/utssdk/app-android/res/drawable/actionsheet_button_select_total.xml
new file mode 100644
index 0000000000000000000000000000000000000000..82291bd858cb02da96b555967bd4cdbae89fdb82
--- /dev/null
+++ b/uni_modules/uni-prompt/utssdk/app-android/res/drawable/actionsheet_button_select_total.xml
@@ -0,0 +1,24 @@
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
\ No newline at end of file
diff --git a/uni_modules/uni-prompt/utssdk/app-android/res/drawable/actionsheet_button_select_total_night.xml b/uni_modules/uni-prompt/utssdk/app-android/res/drawable/actionsheet_button_select_total_night.xml
new file mode 100644
index 0000000000000000000000000000000000000000..fa18118efc6724183b8a7a08922e1b10aca45219
--- /dev/null
+++ b/uni_modules/uni-prompt/utssdk/app-android/res/drawable/actionsheet_button_select_total_night.xml
@@ -0,0 +1,27 @@
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/uni_modules/uni-prompt/utssdk/app-android/res/drawable/actionsheet_button_select_total_night_top.xml b/uni_modules/uni-prompt/utssdk/app-android/res/drawable/actionsheet_button_select_total_night_top.xml
new file mode 100644
index 0000000000000000000000000000000000000000..802fb1fd153089c8024eccc608da51d2ab9a1b7d
--- /dev/null
+++ b/uni_modules/uni-prompt/utssdk/app-android/res/drawable/actionsheet_button_select_total_night_top.xml
@@ -0,0 +1,32 @@
+
+
+
+ -
+
+
+
+
+
+
+ -
+
+
+
+
+
+
+ -
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/uni_modules/uni-prompt/utssdk/app-android/res/drawable/actionsheet_button_select_total_top.xml b/uni_modules/uni-prompt/utssdk/app-android/res/drawable/actionsheet_button_select_total_top.xml
new file mode 100644
index 0000000000000000000000000000000000000000..cff323ad0aa518c410681c25f61911d562187481
--- /dev/null
+++ b/uni_modules/uni-prompt/utssdk/app-android/res/drawable/actionsheet_button_select_total_top.xml
@@ -0,0 +1,32 @@
+
+
+
+ -
+
+
+
+
+
+
+ -
+
+
+
+
+
+
+ -
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/uni_modules/uni-prompt/utssdk/app-android/res/drawable/dcloud_loading_bg.xml b/uni_modules/uni-prompt/utssdk/app-android/res/drawable/dcloud_loading_bg.xml
new file mode 100644
index 0000000000000000000000000000000000000000..801ee7343a61d20dc917dd2335b1330689235e39
--- /dev/null
+++ b/uni_modules/uni-prompt/utssdk/app-android/res/drawable/dcloud_loading_bg.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/uni_modules/uni-prompt/utssdk/app-android/res/drawable/dialog_bg_rounded.xml b/uni_modules/uni-prompt/utssdk/app-android/res/drawable/dialog_bg_rounded.xml
new file mode 100644
index 0000000000000000000000000000000000000000..f1a8adebf727be43dd6848f06836232bc1c6ab13
--- /dev/null
+++ b/uni_modules/uni-prompt/utssdk/app-android/res/drawable/dialog_bg_rounded.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/uni_modules/uni-prompt/utssdk/app-android/res/drawable/dialog_bg_rounded_night.xml b/uni_modules/uni-prompt/utssdk/app-android/res/drawable/dialog_bg_rounded_night.xml
new file mode 100644
index 0000000000000000000000000000000000000000..8d4859e865f4f33c273fa75b3b8c2bae31e0f02f
--- /dev/null
+++ b/uni_modules/uni-prompt/utssdk/app-android/res/drawable/dialog_bg_rounded_night.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/uni_modules/uni-prompt/utssdk/app-android/res/drawable/dialog_button_select_left.xml b/uni_modules/uni-prompt/utssdk/app-android/res/drawable/dialog_button_select_left.xml
new file mode 100644
index 0000000000000000000000000000000000000000..b9c13c9a7e47cfcd44a39903e33612d26d772582
--- /dev/null
+++ b/uni_modules/uni-prompt/utssdk/app-android/res/drawable/dialog_button_select_left.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/uni_modules/uni-prompt/utssdk/app-android/res/drawable/dialog_button_select_left_night.xml b/uni_modules/uni-prompt/utssdk/app-android/res/drawable/dialog_button_select_left_night.xml
new file mode 100644
index 0000000000000000000000000000000000000000..8fec64c5946fad8a562a103cfc32407da9ec36ad
--- /dev/null
+++ b/uni_modules/uni-prompt/utssdk/app-android/res/drawable/dialog_button_select_left_night.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/uni_modules/uni-prompt/utssdk/app-android/res/drawable/dialog_button_select_right.xml b/uni_modules/uni-prompt/utssdk/app-android/res/drawable/dialog_button_select_right.xml
new file mode 100644
index 0000000000000000000000000000000000000000..7a06814e78e5ba43b9622805933fdfee27324c33
--- /dev/null
+++ b/uni_modules/uni-prompt/utssdk/app-android/res/drawable/dialog_button_select_right.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/uni_modules/uni-prompt/utssdk/app-android/res/drawable/dialog_button_select_right_night.xml b/uni_modules/uni-prompt/utssdk/app-android/res/drawable/dialog_button_select_right_night.xml
new file mode 100644
index 0000000000000000000000000000000000000000..fdea82037dce20627a44ce5c0f8c13d6e5dd359b
--- /dev/null
+++ b/uni_modules/uni-prompt/utssdk/app-android/res/drawable/dialog_button_select_right_night.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/uni_modules/uni-prompt/utssdk/app-android/res/drawable/dialog_button_select_total.xml b/uni_modules/uni-prompt/utssdk/app-android/res/drawable/dialog_button_select_total.xml
new file mode 100644
index 0000000000000000000000000000000000000000..b3130c6fe04347756a576aa2672ddb6660ac4699
--- /dev/null
+++ b/uni_modules/uni-prompt/utssdk/app-android/res/drawable/dialog_button_select_total.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/uni_modules/uni-prompt/utssdk/app-android/res/drawable/dialog_button_select_total_night.xml b/uni_modules/uni-prompt/utssdk/app-android/res/drawable/dialog_button_select_total_night.xml
new file mode 100644
index 0000000000000000000000000000000000000000..5aee277a142635ec402568d5ae972609cf53b630
--- /dev/null
+++ b/uni_modules/uni-prompt/utssdk/app-android/res/drawable/dialog_button_select_total_night.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/uni_modules/uni-prompt/utssdk/app-android/res/drawable/shape_btn_bg_normal_left.xml b/uni_modules/uni-prompt/utssdk/app-android/res/drawable/shape_btn_bg_normal_left.xml
new file mode 100644
index 0000000000000000000000000000000000000000..14d38d58ef22f9d155eee44a1484c8acd8b28a6c
--- /dev/null
+++ b/uni_modules/uni-prompt/utssdk/app-android/res/drawable/shape_btn_bg_normal_left.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/uni_modules/uni-prompt/utssdk/app-android/res/drawable/shape_btn_bg_normal_left_night.xml b/uni_modules/uni-prompt/utssdk/app-android/res/drawable/shape_btn_bg_normal_left_night.xml
new file mode 100644
index 0000000000000000000000000000000000000000..d137151633f26d8b82f47ad56e77254119f1e3c4
--- /dev/null
+++ b/uni_modules/uni-prompt/utssdk/app-android/res/drawable/shape_btn_bg_normal_left_night.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/uni_modules/uni-prompt/utssdk/app-android/res/drawable/shape_btn_bg_normal_right.xml b/uni_modules/uni-prompt/utssdk/app-android/res/drawable/shape_btn_bg_normal_right.xml
new file mode 100644
index 0000000000000000000000000000000000000000..4f5dcdbadaca498d650a12cec1b383c0a74148ae
--- /dev/null
+++ b/uni_modules/uni-prompt/utssdk/app-android/res/drawable/shape_btn_bg_normal_right.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/uni_modules/uni-prompt/utssdk/app-android/res/drawable/shape_btn_bg_normal_right_night.xml b/uni_modules/uni-prompt/utssdk/app-android/res/drawable/shape_btn_bg_normal_right_night.xml
new file mode 100644
index 0000000000000000000000000000000000000000..27732e65fd35039870406476361d73af0db9ffea
--- /dev/null
+++ b/uni_modules/uni-prompt/utssdk/app-android/res/drawable/shape_btn_bg_normal_right_night.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/uni_modules/uni-prompt/utssdk/app-android/res/drawable/shape_btn_bg_normal_total.xml b/uni_modules/uni-prompt/utssdk/app-android/res/drawable/shape_btn_bg_normal_total.xml
new file mode 100644
index 0000000000000000000000000000000000000000..482fa450003935ee6fe5fd74ce8cd85081007dd7
--- /dev/null
+++ b/uni_modules/uni-prompt/utssdk/app-android/res/drawable/shape_btn_bg_normal_total.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/uni_modules/uni-prompt/utssdk/app-android/res/drawable/shape_btn_bg_normal_total_night.xml b/uni_modules/uni-prompt/utssdk/app-android/res/drawable/shape_btn_bg_normal_total_night.xml
new file mode 100644
index 0000000000000000000000000000000000000000..9a2458c0825fe66f27e0e4a018fb367358a4e561
--- /dev/null
+++ b/uni_modules/uni-prompt/utssdk/app-android/res/drawable/shape_btn_bg_normal_total_night.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/uni_modules/uni-prompt/utssdk/app-android/res/drawable/shape_btn_bg_select_left.xml b/uni_modules/uni-prompt/utssdk/app-android/res/drawable/shape_btn_bg_select_left.xml
new file mode 100644
index 0000000000000000000000000000000000000000..185ca283709dc560ab702a82ea29fa5c874e722b
--- /dev/null
+++ b/uni_modules/uni-prompt/utssdk/app-android/res/drawable/shape_btn_bg_select_left.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/uni_modules/uni-prompt/utssdk/app-android/res/drawable/shape_btn_bg_select_left_night.xml b/uni_modules/uni-prompt/utssdk/app-android/res/drawable/shape_btn_bg_select_left_night.xml
new file mode 100644
index 0000000000000000000000000000000000000000..143afb82e44aad4357e8c7e0c90d0666c1f29fb6
--- /dev/null
+++ b/uni_modules/uni-prompt/utssdk/app-android/res/drawable/shape_btn_bg_select_left_night.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/uni_modules/uni-prompt/utssdk/app-android/res/drawable/shape_btn_bg_select_right.xml b/uni_modules/uni-prompt/utssdk/app-android/res/drawable/shape_btn_bg_select_right.xml
new file mode 100644
index 0000000000000000000000000000000000000000..b40e15b921a500b2ad3ebb01f02bf989459a66f5
--- /dev/null
+++ b/uni_modules/uni-prompt/utssdk/app-android/res/drawable/shape_btn_bg_select_right.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/uni_modules/uni-prompt/utssdk/app-android/res/drawable/shape_btn_bg_select_right_night.xml b/uni_modules/uni-prompt/utssdk/app-android/res/drawable/shape_btn_bg_select_right_night.xml
new file mode 100644
index 0000000000000000000000000000000000000000..7745310246a52706b406af93ef21323515e57314
--- /dev/null
+++ b/uni_modules/uni-prompt/utssdk/app-android/res/drawable/shape_btn_bg_select_right_night.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/uni_modules/uni-prompt/utssdk/app-android/res/drawable/shape_btn_bg_select_total.xml b/uni_modules/uni-prompt/utssdk/app-android/res/drawable/shape_btn_bg_select_total.xml
new file mode 100644
index 0000000000000000000000000000000000000000..af7406f1a6a75221fe46659c164c904f0b68dafc
--- /dev/null
+++ b/uni_modules/uni-prompt/utssdk/app-android/res/drawable/shape_btn_bg_select_total.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/uni_modules/uni-prompt/utssdk/app-android/res/drawable/shape_btn_bg_select_total_night.xml b/uni_modules/uni-prompt/utssdk/app-android/res/drawable/shape_btn_bg_select_total_night.xml
new file mode 100644
index 0000000000000000000000000000000000000000..6107a4a7f97f4db09cac0741e1c809be9784ae41
--- /dev/null
+++ b/uni_modules/uni-prompt/utssdk/app-android/res/drawable/shape_btn_bg_select_total_night.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/uni_modules/uni-prompt/utssdk/app-android/res/drawable/uts_dcloud_circle_white_progress.xml b/uni_modules/uni-prompt/utssdk/app-android/res/drawable/uts_dcloud_circle_white_progress.xml
new file mode 100644
index 0000000000000000000000000000000000000000..7deadb84192f4700fd332524d2447f3031e580a4
--- /dev/null
+++ b/uni_modules/uni-prompt/utssdk/app-android/res/drawable/uts_dcloud_circle_white_progress.xml
@@ -0,0 +1,22 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/uni_modules/uni-prompt/utssdk/app-android/res/layout/ac_recyclerview_layout.xml b/uni_modules/uni-prompt/utssdk/app-android/res/layout/ac_recyclerview_layout.xml
new file mode 100644
index 0000000000000000000000000000000000000000..edd670a89286e3fe554c9bbdb5566298547f5b51
--- /dev/null
+++ b/uni_modules/uni-prompt/utssdk/app-android/res/layout/ac_recyclerview_layout.xml
@@ -0,0 +1,26 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/uni_modules/uni-prompt/utssdk/app-android/res/layout/ac_recyclerview_layout_night.xml b/uni_modules/uni-prompt/utssdk/app-android/res/layout/ac_recyclerview_layout_night.xml
new file mode 100644
index 0000000000000000000000000000000000000000..fe192318ba2df67f369ccca87fe63f0aac5b7d0b
--- /dev/null
+++ b/uni_modules/uni-prompt/utssdk/app-android/res/layout/ac_recyclerview_layout_night.xml
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/uni_modules/uni-prompt/utssdk/app-android/res/layout/ac_recyclerview_layout_top.xml b/uni_modules/uni-prompt/utssdk/app-android/res/layout/ac_recyclerview_layout_top.xml
new file mode 100644
index 0000000000000000000000000000000000000000..dd275f61de0ac01130af5b262806cd797f9323b3
--- /dev/null
+++ b/uni_modules/uni-prompt/utssdk/app-android/res/layout/ac_recyclerview_layout_top.xml
@@ -0,0 +1,27 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/uni_modules/uni-prompt/utssdk/app-android/res/layout/ac_recyclerview_layout_top_night.xml b/uni_modules/uni-prompt/utssdk/app-android/res/layout/ac_recyclerview_layout_top_night.xml
new file mode 100644
index 0000000000000000000000000000000000000000..dd9d78da101fc8fff8e57e2e043ae6f9514f2320
--- /dev/null
+++ b/uni_modules/uni-prompt/utssdk/app-android/res/layout/ac_recyclerview_layout_top_night.xml
@@ -0,0 +1,27 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/uni_modules/uni-prompt/utssdk/app-android/res/layout/dcloud_loadingview.xml b/uni_modules/uni-prompt/utssdk/app-android/res/layout/dcloud_loadingview.xml
new file mode 100644
index 0000000000000000000000000000000000000000..e54f6e5960831f4e04ca75d91b43535cf6dee908
--- /dev/null
+++ b/uni_modules/uni-prompt/utssdk/app-android/res/layout/dcloud_loadingview.xml
@@ -0,0 +1,42 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/uni_modules/uni-prompt/utssdk/app-android/res/layout/modal_dialog.xml b/uni_modules/uni-prompt/utssdk/app-android/res/layout/modal_dialog.xml
new file mode 100644
index 0000000000000000000000000000000000000000..57ad33d537e7dcc846c80dc99560bdbc137da6bb
--- /dev/null
+++ b/uni_modules/uni-prompt/utssdk/app-android/res/layout/modal_dialog.xml
@@ -0,0 +1,112 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/uni_modules/uni-prompt/utssdk/app-android/res/layout/modal_dialog_night.xml b/uni_modules/uni-prompt/utssdk/app-android/res/layout/modal_dialog_night.xml
new file mode 100644
index 0000000000000000000000000000000000000000..5505c45fbe2b06ec8b1f0ca22f968e88e2012727
--- /dev/null
+++ b/uni_modules/uni-prompt/utssdk/app-android/res/layout/modal_dialog_night.xml
@@ -0,0 +1,112 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/uni_modules/uni-prompt/utssdk/app-android/res/layout/uts_action_sheet.xml b/uni_modules/uni-prompt/utssdk/app-android/res/layout/uts_action_sheet.xml
new file mode 100644
index 0000000000000000000000000000000000000000..4f3e1fef307aa38499f0a7c2fc87264a0fa842aa
--- /dev/null
+++ b/uni_modules/uni-prompt/utssdk/app-android/res/layout/uts_action_sheet.xml
@@ -0,0 +1,63 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/uni_modules/uni-prompt/utssdk/app-android/res/layout/uts_action_sheet_night.xml b/uni_modules/uni-prompt/utssdk/app-android/res/layout/uts_action_sheet_night.xml
new file mode 100644
index 0000000000000000000000000000000000000000..e3545f9be96b4b250362adfdf4c5ab9c0d8efb7a
--- /dev/null
+++ b/uni_modules/uni-prompt/utssdk/app-android/res/layout/uts_action_sheet_night.xml
@@ -0,0 +1,61 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/uni_modules/uni-prompt/utssdk/app-android/res/values-zh/strings.xml b/uni_modules/uni-prompt/utssdk/app-android/res/values-zh/strings.xml
new file mode 100644
index 0000000000000000000000000000000000000000..33774bb3d8ea1c8ff98bb30e5f7384410727b714
--- /dev/null
+++ b/uni_modules/uni-prompt/utssdk/app-android/res/values-zh/strings.xml
@@ -0,0 +1,6 @@
+
+ Configuration
+ 取消
+ 确定
+ 取消
+
diff --git a/uni_modules/uni-prompt/utssdk/app-android/res/values/colors.xml b/uni_modules/uni-prompt/utssdk/app-android/res/values/colors.xml
new file mode 100644
index 0000000000000000000000000000000000000000..cc485743802f56356e941b313c420b6ba744050b
--- /dev/null
+++ b/uni_modules/uni-prompt/utssdk/app-android/res/values/colors.xml
@@ -0,0 +1,46 @@
+
+
+
+ #FFFFFF
+ #efefef
+
+ #DEDEDE
+ #FFFFFF
+
+ #1C1C1C
+ #272727
+
+
+
+ #000000
+ #CFCFCF
+
+
+ #747474
+ #909090
+
+
+ #F6F6F6
+ #3d3d3d
+
+
+ #000000
+ #CFCFCF
+
+ #808080
+ #CFCFCF
+
+ #E0E0E0
+ #303030
+
+ #E3E3E3
+ #303030
+
+ #4A5E86
+ #7388a2
+
+ #000000
+ #a5a5a5
+
+
+
\ No newline at end of file
diff --git a/uni_modules/uni-prompt/utssdk/app-android/res/values/strings.xml b/uni_modules/uni-prompt/utssdk/app-android/res/values/strings.xml
new file mode 100644
index 0000000000000000000000000000000000000000..8ab0ce6cddc5e9e0ced7ffcd520ea94f11648dec
--- /dev/null
+++ b/uni_modules/uni-prompt/utssdk/app-android/res/values/strings.xml
@@ -0,0 +1,7 @@
+
+
+ Configuration
+ Cancel
+ Sure
+ Cancel
+
\ No newline at end of file
diff --git a/uni_modules/uni-prompt/utssdk/app-android/res/values/styles.xml b/uni_modules/uni-prompt/utssdk/app-android/res/values/styles.xml
new file mode 100644
index 0000000000000000000000000000000000000000..3ef3d9d3475345e81bd960eb65f880439bf9de6a
--- /dev/null
+++ b/uni_modules/uni-prompt/utssdk/app-android/res/values/styles.xml
@@ -0,0 +1,23 @@
+
+
+
+
+
+
+
diff --git a/uni_modules/uni-prompt/utssdk/app-android/showActionSheet.uts b/uni_modules/uni-prompt/utssdk/app-android/showActionSheet.uts
new file mode 100644
index 0000000000000000000000000000000000000000..bc3a7161be0991ca07ca925bb9edbc2b03c10a02
--- /dev/null
+++ b/uni_modules/uni-prompt/utssdk/app-android/showActionSheet.uts
@@ -0,0 +1,323 @@
+import AlertDialog from 'android.app.AlertDialog';
+import Dialog from 'android.app.Dialog';
+import Activity from 'android.app.Activity';
+import Gravity from 'android.view.Gravity';
+import { UTSAndroid } from "io.dcloud.uts";
+
+import ViewGroup from 'android.view.ViewGroup';
+import View from 'android.view.View';
+import Color from 'android.graphics.Color';
+import ColorDrawable from 'android.graphics.drawable.ColorDrawable';
+
+import R from 'io.dcloud.uts.prompt.R';
+import TextView from 'android.widget.TextView';
+import LayoutInflater from 'android.view.LayoutInflater';
+
+import AppCompatTextView from 'androidx.appcompat.widget.AppCompatTextView';
+import LinearLayoutCompat from 'androidx.appcompat.widget.LinearLayoutCompat';
+
+import LinearLayoutManager from 'androidx.recyclerview.widget.LinearLayoutManager';
+import RecyclerView from 'androidx.recyclerview.widget.RecyclerView';
+
+
+
+import { ShowActionSheetOptions, ShowActionSheetSuccess,ShowActionSheetFail} from '../interface.uts'
+import string from 'android.R.string';
+import WindowManager from 'android.view.WindowManager';
+
+let uniActionSheet:UniActionSheet|null = null
+
+/**
+ * 弹出功能入口
+ */
+export function actionSheetImpl(style: ShowActionSheetOptions) {
+
+ /**
+ * 参数校验,itemList 不能为空
+ */
+ if(style.itemList == null || style.itemList.length < 1){
+
+ let res = new UniError("uni-prompt",-1,"showActionSheet:fail parameter error: parameter.itemList should have at least 1 item");
+
+ style.fail?.(res)
+ style.complete?.(res)
+ return ;
+ }
+
+
+ /**
+ * 元素个数不能超过6个
+ */
+ if(style.itemList.size > 6){
+ let res = new UniError("uni-prompt",-2,"showActionSheet:fail parameter error: itemList should not be large than 6");
+
+ style.fail?.(res)
+ style.complete?.(res)
+ return ;
+ }
+
+
+ if(uniActionSheet != null){
+ uniActionSheet?.dismiss()
+ }
+ uniActionSheet = new UniActionSheet(UTSAndroid.getUniActivity()!, style)
+ uniActionSheet?.show()
+
+ UTSAndroid.onAppActivityDestroy(function(){
+ uniActionSheet?.dismiss()
+ uniActionSheet = null
+ })
+
+}
+
+
+/**
+ * UniActionSheet
+ * 功能实现
+ */
+export class UniActionSheet extends Dialog{
+
+ /**
+ * 宿主activity
+ */
+ hostActivity: Activity
+ /**
+ * 宿主样式
+ */
+ hostStyle:ShowActionSheetOptions
+ /**
+ * 标题组件
+ */
+ title: AppCompatTextView
+ /**
+ * 取消按钮
+ */
+ cancel: AppCompatTextView
+ /**
+ * 列表 recycler
+ */
+ myRecyclerView: RecyclerView
+
+ /**
+ * title 组件
+ */
+ lineTitle: LinearLayoutCompat
+ /**
+ * 内容组件
+ */
+ lineContent: LinearLayoutCompat
+ /**
+ * 取消组件
+ */
+ lineCancel: LinearLayoutCompat
+
+
+ constructor(activity: Activity, style: ShowActionSheetOptions) {
+
+ super(activity,R.style.actionsheetDialog);
+
+ this.hostActivity = activity
+ this.hostStyle = style
+
+ /**
+ * 适配暗黑模式,配置不同的布局文件
+ */
+ if(UTSAndroid.getAppDarkMode()){
+ setContentView(R.layout.uts_action_sheet_night)
+ }else{
+ setContentView(R.layout.uts_action_sheet)
+ }
+
+
+ this.title = findViewById(R.id.tvTitle)
+ this.cancel = findViewById(R.id.tvCancelAction)
+ this.lineTitle = findViewById(R.id.line_title)
+ this.lineContent = findViewById(R.id.line_content)
+ this.lineCancel = findViewById(R.id.line_cancel)
+ this.myRecyclerView = findViewById(R.id.myRecyclerview)
+ this.myRecyclerView.layoutManager = LinearLayoutManager(this.hostActivity)
+
+
+ this.cancel.setOnClickListener(new CancelClickListener(this,this.hostStyle));
+ let recyclerviewAdapter = new ItemAdapter(this,this.hostStyle)
+ this.myRecyclerView.adapter = recyclerviewAdapter
+
+ if(!style.title.isNullOrBlank()){
+ this.lineTitle.setVisibility(View.VISIBLE)
+ this.title.setText(style.title)
+ }
+
+ if(this.window != null){
+ this.window!.setLayout(WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.WRAP_CONTENT)
+ this.window!.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.BOTTOM);
+ if(this.window!.attributes != null){
+ this.window!.attributes!.windowAnimations = R.style.DialogAnimations_utsSmileWindow;
+ }
+ }
+
+ }
+
+
+}
+
+/**
+ * 列表选项点击事件监听
+ */
+class ItemClickListener extends View.OnClickListener{
+
+ host:Dialog
+ hostStyle:ShowActionSheetOptions
+ hostIndex:number
+
+ constructor(dialog:Dialog,style: ShowActionSheetOptions,index:number){
+ super()
+ this.host = dialog
+ this.hostStyle = style
+ this.hostIndex = index
+ }
+
+ override onClick(v?: View):void{
+
+ const res : ShowActionSheetSuccess = {
+ tapIndex: this.hostIndex
+ }
+
+ this.hostStyle.success?.(res)
+ this.hostStyle.complete?.(res)
+
+ this.host.dismiss()
+
+ }
+}
+
+/**
+ * 取消按钮点击事件
+ */
+class CancelClickListener extends View.OnClickListener{
+
+ host:Dialog
+ hostStyle:ShowActionSheetOptions
+
+ constructor(dialog:Dialog,style: ShowActionSheetOptions){
+ super()
+ this.host = dialog
+ this.hostStyle = style
+ }
+
+ override onClick(v?: View):void{
+
+ let res = new UniError("uni-prompt",1002,"showActionSheet:fail cancel");
+
+ this.hostStyle.fail?.(res)
+ this.hostStyle.complete?.(res)
+
+ this.host.dismiss()
+
+ }
+}
+
+
+/**
+ * 列表数据适配器
+ */
+class ItemAdapter extends RecyclerView.Adapter{
+
+
+ mItemList: Array
+ hostStyle:ShowActionSheetOptions
+ hostDialog:Dialog
+
+ constructor(dialog:Dialog ,style: ShowActionSheetOptions){
+ super()
+ this.hostDialog = dialog
+ this.mItemList = style.itemList
+ this.hostStyle = style
+ }
+
+ /**
+ * view 持有容器
+ */
+ ViewHolder = class extends RecyclerView.ViewHolder {
+
+ itemName:TextView;
+ constructor(view:View) {
+ super(view);
+ itemName = view.findViewById(R.id.tvName) as TextView;
+ }
+ }
+
+
+ override getItemViewType(position: Int): Int {
+ if(hostStyle.title.isNullOrBlank()){
+ // 无标题状态
+ if(position == 0){
+ return 1001
+ }
+ return 1002
+ }else{
+ // 有标题状态
+ return 1002
+ }
+ }
+
+
+ override onCreateViewHolder(
+ parent: ViewGroup,
+ viewType: Int
+ ): ViewHolder {
+
+ let view: View
+ if(viewType == 1002){
+ if(UTSAndroid.getAppDarkMode()){
+ view =
+ LayoutInflater.from(parent.context).inflate(R.layout.ac_recyclerview_layout_night, parent, false)
+ }else{
+ view =
+ LayoutInflater.from(parent.context).inflate(R.layout.ac_recyclerview_layout, parent, false)
+ }
+ }else{
+ if(UTSAndroid.getAppDarkMode()){
+ view =
+ LayoutInflater.from(parent.context).inflate(R.layout.ac_recyclerview_layout_top_night, parent, false)
+ }else{
+ view =
+ LayoutInflater.from(parent.context).inflate(R.layout.ac_recyclerview_layout_top, parent, false)
+ }
+ }
+
+
+ return ViewHolder(view)
+ }
+
+ override onBindViewHolder(holder: ViewHolder, position: Int) {
+ let perContent: String = mItemList[position]
+ holder.itemName.setText(perContent)
+ if(this.hostStyle.itemColor != null && isValidColor(this.hostStyle.itemColor)){
+ holder.itemName.setTextColor(Color.parseColor(this.hostStyle.itemColor))
+ }
+ holder.itemName.setOnClickListener(new ItemClickListener(this.hostDialog,this.hostStyle,position));
+ }
+
+ override getItemCount(): Int {
+ return mItemList.size
+ }
+
+}
+/**
+ * 工具方法,判断一个color 字符串是否合法
+ */
+function isValidColor(colorStr?:string):boolean{
+ if(colorStr == null){
+ return false
+ }
+ if(colorStr.length != 7){
+ return false
+ }
+ if(!colorStr.startsWith("#")){
+ return false
+ }
+ return true
+}
+
+
+
diff --git a/uni_modules/uni-prompt/utssdk/app-android/showModal.uts b/uni_modules/uni-prompt/utssdk/app-android/showModal.uts
new file mode 100644
index 0000000000000000000000000000000000000000..53510829b53487cf95e316b74d2564ae1cd1d963
--- /dev/null
+++ b/uni_modules/uni-prompt/utssdk/app-android/showModal.uts
@@ -0,0 +1,215 @@
+import Dialog from 'android.app.Dialog';
+import Context from 'android.content.Context';
+import R from 'io.dcloud.uts.prompt.R';
+import TextView from 'android.widget.TextView';
+import EditText from 'android.widget.EditText';
+import View from 'android.view.View';
+import Color from 'android.graphics.Color';
+import UTSAndroid from 'io.dcloud.uts.UTSAndroid';
+import Typeface from 'android.graphics.Typeface';
+
+
+import { ShowModalOptions,ShowModalSuccess,ShowModalFail} from '../interface.uts'
+import TextUtils from 'android.text.TextUtils';
+
+
+class UTSDialog extends Dialog implements View.OnClickListener {
+
+ tv_title:TextView
+ tv_content:TextView
+ et_content:EditText
+ tvCancelAction:TextView
+ tvSureAction:TextView
+ view_split_line_v:View
+
+ constructor(context:Context){
+ super(context);
+
+ if(UTSAndroid.getAppDarkMode()){
+ this.setContentView(R.layout.modal_dialog_night);
+ }else{
+ this.setContentView(R.layout.modal_dialog);
+ }
+
+ this.getWindow()?.setBackgroundDrawableResource(android.R.color.transparent);
+
+ this.tv_title = this.findViewById(R.id.tv_title)
+ this.tv_content = this.findViewById(R.id.tv_content)
+ this.et_content = this.findViewById(R.id.et_content)
+ this.tvCancelAction= this.findViewById(R.id.tvCancelAction)
+ this.tvSureAction= this.findViewById(R.id.tvSureAction)
+ this.view_split_line_v = findViewById(R.id.view_split_line_v)
+
+ }
+
+ hostStyle:ShowModalOptions|null = null
+
+ initStyle(style:ShowModalOptions){
+ this.hostStyle = style
+ this.setCanceledOnTouchOutside(false)
+
+ if(style.showCancel != null && style.showCancel == true){
+ this.tvCancelAction.setVisibility(View.VISIBLE)
+ this.view_split_line_v.setVisibility(View.VISIBLE)
+ this.tvSureAction.setVisibility(View.VISIBLE)
+
+ if(UTSAndroid.getAppDarkMode()){
+ this.tvSureAction.setBackgroundResource(R.drawable.dialog_button_select_right_night)
+ }else{
+ this.tvSureAction.setBackgroundResource(R.drawable.dialog_button_select_right)
+ }
+ }else{
+ this.tvCancelAction.setVisibility(View.GONE)
+ this.view_split_line_v.setVisibility(View.GONE)
+ this.tvSureAction.setVisibility(View.VISIBLE)
+
+ if(UTSAndroid.getAppDarkMode()){
+ this.tvSureAction.setBackgroundResource(R.drawable.dialog_button_select_total_night)
+ }else{
+ this.tvSureAction.setBackgroundResource(R.drawable.dialog_button_select_total)
+ }
+
+ }
+
+ if(style.editable != null && style.editable == true){
+ // 编辑模式
+ this.et_content.setVisibility(View.VISIBLE)
+ this.tv_content.setVisibility(View.GONE)
+
+ if(!TextUtils.isEmpty(style.content)){
+
+ this.et_content.setFocusable(true);
+ this.et_content.setFocusableInTouchMode(true);
+ this.et_content.requestFocus();
+ this.et_content.setText(style.content)
+ this.et_content.setSelection(this.et_content.getText().length);
+ }
+
+ if(style.placeholderText != null){
+ this.et_content.setHint(style.placeholderText)
+ }
+
+ if(!TextUtils.isEmpty(style.title)){
+ this.tv_title.setVisibility(View.VISIBLE)
+ this.tv_title.setText(style.title)
+ }else{
+ this.tv_title.setVisibility(View.GONE)
+ }
+
+ }else{
+ // 非编辑模式
+ this.et_content.setVisibility(View.GONE)
+
+
+ if(!TextUtils.isEmpty(style.title)){
+ // title 不为空
+ this.tv_title.setVisibility(View.VISIBLE)
+ this.tv_title.setText(style.title)
+ }else{
+ this.tv_title.setVisibility(View.GONE)
+ }
+
+ if(!TextUtils.isEmpty(style.content)){
+ // content 不为空
+ this.tv_content.setVisibility(View.VISIBLE)
+ this.tv_content.setText(style.content)
+ if(TextUtils.isEmpty(style.title)){
+ // 如果此时title 为空,需要修改文本颜色
+ if(UTSAndroid.getAppDarkMode()){
+ this.tv_content.setTextColor(UTSAndroid.getAppContext()!.getResources().getColor(R.color.dialog_title_text_night))
+ }else{
+ this.tv_content.setTextColor(UTSAndroid.getAppContext()!.getResources().getColor(R.color.dialog_title_text))
+ }
+ }
+ }else{
+ // 判断title 是否为空,如果不为空,则将title填充到content,并且修改文本颜色
+ if(!TextUtils.isEmpty(style.title)){
+ this.tv_title.setVisibility(View.GONE)
+ this.tv_content.setVisibility(View.VISIBLE)
+ this.tv_content.setText(style.title)
+ if(UTSAndroid.getAppDarkMode()){
+ this.tv_content.setTextColor(UTSAndroid.getAppContext()!.getResources().getColor(R.color.dialog_title_text_night))
+ }else{
+ this.tv_content.setTextColor(UTSAndroid.getAppContext()!.getResources().getColor(R.color.dialog_title_text))
+ }
+ }else{
+ this.tv_content.setVisibility(View.GONE)
+ }
+ }
+
+
+ }
+
+ if(style.cancelText != null){
+ this.tvCancelAction.setText(style.cancelText)
+ }
+ if(style.cancelColor != null){
+ try{
+ this.tvCancelAction.setTextColor(Color.parseColor(style.cancelColor))
+ }catch(e){
+ // 传入的格式异常,捕获
+ }
+
+ }
+
+ if(style.confirmText != null){
+ this.tvSureAction.setText(style.confirmText)
+ }
+ if(style.confirmColor != null){
+ try{
+ this.tvSureAction.setTextColor(Color.parseColor(style.confirmColor))
+ }catch(e){
+ // 传入的格式异常,捕获
+ }
+ }
+
+ this.tvCancelAction.setOnClickListener(this)
+ this.tvSureAction.setOnClickListener(this)
+
+ }
+
+ override onClick(view: View) {
+
+ const res: ShowModalSuccess = {
+ confirm: true,
+ cancel: false,
+ }
+
+ if(view.getId() == R.id.tvCancelAction){
+ // 取消
+ res.confirm = false
+ res.cancel = true
+ }else if(view.getId() == R.id.tvSureAction){
+ // 确定
+ let inputContent = this.et_content.getEditableText().toString()
+ if(TextUtils.isEmpty(inputContent)){
+ res.content = null
+ }
+ res.content = inputContent
+ }
+
+ this.hostStyle?.success?.(res)
+ this.hostStyle?.complete?.(res)
+
+ this.dismiss()
+ }
+}
+
+let utsDialog:UTSDialog|null = null
+/**
+ * 弹出对话框的功能入口
+ */
+export function showModalImpl(style:ShowModalOptions){
+ if(utsDialog != null){
+ utsDialog?.dismiss()
+ }
+ utsDialog = new UTSDialog(UTSAndroid.getUniActivity()!);
+ utsDialog?.initStyle(style)
+ utsDialog?.show();
+
+ UTSAndroid.onAppActivityDestroy(function(){
+ utsDialog?.dismiss()
+ utsDialog = null
+ })
+
+}
\ No newline at end of file
diff --git a/uni_modules/uni-prompt/utssdk/app-android/showToast.uts b/uni_modules/uni-prompt/utssdk/app-android/showToast.uts
new file mode 100644
index 0000000000000000000000000000000000000000..bdbbfc8da6de400a22b6241084fe64ec4504fcd5
--- /dev/null
+++ b/uni_modules/uni-prompt/utssdk/app-android/showToast.uts
@@ -0,0 +1,197 @@
+import { getUniActivity } from "io.dcloud.uts.android";
+import Gravity from 'android.view.Gravity';
+import Toast from "android.widget.Toast";
+import { WaitingView } from "./WaitingView.uts"
+import { ShowToastOptions, ShowLoadingOptions, ShowToastFail,ShowToastSuccess, ShowLoadingFail,ShowLoadingSuccess } from '../interface.uts'
+
+
+type ToastStyle = {
+ title : string,
+ icon ?: string,
+ image ?: string,
+ mask ?: boolean,
+ duration ?: number,
+ position ?: string,
+ style ?: string,
+ success ?: (res : UTSJSONObject) => void,
+ fail ?: (res : UTSJSONObject) => void,
+ complete ?: (res : UTSJSONObject) => void
+}
+
+let timeout : number | null = null
+let toast : WaitingView | null = null
+let toastType : string | null = null
+
+export function showToastImpl(style : ShowToastOptions) {
+ makeToast(style, 'toast', 'showToast')
+
+}
+
+export function hideToastImpl() {
+ closeToast("toast")
+}
+
+export function showLoadingImpl(option : ShowLoadingOptions) {
+ makeLoading(option, 'loading', 'showLoading')
+}
+
+export function hideLoadingImpl() {
+ closeToast("loading")
+}
+
+function closeToast(type : string | null) {
+ if (type != null && type !== toastType) {
+ return
+ }
+ if (timeout != null && (timeout as number) > 0) {
+ clearTimeout(timeout as number)
+ timeout = null
+ }
+ if (toast != null) {
+ (toast as WaitingView).close()
+ toast = null
+ }
+ if (toast != null) {
+ (toast as WaitingView).close()
+ toast = null
+ }
+ if (androidToast != null) {
+ androidToast!.cancel()
+ androidToast = null
+ }
+ toastType = null
+}
+
+function makeLoading(style : ShowLoadingOptions, type : string, errMsg : string) {
+ // 关闭之前的展示框
+ closeToast(null)
+ if (style.title == null) {
+ // 没有title 打回报错信息即可
+ let res = new UniError("uni-prompt",1001,"showLoading:title is null");
+ style.fail?.(res)
+ style.complete?.(res)
+
+ } else {
+ toastType = type
+
+ let options = {};
+ let icon = "success"
+
+ options = {
+ name: style.title,
+ modal: style.mask,
+ back: 'transmit',
+ padding: '10',
+ size: '16' // 固定字体大小
+ }
+
+ options["width"] = "140"
+ options["height"] = "112"
+
+ const alert = new WaitingView(getUniActivity(), options)
+ toast = alert
+ alert.showWaiting()
+
+ const res : ShowLoadingSuccess = {
+ }
+ style.success?.(res)
+ style.complete?.(res)
+ }
+}
+
+let androidToast:Toast| null = null
+
+
+function makeToast(style : ShowToastOptions, type : string, errMsg : string) {
+ closeToast(null)
+ if (style.title == null || style.title.length == 0) {
+
+ let res = new UniError("uni-prompt",1001,"showLoading:title is null");
+ style.fail?.(res)
+ style.complete?.(res)
+
+ } else {
+
+ toastType = type
+ if (["top", "center", "bottom"].indexOf(style.position) >= 0) {
+ androidToast = Toast.makeText(getUniActivity(), style.title, Toast.LENGTH_SHORT);
+ switch (style.position) {
+ case "top": {
+ // 修复bottom/top 与 前端api位置不一致的问题
+ androidToast!.setGravity(Gravity.TOP, androidToast!.getXOffset(), androidToast!.getYOffset())
+ break
+ }
+ case "center": {
+ androidToast!.setGravity(Gravity.CENTER, 0, 0)
+ break
+ }
+ case "bottom": {
+ androidToast!.setGravity(Gravity.BOTTOM, androidToast!.getXOffset(), androidToast!.getYOffset())
+ break
+ }
+ }
+ androidToast!.show()
+ const res : ShowToastSuccess = {
+ }
+
+ style.success?.(res)
+ style.complete?.(res)
+ } else {
+ let options = {};
+ let icon = style.icon
+ if (icon == null || ["success", "loading", "error", "none"].indexOf(icon) < 0) {
+ icon = "success"
+ }
+ options = {
+ name: style.title,
+ modal: style.mask,
+ back: 'transmit',
+ padding: '10',
+ size: '16' // 固定字体大小
+ }
+ if ((style.image == null || style.image == '') && icon == "none") {
+ options["loading"] = {
+ display: "none"
+ }
+ } else {
+ options["width"] = "140"
+ options["height"] = "112"
+ }
+ if (style.image != null && style.image != '') {
+ options["loading"] = {
+ display: "block",
+ height: "55",
+ icon: style.image
+ }
+ } else {
+ if (['success', 'error'].indexOf(icon) >= 0) {
+ options["loading"] = {
+ display: 'block',
+ height: '36',
+ icon: icon == "success" ? "successIcon" : "errorIcon"
+ }
+ }
+ }
+
+ const alert = new WaitingView(getUniActivity(), options)
+ toast = alert
+ alert.showWaiting()
+ let duration : number | null = style.duration
+ if (duration == null || duration <= 0) {
+ duration = 1500
+ }
+ if (type !== "loading") {
+ timeout = setTimeout(() => {
+ alert.close()
+ }, duration)
+ }
+
+ const res : ShowToastSuccess = {
+ }
+
+ style.success?.(res)
+ style.complete?.(res)
+ }
+ }
+}
+
diff --git a/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCUniToast.framework/DCUniToast b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCUniToast.framework/DCUniToast
new file mode 100644
index 0000000000000000000000000000000000000000..2e6a70f7fbbb6f5ea745bd28e6add99c01c6e4a4
Binary files /dev/null and b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCUniToast.framework/DCUniToast differ
diff --git a/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCUniToast.framework/Headers/DCUniToast-Swift.h b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCUniToast.framework/Headers/DCUniToast-Swift.h
new file mode 100644
index 0000000000000000000000000000000000000000..7d3ed6969be0b40be4a931e1ef06a33217b2225b
--- /dev/null
+++ b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCUniToast.framework/Headers/DCUniToast-Swift.h
@@ -0,0 +1,506 @@
+#if 0
+#elif defined(__arm64__) && __arm64__
+// Generated by Apple Swift version 5.5.2 (swiftlang-1300.0.47.5 clang-1300.0.29.30)
+#ifndef DCUNITOAST_SWIFT_H
+#define DCUNITOAST_SWIFT_H
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wgcc-compat"
+
+#if !defined(__has_include)
+# define __has_include(x) 0
+#endif
+#if !defined(__has_attribute)
+# define __has_attribute(x) 0
+#endif
+#if !defined(__has_feature)
+# define __has_feature(x) 0
+#endif
+#if !defined(__has_warning)
+# define __has_warning(x) 0
+#endif
+
+#if __has_include()
+# include
+#endif
+
+#pragma clang diagnostic ignored "-Wauto-import"
+#include
+#include
+#include
+#include
+
+#if !defined(SWIFT_TYPEDEFS)
+# define SWIFT_TYPEDEFS 1
+# if __has_include()
+# include
+# elif !defined(__cplusplus)
+typedef uint_least16_t char16_t;
+typedef uint_least32_t char32_t;
+# endif
+typedef float swift_float2 __attribute__((__ext_vector_type__(2)));
+typedef float swift_float3 __attribute__((__ext_vector_type__(3)));
+typedef float swift_float4 __attribute__((__ext_vector_type__(4)));
+typedef double swift_double2 __attribute__((__ext_vector_type__(2)));
+typedef double swift_double3 __attribute__((__ext_vector_type__(3)));
+typedef double swift_double4 __attribute__((__ext_vector_type__(4)));
+typedef int swift_int2 __attribute__((__ext_vector_type__(2)));
+typedef int swift_int3 __attribute__((__ext_vector_type__(3)));
+typedef int swift_int4 __attribute__((__ext_vector_type__(4)));
+typedef unsigned int swift_uint2 __attribute__((__ext_vector_type__(2)));
+typedef unsigned int swift_uint3 __attribute__((__ext_vector_type__(3)));
+typedef unsigned int swift_uint4 __attribute__((__ext_vector_type__(4)));
+#endif
+
+#if !defined(SWIFT_PASTE)
+# define SWIFT_PASTE_HELPER(x, y) x##y
+# define SWIFT_PASTE(x, y) SWIFT_PASTE_HELPER(x, y)
+#endif
+#if !defined(SWIFT_METATYPE)
+# define SWIFT_METATYPE(X) Class
+#endif
+#if !defined(SWIFT_CLASS_PROPERTY)
+# if __has_feature(objc_class_property)
+# define SWIFT_CLASS_PROPERTY(...) __VA_ARGS__
+# else
+# define SWIFT_CLASS_PROPERTY(...)
+# endif
+#endif
+
+#if __has_attribute(objc_runtime_name)
+# define SWIFT_RUNTIME_NAME(X) __attribute__((objc_runtime_name(X)))
+#else
+# define SWIFT_RUNTIME_NAME(X)
+#endif
+#if __has_attribute(swift_name)
+# define SWIFT_COMPILE_NAME(X) __attribute__((swift_name(X)))
+#else
+# define SWIFT_COMPILE_NAME(X)
+#endif
+#if __has_attribute(objc_method_family)
+# define SWIFT_METHOD_FAMILY(X) __attribute__((objc_method_family(X)))
+#else
+# define SWIFT_METHOD_FAMILY(X)
+#endif
+#if __has_attribute(noescape)
+# define SWIFT_NOESCAPE __attribute__((noescape))
+#else
+# define SWIFT_NOESCAPE
+#endif
+#if __has_attribute(ns_consumed)
+# define SWIFT_RELEASES_ARGUMENT __attribute__((ns_consumed))
+#else
+# define SWIFT_RELEASES_ARGUMENT
+#endif
+#if __has_attribute(warn_unused_result)
+# define SWIFT_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
+#else
+# define SWIFT_WARN_UNUSED_RESULT
+#endif
+#if __has_attribute(noreturn)
+# define SWIFT_NORETURN __attribute__((noreturn))
+#else
+# define SWIFT_NORETURN
+#endif
+#if !defined(SWIFT_CLASS_EXTRA)
+# define SWIFT_CLASS_EXTRA
+#endif
+#if !defined(SWIFT_PROTOCOL_EXTRA)
+# define SWIFT_PROTOCOL_EXTRA
+#endif
+#if !defined(SWIFT_ENUM_EXTRA)
+# define SWIFT_ENUM_EXTRA
+#endif
+#if !defined(SWIFT_CLASS)
+# if __has_attribute(objc_subclassing_restricted)
+# define SWIFT_CLASS(SWIFT_NAME) SWIFT_RUNTIME_NAME(SWIFT_NAME) __attribute__((objc_subclassing_restricted)) SWIFT_CLASS_EXTRA
+# define SWIFT_CLASS_NAMED(SWIFT_NAME) __attribute__((objc_subclassing_restricted)) SWIFT_COMPILE_NAME(SWIFT_NAME) SWIFT_CLASS_EXTRA
+# else
+# define SWIFT_CLASS(SWIFT_NAME) SWIFT_RUNTIME_NAME(SWIFT_NAME) SWIFT_CLASS_EXTRA
+# define SWIFT_CLASS_NAMED(SWIFT_NAME) SWIFT_COMPILE_NAME(SWIFT_NAME) SWIFT_CLASS_EXTRA
+# endif
+#endif
+#if !defined(SWIFT_RESILIENT_CLASS)
+# if __has_attribute(objc_class_stub)
+# define SWIFT_RESILIENT_CLASS(SWIFT_NAME) SWIFT_CLASS(SWIFT_NAME) __attribute__((objc_class_stub))
+# define SWIFT_RESILIENT_CLASS_NAMED(SWIFT_NAME) __attribute__((objc_class_stub)) SWIFT_CLASS_NAMED(SWIFT_NAME)
+# else
+# define SWIFT_RESILIENT_CLASS(SWIFT_NAME) SWIFT_CLASS(SWIFT_NAME)
+# define SWIFT_RESILIENT_CLASS_NAMED(SWIFT_NAME) SWIFT_CLASS_NAMED(SWIFT_NAME)
+# endif
+#endif
+
+#if !defined(SWIFT_PROTOCOL)
+# define SWIFT_PROTOCOL(SWIFT_NAME) SWIFT_RUNTIME_NAME(SWIFT_NAME) SWIFT_PROTOCOL_EXTRA
+# define SWIFT_PROTOCOL_NAMED(SWIFT_NAME) SWIFT_COMPILE_NAME(SWIFT_NAME) SWIFT_PROTOCOL_EXTRA
+#endif
+
+#if !defined(SWIFT_EXTENSION)
+# define SWIFT_EXTENSION(M) SWIFT_PASTE(M##_Swift_, __LINE__)
+#endif
+
+#if !defined(OBJC_DESIGNATED_INITIALIZER)
+# if __has_attribute(objc_designated_initializer)
+# define OBJC_DESIGNATED_INITIALIZER __attribute__((objc_designated_initializer))
+# else
+# define OBJC_DESIGNATED_INITIALIZER
+# endif
+#endif
+#if !defined(SWIFT_ENUM_ATTR)
+# if defined(__has_attribute) && __has_attribute(enum_extensibility)
+# define SWIFT_ENUM_ATTR(_extensibility) __attribute__((enum_extensibility(_extensibility)))
+# else
+# define SWIFT_ENUM_ATTR(_extensibility)
+# endif
+#endif
+#if !defined(SWIFT_ENUM)
+# define SWIFT_ENUM(_type, _name, _extensibility) enum _name : _type _name; enum SWIFT_ENUM_ATTR(_extensibility) SWIFT_ENUM_EXTRA _name : _type
+# if __has_feature(generalized_swift_name)
+# define SWIFT_ENUM_NAMED(_type, _name, SWIFT_NAME, _extensibility) enum _name : _type _name SWIFT_COMPILE_NAME(SWIFT_NAME); enum SWIFT_COMPILE_NAME(SWIFT_NAME) SWIFT_ENUM_ATTR(_extensibility) SWIFT_ENUM_EXTRA _name : _type
+# else
+# define SWIFT_ENUM_NAMED(_type, _name, SWIFT_NAME, _extensibility) SWIFT_ENUM(_type, _name, _extensibility)
+# endif
+#endif
+#if !defined(SWIFT_UNAVAILABLE)
+# define SWIFT_UNAVAILABLE __attribute__((unavailable))
+#endif
+#if !defined(SWIFT_UNAVAILABLE_MSG)
+# define SWIFT_UNAVAILABLE_MSG(msg) __attribute__((unavailable(msg)))
+#endif
+#if !defined(SWIFT_AVAILABILITY)
+# define SWIFT_AVAILABILITY(plat, ...) __attribute__((availability(plat, __VA_ARGS__)))
+#endif
+#if !defined(SWIFT_WEAK_IMPORT)
+# define SWIFT_WEAK_IMPORT __attribute__((weak_import))
+#endif
+#if !defined(SWIFT_DEPRECATED)
+# define SWIFT_DEPRECATED __attribute__((deprecated))
+#endif
+#if !defined(SWIFT_DEPRECATED_MSG)
+# define SWIFT_DEPRECATED_MSG(...) __attribute__((deprecated(__VA_ARGS__)))
+#endif
+#if __has_feature(attribute_diagnose_if_objc)
+# define SWIFT_DEPRECATED_OBJC(Msg) __attribute__((diagnose_if(1, Msg, "warning")))
+#else
+# define SWIFT_DEPRECATED_OBJC(Msg) SWIFT_DEPRECATED_MSG(Msg)
+#endif
+#if !defined(IBSegueAction)
+# define IBSegueAction
+#endif
+#if __has_feature(modules)
+#if __has_warning("-Watimport-in-framework-header")
+#pragma clang diagnostic ignored "-Watimport-in-framework-header"
+#endif
+@import ObjectiveC;
+#endif
+
+#pragma clang diagnostic ignored "-Wproperty-attribute-mismatch"
+#pragma clang diagnostic ignored "-Wduplicate-method-arg"
+#if __has_warning("-Wpragma-clang-attribute")
+# pragma clang diagnostic ignored "-Wpragma-clang-attribute"
+#endif
+#pragma clang diagnostic ignored "-Wunknown-pragmas"
+#pragma clang diagnostic ignored "-Wnullability"
+
+#if __has_attribute(external_source_symbol)
+# pragma push_macro("any")
+# undef any
+# pragma clang attribute push(__attribute__((external_source_symbol(language="Swift", defined_in="DCUniToast",generated_declaration))), apply_to=any(function,enum,objc_interface,objc_category,objc_protocol))
+# pragma pop_macro("any")
+#endif
+
+
+
+SWIFT_CLASS("_TtC10DCUniToast7MCToast")
+@interface MCToast : NSObject
+- (nonnull instancetype)init SWIFT_UNAVAILABLE;
++ (nonnull instancetype)new SWIFT_UNAVAILABLE_MSG("-init is unavailable");
+@end
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+SWIFT_CLASS("_TtC10DCUniToast13MCToastConfig")
+@interface MCToastConfig : NSObject
+- (nonnull instancetype)init OBJC_DESIGNATED_INITIALIZER;
+@end
+
+
+
+
+
+
+
+
+#if __has_attribute(external_source_symbol)
+# pragma clang attribute pop
+#endif
+#pragma clang diagnostic pop
+#endif
+
+#elif defined(__ARM_ARCH_7A__) && __ARM_ARCH_7A__
+// Generated by Apple Swift version 5.5.2 (swiftlang-1300.0.47.5 clang-1300.0.29.30)
+#ifndef DCUNITOAST_SWIFT_H
+#define DCUNITOAST_SWIFT_H
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wgcc-compat"
+
+#if !defined(__has_include)
+# define __has_include(x) 0
+#endif
+#if !defined(__has_attribute)
+# define __has_attribute(x) 0
+#endif
+#if !defined(__has_feature)
+# define __has_feature(x) 0
+#endif
+#if !defined(__has_warning)
+# define __has_warning(x) 0
+#endif
+
+#if __has_include()
+# include
+#endif
+
+#pragma clang diagnostic ignored "-Wauto-import"
+#include
+#include
+#include
+#include
+
+#if !defined(SWIFT_TYPEDEFS)
+# define SWIFT_TYPEDEFS 1
+# if __has_include()
+# include
+# elif !defined(__cplusplus)
+typedef uint_least16_t char16_t;
+typedef uint_least32_t char32_t;
+# endif
+typedef float swift_float2 __attribute__((__ext_vector_type__(2)));
+typedef float swift_float3 __attribute__((__ext_vector_type__(3)));
+typedef float swift_float4 __attribute__((__ext_vector_type__(4)));
+typedef double swift_double2 __attribute__((__ext_vector_type__(2)));
+typedef double swift_double3 __attribute__((__ext_vector_type__(3)));
+typedef double swift_double4 __attribute__((__ext_vector_type__(4)));
+typedef int swift_int2 __attribute__((__ext_vector_type__(2)));
+typedef int swift_int3 __attribute__((__ext_vector_type__(3)));
+typedef int swift_int4 __attribute__((__ext_vector_type__(4)));
+typedef unsigned int swift_uint2 __attribute__((__ext_vector_type__(2)));
+typedef unsigned int swift_uint3 __attribute__((__ext_vector_type__(3)));
+typedef unsigned int swift_uint4 __attribute__((__ext_vector_type__(4)));
+#endif
+
+#if !defined(SWIFT_PASTE)
+# define SWIFT_PASTE_HELPER(x, y) x##y
+# define SWIFT_PASTE(x, y) SWIFT_PASTE_HELPER(x, y)
+#endif
+#if !defined(SWIFT_METATYPE)
+# define SWIFT_METATYPE(X) Class
+#endif
+#if !defined(SWIFT_CLASS_PROPERTY)
+# if __has_feature(objc_class_property)
+# define SWIFT_CLASS_PROPERTY(...) __VA_ARGS__
+# else
+# define SWIFT_CLASS_PROPERTY(...)
+# endif
+#endif
+
+#if __has_attribute(objc_runtime_name)
+# define SWIFT_RUNTIME_NAME(X) __attribute__((objc_runtime_name(X)))
+#else
+# define SWIFT_RUNTIME_NAME(X)
+#endif
+#if __has_attribute(swift_name)
+# define SWIFT_COMPILE_NAME(X) __attribute__((swift_name(X)))
+#else
+# define SWIFT_COMPILE_NAME(X)
+#endif
+#if __has_attribute(objc_method_family)
+# define SWIFT_METHOD_FAMILY(X) __attribute__((objc_method_family(X)))
+#else
+# define SWIFT_METHOD_FAMILY(X)
+#endif
+#if __has_attribute(noescape)
+# define SWIFT_NOESCAPE __attribute__((noescape))
+#else
+# define SWIFT_NOESCAPE
+#endif
+#if __has_attribute(ns_consumed)
+# define SWIFT_RELEASES_ARGUMENT __attribute__((ns_consumed))
+#else
+# define SWIFT_RELEASES_ARGUMENT
+#endif
+#if __has_attribute(warn_unused_result)
+# define SWIFT_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
+#else
+# define SWIFT_WARN_UNUSED_RESULT
+#endif
+#if __has_attribute(noreturn)
+# define SWIFT_NORETURN __attribute__((noreturn))
+#else
+# define SWIFT_NORETURN
+#endif
+#if !defined(SWIFT_CLASS_EXTRA)
+# define SWIFT_CLASS_EXTRA
+#endif
+#if !defined(SWIFT_PROTOCOL_EXTRA)
+# define SWIFT_PROTOCOL_EXTRA
+#endif
+#if !defined(SWIFT_ENUM_EXTRA)
+# define SWIFT_ENUM_EXTRA
+#endif
+#if !defined(SWIFT_CLASS)
+# if __has_attribute(objc_subclassing_restricted)
+# define SWIFT_CLASS(SWIFT_NAME) SWIFT_RUNTIME_NAME(SWIFT_NAME) __attribute__((objc_subclassing_restricted)) SWIFT_CLASS_EXTRA
+# define SWIFT_CLASS_NAMED(SWIFT_NAME) __attribute__((objc_subclassing_restricted)) SWIFT_COMPILE_NAME(SWIFT_NAME) SWIFT_CLASS_EXTRA
+# else
+# define SWIFT_CLASS(SWIFT_NAME) SWIFT_RUNTIME_NAME(SWIFT_NAME) SWIFT_CLASS_EXTRA
+# define SWIFT_CLASS_NAMED(SWIFT_NAME) SWIFT_COMPILE_NAME(SWIFT_NAME) SWIFT_CLASS_EXTRA
+# endif
+#endif
+#if !defined(SWIFT_RESILIENT_CLASS)
+# if __has_attribute(objc_class_stub)
+# define SWIFT_RESILIENT_CLASS(SWIFT_NAME) SWIFT_CLASS(SWIFT_NAME) __attribute__((objc_class_stub))
+# define SWIFT_RESILIENT_CLASS_NAMED(SWIFT_NAME) __attribute__((objc_class_stub)) SWIFT_CLASS_NAMED(SWIFT_NAME)
+# else
+# define SWIFT_RESILIENT_CLASS(SWIFT_NAME) SWIFT_CLASS(SWIFT_NAME)
+# define SWIFT_RESILIENT_CLASS_NAMED(SWIFT_NAME) SWIFT_CLASS_NAMED(SWIFT_NAME)
+# endif
+#endif
+
+#if !defined(SWIFT_PROTOCOL)
+# define SWIFT_PROTOCOL(SWIFT_NAME) SWIFT_RUNTIME_NAME(SWIFT_NAME) SWIFT_PROTOCOL_EXTRA
+# define SWIFT_PROTOCOL_NAMED(SWIFT_NAME) SWIFT_COMPILE_NAME(SWIFT_NAME) SWIFT_PROTOCOL_EXTRA
+#endif
+
+#if !defined(SWIFT_EXTENSION)
+# define SWIFT_EXTENSION(M) SWIFT_PASTE(M##_Swift_, __LINE__)
+#endif
+
+#if !defined(OBJC_DESIGNATED_INITIALIZER)
+# if __has_attribute(objc_designated_initializer)
+# define OBJC_DESIGNATED_INITIALIZER __attribute__((objc_designated_initializer))
+# else
+# define OBJC_DESIGNATED_INITIALIZER
+# endif
+#endif
+#if !defined(SWIFT_ENUM_ATTR)
+# if defined(__has_attribute) && __has_attribute(enum_extensibility)
+# define SWIFT_ENUM_ATTR(_extensibility) __attribute__((enum_extensibility(_extensibility)))
+# else
+# define SWIFT_ENUM_ATTR(_extensibility)
+# endif
+#endif
+#if !defined(SWIFT_ENUM)
+# define SWIFT_ENUM(_type, _name, _extensibility) enum _name : _type _name; enum SWIFT_ENUM_ATTR(_extensibility) SWIFT_ENUM_EXTRA _name : _type
+# if __has_feature(generalized_swift_name)
+# define SWIFT_ENUM_NAMED(_type, _name, SWIFT_NAME, _extensibility) enum _name : _type _name SWIFT_COMPILE_NAME(SWIFT_NAME); enum SWIFT_COMPILE_NAME(SWIFT_NAME) SWIFT_ENUM_ATTR(_extensibility) SWIFT_ENUM_EXTRA _name : _type
+# else
+# define SWIFT_ENUM_NAMED(_type, _name, SWIFT_NAME, _extensibility) SWIFT_ENUM(_type, _name, _extensibility)
+# endif
+#endif
+#if !defined(SWIFT_UNAVAILABLE)
+# define SWIFT_UNAVAILABLE __attribute__((unavailable))
+#endif
+#if !defined(SWIFT_UNAVAILABLE_MSG)
+# define SWIFT_UNAVAILABLE_MSG(msg) __attribute__((unavailable(msg)))
+#endif
+#if !defined(SWIFT_AVAILABILITY)
+# define SWIFT_AVAILABILITY(plat, ...) __attribute__((availability(plat, __VA_ARGS__)))
+#endif
+#if !defined(SWIFT_WEAK_IMPORT)
+# define SWIFT_WEAK_IMPORT __attribute__((weak_import))
+#endif
+#if !defined(SWIFT_DEPRECATED)
+# define SWIFT_DEPRECATED __attribute__((deprecated))
+#endif
+#if !defined(SWIFT_DEPRECATED_MSG)
+# define SWIFT_DEPRECATED_MSG(...) __attribute__((deprecated(__VA_ARGS__)))
+#endif
+#if __has_feature(attribute_diagnose_if_objc)
+# define SWIFT_DEPRECATED_OBJC(Msg) __attribute__((diagnose_if(1, Msg, "warning")))
+#else
+# define SWIFT_DEPRECATED_OBJC(Msg) SWIFT_DEPRECATED_MSG(Msg)
+#endif
+#if !defined(IBSegueAction)
+# define IBSegueAction
+#endif
+#if __has_feature(modules)
+#if __has_warning("-Watimport-in-framework-header")
+#pragma clang diagnostic ignored "-Watimport-in-framework-header"
+#endif
+@import ObjectiveC;
+#endif
+
+#pragma clang diagnostic ignored "-Wproperty-attribute-mismatch"
+#pragma clang diagnostic ignored "-Wduplicate-method-arg"
+#if __has_warning("-Wpragma-clang-attribute")
+# pragma clang diagnostic ignored "-Wpragma-clang-attribute"
+#endif
+#pragma clang diagnostic ignored "-Wunknown-pragmas"
+#pragma clang diagnostic ignored "-Wnullability"
+
+#if __has_attribute(external_source_symbol)
+# pragma push_macro("any")
+# undef any
+# pragma clang attribute push(__attribute__((external_source_symbol(language="Swift", defined_in="DCUniToast",generated_declaration))), apply_to=any(function,enum,objc_interface,objc_category,objc_protocol))
+# pragma pop_macro("any")
+#endif
+
+
+
+SWIFT_CLASS("_TtC10DCUniToast7MCToast")
+@interface MCToast : NSObject
+- (nonnull instancetype)init SWIFT_UNAVAILABLE;
++ (nonnull instancetype)new SWIFT_UNAVAILABLE_MSG("-init is unavailable");
+@end
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+SWIFT_CLASS("_TtC10DCUniToast13MCToastConfig")
+@interface MCToastConfig : NSObject
+- (nonnull instancetype)init OBJC_DESIGNATED_INITIALIZER;
+@end
+
+
+
+
+
+
+
+
+#if __has_attribute(external_source_symbol)
+# pragma clang attribute pop
+#endif
+#pragma clang diagnostic pop
+#endif
+
+#endif
diff --git a/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCUniToast.framework/Headers/DCUniToast.h b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCUniToast.framework/Headers/DCUniToast.h
new file mode 100644
index 0000000000000000000000000000000000000000..88276ac65ce7b531db6ade3c4efdb60c7ea8f485
--- /dev/null
+++ b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCUniToast.framework/Headers/DCUniToast.h
@@ -0,0 +1,18 @@
+//
+// DCUniToast.h
+// DCUniToast
+//
+// Created by DCloud on 2023/2/23.
+//
+
+#import
+
+//! Project version number for DCUniToast.
+FOUNDATION_EXPORT double DCUniToastVersionNumber;
+
+//! Project version string for DCUniToast.
+FOUNDATION_EXPORT const unsigned char DCUniToastVersionString[];
+
+// In this header, you should import all the public headers of your framework using statements like #import
+
+
diff --git a/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCUniToast.framework/Info.plist b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCUniToast.framework/Info.plist
new file mode 100644
index 0000000000000000000000000000000000000000..9712052df391242671b05170b8e890a61f75f128
Binary files /dev/null and b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCUniToast.framework/Info.plist differ
diff --git a/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCUniToast.framework/Modules/DCUniToast.swiftmodule/Project/arm.swiftsourceinfo b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCUniToast.framework/Modules/DCUniToast.swiftmodule/Project/arm.swiftsourceinfo
new file mode 100644
index 0000000000000000000000000000000000000000..32b79de36bc0b26bf4402fdfcb0a26653d225d3b
Binary files /dev/null and b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCUniToast.framework/Modules/DCUniToast.swiftmodule/Project/arm.swiftsourceinfo differ
diff --git a/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCUniToast.framework/Modules/DCUniToast.swiftmodule/Project/arm64-apple-ios.swiftsourceinfo b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCUniToast.framework/Modules/DCUniToast.swiftmodule/Project/arm64-apple-ios.swiftsourceinfo
new file mode 100644
index 0000000000000000000000000000000000000000..8fe0fa7c4ae1ef75d28bad43b6f015f4e2000332
Binary files /dev/null and b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCUniToast.framework/Modules/DCUniToast.swiftmodule/Project/arm64-apple-ios.swiftsourceinfo differ
diff --git a/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCUniToast.framework/Modules/DCUniToast.swiftmodule/Project/arm64.swiftsourceinfo b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCUniToast.framework/Modules/DCUniToast.swiftmodule/Project/arm64.swiftsourceinfo
new file mode 100644
index 0000000000000000000000000000000000000000..8fe0fa7c4ae1ef75d28bad43b6f015f4e2000332
Binary files /dev/null and b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCUniToast.framework/Modules/DCUniToast.swiftmodule/Project/arm64.swiftsourceinfo differ
diff --git a/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCUniToast.framework/Modules/DCUniToast.swiftmodule/Project/armv7-apple-ios.swiftsourceinfo b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCUniToast.framework/Modules/DCUniToast.swiftmodule/Project/armv7-apple-ios.swiftsourceinfo
new file mode 100644
index 0000000000000000000000000000000000000000..32b79de36bc0b26bf4402fdfcb0a26653d225d3b
Binary files /dev/null and b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCUniToast.framework/Modules/DCUniToast.swiftmodule/Project/armv7-apple-ios.swiftsourceinfo differ
diff --git a/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCUniToast.framework/Modules/DCUniToast.swiftmodule/Project/armv7.swiftsourceinfo b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCUniToast.framework/Modules/DCUniToast.swiftmodule/Project/armv7.swiftsourceinfo
new file mode 100644
index 0000000000000000000000000000000000000000..32b79de36bc0b26bf4402fdfcb0a26653d225d3b
Binary files /dev/null and b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCUniToast.framework/Modules/DCUniToast.swiftmodule/Project/armv7.swiftsourceinfo differ
diff --git a/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCUniToast.framework/Modules/DCUniToast.swiftmodule/Project/i386-apple-ios-simulator.swiftsourceinfo b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCUniToast.framework/Modules/DCUniToast.swiftmodule/Project/i386-apple-ios-simulator.swiftsourceinfo
new file mode 100644
index 0000000000000000000000000000000000000000..28969618799a41ce48f3192fe18e2d52f9d3b39c
Binary files /dev/null and b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCUniToast.framework/Modules/DCUniToast.swiftmodule/Project/i386-apple-ios-simulator.swiftsourceinfo differ
diff --git a/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCUniToast.framework/Modules/DCUniToast.swiftmodule/Project/i386.swiftsourceinfo b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCUniToast.framework/Modules/DCUniToast.swiftmodule/Project/i386.swiftsourceinfo
new file mode 100644
index 0000000000000000000000000000000000000000..28969618799a41ce48f3192fe18e2d52f9d3b39c
Binary files /dev/null and b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCUniToast.framework/Modules/DCUniToast.swiftmodule/Project/i386.swiftsourceinfo differ
diff --git a/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCUniToast.framework/Modules/DCUniToast.swiftmodule/Project/x86_64-apple-ios-simulator.swiftsourceinfo b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCUniToast.framework/Modules/DCUniToast.swiftmodule/Project/x86_64-apple-ios-simulator.swiftsourceinfo
new file mode 100644
index 0000000000000000000000000000000000000000..42f3058e48452b6a2d4aa373dfece946e2501921
Binary files /dev/null and b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCUniToast.framework/Modules/DCUniToast.swiftmodule/Project/x86_64-apple-ios-simulator.swiftsourceinfo differ
diff --git a/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCUniToast.framework/Modules/DCUniToast.swiftmodule/Project/x86_64.swiftsourceinfo b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCUniToast.framework/Modules/DCUniToast.swiftmodule/Project/x86_64.swiftsourceinfo
new file mode 100644
index 0000000000000000000000000000000000000000..42f3058e48452b6a2d4aa373dfece946e2501921
Binary files /dev/null and b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCUniToast.framework/Modules/DCUniToast.swiftmodule/Project/x86_64.swiftsourceinfo differ
diff --git a/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCUniToast.framework/Modules/DCUniToast.swiftmodule/arm.swiftdoc b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCUniToast.framework/Modules/DCUniToast.swiftmodule/arm.swiftdoc
new file mode 100644
index 0000000000000000000000000000000000000000..0d07be0079df2ef04468fe1340df7b409396ac95
Binary files /dev/null and b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCUniToast.framework/Modules/DCUniToast.swiftmodule/arm.swiftdoc differ
diff --git a/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCUniToast.framework/Modules/DCUniToast.swiftmodule/arm.swiftinterface b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCUniToast.framework/Modules/DCUniToast.swiftmodule/arm.swiftinterface
new file mode 100644
index 0000000000000000000000000000000000000000..bff0c4bb9e66f10bc382492a46e69ccefe1dda57
--- /dev/null
+++ b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCUniToast.framework/Modules/DCUniToast.swiftmodule/arm.swiftinterface
@@ -0,0 +1,116 @@
+// swift-interface-format-version: 1.0
+// swift-compiler-version: Apple Swift version 5.5.2 (swiftlang-1300.0.47.5 clang-1300.0.29.30)
+// swift-module-flags: -target armv7-apple-ios9.0 -enable-objc-interop -enable-library-evolution -swift-version 5 -enforce-exclusivity=checked -O -module-name DCUniToast
+@_exported import DCUniToast
+import Foundation
+import Swift
+import UIKit
+import _Concurrency
+extension UIKit.UIResponder {
+ @_Concurrency.MainActor(unsafe) public func mc_text(_ text: Swift.String, offset: CoreGraphics.CGFloat? = nil, duration: CoreGraphics.CGFloat = MCToastConfig.shared.duration, respond: DCUniToast.MCToast.MCToastRespond = MCToastConfig.shared.respond, callback: DCUniToast.MCToast.MCToastCallback? = nil)
+}
+extension DCUniToast.MCToast {
+ public static func mc_text(_ text: Swift.String, offset: CoreGraphics.CGFloat? = nil, duration: CoreGraphics.CGFloat = MCToastConfig.shared.duration, respond: DCUniToast.MCToast.MCToastRespond = MCToastConfig.shared.respond, callback: DCUniToast.MCToast.MCToastCallback? = nil)
+}
+extension UIKit.UIResponder {
+ @_Concurrency.MainActor(unsafe) public func mc_remove(callback: DCUniToast.MCToast.MCToastCallback? = nil)
+}
+extension DCUniToast.MCToast {
+ public static func mc_remove(callback: DCUniToast.MCToast.MCToastCallback? = nil)
+}
+@objc @_inheritsConvenienceInitializers @_hasMissingDesignatedInitializers public class MCToast : ObjectiveC.NSObject {
+ @objc deinit
+}
+extension DCUniToast.MCToast {
+ public typealias MCToastCallback = () -> Swift.Void
+ public enum MCToastRespond {
+ case `default`
+ case noRespond
+ case respond
+ case navBarRespond
+ public static func == (a: DCUniToast.MCToast.MCToastRespond, b: DCUniToast.MCToast.MCToastRespond) -> Swift.Bool
+ public func hash(into hasher: inout Swift.Hasher)
+ public var hashValue: Swift.Int {
+ get
+ }
+ }
+}
+extension DCUniToast.MCToast {
+ public static func colorWithSystemStyle(_ darkColor: UIKit.UIColor, _ defaultColor: UIKit.UIColor) -> UIKit.UIColor
+}
+extension DCUniToast.MCToast {
+ public enum MCToastType {
+ case success
+ case failure
+ case warning
+ public static func == (a: DCUniToast.MCToast.MCToastType, b: DCUniToast.MCToast.MCToastType) -> Swift.Bool
+ public func hash(into hasher: inout Swift.Hasher)
+ public var hashValue: Swift.Int {
+ get
+ }
+ }
+}
+extension UIKit.UIResponder {
+ @_Concurrency.MainActor(unsafe) public func mc_success(_ text: Swift.String, duration: CoreGraphics.CGFloat = MCToastConfig.shared.duration, respond: DCUniToast.MCToast.MCToastRespond = MCToastConfig.shared.respond, callback: DCUniToast.MCToast.MCToastCallback? = nil)
+ @_Concurrency.MainActor(unsafe) public func mc_failure(_ text: Swift.String, duration: CoreGraphics.CGFloat = MCToastConfig.shared.duration, respond: DCUniToast.MCToast.MCToastRespond = MCToastConfig.shared.respond, callback: DCUniToast.MCToast.MCToastCallback? = nil)
+ @_Concurrency.MainActor(unsafe) public func mc_warning(_ text: Swift.String, duration: CoreGraphics.CGFloat = MCToastConfig.shared.duration, respond: DCUniToast.MCToast.MCToastRespond = MCToastConfig.shared.respond, callback: DCUniToast.MCToast.MCToastCallback? = nil)
+}
+extension DCUniToast.MCToast {
+ public static func mc_success(_ text: Swift.String, duration: CoreGraphics.CGFloat = MCToastConfig.shared.duration, respond: DCUniToast.MCToast.MCToastRespond = MCToastConfig.shared.respond, callback: DCUniToast.MCToast.MCToastCallback? = nil)
+ public static func mc_failure(_ text: Swift.String, duration: CoreGraphics.CGFloat = MCToastConfig.shared.duration, respond: DCUniToast.MCToast.MCToastRespond = MCToastConfig.shared.respond, callback: DCUniToast.MCToast.MCToastCallback? = nil)
+ public static func mc_warning(_ text: Swift.String, duration: CoreGraphics.CGFloat = MCToastConfig.shared.duration, respond: DCUniToast.MCToast.MCToastRespond = MCToastConfig.shared.respond, callback: DCUniToast.MCToast.MCToastCallback? = nil)
+}
+extension DCUniToast.MCToast {
+ @discardableResult
+ public static func showStatus(_ type: DCUniToast.MCToast.MCToastType?, text: Swift.String, iconImage: UIKit.UIImage?, duration: CoreGraphics.CGFloat, respond: DCUniToast.MCToast.MCToastRespond, callback: DCUniToast.MCToast.MCToastCallback? = nil) -> (imageView: UIKit.UIImageView, label: UIKit.UILabel)
+}
+extension UIKit.UIResponder {
+ @_Concurrency.MainActor(unsafe) public func mc_statusBar(_ text: Swift.String, duration: CoreGraphics.CGFloat = MCToastConfig.shared.duration, font: UIKit.UIFont = MCToastConfig.shared.text.font, backgroundColor: UIKit.UIColor? = nil, callback: DCUniToast.MCToast.MCToastCallback? = nil)
+}
+extension DCUniToast.MCToast {
+ public static func mc_statusBar(_ text: Swift.String, duration: CoreGraphics.CGFloat = MCToastConfig.shared.duration, font: UIKit.UIFont = MCToastConfig.shared.text.font, backgroundColor: UIKit.UIColor? = nil, callback: DCUniToast.MCToast.MCToastCallback? = nil)
+}
+@objc @_inheritsConvenienceInitializers public class MCToastConfig : ObjectiveC.NSObject {
+ public static let shared: DCUniToast.MCToastConfig
+ public var respond: DCUniToast.MCToast.MCToastRespond
+ public var background: DCUniToast.MCToastConfig.Background
+ public var icon: DCUniToast.MCToastConfig.Icon
+ public var text: DCUniToast.MCToastConfig.Text
+ public var spacing: DCUniToast.MCToastConfig.MainAreaSpacing
+ public var duration: CoreGraphics.CGFloat
+ @objc override dynamic public init()
+ @objc deinit
+}
+extension DCUniToast.MCToastConfig {
+ public struct Background {
+ public var color: UIKit.UIColor
+ public var size: CoreGraphics.CGSize
+ }
+ public struct Icon {
+ public var size: CoreGraphics.CGSize
+ public var successImage: UIKit.UIImage?
+ public var failureImage: UIKit.UIImage?
+ public var warningImage: UIKit.UIImage?
+ }
+ public struct Text {
+ public var textColor: UIKit.UIColor?
+ public var font: UIKit.UIFont
+ public var offset: (CoreGraphics.CGFloat)
+ }
+ public struct MainAreaSpacing {
+ public var margin: CoreGraphics.CGFloat
+ public var padding: CoreGraphics.CGFloat
+ }
+}
+extension UIKit.UIResponder {
+ @_Concurrency.MainActor(unsafe) public func mc_loading(text: Swift.String = "正在加载中", duration: CoreGraphics.CGFloat = 0, respond: DCUniToast.MCToast.MCToastRespond = MCToastConfig.shared.respond, callback: DCUniToast.MCToast.MCToastCallback? = nil)
+ @_Concurrency.MainActor(unsafe) public func mc_loading(imageNames: [UIKit.UIImage?], animationSpeed: CoreGraphics.CGFloat = 0.1, duration: CoreGraphics.CGFloat = 0, respond: DCUniToast.MCToast.MCToastRespond = MCToastConfig.shared.respond, callback: DCUniToast.MCToast.MCToastCallback? = nil)
+}
+extension DCUniToast.MCToast {
+ public static func mc_loading(text: Swift.String = "正在加载中", duration: CoreGraphics.CGFloat = 0, respond: DCUniToast.MCToast.MCToastRespond = MCToastConfig.shared.respond, callback: DCUniToast.MCToast.MCToastCallback? = nil)
+ public static func mc_loading(imageNames: [UIKit.UIImage?], animationSpeed: CoreGraphics.CGFloat = 0.1, duration: CoreGraphics.CGFloat = 0, respond: DCUniToast.MCToast.MCToastRespond = MCToastConfig.shared.respond, callback: DCUniToast.MCToast.MCToastCallback? = nil)
+}
+extension DCUniToast.MCToast.MCToastRespond : Swift.Equatable {}
+extension DCUniToast.MCToast.MCToastRespond : Swift.Hashable {}
+extension DCUniToast.MCToast.MCToastType : Swift.Equatable {}
+extension DCUniToast.MCToast.MCToastType : Swift.Hashable {}
diff --git a/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCUniToast.framework/Modules/DCUniToast.swiftmodule/arm.swiftmodule b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCUniToast.framework/Modules/DCUniToast.swiftmodule/arm.swiftmodule
new file mode 100644
index 0000000000000000000000000000000000000000..e638821ba89eda4be54861a61390a1ff627ea2dc
Binary files /dev/null and b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCUniToast.framework/Modules/DCUniToast.swiftmodule/arm.swiftmodule differ
diff --git a/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCUniToast.framework/Modules/DCUniToast.swiftmodule/arm64-apple-ios.swiftdoc b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCUniToast.framework/Modules/DCUniToast.swiftmodule/arm64-apple-ios.swiftdoc
new file mode 100644
index 0000000000000000000000000000000000000000..1816fbce7a2872a488e166b183b7ecbed4024552
Binary files /dev/null and b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCUniToast.framework/Modules/DCUniToast.swiftmodule/arm64-apple-ios.swiftdoc differ
diff --git a/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCUniToast.framework/Modules/DCUniToast.swiftmodule/arm64-apple-ios.swiftinterface b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCUniToast.framework/Modules/DCUniToast.swiftmodule/arm64-apple-ios.swiftinterface
new file mode 100644
index 0000000000000000000000000000000000000000..edcea5985c8565b18b4e6befb4fb53405f8f7595
--- /dev/null
+++ b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCUniToast.framework/Modules/DCUniToast.swiftmodule/arm64-apple-ios.swiftinterface
@@ -0,0 +1,116 @@
+// swift-interface-format-version: 1.0
+// swift-compiler-version: Apple Swift version 5.5.2 (swiftlang-1300.0.47.5 clang-1300.0.29.30)
+// swift-module-flags: -target arm64-apple-ios9.0 -enable-objc-interop -enable-library-evolution -swift-version 5 -enforce-exclusivity=checked -O -module-name DCUniToast
+@_exported import DCUniToast
+import Foundation
+import Swift
+import UIKit
+import _Concurrency
+extension UIKit.UIResponder {
+ @_Concurrency.MainActor(unsafe) public func mc_text(_ text: Swift.String, offset: CoreGraphics.CGFloat? = nil, duration: CoreGraphics.CGFloat = MCToastConfig.shared.duration, respond: DCUniToast.MCToast.MCToastRespond = MCToastConfig.shared.respond, callback: DCUniToast.MCToast.MCToastCallback? = nil)
+}
+extension DCUniToast.MCToast {
+ public static func mc_text(_ text: Swift.String, offset: CoreGraphics.CGFloat? = nil, duration: CoreGraphics.CGFloat = MCToastConfig.shared.duration, respond: DCUniToast.MCToast.MCToastRespond = MCToastConfig.shared.respond, callback: DCUniToast.MCToast.MCToastCallback? = nil)
+}
+extension UIKit.UIResponder {
+ @_Concurrency.MainActor(unsafe) public func mc_remove(callback: DCUniToast.MCToast.MCToastCallback? = nil)
+}
+extension DCUniToast.MCToast {
+ public static func mc_remove(callback: DCUniToast.MCToast.MCToastCallback? = nil)
+}
+@objc @_inheritsConvenienceInitializers @_hasMissingDesignatedInitializers public class MCToast : ObjectiveC.NSObject {
+ @objc deinit
+}
+extension DCUniToast.MCToast {
+ public typealias MCToastCallback = () -> Swift.Void
+ public enum MCToastRespond {
+ case `default`
+ case noRespond
+ case respond
+ case navBarRespond
+ public static func == (a: DCUniToast.MCToast.MCToastRespond, b: DCUniToast.MCToast.MCToastRespond) -> Swift.Bool
+ public func hash(into hasher: inout Swift.Hasher)
+ public var hashValue: Swift.Int {
+ get
+ }
+ }
+}
+extension DCUniToast.MCToast {
+ public static func colorWithSystemStyle(_ darkColor: UIKit.UIColor, _ defaultColor: UIKit.UIColor) -> UIKit.UIColor
+}
+extension DCUniToast.MCToast {
+ public enum MCToastType {
+ case success
+ case failure
+ case warning
+ public static func == (a: DCUniToast.MCToast.MCToastType, b: DCUniToast.MCToast.MCToastType) -> Swift.Bool
+ public func hash(into hasher: inout Swift.Hasher)
+ public var hashValue: Swift.Int {
+ get
+ }
+ }
+}
+extension UIKit.UIResponder {
+ @_Concurrency.MainActor(unsafe) public func mc_success(_ text: Swift.String, duration: CoreGraphics.CGFloat = MCToastConfig.shared.duration, respond: DCUniToast.MCToast.MCToastRespond = MCToastConfig.shared.respond, callback: DCUniToast.MCToast.MCToastCallback? = nil)
+ @_Concurrency.MainActor(unsafe) public func mc_failure(_ text: Swift.String, duration: CoreGraphics.CGFloat = MCToastConfig.shared.duration, respond: DCUniToast.MCToast.MCToastRespond = MCToastConfig.shared.respond, callback: DCUniToast.MCToast.MCToastCallback? = nil)
+ @_Concurrency.MainActor(unsafe) public func mc_warning(_ text: Swift.String, duration: CoreGraphics.CGFloat = MCToastConfig.shared.duration, respond: DCUniToast.MCToast.MCToastRespond = MCToastConfig.shared.respond, callback: DCUniToast.MCToast.MCToastCallback? = nil)
+}
+extension DCUniToast.MCToast {
+ public static func mc_success(_ text: Swift.String, duration: CoreGraphics.CGFloat = MCToastConfig.shared.duration, respond: DCUniToast.MCToast.MCToastRespond = MCToastConfig.shared.respond, callback: DCUniToast.MCToast.MCToastCallback? = nil)
+ public static func mc_failure(_ text: Swift.String, duration: CoreGraphics.CGFloat = MCToastConfig.shared.duration, respond: DCUniToast.MCToast.MCToastRespond = MCToastConfig.shared.respond, callback: DCUniToast.MCToast.MCToastCallback? = nil)
+ public static func mc_warning(_ text: Swift.String, duration: CoreGraphics.CGFloat = MCToastConfig.shared.duration, respond: DCUniToast.MCToast.MCToastRespond = MCToastConfig.shared.respond, callback: DCUniToast.MCToast.MCToastCallback? = nil)
+}
+extension DCUniToast.MCToast {
+ @discardableResult
+ public static func showStatus(_ type: DCUniToast.MCToast.MCToastType?, text: Swift.String, iconImage: UIKit.UIImage?, duration: CoreGraphics.CGFloat, respond: DCUniToast.MCToast.MCToastRespond, callback: DCUniToast.MCToast.MCToastCallback? = nil) -> (imageView: UIKit.UIImageView, label: UIKit.UILabel)
+}
+extension UIKit.UIResponder {
+ @_Concurrency.MainActor(unsafe) public func mc_statusBar(_ text: Swift.String, duration: CoreGraphics.CGFloat = MCToastConfig.shared.duration, font: UIKit.UIFont = MCToastConfig.shared.text.font, backgroundColor: UIKit.UIColor? = nil, callback: DCUniToast.MCToast.MCToastCallback? = nil)
+}
+extension DCUniToast.MCToast {
+ public static func mc_statusBar(_ text: Swift.String, duration: CoreGraphics.CGFloat = MCToastConfig.shared.duration, font: UIKit.UIFont = MCToastConfig.shared.text.font, backgroundColor: UIKit.UIColor? = nil, callback: DCUniToast.MCToast.MCToastCallback? = nil)
+}
+@objc @_inheritsConvenienceInitializers public class MCToastConfig : ObjectiveC.NSObject {
+ public static let shared: DCUniToast.MCToastConfig
+ public var respond: DCUniToast.MCToast.MCToastRespond
+ public var background: DCUniToast.MCToastConfig.Background
+ public var icon: DCUniToast.MCToastConfig.Icon
+ public var text: DCUniToast.MCToastConfig.Text
+ public var spacing: DCUniToast.MCToastConfig.MainAreaSpacing
+ public var duration: CoreGraphics.CGFloat
+ @objc override dynamic public init()
+ @objc deinit
+}
+extension DCUniToast.MCToastConfig {
+ public struct Background {
+ public var color: UIKit.UIColor
+ public var size: CoreGraphics.CGSize
+ }
+ public struct Icon {
+ public var size: CoreGraphics.CGSize
+ public var successImage: UIKit.UIImage?
+ public var failureImage: UIKit.UIImage?
+ public var warningImage: UIKit.UIImage?
+ }
+ public struct Text {
+ public var textColor: UIKit.UIColor?
+ public var font: UIKit.UIFont
+ public var offset: (CoreGraphics.CGFloat)
+ }
+ public struct MainAreaSpacing {
+ public var margin: CoreGraphics.CGFloat
+ public var padding: CoreGraphics.CGFloat
+ }
+}
+extension UIKit.UIResponder {
+ @_Concurrency.MainActor(unsafe) public func mc_loading(text: Swift.String = "正在加载中", duration: CoreGraphics.CGFloat = 0, respond: DCUniToast.MCToast.MCToastRespond = MCToastConfig.shared.respond, callback: DCUniToast.MCToast.MCToastCallback? = nil)
+ @_Concurrency.MainActor(unsafe) public func mc_loading(imageNames: [UIKit.UIImage?], animationSpeed: CoreGraphics.CGFloat = 0.1, duration: CoreGraphics.CGFloat = 0, respond: DCUniToast.MCToast.MCToastRespond = MCToastConfig.shared.respond, callback: DCUniToast.MCToast.MCToastCallback? = nil)
+}
+extension DCUniToast.MCToast {
+ public static func mc_loading(text: Swift.String = "正在加载中", duration: CoreGraphics.CGFloat = 0, respond: DCUniToast.MCToast.MCToastRespond = MCToastConfig.shared.respond, callback: DCUniToast.MCToast.MCToastCallback? = nil)
+ public static func mc_loading(imageNames: [UIKit.UIImage?], animationSpeed: CoreGraphics.CGFloat = 0.1, duration: CoreGraphics.CGFloat = 0, respond: DCUniToast.MCToast.MCToastRespond = MCToastConfig.shared.respond, callback: DCUniToast.MCToast.MCToastCallback? = nil)
+}
+extension DCUniToast.MCToast.MCToastRespond : Swift.Equatable {}
+extension DCUniToast.MCToast.MCToastRespond : Swift.Hashable {}
+extension DCUniToast.MCToast.MCToastType : Swift.Equatable {}
+extension DCUniToast.MCToast.MCToastType : Swift.Hashable {}
diff --git a/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCUniToast.framework/Modules/DCUniToast.swiftmodule/arm64-apple-ios.swiftmodule b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCUniToast.framework/Modules/DCUniToast.swiftmodule/arm64-apple-ios.swiftmodule
new file mode 100644
index 0000000000000000000000000000000000000000..d5c77836065b88a4ef205d297545a235df916cb6
Binary files /dev/null and b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCUniToast.framework/Modules/DCUniToast.swiftmodule/arm64-apple-ios.swiftmodule differ
diff --git a/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCUniToast.framework/Modules/DCUniToast.swiftmodule/arm64.swiftdoc b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCUniToast.framework/Modules/DCUniToast.swiftmodule/arm64.swiftdoc
new file mode 100644
index 0000000000000000000000000000000000000000..1816fbce7a2872a488e166b183b7ecbed4024552
Binary files /dev/null and b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCUniToast.framework/Modules/DCUniToast.swiftmodule/arm64.swiftdoc differ
diff --git a/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCUniToast.framework/Modules/DCUniToast.swiftmodule/arm64.swiftinterface b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCUniToast.framework/Modules/DCUniToast.swiftmodule/arm64.swiftinterface
new file mode 100644
index 0000000000000000000000000000000000000000..edcea5985c8565b18b4e6befb4fb53405f8f7595
--- /dev/null
+++ b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCUniToast.framework/Modules/DCUniToast.swiftmodule/arm64.swiftinterface
@@ -0,0 +1,116 @@
+// swift-interface-format-version: 1.0
+// swift-compiler-version: Apple Swift version 5.5.2 (swiftlang-1300.0.47.5 clang-1300.0.29.30)
+// swift-module-flags: -target arm64-apple-ios9.0 -enable-objc-interop -enable-library-evolution -swift-version 5 -enforce-exclusivity=checked -O -module-name DCUniToast
+@_exported import DCUniToast
+import Foundation
+import Swift
+import UIKit
+import _Concurrency
+extension UIKit.UIResponder {
+ @_Concurrency.MainActor(unsafe) public func mc_text(_ text: Swift.String, offset: CoreGraphics.CGFloat? = nil, duration: CoreGraphics.CGFloat = MCToastConfig.shared.duration, respond: DCUniToast.MCToast.MCToastRespond = MCToastConfig.shared.respond, callback: DCUniToast.MCToast.MCToastCallback? = nil)
+}
+extension DCUniToast.MCToast {
+ public static func mc_text(_ text: Swift.String, offset: CoreGraphics.CGFloat? = nil, duration: CoreGraphics.CGFloat = MCToastConfig.shared.duration, respond: DCUniToast.MCToast.MCToastRespond = MCToastConfig.shared.respond, callback: DCUniToast.MCToast.MCToastCallback? = nil)
+}
+extension UIKit.UIResponder {
+ @_Concurrency.MainActor(unsafe) public func mc_remove(callback: DCUniToast.MCToast.MCToastCallback? = nil)
+}
+extension DCUniToast.MCToast {
+ public static func mc_remove(callback: DCUniToast.MCToast.MCToastCallback? = nil)
+}
+@objc @_inheritsConvenienceInitializers @_hasMissingDesignatedInitializers public class MCToast : ObjectiveC.NSObject {
+ @objc deinit
+}
+extension DCUniToast.MCToast {
+ public typealias MCToastCallback = () -> Swift.Void
+ public enum MCToastRespond {
+ case `default`
+ case noRespond
+ case respond
+ case navBarRespond
+ public static func == (a: DCUniToast.MCToast.MCToastRespond, b: DCUniToast.MCToast.MCToastRespond) -> Swift.Bool
+ public func hash(into hasher: inout Swift.Hasher)
+ public var hashValue: Swift.Int {
+ get
+ }
+ }
+}
+extension DCUniToast.MCToast {
+ public static func colorWithSystemStyle(_ darkColor: UIKit.UIColor, _ defaultColor: UIKit.UIColor) -> UIKit.UIColor
+}
+extension DCUniToast.MCToast {
+ public enum MCToastType {
+ case success
+ case failure
+ case warning
+ public static func == (a: DCUniToast.MCToast.MCToastType, b: DCUniToast.MCToast.MCToastType) -> Swift.Bool
+ public func hash(into hasher: inout Swift.Hasher)
+ public var hashValue: Swift.Int {
+ get
+ }
+ }
+}
+extension UIKit.UIResponder {
+ @_Concurrency.MainActor(unsafe) public func mc_success(_ text: Swift.String, duration: CoreGraphics.CGFloat = MCToastConfig.shared.duration, respond: DCUniToast.MCToast.MCToastRespond = MCToastConfig.shared.respond, callback: DCUniToast.MCToast.MCToastCallback? = nil)
+ @_Concurrency.MainActor(unsafe) public func mc_failure(_ text: Swift.String, duration: CoreGraphics.CGFloat = MCToastConfig.shared.duration, respond: DCUniToast.MCToast.MCToastRespond = MCToastConfig.shared.respond, callback: DCUniToast.MCToast.MCToastCallback? = nil)
+ @_Concurrency.MainActor(unsafe) public func mc_warning(_ text: Swift.String, duration: CoreGraphics.CGFloat = MCToastConfig.shared.duration, respond: DCUniToast.MCToast.MCToastRespond = MCToastConfig.shared.respond, callback: DCUniToast.MCToast.MCToastCallback? = nil)
+}
+extension DCUniToast.MCToast {
+ public static func mc_success(_ text: Swift.String, duration: CoreGraphics.CGFloat = MCToastConfig.shared.duration, respond: DCUniToast.MCToast.MCToastRespond = MCToastConfig.shared.respond, callback: DCUniToast.MCToast.MCToastCallback? = nil)
+ public static func mc_failure(_ text: Swift.String, duration: CoreGraphics.CGFloat = MCToastConfig.shared.duration, respond: DCUniToast.MCToast.MCToastRespond = MCToastConfig.shared.respond, callback: DCUniToast.MCToast.MCToastCallback? = nil)
+ public static func mc_warning(_ text: Swift.String, duration: CoreGraphics.CGFloat = MCToastConfig.shared.duration, respond: DCUniToast.MCToast.MCToastRespond = MCToastConfig.shared.respond, callback: DCUniToast.MCToast.MCToastCallback? = nil)
+}
+extension DCUniToast.MCToast {
+ @discardableResult
+ public static func showStatus(_ type: DCUniToast.MCToast.MCToastType?, text: Swift.String, iconImage: UIKit.UIImage?, duration: CoreGraphics.CGFloat, respond: DCUniToast.MCToast.MCToastRespond, callback: DCUniToast.MCToast.MCToastCallback? = nil) -> (imageView: UIKit.UIImageView, label: UIKit.UILabel)
+}
+extension UIKit.UIResponder {
+ @_Concurrency.MainActor(unsafe) public func mc_statusBar(_ text: Swift.String, duration: CoreGraphics.CGFloat = MCToastConfig.shared.duration, font: UIKit.UIFont = MCToastConfig.shared.text.font, backgroundColor: UIKit.UIColor? = nil, callback: DCUniToast.MCToast.MCToastCallback? = nil)
+}
+extension DCUniToast.MCToast {
+ public static func mc_statusBar(_ text: Swift.String, duration: CoreGraphics.CGFloat = MCToastConfig.shared.duration, font: UIKit.UIFont = MCToastConfig.shared.text.font, backgroundColor: UIKit.UIColor? = nil, callback: DCUniToast.MCToast.MCToastCallback? = nil)
+}
+@objc @_inheritsConvenienceInitializers public class MCToastConfig : ObjectiveC.NSObject {
+ public static let shared: DCUniToast.MCToastConfig
+ public var respond: DCUniToast.MCToast.MCToastRespond
+ public var background: DCUniToast.MCToastConfig.Background
+ public var icon: DCUniToast.MCToastConfig.Icon
+ public var text: DCUniToast.MCToastConfig.Text
+ public var spacing: DCUniToast.MCToastConfig.MainAreaSpacing
+ public var duration: CoreGraphics.CGFloat
+ @objc override dynamic public init()
+ @objc deinit
+}
+extension DCUniToast.MCToastConfig {
+ public struct Background {
+ public var color: UIKit.UIColor
+ public var size: CoreGraphics.CGSize
+ }
+ public struct Icon {
+ public var size: CoreGraphics.CGSize
+ public var successImage: UIKit.UIImage?
+ public var failureImage: UIKit.UIImage?
+ public var warningImage: UIKit.UIImage?
+ }
+ public struct Text {
+ public var textColor: UIKit.UIColor?
+ public var font: UIKit.UIFont
+ public var offset: (CoreGraphics.CGFloat)
+ }
+ public struct MainAreaSpacing {
+ public var margin: CoreGraphics.CGFloat
+ public var padding: CoreGraphics.CGFloat
+ }
+}
+extension UIKit.UIResponder {
+ @_Concurrency.MainActor(unsafe) public func mc_loading(text: Swift.String = "正在加载中", duration: CoreGraphics.CGFloat = 0, respond: DCUniToast.MCToast.MCToastRespond = MCToastConfig.shared.respond, callback: DCUniToast.MCToast.MCToastCallback? = nil)
+ @_Concurrency.MainActor(unsafe) public func mc_loading(imageNames: [UIKit.UIImage?], animationSpeed: CoreGraphics.CGFloat = 0.1, duration: CoreGraphics.CGFloat = 0, respond: DCUniToast.MCToast.MCToastRespond = MCToastConfig.shared.respond, callback: DCUniToast.MCToast.MCToastCallback? = nil)
+}
+extension DCUniToast.MCToast {
+ public static func mc_loading(text: Swift.String = "正在加载中", duration: CoreGraphics.CGFloat = 0, respond: DCUniToast.MCToast.MCToastRespond = MCToastConfig.shared.respond, callback: DCUniToast.MCToast.MCToastCallback? = nil)
+ public static func mc_loading(imageNames: [UIKit.UIImage?], animationSpeed: CoreGraphics.CGFloat = 0.1, duration: CoreGraphics.CGFloat = 0, respond: DCUniToast.MCToast.MCToastRespond = MCToastConfig.shared.respond, callback: DCUniToast.MCToast.MCToastCallback? = nil)
+}
+extension DCUniToast.MCToast.MCToastRespond : Swift.Equatable {}
+extension DCUniToast.MCToast.MCToastRespond : Swift.Hashable {}
+extension DCUniToast.MCToast.MCToastType : Swift.Equatable {}
+extension DCUniToast.MCToast.MCToastType : Swift.Hashable {}
diff --git a/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCUniToast.framework/Modules/DCUniToast.swiftmodule/arm64.swiftmodule b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCUniToast.framework/Modules/DCUniToast.swiftmodule/arm64.swiftmodule
new file mode 100644
index 0000000000000000000000000000000000000000..d5c77836065b88a4ef205d297545a235df916cb6
Binary files /dev/null and b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCUniToast.framework/Modules/DCUniToast.swiftmodule/arm64.swiftmodule differ
diff --git a/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCUniToast.framework/Modules/DCUniToast.swiftmodule/armv7-apple-ios.swiftdoc b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCUniToast.framework/Modules/DCUniToast.swiftmodule/armv7-apple-ios.swiftdoc
new file mode 100644
index 0000000000000000000000000000000000000000..0d07be0079df2ef04468fe1340df7b409396ac95
Binary files /dev/null and b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCUniToast.framework/Modules/DCUniToast.swiftmodule/armv7-apple-ios.swiftdoc differ
diff --git a/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCUniToast.framework/Modules/DCUniToast.swiftmodule/armv7-apple-ios.swiftinterface b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCUniToast.framework/Modules/DCUniToast.swiftmodule/armv7-apple-ios.swiftinterface
new file mode 100644
index 0000000000000000000000000000000000000000..bff0c4bb9e66f10bc382492a46e69ccefe1dda57
--- /dev/null
+++ b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCUniToast.framework/Modules/DCUniToast.swiftmodule/armv7-apple-ios.swiftinterface
@@ -0,0 +1,116 @@
+// swift-interface-format-version: 1.0
+// swift-compiler-version: Apple Swift version 5.5.2 (swiftlang-1300.0.47.5 clang-1300.0.29.30)
+// swift-module-flags: -target armv7-apple-ios9.0 -enable-objc-interop -enable-library-evolution -swift-version 5 -enforce-exclusivity=checked -O -module-name DCUniToast
+@_exported import DCUniToast
+import Foundation
+import Swift
+import UIKit
+import _Concurrency
+extension UIKit.UIResponder {
+ @_Concurrency.MainActor(unsafe) public func mc_text(_ text: Swift.String, offset: CoreGraphics.CGFloat? = nil, duration: CoreGraphics.CGFloat = MCToastConfig.shared.duration, respond: DCUniToast.MCToast.MCToastRespond = MCToastConfig.shared.respond, callback: DCUniToast.MCToast.MCToastCallback? = nil)
+}
+extension DCUniToast.MCToast {
+ public static func mc_text(_ text: Swift.String, offset: CoreGraphics.CGFloat? = nil, duration: CoreGraphics.CGFloat = MCToastConfig.shared.duration, respond: DCUniToast.MCToast.MCToastRespond = MCToastConfig.shared.respond, callback: DCUniToast.MCToast.MCToastCallback? = nil)
+}
+extension UIKit.UIResponder {
+ @_Concurrency.MainActor(unsafe) public func mc_remove(callback: DCUniToast.MCToast.MCToastCallback? = nil)
+}
+extension DCUniToast.MCToast {
+ public static func mc_remove(callback: DCUniToast.MCToast.MCToastCallback? = nil)
+}
+@objc @_inheritsConvenienceInitializers @_hasMissingDesignatedInitializers public class MCToast : ObjectiveC.NSObject {
+ @objc deinit
+}
+extension DCUniToast.MCToast {
+ public typealias MCToastCallback = () -> Swift.Void
+ public enum MCToastRespond {
+ case `default`
+ case noRespond
+ case respond
+ case navBarRespond
+ public static func == (a: DCUniToast.MCToast.MCToastRespond, b: DCUniToast.MCToast.MCToastRespond) -> Swift.Bool
+ public func hash(into hasher: inout Swift.Hasher)
+ public var hashValue: Swift.Int {
+ get
+ }
+ }
+}
+extension DCUniToast.MCToast {
+ public static func colorWithSystemStyle(_ darkColor: UIKit.UIColor, _ defaultColor: UIKit.UIColor) -> UIKit.UIColor
+}
+extension DCUniToast.MCToast {
+ public enum MCToastType {
+ case success
+ case failure
+ case warning
+ public static func == (a: DCUniToast.MCToast.MCToastType, b: DCUniToast.MCToast.MCToastType) -> Swift.Bool
+ public func hash(into hasher: inout Swift.Hasher)
+ public var hashValue: Swift.Int {
+ get
+ }
+ }
+}
+extension UIKit.UIResponder {
+ @_Concurrency.MainActor(unsafe) public func mc_success(_ text: Swift.String, duration: CoreGraphics.CGFloat = MCToastConfig.shared.duration, respond: DCUniToast.MCToast.MCToastRespond = MCToastConfig.shared.respond, callback: DCUniToast.MCToast.MCToastCallback? = nil)
+ @_Concurrency.MainActor(unsafe) public func mc_failure(_ text: Swift.String, duration: CoreGraphics.CGFloat = MCToastConfig.shared.duration, respond: DCUniToast.MCToast.MCToastRespond = MCToastConfig.shared.respond, callback: DCUniToast.MCToast.MCToastCallback? = nil)
+ @_Concurrency.MainActor(unsafe) public func mc_warning(_ text: Swift.String, duration: CoreGraphics.CGFloat = MCToastConfig.shared.duration, respond: DCUniToast.MCToast.MCToastRespond = MCToastConfig.shared.respond, callback: DCUniToast.MCToast.MCToastCallback? = nil)
+}
+extension DCUniToast.MCToast {
+ public static func mc_success(_ text: Swift.String, duration: CoreGraphics.CGFloat = MCToastConfig.shared.duration, respond: DCUniToast.MCToast.MCToastRespond = MCToastConfig.shared.respond, callback: DCUniToast.MCToast.MCToastCallback? = nil)
+ public static func mc_failure(_ text: Swift.String, duration: CoreGraphics.CGFloat = MCToastConfig.shared.duration, respond: DCUniToast.MCToast.MCToastRespond = MCToastConfig.shared.respond, callback: DCUniToast.MCToast.MCToastCallback? = nil)
+ public static func mc_warning(_ text: Swift.String, duration: CoreGraphics.CGFloat = MCToastConfig.shared.duration, respond: DCUniToast.MCToast.MCToastRespond = MCToastConfig.shared.respond, callback: DCUniToast.MCToast.MCToastCallback? = nil)
+}
+extension DCUniToast.MCToast {
+ @discardableResult
+ public static func showStatus(_ type: DCUniToast.MCToast.MCToastType?, text: Swift.String, iconImage: UIKit.UIImage?, duration: CoreGraphics.CGFloat, respond: DCUniToast.MCToast.MCToastRespond, callback: DCUniToast.MCToast.MCToastCallback? = nil) -> (imageView: UIKit.UIImageView, label: UIKit.UILabel)
+}
+extension UIKit.UIResponder {
+ @_Concurrency.MainActor(unsafe) public func mc_statusBar(_ text: Swift.String, duration: CoreGraphics.CGFloat = MCToastConfig.shared.duration, font: UIKit.UIFont = MCToastConfig.shared.text.font, backgroundColor: UIKit.UIColor? = nil, callback: DCUniToast.MCToast.MCToastCallback? = nil)
+}
+extension DCUniToast.MCToast {
+ public static func mc_statusBar(_ text: Swift.String, duration: CoreGraphics.CGFloat = MCToastConfig.shared.duration, font: UIKit.UIFont = MCToastConfig.shared.text.font, backgroundColor: UIKit.UIColor? = nil, callback: DCUniToast.MCToast.MCToastCallback? = nil)
+}
+@objc @_inheritsConvenienceInitializers public class MCToastConfig : ObjectiveC.NSObject {
+ public static let shared: DCUniToast.MCToastConfig
+ public var respond: DCUniToast.MCToast.MCToastRespond
+ public var background: DCUniToast.MCToastConfig.Background
+ public var icon: DCUniToast.MCToastConfig.Icon
+ public var text: DCUniToast.MCToastConfig.Text
+ public var spacing: DCUniToast.MCToastConfig.MainAreaSpacing
+ public var duration: CoreGraphics.CGFloat
+ @objc override dynamic public init()
+ @objc deinit
+}
+extension DCUniToast.MCToastConfig {
+ public struct Background {
+ public var color: UIKit.UIColor
+ public var size: CoreGraphics.CGSize
+ }
+ public struct Icon {
+ public var size: CoreGraphics.CGSize
+ public var successImage: UIKit.UIImage?
+ public var failureImage: UIKit.UIImage?
+ public var warningImage: UIKit.UIImage?
+ }
+ public struct Text {
+ public var textColor: UIKit.UIColor?
+ public var font: UIKit.UIFont
+ public var offset: (CoreGraphics.CGFloat)
+ }
+ public struct MainAreaSpacing {
+ public var margin: CoreGraphics.CGFloat
+ public var padding: CoreGraphics.CGFloat
+ }
+}
+extension UIKit.UIResponder {
+ @_Concurrency.MainActor(unsafe) public func mc_loading(text: Swift.String = "正在加载中", duration: CoreGraphics.CGFloat = 0, respond: DCUniToast.MCToast.MCToastRespond = MCToastConfig.shared.respond, callback: DCUniToast.MCToast.MCToastCallback? = nil)
+ @_Concurrency.MainActor(unsafe) public func mc_loading(imageNames: [UIKit.UIImage?], animationSpeed: CoreGraphics.CGFloat = 0.1, duration: CoreGraphics.CGFloat = 0, respond: DCUniToast.MCToast.MCToastRespond = MCToastConfig.shared.respond, callback: DCUniToast.MCToast.MCToastCallback? = nil)
+}
+extension DCUniToast.MCToast {
+ public static func mc_loading(text: Swift.String = "正在加载中", duration: CoreGraphics.CGFloat = 0, respond: DCUniToast.MCToast.MCToastRespond = MCToastConfig.shared.respond, callback: DCUniToast.MCToast.MCToastCallback? = nil)
+ public static func mc_loading(imageNames: [UIKit.UIImage?], animationSpeed: CoreGraphics.CGFloat = 0.1, duration: CoreGraphics.CGFloat = 0, respond: DCUniToast.MCToast.MCToastRespond = MCToastConfig.shared.respond, callback: DCUniToast.MCToast.MCToastCallback? = nil)
+}
+extension DCUniToast.MCToast.MCToastRespond : Swift.Equatable {}
+extension DCUniToast.MCToast.MCToastRespond : Swift.Hashable {}
+extension DCUniToast.MCToast.MCToastType : Swift.Equatable {}
+extension DCUniToast.MCToast.MCToastType : Swift.Hashable {}
diff --git a/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCUniToast.framework/Modules/DCUniToast.swiftmodule/armv7-apple-ios.swiftmodule b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCUniToast.framework/Modules/DCUniToast.swiftmodule/armv7-apple-ios.swiftmodule
new file mode 100644
index 0000000000000000000000000000000000000000..e638821ba89eda4be54861a61390a1ff627ea2dc
Binary files /dev/null and b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCUniToast.framework/Modules/DCUniToast.swiftmodule/armv7-apple-ios.swiftmodule differ
diff --git a/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCUniToast.framework/Modules/DCUniToast.swiftmodule/armv7.swiftdoc b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCUniToast.framework/Modules/DCUniToast.swiftmodule/armv7.swiftdoc
new file mode 100644
index 0000000000000000000000000000000000000000..0d07be0079df2ef04468fe1340df7b409396ac95
Binary files /dev/null and b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCUniToast.framework/Modules/DCUniToast.swiftmodule/armv7.swiftdoc differ
diff --git a/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCUniToast.framework/Modules/DCUniToast.swiftmodule/armv7.swiftinterface b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCUniToast.framework/Modules/DCUniToast.swiftmodule/armv7.swiftinterface
new file mode 100644
index 0000000000000000000000000000000000000000..bff0c4bb9e66f10bc382492a46e69ccefe1dda57
--- /dev/null
+++ b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCUniToast.framework/Modules/DCUniToast.swiftmodule/armv7.swiftinterface
@@ -0,0 +1,116 @@
+// swift-interface-format-version: 1.0
+// swift-compiler-version: Apple Swift version 5.5.2 (swiftlang-1300.0.47.5 clang-1300.0.29.30)
+// swift-module-flags: -target armv7-apple-ios9.0 -enable-objc-interop -enable-library-evolution -swift-version 5 -enforce-exclusivity=checked -O -module-name DCUniToast
+@_exported import DCUniToast
+import Foundation
+import Swift
+import UIKit
+import _Concurrency
+extension UIKit.UIResponder {
+ @_Concurrency.MainActor(unsafe) public func mc_text(_ text: Swift.String, offset: CoreGraphics.CGFloat? = nil, duration: CoreGraphics.CGFloat = MCToastConfig.shared.duration, respond: DCUniToast.MCToast.MCToastRespond = MCToastConfig.shared.respond, callback: DCUniToast.MCToast.MCToastCallback? = nil)
+}
+extension DCUniToast.MCToast {
+ public static func mc_text(_ text: Swift.String, offset: CoreGraphics.CGFloat? = nil, duration: CoreGraphics.CGFloat = MCToastConfig.shared.duration, respond: DCUniToast.MCToast.MCToastRespond = MCToastConfig.shared.respond, callback: DCUniToast.MCToast.MCToastCallback? = nil)
+}
+extension UIKit.UIResponder {
+ @_Concurrency.MainActor(unsafe) public func mc_remove(callback: DCUniToast.MCToast.MCToastCallback? = nil)
+}
+extension DCUniToast.MCToast {
+ public static func mc_remove(callback: DCUniToast.MCToast.MCToastCallback? = nil)
+}
+@objc @_inheritsConvenienceInitializers @_hasMissingDesignatedInitializers public class MCToast : ObjectiveC.NSObject {
+ @objc deinit
+}
+extension DCUniToast.MCToast {
+ public typealias MCToastCallback = () -> Swift.Void
+ public enum MCToastRespond {
+ case `default`
+ case noRespond
+ case respond
+ case navBarRespond
+ public static func == (a: DCUniToast.MCToast.MCToastRespond, b: DCUniToast.MCToast.MCToastRespond) -> Swift.Bool
+ public func hash(into hasher: inout Swift.Hasher)
+ public var hashValue: Swift.Int {
+ get
+ }
+ }
+}
+extension DCUniToast.MCToast {
+ public static func colorWithSystemStyle(_ darkColor: UIKit.UIColor, _ defaultColor: UIKit.UIColor) -> UIKit.UIColor
+}
+extension DCUniToast.MCToast {
+ public enum MCToastType {
+ case success
+ case failure
+ case warning
+ public static func == (a: DCUniToast.MCToast.MCToastType, b: DCUniToast.MCToast.MCToastType) -> Swift.Bool
+ public func hash(into hasher: inout Swift.Hasher)
+ public var hashValue: Swift.Int {
+ get
+ }
+ }
+}
+extension UIKit.UIResponder {
+ @_Concurrency.MainActor(unsafe) public func mc_success(_ text: Swift.String, duration: CoreGraphics.CGFloat = MCToastConfig.shared.duration, respond: DCUniToast.MCToast.MCToastRespond = MCToastConfig.shared.respond, callback: DCUniToast.MCToast.MCToastCallback? = nil)
+ @_Concurrency.MainActor(unsafe) public func mc_failure(_ text: Swift.String, duration: CoreGraphics.CGFloat = MCToastConfig.shared.duration, respond: DCUniToast.MCToast.MCToastRespond = MCToastConfig.shared.respond, callback: DCUniToast.MCToast.MCToastCallback? = nil)
+ @_Concurrency.MainActor(unsafe) public func mc_warning(_ text: Swift.String, duration: CoreGraphics.CGFloat = MCToastConfig.shared.duration, respond: DCUniToast.MCToast.MCToastRespond = MCToastConfig.shared.respond, callback: DCUniToast.MCToast.MCToastCallback? = nil)
+}
+extension DCUniToast.MCToast {
+ public static func mc_success(_ text: Swift.String, duration: CoreGraphics.CGFloat = MCToastConfig.shared.duration, respond: DCUniToast.MCToast.MCToastRespond = MCToastConfig.shared.respond, callback: DCUniToast.MCToast.MCToastCallback? = nil)
+ public static func mc_failure(_ text: Swift.String, duration: CoreGraphics.CGFloat = MCToastConfig.shared.duration, respond: DCUniToast.MCToast.MCToastRespond = MCToastConfig.shared.respond, callback: DCUniToast.MCToast.MCToastCallback? = nil)
+ public static func mc_warning(_ text: Swift.String, duration: CoreGraphics.CGFloat = MCToastConfig.shared.duration, respond: DCUniToast.MCToast.MCToastRespond = MCToastConfig.shared.respond, callback: DCUniToast.MCToast.MCToastCallback? = nil)
+}
+extension DCUniToast.MCToast {
+ @discardableResult
+ public static func showStatus(_ type: DCUniToast.MCToast.MCToastType?, text: Swift.String, iconImage: UIKit.UIImage?, duration: CoreGraphics.CGFloat, respond: DCUniToast.MCToast.MCToastRespond, callback: DCUniToast.MCToast.MCToastCallback? = nil) -> (imageView: UIKit.UIImageView, label: UIKit.UILabel)
+}
+extension UIKit.UIResponder {
+ @_Concurrency.MainActor(unsafe) public func mc_statusBar(_ text: Swift.String, duration: CoreGraphics.CGFloat = MCToastConfig.shared.duration, font: UIKit.UIFont = MCToastConfig.shared.text.font, backgroundColor: UIKit.UIColor? = nil, callback: DCUniToast.MCToast.MCToastCallback? = nil)
+}
+extension DCUniToast.MCToast {
+ public static func mc_statusBar(_ text: Swift.String, duration: CoreGraphics.CGFloat = MCToastConfig.shared.duration, font: UIKit.UIFont = MCToastConfig.shared.text.font, backgroundColor: UIKit.UIColor? = nil, callback: DCUniToast.MCToast.MCToastCallback? = nil)
+}
+@objc @_inheritsConvenienceInitializers public class MCToastConfig : ObjectiveC.NSObject {
+ public static let shared: DCUniToast.MCToastConfig
+ public var respond: DCUniToast.MCToast.MCToastRespond
+ public var background: DCUniToast.MCToastConfig.Background
+ public var icon: DCUniToast.MCToastConfig.Icon
+ public var text: DCUniToast.MCToastConfig.Text
+ public var spacing: DCUniToast.MCToastConfig.MainAreaSpacing
+ public var duration: CoreGraphics.CGFloat
+ @objc override dynamic public init()
+ @objc deinit
+}
+extension DCUniToast.MCToastConfig {
+ public struct Background {
+ public var color: UIKit.UIColor
+ public var size: CoreGraphics.CGSize
+ }
+ public struct Icon {
+ public var size: CoreGraphics.CGSize
+ public var successImage: UIKit.UIImage?
+ public var failureImage: UIKit.UIImage?
+ public var warningImage: UIKit.UIImage?
+ }
+ public struct Text {
+ public var textColor: UIKit.UIColor?
+ public var font: UIKit.UIFont
+ public var offset: (CoreGraphics.CGFloat)
+ }
+ public struct MainAreaSpacing {
+ public var margin: CoreGraphics.CGFloat
+ public var padding: CoreGraphics.CGFloat
+ }
+}
+extension UIKit.UIResponder {
+ @_Concurrency.MainActor(unsafe) public func mc_loading(text: Swift.String = "正在加载中", duration: CoreGraphics.CGFloat = 0, respond: DCUniToast.MCToast.MCToastRespond = MCToastConfig.shared.respond, callback: DCUniToast.MCToast.MCToastCallback? = nil)
+ @_Concurrency.MainActor(unsafe) public func mc_loading(imageNames: [UIKit.UIImage?], animationSpeed: CoreGraphics.CGFloat = 0.1, duration: CoreGraphics.CGFloat = 0, respond: DCUniToast.MCToast.MCToastRespond = MCToastConfig.shared.respond, callback: DCUniToast.MCToast.MCToastCallback? = nil)
+}
+extension DCUniToast.MCToast {
+ public static func mc_loading(text: Swift.String = "正在加载中", duration: CoreGraphics.CGFloat = 0, respond: DCUniToast.MCToast.MCToastRespond = MCToastConfig.shared.respond, callback: DCUniToast.MCToast.MCToastCallback? = nil)
+ public static func mc_loading(imageNames: [UIKit.UIImage?], animationSpeed: CoreGraphics.CGFloat = 0.1, duration: CoreGraphics.CGFloat = 0, respond: DCUniToast.MCToast.MCToastRespond = MCToastConfig.shared.respond, callback: DCUniToast.MCToast.MCToastCallback? = nil)
+}
+extension DCUniToast.MCToast.MCToastRespond : Swift.Equatable {}
+extension DCUniToast.MCToast.MCToastRespond : Swift.Hashable {}
+extension DCUniToast.MCToast.MCToastType : Swift.Equatable {}
+extension DCUniToast.MCToast.MCToastType : Swift.Hashable {}
diff --git a/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCUniToast.framework/Modules/DCUniToast.swiftmodule/armv7.swiftmodule b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCUniToast.framework/Modules/DCUniToast.swiftmodule/armv7.swiftmodule
new file mode 100644
index 0000000000000000000000000000000000000000..e638821ba89eda4be54861a61390a1ff627ea2dc
Binary files /dev/null and b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCUniToast.framework/Modules/DCUniToast.swiftmodule/armv7.swiftmodule differ
diff --git a/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCUniToast.framework/Modules/DCUniToast.swiftmodule/i386-apple-ios-simulator.swiftdoc b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCUniToast.framework/Modules/DCUniToast.swiftmodule/i386-apple-ios-simulator.swiftdoc
new file mode 100644
index 0000000000000000000000000000000000000000..e138c1b8d25f1170286446bec64b6c91614d743c
Binary files /dev/null and b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCUniToast.framework/Modules/DCUniToast.swiftmodule/i386-apple-ios-simulator.swiftdoc differ
diff --git a/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCUniToast.framework/Modules/DCUniToast.swiftmodule/i386-apple-ios-simulator.swiftinterface b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCUniToast.framework/Modules/DCUniToast.swiftmodule/i386-apple-ios-simulator.swiftinterface
new file mode 100644
index 0000000000000000000000000000000000000000..8d93113eec2cf9d14f361707f71a0a7e755b906b
--- /dev/null
+++ b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCUniToast.framework/Modules/DCUniToast.swiftmodule/i386-apple-ios-simulator.swiftinterface
@@ -0,0 +1,116 @@
+// swift-interface-format-version: 1.0
+// swift-compiler-version: Apple Swift version 5.5.2 (swiftlang-1300.0.47.5 clang-1300.0.29.30)
+// swift-module-flags: -target i386-apple-ios9.0-simulator -enable-objc-interop -enable-library-evolution -swift-version 5 -enforce-exclusivity=checked -O -module-name DCUniToast
+@_exported import DCUniToast
+import Foundation
+import Swift
+import UIKit
+import _Concurrency
+extension UIKit.UIResponder {
+ @_Concurrency.MainActor(unsafe) public func mc_text(_ text: Swift.String, offset: CoreGraphics.CGFloat? = nil, duration: CoreGraphics.CGFloat = MCToastConfig.shared.duration, respond: DCUniToast.MCToast.MCToastRespond = MCToastConfig.shared.respond, callback: DCUniToast.MCToast.MCToastCallback? = nil)
+}
+extension DCUniToast.MCToast {
+ public static func mc_text(_ text: Swift.String, offset: CoreGraphics.CGFloat? = nil, duration: CoreGraphics.CGFloat = MCToastConfig.shared.duration, respond: DCUniToast.MCToast.MCToastRespond = MCToastConfig.shared.respond, callback: DCUniToast.MCToast.MCToastCallback? = nil)
+}
+extension UIKit.UIResponder {
+ @_Concurrency.MainActor(unsafe) public func mc_remove(callback: DCUniToast.MCToast.MCToastCallback? = nil)
+}
+extension DCUniToast.MCToast {
+ public static func mc_remove(callback: DCUniToast.MCToast.MCToastCallback? = nil)
+}
+@objc @_inheritsConvenienceInitializers @_hasMissingDesignatedInitializers public class MCToast : ObjectiveC.NSObject {
+ @objc deinit
+}
+extension DCUniToast.MCToast {
+ public typealias MCToastCallback = () -> Swift.Void
+ public enum MCToastRespond {
+ case `default`
+ case noRespond
+ case respond
+ case navBarRespond
+ public static func == (a: DCUniToast.MCToast.MCToastRespond, b: DCUniToast.MCToast.MCToastRespond) -> Swift.Bool
+ public func hash(into hasher: inout Swift.Hasher)
+ public var hashValue: Swift.Int {
+ get
+ }
+ }
+}
+extension DCUniToast.MCToast {
+ public static func colorWithSystemStyle(_ darkColor: UIKit.UIColor, _ defaultColor: UIKit.UIColor) -> UIKit.UIColor
+}
+extension DCUniToast.MCToast {
+ public enum MCToastType {
+ case success
+ case failure
+ case warning
+ public static func == (a: DCUniToast.MCToast.MCToastType, b: DCUniToast.MCToast.MCToastType) -> Swift.Bool
+ public func hash(into hasher: inout Swift.Hasher)
+ public var hashValue: Swift.Int {
+ get
+ }
+ }
+}
+extension UIKit.UIResponder {
+ @_Concurrency.MainActor(unsafe) public func mc_success(_ text: Swift.String, duration: CoreGraphics.CGFloat = MCToastConfig.shared.duration, respond: DCUniToast.MCToast.MCToastRespond = MCToastConfig.shared.respond, callback: DCUniToast.MCToast.MCToastCallback? = nil)
+ @_Concurrency.MainActor(unsafe) public func mc_failure(_ text: Swift.String, duration: CoreGraphics.CGFloat = MCToastConfig.shared.duration, respond: DCUniToast.MCToast.MCToastRespond = MCToastConfig.shared.respond, callback: DCUniToast.MCToast.MCToastCallback? = nil)
+ @_Concurrency.MainActor(unsafe) public func mc_warning(_ text: Swift.String, duration: CoreGraphics.CGFloat = MCToastConfig.shared.duration, respond: DCUniToast.MCToast.MCToastRespond = MCToastConfig.shared.respond, callback: DCUniToast.MCToast.MCToastCallback? = nil)
+}
+extension DCUniToast.MCToast {
+ public static func mc_success(_ text: Swift.String, duration: CoreGraphics.CGFloat = MCToastConfig.shared.duration, respond: DCUniToast.MCToast.MCToastRespond = MCToastConfig.shared.respond, callback: DCUniToast.MCToast.MCToastCallback? = nil)
+ public static func mc_failure(_ text: Swift.String, duration: CoreGraphics.CGFloat = MCToastConfig.shared.duration, respond: DCUniToast.MCToast.MCToastRespond = MCToastConfig.shared.respond, callback: DCUniToast.MCToast.MCToastCallback? = nil)
+ public static func mc_warning(_ text: Swift.String, duration: CoreGraphics.CGFloat = MCToastConfig.shared.duration, respond: DCUniToast.MCToast.MCToastRespond = MCToastConfig.shared.respond, callback: DCUniToast.MCToast.MCToastCallback? = nil)
+}
+extension DCUniToast.MCToast {
+ @discardableResult
+ public static func showStatus(_ type: DCUniToast.MCToast.MCToastType?, text: Swift.String, iconImage: UIKit.UIImage?, duration: CoreGraphics.CGFloat, respond: DCUniToast.MCToast.MCToastRespond, callback: DCUniToast.MCToast.MCToastCallback? = nil) -> (imageView: UIKit.UIImageView, label: UIKit.UILabel)
+}
+extension UIKit.UIResponder {
+ @_Concurrency.MainActor(unsafe) public func mc_statusBar(_ text: Swift.String, duration: CoreGraphics.CGFloat = MCToastConfig.shared.duration, font: UIKit.UIFont = MCToastConfig.shared.text.font, backgroundColor: UIKit.UIColor? = nil, callback: DCUniToast.MCToast.MCToastCallback? = nil)
+}
+extension DCUniToast.MCToast {
+ public static func mc_statusBar(_ text: Swift.String, duration: CoreGraphics.CGFloat = MCToastConfig.shared.duration, font: UIKit.UIFont = MCToastConfig.shared.text.font, backgroundColor: UIKit.UIColor? = nil, callback: DCUniToast.MCToast.MCToastCallback? = nil)
+}
+@objc @_inheritsConvenienceInitializers public class MCToastConfig : ObjectiveC.NSObject {
+ public static let shared: DCUniToast.MCToastConfig
+ public var respond: DCUniToast.MCToast.MCToastRespond
+ public var background: DCUniToast.MCToastConfig.Background
+ public var icon: DCUniToast.MCToastConfig.Icon
+ public var text: DCUniToast.MCToastConfig.Text
+ public var spacing: DCUniToast.MCToastConfig.MainAreaSpacing
+ public var duration: CoreGraphics.CGFloat
+ @objc override dynamic public init()
+ @objc deinit
+}
+extension DCUniToast.MCToastConfig {
+ public struct Background {
+ public var color: UIKit.UIColor
+ public var size: CoreGraphics.CGSize
+ }
+ public struct Icon {
+ public var size: CoreGraphics.CGSize
+ public var successImage: UIKit.UIImage?
+ public var failureImage: UIKit.UIImage?
+ public var warningImage: UIKit.UIImage?
+ }
+ public struct Text {
+ public var textColor: UIKit.UIColor?
+ public var font: UIKit.UIFont
+ public var offset: (CoreGraphics.CGFloat)
+ }
+ public struct MainAreaSpacing {
+ public var margin: CoreGraphics.CGFloat
+ public var padding: CoreGraphics.CGFloat
+ }
+}
+extension UIKit.UIResponder {
+ @_Concurrency.MainActor(unsafe) public func mc_loading(text: Swift.String = "正在加载中", duration: CoreGraphics.CGFloat = 0, respond: DCUniToast.MCToast.MCToastRespond = MCToastConfig.shared.respond, callback: DCUniToast.MCToast.MCToastCallback? = nil)
+ @_Concurrency.MainActor(unsafe) public func mc_loading(imageNames: [UIKit.UIImage?], animationSpeed: CoreGraphics.CGFloat = 0.1, duration: CoreGraphics.CGFloat = 0, respond: DCUniToast.MCToast.MCToastRespond = MCToastConfig.shared.respond, callback: DCUniToast.MCToast.MCToastCallback? = nil)
+}
+extension DCUniToast.MCToast {
+ public static func mc_loading(text: Swift.String = "正在加载中", duration: CoreGraphics.CGFloat = 0, respond: DCUniToast.MCToast.MCToastRespond = MCToastConfig.shared.respond, callback: DCUniToast.MCToast.MCToastCallback? = nil)
+ public static func mc_loading(imageNames: [UIKit.UIImage?], animationSpeed: CoreGraphics.CGFloat = 0.1, duration: CoreGraphics.CGFloat = 0, respond: DCUniToast.MCToast.MCToastRespond = MCToastConfig.shared.respond, callback: DCUniToast.MCToast.MCToastCallback? = nil)
+}
+extension DCUniToast.MCToast.MCToastRespond : Swift.Equatable {}
+extension DCUniToast.MCToast.MCToastRespond : Swift.Hashable {}
+extension DCUniToast.MCToast.MCToastType : Swift.Equatable {}
+extension DCUniToast.MCToast.MCToastType : Swift.Hashable {}
diff --git a/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCUniToast.framework/Modules/DCUniToast.swiftmodule/i386-apple-ios-simulator.swiftmodule b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCUniToast.framework/Modules/DCUniToast.swiftmodule/i386-apple-ios-simulator.swiftmodule
new file mode 100644
index 0000000000000000000000000000000000000000..e39d0c8d9971cb9a6015726337e88495fcf66f9a
Binary files /dev/null and b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCUniToast.framework/Modules/DCUniToast.swiftmodule/i386-apple-ios-simulator.swiftmodule differ
diff --git a/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCUniToast.framework/Modules/DCUniToast.swiftmodule/i386.swiftdoc b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCUniToast.framework/Modules/DCUniToast.swiftmodule/i386.swiftdoc
new file mode 100644
index 0000000000000000000000000000000000000000..e138c1b8d25f1170286446bec64b6c91614d743c
Binary files /dev/null and b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCUniToast.framework/Modules/DCUniToast.swiftmodule/i386.swiftdoc differ
diff --git a/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCUniToast.framework/Modules/DCUniToast.swiftmodule/i386.swiftinterface b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCUniToast.framework/Modules/DCUniToast.swiftmodule/i386.swiftinterface
new file mode 100644
index 0000000000000000000000000000000000000000..8d93113eec2cf9d14f361707f71a0a7e755b906b
--- /dev/null
+++ b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCUniToast.framework/Modules/DCUniToast.swiftmodule/i386.swiftinterface
@@ -0,0 +1,116 @@
+// swift-interface-format-version: 1.0
+// swift-compiler-version: Apple Swift version 5.5.2 (swiftlang-1300.0.47.5 clang-1300.0.29.30)
+// swift-module-flags: -target i386-apple-ios9.0-simulator -enable-objc-interop -enable-library-evolution -swift-version 5 -enforce-exclusivity=checked -O -module-name DCUniToast
+@_exported import DCUniToast
+import Foundation
+import Swift
+import UIKit
+import _Concurrency
+extension UIKit.UIResponder {
+ @_Concurrency.MainActor(unsafe) public func mc_text(_ text: Swift.String, offset: CoreGraphics.CGFloat? = nil, duration: CoreGraphics.CGFloat = MCToastConfig.shared.duration, respond: DCUniToast.MCToast.MCToastRespond = MCToastConfig.shared.respond, callback: DCUniToast.MCToast.MCToastCallback? = nil)
+}
+extension DCUniToast.MCToast {
+ public static func mc_text(_ text: Swift.String, offset: CoreGraphics.CGFloat? = nil, duration: CoreGraphics.CGFloat = MCToastConfig.shared.duration, respond: DCUniToast.MCToast.MCToastRespond = MCToastConfig.shared.respond, callback: DCUniToast.MCToast.MCToastCallback? = nil)
+}
+extension UIKit.UIResponder {
+ @_Concurrency.MainActor(unsafe) public func mc_remove(callback: DCUniToast.MCToast.MCToastCallback? = nil)
+}
+extension DCUniToast.MCToast {
+ public static func mc_remove(callback: DCUniToast.MCToast.MCToastCallback? = nil)
+}
+@objc @_inheritsConvenienceInitializers @_hasMissingDesignatedInitializers public class MCToast : ObjectiveC.NSObject {
+ @objc deinit
+}
+extension DCUniToast.MCToast {
+ public typealias MCToastCallback = () -> Swift.Void
+ public enum MCToastRespond {
+ case `default`
+ case noRespond
+ case respond
+ case navBarRespond
+ public static func == (a: DCUniToast.MCToast.MCToastRespond, b: DCUniToast.MCToast.MCToastRespond) -> Swift.Bool
+ public func hash(into hasher: inout Swift.Hasher)
+ public var hashValue: Swift.Int {
+ get
+ }
+ }
+}
+extension DCUniToast.MCToast {
+ public static func colorWithSystemStyle(_ darkColor: UIKit.UIColor, _ defaultColor: UIKit.UIColor) -> UIKit.UIColor
+}
+extension DCUniToast.MCToast {
+ public enum MCToastType {
+ case success
+ case failure
+ case warning
+ public static func == (a: DCUniToast.MCToast.MCToastType, b: DCUniToast.MCToast.MCToastType) -> Swift.Bool
+ public func hash(into hasher: inout Swift.Hasher)
+ public var hashValue: Swift.Int {
+ get
+ }
+ }
+}
+extension UIKit.UIResponder {
+ @_Concurrency.MainActor(unsafe) public func mc_success(_ text: Swift.String, duration: CoreGraphics.CGFloat = MCToastConfig.shared.duration, respond: DCUniToast.MCToast.MCToastRespond = MCToastConfig.shared.respond, callback: DCUniToast.MCToast.MCToastCallback? = nil)
+ @_Concurrency.MainActor(unsafe) public func mc_failure(_ text: Swift.String, duration: CoreGraphics.CGFloat = MCToastConfig.shared.duration, respond: DCUniToast.MCToast.MCToastRespond = MCToastConfig.shared.respond, callback: DCUniToast.MCToast.MCToastCallback? = nil)
+ @_Concurrency.MainActor(unsafe) public func mc_warning(_ text: Swift.String, duration: CoreGraphics.CGFloat = MCToastConfig.shared.duration, respond: DCUniToast.MCToast.MCToastRespond = MCToastConfig.shared.respond, callback: DCUniToast.MCToast.MCToastCallback? = nil)
+}
+extension DCUniToast.MCToast {
+ public static func mc_success(_ text: Swift.String, duration: CoreGraphics.CGFloat = MCToastConfig.shared.duration, respond: DCUniToast.MCToast.MCToastRespond = MCToastConfig.shared.respond, callback: DCUniToast.MCToast.MCToastCallback? = nil)
+ public static func mc_failure(_ text: Swift.String, duration: CoreGraphics.CGFloat = MCToastConfig.shared.duration, respond: DCUniToast.MCToast.MCToastRespond = MCToastConfig.shared.respond, callback: DCUniToast.MCToast.MCToastCallback? = nil)
+ public static func mc_warning(_ text: Swift.String, duration: CoreGraphics.CGFloat = MCToastConfig.shared.duration, respond: DCUniToast.MCToast.MCToastRespond = MCToastConfig.shared.respond, callback: DCUniToast.MCToast.MCToastCallback? = nil)
+}
+extension DCUniToast.MCToast {
+ @discardableResult
+ public static func showStatus(_ type: DCUniToast.MCToast.MCToastType?, text: Swift.String, iconImage: UIKit.UIImage?, duration: CoreGraphics.CGFloat, respond: DCUniToast.MCToast.MCToastRespond, callback: DCUniToast.MCToast.MCToastCallback? = nil) -> (imageView: UIKit.UIImageView, label: UIKit.UILabel)
+}
+extension UIKit.UIResponder {
+ @_Concurrency.MainActor(unsafe) public func mc_statusBar(_ text: Swift.String, duration: CoreGraphics.CGFloat = MCToastConfig.shared.duration, font: UIKit.UIFont = MCToastConfig.shared.text.font, backgroundColor: UIKit.UIColor? = nil, callback: DCUniToast.MCToast.MCToastCallback? = nil)
+}
+extension DCUniToast.MCToast {
+ public static func mc_statusBar(_ text: Swift.String, duration: CoreGraphics.CGFloat = MCToastConfig.shared.duration, font: UIKit.UIFont = MCToastConfig.shared.text.font, backgroundColor: UIKit.UIColor? = nil, callback: DCUniToast.MCToast.MCToastCallback? = nil)
+}
+@objc @_inheritsConvenienceInitializers public class MCToastConfig : ObjectiveC.NSObject {
+ public static let shared: DCUniToast.MCToastConfig
+ public var respond: DCUniToast.MCToast.MCToastRespond
+ public var background: DCUniToast.MCToastConfig.Background
+ public var icon: DCUniToast.MCToastConfig.Icon
+ public var text: DCUniToast.MCToastConfig.Text
+ public var spacing: DCUniToast.MCToastConfig.MainAreaSpacing
+ public var duration: CoreGraphics.CGFloat
+ @objc override dynamic public init()
+ @objc deinit
+}
+extension DCUniToast.MCToastConfig {
+ public struct Background {
+ public var color: UIKit.UIColor
+ public var size: CoreGraphics.CGSize
+ }
+ public struct Icon {
+ public var size: CoreGraphics.CGSize
+ public var successImage: UIKit.UIImage?
+ public var failureImage: UIKit.UIImage?
+ public var warningImage: UIKit.UIImage?
+ }
+ public struct Text {
+ public var textColor: UIKit.UIColor?
+ public var font: UIKit.UIFont
+ public var offset: (CoreGraphics.CGFloat)
+ }
+ public struct MainAreaSpacing {
+ public var margin: CoreGraphics.CGFloat
+ public var padding: CoreGraphics.CGFloat
+ }
+}
+extension UIKit.UIResponder {
+ @_Concurrency.MainActor(unsafe) public func mc_loading(text: Swift.String = "正在加载中", duration: CoreGraphics.CGFloat = 0, respond: DCUniToast.MCToast.MCToastRespond = MCToastConfig.shared.respond, callback: DCUniToast.MCToast.MCToastCallback? = nil)
+ @_Concurrency.MainActor(unsafe) public func mc_loading(imageNames: [UIKit.UIImage?], animationSpeed: CoreGraphics.CGFloat = 0.1, duration: CoreGraphics.CGFloat = 0, respond: DCUniToast.MCToast.MCToastRespond = MCToastConfig.shared.respond, callback: DCUniToast.MCToast.MCToastCallback? = nil)
+}
+extension DCUniToast.MCToast {
+ public static func mc_loading(text: Swift.String = "正在加载中", duration: CoreGraphics.CGFloat = 0, respond: DCUniToast.MCToast.MCToastRespond = MCToastConfig.shared.respond, callback: DCUniToast.MCToast.MCToastCallback? = nil)
+ public static func mc_loading(imageNames: [UIKit.UIImage?], animationSpeed: CoreGraphics.CGFloat = 0.1, duration: CoreGraphics.CGFloat = 0, respond: DCUniToast.MCToast.MCToastRespond = MCToastConfig.shared.respond, callback: DCUniToast.MCToast.MCToastCallback? = nil)
+}
+extension DCUniToast.MCToast.MCToastRespond : Swift.Equatable {}
+extension DCUniToast.MCToast.MCToastRespond : Swift.Hashable {}
+extension DCUniToast.MCToast.MCToastType : Swift.Equatable {}
+extension DCUniToast.MCToast.MCToastType : Swift.Hashable {}
diff --git a/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCUniToast.framework/Modules/DCUniToast.swiftmodule/i386.swiftmodule b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCUniToast.framework/Modules/DCUniToast.swiftmodule/i386.swiftmodule
new file mode 100644
index 0000000000000000000000000000000000000000..e39d0c8d9971cb9a6015726337e88495fcf66f9a
Binary files /dev/null and b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCUniToast.framework/Modules/DCUniToast.swiftmodule/i386.swiftmodule differ
diff --git a/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCUniToast.framework/Modules/DCUniToast.swiftmodule/x86_64-apple-ios-simulator.swiftdoc b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCUniToast.framework/Modules/DCUniToast.swiftmodule/x86_64-apple-ios-simulator.swiftdoc
new file mode 100644
index 0000000000000000000000000000000000000000..61cbae316f698adc3b70da072d26a8fe68edf2e7
Binary files /dev/null and b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCUniToast.framework/Modules/DCUniToast.swiftmodule/x86_64-apple-ios-simulator.swiftdoc differ
diff --git a/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCUniToast.framework/Modules/DCUniToast.swiftmodule/x86_64-apple-ios-simulator.swiftinterface b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCUniToast.framework/Modules/DCUniToast.swiftmodule/x86_64-apple-ios-simulator.swiftinterface
new file mode 100644
index 0000000000000000000000000000000000000000..536fd1dcf533bc7ca95ed70f859a6f1b0b6bf778
--- /dev/null
+++ b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCUniToast.framework/Modules/DCUniToast.swiftmodule/x86_64-apple-ios-simulator.swiftinterface
@@ -0,0 +1,116 @@
+// swift-interface-format-version: 1.0
+// swift-compiler-version: Apple Swift version 5.5.2 (swiftlang-1300.0.47.5 clang-1300.0.29.30)
+// swift-module-flags: -target x86_64-apple-ios9.0-simulator -enable-objc-interop -enable-library-evolution -swift-version 5 -enforce-exclusivity=checked -O -module-name DCUniToast
+@_exported import DCUniToast
+import Foundation
+import Swift
+import UIKit
+import _Concurrency
+extension UIKit.UIResponder {
+ @_Concurrency.MainActor(unsafe) public func mc_text(_ text: Swift.String, offset: CoreGraphics.CGFloat? = nil, duration: CoreGraphics.CGFloat = MCToastConfig.shared.duration, respond: DCUniToast.MCToast.MCToastRespond = MCToastConfig.shared.respond, callback: DCUniToast.MCToast.MCToastCallback? = nil)
+}
+extension DCUniToast.MCToast {
+ public static func mc_text(_ text: Swift.String, offset: CoreGraphics.CGFloat? = nil, duration: CoreGraphics.CGFloat = MCToastConfig.shared.duration, respond: DCUniToast.MCToast.MCToastRespond = MCToastConfig.shared.respond, callback: DCUniToast.MCToast.MCToastCallback? = nil)
+}
+extension UIKit.UIResponder {
+ @_Concurrency.MainActor(unsafe) public func mc_remove(callback: DCUniToast.MCToast.MCToastCallback? = nil)
+}
+extension DCUniToast.MCToast {
+ public static func mc_remove(callback: DCUniToast.MCToast.MCToastCallback? = nil)
+}
+@objc @_inheritsConvenienceInitializers @_hasMissingDesignatedInitializers public class MCToast : ObjectiveC.NSObject {
+ @objc deinit
+}
+extension DCUniToast.MCToast {
+ public typealias MCToastCallback = () -> Swift.Void
+ public enum MCToastRespond {
+ case `default`
+ case noRespond
+ case respond
+ case navBarRespond
+ public static func == (a: DCUniToast.MCToast.MCToastRespond, b: DCUniToast.MCToast.MCToastRespond) -> Swift.Bool
+ public func hash(into hasher: inout Swift.Hasher)
+ public var hashValue: Swift.Int {
+ get
+ }
+ }
+}
+extension DCUniToast.MCToast {
+ public static func colorWithSystemStyle(_ darkColor: UIKit.UIColor, _ defaultColor: UIKit.UIColor) -> UIKit.UIColor
+}
+extension DCUniToast.MCToast {
+ public enum MCToastType {
+ case success
+ case failure
+ case warning
+ public static func == (a: DCUniToast.MCToast.MCToastType, b: DCUniToast.MCToast.MCToastType) -> Swift.Bool
+ public func hash(into hasher: inout Swift.Hasher)
+ public var hashValue: Swift.Int {
+ get
+ }
+ }
+}
+extension UIKit.UIResponder {
+ @_Concurrency.MainActor(unsafe) public func mc_success(_ text: Swift.String, duration: CoreGraphics.CGFloat = MCToastConfig.shared.duration, respond: DCUniToast.MCToast.MCToastRespond = MCToastConfig.shared.respond, callback: DCUniToast.MCToast.MCToastCallback? = nil)
+ @_Concurrency.MainActor(unsafe) public func mc_failure(_ text: Swift.String, duration: CoreGraphics.CGFloat = MCToastConfig.shared.duration, respond: DCUniToast.MCToast.MCToastRespond = MCToastConfig.shared.respond, callback: DCUniToast.MCToast.MCToastCallback? = nil)
+ @_Concurrency.MainActor(unsafe) public func mc_warning(_ text: Swift.String, duration: CoreGraphics.CGFloat = MCToastConfig.shared.duration, respond: DCUniToast.MCToast.MCToastRespond = MCToastConfig.shared.respond, callback: DCUniToast.MCToast.MCToastCallback? = nil)
+}
+extension DCUniToast.MCToast {
+ public static func mc_success(_ text: Swift.String, duration: CoreGraphics.CGFloat = MCToastConfig.shared.duration, respond: DCUniToast.MCToast.MCToastRespond = MCToastConfig.shared.respond, callback: DCUniToast.MCToast.MCToastCallback? = nil)
+ public static func mc_failure(_ text: Swift.String, duration: CoreGraphics.CGFloat = MCToastConfig.shared.duration, respond: DCUniToast.MCToast.MCToastRespond = MCToastConfig.shared.respond, callback: DCUniToast.MCToast.MCToastCallback? = nil)
+ public static func mc_warning(_ text: Swift.String, duration: CoreGraphics.CGFloat = MCToastConfig.shared.duration, respond: DCUniToast.MCToast.MCToastRespond = MCToastConfig.shared.respond, callback: DCUniToast.MCToast.MCToastCallback? = nil)
+}
+extension DCUniToast.MCToast {
+ @discardableResult
+ public static func showStatus(_ type: DCUniToast.MCToast.MCToastType?, text: Swift.String, iconImage: UIKit.UIImage?, duration: CoreGraphics.CGFloat, respond: DCUniToast.MCToast.MCToastRespond, callback: DCUniToast.MCToast.MCToastCallback? = nil) -> (imageView: UIKit.UIImageView, label: UIKit.UILabel)
+}
+extension UIKit.UIResponder {
+ @_Concurrency.MainActor(unsafe) public func mc_statusBar(_ text: Swift.String, duration: CoreGraphics.CGFloat = MCToastConfig.shared.duration, font: UIKit.UIFont = MCToastConfig.shared.text.font, backgroundColor: UIKit.UIColor? = nil, callback: DCUniToast.MCToast.MCToastCallback? = nil)
+}
+extension DCUniToast.MCToast {
+ public static func mc_statusBar(_ text: Swift.String, duration: CoreGraphics.CGFloat = MCToastConfig.shared.duration, font: UIKit.UIFont = MCToastConfig.shared.text.font, backgroundColor: UIKit.UIColor? = nil, callback: DCUniToast.MCToast.MCToastCallback? = nil)
+}
+@objc @_inheritsConvenienceInitializers public class MCToastConfig : ObjectiveC.NSObject {
+ public static let shared: DCUniToast.MCToastConfig
+ public var respond: DCUniToast.MCToast.MCToastRespond
+ public var background: DCUniToast.MCToastConfig.Background
+ public var icon: DCUniToast.MCToastConfig.Icon
+ public var text: DCUniToast.MCToastConfig.Text
+ public var spacing: DCUniToast.MCToastConfig.MainAreaSpacing
+ public var duration: CoreGraphics.CGFloat
+ @objc override dynamic public init()
+ @objc deinit
+}
+extension DCUniToast.MCToastConfig {
+ public struct Background {
+ public var color: UIKit.UIColor
+ public var size: CoreGraphics.CGSize
+ }
+ public struct Icon {
+ public var size: CoreGraphics.CGSize
+ public var successImage: UIKit.UIImage?
+ public var failureImage: UIKit.UIImage?
+ public var warningImage: UIKit.UIImage?
+ }
+ public struct Text {
+ public var textColor: UIKit.UIColor?
+ public var font: UIKit.UIFont
+ public var offset: (CoreGraphics.CGFloat)
+ }
+ public struct MainAreaSpacing {
+ public var margin: CoreGraphics.CGFloat
+ public var padding: CoreGraphics.CGFloat
+ }
+}
+extension UIKit.UIResponder {
+ @_Concurrency.MainActor(unsafe) public func mc_loading(text: Swift.String = "正在加载中", duration: CoreGraphics.CGFloat = 0, respond: DCUniToast.MCToast.MCToastRespond = MCToastConfig.shared.respond, callback: DCUniToast.MCToast.MCToastCallback? = nil)
+ @_Concurrency.MainActor(unsafe) public func mc_loading(imageNames: [UIKit.UIImage?], animationSpeed: CoreGraphics.CGFloat = 0.1, duration: CoreGraphics.CGFloat = 0, respond: DCUniToast.MCToast.MCToastRespond = MCToastConfig.shared.respond, callback: DCUniToast.MCToast.MCToastCallback? = nil)
+}
+extension DCUniToast.MCToast {
+ public static func mc_loading(text: Swift.String = "正在加载中", duration: CoreGraphics.CGFloat = 0, respond: DCUniToast.MCToast.MCToastRespond = MCToastConfig.shared.respond, callback: DCUniToast.MCToast.MCToastCallback? = nil)
+ public static func mc_loading(imageNames: [UIKit.UIImage?], animationSpeed: CoreGraphics.CGFloat = 0.1, duration: CoreGraphics.CGFloat = 0, respond: DCUniToast.MCToast.MCToastRespond = MCToastConfig.shared.respond, callback: DCUniToast.MCToast.MCToastCallback? = nil)
+}
+extension DCUniToast.MCToast.MCToastRespond : Swift.Equatable {}
+extension DCUniToast.MCToast.MCToastRespond : Swift.Hashable {}
+extension DCUniToast.MCToast.MCToastType : Swift.Equatable {}
+extension DCUniToast.MCToast.MCToastType : Swift.Hashable {}
diff --git a/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCUniToast.framework/Modules/DCUniToast.swiftmodule/x86_64-apple-ios-simulator.swiftmodule b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCUniToast.framework/Modules/DCUniToast.swiftmodule/x86_64-apple-ios-simulator.swiftmodule
new file mode 100644
index 0000000000000000000000000000000000000000..fe0f33e19c5982b292e2ceb04595b47adb0f0787
Binary files /dev/null and b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCUniToast.framework/Modules/DCUniToast.swiftmodule/x86_64-apple-ios-simulator.swiftmodule differ
diff --git a/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCUniToast.framework/Modules/DCUniToast.swiftmodule/x86_64.swiftdoc b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCUniToast.framework/Modules/DCUniToast.swiftmodule/x86_64.swiftdoc
new file mode 100644
index 0000000000000000000000000000000000000000..61cbae316f698adc3b70da072d26a8fe68edf2e7
Binary files /dev/null and b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCUniToast.framework/Modules/DCUniToast.swiftmodule/x86_64.swiftdoc differ
diff --git a/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCUniToast.framework/Modules/DCUniToast.swiftmodule/x86_64.swiftinterface b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCUniToast.framework/Modules/DCUniToast.swiftmodule/x86_64.swiftinterface
new file mode 100644
index 0000000000000000000000000000000000000000..536fd1dcf533bc7ca95ed70f859a6f1b0b6bf778
--- /dev/null
+++ b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCUniToast.framework/Modules/DCUniToast.swiftmodule/x86_64.swiftinterface
@@ -0,0 +1,116 @@
+// swift-interface-format-version: 1.0
+// swift-compiler-version: Apple Swift version 5.5.2 (swiftlang-1300.0.47.5 clang-1300.0.29.30)
+// swift-module-flags: -target x86_64-apple-ios9.0-simulator -enable-objc-interop -enable-library-evolution -swift-version 5 -enforce-exclusivity=checked -O -module-name DCUniToast
+@_exported import DCUniToast
+import Foundation
+import Swift
+import UIKit
+import _Concurrency
+extension UIKit.UIResponder {
+ @_Concurrency.MainActor(unsafe) public func mc_text(_ text: Swift.String, offset: CoreGraphics.CGFloat? = nil, duration: CoreGraphics.CGFloat = MCToastConfig.shared.duration, respond: DCUniToast.MCToast.MCToastRespond = MCToastConfig.shared.respond, callback: DCUniToast.MCToast.MCToastCallback? = nil)
+}
+extension DCUniToast.MCToast {
+ public static func mc_text(_ text: Swift.String, offset: CoreGraphics.CGFloat? = nil, duration: CoreGraphics.CGFloat = MCToastConfig.shared.duration, respond: DCUniToast.MCToast.MCToastRespond = MCToastConfig.shared.respond, callback: DCUniToast.MCToast.MCToastCallback? = nil)
+}
+extension UIKit.UIResponder {
+ @_Concurrency.MainActor(unsafe) public func mc_remove(callback: DCUniToast.MCToast.MCToastCallback? = nil)
+}
+extension DCUniToast.MCToast {
+ public static func mc_remove(callback: DCUniToast.MCToast.MCToastCallback? = nil)
+}
+@objc @_inheritsConvenienceInitializers @_hasMissingDesignatedInitializers public class MCToast : ObjectiveC.NSObject {
+ @objc deinit
+}
+extension DCUniToast.MCToast {
+ public typealias MCToastCallback = () -> Swift.Void
+ public enum MCToastRespond {
+ case `default`
+ case noRespond
+ case respond
+ case navBarRespond
+ public static func == (a: DCUniToast.MCToast.MCToastRespond, b: DCUniToast.MCToast.MCToastRespond) -> Swift.Bool
+ public func hash(into hasher: inout Swift.Hasher)
+ public var hashValue: Swift.Int {
+ get
+ }
+ }
+}
+extension DCUniToast.MCToast {
+ public static func colorWithSystemStyle(_ darkColor: UIKit.UIColor, _ defaultColor: UIKit.UIColor) -> UIKit.UIColor
+}
+extension DCUniToast.MCToast {
+ public enum MCToastType {
+ case success
+ case failure
+ case warning
+ public static func == (a: DCUniToast.MCToast.MCToastType, b: DCUniToast.MCToast.MCToastType) -> Swift.Bool
+ public func hash(into hasher: inout Swift.Hasher)
+ public var hashValue: Swift.Int {
+ get
+ }
+ }
+}
+extension UIKit.UIResponder {
+ @_Concurrency.MainActor(unsafe) public func mc_success(_ text: Swift.String, duration: CoreGraphics.CGFloat = MCToastConfig.shared.duration, respond: DCUniToast.MCToast.MCToastRespond = MCToastConfig.shared.respond, callback: DCUniToast.MCToast.MCToastCallback? = nil)
+ @_Concurrency.MainActor(unsafe) public func mc_failure(_ text: Swift.String, duration: CoreGraphics.CGFloat = MCToastConfig.shared.duration, respond: DCUniToast.MCToast.MCToastRespond = MCToastConfig.shared.respond, callback: DCUniToast.MCToast.MCToastCallback? = nil)
+ @_Concurrency.MainActor(unsafe) public func mc_warning(_ text: Swift.String, duration: CoreGraphics.CGFloat = MCToastConfig.shared.duration, respond: DCUniToast.MCToast.MCToastRespond = MCToastConfig.shared.respond, callback: DCUniToast.MCToast.MCToastCallback? = nil)
+}
+extension DCUniToast.MCToast {
+ public static func mc_success(_ text: Swift.String, duration: CoreGraphics.CGFloat = MCToastConfig.shared.duration, respond: DCUniToast.MCToast.MCToastRespond = MCToastConfig.shared.respond, callback: DCUniToast.MCToast.MCToastCallback? = nil)
+ public static func mc_failure(_ text: Swift.String, duration: CoreGraphics.CGFloat = MCToastConfig.shared.duration, respond: DCUniToast.MCToast.MCToastRespond = MCToastConfig.shared.respond, callback: DCUniToast.MCToast.MCToastCallback? = nil)
+ public static func mc_warning(_ text: Swift.String, duration: CoreGraphics.CGFloat = MCToastConfig.shared.duration, respond: DCUniToast.MCToast.MCToastRespond = MCToastConfig.shared.respond, callback: DCUniToast.MCToast.MCToastCallback? = nil)
+}
+extension DCUniToast.MCToast {
+ @discardableResult
+ public static func showStatus(_ type: DCUniToast.MCToast.MCToastType?, text: Swift.String, iconImage: UIKit.UIImage?, duration: CoreGraphics.CGFloat, respond: DCUniToast.MCToast.MCToastRespond, callback: DCUniToast.MCToast.MCToastCallback? = nil) -> (imageView: UIKit.UIImageView, label: UIKit.UILabel)
+}
+extension UIKit.UIResponder {
+ @_Concurrency.MainActor(unsafe) public func mc_statusBar(_ text: Swift.String, duration: CoreGraphics.CGFloat = MCToastConfig.shared.duration, font: UIKit.UIFont = MCToastConfig.shared.text.font, backgroundColor: UIKit.UIColor? = nil, callback: DCUniToast.MCToast.MCToastCallback? = nil)
+}
+extension DCUniToast.MCToast {
+ public static func mc_statusBar(_ text: Swift.String, duration: CoreGraphics.CGFloat = MCToastConfig.shared.duration, font: UIKit.UIFont = MCToastConfig.shared.text.font, backgroundColor: UIKit.UIColor? = nil, callback: DCUniToast.MCToast.MCToastCallback? = nil)
+}
+@objc @_inheritsConvenienceInitializers public class MCToastConfig : ObjectiveC.NSObject {
+ public static let shared: DCUniToast.MCToastConfig
+ public var respond: DCUniToast.MCToast.MCToastRespond
+ public var background: DCUniToast.MCToastConfig.Background
+ public var icon: DCUniToast.MCToastConfig.Icon
+ public var text: DCUniToast.MCToastConfig.Text
+ public var spacing: DCUniToast.MCToastConfig.MainAreaSpacing
+ public var duration: CoreGraphics.CGFloat
+ @objc override dynamic public init()
+ @objc deinit
+}
+extension DCUniToast.MCToastConfig {
+ public struct Background {
+ public var color: UIKit.UIColor
+ public var size: CoreGraphics.CGSize
+ }
+ public struct Icon {
+ public var size: CoreGraphics.CGSize
+ public var successImage: UIKit.UIImage?
+ public var failureImage: UIKit.UIImage?
+ public var warningImage: UIKit.UIImage?
+ }
+ public struct Text {
+ public var textColor: UIKit.UIColor?
+ public var font: UIKit.UIFont
+ public var offset: (CoreGraphics.CGFloat)
+ }
+ public struct MainAreaSpacing {
+ public var margin: CoreGraphics.CGFloat
+ public var padding: CoreGraphics.CGFloat
+ }
+}
+extension UIKit.UIResponder {
+ @_Concurrency.MainActor(unsafe) public func mc_loading(text: Swift.String = "正在加载中", duration: CoreGraphics.CGFloat = 0, respond: DCUniToast.MCToast.MCToastRespond = MCToastConfig.shared.respond, callback: DCUniToast.MCToast.MCToastCallback? = nil)
+ @_Concurrency.MainActor(unsafe) public func mc_loading(imageNames: [UIKit.UIImage?], animationSpeed: CoreGraphics.CGFloat = 0.1, duration: CoreGraphics.CGFloat = 0, respond: DCUniToast.MCToast.MCToastRespond = MCToastConfig.shared.respond, callback: DCUniToast.MCToast.MCToastCallback? = nil)
+}
+extension DCUniToast.MCToast {
+ public static func mc_loading(text: Swift.String = "正在加载中", duration: CoreGraphics.CGFloat = 0, respond: DCUniToast.MCToast.MCToastRespond = MCToastConfig.shared.respond, callback: DCUniToast.MCToast.MCToastCallback? = nil)
+ public static func mc_loading(imageNames: [UIKit.UIImage?], animationSpeed: CoreGraphics.CGFloat = 0.1, duration: CoreGraphics.CGFloat = 0, respond: DCUniToast.MCToast.MCToastRespond = MCToastConfig.shared.respond, callback: DCUniToast.MCToast.MCToastCallback? = nil)
+}
+extension DCUniToast.MCToast.MCToastRespond : Swift.Equatable {}
+extension DCUniToast.MCToast.MCToastRespond : Swift.Hashable {}
+extension DCUniToast.MCToast.MCToastType : Swift.Equatable {}
+extension DCUniToast.MCToast.MCToastType : Swift.Hashable {}
diff --git a/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCUniToast.framework/Modules/DCUniToast.swiftmodule/x86_64.swiftmodule b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCUniToast.framework/Modules/DCUniToast.swiftmodule/x86_64.swiftmodule
new file mode 100644
index 0000000000000000000000000000000000000000..fe0f33e19c5982b292e2ceb04595b47adb0f0787
Binary files /dev/null and b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCUniToast.framework/Modules/DCUniToast.swiftmodule/x86_64.swiftmodule differ
diff --git a/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCUniToast.framework/Modules/module.modulemap b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCUniToast.framework/Modules/module.modulemap
new file mode 100644
index 0000000000000000000000000000000000000000..bd4b59cc0a58aee5e467f614383fe5af12291634
--- /dev/null
+++ b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCUniToast.framework/Modules/module.modulemap
@@ -0,0 +1,11 @@
+framework module DCUniToast {
+ umbrella header "DCUniToast.h"
+
+ export *
+ module * { export * }
+}
+
+module DCUniToast.Swift {
+ header "DCUniToast-Swift.h"
+ requires objc
+}
diff --git a/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCloudAlertController.framework/DCloudAlertController b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCloudAlertController.framework/DCloudAlertController
new file mode 100644
index 0000000000000000000000000000000000000000..f13219f1ff833a71ff7fd80d5d1bdb83b3ad9e50
Binary files /dev/null and b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCloudAlertController.framework/DCloudAlertController differ
diff --git a/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCloudAlertController.framework/Headers/DCloudAlertController-Swift.h b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCloudAlertController.framework/Headers/DCloudAlertController-Swift.h
new file mode 100644
index 0000000000000000000000000000000000000000..d687cd54bdc01a58e1adc6cc4ae1ec74c8c5bd14
--- /dev/null
+++ b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCloudAlertController.framework/Headers/DCloudAlertController-Swift.h
@@ -0,0 +1,580 @@
+#if 0
+#elif defined(__arm64__) && __arm64__
+// Generated by Apple Swift version 5.5.2 (swiftlang-1300.0.47.5 clang-1300.0.29.30)
+#ifndef DCLOUDALERTCONTROLLER_SWIFT_H
+#define DCLOUDALERTCONTROLLER_SWIFT_H
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wgcc-compat"
+
+#if !defined(__has_include)
+# define __has_include(x) 0
+#endif
+#if !defined(__has_attribute)
+# define __has_attribute(x) 0
+#endif
+#if !defined(__has_feature)
+# define __has_feature(x) 0
+#endif
+#if !defined(__has_warning)
+# define __has_warning(x) 0
+#endif
+
+#if __has_include()
+# include
+#endif
+
+#pragma clang diagnostic ignored "-Wauto-import"
+#include
+#include
+#include
+#include
+
+#if !defined(SWIFT_TYPEDEFS)
+# define SWIFT_TYPEDEFS 1
+# if __has_include()
+# include
+# elif !defined(__cplusplus)
+typedef uint_least16_t char16_t;
+typedef uint_least32_t char32_t;
+# endif
+typedef float swift_float2 __attribute__((__ext_vector_type__(2)));
+typedef float swift_float3 __attribute__((__ext_vector_type__(3)));
+typedef float swift_float4 __attribute__((__ext_vector_type__(4)));
+typedef double swift_double2 __attribute__((__ext_vector_type__(2)));
+typedef double swift_double3 __attribute__((__ext_vector_type__(3)));
+typedef double swift_double4 __attribute__((__ext_vector_type__(4)));
+typedef int swift_int2 __attribute__((__ext_vector_type__(2)));
+typedef int swift_int3 __attribute__((__ext_vector_type__(3)));
+typedef int swift_int4 __attribute__((__ext_vector_type__(4)));
+typedef unsigned int swift_uint2 __attribute__((__ext_vector_type__(2)));
+typedef unsigned int swift_uint3 __attribute__((__ext_vector_type__(3)));
+typedef unsigned int swift_uint4 __attribute__((__ext_vector_type__(4)));
+#endif
+
+#if !defined(SWIFT_PASTE)
+# define SWIFT_PASTE_HELPER(x, y) x##y
+# define SWIFT_PASTE(x, y) SWIFT_PASTE_HELPER(x, y)
+#endif
+#if !defined(SWIFT_METATYPE)
+# define SWIFT_METATYPE(X) Class
+#endif
+#if !defined(SWIFT_CLASS_PROPERTY)
+# if __has_feature(objc_class_property)
+# define SWIFT_CLASS_PROPERTY(...) __VA_ARGS__
+# else
+# define SWIFT_CLASS_PROPERTY(...)
+# endif
+#endif
+
+#if __has_attribute(objc_runtime_name)
+# define SWIFT_RUNTIME_NAME(X) __attribute__((objc_runtime_name(X)))
+#else
+# define SWIFT_RUNTIME_NAME(X)
+#endif
+#if __has_attribute(swift_name)
+# define SWIFT_COMPILE_NAME(X) __attribute__((swift_name(X)))
+#else
+# define SWIFT_COMPILE_NAME(X)
+#endif
+#if __has_attribute(objc_method_family)
+# define SWIFT_METHOD_FAMILY(X) __attribute__((objc_method_family(X)))
+#else
+# define SWIFT_METHOD_FAMILY(X)
+#endif
+#if __has_attribute(noescape)
+# define SWIFT_NOESCAPE __attribute__((noescape))
+#else
+# define SWIFT_NOESCAPE
+#endif
+#if __has_attribute(ns_consumed)
+# define SWIFT_RELEASES_ARGUMENT __attribute__((ns_consumed))
+#else
+# define SWIFT_RELEASES_ARGUMENT
+#endif
+#if __has_attribute(warn_unused_result)
+# define SWIFT_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
+#else
+# define SWIFT_WARN_UNUSED_RESULT
+#endif
+#if __has_attribute(noreturn)
+# define SWIFT_NORETURN __attribute__((noreturn))
+#else
+# define SWIFT_NORETURN
+#endif
+#if !defined(SWIFT_CLASS_EXTRA)
+# define SWIFT_CLASS_EXTRA
+#endif
+#if !defined(SWIFT_PROTOCOL_EXTRA)
+# define SWIFT_PROTOCOL_EXTRA
+#endif
+#if !defined(SWIFT_ENUM_EXTRA)
+# define SWIFT_ENUM_EXTRA
+#endif
+#if !defined(SWIFT_CLASS)
+# if __has_attribute(objc_subclassing_restricted)
+# define SWIFT_CLASS(SWIFT_NAME) SWIFT_RUNTIME_NAME(SWIFT_NAME) __attribute__((objc_subclassing_restricted)) SWIFT_CLASS_EXTRA
+# define SWIFT_CLASS_NAMED(SWIFT_NAME) __attribute__((objc_subclassing_restricted)) SWIFT_COMPILE_NAME(SWIFT_NAME) SWIFT_CLASS_EXTRA
+# else
+# define SWIFT_CLASS(SWIFT_NAME) SWIFT_RUNTIME_NAME(SWIFT_NAME) SWIFT_CLASS_EXTRA
+# define SWIFT_CLASS_NAMED(SWIFT_NAME) SWIFT_COMPILE_NAME(SWIFT_NAME) SWIFT_CLASS_EXTRA
+# endif
+#endif
+#if !defined(SWIFT_RESILIENT_CLASS)
+# if __has_attribute(objc_class_stub)
+# define SWIFT_RESILIENT_CLASS(SWIFT_NAME) SWIFT_CLASS(SWIFT_NAME) __attribute__((objc_class_stub))
+# define SWIFT_RESILIENT_CLASS_NAMED(SWIFT_NAME) __attribute__((objc_class_stub)) SWIFT_CLASS_NAMED(SWIFT_NAME)
+# else
+# define SWIFT_RESILIENT_CLASS(SWIFT_NAME) SWIFT_CLASS(SWIFT_NAME)
+# define SWIFT_RESILIENT_CLASS_NAMED(SWIFT_NAME) SWIFT_CLASS_NAMED(SWIFT_NAME)
+# endif
+#endif
+
+#if !defined(SWIFT_PROTOCOL)
+# define SWIFT_PROTOCOL(SWIFT_NAME) SWIFT_RUNTIME_NAME(SWIFT_NAME) SWIFT_PROTOCOL_EXTRA
+# define SWIFT_PROTOCOL_NAMED(SWIFT_NAME) SWIFT_COMPILE_NAME(SWIFT_NAME) SWIFT_PROTOCOL_EXTRA
+#endif
+
+#if !defined(SWIFT_EXTENSION)
+# define SWIFT_EXTENSION(M) SWIFT_PASTE(M##_Swift_, __LINE__)
+#endif
+
+#if !defined(OBJC_DESIGNATED_INITIALIZER)
+# if __has_attribute(objc_designated_initializer)
+# define OBJC_DESIGNATED_INITIALIZER __attribute__((objc_designated_initializer))
+# else
+# define OBJC_DESIGNATED_INITIALIZER
+# endif
+#endif
+#if !defined(SWIFT_ENUM_ATTR)
+# if defined(__has_attribute) && __has_attribute(enum_extensibility)
+# define SWIFT_ENUM_ATTR(_extensibility) __attribute__((enum_extensibility(_extensibility)))
+# else
+# define SWIFT_ENUM_ATTR(_extensibility)
+# endif
+#endif
+#if !defined(SWIFT_ENUM)
+# define SWIFT_ENUM(_type, _name, _extensibility) enum _name : _type _name; enum SWIFT_ENUM_ATTR(_extensibility) SWIFT_ENUM_EXTRA _name : _type
+# if __has_feature(generalized_swift_name)
+# define SWIFT_ENUM_NAMED(_type, _name, SWIFT_NAME, _extensibility) enum _name : _type _name SWIFT_COMPILE_NAME(SWIFT_NAME); enum SWIFT_COMPILE_NAME(SWIFT_NAME) SWIFT_ENUM_ATTR(_extensibility) SWIFT_ENUM_EXTRA _name : _type
+# else
+# define SWIFT_ENUM_NAMED(_type, _name, SWIFT_NAME, _extensibility) SWIFT_ENUM(_type, _name, _extensibility)
+# endif
+#endif
+#if !defined(SWIFT_UNAVAILABLE)
+# define SWIFT_UNAVAILABLE __attribute__((unavailable))
+#endif
+#if !defined(SWIFT_UNAVAILABLE_MSG)
+# define SWIFT_UNAVAILABLE_MSG(msg) __attribute__((unavailable(msg)))
+#endif
+#if !defined(SWIFT_AVAILABILITY)
+# define SWIFT_AVAILABILITY(plat, ...) __attribute__((availability(plat, __VA_ARGS__)))
+#endif
+#if !defined(SWIFT_WEAK_IMPORT)
+# define SWIFT_WEAK_IMPORT __attribute__((weak_import))
+#endif
+#if !defined(SWIFT_DEPRECATED)
+# define SWIFT_DEPRECATED __attribute__((deprecated))
+#endif
+#if !defined(SWIFT_DEPRECATED_MSG)
+# define SWIFT_DEPRECATED_MSG(...) __attribute__((deprecated(__VA_ARGS__)))
+#endif
+#if __has_feature(attribute_diagnose_if_objc)
+# define SWIFT_DEPRECATED_OBJC(Msg) __attribute__((diagnose_if(1, Msg, "warning")))
+#else
+# define SWIFT_DEPRECATED_OBJC(Msg) SWIFT_DEPRECATED_MSG(Msg)
+#endif
+#if !defined(IBSegueAction)
+# define IBSegueAction
+#endif
+#if __has_feature(modules)
+#if __has_warning("-Watimport-in-framework-header")
+#pragma clang diagnostic ignored "-Watimport-in-framework-header"
+#endif
+@import CoreGraphics;
+@import ObjectiveC;
+@import UIKit;
+#endif
+
+#pragma clang diagnostic ignored "-Wproperty-attribute-mismatch"
+#pragma clang diagnostic ignored "-Wduplicate-method-arg"
+#if __has_warning("-Wpragma-clang-attribute")
+# pragma clang diagnostic ignored "-Wpragma-clang-attribute"
+#endif
+#pragma clang diagnostic ignored "-Wunknown-pragmas"
+#pragma clang diagnostic ignored "-Wnullability"
+
+#if __has_attribute(external_source_symbol)
+# pragma push_macro("any")
+# undef any
+# pragma clang attribute push(__attribute__((external_source_symbol(language="Swift", defined_in="DCloudAlertController",generated_declaration))), apply_to=any(function,enum,objc_interface,objc_category,objc_protocol))
+# pragma pop_macro("any")
+#endif
+
+@class NSCoder;
+@class NSString;
+@class NSBundle;
+
+SWIFT_CLASS("_TtC21DCloudAlertController23DCActionSheetController")
+@interface DCActionSheetController : UIViewController
+- (nullable instancetype)initWithCoder:(NSCoder * _Nonnull)coder SWIFT_UNAVAILABLE;
+- (void)loadView;
+- (void)viewDidLoad;
+- (void)viewDidLayoutSubviews;
+- (nonnull instancetype)initWithNibName:(NSString * _Nullable)nibNameOrNil bundle:(NSBundle * _Nullable)nibBundleOrNil SWIFT_UNAVAILABLE;
+@end
+
+
+@class UITableView;
+@class NSNumber;
+@class NSIndexPath;
+@class UITableViewCell;
+@class UIView;
+
+@interface DCActionSheetController (SWIFT_EXTENSION(DCloudAlertController))
+- (NSInteger)numberOfSectionsInTableView:(UITableView * _Nonnull)tableView SWIFT_WARN_UNUSED_RESULT;
+- (NSInteger)tableView:(UITableView * _Nonnull)tableView numberOfRowsInSection:(NSInteger)section SWIFT_WARN_UNUSED_RESULT;
+- (UITableViewCell * _Nonnull)tableView:(UITableView * _Nonnull)tableView cellForRowAtIndexPath:(NSIndexPath * _Nonnull)indexPath SWIFT_WARN_UNUSED_RESULT;
+- (void)tableView:(UITableView * _Nonnull)tableView didSelectRowAtIndexPath:(NSIndexPath * _Nonnull)indexPath;
+- (CGFloat)tableView:(UITableView * _Nonnull)tableView heightForRowAtIndexPath:(NSIndexPath * _Nonnull)indexPath SWIFT_WARN_UNUSED_RESULT;
+- (CGFloat)tableView:(UITableView * _Nonnull)tableView heightForFooterInSection:(NSInteger)section SWIFT_WARN_UNUSED_RESULT;
+- (UIView * _Nullable)tableView:(UITableView * _Nonnull)tableView viewForFooterInSection:(NSInteger)section SWIFT_WARN_UNUSED_RESULT;
+@end
+
+
+SWIFT_CLASS("_TtC21DCloudAlertController13DCAlertAction")
+@interface DCAlertAction : NSObject
+- (nonnull instancetype)init SWIFT_UNAVAILABLE;
++ (nonnull instancetype)new SWIFT_UNAVAILABLE_MSG("-init is unavailable");
+@end
+
+
+SWIFT_CLASS("_TtC21DCloudAlertController19DCAlertActionButton")
+@interface DCAlertActionButton : UIButton
+- (nonnull instancetype)initWithFrame:(CGRect)frame OBJC_DESIGNATED_INITIALIZER;
+- (nullable instancetype)initWithCoder:(NSCoder * _Nonnull)coder OBJC_DESIGNATED_INITIALIZER;
+@end
+
+
+/// /////////////////////////// DCAlertViewController /////////////////////
+SWIFT_CLASS("_TtC21DCloudAlertController21DCAlertViewController")
+@interface DCAlertViewController : UIViewController
+- (nullable instancetype)initWithCoder:(NSCoder * _Nonnull)coder SWIFT_UNAVAILABLE;
+- (void)loadView;
+- (void)viewWillLayoutSubviews;
+- (void)viewDidLoad;
+- (nonnull instancetype)initWithNibName:(NSString * _Nullable)nibNameOrNil bundle:(NSBundle * _Nullable)nibBundleOrNil SWIFT_UNAVAILABLE;
+@end
+
+@protocol UIViewControllerAnimatedTransitioning;
+
+@interface DCAlertViewController (SWIFT_EXTENSION(DCloudAlertController))
+- (id _Nullable)animationControllerForPresentedController:(UIViewController * _Nonnull)presented presentingController:(UIViewController * _Nonnull)presenting sourceController:(UIViewController * _Nonnull)source SWIFT_WARN_UNUSED_RESULT;
+- (id _Nullable)animationControllerForDismissedController:(UIViewController * _Nonnull)dismissed SWIFT_WARN_UNUSED_RESULT;
+@end
+
+
+
+SWIFT_CLASS("_TtC21DCloudAlertController14DCRIButtonItem")
+@interface DCRIButtonItem : NSObject
+- (nonnull instancetype)init OBJC_DESIGNATED_INITIALIZER;
+@end
+
+
+
+
+#if __has_attribute(external_source_symbol)
+# pragma clang attribute pop
+#endif
+#pragma clang diagnostic pop
+#endif
+
+#elif defined(__ARM_ARCH_7A__) && __ARM_ARCH_7A__
+// Generated by Apple Swift version 5.5.2 (swiftlang-1300.0.47.5 clang-1300.0.29.30)
+#ifndef DCLOUDALERTCONTROLLER_SWIFT_H
+#define DCLOUDALERTCONTROLLER_SWIFT_H
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wgcc-compat"
+
+#if !defined(__has_include)
+# define __has_include(x) 0
+#endif
+#if !defined(__has_attribute)
+# define __has_attribute(x) 0
+#endif
+#if !defined(__has_feature)
+# define __has_feature(x) 0
+#endif
+#if !defined(__has_warning)
+# define __has_warning(x) 0
+#endif
+
+#if __has_include()
+# include
+#endif
+
+#pragma clang diagnostic ignored "-Wauto-import"
+#include
+#include
+#include
+#include
+
+#if !defined(SWIFT_TYPEDEFS)
+# define SWIFT_TYPEDEFS 1
+# if __has_include()
+# include
+# elif !defined(__cplusplus)
+typedef uint_least16_t char16_t;
+typedef uint_least32_t char32_t;
+# endif
+typedef float swift_float2 __attribute__((__ext_vector_type__(2)));
+typedef float swift_float3 __attribute__((__ext_vector_type__(3)));
+typedef float swift_float4 __attribute__((__ext_vector_type__(4)));
+typedef double swift_double2 __attribute__((__ext_vector_type__(2)));
+typedef double swift_double3 __attribute__((__ext_vector_type__(3)));
+typedef double swift_double4 __attribute__((__ext_vector_type__(4)));
+typedef int swift_int2 __attribute__((__ext_vector_type__(2)));
+typedef int swift_int3 __attribute__((__ext_vector_type__(3)));
+typedef int swift_int4 __attribute__((__ext_vector_type__(4)));
+typedef unsigned int swift_uint2 __attribute__((__ext_vector_type__(2)));
+typedef unsigned int swift_uint3 __attribute__((__ext_vector_type__(3)));
+typedef unsigned int swift_uint4 __attribute__((__ext_vector_type__(4)));
+#endif
+
+#if !defined(SWIFT_PASTE)
+# define SWIFT_PASTE_HELPER(x, y) x##y
+# define SWIFT_PASTE(x, y) SWIFT_PASTE_HELPER(x, y)
+#endif
+#if !defined(SWIFT_METATYPE)
+# define SWIFT_METATYPE(X) Class
+#endif
+#if !defined(SWIFT_CLASS_PROPERTY)
+# if __has_feature(objc_class_property)
+# define SWIFT_CLASS_PROPERTY(...) __VA_ARGS__
+# else
+# define SWIFT_CLASS_PROPERTY(...)
+# endif
+#endif
+
+#if __has_attribute(objc_runtime_name)
+# define SWIFT_RUNTIME_NAME(X) __attribute__((objc_runtime_name(X)))
+#else
+# define SWIFT_RUNTIME_NAME(X)
+#endif
+#if __has_attribute(swift_name)
+# define SWIFT_COMPILE_NAME(X) __attribute__((swift_name(X)))
+#else
+# define SWIFT_COMPILE_NAME(X)
+#endif
+#if __has_attribute(objc_method_family)
+# define SWIFT_METHOD_FAMILY(X) __attribute__((objc_method_family(X)))
+#else
+# define SWIFT_METHOD_FAMILY(X)
+#endif
+#if __has_attribute(noescape)
+# define SWIFT_NOESCAPE __attribute__((noescape))
+#else
+# define SWIFT_NOESCAPE
+#endif
+#if __has_attribute(ns_consumed)
+# define SWIFT_RELEASES_ARGUMENT __attribute__((ns_consumed))
+#else
+# define SWIFT_RELEASES_ARGUMENT
+#endif
+#if __has_attribute(warn_unused_result)
+# define SWIFT_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
+#else
+# define SWIFT_WARN_UNUSED_RESULT
+#endif
+#if __has_attribute(noreturn)
+# define SWIFT_NORETURN __attribute__((noreturn))
+#else
+# define SWIFT_NORETURN
+#endif
+#if !defined(SWIFT_CLASS_EXTRA)
+# define SWIFT_CLASS_EXTRA
+#endif
+#if !defined(SWIFT_PROTOCOL_EXTRA)
+# define SWIFT_PROTOCOL_EXTRA
+#endif
+#if !defined(SWIFT_ENUM_EXTRA)
+# define SWIFT_ENUM_EXTRA
+#endif
+#if !defined(SWIFT_CLASS)
+# if __has_attribute(objc_subclassing_restricted)
+# define SWIFT_CLASS(SWIFT_NAME) SWIFT_RUNTIME_NAME(SWIFT_NAME) __attribute__((objc_subclassing_restricted)) SWIFT_CLASS_EXTRA
+# define SWIFT_CLASS_NAMED(SWIFT_NAME) __attribute__((objc_subclassing_restricted)) SWIFT_COMPILE_NAME(SWIFT_NAME) SWIFT_CLASS_EXTRA
+# else
+# define SWIFT_CLASS(SWIFT_NAME) SWIFT_RUNTIME_NAME(SWIFT_NAME) SWIFT_CLASS_EXTRA
+# define SWIFT_CLASS_NAMED(SWIFT_NAME) SWIFT_COMPILE_NAME(SWIFT_NAME) SWIFT_CLASS_EXTRA
+# endif
+#endif
+#if !defined(SWIFT_RESILIENT_CLASS)
+# if __has_attribute(objc_class_stub)
+# define SWIFT_RESILIENT_CLASS(SWIFT_NAME) SWIFT_CLASS(SWIFT_NAME) __attribute__((objc_class_stub))
+# define SWIFT_RESILIENT_CLASS_NAMED(SWIFT_NAME) __attribute__((objc_class_stub)) SWIFT_CLASS_NAMED(SWIFT_NAME)
+# else
+# define SWIFT_RESILIENT_CLASS(SWIFT_NAME) SWIFT_CLASS(SWIFT_NAME)
+# define SWIFT_RESILIENT_CLASS_NAMED(SWIFT_NAME) SWIFT_CLASS_NAMED(SWIFT_NAME)
+# endif
+#endif
+
+#if !defined(SWIFT_PROTOCOL)
+# define SWIFT_PROTOCOL(SWIFT_NAME) SWIFT_RUNTIME_NAME(SWIFT_NAME) SWIFT_PROTOCOL_EXTRA
+# define SWIFT_PROTOCOL_NAMED(SWIFT_NAME) SWIFT_COMPILE_NAME(SWIFT_NAME) SWIFT_PROTOCOL_EXTRA
+#endif
+
+#if !defined(SWIFT_EXTENSION)
+# define SWIFT_EXTENSION(M) SWIFT_PASTE(M##_Swift_, __LINE__)
+#endif
+
+#if !defined(OBJC_DESIGNATED_INITIALIZER)
+# if __has_attribute(objc_designated_initializer)
+# define OBJC_DESIGNATED_INITIALIZER __attribute__((objc_designated_initializer))
+# else
+# define OBJC_DESIGNATED_INITIALIZER
+# endif
+#endif
+#if !defined(SWIFT_ENUM_ATTR)
+# if defined(__has_attribute) && __has_attribute(enum_extensibility)
+# define SWIFT_ENUM_ATTR(_extensibility) __attribute__((enum_extensibility(_extensibility)))
+# else
+# define SWIFT_ENUM_ATTR(_extensibility)
+# endif
+#endif
+#if !defined(SWIFT_ENUM)
+# define SWIFT_ENUM(_type, _name, _extensibility) enum _name : _type _name; enum SWIFT_ENUM_ATTR(_extensibility) SWIFT_ENUM_EXTRA _name : _type
+# if __has_feature(generalized_swift_name)
+# define SWIFT_ENUM_NAMED(_type, _name, SWIFT_NAME, _extensibility) enum _name : _type _name SWIFT_COMPILE_NAME(SWIFT_NAME); enum SWIFT_COMPILE_NAME(SWIFT_NAME) SWIFT_ENUM_ATTR(_extensibility) SWIFT_ENUM_EXTRA _name : _type
+# else
+# define SWIFT_ENUM_NAMED(_type, _name, SWIFT_NAME, _extensibility) SWIFT_ENUM(_type, _name, _extensibility)
+# endif
+#endif
+#if !defined(SWIFT_UNAVAILABLE)
+# define SWIFT_UNAVAILABLE __attribute__((unavailable))
+#endif
+#if !defined(SWIFT_UNAVAILABLE_MSG)
+# define SWIFT_UNAVAILABLE_MSG(msg) __attribute__((unavailable(msg)))
+#endif
+#if !defined(SWIFT_AVAILABILITY)
+# define SWIFT_AVAILABILITY(plat, ...) __attribute__((availability(plat, __VA_ARGS__)))
+#endif
+#if !defined(SWIFT_WEAK_IMPORT)
+# define SWIFT_WEAK_IMPORT __attribute__((weak_import))
+#endif
+#if !defined(SWIFT_DEPRECATED)
+# define SWIFT_DEPRECATED __attribute__((deprecated))
+#endif
+#if !defined(SWIFT_DEPRECATED_MSG)
+# define SWIFT_DEPRECATED_MSG(...) __attribute__((deprecated(__VA_ARGS__)))
+#endif
+#if __has_feature(attribute_diagnose_if_objc)
+# define SWIFT_DEPRECATED_OBJC(Msg) __attribute__((diagnose_if(1, Msg, "warning")))
+#else
+# define SWIFT_DEPRECATED_OBJC(Msg) SWIFT_DEPRECATED_MSG(Msg)
+#endif
+#if !defined(IBSegueAction)
+# define IBSegueAction
+#endif
+#if __has_feature(modules)
+#if __has_warning("-Watimport-in-framework-header")
+#pragma clang diagnostic ignored "-Watimport-in-framework-header"
+#endif
+@import CoreGraphics;
+@import ObjectiveC;
+@import UIKit;
+#endif
+
+#pragma clang diagnostic ignored "-Wproperty-attribute-mismatch"
+#pragma clang diagnostic ignored "-Wduplicate-method-arg"
+#if __has_warning("-Wpragma-clang-attribute")
+# pragma clang diagnostic ignored "-Wpragma-clang-attribute"
+#endif
+#pragma clang diagnostic ignored "-Wunknown-pragmas"
+#pragma clang diagnostic ignored "-Wnullability"
+
+#if __has_attribute(external_source_symbol)
+# pragma push_macro("any")
+# undef any
+# pragma clang attribute push(__attribute__((external_source_symbol(language="Swift", defined_in="DCloudAlertController",generated_declaration))), apply_to=any(function,enum,objc_interface,objc_category,objc_protocol))
+# pragma pop_macro("any")
+#endif
+
+@class NSCoder;
+@class NSString;
+@class NSBundle;
+
+SWIFT_CLASS("_TtC21DCloudAlertController23DCActionSheetController")
+@interface DCActionSheetController : UIViewController
+- (nullable instancetype)initWithCoder:(NSCoder * _Nonnull)coder SWIFT_UNAVAILABLE;
+- (void)loadView;
+- (void)viewDidLoad;
+- (void)viewDidLayoutSubviews;
+- (nonnull instancetype)initWithNibName:(NSString * _Nullable)nibNameOrNil bundle:(NSBundle * _Nullable)nibBundleOrNil SWIFT_UNAVAILABLE;
+@end
+
+
+@class UITableView;
+@class NSNumber;
+@class NSIndexPath;
+@class UITableViewCell;
+@class UIView;
+
+@interface DCActionSheetController (SWIFT_EXTENSION(DCloudAlertController))
+- (NSInteger)numberOfSectionsInTableView:(UITableView * _Nonnull)tableView SWIFT_WARN_UNUSED_RESULT;
+- (NSInteger)tableView:(UITableView * _Nonnull)tableView numberOfRowsInSection:(NSInteger)section SWIFT_WARN_UNUSED_RESULT;
+- (UITableViewCell * _Nonnull)tableView:(UITableView * _Nonnull)tableView cellForRowAtIndexPath:(NSIndexPath * _Nonnull)indexPath SWIFT_WARN_UNUSED_RESULT;
+- (void)tableView:(UITableView * _Nonnull)tableView didSelectRowAtIndexPath:(NSIndexPath * _Nonnull)indexPath;
+- (CGFloat)tableView:(UITableView * _Nonnull)tableView heightForRowAtIndexPath:(NSIndexPath * _Nonnull)indexPath SWIFT_WARN_UNUSED_RESULT;
+- (CGFloat)tableView:(UITableView * _Nonnull)tableView heightForFooterInSection:(NSInteger)section SWIFT_WARN_UNUSED_RESULT;
+- (UIView * _Nullable)tableView:(UITableView * _Nonnull)tableView viewForFooterInSection:(NSInteger)section SWIFT_WARN_UNUSED_RESULT;
+@end
+
+
+SWIFT_CLASS("_TtC21DCloudAlertController13DCAlertAction")
+@interface DCAlertAction : NSObject
+- (nonnull instancetype)init SWIFT_UNAVAILABLE;
++ (nonnull instancetype)new SWIFT_UNAVAILABLE_MSG("-init is unavailable");
+@end
+
+
+SWIFT_CLASS("_TtC21DCloudAlertController19DCAlertActionButton")
+@interface DCAlertActionButton : UIButton
+- (nonnull instancetype)initWithFrame:(CGRect)frame OBJC_DESIGNATED_INITIALIZER;
+- (nullable instancetype)initWithCoder:(NSCoder * _Nonnull)coder OBJC_DESIGNATED_INITIALIZER;
+@end
+
+
+/// /////////////////////////// DCAlertViewController /////////////////////
+SWIFT_CLASS("_TtC21DCloudAlertController21DCAlertViewController")
+@interface DCAlertViewController : UIViewController
+- (nullable instancetype)initWithCoder:(NSCoder * _Nonnull)coder SWIFT_UNAVAILABLE;
+- (void)loadView;
+- (void)viewWillLayoutSubviews;
+- (void)viewDidLoad;
+- (nonnull instancetype)initWithNibName:(NSString * _Nullable)nibNameOrNil bundle:(NSBundle * _Nullable)nibBundleOrNil SWIFT_UNAVAILABLE;
+@end
+
+@protocol UIViewControllerAnimatedTransitioning;
+
+@interface DCAlertViewController (SWIFT_EXTENSION(DCloudAlertController))
+- (id _Nullable)animationControllerForPresentedController:(UIViewController * _Nonnull)presented presentingController:(UIViewController * _Nonnull)presenting sourceController:(UIViewController * _Nonnull)source SWIFT_WARN_UNUSED_RESULT;
+- (id _Nullable)animationControllerForDismissedController:(UIViewController * _Nonnull)dismissed SWIFT_WARN_UNUSED_RESULT;
+@end
+
+
+
+SWIFT_CLASS("_TtC21DCloudAlertController14DCRIButtonItem")
+@interface DCRIButtonItem : NSObject
+- (nonnull instancetype)init OBJC_DESIGNATED_INITIALIZER;
+@end
+
+
+
+
+#if __has_attribute(external_source_symbol)
+# pragma clang attribute pop
+#endif
+#pragma clang diagnostic pop
+#endif
+
+#endif
diff --git a/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCloudAlertController.framework/Headers/DCloudAlertController.h b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCloudAlertController.framework/Headers/DCloudAlertController.h
new file mode 100644
index 0000000000000000000000000000000000000000..69c751f199e2cef08beb26455abbe209b77d3159
--- /dev/null
+++ b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCloudAlertController.framework/Headers/DCloudAlertController.h
@@ -0,0 +1,17 @@
+//
+// DCloudAlertController.h
+// DCloudAlertController
+//
+// Created by lizhongyi on 2023/3/7.
+//
+
+#import
+
+//! Project version number for DCloudAlertController.
+FOUNDATION_EXPORT double DCloudAlertControllerVersionNumber;
+
+//! Project version string for DCloudAlertController.
+FOUNDATION_EXPORT const unsigned char DCloudAlertControllerVersionString[];
+
+// In this header, you should import all the public headers of your framework using statements like #import
+
diff --git a/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCloudAlertController.framework/Info.plist b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCloudAlertController.framework/Info.plist
new file mode 100644
index 0000000000000000000000000000000000000000..b245ccf0d727e4a94a37ac0915c2a74e226ef0ef
Binary files /dev/null and b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCloudAlertController.framework/Info.plist differ
diff --git a/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCloudAlertController.framework/Modules/DCloudAlertController.swiftmodule/Project/arm.swiftsourceinfo b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCloudAlertController.framework/Modules/DCloudAlertController.swiftmodule/Project/arm.swiftsourceinfo
new file mode 100644
index 0000000000000000000000000000000000000000..96dd48baa17085ef944588600dfcfcba89f72e1f
Binary files /dev/null and b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCloudAlertController.framework/Modules/DCloudAlertController.swiftmodule/Project/arm.swiftsourceinfo differ
diff --git a/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCloudAlertController.framework/Modules/DCloudAlertController.swiftmodule/Project/arm64-apple-ios.swiftsourceinfo b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCloudAlertController.framework/Modules/DCloudAlertController.swiftmodule/Project/arm64-apple-ios.swiftsourceinfo
new file mode 100644
index 0000000000000000000000000000000000000000..b4e159bfc54cdbc1ab9cc6a666331b3e0fc03cb3
Binary files /dev/null and b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCloudAlertController.framework/Modules/DCloudAlertController.swiftmodule/Project/arm64-apple-ios.swiftsourceinfo differ
diff --git a/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCloudAlertController.framework/Modules/DCloudAlertController.swiftmodule/Project/arm64.swiftsourceinfo b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCloudAlertController.framework/Modules/DCloudAlertController.swiftmodule/Project/arm64.swiftsourceinfo
new file mode 100644
index 0000000000000000000000000000000000000000..b4e159bfc54cdbc1ab9cc6a666331b3e0fc03cb3
Binary files /dev/null and b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCloudAlertController.framework/Modules/DCloudAlertController.swiftmodule/Project/arm64.swiftsourceinfo differ
diff --git a/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCloudAlertController.framework/Modules/DCloudAlertController.swiftmodule/Project/armv7-apple-ios.swiftsourceinfo b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCloudAlertController.framework/Modules/DCloudAlertController.swiftmodule/Project/armv7-apple-ios.swiftsourceinfo
new file mode 100644
index 0000000000000000000000000000000000000000..96dd48baa17085ef944588600dfcfcba89f72e1f
Binary files /dev/null and b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCloudAlertController.framework/Modules/DCloudAlertController.swiftmodule/Project/armv7-apple-ios.swiftsourceinfo differ
diff --git a/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCloudAlertController.framework/Modules/DCloudAlertController.swiftmodule/Project/armv7.swiftsourceinfo b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCloudAlertController.framework/Modules/DCloudAlertController.swiftmodule/Project/armv7.swiftsourceinfo
new file mode 100644
index 0000000000000000000000000000000000000000..96dd48baa17085ef944588600dfcfcba89f72e1f
Binary files /dev/null and b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCloudAlertController.framework/Modules/DCloudAlertController.swiftmodule/Project/armv7.swiftsourceinfo differ
diff --git a/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCloudAlertController.framework/Modules/DCloudAlertController.swiftmodule/arm.swiftdoc b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCloudAlertController.framework/Modules/DCloudAlertController.swiftmodule/arm.swiftdoc
new file mode 100644
index 0000000000000000000000000000000000000000..4fcdf0f81a4f3cd1c3ea559962f7773266b7ac6f
Binary files /dev/null and b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCloudAlertController.framework/Modules/DCloudAlertController.swiftmodule/arm.swiftdoc differ
diff --git a/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCloudAlertController.framework/Modules/DCloudAlertController.swiftmodule/arm.swiftinterface b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCloudAlertController.framework/Modules/DCloudAlertController.swiftmodule/arm.swiftinterface
new file mode 100644
index 0000000000000000000000000000000000000000..011b08a57972f7044b26426ccc604c57178ccc54
--- /dev/null
+++ b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCloudAlertController.framework/Modules/DCloudAlertController.swiftmodule/arm.swiftinterface
@@ -0,0 +1,167 @@
+// swift-interface-format-version: 1.0
+// swift-compiler-version: Apple Swift version 5.5.2 (swiftlang-1300.0.47.5 clang-1300.0.29.30)
+// swift-module-flags: -target armv7-apple-ios9.0 -enable-objc-interop -enable-library-evolution -swift-version 5 -enforce-exclusivity=checked -O -module-name DCloudAlertController
+@_exported import DCloudAlertController
+import Foundation
+import Swift
+import UIKit
+import _Concurrency
+public enum DCAlertActionStyle : Swift.Int {
+ case defaultStyle
+ case cancelStyle
+ case destructiveStyle
+ case preferredStyle
+ public init?(rawValue: Swift.Int)
+ public typealias RawValue = Swift.Int
+ public var rawValue: Swift.Int {
+ get
+ }
+}
+public enum DCAlertImagePosition : Swift.Int {
+ case null
+ case topCenter
+ case leftTopCenter
+ public init?(rawValue: Swift.Int)
+ public typealias RawValue = Swift.Int
+ public var rawValue: Swift.Int {
+ get
+ }
+}
+@objc public class DCAlertAction : ObjectiveC.NSObject {
+ public var title: Swift.String?
+ public var titleColor: UIKit.UIColor? {
+ get
+ set
+ }
+ public var style: DCloudAlertController.DCAlertActionStyle
+ weak public var button: UIKit.UIButton?
+ public var handler: (_ action: DCloudAlertController.DCAlertAction) -> Swift.Void
+ public var enabled: Swift.Bool {
+ get
+ set
+ }
+ public init(title: Swift.String, style: DCloudAlertController.DCAlertActionStyle, handler: @escaping (_ action: DCloudAlertController.DCAlertAction) -> Swift.Void)
+ @objc deinit
+}
+@objc @_inheritsConvenienceInitializers @_Concurrency.MainActor(unsafe) public class DCAlertActionButton : UIKit.UIButton {
+ @_Concurrency.MainActor(unsafe) @objc override dynamic public init(frame: CoreGraphics.CGRect)
+ @_Concurrency.MainActor(unsafe) @objc required dynamic public init?(coder: Foundation.NSCoder)
+ @objc deinit
+}
+public protocol DCAlertControllerContentViewProtocol : ObjectiveC.NSObject {
+ var titleLabel: UIKit.UILabel { get set }
+ var messageLabel: UIKit.UITextView { get set }
+ var title: Swift.String? { get set }
+ var message: Swift.String? { get set }
+ var image: UIKit.UIImage? { get set }
+ var customView: UIKit.UIView? { get set }
+ var imagePositon: DCloudAlertController.DCAlertImagePosition? { get set }
+ var buttons: [DCloudAlertController.DCAlertActionButton] { get }
+ var actionClickedHandler: ((_ action: DCloudAlertController.DCAlertAction) -> Swift.Void)? { get set }
+ func addAction(_ action: DCloudAlertController.DCAlertAction)
+ func setHairLineColor(_ hairLineColor: UIKit.UIColor?)
+}
+@objc @_inheritsConvenienceInitializers public class DCRIButtonItem : ObjectiveC.NSObject {
+ public static func item() -> DCloudAlertController.DCRIButtonItem
+ public static func itemWithLabel(_ inLabel: Swift.String) -> DCloudAlertController.DCRIButtonItem
+ public static func itemWithLabel(_ inLabel: Swift.String, _ labelColor: UIKit.UIColor? = nil, inAction action: @escaping (() -> Swift.Void)) -> DCloudAlertController.DCRIButtonItem
+ @objc override dynamic public init()
+ @objc deinit
+}
+@objc @_hasMissingDesignatedInitializers @_Concurrency.MainActor(unsafe) public class DCActionSheetController : UIKit.UIViewController {
+ @_Concurrency.MainActor(unsafe) public init(noticeTitle: Swift.String)
+ @_Concurrency.MainActor(unsafe) @objc override dynamic public func loadView()
+ @_Concurrency.MainActor(unsafe) @objc override dynamic public func viewDidLoad()
+ @_Concurrency.MainActor(unsafe) @objc override dynamic public func viewDidLayoutSubviews()
+ @_Concurrency.MainActor(unsafe) public func addAction(_ action: DCloudAlertController.DCAlertAction)
+ @_Concurrency.MainActor(unsafe) public func addAction(_ title: Swift.String, _ style: DCloudAlertController.DCAlertActionStyle, _ handler: @escaping (_ action: DCloudAlertController.DCAlertAction) -> Swift.Void) -> DCloudAlertController.DCAlertAction
+ @_Concurrency.MainActor(unsafe) public func show()
+ @objc deinit
+}
+extension DCloudAlertController.DCActionSheetController : UIKit.UITableViewDelegate, UIKit.UITableViewDataSource {
+ @_Concurrency.MainActor(unsafe) @objc dynamic public func numberOfSections(in tableView: UIKit.UITableView) -> Swift.Int
+ @_Concurrency.MainActor(unsafe) @objc dynamic public func tableView(_ tableView: UIKit.UITableView, numberOfRowsInSection section: Swift.Int) -> Swift.Int
+ @_Concurrency.MainActor(unsafe) @objc dynamic public func tableView(_ tableView: UIKit.UITableView, cellForRowAt indexPath: Foundation.IndexPath) -> UIKit.UITableViewCell
+ @_Concurrency.MainActor(unsafe) @objc dynamic public func tableView(_ tableView: UIKit.UITableView, didSelectRowAt indexPath: Foundation.IndexPath)
+ @_Concurrency.MainActor(unsafe) @objc dynamic public func tableView(_ tableView: UIKit.UITableView, heightForRowAt indexPath: Foundation.IndexPath) -> CoreGraphics.CGFloat
+ @_Concurrency.MainActor(unsafe) @objc dynamic public func tableView(_ tableView: UIKit.UITableView, heightForFooterInSection section: Swift.Int) -> CoreGraphics.CGFloat
+ @_Concurrency.MainActor(unsafe) @objc dynamic public func tableView(_ tableView: UIKit.UITableView, viewForFooterInSection section: Swift.Int) -> UIKit.UIView?
+}
+public enum DCAlertViewControllerStyle : Swift.Int {
+ case alert
+ case textViewAlert
+ public init?(rawValue: Swift.Int)
+ public typealias RawValue = Swift.Int
+ public var rawValue: Swift.Int {
+ get
+ }
+}
+public protocol DCAlertViewControllerDismissDelegate : UIKit.UITextViewDelegate {
+ func canDismissWithAction(_ action: DCloudAlertController.DCAlertAction?, _ param: Any?) -> Swift.Bool
+}
+@objc @_hasMissingDesignatedInitializers @_Concurrency.MainActor(unsafe) public class DCAlertViewController : UIKit.UIViewController {
+ @_Concurrency.MainActor(unsafe) public var canOpenDarkMode: Swift.Bool
+ @_Concurrency.MainActor(unsafe) public var contentViewVisible: Swift.Bool {
+ get
+ set
+ }
+ @_Concurrency.MainActor(unsafe) public var mesageTitle: Swift.String? {
+ get
+ set
+ }
+ @_Concurrency.MainActor(unsafe) public var message: Swift.String? {
+ get
+ set
+ }
+ @_Concurrency.MainActor(unsafe) public var textViewText: Swift.String? {
+ get
+ }
+ @_Concurrency.MainActor(unsafe) public var textView: UIKit.UITextView? {
+ get
+ }
+ @_Concurrency.MainActor(unsafe) weak public var dismissDelegate: DCloudAlertController.DCAlertViewControllerDismissDelegate? {
+ get
+ set
+ }
+ @_Concurrency.MainActor(unsafe) public var preferredStyle: DCloudAlertController.DCAlertViewControllerStyle
+ @_Concurrency.MainActor(unsafe) public var tapGesture: UIKit.UITapGestureRecognizer?
+ @_Concurrency.MainActor(unsafe) public var contentView: (UIKit.UIView & DCloudAlertController.DCAlertControllerContentViewProtocol)?
+ @objc deinit
+ @_Concurrency.MainActor(unsafe) public init(_ title: Swift.String?, _ message: Swift.String?, _ preferredStyle: DCloudAlertController.DCAlertViewControllerStyle, _ placeholder: Swift.String?)
+ @_Concurrency.MainActor(unsafe) public init(_ customView: UIKit.UIView & DCloudAlertController.DCAlertControllerContentViewProtocol, _ preferredStyle: DCloudAlertController.DCAlertViewControllerStyle)
+ @_Concurrency.MainActor(unsafe) @objc override dynamic public func loadView()
+ @_Concurrency.MainActor(unsafe) @objc override dynamic public func viewWillLayoutSubviews()
+ @_Concurrency.MainActor(unsafe) @objc override dynamic public func viewDidLoad()
+ @_Concurrency.MainActor(unsafe) public func alertControllerWithTitle(_ title: Swift.String?, _ message: Swift.String?, _ preferredStyle: DCloudAlertController.DCAlertViewControllerStyle, _ placeholder: Swift.String?) -> DCloudAlertController.DCAlertViewController
+ @_Concurrency.MainActor(unsafe) public func alertControllerWithCustomView(_ view: UIKit.UIView & DCloudAlertController.DCAlertControllerContentViewProtocol, _ preferredStyle: DCloudAlertController.DCAlertViewControllerStyle) -> DCloudAlertController.DCAlertViewController
+ @_Concurrency.MainActor(unsafe) public func addActionWithTitle(_ title: Foundation.NSString, _ style: DCloudAlertController.DCAlertActionStyle, _ handler: @escaping (_ action: DCloudAlertController.DCAlertAction) -> Swift.Void) -> DCloudAlertController.DCAlertAction
+ @_Concurrency.MainActor(unsafe) public func addImage(_ image: UIKit.UIImage, _ position: DCloudAlertController.DCAlertImagePosition)
+ @_Concurrency.MainActor(unsafe) public func addCustomView(_ customView: UIKit.UIView)
+ @_Concurrency.MainActor(unsafe) public func addAction(_ action: DCloudAlertController.DCAlertAction)
+ @_Concurrency.MainActor(unsafe) public func addTapGesture()
+ @_Concurrency.MainActor(unsafe) public func onTapAction(_ action: DCloudAlertController.DCAlertAction)
+ @_Concurrency.MainActor(unsafe) public func resetDoneBtnTitleColor(_ color: UIKit.UIColor)
+}
+extension DCloudAlertController.DCAlertViewController : UIKit.UIViewControllerTransitioningDelegate {
+ @_Concurrency.MainActor(unsafe) @objc dynamic public func animationController(forPresented presented: UIKit.UIViewController, presenting: UIKit.UIViewController, source: UIKit.UIViewController) -> UIKit.UIViewControllerAnimatedTransitioning?
+ @_Concurrency.MainActor(unsafe) @objc dynamic public func animationController(forDismissed dismissed: UIKit.UIViewController) -> UIKit.UIViewControllerAnimatedTransitioning?
+}
+public typealias DCAlertView = DCloudAlertController.DCAlertViewController
+extension DCloudAlertController.DCAlertViewController {
+ @_Concurrency.MainActor(unsafe) public func show()
+ @_Concurrency.MainActor(unsafe) public func dismiss()
+ @_Concurrency.MainActor(unsafe) public static func alertView(_ title: Swift.String, _ doneItem: DCloudAlertController.DCRIButtonItem, _ preferredStyle: DCloudAlertController.DCAlertViewControllerStyle = .alert, _ placeholder: Swift.String = "") -> DCloudAlertController.DCAlertView
+ @_Concurrency.MainActor(unsafe) public static func alertView(_ title: Swift.String?, _ cancelItem: DCloudAlertController.DCRIButtonItem, _ doneItem: DCloudAlertController.DCRIButtonItem, _ preferredStyle: DCloudAlertController.DCAlertViewControllerStyle = .alert, _ placeholder: Swift.String = "") -> DCloudAlertController.DCAlertView
+ @_Concurrency.MainActor(unsafe) public static func alertView(_ title: Swift.String?, _ subTitle: Swift.String?, _ doneItem: DCloudAlertController.DCRIButtonItem, _ preferredStyle: DCloudAlertController.DCAlertViewControllerStyle = .alert, _ placeholder: Swift.String = "") -> DCloudAlertController.DCAlertView
+ @_Concurrency.MainActor(unsafe) public static func alertView(_ title: Swift.String?, _ subTitle: Swift.String?, _ cancelItem: DCloudAlertController.DCRIButtonItem, _ doneItem: DCloudAlertController.DCRIButtonItem, _ preferredStyle: DCloudAlertController.DCAlertViewControllerStyle = .alert, _ placeholder: Swift.String = "") -> DCloudAlertController.DCAlertView
+ @_Concurrency.MainActor(unsafe) public static func alertView(_ title: Swift.String?, _ subTitle: Swift.String?, _ cancelItem: DCloudAlertController.DCRIButtonItem, _ cancelActionStyle: DCloudAlertController.DCAlertActionStyle, _ doneItem: DCloudAlertController.DCRIButtonItem, _ doneActionStyle: DCloudAlertController.DCAlertActionStyle, _ preferredStyle: DCloudAlertController.DCAlertViewControllerStyle, _ placeholder: Swift.String = "") -> DCloudAlertController.DCAlertView
+}
+extension DCloudAlertController.DCAlertActionStyle : Swift.Equatable {}
+extension DCloudAlertController.DCAlertActionStyle : Swift.Hashable {}
+extension DCloudAlertController.DCAlertActionStyle : Swift.RawRepresentable {}
+extension DCloudAlertController.DCAlertImagePosition : Swift.Equatable {}
+extension DCloudAlertController.DCAlertImagePosition : Swift.Hashable {}
+extension DCloudAlertController.DCAlertImagePosition : Swift.RawRepresentable {}
+extension DCloudAlertController.DCAlertViewControllerStyle : Swift.Equatable {}
+extension DCloudAlertController.DCAlertViewControllerStyle : Swift.Hashable {}
+extension DCloudAlertController.DCAlertViewControllerStyle : Swift.RawRepresentable {}
diff --git a/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCloudAlertController.framework/Modules/DCloudAlertController.swiftmodule/arm.swiftmodule b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCloudAlertController.framework/Modules/DCloudAlertController.swiftmodule/arm.swiftmodule
new file mode 100644
index 0000000000000000000000000000000000000000..d76b82309f5ad5a128ec5264d0aa21a08b330a03
Binary files /dev/null and b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCloudAlertController.framework/Modules/DCloudAlertController.swiftmodule/arm.swiftmodule differ
diff --git a/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCloudAlertController.framework/Modules/DCloudAlertController.swiftmodule/arm64-apple-ios.swiftdoc b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCloudAlertController.framework/Modules/DCloudAlertController.swiftmodule/arm64-apple-ios.swiftdoc
new file mode 100644
index 0000000000000000000000000000000000000000..828dbe3eafb17531ef766c8f734f84073f007c71
Binary files /dev/null and b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCloudAlertController.framework/Modules/DCloudAlertController.swiftmodule/arm64-apple-ios.swiftdoc differ
diff --git a/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCloudAlertController.framework/Modules/DCloudAlertController.swiftmodule/arm64-apple-ios.swiftinterface b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCloudAlertController.framework/Modules/DCloudAlertController.swiftmodule/arm64-apple-ios.swiftinterface
new file mode 100644
index 0000000000000000000000000000000000000000..906fb90f0c42e9294673a5c9a7faabf0eb98f9b7
--- /dev/null
+++ b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCloudAlertController.framework/Modules/DCloudAlertController.swiftmodule/arm64-apple-ios.swiftinterface
@@ -0,0 +1,167 @@
+// swift-interface-format-version: 1.0
+// swift-compiler-version: Apple Swift version 5.5.2 (swiftlang-1300.0.47.5 clang-1300.0.29.30)
+// swift-module-flags: -target arm64-apple-ios9.0 -enable-objc-interop -enable-library-evolution -swift-version 5 -enforce-exclusivity=checked -O -module-name DCloudAlertController
+@_exported import DCloudAlertController
+import Foundation
+import Swift
+import UIKit
+import _Concurrency
+public enum DCAlertActionStyle : Swift.Int {
+ case defaultStyle
+ case cancelStyle
+ case destructiveStyle
+ case preferredStyle
+ public init?(rawValue: Swift.Int)
+ public typealias RawValue = Swift.Int
+ public var rawValue: Swift.Int {
+ get
+ }
+}
+public enum DCAlertImagePosition : Swift.Int {
+ case null
+ case topCenter
+ case leftTopCenter
+ public init?(rawValue: Swift.Int)
+ public typealias RawValue = Swift.Int
+ public var rawValue: Swift.Int {
+ get
+ }
+}
+@objc public class DCAlertAction : ObjectiveC.NSObject {
+ public var title: Swift.String?
+ public var titleColor: UIKit.UIColor? {
+ get
+ set
+ }
+ public var style: DCloudAlertController.DCAlertActionStyle
+ weak public var button: UIKit.UIButton?
+ public var handler: (_ action: DCloudAlertController.DCAlertAction) -> Swift.Void
+ public var enabled: Swift.Bool {
+ get
+ set
+ }
+ public init(title: Swift.String, style: DCloudAlertController.DCAlertActionStyle, handler: @escaping (_ action: DCloudAlertController.DCAlertAction) -> Swift.Void)
+ @objc deinit
+}
+@objc @_inheritsConvenienceInitializers @_Concurrency.MainActor(unsafe) public class DCAlertActionButton : UIKit.UIButton {
+ @_Concurrency.MainActor(unsafe) @objc override dynamic public init(frame: CoreGraphics.CGRect)
+ @_Concurrency.MainActor(unsafe) @objc required dynamic public init?(coder: Foundation.NSCoder)
+ @objc deinit
+}
+public protocol DCAlertControllerContentViewProtocol : ObjectiveC.NSObject {
+ var titleLabel: UIKit.UILabel { get set }
+ var messageLabel: UIKit.UITextView { get set }
+ var title: Swift.String? { get set }
+ var message: Swift.String? { get set }
+ var image: UIKit.UIImage? { get set }
+ var customView: UIKit.UIView? { get set }
+ var imagePositon: DCloudAlertController.DCAlertImagePosition? { get set }
+ var buttons: [DCloudAlertController.DCAlertActionButton] { get }
+ var actionClickedHandler: ((_ action: DCloudAlertController.DCAlertAction) -> Swift.Void)? { get set }
+ func addAction(_ action: DCloudAlertController.DCAlertAction)
+ func setHairLineColor(_ hairLineColor: UIKit.UIColor?)
+}
+@objc @_inheritsConvenienceInitializers public class DCRIButtonItem : ObjectiveC.NSObject {
+ public static func item() -> DCloudAlertController.DCRIButtonItem
+ public static func itemWithLabel(_ inLabel: Swift.String) -> DCloudAlertController.DCRIButtonItem
+ public static func itemWithLabel(_ inLabel: Swift.String, _ labelColor: UIKit.UIColor? = nil, inAction action: @escaping (() -> Swift.Void)) -> DCloudAlertController.DCRIButtonItem
+ @objc override dynamic public init()
+ @objc deinit
+}
+@objc @_hasMissingDesignatedInitializers @_Concurrency.MainActor(unsafe) public class DCActionSheetController : UIKit.UIViewController {
+ @_Concurrency.MainActor(unsafe) public init(noticeTitle: Swift.String)
+ @_Concurrency.MainActor(unsafe) @objc override dynamic public func loadView()
+ @_Concurrency.MainActor(unsafe) @objc override dynamic public func viewDidLoad()
+ @_Concurrency.MainActor(unsafe) @objc override dynamic public func viewDidLayoutSubviews()
+ @_Concurrency.MainActor(unsafe) public func addAction(_ action: DCloudAlertController.DCAlertAction)
+ @_Concurrency.MainActor(unsafe) public func addAction(_ title: Swift.String, _ style: DCloudAlertController.DCAlertActionStyle, _ handler: @escaping (_ action: DCloudAlertController.DCAlertAction) -> Swift.Void) -> DCloudAlertController.DCAlertAction
+ @_Concurrency.MainActor(unsafe) public func show()
+ @objc deinit
+}
+extension DCloudAlertController.DCActionSheetController : UIKit.UITableViewDelegate, UIKit.UITableViewDataSource {
+ @_Concurrency.MainActor(unsafe) @objc dynamic public func numberOfSections(in tableView: UIKit.UITableView) -> Swift.Int
+ @_Concurrency.MainActor(unsafe) @objc dynamic public func tableView(_ tableView: UIKit.UITableView, numberOfRowsInSection section: Swift.Int) -> Swift.Int
+ @_Concurrency.MainActor(unsafe) @objc dynamic public func tableView(_ tableView: UIKit.UITableView, cellForRowAt indexPath: Foundation.IndexPath) -> UIKit.UITableViewCell
+ @_Concurrency.MainActor(unsafe) @objc dynamic public func tableView(_ tableView: UIKit.UITableView, didSelectRowAt indexPath: Foundation.IndexPath)
+ @_Concurrency.MainActor(unsafe) @objc dynamic public func tableView(_ tableView: UIKit.UITableView, heightForRowAt indexPath: Foundation.IndexPath) -> CoreGraphics.CGFloat
+ @_Concurrency.MainActor(unsafe) @objc dynamic public func tableView(_ tableView: UIKit.UITableView, heightForFooterInSection section: Swift.Int) -> CoreGraphics.CGFloat
+ @_Concurrency.MainActor(unsafe) @objc dynamic public func tableView(_ tableView: UIKit.UITableView, viewForFooterInSection section: Swift.Int) -> UIKit.UIView?
+}
+public enum DCAlertViewControllerStyle : Swift.Int {
+ case alert
+ case textViewAlert
+ public init?(rawValue: Swift.Int)
+ public typealias RawValue = Swift.Int
+ public var rawValue: Swift.Int {
+ get
+ }
+}
+public protocol DCAlertViewControllerDismissDelegate : UIKit.UITextViewDelegate {
+ func canDismissWithAction(_ action: DCloudAlertController.DCAlertAction?, _ param: Any?) -> Swift.Bool
+}
+@objc @_hasMissingDesignatedInitializers @_Concurrency.MainActor(unsafe) public class DCAlertViewController : UIKit.UIViewController {
+ @_Concurrency.MainActor(unsafe) public var canOpenDarkMode: Swift.Bool
+ @_Concurrency.MainActor(unsafe) public var contentViewVisible: Swift.Bool {
+ get
+ set
+ }
+ @_Concurrency.MainActor(unsafe) public var mesageTitle: Swift.String? {
+ get
+ set
+ }
+ @_Concurrency.MainActor(unsafe) public var message: Swift.String? {
+ get
+ set
+ }
+ @_Concurrency.MainActor(unsafe) public var textViewText: Swift.String? {
+ get
+ }
+ @_Concurrency.MainActor(unsafe) public var textView: UIKit.UITextView? {
+ get
+ }
+ @_Concurrency.MainActor(unsafe) weak public var dismissDelegate: DCloudAlertController.DCAlertViewControllerDismissDelegate? {
+ get
+ set
+ }
+ @_Concurrency.MainActor(unsafe) public var preferredStyle: DCloudAlertController.DCAlertViewControllerStyle
+ @_Concurrency.MainActor(unsafe) public var tapGesture: UIKit.UITapGestureRecognizer?
+ @_Concurrency.MainActor(unsafe) public var contentView: (UIKit.UIView & DCloudAlertController.DCAlertControllerContentViewProtocol)?
+ @objc deinit
+ @_Concurrency.MainActor(unsafe) public init(_ title: Swift.String?, _ message: Swift.String?, _ preferredStyle: DCloudAlertController.DCAlertViewControllerStyle, _ placeholder: Swift.String?)
+ @_Concurrency.MainActor(unsafe) public init(_ customView: UIKit.UIView & DCloudAlertController.DCAlertControllerContentViewProtocol, _ preferredStyle: DCloudAlertController.DCAlertViewControllerStyle)
+ @_Concurrency.MainActor(unsafe) @objc override dynamic public func loadView()
+ @_Concurrency.MainActor(unsafe) @objc override dynamic public func viewWillLayoutSubviews()
+ @_Concurrency.MainActor(unsafe) @objc override dynamic public func viewDidLoad()
+ @_Concurrency.MainActor(unsafe) public func alertControllerWithTitle(_ title: Swift.String?, _ message: Swift.String?, _ preferredStyle: DCloudAlertController.DCAlertViewControllerStyle, _ placeholder: Swift.String?) -> DCloudAlertController.DCAlertViewController
+ @_Concurrency.MainActor(unsafe) public func alertControllerWithCustomView(_ view: UIKit.UIView & DCloudAlertController.DCAlertControllerContentViewProtocol, _ preferredStyle: DCloudAlertController.DCAlertViewControllerStyle) -> DCloudAlertController.DCAlertViewController
+ @_Concurrency.MainActor(unsafe) public func addActionWithTitle(_ title: Foundation.NSString, _ style: DCloudAlertController.DCAlertActionStyle, _ handler: @escaping (_ action: DCloudAlertController.DCAlertAction) -> Swift.Void) -> DCloudAlertController.DCAlertAction
+ @_Concurrency.MainActor(unsafe) public func addImage(_ image: UIKit.UIImage, _ position: DCloudAlertController.DCAlertImagePosition)
+ @_Concurrency.MainActor(unsafe) public func addCustomView(_ customView: UIKit.UIView)
+ @_Concurrency.MainActor(unsafe) public func addAction(_ action: DCloudAlertController.DCAlertAction)
+ @_Concurrency.MainActor(unsafe) public func addTapGesture()
+ @_Concurrency.MainActor(unsafe) public func onTapAction(_ action: DCloudAlertController.DCAlertAction)
+ @_Concurrency.MainActor(unsafe) public func resetDoneBtnTitleColor(_ color: UIKit.UIColor)
+}
+extension DCloudAlertController.DCAlertViewController : UIKit.UIViewControllerTransitioningDelegate {
+ @_Concurrency.MainActor(unsafe) @objc dynamic public func animationController(forPresented presented: UIKit.UIViewController, presenting: UIKit.UIViewController, source: UIKit.UIViewController) -> UIKit.UIViewControllerAnimatedTransitioning?
+ @_Concurrency.MainActor(unsafe) @objc dynamic public func animationController(forDismissed dismissed: UIKit.UIViewController) -> UIKit.UIViewControllerAnimatedTransitioning?
+}
+public typealias DCAlertView = DCloudAlertController.DCAlertViewController
+extension DCloudAlertController.DCAlertViewController {
+ @_Concurrency.MainActor(unsafe) public func show()
+ @_Concurrency.MainActor(unsafe) public func dismiss()
+ @_Concurrency.MainActor(unsafe) public static func alertView(_ title: Swift.String, _ doneItem: DCloudAlertController.DCRIButtonItem, _ preferredStyle: DCloudAlertController.DCAlertViewControllerStyle = .alert, _ placeholder: Swift.String = "") -> DCloudAlertController.DCAlertView
+ @_Concurrency.MainActor(unsafe) public static func alertView(_ title: Swift.String?, _ cancelItem: DCloudAlertController.DCRIButtonItem, _ doneItem: DCloudAlertController.DCRIButtonItem, _ preferredStyle: DCloudAlertController.DCAlertViewControllerStyle = .alert, _ placeholder: Swift.String = "") -> DCloudAlertController.DCAlertView
+ @_Concurrency.MainActor(unsafe) public static func alertView(_ title: Swift.String?, _ subTitle: Swift.String?, _ doneItem: DCloudAlertController.DCRIButtonItem, _ preferredStyle: DCloudAlertController.DCAlertViewControllerStyle = .alert, _ placeholder: Swift.String = "") -> DCloudAlertController.DCAlertView
+ @_Concurrency.MainActor(unsafe) public static func alertView(_ title: Swift.String?, _ subTitle: Swift.String?, _ cancelItem: DCloudAlertController.DCRIButtonItem, _ doneItem: DCloudAlertController.DCRIButtonItem, _ preferredStyle: DCloudAlertController.DCAlertViewControllerStyle = .alert, _ placeholder: Swift.String = "") -> DCloudAlertController.DCAlertView
+ @_Concurrency.MainActor(unsafe) public static func alertView(_ title: Swift.String?, _ subTitle: Swift.String?, _ cancelItem: DCloudAlertController.DCRIButtonItem, _ cancelActionStyle: DCloudAlertController.DCAlertActionStyle, _ doneItem: DCloudAlertController.DCRIButtonItem, _ doneActionStyle: DCloudAlertController.DCAlertActionStyle, _ preferredStyle: DCloudAlertController.DCAlertViewControllerStyle, _ placeholder: Swift.String = "") -> DCloudAlertController.DCAlertView
+}
+extension DCloudAlertController.DCAlertActionStyle : Swift.Equatable {}
+extension DCloudAlertController.DCAlertActionStyle : Swift.Hashable {}
+extension DCloudAlertController.DCAlertActionStyle : Swift.RawRepresentable {}
+extension DCloudAlertController.DCAlertImagePosition : Swift.Equatable {}
+extension DCloudAlertController.DCAlertImagePosition : Swift.Hashable {}
+extension DCloudAlertController.DCAlertImagePosition : Swift.RawRepresentable {}
+extension DCloudAlertController.DCAlertViewControllerStyle : Swift.Equatable {}
+extension DCloudAlertController.DCAlertViewControllerStyle : Swift.Hashable {}
+extension DCloudAlertController.DCAlertViewControllerStyle : Swift.RawRepresentable {}
diff --git a/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCloudAlertController.framework/Modules/DCloudAlertController.swiftmodule/arm64-apple-ios.swiftmodule b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCloudAlertController.framework/Modules/DCloudAlertController.swiftmodule/arm64-apple-ios.swiftmodule
new file mode 100644
index 0000000000000000000000000000000000000000..053644813bf31e10c1525e4855e29c81628dcdf2
Binary files /dev/null and b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCloudAlertController.framework/Modules/DCloudAlertController.swiftmodule/arm64-apple-ios.swiftmodule differ
diff --git a/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCloudAlertController.framework/Modules/DCloudAlertController.swiftmodule/arm64.swiftdoc b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCloudAlertController.framework/Modules/DCloudAlertController.swiftmodule/arm64.swiftdoc
new file mode 100644
index 0000000000000000000000000000000000000000..828dbe3eafb17531ef766c8f734f84073f007c71
Binary files /dev/null and b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCloudAlertController.framework/Modules/DCloudAlertController.swiftmodule/arm64.swiftdoc differ
diff --git a/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCloudAlertController.framework/Modules/DCloudAlertController.swiftmodule/arm64.swiftinterface b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCloudAlertController.framework/Modules/DCloudAlertController.swiftmodule/arm64.swiftinterface
new file mode 100644
index 0000000000000000000000000000000000000000..906fb90f0c42e9294673a5c9a7faabf0eb98f9b7
--- /dev/null
+++ b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCloudAlertController.framework/Modules/DCloudAlertController.swiftmodule/arm64.swiftinterface
@@ -0,0 +1,167 @@
+// swift-interface-format-version: 1.0
+// swift-compiler-version: Apple Swift version 5.5.2 (swiftlang-1300.0.47.5 clang-1300.0.29.30)
+// swift-module-flags: -target arm64-apple-ios9.0 -enable-objc-interop -enable-library-evolution -swift-version 5 -enforce-exclusivity=checked -O -module-name DCloudAlertController
+@_exported import DCloudAlertController
+import Foundation
+import Swift
+import UIKit
+import _Concurrency
+public enum DCAlertActionStyle : Swift.Int {
+ case defaultStyle
+ case cancelStyle
+ case destructiveStyle
+ case preferredStyle
+ public init?(rawValue: Swift.Int)
+ public typealias RawValue = Swift.Int
+ public var rawValue: Swift.Int {
+ get
+ }
+}
+public enum DCAlertImagePosition : Swift.Int {
+ case null
+ case topCenter
+ case leftTopCenter
+ public init?(rawValue: Swift.Int)
+ public typealias RawValue = Swift.Int
+ public var rawValue: Swift.Int {
+ get
+ }
+}
+@objc public class DCAlertAction : ObjectiveC.NSObject {
+ public var title: Swift.String?
+ public var titleColor: UIKit.UIColor? {
+ get
+ set
+ }
+ public var style: DCloudAlertController.DCAlertActionStyle
+ weak public var button: UIKit.UIButton?
+ public var handler: (_ action: DCloudAlertController.DCAlertAction) -> Swift.Void
+ public var enabled: Swift.Bool {
+ get
+ set
+ }
+ public init(title: Swift.String, style: DCloudAlertController.DCAlertActionStyle, handler: @escaping (_ action: DCloudAlertController.DCAlertAction) -> Swift.Void)
+ @objc deinit
+}
+@objc @_inheritsConvenienceInitializers @_Concurrency.MainActor(unsafe) public class DCAlertActionButton : UIKit.UIButton {
+ @_Concurrency.MainActor(unsafe) @objc override dynamic public init(frame: CoreGraphics.CGRect)
+ @_Concurrency.MainActor(unsafe) @objc required dynamic public init?(coder: Foundation.NSCoder)
+ @objc deinit
+}
+public protocol DCAlertControllerContentViewProtocol : ObjectiveC.NSObject {
+ var titleLabel: UIKit.UILabel { get set }
+ var messageLabel: UIKit.UITextView { get set }
+ var title: Swift.String? { get set }
+ var message: Swift.String? { get set }
+ var image: UIKit.UIImage? { get set }
+ var customView: UIKit.UIView? { get set }
+ var imagePositon: DCloudAlertController.DCAlertImagePosition? { get set }
+ var buttons: [DCloudAlertController.DCAlertActionButton] { get }
+ var actionClickedHandler: ((_ action: DCloudAlertController.DCAlertAction) -> Swift.Void)? { get set }
+ func addAction(_ action: DCloudAlertController.DCAlertAction)
+ func setHairLineColor(_ hairLineColor: UIKit.UIColor?)
+}
+@objc @_inheritsConvenienceInitializers public class DCRIButtonItem : ObjectiveC.NSObject {
+ public static func item() -> DCloudAlertController.DCRIButtonItem
+ public static func itemWithLabel(_ inLabel: Swift.String) -> DCloudAlertController.DCRIButtonItem
+ public static func itemWithLabel(_ inLabel: Swift.String, _ labelColor: UIKit.UIColor? = nil, inAction action: @escaping (() -> Swift.Void)) -> DCloudAlertController.DCRIButtonItem
+ @objc override dynamic public init()
+ @objc deinit
+}
+@objc @_hasMissingDesignatedInitializers @_Concurrency.MainActor(unsafe) public class DCActionSheetController : UIKit.UIViewController {
+ @_Concurrency.MainActor(unsafe) public init(noticeTitle: Swift.String)
+ @_Concurrency.MainActor(unsafe) @objc override dynamic public func loadView()
+ @_Concurrency.MainActor(unsafe) @objc override dynamic public func viewDidLoad()
+ @_Concurrency.MainActor(unsafe) @objc override dynamic public func viewDidLayoutSubviews()
+ @_Concurrency.MainActor(unsafe) public func addAction(_ action: DCloudAlertController.DCAlertAction)
+ @_Concurrency.MainActor(unsafe) public func addAction(_ title: Swift.String, _ style: DCloudAlertController.DCAlertActionStyle, _ handler: @escaping (_ action: DCloudAlertController.DCAlertAction) -> Swift.Void) -> DCloudAlertController.DCAlertAction
+ @_Concurrency.MainActor(unsafe) public func show()
+ @objc deinit
+}
+extension DCloudAlertController.DCActionSheetController : UIKit.UITableViewDelegate, UIKit.UITableViewDataSource {
+ @_Concurrency.MainActor(unsafe) @objc dynamic public func numberOfSections(in tableView: UIKit.UITableView) -> Swift.Int
+ @_Concurrency.MainActor(unsafe) @objc dynamic public func tableView(_ tableView: UIKit.UITableView, numberOfRowsInSection section: Swift.Int) -> Swift.Int
+ @_Concurrency.MainActor(unsafe) @objc dynamic public func tableView(_ tableView: UIKit.UITableView, cellForRowAt indexPath: Foundation.IndexPath) -> UIKit.UITableViewCell
+ @_Concurrency.MainActor(unsafe) @objc dynamic public func tableView(_ tableView: UIKit.UITableView, didSelectRowAt indexPath: Foundation.IndexPath)
+ @_Concurrency.MainActor(unsafe) @objc dynamic public func tableView(_ tableView: UIKit.UITableView, heightForRowAt indexPath: Foundation.IndexPath) -> CoreGraphics.CGFloat
+ @_Concurrency.MainActor(unsafe) @objc dynamic public func tableView(_ tableView: UIKit.UITableView, heightForFooterInSection section: Swift.Int) -> CoreGraphics.CGFloat
+ @_Concurrency.MainActor(unsafe) @objc dynamic public func tableView(_ tableView: UIKit.UITableView, viewForFooterInSection section: Swift.Int) -> UIKit.UIView?
+}
+public enum DCAlertViewControllerStyle : Swift.Int {
+ case alert
+ case textViewAlert
+ public init?(rawValue: Swift.Int)
+ public typealias RawValue = Swift.Int
+ public var rawValue: Swift.Int {
+ get
+ }
+}
+public protocol DCAlertViewControllerDismissDelegate : UIKit.UITextViewDelegate {
+ func canDismissWithAction(_ action: DCloudAlertController.DCAlertAction?, _ param: Any?) -> Swift.Bool
+}
+@objc @_hasMissingDesignatedInitializers @_Concurrency.MainActor(unsafe) public class DCAlertViewController : UIKit.UIViewController {
+ @_Concurrency.MainActor(unsafe) public var canOpenDarkMode: Swift.Bool
+ @_Concurrency.MainActor(unsafe) public var contentViewVisible: Swift.Bool {
+ get
+ set
+ }
+ @_Concurrency.MainActor(unsafe) public var mesageTitle: Swift.String? {
+ get
+ set
+ }
+ @_Concurrency.MainActor(unsafe) public var message: Swift.String? {
+ get
+ set
+ }
+ @_Concurrency.MainActor(unsafe) public var textViewText: Swift.String? {
+ get
+ }
+ @_Concurrency.MainActor(unsafe) public var textView: UIKit.UITextView? {
+ get
+ }
+ @_Concurrency.MainActor(unsafe) weak public var dismissDelegate: DCloudAlertController.DCAlertViewControllerDismissDelegate? {
+ get
+ set
+ }
+ @_Concurrency.MainActor(unsafe) public var preferredStyle: DCloudAlertController.DCAlertViewControllerStyle
+ @_Concurrency.MainActor(unsafe) public var tapGesture: UIKit.UITapGestureRecognizer?
+ @_Concurrency.MainActor(unsafe) public var contentView: (UIKit.UIView & DCloudAlertController.DCAlertControllerContentViewProtocol)?
+ @objc deinit
+ @_Concurrency.MainActor(unsafe) public init(_ title: Swift.String?, _ message: Swift.String?, _ preferredStyle: DCloudAlertController.DCAlertViewControllerStyle, _ placeholder: Swift.String?)
+ @_Concurrency.MainActor(unsafe) public init(_ customView: UIKit.UIView & DCloudAlertController.DCAlertControllerContentViewProtocol, _ preferredStyle: DCloudAlertController.DCAlertViewControllerStyle)
+ @_Concurrency.MainActor(unsafe) @objc override dynamic public func loadView()
+ @_Concurrency.MainActor(unsafe) @objc override dynamic public func viewWillLayoutSubviews()
+ @_Concurrency.MainActor(unsafe) @objc override dynamic public func viewDidLoad()
+ @_Concurrency.MainActor(unsafe) public func alertControllerWithTitle(_ title: Swift.String?, _ message: Swift.String?, _ preferredStyle: DCloudAlertController.DCAlertViewControllerStyle, _ placeholder: Swift.String?) -> DCloudAlertController.DCAlertViewController
+ @_Concurrency.MainActor(unsafe) public func alertControllerWithCustomView(_ view: UIKit.UIView & DCloudAlertController.DCAlertControllerContentViewProtocol, _ preferredStyle: DCloudAlertController.DCAlertViewControllerStyle) -> DCloudAlertController.DCAlertViewController
+ @_Concurrency.MainActor(unsafe) public func addActionWithTitle(_ title: Foundation.NSString, _ style: DCloudAlertController.DCAlertActionStyle, _ handler: @escaping (_ action: DCloudAlertController.DCAlertAction) -> Swift.Void) -> DCloudAlertController.DCAlertAction
+ @_Concurrency.MainActor(unsafe) public func addImage(_ image: UIKit.UIImage, _ position: DCloudAlertController.DCAlertImagePosition)
+ @_Concurrency.MainActor(unsafe) public func addCustomView(_ customView: UIKit.UIView)
+ @_Concurrency.MainActor(unsafe) public func addAction(_ action: DCloudAlertController.DCAlertAction)
+ @_Concurrency.MainActor(unsafe) public func addTapGesture()
+ @_Concurrency.MainActor(unsafe) public func onTapAction(_ action: DCloudAlertController.DCAlertAction)
+ @_Concurrency.MainActor(unsafe) public func resetDoneBtnTitleColor(_ color: UIKit.UIColor)
+}
+extension DCloudAlertController.DCAlertViewController : UIKit.UIViewControllerTransitioningDelegate {
+ @_Concurrency.MainActor(unsafe) @objc dynamic public func animationController(forPresented presented: UIKit.UIViewController, presenting: UIKit.UIViewController, source: UIKit.UIViewController) -> UIKit.UIViewControllerAnimatedTransitioning?
+ @_Concurrency.MainActor(unsafe) @objc dynamic public func animationController(forDismissed dismissed: UIKit.UIViewController) -> UIKit.UIViewControllerAnimatedTransitioning?
+}
+public typealias DCAlertView = DCloudAlertController.DCAlertViewController
+extension DCloudAlertController.DCAlertViewController {
+ @_Concurrency.MainActor(unsafe) public func show()
+ @_Concurrency.MainActor(unsafe) public func dismiss()
+ @_Concurrency.MainActor(unsafe) public static func alertView(_ title: Swift.String, _ doneItem: DCloudAlertController.DCRIButtonItem, _ preferredStyle: DCloudAlertController.DCAlertViewControllerStyle = .alert, _ placeholder: Swift.String = "") -> DCloudAlertController.DCAlertView
+ @_Concurrency.MainActor(unsafe) public static func alertView(_ title: Swift.String?, _ cancelItem: DCloudAlertController.DCRIButtonItem, _ doneItem: DCloudAlertController.DCRIButtonItem, _ preferredStyle: DCloudAlertController.DCAlertViewControllerStyle = .alert, _ placeholder: Swift.String = "") -> DCloudAlertController.DCAlertView
+ @_Concurrency.MainActor(unsafe) public static func alertView(_ title: Swift.String?, _ subTitle: Swift.String?, _ doneItem: DCloudAlertController.DCRIButtonItem, _ preferredStyle: DCloudAlertController.DCAlertViewControllerStyle = .alert, _ placeholder: Swift.String = "") -> DCloudAlertController.DCAlertView
+ @_Concurrency.MainActor(unsafe) public static func alertView(_ title: Swift.String?, _ subTitle: Swift.String?, _ cancelItem: DCloudAlertController.DCRIButtonItem, _ doneItem: DCloudAlertController.DCRIButtonItem, _ preferredStyle: DCloudAlertController.DCAlertViewControllerStyle = .alert, _ placeholder: Swift.String = "") -> DCloudAlertController.DCAlertView
+ @_Concurrency.MainActor(unsafe) public static func alertView(_ title: Swift.String?, _ subTitle: Swift.String?, _ cancelItem: DCloudAlertController.DCRIButtonItem, _ cancelActionStyle: DCloudAlertController.DCAlertActionStyle, _ doneItem: DCloudAlertController.DCRIButtonItem, _ doneActionStyle: DCloudAlertController.DCAlertActionStyle, _ preferredStyle: DCloudAlertController.DCAlertViewControllerStyle, _ placeholder: Swift.String = "") -> DCloudAlertController.DCAlertView
+}
+extension DCloudAlertController.DCAlertActionStyle : Swift.Equatable {}
+extension DCloudAlertController.DCAlertActionStyle : Swift.Hashable {}
+extension DCloudAlertController.DCAlertActionStyle : Swift.RawRepresentable {}
+extension DCloudAlertController.DCAlertImagePosition : Swift.Equatable {}
+extension DCloudAlertController.DCAlertImagePosition : Swift.Hashable {}
+extension DCloudAlertController.DCAlertImagePosition : Swift.RawRepresentable {}
+extension DCloudAlertController.DCAlertViewControllerStyle : Swift.Equatable {}
+extension DCloudAlertController.DCAlertViewControllerStyle : Swift.Hashable {}
+extension DCloudAlertController.DCAlertViewControllerStyle : Swift.RawRepresentable {}
diff --git a/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCloudAlertController.framework/Modules/DCloudAlertController.swiftmodule/arm64.swiftmodule b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCloudAlertController.framework/Modules/DCloudAlertController.swiftmodule/arm64.swiftmodule
new file mode 100644
index 0000000000000000000000000000000000000000..053644813bf31e10c1525e4855e29c81628dcdf2
Binary files /dev/null and b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCloudAlertController.framework/Modules/DCloudAlertController.swiftmodule/arm64.swiftmodule differ
diff --git a/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCloudAlertController.framework/Modules/DCloudAlertController.swiftmodule/armv7-apple-ios.swiftdoc b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCloudAlertController.framework/Modules/DCloudAlertController.swiftmodule/armv7-apple-ios.swiftdoc
new file mode 100644
index 0000000000000000000000000000000000000000..4fcdf0f81a4f3cd1c3ea559962f7773266b7ac6f
Binary files /dev/null and b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCloudAlertController.framework/Modules/DCloudAlertController.swiftmodule/armv7-apple-ios.swiftdoc differ
diff --git a/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCloudAlertController.framework/Modules/DCloudAlertController.swiftmodule/armv7-apple-ios.swiftinterface b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCloudAlertController.framework/Modules/DCloudAlertController.swiftmodule/armv7-apple-ios.swiftinterface
new file mode 100644
index 0000000000000000000000000000000000000000..011b08a57972f7044b26426ccc604c57178ccc54
--- /dev/null
+++ b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCloudAlertController.framework/Modules/DCloudAlertController.swiftmodule/armv7-apple-ios.swiftinterface
@@ -0,0 +1,167 @@
+// swift-interface-format-version: 1.0
+// swift-compiler-version: Apple Swift version 5.5.2 (swiftlang-1300.0.47.5 clang-1300.0.29.30)
+// swift-module-flags: -target armv7-apple-ios9.0 -enable-objc-interop -enable-library-evolution -swift-version 5 -enforce-exclusivity=checked -O -module-name DCloudAlertController
+@_exported import DCloudAlertController
+import Foundation
+import Swift
+import UIKit
+import _Concurrency
+public enum DCAlertActionStyle : Swift.Int {
+ case defaultStyle
+ case cancelStyle
+ case destructiveStyle
+ case preferredStyle
+ public init?(rawValue: Swift.Int)
+ public typealias RawValue = Swift.Int
+ public var rawValue: Swift.Int {
+ get
+ }
+}
+public enum DCAlertImagePosition : Swift.Int {
+ case null
+ case topCenter
+ case leftTopCenter
+ public init?(rawValue: Swift.Int)
+ public typealias RawValue = Swift.Int
+ public var rawValue: Swift.Int {
+ get
+ }
+}
+@objc public class DCAlertAction : ObjectiveC.NSObject {
+ public var title: Swift.String?
+ public var titleColor: UIKit.UIColor? {
+ get
+ set
+ }
+ public var style: DCloudAlertController.DCAlertActionStyle
+ weak public var button: UIKit.UIButton?
+ public var handler: (_ action: DCloudAlertController.DCAlertAction) -> Swift.Void
+ public var enabled: Swift.Bool {
+ get
+ set
+ }
+ public init(title: Swift.String, style: DCloudAlertController.DCAlertActionStyle, handler: @escaping (_ action: DCloudAlertController.DCAlertAction) -> Swift.Void)
+ @objc deinit
+}
+@objc @_inheritsConvenienceInitializers @_Concurrency.MainActor(unsafe) public class DCAlertActionButton : UIKit.UIButton {
+ @_Concurrency.MainActor(unsafe) @objc override dynamic public init(frame: CoreGraphics.CGRect)
+ @_Concurrency.MainActor(unsafe) @objc required dynamic public init?(coder: Foundation.NSCoder)
+ @objc deinit
+}
+public protocol DCAlertControllerContentViewProtocol : ObjectiveC.NSObject {
+ var titleLabel: UIKit.UILabel { get set }
+ var messageLabel: UIKit.UITextView { get set }
+ var title: Swift.String? { get set }
+ var message: Swift.String? { get set }
+ var image: UIKit.UIImage? { get set }
+ var customView: UIKit.UIView? { get set }
+ var imagePositon: DCloudAlertController.DCAlertImagePosition? { get set }
+ var buttons: [DCloudAlertController.DCAlertActionButton] { get }
+ var actionClickedHandler: ((_ action: DCloudAlertController.DCAlertAction) -> Swift.Void)? { get set }
+ func addAction(_ action: DCloudAlertController.DCAlertAction)
+ func setHairLineColor(_ hairLineColor: UIKit.UIColor?)
+}
+@objc @_inheritsConvenienceInitializers public class DCRIButtonItem : ObjectiveC.NSObject {
+ public static func item() -> DCloudAlertController.DCRIButtonItem
+ public static func itemWithLabel(_ inLabel: Swift.String) -> DCloudAlertController.DCRIButtonItem
+ public static func itemWithLabel(_ inLabel: Swift.String, _ labelColor: UIKit.UIColor? = nil, inAction action: @escaping (() -> Swift.Void)) -> DCloudAlertController.DCRIButtonItem
+ @objc override dynamic public init()
+ @objc deinit
+}
+@objc @_hasMissingDesignatedInitializers @_Concurrency.MainActor(unsafe) public class DCActionSheetController : UIKit.UIViewController {
+ @_Concurrency.MainActor(unsafe) public init(noticeTitle: Swift.String)
+ @_Concurrency.MainActor(unsafe) @objc override dynamic public func loadView()
+ @_Concurrency.MainActor(unsafe) @objc override dynamic public func viewDidLoad()
+ @_Concurrency.MainActor(unsafe) @objc override dynamic public func viewDidLayoutSubviews()
+ @_Concurrency.MainActor(unsafe) public func addAction(_ action: DCloudAlertController.DCAlertAction)
+ @_Concurrency.MainActor(unsafe) public func addAction(_ title: Swift.String, _ style: DCloudAlertController.DCAlertActionStyle, _ handler: @escaping (_ action: DCloudAlertController.DCAlertAction) -> Swift.Void) -> DCloudAlertController.DCAlertAction
+ @_Concurrency.MainActor(unsafe) public func show()
+ @objc deinit
+}
+extension DCloudAlertController.DCActionSheetController : UIKit.UITableViewDelegate, UIKit.UITableViewDataSource {
+ @_Concurrency.MainActor(unsafe) @objc dynamic public func numberOfSections(in tableView: UIKit.UITableView) -> Swift.Int
+ @_Concurrency.MainActor(unsafe) @objc dynamic public func tableView(_ tableView: UIKit.UITableView, numberOfRowsInSection section: Swift.Int) -> Swift.Int
+ @_Concurrency.MainActor(unsafe) @objc dynamic public func tableView(_ tableView: UIKit.UITableView, cellForRowAt indexPath: Foundation.IndexPath) -> UIKit.UITableViewCell
+ @_Concurrency.MainActor(unsafe) @objc dynamic public func tableView(_ tableView: UIKit.UITableView, didSelectRowAt indexPath: Foundation.IndexPath)
+ @_Concurrency.MainActor(unsafe) @objc dynamic public func tableView(_ tableView: UIKit.UITableView, heightForRowAt indexPath: Foundation.IndexPath) -> CoreGraphics.CGFloat
+ @_Concurrency.MainActor(unsafe) @objc dynamic public func tableView(_ tableView: UIKit.UITableView, heightForFooterInSection section: Swift.Int) -> CoreGraphics.CGFloat
+ @_Concurrency.MainActor(unsafe) @objc dynamic public func tableView(_ tableView: UIKit.UITableView, viewForFooterInSection section: Swift.Int) -> UIKit.UIView?
+}
+public enum DCAlertViewControllerStyle : Swift.Int {
+ case alert
+ case textViewAlert
+ public init?(rawValue: Swift.Int)
+ public typealias RawValue = Swift.Int
+ public var rawValue: Swift.Int {
+ get
+ }
+}
+public protocol DCAlertViewControllerDismissDelegate : UIKit.UITextViewDelegate {
+ func canDismissWithAction(_ action: DCloudAlertController.DCAlertAction?, _ param: Any?) -> Swift.Bool
+}
+@objc @_hasMissingDesignatedInitializers @_Concurrency.MainActor(unsafe) public class DCAlertViewController : UIKit.UIViewController {
+ @_Concurrency.MainActor(unsafe) public var canOpenDarkMode: Swift.Bool
+ @_Concurrency.MainActor(unsafe) public var contentViewVisible: Swift.Bool {
+ get
+ set
+ }
+ @_Concurrency.MainActor(unsafe) public var mesageTitle: Swift.String? {
+ get
+ set
+ }
+ @_Concurrency.MainActor(unsafe) public var message: Swift.String? {
+ get
+ set
+ }
+ @_Concurrency.MainActor(unsafe) public var textViewText: Swift.String? {
+ get
+ }
+ @_Concurrency.MainActor(unsafe) public var textView: UIKit.UITextView? {
+ get
+ }
+ @_Concurrency.MainActor(unsafe) weak public var dismissDelegate: DCloudAlertController.DCAlertViewControllerDismissDelegate? {
+ get
+ set
+ }
+ @_Concurrency.MainActor(unsafe) public var preferredStyle: DCloudAlertController.DCAlertViewControllerStyle
+ @_Concurrency.MainActor(unsafe) public var tapGesture: UIKit.UITapGestureRecognizer?
+ @_Concurrency.MainActor(unsafe) public var contentView: (UIKit.UIView & DCloudAlertController.DCAlertControllerContentViewProtocol)?
+ @objc deinit
+ @_Concurrency.MainActor(unsafe) public init(_ title: Swift.String?, _ message: Swift.String?, _ preferredStyle: DCloudAlertController.DCAlertViewControllerStyle, _ placeholder: Swift.String?)
+ @_Concurrency.MainActor(unsafe) public init(_ customView: UIKit.UIView & DCloudAlertController.DCAlertControllerContentViewProtocol, _ preferredStyle: DCloudAlertController.DCAlertViewControllerStyle)
+ @_Concurrency.MainActor(unsafe) @objc override dynamic public func loadView()
+ @_Concurrency.MainActor(unsafe) @objc override dynamic public func viewWillLayoutSubviews()
+ @_Concurrency.MainActor(unsafe) @objc override dynamic public func viewDidLoad()
+ @_Concurrency.MainActor(unsafe) public func alertControllerWithTitle(_ title: Swift.String?, _ message: Swift.String?, _ preferredStyle: DCloudAlertController.DCAlertViewControllerStyle, _ placeholder: Swift.String?) -> DCloudAlertController.DCAlertViewController
+ @_Concurrency.MainActor(unsafe) public func alertControllerWithCustomView(_ view: UIKit.UIView & DCloudAlertController.DCAlertControllerContentViewProtocol, _ preferredStyle: DCloudAlertController.DCAlertViewControllerStyle) -> DCloudAlertController.DCAlertViewController
+ @_Concurrency.MainActor(unsafe) public func addActionWithTitle(_ title: Foundation.NSString, _ style: DCloudAlertController.DCAlertActionStyle, _ handler: @escaping (_ action: DCloudAlertController.DCAlertAction) -> Swift.Void) -> DCloudAlertController.DCAlertAction
+ @_Concurrency.MainActor(unsafe) public func addImage(_ image: UIKit.UIImage, _ position: DCloudAlertController.DCAlertImagePosition)
+ @_Concurrency.MainActor(unsafe) public func addCustomView(_ customView: UIKit.UIView)
+ @_Concurrency.MainActor(unsafe) public func addAction(_ action: DCloudAlertController.DCAlertAction)
+ @_Concurrency.MainActor(unsafe) public func addTapGesture()
+ @_Concurrency.MainActor(unsafe) public func onTapAction(_ action: DCloudAlertController.DCAlertAction)
+ @_Concurrency.MainActor(unsafe) public func resetDoneBtnTitleColor(_ color: UIKit.UIColor)
+}
+extension DCloudAlertController.DCAlertViewController : UIKit.UIViewControllerTransitioningDelegate {
+ @_Concurrency.MainActor(unsafe) @objc dynamic public func animationController(forPresented presented: UIKit.UIViewController, presenting: UIKit.UIViewController, source: UIKit.UIViewController) -> UIKit.UIViewControllerAnimatedTransitioning?
+ @_Concurrency.MainActor(unsafe) @objc dynamic public func animationController(forDismissed dismissed: UIKit.UIViewController) -> UIKit.UIViewControllerAnimatedTransitioning?
+}
+public typealias DCAlertView = DCloudAlertController.DCAlertViewController
+extension DCloudAlertController.DCAlertViewController {
+ @_Concurrency.MainActor(unsafe) public func show()
+ @_Concurrency.MainActor(unsafe) public func dismiss()
+ @_Concurrency.MainActor(unsafe) public static func alertView(_ title: Swift.String, _ doneItem: DCloudAlertController.DCRIButtonItem, _ preferredStyle: DCloudAlertController.DCAlertViewControllerStyle = .alert, _ placeholder: Swift.String = "") -> DCloudAlertController.DCAlertView
+ @_Concurrency.MainActor(unsafe) public static func alertView(_ title: Swift.String?, _ cancelItem: DCloudAlertController.DCRIButtonItem, _ doneItem: DCloudAlertController.DCRIButtonItem, _ preferredStyle: DCloudAlertController.DCAlertViewControllerStyle = .alert, _ placeholder: Swift.String = "") -> DCloudAlertController.DCAlertView
+ @_Concurrency.MainActor(unsafe) public static func alertView(_ title: Swift.String?, _ subTitle: Swift.String?, _ doneItem: DCloudAlertController.DCRIButtonItem, _ preferredStyle: DCloudAlertController.DCAlertViewControllerStyle = .alert, _ placeholder: Swift.String = "") -> DCloudAlertController.DCAlertView
+ @_Concurrency.MainActor(unsafe) public static func alertView(_ title: Swift.String?, _ subTitle: Swift.String?, _ cancelItem: DCloudAlertController.DCRIButtonItem, _ doneItem: DCloudAlertController.DCRIButtonItem, _ preferredStyle: DCloudAlertController.DCAlertViewControllerStyle = .alert, _ placeholder: Swift.String = "") -> DCloudAlertController.DCAlertView
+ @_Concurrency.MainActor(unsafe) public static func alertView(_ title: Swift.String?, _ subTitle: Swift.String?, _ cancelItem: DCloudAlertController.DCRIButtonItem, _ cancelActionStyle: DCloudAlertController.DCAlertActionStyle, _ doneItem: DCloudAlertController.DCRIButtonItem, _ doneActionStyle: DCloudAlertController.DCAlertActionStyle, _ preferredStyle: DCloudAlertController.DCAlertViewControllerStyle, _ placeholder: Swift.String = "") -> DCloudAlertController.DCAlertView
+}
+extension DCloudAlertController.DCAlertActionStyle : Swift.Equatable {}
+extension DCloudAlertController.DCAlertActionStyle : Swift.Hashable {}
+extension DCloudAlertController.DCAlertActionStyle : Swift.RawRepresentable {}
+extension DCloudAlertController.DCAlertImagePosition : Swift.Equatable {}
+extension DCloudAlertController.DCAlertImagePosition : Swift.Hashable {}
+extension DCloudAlertController.DCAlertImagePosition : Swift.RawRepresentable {}
+extension DCloudAlertController.DCAlertViewControllerStyle : Swift.Equatable {}
+extension DCloudAlertController.DCAlertViewControllerStyle : Swift.Hashable {}
+extension DCloudAlertController.DCAlertViewControllerStyle : Swift.RawRepresentable {}
diff --git a/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCloudAlertController.framework/Modules/DCloudAlertController.swiftmodule/armv7-apple-ios.swiftmodule b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCloudAlertController.framework/Modules/DCloudAlertController.swiftmodule/armv7-apple-ios.swiftmodule
new file mode 100644
index 0000000000000000000000000000000000000000..d76b82309f5ad5a128ec5264d0aa21a08b330a03
Binary files /dev/null and b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCloudAlertController.framework/Modules/DCloudAlertController.swiftmodule/armv7-apple-ios.swiftmodule differ
diff --git a/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCloudAlertController.framework/Modules/DCloudAlertController.swiftmodule/armv7.swiftdoc b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCloudAlertController.framework/Modules/DCloudAlertController.swiftmodule/armv7.swiftdoc
new file mode 100644
index 0000000000000000000000000000000000000000..4fcdf0f81a4f3cd1c3ea559962f7773266b7ac6f
Binary files /dev/null and b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCloudAlertController.framework/Modules/DCloudAlertController.swiftmodule/armv7.swiftdoc differ
diff --git a/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCloudAlertController.framework/Modules/DCloudAlertController.swiftmodule/armv7.swiftinterface b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCloudAlertController.framework/Modules/DCloudAlertController.swiftmodule/armv7.swiftinterface
new file mode 100644
index 0000000000000000000000000000000000000000..011b08a57972f7044b26426ccc604c57178ccc54
--- /dev/null
+++ b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCloudAlertController.framework/Modules/DCloudAlertController.swiftmodule/armv7.swiftinterface
@@ -0,0 +1,167 @@
+// swift-interface-format-version: 1.0
+// swift-compiler-version: Apple Swift version 5.5.2 (swiftlang-1300.0.47.5 clang-1300.0.29.30)
+// swift-module-flags: -target armv7-apple-ios9.0 -enable-objc-interop -enable-library-evolution -swift-version 5 -enforce-exclusivity=checked -O -module-name DCloudAlertController
+@_exported import DCloudAlertController
+import Foundation
+import Swift
+import UIKit
+import _Concurrency
+public enum DCAlertActionStyle : Swift.Int {
+ case defaultStyle
+ case cancelStyle
+ case destructiveStyle
+ case preferredStyle
+ public init?(rawValue: Swift.Int)
+ public typealias RawValue = Swift.Int
+ public var rawValue: Swift.Int {
+ get
+ }
+}
+public enum DCAlertImagePosition : Swift.Int {
+ case null
+ case topCenter
+ case leftTopCenter
+ public init?(rawValue: Swift.Int)
+ public typealias RawValue = Swift.Int
+ public var rawValue: Swift.Int {
+ get
+ }
+}
+@objc public class DCAlertAction : ObjectiveC.NSObject {
+ public var title: Swift.String?
+ public var titleColor: UIKit.UIColor? {
+ get
+ set
+ }
+ public var style: DCloudAlertController.DCAlertActionStyle
+ weak public var button: UIKit.UIButton?
+ public var handler: (_ action: DCloudAlertController.DCAlertAction) -> Swift.Void
+ public var enabled: Swift.Bool {
+ get
+ set
+ }
+ public init(title: Swift.String, style: DCloudAlertController.DCAlertActionStyle, handler: @escaping (_ action: DCloudAlertController.DCAlertAction) -> Swift.Void)
+ @objc deinit
+}
+@objc @_inheritsConvenienceInitializers @_Concurrency.MainActor(unsafe) public class DCAlertActionButton : UIKit.UIButton {
+ @_Concurrency.MainActor(unsafe) @objc override dynamic public init(frame: CoreGraphics.CGRect)
+ @_Concurrency.MainActor(unsafe) @objc required dynamic public init?(coder: Foundation.NSCoder)
+ @objc deinit
+}
+public protocol DCAlertControllerContentViewProtocol : ObjectiveC.NSObject {
+ var titleLabel: UIKit.UILabel { get set }
+ var messageLabel: UIKit.UITextView { get set }
+ var title: Swift.String? { get set }
+ var message: Swift.String? { get set }
+ var image: UIKit.UIImage? { get set }
+ var customView: UIKit.UIView? { get set }
+ var imagePositon: DCloudAlertController.DCAlertImagePosition? { get set }
+ var buttons: [DCloudAlertController.DCAlertActionButton] { get }
+ var actionClickedHandler: ((_ action: DCloudAlertController.DCAlertAction) -> Swift.Void)? { get set }
+ func addAction(_ action: DCloudAlertController.DCAlertAction)
+ func setHairLineColor(_ hairLineColor: UIKit.UIColor?)
+}
+@objc @_inheritsConvenienceInitializers public class DCRIButtonItem : ObjectiveC.NSObject {
+ public static func item() -> DCloudAlertController.DCRIButtonItem
+ public static func itemWithLabel(_ inLabel: Swift.String) -> DCloudAlertController.DCRIButtonItem
+ public static func itemWithLabel(_ inLabel: Swift.String, _ labelColor: UIKit.UIColor? = nil, inAction action: @escaping (() -> Swift.Void)) -> DCloudAlertController.DCRIButtonItem
+ @objc override dynamic public init()
+ @objc deinit
+}
+@objc @_hasMissingDesignatedInitializers @_Concurrency.MainActor(unsafe) public class DCActionSheetController : UIKit.UIViewController {
+ @_Concurrency.MainActor(unsafe) public init(noticeTitle: Swift.String)
+ @_Concurrency.MainActor(unsafe) @objc override dynamic public func loadView()
+ @_Concurrency.MainActor(unsafe) @objc override dynamic public func viewDidLoad()
+ @_Concurrency.MainActor(unsafe) @objc override dynamic public func viewDidLayoutSubviews()
+ @_Concurrency.MainActor(unsafe) public func addAction(_ action: DCloudAlertController.DCAlertAction)
+ @_Concurrency.MainActor(unsafe) public func addAction(_ title: Swift.String, _ style: DCloudAlertController.DCAlertActionStyle, _ handler: @escaping (_ action: DCloudAlertController.DCAlertAction) -> Swift.Void) -> DCloudAlertController.DCAlertAction
+ @_Concurrency.MainActor(unsafe) public func show()
+ @objc deinit
+}
+extension DCloudAlertController.DCActionSheetController : UIKit.UITableViewDelegate, UIKit.UITableViewDataSource {
+ @_Concurrency.MainActor(unsafe) @objc dynamic public func numberOfSections(in tableView: UIKit.UITableView) -> Swift.Int
+ @_Concurrency.MainActor(unsafe) @objc dynamic public func tableView(_ tableView: UIKit.UITableView, numberOfRowsInSection section: Swift.Int) -> Swift.Int
+ @_Concurrency.MainActor(unsafe) @objc dynamic public func tableView(_ tableView: UIKit.UITableView, cellForRowAt indexPath: Foundation.IndexPath) -> UIKit.UITableViewCell
+ @_Concurrency.MainActor(unsafe) @objc dynamic public func tableView(_ tableView: UIKit.UITableView, didSelectRowAt indexPath: Foundation.IndexPath)
+ @_Concurrency.MainActor(unsafe) @objc dynamic public func tableView(_ tableView: UIKit.UITableView, heightForRowAt indexPath: Foundation.IndexPath) -> CoreGraphics.CGFloat
+ @_Concurrency.MainActor(unsafe) @objc dynamic public func tableView(_ tableView: UIKit.UITableView, heightForFooterInSection section: Swift.Int) -> CoreGraphics.CGFloat
+ @_Concurrency.MainActor(unsafe) @objc dynamic public func tableView(_ tableView: UIKit.UITableView, viewForFooterInSection section: Swift.Int) -> UIKit.UIView?
+}
+public enum DCAlertViewControllerStyle : Swift.Int {
+ case alert
+ case textViewAlert
+ public init?(rawValue: Swift.Int)
+ public typealias RawValue = Swift.Int
+ public var rawValue: Swift.Int {
+ get
+ }
+}
+public protocol DCAlertViewControllerDismissDelegate : UIKit.UITextViewDelegate {
+ func canDismissWithAction(_ action: DCloudAlertController.DCAlertAction?, _ param: Any?) -> Swift.Bool
+}
+@objc @_hasMissingDesignatedInitializers @_Concurrency.MainActor(unsafe) public class DCAlertViewController : UIKit.UIViewController {
+ @_Concurrency.MainActor(unsafe) public var canOpenDarkMode: Swift.Bool
+ @_Concurrency.MainActor(unsafe) public var contentViewVisible: Swift.Bool {
+ get
+ set
+ }
+ @_Concurrency.MainActor(unsafe) public var mesageTitle: Swift.String? {
+ get
+ set
+ }
+ @_Concurrency.MainActor(unsafe) public var message: Swift.String? {
+ get
+ set
+ }
+ @_Concurrency.MainActor(unsafe) public var textViewText: Swift.String? {
+ get
+ }
+ @_Concurrency.MainActor(unsafe) public var textView: UIKit.UITextView? {
+ get
+ }
+ @_Concurrency.MainActor(unsafe) weak public var dismissDelegate: DCloudAlertController.DCAlertViewControllerDismissDelegate? {
+ get
+ set
+ }
+ @_Concurrency.MainActor(unsafe) public var preferredStyle: DCloudAlertController.DCAlertViewControllerStyle
+ @_Concurrency.MainActor(unsafe) public var tapGesture: UIKit.UITapGestureRecognizer?
+ @_Concurrency.MainActor(unsafe) public var contentView: (UIKit.UIView & DCloudAlertController.DCAlertControllerContentViewProtocol)?
+ @objc deinit
+ @_Concurrency.MainActor(unsafe) public init(_ title: Swift.String?, _ message: Swift.String?, _ preferredStyle: DCloudAlertController.DCAlertViewControllerStyle, _ placeholder: Swift.String?)
+ @_Concurrency.MainActor(unsafe) public init(_ customView: UIKit.UIView & DCloudAlertController.DCAlertControllerContentViewProtocol, _ preferredStyle: DCloudAlertController.DCAlertViewControllerStyle)
+ @_Concurrency.MainActor(unsafe) @objc override dynamic public func loadView()
+ @_Concurrency.MainActor(unsafe) @objc override dynamic public func viewWillLayoutSubviews()
+ @_Concurrency.MainActor(unsafe) @objc override dynamic public func viewDidLoad()
+ @_Concurrency.MainActor(unsafe) public func alertControllerWithTitle(_ title: Swift.String?, _ message: Swift.String?, _ preferredStyle: DCloudAlertController.DCAlertViewControllerStyle, _ placeholder: Swift.String?) -> DCloudAlertController.DCAlertViewController
+ @_Concurrency.MainActor(unsafe) public func alertControllerWithCustomView(_ view: UIKit.UIView & DCloudAlertController.DCAlertControllerContentViewProtocol, _ preferredStyle: DCloudAlertController.DCAlertViewControllerStyle) -> DCloudAlertController.DCAlertViewController
+ @_Concurrency.MainActor(unsafe) public func addActionWithTitle(_ title: Foundation.NSString, _ style: DCloudAlertController.DCAlertActionStyle, _ handler: @escaping (_ action: DCloudAlertController.DCAlertAction) -> Swift.Void) -> DCloudAlertController.DCAlertAction
+ @_Concurrency.MainActor(unsafe) public func addImage(_ image: UIKit.UIImage, _ position: DCloudAlertController.DCAlertImagePosition)
+ @_Concurrency.MainActor(unsafe) public func addCustomView(_ customView: UIKit.UIView)
+ @_Concurrency.MainActor(unsafe) public func addAction(_ action: DCloudAlertController.DCAlertAction)
+ @_Concurrency.MainActor(unsafe) public func addTapGesture()
+ @_Concurrency.MainActor(unsafe) public func onTapAction(_ action: DCloudAlertController.DCAlertAction)
+ @_Concurrency.MainActor(unsafe) public func resetDoneBtnTitleColor(_ color: UIKit.UIColor)
+}
+extension DCloudAlertController.DCAlertViewController : UIKit.UIViewControllerTransitioningDelegate {
+ @_Concurrency.MainActor(unsafe) @objc dynamic public func animationController(forPresented presented: UIKit.UIViewController, presenting: UIKit.UIViewController, source: UIKit.UIViewController) -> UIKit.UIViewControllerAnimatedTransitioning?
+ @_Concurrency.MainActor(unsafe) @objc dynamic public func animationController(forDismissed dismissed: UIKit.UIViewController) -> UIKit.UIViewControllerAnimatedTransitioning?
+}
+public typealias DCAlertView = DCloudAlertController.DCAlertViewController
+extension DCloudAlertController.DCAlertViewController {
+ @_Concurrency.MainActor(unsafe) public func show()
+ @_Concurrency.MainActor(unsafe) public func dismiss()
+ @_Concurrency.MainActor(unsafe) public static func alertView(_ title: Swift.String, _ doneItem: DCloudAlertController.DCRIButtonItem, _ preferredStyle: DCloudAlertController.DCAlertViewControllerStyle = .alert, _ placeholder: Swift.String = "") -> DCloudAlertController.DCAlertView
+ @_Concurrency.MainActor(unsafe) public static func alertView(_ title: Swift.String?, _ cancelItem: DCloudAlertController.DCRIButtonItem, _ doneItem: DCloudAlertController.DCRIButtonItem, _ preferredStyle: DCloudAlertController.DCAlertViewControllerStyle = .alert, _ placeholder: Swift.String = "") -> DCloudAlertController.DCAlertView
+ @_Concurrency.MainActor(unsafe) public static func alertView(_ title: Swift.String?, _ subTitle: Swift.String?, _ doneItem: DCloudAlertController.DCRIButtonItem, _ preferredStyle: DCloudAlertController.DCAlertViewControllerStyle = .alert, _ placeholder: Swift.String = "") -> DCloudAlertController.DCAlertView
+ @_Concurrency.MainActor(unsafe) public static func alertView(_ title: Swift.String?, _ subTitle: Swift.String?, _ cancelItem: DCloudAlertController.DCRIButtonItem, _ doneItem: DCloudAlertController.DCRIButtonItem, _ preferredStyle: DCloudAlertController.DCAlertViewControllerStyle = .alert, _ placeholder: Swift.String = "") -> DCloudAlertController.DCAlertView
+ @_Concurrency.MainActor(unsafe) public static func alertView(_ title: Swift.String?, _ subTitle: Swift.String?, _ cancelItem: DCloudAlertController.DCRIButtonItem, _ cancelActionStyle: DCloudAlertController.DCAlertActionStyle, _ doneItem: DCloudAlertController.DCRIButtonItem, _ doneActionStyle: DCloudAlertController.DCAlertActionStyle, _ preferredStyle: DCloudAlertController.DCAlertViewControllerStyle, _ placeholder: Swift.String = "") -> DCloudAlertController.DCAlertView
+}
+extension DCloudAlertController.DCAlertActionStyle : Swift.Equatable {}
+extension DCloudAlertController.DCAlertActionStyle : Swift.Hashable {}
+extension DCloudAlertController.DCAlertActionStyle : Swift.RawRepresentable {}
+extension DCloudAlertController.DCAlertImagePosition : Swift.Equatable {}
+extension DCloudAlertController.DCAlertImagePosition : Swift.Hashable {}
+extension DCloudAlertController.DCAlertImagePosition : Swift.RawRepresentable {}
+extension DCloudAlertController.DCAlertViewControllerStyle : Swift.Equatable {}
+extension DCloudAlertController.DCAlertViewControllerStyle : Swift.Hashable {}
+extension DCloudAlertController.DCAlertViewControllerStyle : Swift.RawRepresentable {}
diff --git a/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCloudAlertController.framework/Modules/DCloudAlertController.swiftmodule/armv7.swiftmodule b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCloudAlertController.framework/Modules/DCloudAlertController.swiftmodule/armv7.swiftmodule
new file mode 100644
index 0000000000000000000000000000000000000000..d76b82309f5ad5a128ec5264d0aa21a08b330a03
Binary files /dev/null and b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCloudAlertController.framework/Modules/DCloudAlertController.swiftmodule/armv7.swiftmodule differ
diff --git a/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCloudAlertController.framework/Modules/DCloudAlertController.swiftmodule/i386-apple-ios-simulator.swiftdoc b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCloudAlertController.framework/Modules/DCloudAlertController.swiftmodule/i386-apple-ios-simulator.swiftdoc
new file mode 100644
index 0000000000000000000000000000000000000000..12ee779a3bb37522508df6d29c27e966fae0703a
Binary files /dev/null and b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCloudAlertController.framework/Modules/DCloudAlertController.swiftmodule/i386-apple-ios-simulator.swiftdoc differ
diff --git a/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCloudAlertController.framework/Modules/DCloudAlertController.swiftmodule/i386-apple-ios-simulator.swiftinterface b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCloudAlertController.framework/Modules/DCloudAlertController.swiftmodule/i386-apple-ios-simulator.swiftinterface
new file mode 100644
index 0000000000000000000000000000000000000000..05592a796a200afbe765e57e27c5cbed4463c151
--- /dev/null
+++ b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCloudAlertController.framework/Modules/DCloudAlertController.swiftmodule/i386-apple-ios-simulator.swiftinterface
@@ -0,0 +1,167 @@
+// swift-interface-format-version: 1.0
+// swift-compiler-version: Apple Swift version 5.5.2 (swiftlang-1300.0.47.5 clang-1300.0.29.30)
+// swift-module-flags: -target i386-apple-ios9.0-simulator -enable-objc-interop -enable-library-evolution -swift-version 5 -enforce-exclusivity=checked -O -module-name DCloudAlertController
+@_exported import DCloudAlertController
+import Foundation
+import Swift
+import UIKit
+import _Concurrency
+public enum DCAlertActionStyle : Swift.Int {
+ case defaultStyle
+ case cancelStyle
+ case destructiveStyle
+ case preferredStyle
+ public init?(rawValue: Swift.Int)
+ public typealias RawValue = Swift.Int
+ public var rawValue: Swift.Int {
+ get
+ }
+}
+public enum DCAlertImagePosition : Swift.Int {
+ case null
+ case topCenter
+ case leftTopCenter
+ public init?(rawValue: Swift.Int)
+ public typealias RawValue = Swift.Int
+ public var rawValue: Swift.Int {
+ get
+ }
+}
+@objc public class DCAlertAction : ObjectiveC.NSObject {
+ public var title: Swift.String?
+ public var titleColor: UIKit.UIColor? {
+ get
+ set
+ }
+ public var style: DCloudAlertController.DCAlertActionStyle
+ weak public var button: UIKit.UIButton?
+ public var handler: (_ action: DCloudAlertController.DCAlertAction) -> Swift.Void
+ public var enabled: Swift.Bool {
+ get
+ set
+ }
+ public init(title: Swift.String, style: DCloudAlertController.DCAlertActionStyle, handler: @escaping (_ action: DCloudAlertController.DCAlertAction) -> Swift.Void)
+ @objc deinit
+}
+@objc @_inheritsConvenienceInitializers @_Concurrency.MainActor(unsafe) public class DCAlertActionButton : UIKit.UIButton {
+ @_Concurrency.MainActor(unsafe) @objc override dynamic public init(frame: CoreGraphics.CGRect)
+ @_Concurrency.MainActor(unsafe) @objc required dynamic public init?(coder: Foundation.NSCoder)
+ @objc deinit
+}
+public protocol DCAlertControllerContentViewProtocol : ObjectiveC.NSObject {
+ var titleLabel: UIKit.UILabel { get set }
+ var messageLabel: UIKit.UITextView { get set }
+ var title: Swift.String? { get set }
+ var message: Swift.String? { get set }
+ var image: UIKit.UIImage? { get set }
+ var customView: UIKit.UIView? { get set }
+ var imagePositon: DCloudAlertController.DCAlertImagePosition? { get set }
+ var buttons: [DCloudAlertController.DCAlertActionButton] { get }
+ var actionClickedHandler: ((_ action: DCloudAlertController.DCAlertAction) -> Swift.Void)? { get set }
+ func addAction(_ action: DCloudAlertController.DCAlertAction)
+ func setHairLineColor(_ hairLineColor: UIKit.UIColor?)
+}
+@objc @_inheritsConvenienceInitializers public class DCRIButtonItem : ObjectiveC.NSObject {
+ public static func item() -> DCloudAlertController.DCRIButtonItem
+ public static func itemWithLabel(_ inLabel: Swift.String) -> DCloudAlertController.DCRIButtonItem
+ public static func itemWithLabel(_ inLabel: Swift.String, _ labelColor: UIKit.UIColor? = nil, inAction action: @escaping (() -> Swift.Void)) -> DCloudAlertController.DCRIButtonItem
+ @objc override dynamic public init()
+ @objc deinit
+}
+@objc @_hasMissingDesignatedInitializers @_Concurrency.MainActor(unsafe) public class DCActionSheetController : UIKit.UIViewController {
+ @_Concurrency.MainActor(unsafe) public init(noticeTitle: Swift.String)
+ @_Concurrency.MainActor(unsafe) @objc override dynamic public func loadView()
+ @_Concurrency.MainActor(unsafe) @objc override dynamic public func viewDidLoad()
+ @_Concurrency.MainActor(unsafe) @objc override dynamic public func viewDidLayoutSubviews()
+ @_Concurrency.MainActor(unsafe) public func addAction(_ action: DCloudAlertController.DCAlertAction)
+ @_Concurrency.MainActor(unsafe) public func addAction(_ title: Swift.String, _ style: DCloudAlertController.DCAlertActionStyle, _ handler: @escaping (_ action: DCloudAlertController.DCAlertAction) -> Swift.Void) -> DCloudAlertController.DCAlertAction
+ @_Concurrency.MainActor(unsafe) public func show()
+ @objc deinit
+}
+extension DCloudAlertController.DCActionSheetController : UIKit.UITableViewDelegate, UIKit.UITableViewDataSource {
+ @_Concurrency.MainActor(unsafe) @objc dynamic public func numberOfSections(in tableView: UIKit.UITableView) -> Swift.Int
+ @_Concurrency.MainActor(unsafe) @objc dynamic public func tableView(_ tableView: UIKit.UITableView, numberOfRowsInSection section: Swift.Int) -> Swift.Int
+ @_Concurrency.MainActor(unsafe) @objc dynamic public func tableView(_ tableView: UIKit.UITableView, cellForRowAt indexPath: Foundation.IndexPath) -> UIKit.UITableViewCell
+ @_Concurrency.MainActor(unsafe) @objc dynamic public func tableView(_ tableView: UIKit.UITableView, didSelectRowAt indexPath: Foundation.IndexPath)
+ @_Concurrency.MainActor(unsafe) @objc dynamic public func tableView(_ tableView: UIKit.UITableView, heightForRowAt indexPath: Foundation.IndexPath) -> CoreGraphics.CGFloat
+ @_Concurrency.MainActor(unsafe) @objc dynamic public func tableView(_ tableView: UIKit.UITableView, heightForFooterInSection section: Swift.Int) -> CoreGraphics.CGFloat
+ @_Concurrency.MainActor(unsafe) @objc dynamic public func tableView(_ tableView: UIKit.UITableView, viewForFooterInSection section: Swift.Int) -> UIKit.UIView?
+}
+public enum DCAlertViewControllerStyle : Swift.Int {
+ case alert
+ case textViewAlert
+ public init?(rawValue: Swift.Int)
+ public typealias RawValue = Swift.Int
+ public var rawValue: Swift.Int {
+ get
+ }
+}
+public protocol DCAlertViewControllerDismissDelegate : UIKit.UITextViewDelegate {
+ func canDismissWithAction(_ action: DCloudAlertController.DCAlertAction?, _ param: Any?) -> Swift.Bool
+}
+@objc @_hasMissingDesignatedInitializers @_Concurrency.MainActor(unsafe) public class DCAlertViewController : UIKit.UIViewController {
+ @_Concurrency.MainActor(unsafe) public var canOpenDarkMode: Swift.Bool
+ @_Concurrency.MainActor(unsafe) public var contentViewVisible: Swift.Bool {
+ get
+ set
+ }
+ @_Concurrency.MainActor(unsafe) public var mesageTitle: Swift.String? {
+ get
+ set
+ }
+ @_Concurrency.MainActor(unsafe) public var message: Swift.String? {
+ get
+ set
+ }
+ @_Concurrency.MainActor(unsafe) public var textViewText: Swift.String? {
+ get
+ }
+ @_Concurrency.MainActor(unsafe) public var textView: UIKit.UITextView? {
+ get
+ }
+ @_Concurrency.MainActor(unsafe) weak public var dismissDelegate: DCloudAlertController.DCAlertViewControllerDismissDelegate? {
+ get
+ set
+ }
+ @_Concurrency.MainActor(unsafe) public var preferredStyle: DCloudAlertController.DCAlertViewControllerStyle
+ @_Concurrency.MainActor(unsafe) public var tapGesture: UIKit.UITapGestureRecognizer?
+ @_Concurrency.MainActor(unsafe) public var contentView: (UIKit.UIView & DCloudAlertController.DCAlertControllerContentViewProtocol)?
+ @objc deinit
+ @_Concurrency.MainActor(unsafe) public init(_ title: Swift.String?, _ message: Swift.String?, _ preferredStyle: DCloudAlertController.DCAlertViewControllerStyle, _ placeholder: Swift.String?)
+ @_Concurrency.MainActor(unsafe) public init(_ customView: UIKit.UIView & DCloudAlertController.DCAlertControllerContentViewProtocol, _ preferredStyle: DCloudAlertController.DCAlertViewControllerStyle)
+ @_Concurrency.MainActor(unsafe) @objc override dynamic public func loadView()
+ @_Concurrency.MainActor(unsafe) @objc override dynamic public func viewWillLayoutSubviews()
+ @_Concurrency.MainActor(unsafe) @objc override dynamic public func viewDidLoad()
+ @_Concurrency.MainActor(unsafe) public func alertControllerWithTitle(_ title: Swift.String?, _ message: Swift.String?, _ preferredStyle: DCloudAlertController.DCAlertViewControllerStyle, _ placeholder: Swift.String?) -> DCloudAlertController.DCAlertViewController
+ @_Concurrency.MainActor(unsafe) public func alertControllerWithCustomView(_ view: UIKit.UIView & DCloudAlertController.DCAlertControllerContentViewProtocol, _ preferredStyle: DCloudAlertController.DCAlertViewControllerStyle) -> DCloudAlertController.DCAlertViewController
+ @_Concurrency.MainActor(unsafe) public func addActionWithTitle(_ title: Foundation.NSString, _ style: DCloudAlertController.DCAlertActionStyle, _ handler: @escaping (_ action: DCloudAlertController.DCAlertAction) -> Swift.Void) -> DCloudAlertController.DCAlertAction
+ @_Concurrency.MainActor(unsafe) public func addImage(_ image: UIKit.UIImage, _ position: DCloudAlertController.DCAlertImagePosition)
+ @_Concurrency.MainActor(unsafe) public func addCustomView(_ customView: UIKit.UIView)
+ @_Concurrency.MainActor(unsafe) public func addAction(_ action: DCloudAlertController.DCAlertAction)
+ @_Concurrency.MainActor(unsafe) public func addTapGesture()
+ @_Concurrency.MainActor(unsafe) public func onTapAction(_ action: DCloudAlertController.DCAlertAction)
+ @_Concurrency.MainActor(unsafe) public func resetDoneBtnTitleColor(_ color: UIKit.UIColor)
+}
+extension DCloudAlertController.DCAlertViewController : UIKit.UIViewControllerTransitioningDelegate {
+ @_Concurrency.MainActor(unsafe) @objc dynamic public func animationController(forPresented presented: UIKit.UIViewController, presenting: UIKit.UIViewController, source: UIKit.UIViewController) -> UIKit.UIViewControllerAnimatedTransitioning?
+ @_Concurrency.MainActor(unsafe) @objc dynamic public func animationController(forDismissed dismissed: UIKit.UIViewController) -> UIKit.UIViewControllerAnimatedTransitioning?
+}
+public typealias DCAlertView = DCloudAlertController.DCAlertViewController
+extension DCloudAlertController.DCAlertViewController {
+ @_Concurrency.MainActor(unsafe) public func show()
+ @_Concurrency.MainActor(unsafe) public func dismiss()
+ @_Concurrency.MainActor(unsafe) public static func alertView(_ title: Swift.String, _ doneItem: DCloudAlertController.DCRIButtonItem, _ preferredStyle: DCloudAlertController.DCAlertViewControllerStyle = .alert, _ placeholder: Swift.String = "") -> DCloudAlertController.DCAlertView
+ @_Concurrency.MainActor(unsafe) public static func alertView(_ title: Swift.String?, _ cancelItem: DCloudAlertController.DCRIButtonItem, _ doneItem: DCloudAlertController.DCRIButtonItem, _ preferredStyle: DCloudAlertController.DCAlertViewControllerStyle = .alert, _ placeholder: Swift.String = "") -> DCloudAlertController.DCAlertView
+ @_Concurrency.MainActor(unsafe) public static func alertView(_ title: Swift.String?, _ subTitle: Swift.String?, _ doneItem: DCloudAlertController.DCRIButtonItem, _ preferredStyle: DCloudAlertController.DCAlertViewControllerStyle = .alert, _ placeholder: Swift.String = "") -> DCloudAlertController.DCAlertView
+ @_Concurrency.MainActor(unsafe) public static func alertView(_ title: Swift.String?, _ subTitle: Swift.String?, _ cancelItem: DCloudAlertController.DCRIButtonItem, _ doneItem: DCloudAlertController.DCRIButtonItem, _ preferredStyle: DCloudAlertController.DCAlertViewControllerStyle = .alert, _ placeholder: Swift.String = "") -> DCloudAlertController.DCAlertView
+ @_Concurrency.MainActor(unsafe) public static func alertView(_ title: Swift.String?, _ subTitle: Swift.String?, _ cancelItem: DCloudAlertController.DCRIButtonItem, _ cancelActionStyle: DCloudAlertController.DCAlertActionStyle, _ doneItem: DCloudAlertController.DCRIButtonItem, _ doneActionStyle: DCloudAlertController.DCAlertActionStyle, _ preferredStyle: DCloudAlertController.DCAlertViewControllerStyle, _ placeholder: Swift.String = "") -> DCloudAlertController.DCAlertView
+}
+extension DCloudAlertController.DCAlertActionStyle : Swift.Equatable {}
+extension DCloudAlertController.DCAlertActionStyle : Swift.Hashable {}
+extension DCloudAlertController.DCAlertActionStyle : Swift.RawRepresentable {}
+extension DCloudAlertController.DCAlertImagePosition : Swift.Equatable {}
+extension DCloudAlertController.DCAlertImagePosition : Swift.Hashable {}
+extension DCloudAlertController.DCAlertImagePosition : Swift.RawRepresentable {}
+extension DCloudAlertController.DCAlertViewControllerStyle : Swift.Equatable {}
+extension DCloudAlertController.DCAlertViewControllerStyle : Swift.Hashable {}
+extension DCloudAlertController.DCAlertViewControllerStyle : Swift.RawRepresentable {}
diff --git a/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCloudAlertController.framework/Modules/DCloudAlertController.swiftmodule/i386-apple-ios-simulator.swiftmodule b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCloudAlertController.framework/Modules/DCloudAlertController.swiftmodule/i386-apple-ios-simulator.swiftmodule
new file mode 100644
index 0000000000000000000000000000000000000000..a78bc9e7f0a4bb5749bea14a43cde79fc236d72b
Binary files /dev/null and b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCloudAlertController.framework/Modules/DCloudAlertController.swiftmodule/i386-apple-ios-simulator.swiftmodule differ
diff --git a/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCloudAlertController.framework/Modules/DCloudAlertController.swiftmodule/i386.swiftdoc b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCloudAlertController.framework/Modules/DCloudAlertController.swiftmodule/i386.swiftdoc
new file mode 100644
index 0000000000000000000000000000000000000000..12ee779a3bb37522508df6d29c27e966fae0703a
Binary files /dev/null and b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCloudAlertController.framework/Modules/DCloudAlertController.swiftmodule/i386.swiftdoc differ
diff --git a/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCloudAlertController.framework/Modules/DCloudAlertController.swiftmodule/i386.swiftinterface b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCloudAlertController.framework/Modules/DCloudAlertController.swiftmodule/i386.swiftinterface
new file mode 100644
index 0000000000000000000000000000000000000000..05592a796a200afbe765e57e27c5cbed4463c151
--- /dev/null
+++ b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCloudAlertController.framework/Modules/DCloudAlertController.swiftmodule/i386.swiftinterface
@@ -0,0 +1,167 @@
+// swift-interface-format-version: 1.0
+// swift-compiler-version: Apple Swift version 5.5.2 (swiftlang-1300.0.47.5 clang-1300.0.29.30)
+// swift-module-flags: -target i386-apple-ios9.0-simulator -enable-objc-interop -enable-library-evolution -swift-version 5 -enforce-exclusivity=checked -O -module-name DCloudAlertController
+@_exported import DCloudAlertController
+import Foundation
+import Swift
+import UIKit
+import _Concurrency
+public enum DCAlertActionStyle : Swift.Int {
+ case defaultStyle
+ case cancelStyle
+ case destructiveStyle
+ case preferredStyle
+ public init?(rawValue: Swift.Int)
+ public typealias RawValue = Swift.Int
+ public var rawValue: Swift.Int {
+ get
+ }
+}
+public enum DCAlertImagePosition : Swift.Int {
+ case null
+ case topCenter
+ case leftTopCenter
+ public init?(rawValue: Swift.Int)
+ public typealias RawValue = Swift.Int
+ public var rawValue: Swift.Int {
+ get
+ }
+}
+@objc public class DCAlertAction : ObjectiveC.NSObject {
+ public var title: Swift.String?
+ public var titleColor: UIKit.UIColor? {
+ get
+ set
+ }
+ public var style: DCloudAlertController.DCAlertActionStyle
+ weak public var button: UIKit.UIButton?
+ public var handler: (_ action: DCloudAlertController.DCAlertAction) -> Swift.Void
+ public var enabled: Swift.Bool {
+ get
+ set
+ }
+ public init(title: Swift.String, style: DCloudAlertController.DCAlertActionStyle, handler: @escaping (_ action: DCloudAlertController.DCAlertAction) -> Swift.Void)
+ @objc deinit
+}
+@objc @_inheritsConvenienceInitializers @_Concurrency.MainActor(unsafe) public class DCAlertActionButton : UIKit.UIButton {
+ @_Concurrency.MainActor(unsafe) @objc override dynamic public init(frame: CoreGraphics.CGRect)
+ @_Concurrency.MainActor(unsafe) @objc required dynamic public init?(coder: Foundation.NSCoder)
+ @objc deinit
+}
+public protocol DCAlertControllerContentViewProtocol : ObjectiveC.NSObject {
+ var titleLabel: UIKit.UILabel { get set }
+ var messageLabel: UIKit.UITextView { get set }
+ var title: Swift.String? { get set }
+ var message: Swift.String? { get set }
+ var image: UIKit.UIImage? { get set }
+ var customView: UIKit.UIView? { get set }
+ var imagePositon: DCloudAlertController.DCAlertImagePosition? { get set }
+ var buttons: [DCloudAlertController.DCAlertActionButton] { get }
+ var actionClickedHandler: ((_ action: DCloudAlertController.DCAlertAction) -> Swift.Void)? { get set }
+ func addAction(_ action: DCloudAlertController.DCAlertAction)
+ func setHairLineColor(_ hairLineColor: UIKit.UIColor?)
+}
+@objc @_inheritsConvenienceInitializers public class DCRIButtonItem : ObjectiveC.NSObject {
+ public static func item() -> DCloudAlertController.DCRIButtonItem
+ public static func itemWithLabel(_ inLabel: Swift.String) -> DCloudAlertController.DCRIButtonItem
+ public static func itemWithLabel(_ inLabel: Swift.String, _ labelColor: UIKit.UIColor? = nil, inAction action: @escaping (() -> Swift.Void)) -> DCloudAlertController.DCRIButtonItem
+ @objc override dynamic public init()
+ @objc deinit
+}
+@objc @_hasMissingDesignatedInitializers @_Concurrency.MainActor(unsafe) public class DCActionSheetController : UIKit.UIViewController {
+ @_Concurrency.MainActor(unsafe) public init(noticeTitle: Swift.String)
+ @_Concurrency.MainActor(unsafe) @objc override dynamic public func loadView()
+ @_Concurrency.MainActor(unsafe) @objc override dynamic public func viewDidLoad()
+ @_Concurrency.MainActor(unsafe) @objc override dynamic public func viewDidLayoutSubviews()
+ @_Concurrency.MainActor(unsafe) public func addAction(_ action: DCloudAlertController.DCAlertAction)
+ @_Concurrency.MainActor(unsafe) public func addAction(_ title: Swift.String, _ style: DCloudAlertController.DCAlertActionStyle, _ handler: @escaping (_ action: DCloudAlertController.DCAlertAction) -> Swift.Void) -> DCloudAlertController.DCAlertAction
+ @_Concurrency.MainActor(unsafe) public func show()
+ @objc deinit
+}
+extension DCloudAlertController.DCActionSheetController : UIKit.UITableViewDelegate, UIKit.UITableViewDataSource {
+ @_Concurrency.MainActor(unsafe) @objc dynamic public func numberOfSections(in tableView: UIKit.UITableView) -> Swift.Int
+ @_Concurrency.MainActor(unsafe) @objc dynamic public func tableView(_ tableView: UIKit.UITableView, numberOfRowsInSection section: Swift.Int) -> Swift.Int
+ @_Concurrency.MainActor(unsafe) @objc dynamic public func tableView(_ tableView: UIKit.UITableView, cellForRowAt indexPath: Foundation.IndexPath) -> UIKit.UITableViewCell
+ @_Concurrency.MainActor(unsafe) @objc dynamic public func tableView(_ tableView: UIKit.UITableView, didSelectRowAt indexPath: Foundation.IndexPath)
+ @_Concurrency.MainActor(unsafe) @objc dynamic public func tableView(_ tableView: UIKit.UITableView, heightForRowAt indexPath: Foundation.IndexPath) -> CoreGraphics.CGFloat
+ @_Concurrency.MainActor(unsafe) @objc dynamic public func tableView(_ tableView: UIKit.UITableView, heightForFooterInSection section: Swift.Int) -> CoreGraphics.CGFloat
+ @_Concurrency.MainActor(unsafe) @objc dynamic public func tableView(_ tableView: UIKit.UITableView, viewForFooterInSection section: Swift.Int) -> UIKit.UIView?
+}
+public enum DCAlertViewControllerStyle : Swift.Int {
+ case alert
+ case textViewAlert
+ public init?(rawValue: Swift.Int)
+ public typealias RawValue = Swift.Int
+ public var rawValue: Swift.Int {
+ get
+ }
+}
+public protocol DCAlertViewControllerDismissDelegate : UIKit.UITextViewDelegate {
+ func canDismissWithAction(_ action: DCloudAlertController.DCAlertAction?, _ param: Any?) -> Swift.Bool
+}
+@objc @_hasMissingDesignatedInitializers @_Concurrency.MainActor(unsafe) public class DCAlertViewController : UIKit.UIViewController {
+ @_Concurrency.MainActor(unsafe) public var canOpenDarkMode: Swift.Bool
+ @_Concurrency.MainActor(unsafe) public var contentViewVisible: Swift.Bool {
+ get
+ set
+ }
+ @_Concurrency.MainActor(unsafe) public var mesageTitle: Swift.String? {
+ get
+ set
+ }
+ @_Concurrency.MainActor(unsafe) public var message: Swift.String? {
+ get
+ set
+ }
+ @_Concurrency.MainActor(unsafe) public var textViewText: Swift.String? {
+ get
+ }
+ @_Concurrency.MainActor(unsafe) public var textView: UIKit.UITextView? {
+ get
+ }
+ @_Concurrency.MainActor(unsafe) weak public var dismissDelegate: DCloudAlertController.DCAlertViewControllerDismissDelegate? {
+ get
+ set
+ }
+ @_Concurrency.MainActor(unsafe) public var preferredStyle: DCloudAlertController.DCAlertViewControllerStyle
+ @_Concurrency.MainActor(unsafe) public var tapGesture: UIKit.UITapGestureRecognizer?
+ @_Concurrency.MainActor(unsafe) public var contentView: (UIKit.UIView & DCloudAlertController.DCAlertControllerContentViewProtocol)?
+ @objc deinit
+ @_Concurrency.MainActor(unsafe) public init(_ title: Swift.String?, _ message: Swift.String?, _ preferredStyle: DCloudAlertController.DCAlertViewControllerStyle, _ placeholder: Swift.String?)
+ @_Concurrency.MainActor(unsafe) public init(_ customView: UIKit.UIView & DCloudAlertController.DCAlertControllerContentViewProtocol, _ preferredStyle: DCloudAlertController.DCAlertViewControllerStyle)
+ @_Concurrency.MainActor(unsafe) @objc override dynamic public func loadView()
+ @_Concurrency.MainActor(unsafe) @objc override dynamic public func viewWillLayoutSubviews()
+ @_Concurrency.MainActor(unsafe) @objc override dynamic public func viewDidLoad()
+ @_Concurrency.MainActor(unsafe) public func alertControllerWithTitle(_ title: Swift.String?, _ message: Swift.String?, _ preferredStyle: DCloudAlertController.DCAlertViewControllerStyle, _ placeholder: Swift.String?) -> DCloudAlertController.DCAlertViewController
+ @_Concurrency.MainActor(unsafe) public func alertControllerWithCustomView(_ view: UIKit.UIView & DCloudAlertController.DCAlertControllerContentViewProtocol, _ preferredStyle: DCloudAlertController.DCAlertViewControllerStyle) -> DCloudAlertController.DCAlertViewController
+ @_Concurrency.MainActor(unsafe) public func addActionWithTitle(_ title: Foundation.NSString, _ style: DCloudAlertController.DCAlertActionStyle, _ handler: @escaping (_ action: DCloudAlertController.DCAlertAction) -> Swift.Void) -> DCloudAlertController.DCAlertAction
+ @_Concurrency.MainActor(unsafe) public func addImage(_ image: UIKit.UIImage, _ position: DCloudAlertController.DCAlertImagePosition)
+ @_Concurrency.MainActor(unsafe) public func addCustomView(_ customView: UIKit.UIView)
+ @_Concurrency.MainActor(unsafe) public func addAction(_ action: DCloudAlertController.DCAlertAction)
+ @_Concurrency.MainActor(unsafe) public func addTapGesture()
+ @_Concurrency.MainActor(unsafe) public func onTapAction(_ action: DCloudAlertController.DCAlertAction)
+ @_Concurrency.MainActor(unsafe) public func resetDoneBtnTitleColor(_ color: UIKit.UIColor)
+}
+extension DCloudAlertController.DCAlertViewController : UIKit.UIViewControllerTransitioningDelegate {
+ @_Concurrency.MainActor(unsafe) @objc dynamic public func animationController(forPresented presented: UIKit.UIViewController, presenting: UIKit.UIViewController, source: UIKit.UIViewController) -> UIKit.UIViewControllerAnimatedTransitioning?
+ @_Concurrency.MainActor(unsafe) @objc dynamic public func animationController(forDismissed dismissed: UIKit.UIViewController) -> UIKit.UIViewControllerAnimatedTransitioning?
+}
+public typealias DCAlertView = DCloudAlertController.DCAlertViewController
+extension DCloudAlertController.DCAlertViewController {
+ @_Concurrency.MainActor(unsafe) public func show()
+ @_Concurrency.MainActor(unsafe) public func dismiss()
+ @_Concurrency.MainActor(unsafe) public static func alertView(_ title: Swift.String, _ doneItem: DCloudAlertController.DCRIButtonItem, _ preferredStyle: DCloudAlertController.DCAlertViewControllerStyle = .alert, _ placeholder: Swift.String = "") -> DCloudAlertController.DCAlertView
+ @_Concurrency.MainActor(unsafe) public static func alertView(_ title: Swift.String?, _ cancelItem: DCloudAlertController.DCRIButtonItem, _ doneItem: DCloudAlertController.DCRIButtonItem, _ preferredStyle: DCloudAlertController.DCAlertViewControllerStyle = .alert, _ placeholder: Swift.String = "") -> DCloudAlertController.DCAlertView
+ @_Concurrency.MainActor(unsafe) public static func alertView(_ title: Swift.String?, _ subTitle: Swift.String?, _ doneItem: DCloudAlertController.DCRIButtonItem, _ preferredStyle: DCloudAlertController.DCAlertViewControllerStyle = .alert, _ placeholder: Swift.String = "") -> DCloudAlertController.DCAlertView
+ @_Concurrency.MainActor(unsafe) public static func alertView(_ title: Swift.String?, _ subTitle: Swift.String?, _ cancelItem: DCloudAlertController.DCRIButtonItem, _ doneItem: DCloudAlertController.DCRIButtonItem, _ preferredStyle: DCloudAlertController.DCAlertViewControllerStyle = .alert, _ placeholder: Swift.String = "") -> DCloudAlertController.DCAlertView
+ @_Concurrency.MainActor(unsafe) public static func alertView(_ title: Swift.String?, _ subTitle: Swift.String?, _ cancelItem: DCloudAlertController.DCRIButtonItem, _ cancelActionStyle: DCloudAlertController.DCAlertActionStyle, _ doneItem: DCloudAlertController.DCRIButtonItem, _ doneActionStyle: DCloudAlertController.DCAlertActionStyle, _ preferredStyle: DCloudAlertController.DCAlertViewControllerStyle, _ placeholder: Swift.String = "") -> DCloudAlertController.DCAlertView
+}
+extension DCloudAlertController.DCAlertActionStyle : Swift.Equatable {}
+extension DCloudAlertController.DCAlertActionStyle : Swift.Hashable {}
+extension DCloudAlertController.DCAlertActionStyle : Swift.RawRepresentable {}
+extension DCloudAlertController.DCAlertImagePosition : Swift.Equatable {}
+extension DCloudAlertController.DCAlertImagePosition : Swift.Hashable {}
+extension DCloudAlertController.DCAlertImagePosition : Swift.RawRepresentable {}
+extension DCloudAlertController.DCAlertViewControllerStyle : Swift.Equatable {}
+extension DCloudAlertController.DCAlertViewControllerStyle : Swift.Hashable {}
+extension DCloudAlertController.DCAlertViewControllerStyle : Swift.RawRepresentable {}
diff --git a/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCloudAlertController.framework/Modules/DCloudAlertController.swiftmodule/i386.swiftmodule b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCloudAlertController.framework/Modules/DCloudAlertController.swiftmodule/i386.swiftmodule
new file mode 100644
index 0000000000000000000000000000000000000000..a78bc9e7f0a4bb5749bea14a43cde79fc236d72b
Binary files /dev/null and b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCloudAlertController.framework/Modules/DCloudAlertController.swiftmodule/i386.swiftmodule differ
diff --git a/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCloudAlertController.framework/Modules/DCloudAlertController.swiftmodule/x86_64-apple-ios-simulator.swiftdoc b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCloudAlertController.framework/Modules/DCloudAlertController.swiftmodule/x86_64-apple-ios-simulator.swiftdoc
new file mode 100644
index 0000000000000000000000000000000000000000..3826e93bbe7e8280b39a265f0538510b1c8014a4
Binary files /dev/null and b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCloudAlertController.framework/Modules/DCloudAlertController.swiftmodule/x86_64-apple-ios-simulator.swiftdoc differ
diff --git a/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCloudAlertController.framework/Modules/DCloudAlertController.swiftmodule/x86_64-apple-ios-simulator.swiftinterface b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCloudAlertController.framework/Modules/DCloudAlertController.swiftmodule/x86_64-apple-ios-simulator.swiftinterface
new file mode 100644
index 0000000000000000000000000000000000000000..3061d2187e3a0c3601ddfe189d32f1c032e0ab7d
--- /dev/null
+++ b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCloudAlertController.framework/Modules/DCloudAlertController.swiftmodule/x86_64-apple-ios-simulator.swiftinterface
@@ -0,0 +1,167 @@
+// swift-interface-format-version: 1.0
+// swift-compiler-version: Apple Swift version 5.5.2 (swiftlang-1300.0.47.5 clang-1300.0.29.30)
+// swift-module-flags: -target x86_64-apple-ios9.0-simulator -enable-objc-interop -enable-library-evolution -swift-version 5 -enforce-exclusivity=checked -O -module-name DCloudAlertController
+@_exported import DCloudAlertController
+import Foundation
+import Swift
+import UIKit
+import _Concurrency
+public enum DCAlertActionStyle : Swift.Int {
+ case defaultStyle
+ case cancelStyle
+ case destructiveStyle
+ case preferredStyle
+ public init?(rawValue: Swift.Int)
+ public typealias RawValue = Swift.Int
+ public var rawValue: Swift.Int {
+ get
+ }
+}
+public enum DCAlertImagePosition : Swift.Int {
+ case null
+ case topCenter
+ case leftTopCenter
+ public init?(rawValue: Swift.Int)
+ public typealias RawValue = Swift.Int
+ public var rawValue: Swift.Int {
+ get
+ }
+}
+@objc public class DCAlertAction : ObjectiveC.NSObject {
+ public var title: Swift.String?
+ public var titleColor: UIKit.UIColor? {
+ get
+ set
+ }
+ public var style: DCloudAlertController.DCAlertActionStyle
+ weak public var button: UIKit.UIButton?
+ public var handler: (_ action: DCloudAlertController.DCAlertAction) -> Swift.Void
+ public var enabled: Swift.Bool {
+ get
+ set
+ }
+ public init(title: Swift.String, style: DCloudAlertController.DCAlertActionStyle, handler: @escaping (_ action: DCloudAlertController.DCAlertAction) -> Swift.Void)
+ @objc deinit
+}
+@objc @_inheritsConvenienceInitializers @_Concurrency.MainActor(unsafe) public class DCAlertActionButton : UIKit.UIButton {
+ @_Concurrency.MainActor(unsafe) @objc override dynamic public init(frame: CoreGraphics.CGRect)
+ @_Concurrency.MainActor(unsafe) @objc required dynamic public init?(coder: Foundation.NSCoder)
+ @objc deinit
+}
+public protocol DCAlertControllerContentViewProtocol : ObjectiveC.NSObject {
+ var titleLabel: UIKit.UILabel { get set }
+ var messageLabel: UIKit.UITextView { get set }
+ var title: Swift.String? { get set }
+ var message: Swift.String? { get set }
+ var image: UIKit.UIImage? { get set }
+ var customView: UIKit.UIView? { get set }
+ var imagePositon: DCloudAlertController.DCAlertImagePosition? { get set }
+ var buttons: [DCloudAlertController.DCAlertActionButton] { get }
+ var actionClickedHandler: ((_ action: DCloudAlertController.DCAlertAction) -> Swift.Void)? { get set }
+ func addAction(_ action: DCloudAlertController.DCAlertAction)
+ func setHairLineColor(_ hairLineColor: UIKit.UIColor?)
+}
+@objc @_inheritsConvenienceInitializers public class DCRIButtonItem : ObjectiveC.NSObject {
+ public static func item() -> DCloudAlertController.DCRIButtonItem
+ public static func itemWithLabel(_ inLabel: Swift.String) -> DCloudAlertController.DCRIButtonItem
+ public static func itemWithLabel(_ inLabel: Swift.String, _ labelColor: UIKit.UIColor? = nil, inAction action: @escaping (() -> Swift.Void)) -> DCloudAlertController.DCRIButtonItem
+ @objc override dynamic public init()
+ @objc deinit
+}
+@objc @_hasMissingDesignatedInitializers @_Concurrency.MainActor(unsafe) public class DCActionSheetController : UIKit.UIViewController {
+ @_Concurrency.MainActor(unsafe) public init(noticeTitle: Swift.String)
+ @_Concurrency.MainActor(unsafe) @objc override dynamic public func loadView()
+ @_Concurrency.MainActor(unsafe) @objc override dynamic public func viewDidLoad()
+ @_Concurrency.MainActor(unsafe) @objc override dynamic public func viewDidLayoutSubviews()
+ @_Concurrency.MainActor(unsafe) public func addAction(_ action: DCloudAlertController.DCAlertAction)
+ @_Concurrency.MainActor(unsafe) public func addAction(_ title: Swift.String, _ style: DCloudAlertController.DCAlertActionStyle, _ handler: @escaping (_ action: DCloudAlertController.DCAlertAction) -> Swift.Void) -> DCloudAlertController.DCAlertAction
+ @_Concurrency.MainActor(unsafe) public func show()
+ @objc deinit
+}
+extension DCloudAlertController.DCActionSheetController : UIKit.UITableViewDelegate, UIKit.UITableViewDataSource {
+ @_Concurrency.MainActor(unsafe) @objc dynamic public func numberOfSections(in tableView: UIKit.UITableView) -> Swift.Int
+ @_Concurrency.MainActor(unsafe) @objc dynamic public func tableView(_ tableView: UIKit.UITableView, numberOfRowsInSection section: Swift.Int) -> Swift.Int
+ @_Concurrency.MainActor(unsafe) @objc dynamic public func tableView(_ tableView: UIKit.UITableView, cellForRowAt indexPath: Foundation.IndexPath) -> UIKit.UITableViewCell
+ @_Concurrency.MainActor(unsafe) @objc dynamic public func tableView(_ tableView: UIKit.UITableView, didSelectRowAt indexPath: Foundation.IndexPath)
+ @_Concurrency.MainActor(unsafe) @objc dynamic public func tableView(_ tableView: UIKit.UITableView, heightForRowAt indexPath: Foundation.IndexPath) -> CoreGraphics.CGFloat
+ @_Concurrency.MainActor(unsafe) @objc dynamic public func tableView(_ tableView: UIKit.UITableView, heightForFooterInSection section: Swift.Int) -> CoreGraphics.CGFloat
+ @_Concurrency.MainActor(unsafe) @objc dynamic public func tableView(_ tableView: UIKit.UITableView, viewForFooterInSection section: Swift.Int) -> UIKit.UIView?
+}
+public enum DCAlertViewControllerStyle : Swift.Int {
+ case alert
+ case textViewAlert
+ public init?(rawValue: Swift.Int)
+ public typealias RawValue = Swift.Int
+ public var rawValue: Swift.Int {
+ get
+ }
+}
+public protocol DCAlertViewControllerDismissDelegate : UIKit.UITextViewDelegate {
+ func canDismissWithAction(_ action: DCloudAlertController.DCAlertAction?, _ param: Any?) -> Swift.Bool
+}
+@objc @_hasMissingDesignatedInitializers @_Concurrency.MainActor(unsafe) public class DCAlertViewController : UIKit.UIViewController {
+ @_Concurrency.MainActor(unsafe) public var canOpenDarkMode: Swift.Bool
+ @_Concurrency.MainActor(unsafe) public var contentViewVisible: Swift.Bool {
+ get
+ set
+ }
+ @_Concurrency.MainActor(unsafe) public var mesageTitle: Swift.String? {
+ get
+ set
+ }
+ @_Concurrency.MainActor(unsafe) public var message: Swift.String? {
+ get
+ set
+ }
+ @_Concurrency.MainActor(unsafe) public var textViewText: Swift.String? {
+ get
+ }
+ @_Concurrency.MainActor(unsafe) public var textView: UIKit.UITextView? {
+ get
+ }
+ @_Concurrency.MainActor(unsafe) weak public var dismissDelegate: DCloudAlertController.DCAlertViewControllerDismissDelegate? {
+ get
+ set
+ }
+ @_Concurrency.MainActor(unsafe) public var preferredStyle: DCloudAlertController.DCAlertViewControllerStyle
+ @_Concurrency.MainActor(unsafe) public var tapGesture: UIKit.UITapGestureRecognizer?
+ @_Concurrency.MainActor(unsafe) public var contentView: (UIKit.UIView & DCloudAlertController.DCAlertControllerContentViewProtocol)?
+ @objc deinit
+ @_Concurrency.MainActor(unsafe) public init(_ title: Swift.String?, _ message: Swift.String?, _ preferredStyle: DCloudAlertController.DCAlertViewControllerStyle, _ placeholder: Swift.String?)
+ @_Concurrency.MainActor(unsafe) public init(_ customView: UIKit.UIView & DCloudAlertController.DCAlertControllerContentViewProtocol, _ preferredStyle: DCloudAlertController.DCAlertViewControllerStyle)
+ @_Concurrency.MainActor(unsafe) @objc override dynamic public func loadView()
+ @_Concurrency.MainActor(unsafe) @objc override dynamic public func viewWillLayoutSubviews()
+ @_Concurrency.MainActor(unsafe) @objc override dynamic public func viewDidLoad()
+ @_Concurrency.MainActor(unsafe) public func alertControllerWithTitle(_ title: Swift.String?, _ message: Swift.String?, _ preferredStyle: DCloudAlertController.DCAlertViewControllerStyle, _ placeholder: Swift.String?) -> DCloudAlertController.DCAlertViewController
+ @_Concurrency.MainActor(unsafe) public func alertControllerWithCustomView(_ view: UIKit.UIView & DCloudAlertController.DCAlertControllerContentViewProtocol, _ preferredStyle: DCloudAlertController.DCAlertViewControllerStyle) -> DCloudAlertController.DCAlertViewController
+ @_Concurrency.MainActor(unsafe) public func addActionWithTitle(_ title: Foundation.NSString, _ style: DCloudAlertController.DCAlertActionStyle, _ handler: @escaping (_ action: DCloudAlertController.DCAlertAction) -> Swift.Void) -> DCloudAlertController.DCAlertAction
+ @_Concurrency.MainActor(unsafe) public func addImage(_ image: UIKit.UIImage, _ position: DCloudAlertController.DCAlertImagePosition)
+ @_Concurrency.MainActor(unsafe) public func addCustomView(_ customView: UIKit.UIView)
+ @_Concurrency.MainActor(unsafe) public func addAction(_ action: DCloudAlertController.DCAlertAction)
+ @_Concurrency.MainActor(unsafe) public func addTapGesture()
+ @_Concurrency.MainActor(unsafe) public func onTapAction(_ action: DCloudAlertController.DCAlertAction)
+ @_Concurrency.MainActor(unsafe) public func resetDoneBtnTitleColor(_ color: UIKit.UIColor)
+}
+extension DCloudAlertController.DCAlertViewController : UIKit.UIViewControllerTransitioningDelegate {
+ @_Concurrency.MainActor(unsafe) @objc dynamic public func animationController(forPresented presented: UIKit.UIViewController, presenting: UIKit.UIViewController, source: UIKit.UIViewController) -> UIKit.UIViewControllerAnimatedTransitioning?
+ @_Concurrency.MainActor(unsafe) @objc dynamic public func animationController(forDismissed dismissed: UIKit.UIViewController) -> UIKit.UIViewControllerAnimatedTransitioning?
+}
+public typealias DCAlertView = DCloudAlertController.DCAlertViewController
+extension DCloudAlertController.DCAlertViewController {
+ @_Concurrency.MainActor(unsafe) public func show()
+ @_Concurrency.MainActor(unsafe) public func dismiss()
+ @_Concurrency.MainActor(unsafe) public static func alertView(_ title: Swift.String, _ doneItem: DCloudAlertController.DCRIButtonItem, _ preferredStyle: DCloudAlertController.DCAlertViewControllerStyle = .alert, _ placeholder: Swift.String = "") -> DCloudAlertController.DCAlertView
+ @_Concurrency.MainActor(unsafe) public static func alertView(_ title: Swift.String?, _ cancelItem: DCloudAlertController.DCRIButtonItem, _ doneItem: DCloudAlertController.DCRIButtonItem, _ preferredStyle: DCloudAlertController.DCAlertViewControllerStyle = .alert, _ placeholder: Swift.String = "") -> DCloudAlertController.DCAlertView
+ @_Concurrency.MainActor(unsafe) public static func alertView(_ title: Swift.String?, _ subTitle: Swift.String?, _ doneItem: DCloudAlertController.DCRIButtonItem, _ preferredStyle: DCloudAlertController.DCAlertViewControllerStyle = .alert, _ placeholder: Swift.String = "") -> DCloudAlertController.DCAlertView
+ @_Concurrency.MainActor(unsafe) public static func alertView(_ title: Swift.String?, _ subTitle: Swift.String?, _ cancelItem: DCloudAlertController.DCRIButtonItem, _ doneItem: DCloudAlertController.DCRIButtonItem, _ preferredStyle: DCloudAlertController.DCAlertViewControllerStyle = .alert, _ placeholder: Swift.String = "") -> DCloudAlertController.DCAlertView
+ @_Concurrency.MainActor(unsafe) public static func alertView(_ title: Swift.String?, _ subTitle: Swift.String?, _ cancelItem: DCloudAlertController.DCRIButtonItem, _ cancelActionStyle: DCloudAlertController.DCAlertActionStyle, _ doneItem: DCloudAlertController.DCRIButtonItem, _ doneActionStyle: DCloudAlertController.DCAlertActionStyle, _ preferredStyle: DCloudAlertController.DCAlertViewControllerStyle, _ placeholder: Swift.String = "") -> DCloudAlertController.DCAlertView
+}
+extension DCloudAlertController.DCAlertActionStyle : Swift.Equatable {}
+extension DCloudAlertController.DCAlertActionStyle : Swift.Hashable {}
+extension DCloudAlertController.DCAlertActionStyle : Swift.RawRepresentable {}
+extension DCloudAlertController.DCAlertImagePosition : Swift.Equatable {}
+extension DCloudAlertController.DCAlertImagePosition : Swift.Hashable {}
+extension DCloudAlertController.DCAlertImagePosition : Swift.RawRepresentable {}
+extension DCloudAlertController.DCAlertViewControllerStyle : Swift.Equatable {}
+extension DCloudAlertController.DCAlertViewControllerStyle : Swift.Hashable {}
+extension DCloudAlertController.DCAlertViewControllerStyle : Swift.RawRepresentable {}
diff --git a/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCloudAlertController.framework/Modules/DCloudAlertController.swiftmodule/x86_64-apple-ios-simulator.swiftmodule b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCloudAlertController.framework/Modules/DCloudAlertController.swiftmodule/x86_64-apple-ios-simulator.swiftmodule
new file mode 100644
index 0000000000000000000000000000000000000000..93fef5176a633f41277d73843f52ec632dbd9e14
Binary files /dev/null and b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCloudAlertController.framework/Modules/DCloudAlertController.swiftmodule/x86_64-apple-ios-simulator.swiftmodule differ
diff --git a/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCloudAlertController.framework/Modules/DCloudAlertController.swiftmodule/x86_64.swiftdoc b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCloudAlertController.framework/Modules/DCloudAlertController.swiftmodule/x86_64.swiftdoc
new file mode 100644
index 0000000000000000000000000000000000000000..3826e93bbe7e8280b39a265f0538510b1c8014a4
Binary files /dev/null and b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCloudAlertController.framework/Modules/DCloudAlertController.swiftmodule/x86_64.swiftdoc differ
diff --git a/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCloudAlertController.framework/Modules/DCloudAlertController.swiftmodule/x86_64.swiftinterface b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCloudAlertController.framework/Modules/DCloudAlertController.swiftmodule/x86_64.swiftinterface
new file mode 100644
index 0000000000000000000000000000000000000000..3061d2187e3a0c3601ddfe189d32f1c032e0ab7d
--- /dev/null
+++ b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCloudAlertController.framework/Modules/DCloudAlertController.swiftmodule/x86_64.swiftinterface
@@ -0,0 +1,167 @@
+// swift-interface-format-version: 1.0
+// swift-compiler-version: Apple Swift version 5.5.2 (swiftlang-1300.0.47.5 clang-1300.0.29.30)
+// swift-module-flags: -target x86_64-apple-ios9.0-simulator -enable-objc-interop -enable-library-evolution -swift-version 5 -enforce-exclusivity=checked -O -module-name DCloudAlertController
+@_exported import DCloudAlertController
+import Foundation
+import Swift
+import UIKit
+import _Concurrency
+public enum DCAlertActionStyle : Swift.Int {
+ case defaultStyle
+ case cancelStyle
+ case destructiveStyle
+ case preferredStyle
+ public init?(rawValue: Swift.Int)
+ public typealias RawValue = Swift.Int
+ public var rawValue: Swift.Int {
+ get
+ }
+}
+public enum DCAlertImagePosition : Swift.Int {
+ case null
+ case topCenter
+ case leftTopCenter
+ public init?(rawValue: Swift.Int)
+ public typealias RawValue = Swift.Int
+ public var rawValue: Swift.Int {
+ get
+ }
+}
+@objc public class DCAlertAction : ObjectiveC.NSObject {
+ public var title: Swift.String?
+ public var titleColor: UIKit.UIColor? {
+ get
+ set
+ }
+ public var style: DCloudAlertController.DCAlertActionStyle
+ weak public var button: UIKit.UIButton?
+ public var handler: (_ action: DCloudAlertController.DCAlertAction) -> Swift.Void
+ public var enabled: Swift.Bool {
+ get
+ set
+ }
+ public init(title: Swift.String, style: DCloudAlertController.DCAlertActionStyle, handler: @escaping (_ action: DCloudAlertController.DCAlertAction) -> Swift.Void)
+ @objc deinit
+}
+@objc @_inheritsConvenienceInitializers @_Concurrency.MainActor(unsafe) public class DCAlertActionButton : UIKit.UIButton {
+ @_Concurrency.MainActor(unsafe) @objc override dynamic public init(frame: CoreGraphics.CGRect)
+ @_Concurrency.MainActor(unsafe) @objc required dynamic public init?(coder: Foundation.NSCoder)
+ @objc deinit
+}
+public protocol DCAlertControllerContentViewProtocol : ObjectiveC.NSObject {
+ var titleLabel: UIKit.UILabel { get set }
+ var messageLabel: UIKit.UITextView { get set }
+ var title: Swift.String? { get set }
+ var message: Swift.String? { get set }
+ var image: UIKit.UIImage? { get set }
+ var customView: UIKit.UIView? { get set }
+ var imagePositon: DCloudAlertController.DCAlertImagePosition? { get set }
+ var buttons: [DCloudAlertController.DCAlertActionButton] { get }
+ var actionClickedHandler: ((_ action: DCloudAlertController.DCAlertAction) -> Swift.Void)? { get set }
+ func addAction(_ action: DCloudAlertController.DCAlertAction)
+ func setHairLineColor(_ hairLineColor: UIKit.UIColor?)
+}
+@objc @_inheritsConvenienceInitializers public class DCRIButtonItem : ObjectiveC.NSObject {
+ public static func item() -> DCloudAlertController.DCRIButtonItem
+ public static func itemWithLabel(_ inLabel: Swift.String) -> DCloudAlertController.DCRIButtonItem
+ public static func itemWithLabel(_ inLabel: Swift.String, _ labelColor: UIKit.UIColor? = nil, inAction action: @escaping (() -> Swift.Void)) -> DCloudAlertController.DCRIButtonItem
+ @objc override dynamic public init()
+ @objc deinit
+}
+@objc @_hasMissingDesignatedInitializers @_Concurrency.MainActor(unsafe) public class DCActionSheetController : UIKit.UIViewController {
+ @_Concurrency.MainActor(unsafe) public init(noticeTitle: Swift.String)
+ @_Concurrency.MainActor(unsafe) @objc override dynamic public func loadView()
+ @_Concurrency.MainActor(unsafe) @objc override dynamic public func viewDidLoad()
+ @_Concurrency.MainActor(unsafe) @objc override dynamic public func viewDidLayoutSubviews()
+ @_Concurrency.MainActor(unsafe) public func addAction(_ action: DCloudAlertController.DCAlertAction)
+ @_Concurrency.MainActor(unsafe) public func addAction(_ title: Swift.String, _ style: DCloudAlertController.DCAlertActionStyle, _ handler: @escaping (_ action: DCloudAlertController.DCAlertAction) -> Swift.Void) -> DCloudAlertController.DCAlertAction
+ @_Concurrency.MainActor(unsafe) public func show()
+ @objc deinit
+}
+extension DCloudAlertController.DCActionSheetController : UIKit.UITableViewDelegate, UIKit.UITableViewDataSource {
+ @_Concurrency.MainActor(unsafe) @objc dynamic public func numberOfSections(in tableView: UIKit.UITableView) -> Swift.Int
+ @_Concurrency.MainActor(unsafe) @objc dynamic public func tableView(_ tableView: UIKit.UITableView, numberOfRowsInSection section: Swift.Int) -> Swift.Int
+ @_Concurrency.MainActor(unsafe) @objc dynamic public func tableView(_ tableView: UIKit.UITableView, cellForRowAt indexPath: Foundation.IndexPath) -> UIKit.UITableViewCell
+ @_Concurrency.MainActor(unsafe) @objc dynamic public func tableView(_ tableView: UIKit.UITableView, didSelectRowAt indexPath: Foundation.IndexPath)
+ @_Concurrency.MainActor(unsafe) @objc dynamic public func tableView(_ tableView: UIKit.UITableView, heightForRowAt indexPath: Foundation.IndexPath) -> CoreGraphics.CGFloat
+ @_Concurrency.MainActor(unsafe) @objc dynamic public func tableView(_ tableView: UIKit.UITableView, heightForFooterInSection section: Swift.Int) -> CoreGraphics.CGFloat
+ @_Concurrency.MainActor(unsafe) @objc dynamic public func tableView(_ tableView: UIKit.UITableView, viewForFooterInSection section: Swift.Int) -> UIKit.UIView?
+}
+public enum DCAlertViewControllerStyle : Swift.Int {
+ case alert
+ case textViewAlert
+ public init?(rawValue: Swift.Int)
+ public typealias RawValue = Swift.Int
+ public var rawValue: Swift.Int {
+ get
+ }
+}
+public protocol DCAlertViewControllerDismissDelegate : UIKit.UITextViewDelegate {
+ func canDismissWithAction(_ action: DCloudAlertController.DCAlertAction?, _ param: Any?) -> Swift.Bool
+}
+@objc @_hasMissingDesignatedInitializers @_Concurrency.MainActor(unsafe) public class DCAlertViewController : UIKit.UIViewController {
+ @_Concurrency.MainActor(unsafe) public var canOpenDarkMode: Swift.Bool
+ @_Concurrency.MainActor(unsafe) public var contentViewVisible: Swift.Bool {
+ get
+ set
+ }
+ @_Concurrency.MainActor(unsafe) public var mesageTitle: Swift.String? {
+ get
+ set
+ }
+ @_Concurrency.MainActor(unsafe) public var message: Swift.String? {
+ get
+ set
+ }
+ @_Concurrency.MainActor(unsafe) public var textViewText: Swift.String? {
+ get
+ }
+ @_Concurrency.MainActor(unsafe) public var textView: UIKit.UITextView? {
+ get
+ }
+ @_Concurrency.MainActor(unsafe) weak public var dismissDelegate: DCloudAlertController.DCAlertViewControllerDismissDelegate? {
+ get
+ set
+ }
+ @_Concurrency.MainActor(unsafe) public var preferredStyle: DCloudAlertController.DCAlertViewControllerStyle
+ @_Concurrency.MainActor(unsafe) public var tapGesture: UIKit.UITapGestureRecognizer?
+ @_Concurrency.MainActor(unsafe) public var contentView: (UIKit.UIView & DCloudAlertController.DCAlertControllerContentViewProtocol)?
+ @objc deinit
+ @_Concurrency.MainActor(unsafe) public init(_ title: Swift.String?, _ message: Swift.String?, _ preferredStyle: DCloudAlertController.DCAlertViewControllerStyle, _ placeholder: Swift.String?)
+ @_Concurrency.MainActor(unsafe) public init(_ customView: UIKit.UIView & DCloudAlertController.DCAlertControllerContentViewProtocol, _ preferredStyle: DCloudAlertController.DCAlertViewControllerStyle)
+ @_Concurrency.MainActor(unsafe) @objc override dynamic public func loadView()
+ @_Concurrency.MainActor(unsafe) @objc override dynamic public func viewWillLayoutSubviews()
+ @_Concurrency.MainActor(unsafe) @objc override dynamic public func viewDidLoad()
+ @_Concurrency.MainActor(unsafe) public func alertControllerWithTitle(_ title: Swift.String?, _ message: Swift.String?, _ preferredStyle: DCloudAlertController.DCAlertViewControllerStyle, _ placeholder: Swift.String?) -> DCloudAlertController.DCAlertViewController
+ @_Concurrency.MainActor(unsafe) public func alertControllerWithCustomView(_ view: UIKit.UIView & DCloudAlertController.DCAlertControllerContentViewProtocol, _ preferredStyle: DCloudAlertController.DCAlertViewControllerStyle) -> DCloudAlertController.DCAlertViewController
+ @_Concurrency.MainActor(unsafe) public func addActionWithTitle(_ title: Foundation.NSString, _ style: DCloudAlertController.DCAlertActionStyle, _ handler: @escaping (_ action: DCloudAlertController.DCAlertAction) -> Swift.Void) -> DCloudAlertController.DCAlertAction
+ @_Concurrency.MainActor(unsafe) public func addImage(_ image: UIKit.UIImage, _ position: DCloudAlertController.DCAlertImagePosition)
+ @_Concurrency.MainActor(unsafe) public func addCustomView(_ customView: UIKit.UIView)
+ @_Concurrency.MainActor(unsafe) public func addAction(_ action: DCloudAlertController.DCAlertAction)
+ @_Concurrency.MainActor(unsafe) public func addTapGesture()
+ @_Concurrency.MainActor(unsafe) public func onTapAction(_ action: DCloudAlertController.DCAlertAction)
+ @_Concurrency.MainActor(unsafe) public func resetDoneBtnTitleColor(_ color: UIKit.UIColor)
+}
+extension DCloudAlertController.DCAlertViewController : UIKit.UIViewControllerTransitioningDelegate {
+ @_Concurrency.MainActor(unsafe) @objc dynamic public func animationController(forPresented presented: UIKit.UIViewController, presenting: UIKit.UIViewController, source: UIKit.UIViewController) -> UIKit.UIViewControllerAnimatedTransitioning?
+ @_Concurrency.MainActor(unsafe) @objc dynamic public func animationController(forDismissed dismissed: UIKit.UIViewController) -> UIKit.UIViewControllerAnimatedTransitioning?
+}
+public typealias DCAlertView = DCloudAlertController.DCAlertViewController
+extension DCloudAlertController.DCAlertViewController {
+ @_Concurrency.MainActor(unsafe) public func show()
+ @_Concurrency.MainActor(unsafe) public func dismiss()
+ @_Concurrency.MainActor(unsafe) public static func alertView(_ title: Swift.String, _ doneItem: DCloudAlertController.DCRIButtonItem, _ preferredStyle: DCloudAlertController.DCAlertViewControllerStyle = .alert, _ placeholder: Swift.String = "") -> DCloudAlertController.DCAlertView
+ @_Concurrency.MainActor(unsafe) public static func alertView(_ title: Swift.String?, _ cancelItem: DCloudAlertController.DCRIButtonItem, _ doneItem: DCloudAlertController.DCRIButtonItem, _ preferredStyle: DCloudAlertController.DCAlertViewControllerStyle = .alert, _ placeholder: Swift.String = "") -> DCloudAlertController.DCAlertView
+ @_Concurrency.MainActor(unsafe) public static func alertView(_ title: Swift.String?, _ subTitle: Swift.String?, _ doneItem: DCloudAlertController.DCRIButtonItem, _ preferredStyle: DCloudAlertController.DCAlertViewControllerStyle = .alert, _ placeholder: Swift.String = "") -> DCloudAlertController.DCAlertView
+ @_Concurrency.MainActor(unsafe) public static func alertView(_ title: Swift.String?, _ subTitle: Swift.String?, _ cancelItem: DCloudAlertController.DCRIButtonItem, _ doneItem: DCloudAlertController.DCRIButtonItem, _ preferredStyle: DCloudAlertController.DCAlertViewControllerStyle = .alert, _ placeholder: Swift.String = "") -> DCloudAlertController.DCAlertView
+ @_Concurrency.MainActor(unsafe) public static func alertView(_ title: Swift.String?, _ subTitle: Swift.String?, _ cancelItem: DCloudAlertController.DCRIButtonItem, _ cancelActionStyle: DCloudAlertController.DCAlertActionStyle, _ doneItem: DCloudAlertController.DCRIButtonItem, _ doneActionStyle: DCloudAlertController.DCAlertActionStyle, _ preferredStyle: DCloudAlertController.DCAlertViewControllerStyle, _ placeholder: Swift.String = "") -> DCloudAlertController.DCAlertView
+}
+extension DCloudAlertController.DCAlertActionStyle : Swift.Equatable {}
+extension DCloudAlertController.DCAlertActionStyle : Swift.Hashable {}
+extension DCloudAlertController.DCAlertActionStyle : Swift.RawRepresentable {}
+extension DCloudAlertController.DCAlertImagePosition : Swift.Equatable {}
+extension DCloudAlertController.DCAlertImagePosition : Swift.Hashable {}
+extension DCloudAlertController.DCAlertImagePosition : Swift.RawRepresentable {}
+extension DCloudAlertController.DCAlertViewControllerStyle : Swift.Equatable {}
+extension DCloudAlertController.DCAlertViewControllerStyle : Swift.Hashable {}
+extension DCloudAlertController.DCAlertViewControllerStyle : Swift.RawRepresentable {}
diff --git a/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCloudAlertController.framework/Modules/DCloudAlertController.swiftmodule/x86_64.swiftmodule b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCloudAlertController.framework/Modules/DCloudAlertController.swiftmodule/x86_64.swiftmodule
new file mode 100644
index 0000000000000000000000000000000000000000..93fef5176a633f41277d73843f52ec632dbd9e14
Binary files /dev/null and b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCloudAlertController.framework/Modules/DCloudAlertController.swiftmodule/x86_64.swiftmodule differ
diff --git a/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCloudAlertController.framework/Modules/module.modulemap b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCloudAlertController.framework/Modules/module.modulemap
new file mode 100644
index 0000000000000000000000000000000000000000..1411e16467da11aeee8f47811b5b1f12f9bc1198
--- /dev/null
+++ b/uni_modules/uni-prompt/utssdk/app-ios/Frameworks/DCloudAlertController.framework/Modules/module.modulemap
@@ -0,0 +1,11 @@
+framework module DCloudAlertController {
+ umbrella header "DCloudAlertController.h"
+
+ export *
+ module * { export * }
+}
+
+module DCloudAlertController.Swift {
+ header "DCloudAlertController-Swift.h"
+ requires objc
+}
diff --git a/uni_modules/uni-prompt/utssdk/app-ios/Resources/uni_uts_toast_error.png b/uni_modules/uni-prompt/utssdk/app-ios/Resources/uni_uts_toast_error.png
new file mode 100644
index 0000000000000000000000000000000000000000..4743b25e1284270fee6ba8fefdb5265f6c451a93
Binary files /dev/null and b/uni_modules/uni-prompt/utssdk/app-ios/Resources/uni_uts_toast_error.png differ
diff --git a/uni_modules/uni-prompt/utssdk/app-ios/Resources/uni_uts_toast_success.png b/uni_modules/uni-prompt/utssdk/app-ios/Resources/uni_uts_toast_success.png
new file mode 100644
index 0000000000000000000000000000000000000000..c1f5bd7c5293dcc37284f30b215ff2a3779c316f
Binary files /dev/null and b/uni_modules/uni-prompt/utssdk/app-ios/Resources/uni_uts_toast_success.png differ
diff --git a/uni_modules/uni-prompt/utssdk/app-ios/index.uts b/uni_modules/uni-prompt/utssdk/app-ios/index.uts
new file mode 100644
index 0000000000000000000000000000000000000000..d1468692a849b2245092e95c679fd7f5a259c7f6
--- /dev/null
+++ b/uni_modules/uni-prompt/utssdk/app-ios/index.uts
@@ -0,0 +1,30 @@
+import { ShowActionSheetOptions, ShowModalOptions, ShowToastOptions, ShowLoadingOptions, ShowToast, HideToast, ShowLoading, HideLoading, ShowModal, ShowActionSheet } from "../interface.uts"
+import * as ToastModule from "./showToast.uts"
+import * as ModalModule from "./showModal.uts"
+import * as ActionSheetModule from "./showActionSheet.uts"
+
+
+export const showToast : ShowToast = function (options : ShowToastOptions) {
+ ToastModule.toShowToast(options)
+}
+
+export const hideToast : HideToast = function () {
+ ToastModule.toHideToast()
+}
+
+export const showLoading : ShowLoading = function (options : ShowLoadingOptions) {
+ ToastModule.toShowLoading(options)
+}
+
+export const hideLoading : HideLoading = function () {
+ ToastModule.toHideLoading()
+}
+
+export const showModal : ShowModal = function (options : ShowModalOptions) {
+ ModalModule.toShowModal(options)
+}
+
+export const showActionSheet : ShowActionSheet = function (options : ShowActionSheetOptions) {
+ ActionSheetModule.actionSheet(options)
+}
+
diff --git a/uni_modules/uni-prompt/utssdk/app-ios/showActionSheet.uts b/uni_modules/uni-prompt/utssdk/app-ios/showActionSheet.uts
new file mode 100644
index 0000000000000000000000000000000000000000..dfbf4354e99a49a6832d391f83e74a642f16406a
--- /dev/null
+++ b/uni_modules/uni-prompt/utssdk/app-ios/showActionSheet.uts
@@ -0,0 +1,72 @@
+import { UIPopoverArrowDirection , UIDevice , UIUserInterfaceIdiom, CGRect } from "UIKit"
+import { UTSiOS } from "DCloudUTSFoundation"
+import { DispatchQueue } from 'Dispatch';
+import { DCActionSheetController, DCAlertAction, DCAlertActionStyle } from "DCloudAlertController" assert { type: "implementationOnly" };
+import { ShowActionSheetOptions, ShowActionSheetSuccess, ShowActionSheetFail } from '../interface.uts'
+
+
+export function actionSheet(options : ShowActionSheetOptions) {
+ const itemList = options.itemList!
+ if (itemList.length < 1) {
+ let res = new UniError("uni-prompt",-3,"showActionSheet:fail cancel");
+ options.fail?.(res)
+ options.complete?.(res)
+ return
+ }
+
+ // uts方法默认会在子线程中执行,涉及 UI 操作必须在主线程中运行,通过 DispatchQueue.main.async 方法可将代码在主线程中运行
+ DispatchQueue.main.async(execute = () : void => {
+ // 初始化actionSheet的实例
+ let actionSheet = DCActionSheetController.init(noticeTitle = options.title ?? "")
+
+ // 创建普通按钮
+ itemList.forEach((item : string, index : number) => {
+
+ let action = DCAlertAction.init(title = item, style = DCAlertActionStyle.defaultStyle, handler = (action: DCAlertAction): void => {
+ // 点击按钮的回调方法
+ const res: ShowActionSheetSuccess = {
+ tapIndex: index + 1,
+ }
+ options.success?.(res)
+ options.complete?.(res)
+ })
+
+ if (options.itemColor != null) {
+ const color = UTSiOS.colorWithString(options.itemColor!)
+ action.titleColor = color
+ }
+ actionSheet.addAction(action)
+ })
+ let cancelAction = DCAlertAction.init(title = "取消", style = DCAlertActionStyle.cancelStyle, handler = (action: DCAlertAction): void => {
+ // 点击按钮的回调方法
+ let res = new UniError("uni-prompt",1002,"showActionSheet:fail cancel");
+ options.fail?.(res)
+ options.complete?.(res)
+ })
+ if (options.itemColor != null) {
+ const color = UTSiOS.colorWithString(options.itemColor!)
+ cancelAction.titleColor = color
+ }
+ actionSheet.addAction(cancelAction)
+
+ // 判断是否设置popover
+ const isPad = UIDevice.current.userInterfaceIdiom == UIUserInterfaceIdiom.pad
+ if (options.popover != null && isPad == true) {
+ let popoverController = actionSheet.popoverPresentationController
+ if (popoverController != null) {
+ let sourceView = UTSiOS.getCurrentViewController().view
+ if (sourceView != null) {
+ let sourceRect = CGRect(x = options.popover!.left.toDouble(), y = options.popover!.top.toDouble(), width = options.popover!.width.toDouble(), height = options.popover!.height.toDouble())
+ if (options.popover!.height == -1) {
+ sourceRect = CGRect(x = sourceView!.bounds.midX, y = sourceView!.bounds.maxY, width = 1.0, height = 1.0)
+ }
+ popoverController!.sourceView = sourceView
+ popoverController!.sourceRect = sourceRect
+ popoverController!.permittedArrowDirections = UIPopoverArrowDirection.any
+ }
+ }
+ }
+ actionSheet.show()
+ })
+}
+
diff --git a/uni_modules/uni-prompt/utssdk/app-ios/showModal.uts b/uni_modules/uni-prompt/utssdk/app-ios/showModal.uts
new file mode 100644
index 0000000000000000000000000000000000000000..184b42bb08c50269f523243c085aac672a6c1116
--- /dev/null
+++ b/uni_modules/uni-prompt/utssdk/app-ios/showModal.uts
@@ -0,0 +1,78 @@
+import { UTSiOS } from "DCloudUTSFoundation"
+import { DispatchQueue } from 'Dispatch';
+import { DCAlertAction, DCAlertActionStyle, DCAlertView, DCAlertViewControllerStyle } from "DCloudAlertController" assert { type: "implementationOnly" };
+import { ShowModalOptions, ShowModalSuccess, ShowModalFail } from '../interface.uts'
+
+export function toShowModal(options: ShowModalOptions) {
+ // 参数解析
+ const title = options.title == null ? "" : options.title!
+ const message = options.content == null ? "" : options.content!
+ const showCancel = options.showCancel == null ? true : (options.showCancel != false)
+ const cancelText = options.cancelText == null ? "取消" : options.cancelText!
+ const confirmText = options.confirmText == null ? "确定" : options.confirmText!
+ const canEidt = options.editable == null ? false : (options.editable != false)
+ const placeholderText = options.placeholderText == null ? "" : options.placeholderText!
+
+ // uts方法默认会在子线程中执行,涉及 UI 操作必须在主线程中运行,通过 DispatchQueue.main.async 方法可将代码在主线程中运行
+ DispatchQueue.main.async(execute = (): void => {
+
+ // 初始化 DCAlertView 实例对象 alert
+ const style: DCAlertViewControllerStyle = canEidt ? DCAlertViewControllerStyle.textViewAlert : DCAlertViewControllerStyle.alert
+ const alert = DCAlertView.init(title, message, style, placeholderText)
+
+ // 取消按钮及其回调
+ if (showCancel) {
+ const cancelAction = DCAlertAction.init(title = cancelText, style = DCAlertActionStyle.cancelStyle, handler = (action: DCAlertAction): void => {
+ // 获取输入框中的内容
+ let inputText = ""
+ if (canEidt == true) {
+ inputText = alert.textView?.text ?? ""
+ }
+ // 点击按钮的回调方法
+ const res: ShowModalSuccess = {
+ confirm: true,
+ cancel: false,
+ content: inputText
+ }
+ options.success?.(res)
+ options.complete?.(res)
+ })
+ // 自定义取消按钮颜色
+ if (options.cancelColor != null) {
+ const color = UTSiOS.colorWithString(options.cancelColor!)
+ cancelAction.titleColor = color
+ }
+ // 添加action
+ alert.addAction(cancelAction)
+ }
+
+ // 确定按钮及其回调
+ const okAction = DCAlertAction.init(title = confirmText, style = DCAlertActionStyle.preferredStyle, handler = (action: DCAlertAction): void => {
+ // 获取输入框中的内容
+ let inputText = ""
+ if (canEidt == true) {
+ inputText = alert.textView?.text ?? ""
+ }
+
+ // 点击按钮的回调方法
+ const res: ShowModalSuccess = {
+ confirm: true,
+ cancel: false,
+ content: inputText
+ }
+ options.success?.(res)
+ options.complete?.(res)
+ })
+ // 自定义确定按钮颜色
+ if (options.confirmColor != null) {
+ const color = UTSiOS.colorWithString(options.confirmColor!)
+ okAction.titleColor = color
+ }
+ // 添加action
+ alert.addAction(okAction)
+
+ // 弹出alert
+ alert.show()
+ })
+}
+
diff --git a/uni_modules/uni-prompt/utssdk/app-ios/showToast.uts b/uni_modules/uni-prompt/utssdk/app-ios/showToast.uts
new file mode 100644
index 0000000000000000000000000000000000000000..5689bc199081ede2a4c7163d481b08171dbb6aa5
--- /dev/null
+++ b/uni_modules/uni-prompt/utssdk/app-ios/showToast.uts
@@ -0,0 +1,99 @@
+import { UTSiOS } from "DCloudUTSFoundation"
+import { MCToast, MCToastConfig } from "DCUniToast" assert { type: "implementationOnly" };
+import { UIScreen, UIImage } from 'UIKit'
+import { ShowToastOptions, ShowLoadingOptions, ShowToastSuccess, ShowToastFail, ShowLoadingSuccess, ShowLoadingFail } from '../interface.uts'
+
+/* 显示toast */
+export function toShowToast(options: ShowToastOptions) {
+ if (options.title == null || options.title.length == 0) {
+ let res = new UniError("uni-prompt",1001,"showLoading:title is null");
+ options.fail?.(res)
+ options.complete?.(res)
+ } else {
+ //duration
+ let duration = 2.5
+ if (options.duration != null) {
+ duration = options.duration! / 1000
+ }
+ //mask
+ let mask = MCToast.MCToastRespond.default
+ if (options.mask == true) {
+ mask = MCToast.MCToastRespond.noRespond
+ }
+ MCToastConfig.shared.background.size = CGSize.init(width = 135, height = 120);
+ //position
+ if (options.position != null) {
+ const interval = Float(UIScreen.main.bounds.height * 0.25)
+ let centerPoint = 0.0 //正下 负上
+ if (options.position == "top") {
+ centerPoint = 0 - interval
+ } else if (options.position == "center") {
+ centerPoint = 0.0
+ } else {
+ centerPoint = Number(interval)
+ }
+ MCToast.mc_text(options.title, offset = CGFloat(centerPoint.toFloat()), duration = CGFloat(duration.toFloat()), respond = mask)
+ } else {
+ MCToastConfig.shared.icon.successImage = new UIImage(named = "uni_uts_toast_success.png")
+ MCToastConfig.shared.icon.failureImage = new UIImage(named = "uni_uts_toast_error.png")
+ if (options.image != null) {
+ const imagePath = UTSiOS.getResourcePath(options.image!)
+ const image = new UIImage(contentsOfFile = imagePath)
+ MCToast.showStatus(MCToast.MCToastType.success, text = options.title, iconImage = image, duration = CGFloat(duration.toFloat()), respond = mask)
+
+ } else if (options.icon != null) {
+ if (options.icon == "success") {
+ MCToast.mc_success(options.title, duration = CGFloat(duration.toFloat()), respond = mask)
+ } else if (options.icon == "error") {
+ MCToast.mc_failure(options.title, duration = CGFloat(duration.toFloat()), respond = mask)
+ } else if (options.icon == "loading") {
+ MCToast.mc_loading(text = options.title, duration = CGFloat(duration.toFloat()), respond = mask)
+ } else {
+ MCToast.mc_text(options.title, offset = 0, duration = CGFloat(duration.toFloat()), respond = mask)
+ }
+ } else {
+ MCToast.mc_success(options.title, duration = CGFloat(duration.toFloat()), respond = mask)
+ }
+ }
+ const res: ShowToastSuccess = {
+ }
+ options.success?.(res)
+ options.complete?.(res)
+ }
+
+}
+
+/* 隐藏toast */
+export function toHideToast() {
+ MCToast.mc_remove()
+}
+
+/* 显示loading + text */
+export function toShowLoading(options: ShowLoadingOptions) {
+ if (options.title == null || options.title.length == 0) {
+ let res = new UniError("uni-prompt",1001,"showLoading:title is null");
+ options.fail?.(res)
+ options.complete?.(res)
+ } else {
+ // mask
+ let mask = MCToast.MCToastRespond.default
+ if (options.mask == true) {
+ mask = MCToast.MCToastRespond.noRespond
+ }
+ // config
+ MCToastConfig.shared.background.size = CGSize.init(width = 135, height = 120);
+ // show loading
+ MCToast.mc_loading(text = options.title, respond = mask)
+ // callback
+ const res: ShowLoadingSuccess = {
+ }
+ options.success?.(res)
+ options.complete?.(res)
+ }
+
+}
+
+/* 隐藏loading */
+export function toHideLoading() {
+ MCToast.mc_remove()
+}
\ No newline at end of file
diff --git a/uni_modules/uni-prompt/utssdk/interface.uts b/uni_modules/uni-prompt/utssdk/interface.uts
new file mode 100644
index 0000000000000000000000000000000000000000..b37cececa856f298bb58cc1c58917737ecb72b15
--- /dev/null
+++ b/uni_modules/uni-prompt/utssdk/interface.uts
@@ -0,0 +1,597 @@
+/**
+ * uni.showToast成功回调参数
+ */
+export type ShowToastSuccess = {
+}
+
+/**
+ * uni.showToast成功回调函数定义
+ */
+export type ShowToastSuccessCallback = (res: ShowToastSuccess) => void
+/**
+ * uni.showToast失败回调函数定义
+ */
+export type ShowToastFailCallback = (res: UniError) => void
+/**
+ * uni.showToast完成回调函数定义
+ */
+export type ShowToastCompleteCallback = (res: any) => void
+
+/**
+ * uni.showToast参数定义
+ */
+export type ShowToastOptions = {
+ /**
+ * 提示的内容,长度与 icon 取值有关。
+ */
+ title: string,
+ /**
+ * 图标,有效值详见下方说明,默认:success。
+ * @description icon值说明 success: 显示成功图标,error: 显示错误图标; fail: 显示错误图标,此时title文本无长度显示; exception: 显示异常图标,此时title文本无长度显示; loading: 显示加载图标;none: 不显示图标。
+ */
+ icon?: string | null,
+ /**
+ * 自定义图标的本地路径(app端暂不支持gif)
+ */
+ image?: string | null,
+ /**
+ * 是否显示透明蒙层,防止触摸穿透,默认:false
+ */
+ mask?: boolean | null,
+ /**
+ * 提示的延迟时间,单位毫秒,默认:1500
+ */
+ duration?: number | null,
+ /**
+ * 纯文本轻提示显示位置,填写有效值后只有 title 属性生效,且不支持通过 uni.hideToast 隐藏。
+ * @description position值说明(仅App生效) top: 居上显示; center: 居中显示;bottom: 居底显示
+ */
+ position?: string | null,
+ /**
+ * 接口调用成功的回调函数
+ */
+ success?: ShowToastSuccessCallback | null,
+ /**
+ * 接口调用失败的回调函数
+ */
+ fail?: ShowToastFailCallback | null,
+ /**
+ * 接口调用结束的回调函数(调用成功、失败都会执行)
+ */
+ complete?: ShowToastCompleteCallback | null
+}
+
+/**
+ * uni.showToast函数定义
+ * 弹出toast
+ *
+ * @param {ShowToastOptions} options
+ * @tutorial https://uniapp.dcloud.net.cn/api/ui/prompt.html#showtoast
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "4.4.4",
+ * "uniVer": "√",
+ * "unixVer": "3.9.0"
+ * },
+ * "ios": {
+ * "osVer": "9.0",
+ * "uniVer": "√",
+ * "unixVer": "x"
+ * }
+ * }
+ * }
+ */
+export type ShowToast = (options: ShowToastOptions) => void
+
+/**
+ * uni.hideToast函数定义
+ * 隐藏toast
+ *
+ * @tutorial https://uniapp.dcloud.net.cn/api/ui/prompt.html#hidetoast
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "4.4.4",
+ * "uniVer": "√",
+ * "unixVer": "3.9.0"
+ * },
+ * "ios": {
+ * "osVer": "9.0",
+ * "uniVer": "√",
+ * "unixVer": "x"
+ * }
+ * }
+ * }
+ */
+export type HideToast = () => void
+
+
+/**
+ * uni.showLoading成功回调参数
+ */
+export type ShowLoadingSuccess = {
+}
+
+/**
+ * uni.showLoading成功回调函数定义
+ */
+export type ShowLoadingSuccessCallback = (res: ShowLoadingSuccess) => void
+/**
+ * uni.showLoading失败回调函数定义
+ */
+export type ShowLoadingFailCallback = (res: UniError) => void
+/**
+ * uni.showLoading完成回调函数定义
+ */
+export type ShowLoadingCompleteCallback = (res: any) => void
+
+/**
+ * uni.showLoading参数定义
+ */
+export type ShowLoadingOptions = {
+ /**
+ * 提示的内容,长度与 icon 取值有关。
+ */
+ title: string,
+ /**
+ * 是否显示透明蒙层,防止触摸穿透,默认:false
+ */
+ mask?: boolean | null,
+ /**
+ * 接口调用成功的回调函数
+ */
+ success?: ShowLoadingSuccessCallback | null,
+ /**
+ * 接口调用失败的回调函数
+ */
+ fail?: ShowLoadingFailCallback | null,
+ /**
+ * 接口调用结束的回调函数(调用成功、失败都会执行)
+ */
+ complete?: ShowLoadingCompleteCallback | null
+}
+
+/**
+ * uni.showLoading函数定义
+ * 弹出loading
+ *
+ * @param {ShowLoadingOptions} options
+ * @tutorial https://uniapp.dcloud.net.cn/api/ui/prompt.html#showloading
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "4.4.4",
+ * "uniVer": "√",
+ * "unixVer": "3.9.0"
+ * },
+ * "ios": {
+ * "osVer": "9.0",
+ * "uniVer": "√",
+ * "unixVer": "x"
+ * }
+ * }
+ * }
+ */
+export type ShowLoading = (options: ShowLoadingOptions) => void
+
+/**
+ * uni.hideLoading函数定义
+ * 隐藏loading
+ *
+ * @tutorial https://uniapp.dcloud.net.cn/api/ui/prompt.html#hideloading
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "4.4.4",
+ * "uniVer": "√",
+ * "unixVer": "3.9.0"
+ * },
+ * "ios": {
+ * "osVer": "9.0",
+ * "uniVer": "√",
+ * "unixVer": "x"
+ * }
+ * }
+ * }
+ *
+ */
+export type HideLoading = () => void
+
+/**
+ * uni.showModal 成功回调参数
+ */
+export type ShowModalSuccess = {
+ /**
+ * 为 true 时,表示用户点击了确定按钮
+ */
+ confirm: boolean,
+ /**
+ * 为 true 时,表示用户点击了取消(用于 Android 系统区分点击蒙层关闭还是点击取消按钮关闭)
+ */
+ cancel: boolean,
+ /**
+ * editable 为 true 时,用户输入的文本
+ */
+ content: string | null
+}
+
+/**
+ * uni.showModal成功回调函数定义
+ */
+export type ShowModalSuccessCallback = (res: ShowModalSuccess) => void
+/**
+ * uni.showModal失败回调函数定义
+ */
+export type ShowModalFailCallback = (res: UniError) => void
+/**
+ * uni.showModal完成回调函数定义
+ */
+export type ShowModalCompleteCallback = (res: any) => void
+/**
+ * uni.showModal 参数定义
+ */
+export type ShowModalOptions = {
+ /**
+ * 提示的标题
+ */
+ title?: string | null,
+ /**
+ * 提示的内容
+ */
+ content?: string | null,
+ /**
+ * @default true
+ * 是否显示取消按钮,默认为 true
+ */
+ showCancel?: boolean | null,
+ /**
+ * 取消按钮的文字,默认为"取消"
+ */
+ cancelText?: string | null,
+ /**
+ * 取消按钮的文字颜色,默认为"#000000"
+ */
+ cancelColor?: string | null,
+ /**
+ * 确定按钮的文字,默认为"确定"
+ */
+ confirmText?: string | null,
+ /**
+ * 确定按钮的文字颜色
+ */
+ confirmColor?: string | null,
+ /**
+ * @default false
+ * 是否显示输入框
+ */
+ editable?: boolean | null,
+ /**
+ * 显示输入框时的提示文本
+ */
+ placeholderText?: string | null,
+ /**
+ * 接口调用成功的回调函数
+ */
+ success?: ShowModalSuccessCallback | null,
+ /**
+ * 接口调用失败的回调函数
+ */
+ fail?: ShowModalFailCallback | null,
+ /**
+ * 接口调用结束的回调函数(调用成功、失败都会执行)
+ */
+ complete?: ShowModalCompleteCallback | null
+}
+
+/**
+ * uni.showModal 函数定义
+ *
+ * 弹出modal
+ *
+ * @param {ShowModalOptions} options
+ * @tutorial https://uniapp.dcloud.net.cn/api/ui/prompt.html#showmodal
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "4.4.4",
+ * "uniVer": "√",
+ * "unixVer": "3.9.0"
+ * },
+ * "ios": {
+ * "osVer": "9.0",
+ * "uniVer": "√",
+ * "unixVer": "x"
+ * }
+ * }
+ * }
+ */
+export type ShowModal = (options: ShowModalOptions) => void
+
+/**
+ * uni.ShowActionSheet成功回调参数
+ */
+export type ShowActionSheetSuccess = {
+ /**
+ * 用户点击的按钮,从上到下的顺序,从0开始
+ */
+ tapIndex: number | null,
+}
+
+export type Popover = {
+ /**
+ * 指示区域坐标,使用原生 navigationBar 时一般需要加上 navigationBar 的高度
+ */
+ top: number,
+ /**
+ * 指示区域坐标
+ */
+ left: number,
+ /**
+ * 指示区域宽度
+ */
+ width: number,
+ /**
+ * 指示区域高度
+ */
+ height: number
+}
+
+/**
+ * uni.showActionSheet成功回调函数定义
+ */
+export type ShowActionSheetSuccessCallback = (res: ShowActionSheetSuccess) => void
+/**
+ * uni.showActionSheet成功回调函数定义
+ */
+export type ShowActionSheetFailCallback = (res: UniError) => void
+/**
+ * uni.showActionSheet成功回调函数定义
+ */
+export type ShowActionSheetCompleteCallback = (res: any) => void
+
+/**
+ * uni.showActionSheet函数参数定义
+ */
+export type ShowActionSheetOptions = {
+ /**
+ * 菜单标题
+ */
+ title?: string | null,
+ /**
+ * 警示文案(同菜单标题, app无效)
+ */
+ alertText?: string | null,
+ /**
+ * 按钮的文字数组
+ */
+ itemList: string[],
+ /**
+ * 按钮的文字颜色,字符串格式(iOS默认为系统控件颜色)
+ */
+ itemColor?: string | null,
+ /**
+ * 大屏设备弹出原生选择按钮框的指示区域,默认居中显示
+ */
+ popover?: Popover | null,
+ /**
+ * 接口调用成功的回调函数
+ */
+ success?: ShowActionSheetSuccessCallback | null,
+ /**
+ * 接口调用失败的回调函数
+ */
+ fail?: ShowActionSheetFailCallback | null,
+ /**
+ * 接口调用结束的回调函数(调用成功、失败都会执行)
+ */
+ complete?: ShowActionSheetCompleteCallback | null
+}
+
+/**
+ * uni.showActionSheet函数定义
+ *
+ * 弹出actionSheet
+ *
+ * @param {ShowActionSheetOptions} options
+ * @tutorial https://uniapp.dcloud.net.cn/api/ui/prompt.html#showactionsheet
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "4.4.4",
+ * "uniVer": "√",
+ * "unixVer": "3.9.0"
+ * },
+ * "ios": {
+ * "osVer": "9.0",
+ * "uniVer": "√",
+ * "unixVer": "x"
+ * }
+ * }
+ * }
+ */
+export type ShowActionSheet = (options: ShowActionSheetOptions) => void
+
+
+export interface Uni {
+ /**
+ * @description 显示消息提示框
+ * @param {ShowToastOptions} option
+ * @example
+ * ```typescript
+ * uni.showToast({
+ * title: '标题',
+ * duration: 2000
+ * });
+ * ```
+ * @remark
+ * - showLoading 和 showToast 同时只能显示一个
+ * - showToast 应与 hideToast 配对使用
+ * @tutorial [](https://uniapp.dcloud.net.cn/api/ui/prompt.html#showtoast)
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "4.4.4",
+ * "uniVer": "√",
+ * "unixVer": "3.9.0"
+ * },
+ * "ios": {
+ * "osVer": "9.0",
+ * "uniVer": "√",
+ * "unixVer": "x"
+ * }
+ * }
+ * }
+ */
+ showToast(options: ShowToastOptions): void,
+ /**
+ * @description 隐藏消息提示框。
+ * @example
+ * ```typescript
+ * uni.hideToast();
+ * ```
+ * @tutorial [](https://uniapp.dcloud.net.cn/api/ui/prompt.html#hidetoast)
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "4.4.4",
+ * "uniVer": "√",
+ * "unixVer": "3.9.0"
+ * },
+ * "ios": {
+ * "osVer": "9.0",
+ * "uniVer": "√",
+ * "unixVer": "x"
+ * }
+ * }
+ * }
+ */
+ hideToast(): void,
+ /**
+ * @description 显示 loading 提示框, 需主动调用 uni.hideLoading 才能关闭提示框。
+ * @param {ShowLoadingOptions} option
+ * @example
+ * ```typescript
+ * uni.showLoading({
+ * title: '加载中'
+ * });
+ * ```
+ * @remark
+ * - showLoading 和 showToast 同时只能显示一个
+ * - showToast 应与 hideToast 配对使用
+ * @tutorial [](https://uniapp.dcloud.net.cn/api/ui/prompt.html#showloading)
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "4.4.4",
+ * "uniVer": "√",
+ * "unixVer": "3.9.0"
+ * },
+ * "ios": {
+ * "osVer": "9.0",
+ * "uniVer": "√",
+ * "unixVer": "x"
+ * }
+ * }
+ * }
+ */
+ showLoading(options: ShowLoadingOptions): void,
+ /**
+ * @description 隐藏 loading 提示框。
+ * @example
+ * ```typescript
+ * uni.showLoading({
+ * title: '加载中'
+ * });
+ *
+ * setTimeout(function () {
+ * uni.hideLoading();
+ * }, 2000);
+ *
+ * ```
+ * @tutorial [](https://uniapp.dcloud.net.cn/api/ui/prompt.html#hideloading)
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "4.4.4",
+ * "uniVer": "√",
+ * "unixVer": "3.9.0"
+ * },
+ * "ios": {
+ * "osVer": "9.0",
+ * "uniVer": "√",
+ * "unixVer": "x"
+ * }
+ * }
+ * }
+ */
+ hideLoading():void,
+ /**
+ * @description 显示模态弹窗,可以只有一个确定按钮,也可以同时有确定和取消按钮。类似于一个API整合了 html 中:alert、confirm。
+ * @param {ShowModalOptions} option
+ * @example
+ * ```typescript
+ * uni.showModal({
+ * title: '提示',
+ * content: '这是一个模态弹窗',
+ * success: function (res) {
+ * if (res.confirm) {
+ * console.log('用户点击确定');
+ * } else if (res.cancel) {
+ * console.log('用户点击取消');
+ * }
+ * }
+ * });
+ *
+ *
+ * ```
+ * @tutorial [](https://uniapp.dcloud.net.cn/api/ui/prompt.html#showmodal)
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "4.4.4",
+ * "uniVer": "√",
+ * "unixVer": "3.9.0"
+ * },
+ * "ios": {
+ * "osVer": "9.0",
+ * "uniVer": "√",
+ * "unixVer": "x"
+ * }
+ * }
+ * }
+ */
+ showModal(options: ShowModalOptions) : void,
+ /**
+ * @description 从底部向上弹出操作菜单
+ * @param {ShowActionSheetOptions} option
+ * @example
+ * ```typescript
+ * uni.showActionSheet({
+ * itemList: ['A', 'B', 'C'],
+ * success: function (res) {
+ * console.log('选中了第' + (res.tapIndex + 1) + '个按钮');
+ * },
+ * fail: function (res) {
+ * console.log(res.errMsg);
+ * }
+ * });
+ * ```
+ * @tutorial [](https://uniapp.dcloud.net.cn/api/ui/prompt.html#showactionsheet)
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "4.4.4",
+ * "uniVer": "√",
+ * "unixVer": "3.9.0"
+ * },
+ * "ios": {
+ * "osVer": "9.0",
+ * "uniVer": "√",
+ * "unixVer": "x"
+ * }
+ * }
+ * }
+ */
+ showActionSheet(options: ShowActionSheetOptions) : void
+}
diff --git a/uni_modules/uni-push/changelog.md b/uni_modules/uni-push/changelog.md
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/uni_modules/uni-push/package.json b/uni_modules/uni-push/package.json
new file mode 100644
index 0000000000000000000000000000000000000000..7674d4c16b2f4a8e848dafab5f70dddf0f1e2cf3
--- /dev/null
+++ b/uni_modules/uni-push/package.json
@@ -0,0 +1,125 @@
+{
+ "id": "uni-push",
+ "displayName": "uni-push",
+ "version": "1.0.0",
+ "description": "uni-push",
+ "keywords": [
+ "uni-push"
+ ],
+ "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": {
+ "getPushClientId": {
+ "name": "getPushClientId",
+ "app": {
+ "js": false,
+ "kotlin": true,
+ "swift": false
+ }
+ },
+ "onPushMessage": {
+ "name": "onPushMessage",
+ "app": {
+ "js": false,
+ "kotlin": true,
+ "swift": false
+ }
+ },
+ "offPushMessage": {
+ "name": "offPushMessage",
+ "app": {
+ "js": false,
+ "kotlin": true,
+ "swift": false
+ }
+ },
+ "getChannelManager": {
+ "name": "getChannelManager",
+ "app": {
+ "js": false,
+ "kotlin": true,
+ "swift": false
+ }
+ },
+ "createPushMessage": {
+ "name": "createPushMessage",
+ "app": {
+ "js": false,
+ "kotlin": true,
+ "swift": false
+ }
+ }
+ }
+ },
+ "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"
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/uni_modules/uni-push/readme.md b/uni_modules/uni-push/readme.md
new file mode 100644
index 0000000000000000000000000000000000000000..c5dde5d47b0ebff0c34cf361d7140765c1893b44
--- /dev/null
+++ b/uni_modules/uni-push/readme.md
@@ -0,0 +1,142 @@
+# uni-push
+
+`uni-push` 工程,是基于 DCloud-UTS 架构之上的封装个推消息推送 `SDK` 的插件工程,使用此模块可轻松实现服务端向客户端推送通知和透传消息的功能。
+
+### 插件使用说明
+
+#### 导入插件
+```uts
+import * as GTPlugin from "../../uni_modules/uni-push"
+```
+
+#### 初始化
+
+```typescript
+//初始化个推推送
+GTPlugin.initPush();
+```
+
+#### 推送消息事件
+
+> 添加透传消息回调,对应的GTPlugin.offPushMessage()可移除对应监听callback(传入null,可移除所有监听callback)
+
+```typescript
+GTPlugin.onPushMessage((res) => {
+ console.log("onPushMessage => " + JSON.stringify(res))
+})
+```
+
+| 名称 | 类型 | 描述 |
+| ---- | ------------- | ----------------------------------------------------------- |
+| type | String | 事件类型,"click"-从系统推送服务点击消息启动应用事件;"receive"-应用从推送服务器接收到推送消息事件。 |
+| data | String、Object | 消息内容 |
+
+
+
+#### 日志
+
+开发阶段,需要使用到日志辅助。
+
+```typescript
+//设置日志回调,可以在控制台看到[GT-PUSH]的日志
+GTPlugin.setDebugLogger(function(res) {
+ console.log(res)
+});
+```
+
+当插件正常初始化会出现以下日志:
+
+```uts
+16:47:53.254 [GT-PUSH] [LogController] Sdk version = 3.3.0.0 at pages/index/index.vue:25
+16:47:54.052 [GT-PUSH] [ServiceManager] ServiceManager start from initialize... at pages/index/index.vue:25
+16:47:54.073 [GT-PUSH] PushCore started at pages/index/index.vue:25
+16:47:54.274 [GT-PUSH] onHandleIntent() = get sdk service pid at pages/index/index.vue:25
+16:47:54.292 [GT-PUSH] onHandleIntent() areNotificationsEnabled at pages/index/index.vue:25
+16:47:54.353 [GT-PUSH] [LoginInteractor] Start login appid = nU*******wzf at pages/index/index.vue:25
+16:47:54.571 收到 cid onReceiveClientId : 3061f********ce7578eb24 at pages/index/index.vue:29
+16:47:54.592 [GT-PUSH] onHandleIntent() = received client id at pages/index/index.vue:25
+16:47:54.593 [GT-PUSH] [LoginResult] Login successed with cid = 3061f********ce7578eb24 at pages/index/index.vue:25
+```
+
+#### 推送相关动作
+
+> 设置推送相关动作回调,更多可查看`app-android/index.uts`下面的 `UserPushAction`类
+
+```typescript
+GTPlugin.setPushAction({
+ onReceiveClientId: function(cid) {
+ console.log("收到 cid onReceiveClientId : " + cid)
+ }
+});
+```
+
+
+
+#### 唯一的推送标识
+
+获取客户端唯一的推送标识
+
+```typescript
+GTPlugin.getPushClientId({
+ success: (res) => {
+ console.log("getPushClientId success => " + JSON.stringify(res));
+ },
+ fail: (res) => {
+ console.log("getPushClientId fail => " + JSON.stringify(res));
+ },
+ complete: (res) => {
+ console.log("getPushClientId complete => " + JSON.stringify(res));
+ }
+});
+```
+
+**OBJECT 参数说明**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | -------- | --- | ------------------------ |
+| success | Function | 是 | 接口调用的回调函数,详见返回参数说明 |
+| fail | Function | 否 | 接口调用失败的回调函数 |
+| complete | Function | 否 | 接口调用结束的回调函数(调用成功、失败都会执行) |
+
+**success 返回参数说明**
+
+| 参数 | 类型 | 说明 |
+| ------ | ------ | ---------------------------------------- |
+| cid | String | 个推客户端推送id,对应uni-id-device表的push_clientid |
+| errMsg | String | 错误描述 |
+
+**fail 返回参数说明**
+
+| 参数 | 类型 | 说明 |
+| ------ | ------ | ---- |
+| errMsg | String | 错误描述 |
+
+
+
+### APP_ID申请
+
+可登录[个推官网](https://dev.getui.com/)注册申请应用,获取APP相关信息。
+
+
+
+### 多厂商
+
+多厂商渠道可以参考[[厂商应用开通指南-个推文档中心](https://docs.getui.com/getui/mobile/vendor/vendor_open/) 和 [厂商 SDK 集成指南-个推文档中心](https://docs.getui.com/getui/mobile/vendor/androidstudio/)
+
+> 注意:华为厂商需要把`agconnect-services.json` 放到${工程根目录}/nativeResources/android/ 目录下
+
+### 开发文档
+
+[个推推送SDK](https://docs.getui.com/getui/start/accessGuide/)
+[多厂商接入](https://docs.getui.com/getui/mobile/vendor/vendor_open/)
+
+
+
+### 注意事项
+
+在`AndroidManifest.xml`中,必须声明插件`flag`
+
+```xml
+
+
+```
diff --git a/uni_modules/uni-push/utssdk/app-android/AndroidManifest.xml b/uni_modules/uni-push/utssdk/app-android/AndroidManifest.xml
new file mode 100644
index 0000000000000000000000000000000000000000..0272d5637496aceebc0a71a2908eb3d5eb81cfaf
--- /dev/null
+++ b/uni_modules/uni-push/utssdk/app-android/AndroidManifest.xml
@@ -0,0 +1,34 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/uni_modules/uni-push/utssdk/app-android/config.json b/uni_modules/uni-push/utssdk/app-android/config.json
new file mode 100644
index 0000000000000000000000000000000000000000..82b9613f2c85c6060d2af8bb064882b2b5003711
--- /dev/null
+++ b/uni_modules/uni-push/utssdk/app-android/config.json
@@ -0,0 +1,42 @@
+{
+ "parameters": {
+ "appid": {
+ "placeholder": "GETUI_APPID"
+ },
+ "mipush_appid": {
+ "placeholder": "MIPUSH_APPID"
+ },
+ "mipush_appkey": {
+ "placeholder": "MIPUSH_APPKEY"
+ },
+ "meizupush_appid": {
+ "placeholder": "MEIZUPUSH_APPID"
+ },
+ "meizupush_appkey": {
+ "placeholder": "MEIZUPUSH_APPKEY"
+ },
+ "oppopush_appkey": {
+ "placeholder": "OPPOPUSH_APPKEY"
+ },
+ "oppopush_appsecret": {
+ "placeholder": "OPPOPUSH_APPSECRET"
+ },
+ "huaweipush_appid": {
+ "placeholder": "com.huawei.hms.client.appid"
+ },
+ "vivopush_appid": {
+ "placeholder": "com.vivo.push.app_id"
+ },
+ "vivopush_appkey": {
+ "placeholder": "com.vivo.push.api_key"
+ },
+ "dcloud_unipush_auto_notification": {
+ "placeholder": "dcloud_unipush_auto_notification"
+ }
+ },
+ "files": [{
+ "source": "push_unipush_huaweipush_agconnect-services.json",
+ "target": "agconnect-services.json",
+ "des": "HMS配置文件"
+ }]
+}
\ No newline at end of file
diff --git a/uni_modules/uni-push/utssdk/app-android/gt-sdk/GTPush.uts b/uni_modules/uni-push/utssdk/app-android/gt-sdk/GTPush.uts
new file mode 100644
index 0000000000000000000000000000000000000000..0ebb25a3c9b0bf9ddb234557ce6e4f506ff2db3c
--- /dev/null
+++ b/uni_modules/uni-push/utssdk/app-android/gt-sdk/GTPush.uts
@@ -0,0 +1,144 @@
+import Context from "android.content.Context";
+import GTPlugin from "com.getui.sdk.GTPlugin";
+import IPushAction from "com.getui.sdk.IPushAction";
+import GTCmdMessage from "com.igexin.sdk.message.GTCmdMessage";
+import GTNotificationMessage from "com.igexin.sdk.message.GTNotificationMessage";
+import GTTransmitMessage from "com.igexin.sdk.message.GTTransmitMessage";
+import IUserLoggerInterface from "com.igexin.sdk.IUserLoggerInterface";
+
+export function gtInit(context : Context) : void {
+ GTPlugin.initialize(context);
+}
+
+export function getClientId(context : Context) : string {
+ return GTPlugin.getClientId(context);
+}
+
+export function setPushAction(action : UserPushAction) : void {
+ GTPlugin.setPushAction(action);
+}
+
+
+export type GTPushActionOptions = {
+
+ onReceiveServicePid ?: (res : number) => void
+
+ /**
+ * 接收clientId(cid)
+ */
+ onReceiveClientId ?: (res : string) => void
+
+ /**
+ * 此方法用于接收和处理透传消息。透传消息个推只传递数据,不做任何处理,客户端接收到透传消息后需要自己去做后续动作处理,如通知栏展示、弹框等。
+ * 如果开发者在客户端将透传消息创建了通知栏展示,建议将展示和点击回执上报给个推。
+ */
+ onReceiveMessageData ?: (res : string) => void
+
+ /**
+ * cid 离线上线通知
+ */
+ onReceiveOnlineState ?: (res : boolean) => void
+
+ /**
+ * 各种事件处理回执
+ */
+ onReceiveCommandResult ?: (res : GTCmdMessage) => void
+
+ /**
+ * 通知点击,只有个推通道下发的通知会回调此方法
+ */
+ onNotificationMessageClicked ?: (res : string) => void
+
+ /**
+ * 通知到达,只有个推通道下发的通知会回调此方法
+ */
+ onNotificationMessageArrived ?: (res : GTNotificationMessage) => void
+}
+
+
+
+export class UserPushAction implements IPushAction {
+
+ constructor(
+ private options : GTPushActionOptions) {
+ }
+
+ override onReceiveServicePid(ctx : Context, pid : Int) {
+ this.options.onReceiveServicePid?.(pid)
+ }
+
+ /**
+ * 接收clientId(cid)
+ */
+ override onReceiveClientId(ctx : Context, cid : string) {
+ this.options.onReceiveClientId?.(cid)
+ }
+
+ /**
+ * 此方法用于接收和处理透传消息。透传消息个推只传递数据,不做任何处理,客户端接收到透传消息后需要自己去做后续动作处理,如通知栏展示、弹框等。
+ * 如果开发者在客户端将透传消息创建了通知栏展示,建议将展示和点击回执上报给个推。
+ *
+ * class GTTransmitMessage {
+ * private String taskId;
+ * private String messageId;
+ * private String payloadId;
+ * private byte[] payload;
+ * }
+ */
+ override onReceiveMessageData(ctx : Context, message : GTTransmitMessage) {
+ this.options.onReceiveMessageData?.(new String(message.getPayload()))
+ }
+
+ /**
+ * cid 离线/上线通知
+ */
+ override onReceiveOnlineState(ctx : Context, state : boolean) {
+ this.options.onReceiveOnlineState?.(state)
+ }
+
+ /**
+ * 各种事件处理回执
+ */
+ override onReceiveCommandResult(ctx : Context, message : GTCmdMessage) {
+ this.options.onReceiveCommandResult?.(message)
+ }
+
+ /**
+ * 通知点击,只有个推通道下发的通知会回调此方法
+ */
+ override onNotificationMessageClicked(ctx : Context, message : GTNotificationMessage) {
+ const params = {
+ "title": message.getTitle(),
+ "content": message.getContent()
+ };
+ this.options.onNotificationMessageClicked?.(JSON.stringify(params))
+ }
+
+ /**
+ * 通知到达,只有个推通道下发的通知会回调此方法
+ */
+ override onNotificationMessageArrived(ctx : Context, message : GTNotificationMessage) {
+ this.options.onNotificationMessageArrived?.(message)
+ }
+}
+
+
+class UserLoggerInterface implements IUserLoggerInterface {
+ constructor(private callback : (log : string) => void) {
+ }
+
+ override log(s : string) {
+ this.callback?.(s)
+ }
+}
+
+/**
+ * 个推推送sdk调试日志信息
+ * setDebugLogger 接口仅限调试的时候使用,切勿发布到线上版本,重复调用仅以第一次为准。
+ */
+export function setDebugLogger(callback : (log : string) => void) {
+ const ctx = UTSAndroid.getAppContext();
+ if (ctx != null) {
+ GTPlugin.setDebugLogger(ctx, new UserLoggerInterface(callback))
+ }
+}
\ No newline at end of file
diff --git a/uni_modules/uni-push/utssdk/app-android/index.uts b/uni_modules/uni-push/utssdk/app-android/index.uts
new file mode 100644
index 0000000000000000000000000000000000000000..34379f2b9c0c8aaba15f09e095b767966c947f8c
--- /dev/null
+++ b/uni_modules/uni-push/utssdk/app-android/index.uts
@@ -0,0 +1,364 @@
+
+import { GetPushClientIdOptions, GetPushClientIdSuccess, GetPushClientIdFail, OnPushMessageCallback, OnPushMessageCallbackResult, OnPushMessageType, CreatePushMessageOptions, ChannelManager } from '../interface.uts'
+
+import { gtInit, GTPushActionOptions, UserPushAction, setPushAction } from './gt-sdk/GTPush.uts'
+import Context from 'android.content.Context';
+import { PushMessage } from './push/PushMessage.uts';
+import PackageManager from 'android.content.pm.PackageManager';
+import ApplicationInfo from 'android.content.pm.ApplicationInfo';
+import Activity from 'android.app.Activity';
+import TextUtils from 'android.text.TextUtils';
+import { PushState } from './push/PushState.uts';
+import { PushManager } from './push/PushManager.uts';
+import { StringUtil } from './push/utils/StringUtil.uts';
+import SharedPreferences from 'android.content.SharedPreferences';
+import Handler from 'android.os.Handler';
+import { PushChannelManager } from './push/PushChannelManager.uts';
+import Bundle from 'android.os.Bundle';
+import Intent from 'android.content.Intent';
+import Uri from 'android.net.Uri';
+import { globalPushMessageCallbacks, sendEvent } from './push/PushManager.uts'
+export { PushActionService } from './push/PushActionService.uts';
+
+const SP_NAME = "clientid_unipush";
+const SP_KEY_CLIENT_ID = "clientid";
+
+
+let gtCallBack : UserPushAction | null = null;
+let gtPushInitialize = false
+
+/**
+ * 个推推送sdk初始化
+ */
+function initPush() {
+ const ctx = UTSAndroid.getAppContext();
+ if (ctx != null && !gtPushInitialize) {
+ gtPushInitialize = true;
+ gtInit(ctx);
+ setPushAction(getGTCallBack());
+ }
+}
+
+/**
+ * 获取客户端唯一的推送标识(注意:这是一个异步的方法)
+ */
+export function getPushClientId(options : GetPushClientIdOptions) {
+ initPush()
+ const ctx = UTSAndroid.getAppContext() as Context;
+ const sp = ctx.getSharedPreferences(SP_NAME, Context.MODE_PRIVATE) as SharedPreferences;
+ const clientId = sp.getString(SP_KEY_CLIENT_ID, "")
+ if (TextUtils.isEmpty(clientId)) {
+ const handler = new Handler()
+ const changeListener = new (class implements SharedPreferences.OnSharedPreferenceChangeListener {
+ override onSharedPreferenceChanged(sharedPreferences : SharedPreferences, key : string) : void {
+ if (key != SP_KEY_CLIENT_ID) {
+ return
+ }
+ handler.removeCallbacksAndMessages(null)
+ sharedPreferences.unregisterOnSharedPreferenceChangeListener(this)
+ const cid = sharedPreferences.getString(SP_KEY_CLIENT_ID, "")
+ const res : GetPushClientIdSuccess = { errMsg: "success", cid: cid!! }
+ options.success?.(res)
+ options.complete?.(res)
+ }
+ })
+ sp.registerOnSharedPreferenceChangeListener(changeListener)
+
+ const runnable = new (class implements Runnable {
+ override run() {
+ const clientId = sp.getString(SP_KEY_CLIENT_ID, "")
+ if (!TextUtils.isEmpty(clientId)) {
+ const res : GetPushClientIdSuccess = { errMsg: "success", cid: clientId!! }
+ options.success?.(res)
+ options.complete?.(res)
+ } else {
+ const res : GetPushClientIdFail = {
+ errSubject: "uni-push",
+ errCode: -1,
+ errMsg: "failed,check appkey or appid",
+ }
+ options.fail?.(res)
+ options.complete?.(res)
+ }
+ }
+ })
+ handler.postDelayed(runnable, 15000)
+ } else {
+ const res : GetPushClientIdSuccess = { errMsg: "success", cid: clientId!! }
+ options.success?.(res)
+ options.complete?.(res)
+ }
+}
+
+/**
+ * 增加监听推送消息事件(应用在线的时候没有通知栏消息,全部是透传。), 注意: 使用时,开发者需要注册写到第一个activity的周期内 , 即首页.
+ */
+export function onPushMessage(callback : OnPushMessageCallback | null) {
+ initPush()
+ if (callback == null) {
+ return;
+ }
+ if (globalPushMessageCallbacks.indexOf(callback) == -1) {
+ globalPushMessageCallbacks.push(callback)
+ }
+
+ processOfflineMessage()
+ // 处理没有注册监听时,已经接到的消息,此时从缓存里取
+ PushManager.getInstance().comsumeMessages("click", (msgs : PushMessage[]) => {
+ msgs.forEach((msg) => {
+ sendEvent("click", msg)
+ })
+ })
+ PushManager.getInstance().comsumeMessages("receive", (msgs : PushMessage[]) => {
+ msgs.forEach((msg) => {
+ sendEvent("receive", msg)
+ })
+ })
+}
+
+/**
+ * 移除推送消息监听事件(没有传入参数,则移除App级别的所有事件监听器。)
+ */
+export function offPushMessage(callback : OnPushMessageCallback | null) {
+ if (callback == null) {
+ const len = globalPushMessageCallbacks.length;
+ globalPushMessageCallbacks.splice(0, len)
+ return;
+ }
+
+ let index = globalPushMessageCallbacks.indexOf(callback)
+ if (index == -1) {
+ return;
+ }
+ globalPushMessageCallbacks.splice(index, 1)
+}
+
+export function getChannelManager() : ChannelManager {
+ return PushChannelManager.getInstance()
+}
+
+export function createPushMessage(options : CreatePushMessageOptions) : void {
+ const context = UTSAndroid.getAppContext() as Context
+ const appId = UTSAndroid.getAppId()
+ const pushMessage = new PushMessage(JSON.stringify(options), getApplicationName(), false)
+
+ const min = 0
+ if (pushMessage.mDelay == min.toLong()) {
+ PushManager.getInstance().addPushMessage(appId, pushMessage)
+ PushManager.getInstance().createNotification(context, pushMessage)
+ } else {
+ new Handler().postDelayed(new (class implements Runnable {
+ override run() {
+ PushManager.getInstance().addPushMessage(appId, pushMessage)
+ PushManager.getInstance().createNotification(context, pushMessage)
+ }
+ }), pushMessage.mDelay * 1000)
+ }
+}
+
+
+function getGTCallBack() : UserPushAction {
+ if (gtCallBack == null) {
+ const options = {
+ onReceiveClientId(cid : string) {
+ const context = UTSAndroid.getAppContext() as Context;
+ const sp = context.getSharedPreferences(SP_NAME, Context.MODE_PRIVATE);
+ const editor = sp.edit();
+ editor.putString(SP_KEY_CLIENT_ID, cid);
+ editor.commit();
+ },
+ onNotificationMessageClicked(res : string) {
+ const pushMessage = new PushMessage(res, getApplicationName(), false)
+ if (!sendEvent("click", pushMessage)) {
+ PushManager.getInstance().addNeedExecClickMessage(pushMessage)
+ }
+ },
+ onReceiveMessageData(res : string) {
+ if (!TextUtils.isEmpty(res)) {
+ let isUniPush2 = false
+ const jsonObject = JSON.parseObject(res)
+ const unipushVersionStr = jsonObject?.getString("unipush_version")
+ if (!TextUtils.isEmpty(unipushVersionStr)) {
+ const unipushVersion = parseFloat(unipushVersionStr!!)
+ if (unipushVersion == 2.0) {
+ isUniPush2 = true;
+ }
+ }
+ if (isUniPush2) {
+ processForUniPush2(res);
+ } else {
+ processForUniPush(res);
+ }
+ }
+ },
+ } as GTPushActionOptions;
+ gtCallBack = new UserPushAction(options);
+ }
+
+ return gtCallBack!!;
+}
+
+/**
+ * 处理离线消息
+ */
+function processOfflineMessage() {
+ const activity = UTSAndroid.getUniActivity() as Activity
+ const intent = activity.getIntent()
+
+ // const testStr = "intent://io.dcloud.unipush/?#Intent;scheme=unipush;launchFlags=0x4000000;package=uni.UNI8CD4C4C;component=uni.UNI8CD4C4C/io.dcloud.uniapp.UniAppActivity;S.UP-OL-SU=true;S.unipush_version=2.0;S.payload={\"cccccforceNotification\":\"xxx\",\"path\":\"XXX\"};S.title=xxx;S.content=xxx;S.unipush_data={\"forceNotification\":\"xxx\",\"path\":\"XXX\"};end"
+ // const intent = Intent.parseUri(testStr , 0)
+
+ if (intent.hasExtra("UP-OL-SU")) {
+ let isUniPush2 = false;
+ const unipushVersionStr = intent.getStringExtra("unipush_version");
+ if (!TextUtils.isEmpty(unipushVersionStr)) {
+ const unipushVersion = parseFloat(unipushVersionStr!!)
+ if (unipushVersion == 2.0) {
+ isUniPush2 = true;
+ }
+ }
+
+ const params = {}
+
+ if (isUniPush2) {
+ try {
+ params["title"] = intent.getStringExtra("title")
+ params["content"] = intent.getStringExtra("content")
+ params["unipush_version"] = intent.getStringExtra("unipush_version")
+
+ const channelId = intent.getStringExtra("channelId");
+ const category = intent.getStringExtra("category");
+ if (!TextUtils.isEmpty(channelId)) {
+ params["channelId"] = channelId
+ }
+ if (!TextUtils.isEmpty(category)) {
+ params["category"] = category
+ }
+
+ let payload = intent.getStringExtra("payload");
+ const payloadJsonObject = JSON.parseObject(payload ?? "")
+ if (payloadJsonObject == null) {
+ if (payload != null) {
+ //如果后端传的不是json,而是纯字符串,就需要单独处理,去掉多余的引号,并且枚举一下类型.
+ //双引号套双引号,就说明是传的字符串.
+ if (payload.startsWith("\"")) {
+ payload = StringUtil.trimString(payload, '"');
+ params["payload"] = payload
+ } else {
+ const payloadInt = StringUtil.getInt(payload);
+ const payloadDouble = StringUtil.getDouble(payload);
+ if (payloadInt != null) {
+ params["payload"] = payloadInt
+ } else if (payloadDouble != null) {
+ params["payload"] = payloadDouble
+ } else if (payload == "true" || payload == "false") {
+ params["payload"] = payload.toBoolean()
+ } else {
+ params["payload"] = payload
+ }
+ }
+ }
+ } else {
+ params["payload"] = payloadJsonObject
+ }
+
+ const unipush_data = intent.getStringExtra("unipush_data");
+ const unipushDataJsonObject = JSON.parseObject(unipush_data ?? "");
+ if (unipushDataJsonObject != null) {
+ unipushDataJsonObject.toMap().forEach((value, key) => {
+ params[key] = value
+ })
+ }
+
+ intent.removeExtra("UP-OL-SU");
+ intent.removeExtra("title");
+ intent.removeExtra("content");
+ intent.removeExtra("payload");
+ intent.removeExtra("unipush_version");
+ intent.removeExtra("unipush_data");
+ intent.removeExtra("channelId");
+ intent.removeExtra("category");
+
+ const data = JSON.stringify(params)
+ const pushMessage = new PushMessage(data, getApplicationName(), true);
+ if (!sendEvent("click", pushMessage)) {
+ PushManager.getInstance().addNeedExecClickMessage(pushMessage)
+ }
+ } catch (e : Exception) {
+ e.printStackTrace();
+ }
+ } else {
+ try {
+ params["title"] = intent.getStringExtra("title")
+ params["content"] = intent.getStringExtra("content")
+ params["payload"] = intent.getStringExtra("payload")
+ const channelId = intent.getStringExtra("channelId");
+ const category = intent.getStringExtra("category");
+ if (!TextUtils.isEmpty(channelId)) {
+ params["channelId"] = channelId
+ }
+ if (!TextUtils.isEmpty(category)) {
+ params["category"] = category
+ }
+ intent.removeExtra("UP-OL-SU");
+ intent.removeExtra("title");
+ intent.removeExtra("content");
+ intent.removeExtra("payload");
+ intent.removeExtra("channelId");
+ intent.removeExtra("category");
+ const data = JSON.stringify(params)
+ const pushMessage = new PushMessage(data, getApplicationName(), true);
+ if (!sendEvent("click", pushMessage)) {
+ PushManager.getInstance().addNeedExecClickMessage(pushMessage)
+ }
+ } catch (e : Exception) {
+ e.printStackTrace();
+ }
+ }
+ }
+}
+
+
+function processForUniPush(data : string) : void {
+ const context = UTSAndroid.getAppContext() as Context
+ const pushMessage = new PushMessage(data, getApplicationName(), false)
+ const needPush = PushState.getAutoNotification()
+ if (needPush && pushMessage.getNeedCreateNotification()) {
+ PushManager.getInstance().createNotification(context, pushMessage)
+ } else if (!sendEvent("receive", pushMessage)) {
+ PushManager.getInstance().addNeedExecReceiveMessage(pushMessage);
+
+ }
+ PushManager.getInstance().addPushMessage(UTSAndroid.getAppId(), pushMessage);
+}
+
+function processForUniPush2(data : string) : void {
+ const context = UTSAndroid.getAppContext() as Context
+ const jsonObject = JSON.parseObject(data)
+ if (jsonObject != null) {
+ const forceNotification = jsonObject.getBoolean("force_notification")
+ const pushMessage = new PushMessage(data, getApplicationName(), true)
+ if (forceNotification != null && forceNotification) {
+ PushManager.getInstance().createNotification(context, pushMessage)
+ } else if (!sendEvent("receive", pushMessage)) {
+ PushManager.getInstance().addNeedExecReceiveMessage(pushMessage);
+ }
+ PushManager.getInstance().addPushMessage(UTSAndroid.getAppId(), pushMessage);
+ }
+}
+
+function getApplicationName() : string {
+ let packageManager : PackageManager | null = null
+ let applicationInfo : ApplicationInfo | null = null
+ const context = UTSAndroid.getAppContext() as Context;
+ try {
+ packageManager = context.getApplicationContext().getPackageManager()
+ applicationInfo = packageManager.getApplicationInfo(context.getPackageName(), 0)
+ } catch (_ : Exception) {
+ }
+ if (applicationInfo == null) {
+ return ""
+ }
+
+ return packageManager?.getApplicationLabel(applicationInfo).toString() ?? ""
+}
\ No newline at end of file
diff --git a/uni_modules/uni-push/utssdk/app-android/libs/getui-uts-android-release-20230928135005.aar b/uni_modules/uni-push/utssdk/app-android/libs/getui-uts-android-release-20230928135005.aar
new file mode 100644
index 0000000000000000000000000000000000000000..93354738c7fef06d3cd9a7d1d48aecd68204616a
Binary files /dev/null and b/uni_modules/uni-push/utssdk/app-android/libs/getui-uts-android-release-20230928135005.aar differ
diff --git a/uni_modules/uni-push/utssdk/app-android/push/PushActionService.uts b/uni_modules/uni-push/utssdk/app-android/push/PushActionService.uts
new file mode 100644
index 0000000000000000000000000000000000000000..886709c8f29ca335d70fff3c7ad886df655d2790
--- /dev/null
+++ b/uni_modules/uni-push/utssdk/app-android/push/PushActionService.uts
@@ -0,0 +1,21 @@
+import Service from 'android.app.Service';
+import Intent from 'android.content.Intent';
+import IBinder from 'android.os.IBinder';
+import { PushManager } from './PushManager.uts';
+export class PushActionService extends Service {
+
+ constructor(){
+ super();
+ }
+
+ override onBind(intent : Intent) : IBinder | null {
+ return null
+ }
+
+ override onStartCommand(intent : Intent | null, flag : Int, startId : Int) : Int {
+ if (intent != null) {
+ PushManager.getInstance().processAction(this.getBaseContext(), intent)
+ }
+ return super.onStartCommand(intent, flag, startId)
+ }
+}
\ No newline at end of file
diff --git a/uni_modules/uni-push/utssdk/app-android/push/PushChannelManager.uts b/uni_modules/uni-push/utssdk/app-android/push/PushChannelManager.uts
new file mode 100644
index 0000000000000000000000000000000000000000..07f55431709507f1a2b50c6d6ffe946b8266bf3c
--- /dev/null
+++ b/uni_modules/uni-push/utssdk/app-android/push/PushChannelManager.uts
@@ -0,0 +1,98 @@
+import { ChannelManager, SetPushChannelOptions } from "../../interface.uts";
+import Context from 'android.content.Context';
+import Build from 'android.os.Build';
+import NotificationManager from 'android.app.NotificationManager';
+import NotificationChannelGroup from 'android.app.NotificationChannelGroup';
+import NotificationChannel from 'android.app.NotificationChannel';
+import TextUtils from 'android.text.TextUtils';
+import ContentResolver from 'android.content.ContentResolver';
+import Uri from 'android.net.Uri';
+import RingtoneManager from 'android.media.RingtoneManager';
+
+export class PushChannelManager implements ChannelManager {
+
+ static LOCAL_PUSH_CHANNEL_ID = "DcloudChannelID";
+ static LOCAL_PUSH_GROUP_ID = "DcloudGroupID";
+
+ private static INSTANCE : PushChannelManager | null = null
+
+ static getInstance() : PushChannelManager {
+ if (this.INSTANCE == null) {
+ this.INSTANCE = new PushChannelManager()
+ }
+ return this.INSTANCE!!
+ }
+
+ createDefaultChannel(context : Context) {
+ if (Build.VERSION.SDK_INT >= 26) {
+ const notificationManager = context.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
+ const pChannelId = PushChannelManager.LOCAL_PUSH_CHANNEL_ID
+ const pChannelName = context.getResources().getString(R.string.dcloud_feature_aps_notification_channel)
+ if (notificationManager.getNotificationChannel(pChannelId) == null) {
+ notificationManager.createNotificationChannelGroup(new NotificationChannelGroup(PushChannelManager.LOCAL_PUSH_GROUP_ID, context.getResources().getString(R.string.dcloud_feature_aps_notification_group)))
+ const channel = new NotificationChannel(pChannelId, pChannelName, NotificationManager.IMPORTANCE_DEFAULT)
+ channel.enableLights(true)
+ channel.setShowBadge(true)
+ notificationManager.createNotificationChannel(channel)
+ }
+ }
+ }
+
+ /**
+ * 设置推送渠道
+ */
+ setPushChannel(options : SetPushChannelOptions) : void {
+ if (Build.VERSION.SDK_INT >= 26) {
+ const context = UTSAndroid.getAppContext() as Context
+ const notificationManager = context.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager;
+ if (notificationManager.getNotificationChannel(options.channelId) == null) {
+ const notificationChannel = new NotificationChannel(options.channelId, options.channelDesc, NotificationManager.IMPORTANCE_DEFAULT);
+ notificationChannel.setShowBadge(true);
+ let sound = 0;
+ if (!TextUtils.isEmpty(options.soundName)) {
+ const packName = context.getApplicationInfo().packageName
+ sound = context.getResources().getIdentifier(options.soundName!!, "raw", packName)
+ }
+ let uriStr = "";
+ if (sound != 0) {
+ uriStr = ContentResolver.SCHEME_ANDROID_RESOURCE + "://" + context.getPackageName() + "/raw/" + sound;
+ }
+
+ if (!TextUtils.isEmpty(uriStr)) {
+ notificationChannel.setSound(Uri.parse(uriStr), null);
+ } else {
+ const uri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);//默认铃音
+ notificationChannel.setSound(uri, null);
+ }
+
+ if (options.importance != null) {
+ notificationChannel.setImportance(options.importance!!.toInt());
+ }
+ if (options.lockscreenVisibility != null) {
+ notificationChannel.setLockscreenVisibility(options.lockscreenVisibility!!.toInt());
+ }
+ notificationChannel.enableLights(options.enableLights ?? false);
+ notificationChannel.enableVibration(options.enableVibration ?? false);
+ notificationManager.createNotificationChannel(notificationChannel);
+ }
+ }
+ }
+ /**
+ * 获取当前应用注册的所有的通知渠道。
+ */
+ getAllChannels() : string[] {
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
+ const context = UTSAndroid.getAppContext() as Context
+ const nm = context.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
+ const channels : string[] = []
+ const list = nm.getNotificationChannels()
+ for (let i:Int = 0; i < list.size; i++) {
+ channels.push(list.get(i).toString())
+ }
+ return channels
+ }else{
+ return [] as string[]
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/uni_modules/uni-push/utssdk/app-android/push/PushManager.uts b/uni_modules/uni-push/utssdk/app-android/push/PushManager.uts
new file mode 100644
index 0000000000000000000000000000000000000000..bbc8b88effc02986f81d65de0df74742033baff3
--- /dev/null
+++ b/uni_modules/uni-push/utssdk/app-android/push/PushManager.uts
@@ -0,0 +1,320 @@
+import Context from 'android.content.Context';
+import Intent from 'android.content.Intent';
+import { PushChannelManager } from './PushChannelManager.uts';
+import { PushMessage } from './PushMessage.uts';
+import NotificationManager from 'android.app.NotificationManager';
+import ComponentName from 'android.content.ComponentName';
+import PendingIntent from 'android.app.PendingIntent';
+import Build from 'android.os.Build';
+import TextUtils from 'android.text.TextUtils';
+import Notification from 'android.app.Notification';
+import Bitmap from 'android.graphics.Bitmap';
+import BitmapFactory from 'android.graphics.BitmapFactory';
+import File from 'java.io.File';
+import { OnPushMessageCallback, OnPushMessageType, OnPushMessageCallbackResult } from '../../interface.uts'
+
+export const globalPushMessageCallbacks : OnPushMessageCallback[] = []
+
+export function sendEvent(type : OnPushMessageType, pushMessage : PushMessage) : boolean {
+ const data = pushMessage.getJsonObject()
+ const result : OnPushMessageCallbackResult = {
+ type: type,
+ data: data
+ }
+ if (globalPushMessageCallbacks.length == 0) {
+ return false
+ } else {
+ globalPushMessageCallbacks.forEach((cb : OnPushMessageCallback) => {
+ cb(result)
+ })
+ return true
+ }
+}
+
+export class PushManager {
+ private static INSTANCE : PushManager | null = null
+
+ private ACTION_TYPE_CREATE = "ACTION_TYPE_CREATE"
+ private ACTION_TYPE_REMOVE = "ACTION_TYPE_REMOVE"
+ private ACTION_TYPE_CLEAR = "ACTION_TYPE_CLEAR"
+ private ACTION_TYPE_CLICK = "ACTION_TYPE_CLICK"
+
+ private mAppMessages : Map> = new Map()
+ private mNeedExecClickMessages : PushMessage[] = []
+ private mNeedExecReceiveMessages : PushMessage[] = []
+
+ static getInstance() : PushManager {
+ if (this.INSTANCE == null) {
+ this.INSTANCE = new PushManager()
+ }
+ return this.INSTANCE!!
+ }
+
+
+
+
+
+ createNotification(context : Context, message : PushMessage) {
+ PushChannelManager.getInstance().createDefaultChannel(context)
+ const intent = new Intent(this.ACTION_TYPE_CREATE)
+ intent.putExtras(message.toBundle())
+ this.processAction(context, intent)
+ }
+
+ addPushMessage(pAppid : string, pMsg : PushMessage) {
+ let _arr = this.mAppMessages.get(pAppid);
+ if (_arr == null) {
+ _arr = new Array();
+ this.mAppMessages.set(pAppid, _arr);
+ }
+ _arr.push(pMsg);
+ }
+
+
+ addNeedExecClickMessage(pushMessage : PushMessage) {
+ if (this.mNeedExecClickMessages.length > 0) {
+ this.mNeedExecClickMessages = []
+ }
+ this.mNeedExecClickMessages.push(pushMessage)
+ }
+
+ addNeedExecReceiveMessage(pushMessage : PushMessage) {
+ this.mNeedExecReceiveMessages.push(pushMessage)
+ }
+
+ removePushMessage(pAppid : String, pPushMsg : PushMessage) {
+ const _arr = this.mAppMessages.get(pAppid);
+ if (_arr != null && _arr.indexOf(pPushMsg) > 0) {
+ _arr.splice(_arr.indexOf(pPushMsg), 1);
+ }
+ }
+
+ /**
+ * 消费缓存的消息
+ */
+ comsumeMessages(type : string, cb : (msgs : PushMessage[]) => void) {
+ if (type == "click") {
+ cb(this.mNeedExecClickMessages)
+ this.mNeedExecClickMessages.splice(0)
+ } else if (type == "receive") {
+ cb(this.mNeedExecReceiveMessages)
+ this.mNeedExecReceiveMessages.splice(0)
+ }
+ }
+
+
+ processAction(context : Context, intent : Intent) {
+ const notificationManager = context.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
+ const action = intent.getAction()
+ switch (action) {
+ case this.ACTION_TYPE_CREATE:
+ {
+ const title = intent.getStringExtra("title");
+ const message = intent.getStringExtra("content");
+ const nId = intent.getIntExtra("nId", 0);
+ const when = intent.getLongExtra("when", 0);
+ const appid = intent.getStringExtra("appid");
+ const icon = intent.getStringExtra("icon");
+ const sound = intent.getStringExtra("sound");
+ const category = intent.getStringExtra("category");
+ let channelId = intent.getStringExtra("channelId");
+ const i = new Intent(this.ACTION_TYPE_CLICK);
+ i.setComponent(new ComponentName(context.getPackageName(), "uts.sdk.modules.DCloudUniPush.PushActionService"));
+ i.putExtras(intent.getExtras()!!);
+ let flags = PendingIntent.FLAG_ONE_SHOT;
+ if (Build.VERSION.SDK_INT >= 23) {
+ flags = PendingIntent.FLAG_ONE_SHOT | PendingIntent.FLAG_IMMUTABLE;
+ }
+ const contentIntent = PendingIntent.getService(context, nId, i, flags);
+
+ let builder : Notification.Builder | null = null;
+ if (Build.VERSION.SDK_INT >= 26) {
+ if (TextUtils.isEmpty(channelId)) {
+ channelId = PushChannelManager.LOCAL_PUSH_CHANNEL_ID;
+ }
+ builder = new Notification.Builder(context, channelId);
+ } else {
+ builder = new Notification.Builder(context);
+ }
+
+ let bitmap : Bitmap | null = null;
+ try {
+ if (!TextUtils.isEmpty(icon) && this.fileIsExist(icon!!)) {
+ bitmap = BitmapFactory.decodeFile(icon!!);
+ }
+ } catch (e : Exception) {
+ e.printStackTrace();
+ }
+ if (bitmap != null) {
+ builder.setLargeIcon(bitmap);
+ }
+
+ const id_small = context.getResources().getIdentifier("push_small", "drawable", context.getPackageName())
+ if (id_small <= 0) {
+ builder.setSmallIcon(context.getApplicationInfo().icon); //设置图标
+ } else {
+ builder.setSmallIcon(id_small); //设置图标
+ }
+
+ const id = context.getResources().getIdentifier("push", "drawable", context.getPackageName())
+ if (bitmap == null) {
+ let largeBitmap : Bitmap | null = null;
+ if (id <= 0) {
+ largeBitmap = BitmapFactory.decodeResource(context.getResources(), context.getApplicationInfo().icon);
+ } else {
+ largeBitmap = BitmapFactory.decodeResource(context.getResources(), id);
+ }
+ if (null != largeBitmap) {
+ builder.setLargeIcon(largeBitmap);
+ }
+ }
+ builder.setContentTitle(title); //设置标题
+ builder.setContentText(message); //消息内容
+ if (Build.VERSION.SDK_INT >= 24) {
+ builder.setShowWhen(true);
+ }
+ builder.setWhen(when); //发送时间
+
+ // 添加声音提示
+ if ("system" == sound) {
+ builder.setDefaults(Notification.DEFAULT_SOUND); //设置默认的提示音,振动方式,灯光
+ }
+ builder.setAutoCancel(true);//打开程序后图标消失
+ builder.setContentIntent(contentIntent);
+ builder.setCategory(category);
+ const notification = builder.build();
+ try {
+ notificationManager.notify(nId, notification);
+ } catch (e : Exception) {
+ e.printStackTrace();
+ }
+ }
+
+ break;
+ case this.ACTION_TYPE_REMOVE:
+ {
+ const _id = intent.getIntExtra("id", 0);
+ if (_id != null) {
+ notificationManager.cancel(_id);
+ }
+ }
+ break;
+ case this.ACTION_TYPE_CLEAR:
+ {
+ notificationManager.cancelAll();
+ const _appid = intent.getStringExtra("_appId");
+ if (_appid != null) {
+ const appMsg = PushManager.getInstance().mAppMessages;
+ appMsg.delete(_appid);
+ }
+ }
+ break;
+ case this.ACTION_TYPE_CLICK:
+ {
+ this.clickHandle(intent, notificationManager);
+ const packagename = context.getPackageName();// 启动类所在包名
+ const pm = context.getPackageManager();
+ const _intent = pm.getLaunchIntentForPackage(packagename);
+ const appid = intent.getStringExtra("appid");
+ _intent?.putExtra("appid", appid);
+ const isStartWeb = intent?.getBooleanExtra("__start_first_web__", false) ?? false;
+ if (isStartWeb) {
+ _intent?.putExtra("__start_first_web__", isStartWeb);
+ _intent?.putExtra("__first_web_url__", intent?.getStringExtra("__first_web_url__"));
+ }
+ _intent?.putExtra("__start_from__", 3);
+ _intent?.putExtra("__payload__", intent?.getStringExtra("payload"));
+ _intent?.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
+ context.startActivity(_intent);
+ }
+ break;
+ }
+
+ }
+
+ clickHandle(intent : Intent, _notificationManager : NotificationManager) {
+ const _bundle = intent.getExtras()!!;
+ const appid = _bundle.getString("appid");
+ const uuid = _bundle.getString("uuid");
+ if (_notificationManager != null) {//作为插件时,手助负责创建通知栏消息
+ const _id = intent.getIntExtra("id", 0);
+ _notificationManager.cancel(_id);
+ }
+ let _pushMessage : PushMessage | null = null
+ if (appid != null && uuid != null) {
+ _pushMessage = this.findPushMessage(appid!!, uuid!!);
+ }
+ if (_pushMessage != null) {
+ let isStartWeb = false;
+ if (!TextUtils.isEmpty(_pushMessage.mPayload)) {
+ try {
+ const payLoadJson = JSON.parseObject(_pushMessage.mPayload ?? "")
+ const url = payLoadJson?.getString("__adurl")
+ if (!TextUtils.isEmpty(url)) {
+ intent.putExtra("__start_first_web__", true);
+ intent.putExtra("__first_web_url__", url);
+ isStartWeb = true;
+ }
+ } catch (e : Exception) {
+ e.printStackTrace();
+ }
+ }
+
+ if (!isStartWeb && !sendEvent("click", _pushMessage)) {
+ this.addNeedExecClickMessage(_pushMessage);
+ }
+ // 点击后的消息,需要移除消息记录,避免getAllMessage时不正确
+ if (appid != null) {
+ this.removePushMessage(appid, _pushMessage);
+ }
+ } else {
+ _pushMessage = new PushMessage(_bundle);
+ if (!TextUtils.isEmpty(_pushMessage.mPayload)) {
+ try {
+ const payLoadJson = JSON.parseObject(_pushMessage.mPayload!!)
+ const url = payLoadJson?.getString("__adurl")
+ if (!TextUtils.isEmpty(url)) {
+ intent.putExtra("__start_first_web__", true);
+ intent.putExtra("__first_web_url__", url);
+ }
+ } catch (e : Exception) {
+ e.printStackTrace();
+ }
+ }
+ this.addNeedExecClickMessage(_pushMessage);
+ }
+ _bundle.clear();
+ }
+
+
+
+ findPushMessage(pAppid : String, pUuid : String) : PushMessage | null {
+ let _ret : PushMessage | null = null;
+ const _arr = this.mAppMessages.get(pAppid);
+ if (_arr == null) {//若没有通过appid获取到消息集合,则通过uuid遍历所有消息
+ this.mAppMessages.forEach((value : PushMessage[], key : string) => {
+ if (value != null) {
+ value.forEach((value : PushMessage) => {
+ if (pUuid == value.getMessageUUID()) {
+ _ret = value
+ }
+ })
+ }
+ })
+ } else if (_arr != null) {
+ _arr.forEach((value : PushMessage) => {
+ if (pUuid == value.getMessageUUID()) {
+ _ret = value
+ }
+ })
+ }
+ return _ret;
+ }
+
+
+ fileIsExist(path : string) : boolean {
+ const realPath = UTSAndroid.convert2AbsFullPath(path)
+ const file = new File(realPath)
+ return file.exists()
+ }
+}
\ No newline at end of file
diff --git a/uni_modules/uni-push/utssdk/app-android/push/PushMessage.uts b/uni_modules/uni-push/utssdk/app-android/push/PushMessage.uts
new file mode 100644
index 0000000000000000000000000000000000000000..ef84878939440a73a869e785081e1ea50f74b66c
--- /dev/null
+++ b/uni_modules/uni-push/utssdk/app-android/push/PushMessage.uts
@@ -0,0 +1,275 @@
+import TextUtils from 'android.text.TextUtils'
+import Bundle from 'android.os.Bundle';
+
+export class PushMessage {
+ private mTitle : string | null = null
+ private contentJson : string | null = null
+ private mContent : string | null = null
+
+ mPayloadJSON : UTSJSONObject | null = null
+ mPayload : string | null = null
+
+ private mWhen : Long = 0
+ mDelay : Long = 0
+ private mPath : string | null = null
+ private mForceNotification : string | null = null
+ private channelId = ""
+ private category = ""
+ private mMessageAppid : string | null = null
+ private mIconPath : string | null = null
+
+ private mUUID : string | null = null
+ private nID : number = 0
+ private isCover = false
+ private sound = "system"
+ private static mNotificationId = 1
+ private needCreateNotification = true
+
+ private pushVersion : Float = 1.0.toFloat()
+ private extJSON : UTSJSONObject | null = null
+
+ constructor(data : string, defaultTitle : string, isUniPush2 : boolean) {
+ if (!isUniPush2) {
+ this.contentJson = data
+ this.parseJson(data, UTSAndroid.getAppId(), defaultTitle)
+ } else {
+ this.extJSON = JSON.parseObject(data)
+ this.mMessageAppid = UTSAndroid.getAppId()
+ this.pushVersion = 2.0.toFloat()
+ if (this.extJSON != null) {
+ this.channelId = this.extJSON!!.getString("channelId") ?? ""
+ this.category = this.extJSON!!.getString("category") ?? ""
+ }
+ }
+ this.setMessageUUID()
+ this.setNotificationID()
+ }
+
+ $constructor(b : Bundle) {
+ this.mTitle = b.getString("title");
+ this.mContent = b.getString("content");
+ this.nID = b.getInt("nId");
+ this.mWhen = b.getLong("when");
+ this.sound = b.getString("sound") ?? "system";
+ this.mMessageAppid = b.getString("appid");
+ this.mUUID = b.getString("uuid");
+ this.mPayload = b.getString("payload");
+ this.mIconPath = b.getString("icon");
+ this.channelId = b.getString("channelId", "");
+ this.category = b.getString("category", "");
+ }
+
+
+
+ getNeedCreateNotification() : boolean {
+ return this.needCreateNotification;//payload为空串时需要创建
+ }
+
+ getMessageUUID() : string | null {
+ return this.mUUID
+ }
+
+ getJsonObject() : UTSJSONObject {
+ if (this.extJSON != null) {
+ if (this.pushVersion == (2.0.toFloat())) {
+ try {
+ this.extJSON!!["__UUID__"] = this.mUUID
+ this.extJSON!!["appid"] = this.mMessageAppid
+ } catch (e : Exception) {
+ e.printStackTrace()
+ return {};
+ }
+ }
+ return this.extJSON!!
+ } else {
+ const result = {} as UTSJSONObject;
+ result["__UUID__"] = this.mUUID
+ result["title"] = this.mTitle
+ result["appid"] = this.mMessageAppid
+ result["content"] = this.mContent
+ if (this.mPayloadJSON != null) {
+ result["payload"] = this.cleanNullValue(this.mPayloadJSON!!)
+ } else {
+ let payLoadObj : UTSJSONObject | null = null
+ if (this.mPayload != null) {
+ payLoadObj = JSON.parseObject(this.mPayload!!)
+ }
+
+ if (payLoadObj != null) {
+ result["payload"] = this.cleanNullValue(payLoadObj)
+ } else {
+ result["payload"] = this.mPayload
+ }
+ }
+ if (!TextUtils.isEmpty(this.mPath)) {
+ result["path"] = this.mPath
+ }
+ if (!TextUtils.isEmpty(this.mForceNotification)) {
+ result["force_notification"] = this.mForceNotification
+ }
+ if (!TextUtils.isEmpty(this.channelId)) {
+ result["channelId"] = this.channelId
+ }
+ if (!TextUtils.isEmpty(this.category)) {
+ result["category"] = this.category
+ }
+ return result
+ }
+ }
+
+ cleanNullValue(json : UTSJSONObject) : UTSJSONObject {
+ const result = {}
+ json.toMap().forEach((value, key) => {
+ if (value != null) {
+ result[key] = value
+ }
+ })
+ return result
+ }
+
+
+ toBundle() : Bundle {
+ const bundle = new Bundle()
+ if (this.extJSON != null && this.pushVersion == (2.0.toFloat())) {
+ bundle.putInt("nId", this.nID.toInt());
+ bundle.putLong("when", this.mWhen);
+ bundle.putString("sound", this.sound);
+ bundle.putString("appid", this.mMessageAppid);
+ bundle.putString("uuid", this.mUUID);
+ bundle.putString("icon", this.mIconPath);
+
+ const map = this.extJSON!!.toMap()
+ map.forEach((value, key) => {
+ if (value != null) {
+ if (typeof value == 'string') {
+ bundle.putString(key, value as string);
+ } else if (value instanceof Integer) {
+ bundle.putInt(key, value as Int);
+ } else if (value instanceof Double) {
+ bundle.putDouble(key, value);
+ } else if (typeof value == 'boolean') {
+ bundle.putBoolean(key, value as boolean);
+ } else if (value instanceof UTSJSONObject) {
+ bundle.putString(key, (value as UTSJSONObject).toJSONString());
+ }
+ }
+ })
+ return bundle
+ }
+
+ bundle.putString("title", this.mTitle);
+ bundle.putString("content", this.mContent);
+ bundle.putInt("nId", this.nID.toInt());
+ bundle.putLong("when", this.mWhen);
+ bundle.putString("sound", this.sound);
+ bundle.putString("appid", this.mMessageAppid);
+ bundle.putString("uuid", this.mUUID);
+ if (this.mPayloadJSON != null) {
+ bundle.putString("payload", this.mPayloadJSON!!.toJSONString());
+ } else {
+ bundle.putString("payload", this.mPayload);
+ }
+ bundle.putString("icon", this.mIconPath);
+ bundle.putString("channelId", this.channelId);
+ bundle.putString("category", this.category);
+
+ return bundle
+ }
+
+
+
+ private setMessageUUID() : void {
+ this.mUUID = "androidPushMsg" + this.hashCode()
+ }
+
+ private setNotificationID() : void {
+ if (!this.isCover) {
+ PushMessage.mNotificationId++
+ }
+ this.nID = PushMessage.mNotificationId
+ }
+
+
+ /**
+ * 解析消息的数据
+ * @param defaultAppid 通过appid 查询到icon资源 , 1.0强需求, 2.0 不需求
+ */
+ private parseJson(data : string, defaultAppid : string, defaultTitle : string) : void {
+ const json = JSON.parseObject(data)
+ if (json != null) {
+ let t_appid = json.getString("appid")
+ const content = json.getString("content")
+ if (content != null) {
+ this.mContent = content
+ } else {
+ const message = json.getString("message")
+ if (message != null) {
+ this.mContent = message
+ } else {
+ this.needCreateNotification = true
+ this.mContent = data
+ }
+ }
+
+ if (this.hasOwnProperty(json, "payload")) {
+ const payloadJson = json.getJSON("payload")
+ if (payloadJson != null) {
+ this.mPayloadJSON = payloadJson
+ } else {
+ this.mPayload = json.getString("payload")
+ }
+ } else {
+ if (this.hasOwnProperty(json, "Payload")) {
+ const payloadJson = json.getJSON("Payload")
+ if (payloadJson != null) {
+ this.mPayloadJSON = payloadJson
+ } else {
+ this.mPayload = json.getString("Payload")
+ }
+ } else {
+ this.needCreateNotification = false
+ this.mPayload = data
+ }
+ }
+
+ if (this.hasOwnProperty(json, "title")) {
+ this.mTitle = json.getString("title")
+ } else {
+ this.needCreateNotification = false
+ this.mTitle = defaultTitle
+ }
+
+ this.isCover = json.getBoolean("cover") ?? false
+ if ("none" == json.getString("sound")) {
+ this.sound = "none"
+ }
+ this.mWhen = (json.getNumber("when") ?? 0).toLong()
+ this.mDelay = (json.getNumber("delay") ?? 0).toLong()
+
+ this.mPath = json.getString("path")
+ this.mForceNotification = json.getString("force_notification")
+ this.channelId = json.getString("channelId") ?? ""
+ this.category = json.getString("category") ?? ""
+
+ if (TextUtils.isEmpty(t_appid)) {
+ t_appid = defaultAppid
+ }
+ this.mMessageAppid = t_appid
+ const iconPath = json.getString("icon") ?? ""
+ this.mIconPath = UTSAndroid.convert2AbsFullPath(iconPath)
+ } else {
+ this.needCreateNotification = false
+ this.mContent = data
+ this.mPayload = data
+ this.mTitle = defaultTitle
+ }
+ }
+
+
+ private hasOwnProperty(jsonObject : UTSJSONObject, key : string) : boolean {
+ return jsonObject.getAny(key) != null
+ }
+
+
+
+}
\ No newline at end of file
diff --git a/uni_modules/uni-push/utssdk/app-android/push/PushState.uts b/uni_modules/uni-push/utssdk/app-android/push/PushState.uts
new file mode 100644
index 0000000000000000000000000000000000000000..c80852d5c975a9af825366fe6c71a6d723f0adf1
--- /dev/null
+++ b/uni_modules/uni-push/utssdk/app-android/push/PushState.uts
@@ -0,0 +1,42 @@
+import Context from 'android.content.Context';
+import PackageManager from 'android.content.pm.PackageManager';
+import Bundle from 'android.os.Bundle';
+import TextUtils from 'android.text.TextUtils';
+export class PushState {
+
+ private static sMetaDatas : Bundle | null = null
+
+
+ static getAutoNotification() : boolean {
+ const context = UTSAndroid.getAppContext() as Context
+ const sp = context.getSharedPreferences("push_db_name", Context.MODE_PRIVATE)
+ const autoNotification = this.getMetaValue(context, "dcloud_unipush_auto_notification")
+ let needPush = true
+ if (autoNotification != null) {
+ if (!autoNotification.equals("ture", true)) {
+ needPush = false;
+ }
+ }
+ needPush = sp.getBoolean("auto_notification", needPush);
+ return needPush
+ }
+
+
+ private static getMetaValue(context : Context, metaKey : string) : string | null {
+ if (this.sMetaDatas == null) {
+ try {
+ this.sMetaDatas = context.getPackageManager().getApplicationInfo(context.getPackageName(), PackageManager.GET_META_DATA).metaData;
+ } catch (e : Exception) {
+ e.printStackTrace();
+ return null;
+ }
+ }
+ if (this.sMetaDatas != null) {
+ const value = this.sMetaDatas!!.get(metaKey)
+ if (value != null && !TextUtils.isEmpty(value as string)) {
+ return value as string;
+ }
+ }
+ return null;
+ }
+}
\ No newline at end of file
diff --git a/uni_modules/uni-push/utssdk/app-android/push/utils/StringUtil.uts b/uni_modules/uni-push/utssdk/app-android/push/utils/StringUtil.uts
new file mode 100644
index 0000000000000000000000000000000000000000..97bc29a1408d4a5be16314cd31c4e18751147513
--- /dev/null
+++ b/uni_modules/uni-push/utssdk/app-android/push/utils/StringUtil.uts
@@ -0,0 +1,31 @@
+export class StringUtil {
+ static trimString(pSrc : string, removed : string) : string {
+ const pTrimChar = removed.charAt(0)
+ let _ret = pSrc;
+ if (_ret != null && _ret != "") {
+ const _startPosi = _ret.charAt(0) == pTrimChar ? 1 : 0;
+ const _count = _ret.length;
+ const _endPosi = _ret.charAt(_count - 1) == pTrimChar ? _count - 1 : _count;
+ _ret = _ret.substring(_startPosi, _endPosi);
+ }
+ return _ret;
+ }
+
+ static getInt(content : string) : number | null {
+ try {
+ return content.toInt();
+ } catch (e : Exception) {
+ return null;
+ }
+ }
+
+
+ static getDouble(content : string) : number | null {
+ try {
+ return content.toDouble()
+ } catch (e : Exception) {
+ return null;
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/uni_modules/uni-push/utssdk/app-android/res/drawable-xxhdpi/push.png b/uni_modules/uni-push/utssdk/app-android/res/drawable-xxhdpi/push.png
new file mode 100755
index 0000000000000000000000000000000000000000..ed3d29bd26d2b611a328fba26aac73b44e916a10
Binary files /dev/null and b/uni_modules/uni-push/utssdk/app-android/res/drawable-xxhdpi/push.png differ
diff --git a/uni_modules/uni-push/utssdk/app-android/res/drawable-xxhdpi/push_small.png b/uni_modules/uni-push/utssdk/app-android/res/drawable-xxhdpi/push_small.png
new file mode 100755
index 0000000000000000000000000000000000000000..800dbd4a677f3c838095d7f31a4bc60ef85e75ed
Binary files /dev/null and b/uni_modules/uni-push/utssdk/app-android/res/drawable-xxhdpi/push_small.png differ
diff --git a/uni_modules/uni-push/utssdk/app-android/res/raw/keep.xml b/uni_modules/uni-push/utssdk/app-android/res/raw/keep.xml
new file mode 100644
index 0000000000000000000000000000000000000000..35edb41154a913b6042713dad4b709968f2b9970
--- /dev/null
+++ b/uni_modules/uni-push/utssdk/app-android/res/raw/keep.xml
@@ -0,0 +1,7 @@
+
+
+
+ 消息推送
+ 推送消息
+
+
\ No newline at end of file
diff --git a/uni_modules/uni-push/utssdk/app-android/res/values/values.xml b/uni_modules/uni-push/utssdk/app-android/res/values/values.xml
new file mode 100644
index 0000000000000000000000000000000000000000..012adb5e607f5fee15fbdd8653591adaedf7a808
--- /dev/null
+++ b/uni_modules/uni-push/utssdk/app-android/res/values/values.xml
@@ -0,0 +1,6 @@
+
+
+ unipush
+ message push
+
+
\ No newline at end of file
diff --git a/uni_modules/uni-push/utssdk/app-ios/index.uts b/uni_modules/uni-push/utssdk/app-ios/index.uts
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/uni_modules/uni-push/utssdk/interface.uts b/uni_modules/uni-push/utssdk/interface.uts
new file mode 100644
index 0000000000000000000000000000000000000000..84490f8ac43178f6aa5003271af83a36dff8e0d6
--- /dev/null
+++ b/uni_modules/uni-push/utssdk/interface.uts
@@ -0,0 +1,396 @@
+export interface Uni {
+ /**
+ * getPushClientId()
+ * @description
+ * 获取客户端唯一的推送标识
+ * @param {GetPushClientIdOptions}
+ * @return {void}
+ * @tutorial http://uniapp.dcloud.io/api/plugins/push.html#getpushclientid
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "4.4",
+ * "uniVer": "√",
+ * "unixVer": "3.97"
+ * },
+ * "ios": {
+ * "osVer": "9.0",
+ * "uniVer": "x",
+ * "unixVer": "x"
+ * }
+ * }
+ * }
+ * @example
+ ```typescript
+ uni.getPushClientId({
+ complete: (res: any) => {
+ console.log("getPushClientId complete => " + JSON.stringify(res));
+ }
+ });
+ ```
+ */
+ getPushClientId(options : GetPushClientIdOptions) : void;
+ /**
+ * onPushMessage()
+ * @description
+ * 启动监听推送消息事件
+ * @param {OnPushMessageCallback}
+ * @return {void}
+ * @tutorial http://uniapp.dcloud.io/api/plugins/push.html#onpushmessage
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "4.4",
+ * "uniVer": "√",
+ * "unixVer": "3.97"
+ * },
+ * "ios": {
+ * "osVer": "9.0",
+ * "uniVer": "x",
+ * "unixVer": "x"
+ * }
+ * }
+ * }
+ * @example
+ ```typescript
+ uni.onPushMessage((res : OnPushMessageCallbackResult) => {
+ console.log("onPushMessage => " + JSON.stringify(res))
+ });
+ ```
+ */
+ onPushMessage(callback : OnPushMessageCallback) : void;
+ /**
+ * offPushMessage()
+ * @description
+ * 关闭推送消息监听事件
+ * @param {OnPushMessageCallback}
+ * @return {void}
+ * @tutorial http://uniapp.dcloud.io/api/plugins/push.html#offpushmessage
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "4.4",
+ * "uniVer": "√",
+ * "unixVer": "3.97"
+ * },
+ * "ios": {
+ * "osVer": "9.0",
+ * "uniVer": "x",
+ * "unixVer": "x"
+ * }
+ * }
+ * }
+ * @example
+ ```typescript
+ const cb = (res : OnPushMessageCallbackResult) => {
+ console.log("onPushMessage => " + JSON.stringify(res))
+ }
+ uni.offPushMessage(cb);
+ ```
+ */
+ offPushMessage(callback : OnPushMessageCallback) : void;
+ /**
+ * getChannelManager()
+ * @description
+ * 获取通知渠道管理器,Android 8系统以上才可以设置通知渠道,Android 8系统以下返回null。
+ * @param {void}
+ * @return {ChannelManager}
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "4.4",
+ * "uniVer": "3.97",
+ * "unixVer": "3.97"
+ * },
+ * "ios": {
+ * "osVer": "9.0",
+ * "uniVer": "x",
+ * "unixVer": "x"
+ * }
+ * }
+ * }
+ * @example
+ ```typescript
+ const channelManager = uni.getChannelManager();
+ channelManager.setPushChannel({
+ channelId: "test1",
+ channelDesc: "test1 desc",
+ soundName: "pushsound"
+ })
+ const channels = channelManager.getAllChannels() as string[]
+ console.log("channels : " + channels);
+ ```
+ */
+ getChannelManager() : ChannelManager;
+
+ /**
+ * createPushMessage()
+ * @description
+ * 创建本地通知栏消息
+ * @param {CreatePushMessageOptions}
+ * @return {void}
+ * @tutorial http://uniapp.dcloud.io/api/plugins/push.html#createpushmessage
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "4.4",
+ * "uniVer": "√",
+ * "unixVer": "3.97"
+ * },
+ * "ios": {
+ * "osVer": "9.0",
+ * "uniVer": "x",
+ * "unixVer": "x"
+ * }
+ * }
+ * }
+ * @example
+ ```typescript
+ uni.createPushMessage({
+ title:"hello",
+ content: "content"
+ });
+ ```
+ */
+ createPushMessage(options : CreatePushMessageOptions) : void;
+}
+
+export type GetPushClientId = (options : GetPushClientIdOptions) => void;
+export type GetPushClientIdSuccess = {
+ /**
+ * 个推客户端推送id,对应uni-id-device表的push_clientid
+ */
+ cid : string,
+ /**
+ * 错误描述
+ */
+ errMsg : string
+};
+export type GetPushClientIdSuccessCallback = (result : GetPushClientIdSuccess) => void;
+export type GetPushClientIdFail = UniError;
+export type GetPushClientIdFailCallback = (result : GetPushClientIdFail) => void;
+export type GetPushClientIdComplete = any;
+export type GetPushClientIdCompleteCallback = (result : GetPushClientIdComplete) => void;
+export type GetPushClientIdOptions = {
+ /**
+ * 接口调用成功的回调函数
+ * @defaultValue null
+ */
+ success : GetPushClientIdSuccessCallback | null,
+ /**
+ * 接口调用失败的回调函数
+ * @defaultValue null
+ */
+ fail : GetPushClientIdFailCallback | null,
+ /**
+ * 接口调用结束的回调函数(调用成功、失败都会执行)
+ * @defaultValue null
+ */
+ complete : GetPushClientIdCompleteCallback | null
+};
+/**
+ * 事件类型
+ * - click 从系统推送服务点击消息启动应用事件
+ * - receive 应用从推送服务器接收到推送消息事件
+ */
+export type OnPushMessageType = "click" | "receive";
+
+export type OnPushMessageCallbackResult = {
+ /**
+ * 事件类型
+ * @type{OnPushMessageType}
+ */
+ type : OnPushMessageType,
+ /**
+ * 消息内容
+ */
+ data : UTSJSONObject
+};
+
+export type OnPushMessageCallback = (result : OnPushMessageCallbackResult) => void;
+export type OnPushMessage = (callback : OnPushMessageCallback) => void;
+export type OffPushMessage = (callback : OnPushMessageCallback) => void;
+
+
+export type GetChannelManager = () => ChannelManager;
+export type SetPushChannelOptions = {
+ /**
+ * 添加的声音文件,注意raw目录下必须要有 ,不传此字段将使用默认铃音。
+ * @defaultValue null
+ */
+ soundName? : string | null,
+ /**
+ * 通知渠道id
+ */
+ channelId : string,
+ /**
+ * 通知渠道描述
+ */
+ channelDesc : string,
+ /**
+ * 呼吸灯闪烁
+ * @defaultValue false
+ */
+ enableLights? : boolean | null,
+ /**
+ * 震动
+ * @defaultValue false
+ */
+ enableVibration? : boolean | null,
+ /**
+ * 通知的重要性级别,可选范围IMPORTANCE_LOW:2、IMPORTANCE_DEFAULT:3、IMPORTANCE_HIGH:4 。
+ * @defaultValue 3
+ */
+ importance? : number | null,
+ /**
+ * 锁屏可见性,可选范围VISIBILITY_PRIVATE:0、VISIBILITY_PUBLIC:1、VISIBILITY_SECRET:-1、VISIBILITY_NO_OVERRIDE:-1000。
+ * @defaultValue -1000
+ */
+ lockscreenVisibility? : number | null
+}
+export interface ChannelManager {
+ /**
+ * 设置推送渠道
+ *
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "4.4",
+ * "uniVer": "√",
+ * "unixVer": "3.97"
+ * },
+ * "ios": {
+ * "osVer": "9.0",
+ * "uniVer": "x",
+ * "unixVer": "x"
+ * }
+ * }
+ * }
+ */
+ setPushChannel(options : SetPushChannelOptions) : void;
+ /**
+ * 获取当前应用注册的所有的通知渠道。
+ *
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "4.4",
+ * "uniVer": "√",
+ * "unixVer": "3.97"
+ * },
+ * "ios": {
+ * "osVer": "9.0",
+ * "uniVer": "x",
+ * "unixVer": "x"
+ * }
+ * }
+ * }
+ */
+ getAllChannels() : Array;
+}
+
+export type CreatePushMessage = (options : CreatePushMessageOptions) => void;
+export type CreatePushMessageSuccess = {};
+export type CreatePushMessageSuccessCallback = (result : CreatePushMessageSuccess) => void;
+export type CreatePushMessageFail = UniError;
+export type CreatePushMessageFailCallback = (result : CreatePushMessageFail) => void;
+export type CreatePushMessageComplete = any;
+export type CreatePushMessageCompleteCallback = (result : CreatePushMessageComplete) => void;
+export type CreatePushMessageOptions = {
+ /**
+ * 是否覆盖上一次提示的消息
+ * @type boolean
+ * @defaultValue false
+ */
+ cover? : boolean | null,
+ /**
+ * 提示消息延迟显示的时间,单位为s
+ * @defaultValue 0
+ */
+ delay? : number | null,
+ /**
+ * 推送消息的图标
+ * @defaultValue null
+ */
+ icon? : string | null,
+ /**
+ * 推送消息的提示音
+ * - system: 使用系统通知提示音(默认值)
+ * - none: 不使用提示音
+ * @type 'system' | 'none'
+ * @defaultValue "system"
+ */
+ sound? : string | null,
+ /**
+ * 推送消息的标题
+ * @defaultValue ""
+ */
+ title? : string | null,
+ /**
+ * 消息显示的内容,在系统通知中心中显示的文本内容
+ */
+ content : string,
+ /**
+ * 消息承载的数据,可根据业务逻辑自定义数据格式
+ * @defaultValue null
+ */
+ payload? : any | null,
+ /**
+ * 消息上显示的提示时间
+ * @defaultValue 当前时间
+ */
+ when? : number | null,
+ /**
+ * 渠道id
+ * @defaultValue "DcloudChannelID"
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "4.4",
+ * "uniVer": "√",
+ * "unixVer": "3.97"
+ * },
+ * "ios": {
+ * "osVer": "9.0",
+ * "uniVer": "x",
+ * "unixVer": "x"
+ * }
+ * }
+ * }
+ */
+ channelId? : string | null,
+ /**
+ * 通知类别
+ * @defaultValue null
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "4.4",
+ * "uniVer": "√",
+ * "unixVer": "3.97"
+ * },
+ * "ios": {
+ * "osVer": "9.0",
+ * "uniVer": "x",
+ * "unixVer": "x"
+ * }
+ * }
+ * }
+ */
+ category? : string | null,
+ /**
+ * 接口调用成功的回调函数
+ * @defaultValue null
+ */
+ success : CreatePushMessageSuccessCallback | null,
+ /**
+ * 接口调用失败的回调函数
+ * @defaultValue null
+ */
+ fail : CreatePushMessageFailCallback | null,
+ /**
+ * 接口调用结束的回调函数(调用成功、失败都会执行)
+ * @defaultValue null
+ */
+ complete : CreatePushMessageCompleteCallback | null
+};
diff --git a/uni_modules/uni-storage/changelog.md b/uni_modules/uni-storage/changelog.md
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/uni_modules/uni-storage/package.json b/uni_modules/uni-storage/package.json
new file mode 100644
index 0000000000000000000000000000000000000000..c0da4b7a48697f743a265be373a87bf5172374d0
--- /dev/null
+++ b/uni_modules/uni-storage/package.json
@@ -0,0 +1,165 @@
+{
+ "id": "UTS-Storage",
+ "displayName": "UTS-Storage",
+ "version": "1.0.0",
+ "description": "UTS-Storage",
+ "keywords": [
+ "UTS-Storage"
+],
+ "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": {
+ "uni-ext-api": {
+ "uni": {
+ "setStorage": {
+ "name": "setStorage",
+ "app": {
+ "js": false,
+ "kotlin": true,
+ "swift": true
+ }
+ },
+ "setStorageSync": {
+ "name": "setStorageSync",
+ "app": {
+ "js": false,
+ "kotlin": true,
+ "swift": true
+ }
+ },
+ "getStorage": {
+ "name": "getStorage",
+ "app": {
+ "js": false,
+ "kotlin": true,
+ "swift": true
+ }
+ },
+ "getStorageSync": {
+ "name": "getStorageSync",
+ "app": {
+ "js": false,
+ "kotlin": true,
+ "swift": true
+ }
+ },
+ "getStorageInfo": {
+ "name": "getStorageInfo",
+ "app": {
+ "js": false,
+ "kotlin": true,
+ "swift": true
+ }
+ },
+ "getStorageInfoSync": {
+ "name": "getStorageInfoSync",
+ "app": {
+ "js": false,
+ "kotlin": true,
+ "swift": true
+ }
+ },
+ "removeStorage": {
+ "name": "removeStorage",
+ "app": {
+ "js": false,
+ "kotlin": true,
+ "swift": true
+ }
+ },
+ "removeStorageSync": {
+ "name": "removeStorageSync",
+ "app": {
+ "js": false,
+ "kotlin": true,
+ "swift": true
+ }
+ },
+ "clearStorage": {
+ "name": "clearStorage",
+ "app": {
+ "js": false,
+ "kotlin": true,
+ "swift": true
+ }
+ },
+ "clearStorageSync": {
+ "name": "clearStorageSync",
+ "app": {
+ "js": false,
+ "kotlin": true,
+ "swift": true
+ }
+ }
+ }
+ },
+ "dependencies": [],
+ "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"
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/uni_modules/uni-storage/readme.md b/uni_modules/uni-storage/readme.md
new file mode 100644
index 0000000000000000000000000000000000000000..5cf7be4be3d6dc942a2d92103022b516dc4c7af8
--- /dev/null
+++ b/uni_modules/uni-storage/readme.md
@@ -0,0 +1,6 @@
+# UTS-Storage
+### 开发文档
+[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)
\ No newline at end of file
diff --git a/uni_modules/uni-storage/utssdk/app-android/index.uts b/uni_modules/uni-storage/utssdk/app-android/index.uts
new file mode 100644
index 0000000000000000000000000000000000000000..f77c411580cab2819cf70636eb60a413ac974e53
--- /dev/null
+++ b/uni_modules/uni-storage/utssdk/app-android/index.uts
@@ -0,0 +1,359 @@
+import { SetStorage, SetStorageOptions, SetStorageSuccess } from "../interface.uts"
+import { SetStorageSync } from "../interface.uts"
+import { GetStorage, GetStorageOptions, GetStorageSuccess } from "../interface.uts"
+import { GetStorageSync } from "../interface.uts"
+import { GetStorageInfoSuccess, GetStorageInfo, GetStorageInfoOptions } from "../interface.uts"
+import { GetStorageInfoSync } from "../interface.uts"
+
+import { RemoveStorage, RemoveStorageOptions, RemoveStorageSuccess } from "../interface.uts"
+import { RemoveStorageSync } from "../interface.uts"
+import { ClearStorage, ClearStorageSuccess, ClearStorageOptions } from "../interface.uts"
+import { ClearStorageSync } from "../interface.uts"
+
+// @ts-expect-error
+import DCStorage from "io.dcloud.common.util.db.DCStorage";
+// @ts-expect-error
+import UTSAndroid from 'io.dcloud.uts.UTSAndroid';
+// @ts-expect-error
+import List from 'java.util.List';
+import {
+ uni_getStorageAsync,
+ uni_getStorageSync,
+ uni_setStorageAsync,
+ uni_setStorageSync
+} from "../uniStorageTool.uts"
+
+
+/**
+ * 设置储存项
+ */
+export const setStorage: SetStorage = function (options: SetStorageOptions) {
+
+ setTimeout(function () {
+
+ let dcStorage = DCStorage.getDCStorage(UTSAndroid.getUniActivity());
+ if (dcStorage == null) {
+ let ret = new UniError("uni-setStorage", -1, "storage not found.")
+ options.fail?.(ret)
+ options.complete?.(ret)
+ return
+ }
+ /**
+ * 通过公共函数执行设置逻辑
+ */
+ uni_setStorageAsync(options, (itemKey: string, itemData: string) => {
+ dcStorage.performSetItem(UTSAndroid.getUniActivity(), UTSAndroid.getAppId(), itemKey, itemData);
+ }, (itemKey: string) => {
+ dcStorage.performRemoveItem(UTSAndroid.getUniActivity(), UTSAndroid.getAppId(), itemKey);
+ })
+
+
+ }, 0)
+}
+
+/**
+ * 同步设置储存项
+ */
+export const setStorageSync: SetStorageSync = function (key: string, data: any) {
+
+ let dcStorage = DCStorage.getDCStorage(UTSAndroid.getUniActivity());
+
+ if (dcStorage == null) {
+ // 异常了
+ return;
+ }
+ uni_setStorageSync(key, data, (itemKey: string, itemValue: string) => {
+ let dataString = itemValue
+ if (typeof data == "string") {
+ // string 类型不进行序列化
+ dataString = data as string
+ }
+ dcStorage.performSetItem(UTSAndroid.getUniActivity(), UTSAndroid.getAppId(), itemKey, dataString);
+ }, (itemKey: string) => {
+ dcStorage.performRemoveItem(UTSAndroid.getUniActivity(), UTSAndroid.getAppId(), itemKey);
+ })
+
+
+}
+
+
+/**
+ * 获取储存项
+ */
+function includeKey(key: string): boolean {
+
+ let info = DCStorage.getDCStorage(UTSAndroid.getUniActivity()!).performGetAllKeys(UTSAndroid.getAppId())
+ console.log(info)
+ if (info.v != null && info.code == DCStorage.SUCCESS) {
+ //&& info.v instanceof java.util.List
+ // @ts-expect-error
+ let keys = UTSArray.fromNative((info.v as ArrayList));
+ if (keys.indexOf(key) > -1) {
+ return true
+ }
+ }
+ return false;
+}
+
+export const getStorage: GetStorage = function getStorage(options: GetStorageOptions) {
+
+
+ let dcStorage = DCStorage.getDCStorage(UTSAndroid.getUniActivity());
+
+ if (dcStorage == null) {
+ let ret = new UniError("uni-setStorage", -1, "storage not found.")
+ options.fail?.(ret)
+ options.complete?.(ret)
+ return
+ }
+
+ setTimeout(function () {
+
+ uni_getStorageAsync(options, function (itemKey: string): string | null {
+
+ let info = dcStorage.performGetItem(UTSAndroid.getAppId(), itemKey);
+ if (info != null && info.code == DCStorage.SUCCESS && info.v != null) {
+ // 获取成功
+ return info.v as string
+ }
+
+ return null
+ }, function (key: string): boolean {
+ let list: String[] = []
+
+ let info = dcStorage.performGetAllKeys(UTSAndroid.getAppId())
+ if (info.code == DCStorage.SUCCESS && info.v != null) {
+
+ /**
+ * 临时语法支持,foreach 组织数组格式
+ */
+ let arrayKeys: String[] = []
+ ;(info.v as List).forEach((perKey: string) => {
+ arrayKeys.push(perKey)
+ });
+
+ list = arrayKeys
+ }
+
+ if (list != null) {
+ let item = list!.find((value): boolean => {
+ if (typeof value == "string") {
+ return (value as string) == key;
+ }
+ return false;
+ })
+ return (item != null);
+ }
+ return false;
+ })
+
+
+ }, 0)
+}
+
+
+/**
+ * 同步获取储存项
+ */
+export const getStorageSync: GetStorageSync = function (key: string): any | null {
+
+
+ return uni_getStorageSync(key, function (itemKey: string): string | null {
+ let dcStorage = DCStorage.getDCStorage(UTSAndroid.getUniActivity());
+
+ if (dcStorage == null) {
+ return "";
+ }
+
+ let info = dcStorage.performGetItem(UTSAndroid.getAppId(), itemKey);
+ if (info != null && info.code == DCStorage.SUCCESS && info.v != null) {
+ // 获取成功
+ return info.v as string
+ }
+ return ""
+ });
+
+
+}
+
+/**
+ * 获取储存信息
+ */
+export const getStorageInfo: GetStorageInfo = function (options: GetStorageInfoOptions) {
+
+ setTimeout(function () {
+
+
+ let dcStorage = DCStorage.getDCStorage(UTSAndroid.getUniActivity());
+
+ if (dcStorage == null) {
+ let ret = new UniError("uni-setStorage", -1, "storage not found.")
+ options.fail?.(ret)
+ options.complete?.(ret)
+ }
+
+ let ret: GetStorageInfoSuccess = {
+ keys: [],
+ currentSize: 0,
+ limitSize: 10240
+ }
+
+ let info = dcStorage.performGetAllKeys(UTSAndroid.getAppId());
+ if (info.code == DCStorage.SUCCESS && info.v != null) {
+
+ let arrayKeys: string[] = []
+
+ /**
+ * 临时语法支持,foreach 组织数组格式
+ */
+ ;(info.v as List).forEach((perKey: string) => {
+ arrayKeys.push(perKey)
+ });
+
+ /**
+ * 储存的最大值:SQLLite数据库当前允许的最大值
+ * 储存的已用值:SQLLite数据文件当前的大小
+ */
+ try {
+ ret.keys = arrayKeys
+
+ let limitNum = dcStorage.getDBMaxLength(UTSAndroid.getAppId()).toDouble()
+ ret.limitSize = limitNum / 1024
+
+ let currentNum = dcStorage.getDBCurrentLength(UTSAndroid.getAppId()).toDouble()
+ ret.currentSize = currentNum / 1024
+ } catch (e) {
+ //TODO handle the exception
+ }
+
+ // let arrayRet = info.v as Array
+ options.success?.(ret)
+ }
+ }, 0)
+
+}
+
+
+/**
+ * 同步获取储存信息
+ */
+export const getStorageInfoSync: GetStorageInfoSync = function (): GetStorageInfoSuccess {
+
+ // android SQL 单表最大限制为
+ let ret: GetStorageInfoSuccess = {
+ keys: [],
+ currentSize: 0,
+ limitSize: 10240,
+ }
+
+ let dcStorage = DCStorage.getDCStorage(UTSAndroid.getUniActivity());
+ if (dcStorage == null) {
+ return ret
+ }
+
+
+ let info = dcStorage.performGetAllKeys(UTSAndroid.getAppId());
+ if (info.code == DCStorage.SUCCESS && info.v != null) {
+
+ /**
+ * 临时语法支持,foreach 组织数组格式
+ */
+ let arrayKeys: string[] = []
+ ;(info.v as List).forEach((perKey: string) => {
+ arrayKeys.push(perKey)
+ });
+
+ ret.keys = arrayKeys
+ }
+
+ /**
+ * 储存的最大值:SQLLite数据库当前允许的最大值
+ * 储存的已用值:SQLLite数据文件当前的大小
+ */
+ try {
+ let limitNum = dcStorage.getDBMaxLength(UTSAndroid.getAppId()).toDouble()
+ ret.limitSize = limitNum / 1024
+
+ let currentNum = dcStorage.getDBCurrentLength(UTSAndroid.getAppId()).toDouble()
+ ret.currentSize = currentNum / 1024
+ } catch (e) {
+ //TODO handle the exception
+ }
+
+
+ return ret
+
+}
+
+/**
+ * 移除指定储存项
+ */
+export const removeStorage: RemoveStorage = function (options: RemoveStorageOptions) {
+
+ setTimeout(function () {
+ let dcStorage = DCStorage.getDCStorage(UTSAndroid.getUniActivity());
+ if (dcStorage == null) {
+ let ret = new UniError("uni-removeStorage", -1, "storage not found.")
+ options.fail?.(ret)
+ options.complete?.(ret)
+ return;
+ }
+ dcStorage.performRemoveItem(UTSAndroid.getUniActivity(), UTSAndroid.getAppId(), options.key);
+ let ret: RemoveStorageSuccess = {}
+ options.success?.(ret)
+ options.complete?.(ret)
+
+ }, 0)
+
+}
+
+/**
+ * 同步移除指定储存项
+ */
+export const removeStorageSync: RemoveStorageSync = function (key: string) {
+
+ let dcStorage = DCStorage.getDCStorage(UTSAndroid.getUniActivity());
+ if (dcStorage == null) {
+ return;
+ }
+ dcStorage.performRemoveItem(UTSAndroid.getUniActivity(), UTSAndroid.getAppId(), key);
+
+}
+
+/**
+ * 清空储存选项
+ */
+export const clearStorage: ClearStorage = function (option: ClearStorageOptions | null) {
+
+ setTimeout(function () {
+ let dcStorage = DCStorage.getDCStorage(UTSAndroid.getUniActivity());
+ if (dcStorage == null) {
+ let ret = new UniError("uni-clearStorage", -1, "error:storage not found.")
+ option?.fail?.(ret)
+ option?.complete?.(ret)
+ return;
+ }
+ dcStorage.performClear(UTSAndroid.getUniActivity(), UTSAndroid.getAppId());
+
+
+ let ret: ClearStorageSuccess = {}
+ option?.success?.(ret)
+ option?.complete?.(ret)
+ }, 0)
+
+}
+
+/**
+ * 同步清空储存选项
+ */
+export const clearStorageSync: ClearStorageSync = function () {
+
+
+ let dcStorage = DCStorage.getDCStorage(UTSAndroid.getUniActivity());
+ if (dcStorage == null) {
+ return;
+ }
+ dcStorage.performClear(UTSAndroid.getUniActivity(), UTSAndroid.getAppId());
+
+}
+
diff --git a/uni_modules/uni-storage/utssdk/app-ios/Frameworks/storage.framework/Headers/StorageManager.h b/uni_modules/uni-storage/utssdk/app-ios/Frameworks/storage.framework/Headers/StorageManager.h
new file mode 100644
index 0000000000000000000000000000000000000000..c4c863ac114049c819fc34ee0e10321a61bcb2ba
--- /dev/null
+++ b/uni_modules/uni-storage/utssdk/app-ios/Frameworks/storage.framework/Headers/StorageManager.h
@@ -0,0 +1,37 @@
+//
+// StorageManager.h
+// storage
+//
+// Created by DCloud on 2018/6/13.
+// Copyright © 2018年 DCloud. All rights reserved.
+//
+
+#import
+
+typedef void (^StorageManagerCallback)(id result);
+
+@class Storage;
+@interface StorageManager : NSObject
++ (Storage*)currentStorage;
++ (Storage*)activeStorageWithDomain:(NSString*)domain;
++ (void)serializeStorageWithDomain:(NSString*)domain;
++ (Storage*)storageWithDomain:(NSString*)domain;
+@end
+
+@interface Storage : NSObject
+@property(nonatomic, strong)NSString* domain;
+@property(nonatomic, strong)NSString* rootPath;
+- (NSUInteger)length;
+
+- (NSArray*)getAllKeys;
+
+- (void)setItem:(NSString *)key value:(NSString *)value callback:(StorageManagerCallback)callback;
+
+- (void)setItemPersistent:(NSString *)key value:(NSString *)value callback:(StorageManagerCallback)callback;
+
+- (NSString*)getItem:(NSString *)key callback:(StorageManagerCallback)callback;
+
+- (void)removeItem:(NSString *)key callback:(StorageManagerCallback)callback;
+- (void)clear;
+@end
+
diff --git a/uni_modules/uni-storage/utssdk/app-ios/Frameworks/storage.framework/Headers/storage.h b/uni_modules/uni-storage/utssdk/app-ios/Frameworks/storage.framework/Headers/storage.h
new file mode 100644
index 0000000000000000000000000000000000000000..d7b8f8a4edf1a07ad5fd8b043ff7359aeeeecd3a
--- /dev/null
+++ b/uni_modules/uni-storage/utssdk/app-ios/Frameworks/storage.framework/Headers/storage.h
@@ -0,0 +1,19 @@
+//
+// storage.h
+// storage
+//
+// Created by DCloud on 2018/6/13.
+// Copyright © 2018年 DCloud. All rights reserved.
+//
+
+#import
+
+//! Project version number for storage.
+FOUNDATION_EXPORT double storageVersionNumber;
+
+//! Project version string for storage.
+FOUNDATION_EXPORT const unsigned char storageVersionString[];
+
+// In this header, you should import all the public headers of your framework using statements like #import
+
+#import
diff --git a/uni_modules/uni-storage/utssdk/app-ios/Frameworks/storage.framework/Info.plist b/uni_modules/uni-storage/utssdk/app-ios/Frameworks/storage.framework/Info.plist
new file mode 100644
index 0000000000000000000000000000000000000000..01ae4beacf0d6cddabe42ca2f7fdd97865dbdae3
Binary files /dev/null and b/uni_modules/uni-storage/utssdk/app-ios/Frameworks/storage.framework/Info.plist differ
diff --git a/uni_modules/uni-storage/utssdk/app-ios/Frameworks/storage.framework/Modules/module.modulemap b/uni_modules/uni-storage/utssdk/app-ios/Frameworks/storage.framework/Modules/module.modulemap
new file mode 100644
index 0000000000000000000000000000000000000000..858a5dae406c35db8db883f36021327836151855
--- /dev/null
+++ b/uni_modules/uni-storage/utssdk/app-ios/Frameworks/storage.framework/Modules/module.modulemap
@@ -0,0 +1,6 @@
+framework module storage {
+ umbrella header "storage.h"
+
+ export *
+ module * { export * }
+}
diff --git a/uni_modules/uni-storage/utssdk/app-ios/Frameworks/storage.framework/storage b/uni_modules/uni-storage/utssdk/app-ios/Frameworks/storage.framework/storage
new file mode 100644
index 0000000000000000000000000000000000000000..2255ac64b01ca0fc05faea041f5cbb4029375f8b
Binary files /dev/null and b/uni_modules/uni-storage/utssdk/app-ios/Frameworks/storage.framework/storage differ
diff --git a/uni_modules/uni-storage/utssdk/app-ios/index.uts b/uni_modules/uni-storage/utssdk/app-ios/index.uts
new file mode 100644
index 0000000000000000000000000000000000000000..cf73d4602297a060aceaf3f2e72f3a3183f01ed8
--- /dev/null
+++ b/uni_modules/uni-storage/utssdk/app-ios/index.uts
@@ -0,0 +1,190 @@
+import { SetStorageSuccess, SetStorageOptions, SetStorage, SetStorageSync, GetStorageSuccess, GetStorageOptions, GetStorage, GetStorageSync, GetStorageInfoSuccess, GetStorageInfoOptions, GetStorageInfo, GetStorageInfoSync, RemoveStorageSuccess, RemoveStorageOptions, RemoveStorage, RemoveStorageSync, ClearStorage, ClearStorageSync, ClearStorageOptions, ClearStorageSuccess} from "../interface.uts"
+import { Storage, StorageManager } from "storage" assert { type: "implementationOnly" };
+import { UTSiOS, dc_storage_aes_key, dc_storage_path_component, dc_storage_old_path_component } from "DCloudUTSFoundation";
+import { NSDictionary, URL, FileManager, PropertyListSerialization, NSData, NSKeyedUnarchiver } from 'Foundation';
+import { uni_getStorageAsync, uni_getStorageSync, uni_setStorageAsync, uni_setStorageSync } from "../uniStorageTool.uts"
+
+
+class StorageTool {
+ protected static storage: Storage | null
+
+ private static migrateStorage(storage: Storage) {
+ let dataPath = UTSiOS.getDataPath()
+ const oldPath = new URL(fileURLWithPath = dataPath).appendingPathComponent(dc_storage_old_path_component).absoluteString
+ let content: any | null = null
+
+ if (FileManager.default.fileExists(atPath = oldPath)) {
+ let data = FileManager.default.contents(atPath = oldPath)
+ if (data != null) {
+ content = PropertyListSerialization.propertyListFromData(data!, mutabilityOption = [PropertyListSerialization.MutabilityOptions.mutableContainersAndLeaves], format = null, errorDescription = null)
+ }
+ try {
+ UTSiOS.try(FileManager.default.removeItem(atPath = oldPath))
+ } catch (e) {
+ // console.log(e)
+ }
+ } else{
+ const path = new URL(fileURLWithPath = dataPath).appendingPathComponent(dc_storage_path_component).absoluteString
+ let inputData = NSData.init(contentsOfFile = path)
+ if ( inputData != null ) {
+ let data = UTSiOS.dc_AESDecrypt(data = inputData!, key = dc_storage_aes_key)
+ if (data != null) {
+ content = NSKeyedUnarchiver.unarchiveObject(with = data!)
+ }
+ }
+ try {
+ UTSiOS.try(FileManager.default.removeItem(atPath = path))
+ } catch (e) {
+ // console.log(e)
+ }
+ }
+ if (content != null ) {
+ let contentDic = UTSiOS.convertDictionary(content!)
+ if (contentDic.isEmpty == false) {
+ let dic = new NSDictionary(dictionary = contentDic)
+ let i = 0
+ while (i < dic.allKeys.length){
+ let key = dic.allKeys[i]
+ if (key != null && typeof key == "string") {
+ let value = dic.value(forKey = key as string)
+ if (value != null && typeof value == "string") {
+ storage.setItem(key as string, value = value as string, callback = null)
+ }
+ }
+ i++
+ }
+ }
+ }
+ }
+
+ protected static getStorage(): Storage {
+ if (this.storage != null) {
+ return this.storage!
+ }
+ const domain: string = UTSiOS.getAppId()
+ let storage: Storage | null = null
+ storage = StorageManager.storage(withDomain = domain)
+ if (this.storage == null) {
+ storage = StorageManager.activeStorage(withDomain = domain)
+ const path = UTSiOS.getDataPath()
+ storage!.rootPath = path
+ this.migrateStorage(storage!)
+ }
+ this.storage = storage
+ return storage!
+ }
+
+}
+
+
+
+export const setStorage: SetStorage = function (options: SetStorageOptions) {
+ setTimeout(() => {
+ uni_setStorageAsync(options, (itemKey: string, itemData: string) => {
+ StorageTool.getStorage().setItemPersistent(itemKey, value = itemData, callback = null)
+ }, (itemKey: string) => {
+ StorageTool.getStorage().removeItem(itemKey, callback = null)
+ })
+ }, 0)
+}
+
+export const setStorageSync: SetStorageSync = function (key: string, data: any) {
+ uni_setStorageSync(key, data, (itemKey: string, itemValue: string) => {
+ StorageTool.getStorage().setItemPersistent(itemKey, value = itemValue, callback = null)
+ }, (itemKey: string) => {
+ StorageTool.getStorage().removeItem(itemKey, callback = null)
+ })
+}
+
+function getItemAsync(itemKey: string): string | null {
+ return StorageTool.getStorage().getItem(itemKey, callback = null)
+}
+
+function includeKey(key: string): boolean {
+ let storage = StorageTool.getStorage()
+ let list = storage.getAllKeys()
+ if (list != null) {
+ let item = list!.find((value): boolean => {
+ if (typeof value == "string") {
+ return (value as string) == key;
+ }
+ return false;
+ })
+ return (item != null);
+ }
+ return false;
+}
+
+export const getStorage: GetStorage = function (options: GetStorageOptions) {
+ setTimeout(() => {
+ uni_getStorageAsync(options, getItemAsync, includeKey)
+ }, 0);
+}
+
+export const getStorageSync: GetStorageSync = function (key: string): any {
+ return uni_getStorageSync(key, getItemAsync)
+}
+
+export const getStorageInfo: GetStorageInfo = function (options: GetStorageInfoOptions) {
+ setTimeout(() => {
+ const storage = StorageTool.getStorage()
+ const allKeys = storage.getAllKeys()
+ const length = storage.length()
+ const limitSize = 1.7976931348623157e+308
+
+ const success: GetStorageInfoSuccess = {
+ keys: allKeys,
+ currentSize: length,
+ limitSize: limitSize
+ }
+ options.success?.(success)
+ options.complete?.(success)
+ }, 0);
+}
+
+export const getStorageInfoSync: GetStorageInfoSync = function () : GetStorageInfoSuccess {
+ const storage = StorageTool.getStorage()
+ const allKeys = storage.getAllKeys()
+ const length = storage.length()
+ const limitSize = 1.7976931348623157e+308
+
+ const success: GetStorageInfoSuccess = {
+ keys: allKeys,
+ currentSize: length,
+ limitSize: limitSize
+ }
+ return success
+}
+
+export const removeStorage: RemoveStorage = function (options: RemoveStorageOptions) {
+ setTimeout(() => {
+ StorageTool.getStorage().removeItem(options.key, callback = null)
+ let success: RemoveStorageSuccess = {
+ }
+ options.success?.(success)
+ options.complete?.(success)
+ }, 0);
+
+}
+
+export const removeStorageSync: RemoveStorageSync = function (key: string) {
+ StorageTool.getStorage().removeItem(key, callback = null)
+}
+
+export const clearStorage: ClearStorage = function (option: ClearStorageOptions | null) {
+ setTimeout(() => {
+ StorageTool.getStorage().clear()
+ let success: ClearStorageSuccess = {
+ }
+ if (option != null) {
+ option!.success?.(success)
+ option!.complete?.(success)
+ }
+ }, 0);
+
+}
+
+export const clearStorageSync: ClearStorageSync = function () {
+ StorageTool.getStorage().clear()
+}
+
diff --git a/uni_modules/uni-storage/utssdk/interface.uts b/uni_modules/uni-storage/utssdk/interface.uts
new file mode 100644
index 0000000000000000000000000000000000000000..e94b9a2d6ee44f5b67299df1af819e4679bf437b
--- /dev/null
+++ b/uni_modules/uni-storage/utssdk/interface.uts
@@ -0,0 +1,491 @@
+/**
+ * uni.setStorage成功回调参数
+ */
+export type SetStorageSuccess = {
+
+}
+
+/**
+ * uni.setStorage成功回调函数定义
+ */
+export type SetStorageSuccessCallback = (res: SetStorageSuccess) => void
+/**
+ * uni.setStorage失败回调函数定义
+ */
+export type SetStorageFailCallback = (res: UniError) => void
+/**
+ * uni.setStorage完成回调函数定义
+ */
+export type SetStorageCompleteCallback = (res: any) => void
+/**
+ * uni.setStorage参数定义
+ */
+export type SetStorageOptions = {
+ /**
+ * 本地存储中的指定的 key
+ */
+ key: string,
+ /**
+ * 需要存储的内容,只支持原生类型、及能够通过 JSON.stringify 序列化的对象
+ */
+ data: any,
+ /**
+ * 接口调用成功的回调函数
+ */
+ success?: SetStorageSuccessCallback | null,
+ /**
+ * 接口调用失败的回调函数
+ */
+ fail?: SetStorageFailCallback | null,
+ /**
+ * 接口调用结束的回调函数(调用成功、失败都会执行)
+ */
+ complete?: SetStorageCompleteCallback | null
+}
+
+export type SetStorage = (options: SetStorageOptions) => void
+
+export type SetStorageSync = (key: string, data: any) => void
+
+
+/**
+ * uni.getStorage成功回调参数
+ */
+export type GetStorageSuccess = {
+ /**
+ * key 对应的内容
+ */
+ data: any | null
+}
+
+/**
+ * uni.getStorage成功回调函数定义
+ */
+export type GetStorageSuccessCallback = (res: GetStorageSuccess) => void
+/**
+ * uni.getStorage失败回调函数定义
+ */
+export type GetStorageFailCallback = (res: UniError) => void
+/**
+ * uni.getStorage完成回调函数定义
+ */
+export type GetStorageCompleteCallback = (res: any) => void
+/**
+ * uni.getStorage参数定义
+ */
+export type GetStorageOptions = {
+ /**
+ * 本地存储中的指定的 key
+ */
+ key: string,
+ /**
+ * 接口调用成功的回调函数
+ */
+ success?: GetStorageSuccessCallback | null,
+ /**
+ * 接口调用失败的回调函数
+ */
+ fail?: GetStorageFailCallback | null,
+ /**
+ * 接口调用结束的回调函数(调用成功、失败都会执行)
+ */
+ complete?: GetStorageCompleteCallback | null
+}
+
+
+export type GetStorage = (options: GetStorageOptions) => void
+
+
+export type GetStorageSync = (key: string) => any | null
+
+
+/**
+ * uni.getStorageInfo成功回调参数
+ */
+export type GetStorageInfoSuccess = {
+ /**
+ * 当前 storage 中所有的 key
+ */
+ keys: Array,
+ /**
+ * 当前占用的空间大小, 单位:kb
+ */
+ currentSize: number,
+ /**
+ * 限制的空间大小, 单位:kb
+ */
+ limitSize: number,
+}
+
+/**
+ * uni.getStorageInfo成功回调函数定义
+ */
+export type GetStorageInfoSuccessCallback = (res: GetStorageInfoSuccess) => void
+/**
+ * uni.getStorageInfo失败回调函数定义
+ */
+export type GetStorageInfoFailCallback = (res: UniError) => void
+/**
+ * uni.getStorageInfo完成回调函数定义
+ */
+export type GetStorageInfoCompleteCallback = (res: any) => void
+/**
+ * uni.getStorageInfo参数定义
+ */
+export type GetStorageInfoOptions = {
+ /**
+ * 接口调用成功的回调函数
+ */
+ success?: GetStorageInfoSuccessCallback | null,
+ /**
+ * 接口调用失败的回调函数
+ */
+ fail?: GetStorageInfoFailCallback | null,
+ /**
+ * 接口调用结束的回调函数(调用成功、失败都会执行)
+ */
+ complete?: GetStorageInfoCompleteCallback | null
+}
+
+
+export type GetStorageInfo = (options: GetStorageInfoOptions) => void
+
+export type GetStorageInfoSync = () => GetStorageInfoSuccess
+
+/**
+ * uni.removeStorage成功回调参数
+ */
+export type RemoveStorageSuccess = {
+}
+
+/**
+ * uni.removeStorage成功回调函数定义
+ */
+export type RemoveStorageSuccessCallback = (res: RemoveStorageSuccess) => void
+/**
+ * uni.removeStorage失败回调函数定义
+ */
+export type RemoveStorageFailCallback = (res: UniError) => void
+/**
+ * uni.removeStorage完成回调函数定义
+ */
+export type RemoveStorageCompleteCallback = (res: any) => void
+/**
+ * uni.removeStorage参数定义
+ */
+export type RemoveStorageOptions = {
+ /**
+ * 本地存储中的指定的 key
+ */
+ key: string,
+ /**
+ * 接口调用的回调函数
+ */
+ success?: RemoveStorageSuccessCallback | null,
+ /**
+ * 接口调用失败的回调函数
+ */
+ fail?: RemoveStorageFailCallback | null,
+ /**
+ * 接口调用结束的回调函数(调用成功、失败都会执行)
+ */
+ complete?: RemoveStorageCompleteCallback | null
+}
+
+
+export type RemoveStorage = (options: RemoveStorageOptions) => void
+
+
+export type RemoveStorageSync = (key: string) => void
+
+/**
+ * uni.clearStorage 成功返回数据结构
+ */
+export type ClearStorageSuccess = {
+
+}
+
+/**
+ * uni.clearStorage 成功回调函数定义
+ */
+export type ClearStorageSuccessCallback = (res: ClearStorageSuccess) => void
+/**
+ * uni.clearStorage 失败回调函数定义
+ */
+export type ClearStorageFailCallback = (res: UniError) => void
+/**
+ * uni.clearStorage 完成回调函数定义
+ */
+export type ClearStorageCompleteCallback = (res: any) => void
+
+/**
+ * uni.removeStorage参数定义
+ */
+export type ClearStorageOptions = {
+ /**
+ * 接口调用的回调函数
+ */
+ success?: ClearStorageSuccessCallback | null,
+ /**
+ * 接口调用失败的回调函数
+ */
+ fail?: ClearStorageFailCallback | null,
+ /**
+ * 接口调用结束的回调函数(调用成功、失败都会执行)
+ */
+ complete?: ClearStorageCompleteCallback | null
+}
+
+export type ClearStorage = (option?: ClearStorageOptions | null) => void
+
+
+export type ClearStorageSync = () => void
+
+export interface Uni {
+ /**
+ * uni.setStorage函数定义
+ * 将数据存储在本地storage存储中指定的 key 中,会覆盖掉原来该 key 对应的内容,这是一个异步接口。
+ *
+ * @param {SetStorageOptions} options
+ * @tutorial https://uniapp.dcloud.net.cn/api/storage/storage.html#setstorage
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "4.4.4",
+ * "uniVer": "2.0.3",
+ * "unixVer": "3.9.0"
+ * },
+ * "ios": {
+ * "osVer": "9.0",
+ * "uniVer": "2.0.3",
+ * "unixVer": "x"
+ * }
+ * }
+ * }
+ * @uniVersion 2.0.3
+ * @uniVueVersion 2,3 //支持的vue版本
+ */
+ setStorage(options: SetStorageOptions) : void,
+ /**
+ * uni.setStorageSync函数定义
+ * 将 data 存储在本地storage存储中指定的 key 中,会覆盖掉原来该 key 对应的内容,这是一个同步接口。
+ *
+ * @param {string} key 本地storage存储中的指定的 key
+ * @param {any} data 需要存储的内容,只支持原生类型、及能够通过 JSON.stringify 序列化的对象
+ * @tutorial https://uniapp.dcloud.net.cn/api/storage/storage.html#setstoragesync
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "4.4.4",
+ * "uniVer": "2.0.3",
+ * "unixVer": "3.9.0"
+ * },
+ * "ios": {
+ * "osVer": "9.0",
+ * "uniVer": "2.0.3",
+ * "unixVer": "x"
+ * }
+ * }
+ * }
+ * @uniVersion 2.0.3
+ * @uniVueVersion 2,3 //支持的vue版本
+ */
+ setStorageSync(key: string, data: any) : void,
+ /**
+ * uni.getStorage函数定义
+ * 从本地存储中异步获取指定 key 对应的内容。
+ *
+ * @param {GetStorageOptions} options
+ * @tutorial https://uniapp.dcloud.net.cn/api/storage/storage.html#getstorage
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "4.4.4",
+ * "uniVer": "2.0.3",
+ * "unixVer": "x"
+ * },
+ * "ios": {
+ * "osVer": "9.0",
+ * "uniVer": "2.0.3",
+ * "unixVer": "x"
+ * }
+ * }
+ * }
+ * @uniVersion 2.0.3
+ * @uniVueVersion 2,3 //支持的vue版本
+ */
+ getStorage(options: GetStorageOptions) : void,
+ /**
+ * uni.getStorageSync函数定义
+ * 从本地存储中同步获取指定 key 对应的内容。
+ *
+ * @param {string} key 本地存储中的指定的 key
+ * @tutorial https://uniapp.dcloud.net.cn/api/storage/storage.html#getstoragesync
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "4.4.4",
+ * "uniVer": "2.0.3",
+ * "unixVer": "3.9.0"
+ * },
+ * "ios": {
+ * "osVer": "9.0",
+ * "uniVer": "2.0.3",
+ * "unixVer": "x"
+ * }
+ * }
+ * }
+ * @uniVersion 2.0.3
+ * @uniVueVersion 2,3 //支持的vue版本
+ */
+ getStorageSync(key: string) : any | null,
+ /**
+ * uni.getStorageInfo函数定义
+ * 异步获取当前 storage 的相关信息。
+ *
+ * @param {GetStorageInfoOptions} options
+ * @tutorial https://uniapp.dcloud.net.cn/api/storage/storage.html#getstorageinfo
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "4.4.4",
+ * "uniVer": "2.0.3",
+ * "unixVer": "3.9.0"
+ * },
+ * "ios": {
+ * "osVer": "9.0",
+ * "uniVer": "2.0.3",
+ * "unixVer": "x"
+ * }
+ * }
+ * }
+ * @uniVersion 2.0.3
+ * @uniVueVersion 2,3 //支持的vue版本
+ */
+ getStorageInfo(options: GetStorageInfoOptions) : void,
+ /**
+ * uni.getStorageInfoSync函数定义
+ * 同步获取当前 storage 的相关信息。
+ *
+ *
+ * @tutorial https://uniapp.dcloud.net.cn/api/storage/storage.html#getstorageinfosync
+ *
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "4.4.4",
+ * "uniVer": "2.0.3",
+ * "unixVer": "3.9.0"
+ * },
+ * "ios": {
+ * "osVer": "9.0",
+ * "uniVer": "2.0.3",
+ * "unixVer": "x"
+ * }
+ * }
+ * }
+ * @uniVersion 2.0.3
+ * @uniVueVersion 2,3 //支持的vue版本
+ */
+ getStorageInfoSync() : GetStorageInfoSuccess,
+ /**
+ * uni.removeStorage函数定义
+ * 从本地存储中异步移除指定 key。
+ *
+ * @param {RemoveStorageOptions} options
+ *
+ * @tutorial hhttps://uniapp.dcloud.net.cn/api/storage/storage.html#removestorage
+ *
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "4.4.4",
+ * "uniVer": "2.0.3",
+ * "unixVer": "3.9.0"
+ * },
+ * "ios": {
+ * "osVer": "9.0",
+ * "uniVer": "2.0.3",
+ * "unixVer": "x"
+ * }
+ * }
+ * }
+ * @uniVersion 2.0.3
+ * @uniVueVersion 2,3 //支持的vue版本
+ */
+ removeStorage(options: RemoveStorageOptions) : void,
+ /**
+ * uni.removeStorageSync函数定义
+ * 从本地存储中同步移除指定 key。
+ *
+ * @param {string} key 本地存储中的指定的 key
+ *
+ * @tutorial https://uniapp.dcloud.net.cn/api/storage/storage.html#removestoragesync
+ *
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "4.4.4",
+ * "uniVer": "2.0.3",
+ * "unixVer": "3.9.0"
+ * },
+ * "ios": {
+ * "osVer": "9.0",
+ * "uniVer": "2.0.3",
+ * "unixVer": "x"
+ * }
+ * }
+ * }
+ * @uniVersion 2.0.3
+ * @uniVueVersion 2,3 //支持的vue版本
+ */
+ removeStorageSync(key: string) : void,
+ /**
+ * uni.clearStorage函数定义
+ * 清除本地数据存储。
+ *
+ * @tutorial https://uniapp.dcloud.net.cn/api/storage/storage.html#clearstorage
+ *
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "4.4.4",
+ * "uniVer": "2.0.3",
+ * "unixVer": "3.9.0"
+ * },
+ * "ios": {
+ * "osVer": "9.0",
+ * "uniVer": "2.0.3",
+ * "unixVer": "x"
+ * }
+ * }
+ * }
+ * @uniVersion 2.0.3
+ * @uniVueVersion 2,3 //支持的vue版本
+ */
+ clearStorage(option?: ClearStorageOptions | null) : void,
+ /**
+ * uni.clearStorageSync函数定义
+ * 清除本地数据存储。
+ *
+ * @tutorial https://uniapp.dcloud.net.cn/api/storage/storage.html#clearstoragesync
+ *
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "4.4.4",
+ * "uniVer": "2.0.3",
+ * "unixVer": "3.9.0"
+ * },
+ * "ios": {
+ * "osVer": "9.0",
+ * "uniVer": "2.0.3",
+ * "unixVer": "x"
+ * }
+ * }
+ * }
+ * @uniVersion 2.0.3
+ * @uniVueVersion 2,3 //支持的vue版本
+ */
+ clearStorageSync() : void
+}
diff --git a/uni_modules/uni-storage/utssdk/uniStorageTool.uts b/uni_modules/uni-storage/utssdk/uniStorageTool.uts
new file mode 100644
index 0000000000000000000000000000000000000000..11b054e059672db2ab708b8978fa54ac9ead17a4
--- /dev/null
+++ b/uni_modules/uni-storage/utssdk/uniStorageTool.uts
@@ -0,0 +1,197 @@
+import { SetStorageOptions, SetStorageSuccess, GetStorageOptions, GetStorageSuccess } from "./interface.uts"
+
+
+const STORAGE_DATA_TYPE = '__TYPE'
+const STORAGE_KEYS = 'uni-storage-keys'
+
+/**
+ * add since 2023-09-04 过滤原生数据类型对齐 web typeOf 用于兼容旧数据
+ */
+function filterNativeType(src:string):string{
+ if(src == "Double" || src == "Float" || src == "Long" || src == "Int" || src == "Short" || src == "Byte" || src == "UByte" || src == "UShort" || src == "UInt" || src == "ULong"){
+ return "number"
+ }
+
+ return src
+}
+
+
+function parseValue(value: any): any | null {
+ const types = ['object', 'string', 'number', 'boolean', 'undefined']
+ const object = typeof value == 'string' ? JSON.parse(value as string) : value
+ if (object == null) {
+ return null
+ } else {
+ const type = typeof object
+ if (types.indexOf(type) >= 0) {
+ // @ts-expect-error
+ if (object instanceof UTSJSONObject || object instanceof Map) {
+ // @ts-expect-error
+ const map = (object instanceof UTSJSONObject) ? (object as UTSJSONObject).toMap() : (object as Map)
+ if (map.size == 2 && map.has('data') && map.has('type')) {
+ let dataType:string = ""
+ if(map.get("type") == null){
+ dataType = ""
+ }else{
+ dataType = map.get("type") as string
+ }
+ if (filterNativeType(typeof map.get('data')) == dataType && dataType != 'string') {
+ return map.get('data')
+ }else if (typeof map.get('data') == dataType && dataType == 'string') {
+ const regex = /^\d{4}-\d{2}-\d{2}T\d{2}\:\d{2}\:\d{2}\.\d{3}Z$/
+ // @ts-expect-error
+ if (type == 'object' && regex.test(map.get('data') as string)) {
+ let dateStr = map.get('data') as string
+ return new Date(dateStr)
+ }
+ return map.get('data')
+ }
+ } else if (map.size >= 1){
+ return ''
+ }
+ }
+ }
+ return null
+ }
+}
+
+function praseGetStorage(type: string, value: string): any | null {
+ let data: any | null = value
+ if (type != 'string' || (type == "string" && value == '{"type":"undefined"}')) {
+ // 兼容H5和V3初期历史格式
+ let object = JSON.parse(value)
+
+ if (object == null) {
+ return data
+ }
+
+ const result = parseValue(object)
+ if (result != null) {
+ data = result
+ } else if (type != null){
+ // 兼容App端历史格式
+ data = object
+ if (typeof object == 'string') {
+ object = JSON.parse(object as string)
+ const objectType = typeof object
+ if (objectType == 'number' && type == 'date') {
+ let dateNum = object as number
+ data = new Date(dateNum)
+ } else if (objectType == (['null', 'array'].indexOf(type) < 0 ? type : 'object')) {
+ data = object
+ }
+ }
+ }
+ }
+ return data
+}
+
+function uni_setStorageSync(key: string, data: any, saveItemHandler: (key: string, data: string) => void, removeItemHandler: (key: string) => void) {
+ let type = filterNativeType(typeof data)
+ let value: string | null = null
+ value = (type == 'string') ? (data as string) : JSON.stringify({type: type, data: data})
+ if (type == 'string' && parseValue(data) != null) {
+ saveItemHandler(key + STORAGE_DATA_TYPE, type)
+ } else{
+ removeItemHandler(key + STORAGE_DATA_TYPE)
+ }
+
+ if(value == null){
+ value = ""
+ }
+
+ saveItemHandler(key, value!)
+}
+
+function uni_setStorageAsync(options: SetStorageOptions, saveItemAsyncHandler: (key: string, data: string) => void, removeItemAsyncHandler: (key: string) => void) {
+ const type = filterNativeType(typeof options.data)
+ let value: string | null = null
+ value = (type == 'string') ? (options.data as string) : JSON.stringify({type: type, data: options.data})
+ if (value == null) {
+ let fail = new UniError("uni-storage", -1, "data can not be stringify")
+ options.fail?.(fail)
+ options.complete?.(fail)
+ } else{
+ if (type == 'string' && parseValue(options.data) != null) {
+ saveItemAsyncHandler(options.key + STORAGE_DATA_TYPE, type)
+ } else{
+ removeItemAsyncHandler(options.key + STORAGE_DATA_TYPE)
+ }
+ if(value == null){
+ value = ""
+ }
+ saveItemAsyncHandler(options.key, value!)
+ let success: SetStorageSuccess = {
+ }
+ options.success?.(success)
+ options.complete?.(success)
+ }
+
+}
+
+function uni_getStorageSync(key: string, getItemHandler: ((key: string) => string | null)): any | null {
+ let value = getItemHandler(key)
+ let typeOrigin = getItemHandler(key + STORAGE_DATA_TYPE)
+ if(typeOrigin == null){
+ typeOrigin = ""
+ }
+
+ const type = typeOrigin!.toLowerCase()
+ if (typeof value != "string") {
+ return ''
+ }
+ if(value == null){
+ value = ""
+ }
+ return praseGetStorage(type, value!)
+}
+
+function uni_getStorageAsync(options: GetStorageOptions, getItemAsyncHandler: ((key: string) => string | null), includesKey: (key: string) => boolean) {
+ let ret = includesKey(options.key);
+ if (!ret) {
+ let fail = new UniError("uni-storage", -2, "getStorage:fail data not found")
+ options.fail?.(fail);
+ options.complete?.(fail);
+ return;
+ }
+ let value = getItemAsyncHandler(options.key)
+ if(value == null){
+ value = ""
+ }
+ let typeOrigin = getItemAsyncHandler(options.key + STORAGE_DATA_TYPE)
+ if(typeOrigin == null){
+ typeOrigin = ""
+ }
+ const type = typeOrigin!.toLowerCase()
+
+ if (typeof value != "string") {
+ let success: GetStorageSuccess = {
+ data: ""
+ }
+ options.success?.(success)
+ options.complete?.(success)
+ }else {
+ const data = praseGetStorage(type, value!)
+ let success: GetStorageSuccess = {
+ data: data
+ }
+ options.success?.(success)
+ options.complete?.(success)
+ }
+}
+
+export {
+ STORAGE_DATA_TYPE,
+ STORAGE_KEYS,
+ uni_setStorageSync,
+ uni_setStorageAsync,
+ uni_getStorageSync,
+ uni_getStorageAsync,
+}
+
+
+
+
+
+
+
diff --git a/uni_modules/uni-usercapturescreen/index.d.ts b/uni_modules/uni-usercapturescreen/index.d.ts
index debf1a1d781a14f5ef58dec089a42786b7ad837a..dbb3f929122ab33841008ec9774259e70987cdb0 100644
--- a/uni_modules/uni-usercapturescreen/index.d.ts
+++ b/uni_modules/uni-usercapturescreen/index.d.ts
@@ -1,18 +1,157 @@
declare namespace UniNamespace {
- type OnUserCaptureScreenCallback = (res?: { errMsg: string }) => void
+ /**
+ * uni.onUserCaptureScreen/uni.offUserCaptureScreen回调参数
+ */
+ type OnUserCaptureScreenCallbackResult = {
+ /**
+ * 截屏文件路径(仅Android返回)
+ */
+ path ?: string
+ }
+
+ /**
+ * uni.onUserCaptureScreen/uni.offUserCaptureScreen回调函数定义
+ */
+ type UserCaptureScreenCallback = (res : OnUserCaptureScreenCallbackResult) => void
+
+ type OnUserCaptureScreen = (callback : UserCaptureScreenCallback | null) => void
+
+ type OffUserCaptureScreen = (callback : UserCaptureScreenCallback | null) => void
+
+ /**
+ * uni.setUserCaptureScreen成功回调参数
+ */
+ type SetUserCaptureScreenSuccess = {
+
+ }
+
+ /**
+ * uni.setUserCaptureScreen成功回调函数定义
+ */
+ type SetUserCaptureScreenSuccessCallback = (res : SetUserCaptureScreenSuccess) => void
+
+ /**
+ * 错误码
+ * - 12001 "setUserCaptureScreen:system not support"
+ * - 12010 "setUserCaptureScreen:system internal error"
+ */
+ type SetUserCaptureScreenErrorCode = 12001 | 12010;
+
+ /**
+ * SetUserCaptureScreen 的错误回调参数
+ */
+ interface SetUserCaptureScreenFail {
+ errCode : SetUserCaptureScreenErrorCode
+ }
+
+ /**
+ * uni.setUserCaptureScreen失败回调函数定义
+ */
+ type SetUserCaptureScreenFailCallback = (res : SetUserCaptureScreenFail) => void
+
+ /**
+ * uni.setUserCaptureScreen完成回调函数定义
+ */
+ type SetUserCaptureScreenCompleteCallback = (res : any) => void
+
+ /**
+ * uni.setUserCaptureScreen参数
+ */
+ type SetUserCaptureScreenOptions = {
+ /**
+ * true: 允许用户截屏 false: 不允许用户截屏,防止用户截屏到应用页面内容
+ */
+ enable : boolean;
+ /**
+ * 接口调用成功的回调函数
+ */
+ // success : SetUserCaptureScreenSuccessCallback | null,
+ success ?: SetUserCaptureScreenSuccessCallback,
+ /**
+ * 接口调用失败的回调函数
+ */
+ // fail : SetUserCaptureScreenFailCallback | null,
+ fail ?: SetUserCaptureScreenFailCallback,
+ /**
+ * 接口调用结束的回调函数(调用成功、失败都会执行)
+ */
+ // complete : SetUserCaptureScreenSuccessCallback | SetUserCaptureScreenFailCallback | null
+ complete ?: SetUserCaptureScreenCompleteCallback
+ }
+
+ type SetUserCaptureScreen = (options : SetUserCaptureScreenOptions) => void
}
declare interface Uni {
/**
- * 监听用户主动截屏事件,用户使用系统截屏按键截屏时触发此事件。
+ * 开启截屏监听
+ *
+ * @param {UserCaptureScreenCallback} callback
+ * @tutorial https://uniapp.dcloud.net.cn/api/system/capture-screen.html#onusercapturescreen
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "4.4.4",
+ * "uniVer": "3.7.7",
+ * "unixVer": "3.9.0"
+ * },
+ * "ios": {
+ * "osVer": "9.0",
+ * "uniVer": "3.7.7",
+ * "unixVer": "x"
+ * }
+ * }
+ * }
+ * @uniVersion 3.7.7
+ * @uniVueVersion 2,3 //支持的vue版本
+ * @autotest { expectCallback: true }
+ */
+ onUserCaptureScreen(callback : UniNamespace.UserCaptureScreenCallback | null) : void,
+ /**
+ * 关闭截屏监听
*
- * 文档: [https://uniapp.dcloud.net.cn/api/system/capture-screen.html#onusercapturescreen](https://uniapp.dcloud.net.cn/api/system/capture-screen.html#onusercapturescreen)
+ * @param {UserCaptureScreenCallback} callback
+ * @tutorial https://uniapp.dcloud.net.cn/api/system/capture-screen.html#offusercapturescreen
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "4.4.4",
+ * "uniVer": "3.7.7",
+ * "unixVer": "3.9.0"
+ * },
+ * "ios": {
+ * "osVer": "9.0",
+ * "uniVer": "3.7.7",
+ * "unixVer": "x"
+ * }
+ * }
+ * }
+ * @uniVersion 3.7.7
+ * @uniVueVersion 2,3 //支持的vue版本
+ * @autotest { expectCallback: true }
*/
- onUserCaptureScreen(callback: UniNamespace.OnUserCaptureScreenCallback): void;
+ offUserCaptureScreen(callback : UniNamespace.UserCaptureScreenCallback | null) : void,
/**
- * 用户主动截屏事件。取消事件监听。
+ * 设置防截屏
*
- * 文档: [https://uniapp.dcloud.net.cn/api/system/capture-screen.html#offusercapturescreen](https://uniapp.dcloud.net.cn/api/system/capture-screen.html#offusercapturescreen)
+ * @param {SetUserCaptureScreenOptions} options
+ * @tutorial https://uniapp.dcloud.net.cn/api/system/capture-screen.html#setusercapturescreen
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "4.4.4",
+ * "uniVer": "3.7.7",
+ * "unixVer": "3.9.0"
+ * },
+ * "ios": {
+ * "osVer": "13.0",
+ * "uniVer": "3.7.7",
+ * "unixVer": "x"
+ * }
+ * }
+ * }
+ * @uniVersion 3.7.7
+ * @uniVueVersion 2,3 //支持的vue版本
*/
- offUserCaptureScreen(callback: UniNamespace.OnUserCaptureScreenCallback): void;
+ setUserCaptureScreen(options : UniNamespace.SetUserCaptureScreenOptions) : void
}
diff --git a/uni_modules/uni-usercapturescreen/package.json b/uni_modules/uni-usercapturescreen/package.json
index f1e4ca2eaedcc64ede2d0c88fc5449574a426877..c55c0f8c8fa27f63b93a7d4cc1e19c67ae22795a 100644
--- a/uni_modules/uni-usercapturescreen/package.json
+++ b/uni_modules/uni-usercapturescreen/package.json
@@ -33,9 +33,16 @@
"uni_modules": {
"uni-ext-api":{
"uni": {
- "onUserCaptureScreen": "onUserCaptureScreen",
- "offUserCaptureScreen": "offUserCaptureScreen",
- "setUserCaptureScreen": "setUserCaptureScreen"
+ "onUserCaptureScreen": {
+ "web": false
+ },
+ "offUserCaptureScreen": {
+ "web": false
+ },
+ "setUserCaptureScreen": {
+ "web": false,
+ "mp-weixin": false
+ }
}
},
"dependencies": [],
@@ -47,7 +54,7 @@
},
"client": {
"Vue": {
- "vue2": "n",
+ "vue2": "y",
"vue3": "y"
},
"App": {
diff --git a/uni_modules/uni-usercapturescreen/utssdk/app-android/index.uts b/uni_modules/uni-usercapturescreen/utssdk/app-android/index.uts
index 99cf531e58733d6ae0c68ace8dc08e7c0d99b530..c5c1bd484d3c61dccd778f6bf0c8bad9fe06c46a 100644
--- a/uni_modules/uni-usercapturescreen/utssdk/app-android/index.uts
+++ b/uni_modules/uni-usercapturescreen/utssdk/app-android/index.uts
@@ -9,6 +9,7 @@ import Environment from "android.os.Environment";
import System from 'java.lang.System';
import WindowManager from 'android.view.WindowManager';
import { OnUserCaptureScreenCallbackResult, UserCaptureScreenCallback, OnUserCaptureScreen, OffUserCaptureScreen, SetUserCaptureScreenSuccess, SetUserCaptureScreenOptions, SetUserCaptureScreen } from "../interface.uts";
+import string from 'android.R.string';
/**
@@ -34,9 +35,9 @@ class ScreenFileObserver extends FileObserver {
*/
private screenFile : File;
- constructor(screenFile : File) {
- super(screenFile);
- this.screenFile = screenFile;
+ constructor(screenFileStr : string) {
+ super(screenFileStr);
+ this.screenFile = new File(screenFileStr);
}
override onEvent(event : Int, path : string | null) : void {
@@ -83,7 +84,7 @@ export const onUserCaptureScreen : OnUserCaptureScreen = function (callback : Us
}
// 先结束监听 再开启监听
observer?.stopWatching();
- observer = new ScreenFileObserver(directory_screenshot);
+ observer = new ScreenFileObserver(directory_screenshot.getPath());
observer?.startWatching();
@@ -92,7 +93,6 @@ export const onUserCaptureScreen : OnUserCaptureScreen = function (callback : Us
observer = null
})
-
}
/**
diff --git a/uni_modules/uni-usercapturescreen/utssdk/app-ios/index.uts b/uni_modules/uni-usercapturescreen/utssdk/app-ios/index.uts
index 544fb212e6caecc98a1d9a7ac34481234fe49fa2..5f6273f7bd38e71dded65285d63f401863486982 100644
--- a/uni_modules/uni-usercapturescreen/utssdk/app-ios/index.uts
+++ b/uni_modules/uni-usercapturescreen/utssdk/app-ios/index.uts
@@ -3,8 +3,8 @@ import { CGRect } from "CoreFoundation";
import { UIApplication, UIView, UITextField, UIScreen, UIDevice } from "UIKit"
import { UTSiOS } from "DCloudUTSFoundation"
import { DispatchQueue } from 'Dispatch';
-import { SetUserCaptureScreenOptions, OnUserCaptureScreenCallbackResult, OnUserCaptureScreen, OffUserCaptureScreen, SetUserCaptureScreen, UserCaptureScreenCallback, SetUserCaptureScreenSuccess, SetUserCaptureScreenFail } from "../interface.uts"
-
+import { SetUserCaptureScreenOptions, OnUserCaptureScreenCallbackResult, OnUserCaptureScreen, OffUserCaptureScreen, SetUserCaptureScreen, UserCaptureScreenCallback, SetUserCaptureScreenSuccess } from "../interface.uts"
+import { SetUserCaptureScreenFailImpl } from "../unierror.uts"
/**
* 定义监听截屏事件工具类
*/
@@ -119,20 +119,12 @@ export const offUserCaptureScreen : OffUserCaptureScreen = function (callback :
*/
export const setUserCaptureScreen : SetUserCaptureScreen = function (options : SetUserCaptureScreenOptions) {
if (UIDevice.current.systemVersion < "13.0") {
- let res: SetUserCaptureScreenFail = {
- errCode: 12001,
- errSubject: "uni-usercapturescreen",
- errMsg: "setUserCaptureScreen:system not support"
- }
+ let res = new SetUserCaptureScreenFailImpl(12001)
options.fail?.(res);
options.complete?.(res);
} else if (UIDevice.current.systemVersion == "15.1") {
- let res: SetUserCaptureScreenFail = {
- errCode: 12010,
- errSubject: "uni-usercapturescreen",
- errMsg: "setUserCaptureScreen:system internal error"
- }
+ let res = new SetUserCaptureScreenFailImpl(12010)
options.fail?.(res);
options.complete?.(res);
} else {
diff --git a/uni_modules/uni-usercapturescreen/utssdk/interface.uts b/uni_modules/uni-usercapturescreen/utssdk/interface.uts
index 235b78209fb8cd67a64953edead91b355eab4ce1..5339338b3aa31e22edf9ced46579b95ee0ae9462 100644
--- a/uni_modules/uni-usercapturescreen/utssdk/interface.uts
+++ b/uni_modules/uni-usercapturescreen/utssdk/interface.uts
@@ -13,26 +13,8 @@ export type OnUserCaptureScreenCallbackResult = {
*/
export type UserCaptureScreenCallback = (res : OnUserCaptureScreenCallbackResult) => void
-/**
- * uni.onUserCaptureScreen函数定义
- * 开启截屏监听
- *
- * @param {UserCaptureScreenCallback} callback
- * @tutorial https://uniapp.dcloud.net.cn/api/system/capture-screen.html#onusercapturescreen
- * @platforms APP-IOS = ^9.0,APP-ANDROID = ^4.4
- * @since 3.7.7
- */
export type OnUserCaptureScreen = (callback : UserCaptureScreenCallback | null) => void
-/**
- * uni.offUserCaptureScreen函数定义
- * 关闭截屏监听
- *
- * @param {UserCaptureScreenCallback} callback
- * @tutorial https://uniapp.dcloud.net.cn/api/system/capture-screen.html#offusercapturescreen
- * @platforms APP-IOS = ^9.0,APP-ANDROID = ^4.4
- * @since 3.7.7
- */
export type OffUserCaptureScreen = (callback : UserCaptureScreenCallback | null) => void
/**
@@ -41,25 +23,6 @@ export type OffUserCaptureScreen = (callback : UserCaptureScreenCallback | null)
export type SetUserCaptureScreenSuccess = {
}
-/**
- * uni.setUserCaptureScreen失败回调参数
- */
-export type SetUserCaptureScreenFail = {
- /**
- * 错误码
- * 12001:system not support
- * 12010:system internal error
- */
- errCode : number,
- /**
- * 调用API的名称
- */
- errSubject : string,
- /**
- * 错误的详细信息
- */
- errMsg : string,
-}
/**
* uni.setUserCaptureScreen成功回调函数定义
@@ -69,7 +32,7 @@ export type SetUserCaptureScreenSuccessCallback = (res : SetUserCaptureScreenSuc
/**
* uni.setUserCaptureScreen失败回调函数定义
*/
-export type SetUserCaptureScreenFailCallback = (res : SetUserCaptureScreenFail) => void
+export type SetUserCaptureScreenFailCallback = (res : UniError) => void
/**
* uni.setUserCaptureScreen完成回调函数定义
@@ -100,23 +63,93 @@ export type SetUserCaptureScreenOptions = {
*/
// complete : SetUserCaptureScreenSuccessCallback | SetUserCaptureScreenFailCallback | null
complete ?: SetUserCaptureScreenCompleteCallback
-}
-
-
-/**
- * * uni.setUserCaptureScreen函数定义
+}
+
+/**
+ * 错误码
+ * - 12001 "setUserCaptureScreen:system not support"
+ * - 12010 "setUserCaptureScreen:system internal error"
+ */
+export type SetUserCaptureScreenErrorCode = 12001 | 12010;
+/**
+ * SetUserCaptureScreen 的错误回调参数
+ */
+export interface SetUserCaptureScreenFail extends IUniError {
+ errCode : SetUserCaptureScreenErrorCode
+};
- * 设置防截屏
- *
- * @param {SetUserCaptureScreenOptions} options
- * @tutorial https://uniapp.dcloud.net.cn/api/system/capture-screen.html#setusercapturescreen
- * @platforms APP-IOS = ^13.0,APP-ANDROID = ^4.4
- * @since 3.7.7
- */
export type SetUserCaptureScreen = (options : SetUserCaptureScreenOptions) => void
-export interface Uni {
- onUserCaptureScreen : OnUserCaptureScreen,
- offUserCaptureScreen : OffUserCaptureScreen,
- setUserCaptureScreen : SetUserCaptureScreen
+export interface Uni {
+ /**
+ * 开启截屏监听
+ *
+ * @param {UserCaptureScreenCallback} callback
+ * @tutorial https://uniapp.dcloud.net.cn/api/system/capture-screen.html#onusercapturescreen
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "4.4.4",
+ * "uniVer": "3.7.7",
+ * "unixVer": "3.9.0"
+ * },
+ * "ios": {
+ * "osVer": "9.0",
+ * "uniVer": "3.7.7",
+ * "unixVer": "3.9.0"
+ * }
+ * }
+ * }
+ * @uniVersion 3.7.7
+ * @uniVueVersion 2,3 //支持的vue版本
+ * @autotest { expectCallback: true }
+ */
+ onUserCaptureScreen(callback : UserCaptureScreenCallback | null) : void,
+ /**
+ * 关闭截屏监听
+ *
+ * @param {UserCaptureScreenCallback} callback
+ * @tutorial https://uniapp.dcloud.net.cn/api/system/capture-screen.html#offusercapturescreen
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "4.4.4",
+ * "uniVer": "3.7.7",
+ * "unixVer": "3.9.0"
+ * },
+ * "ios": {
+ * "osVer": "9.0",
+ * "uniVer": "3.7.7",
+ * "unixVer": "3.9.0"
+ * }
+ * }
+ * }
+ * @uniVersion 3.7.7
+ * @uniVueVersion 2,3 //支持的vue版本
+ * @autotest { expectCallback: true }
+ */
+ offUserCaptureScreen(callback : UserCaptureScreenCallback | null) : void,
+ /**
+ * 设置防截屏
+ *
+ * @param {SetUserCaptureScreenOptions} options
+ * @tutorial https://uniapp.dcloud.net.cn/api/system/capture-screen.html#setusercapturescreen
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "4.4.4",
+ * "uniVer": "3.7.7",
+ * "unixVer": "3.9.0"
+ * },
+ * "ios": {
+ * "osVer": "13.0",
+ * "uniVer": "3.7.7",
+ * "unixVer": "3.9.0"
+ * }
+ * }
+ * }
+ * @uniVersion 3.7.7
+ * @uniVueVersion 2,3 //支持的vue版本
+ */
+ setUserCaptureScreen(options : SetUserCaptureScreenOptions) : void
}
\ No newline at end of file
diff --git a/uni_modules/uni-usercapturescreen/utssdk/unierror.uts b/uni_modules/uni-usercapturescreen/utssdk/unierror.uts
new file mode 100644
index 0000000000000000000000000000000000000000..817cb79cb20c36ec3fbcd2012175e2655abfaf5d
--- /dev/null
+++ b/uni_modules/uni-usercapturescreen/utssdk/unierror.uts
@@ -0,0 +1,35 @@
+import { SetUserCaptureScreenErrorCode, SetUserCaptureScreenFail } from "./interface.uts"
+/**
+ * 错误主题
+ */
+export const UniErrorSubject = 'uni-usercapturescreen';
+
+
+/**
+ * 错误信息
+ * @UniError
+ */
+export const UniErrors : Map = new Map([
+ /**
+ * 错误码及对应的错误信息
+ */
+ [12001, 'setUserCaptureScreen:system not support'],
+ [12010, 'setUserCaptureScreen:system internal error'],
+]);
+
+
+/**
+ * 错误对象实现
+ */
+export class SetUserCaptureScreenFailImpl extends UniError implements SetUserCaptureScreenFail {
+
+ /**
+ * 错误对象构造函数
+ */
+ constructor(errCode : SetUserCaptureScreenErrorCode) {
+ super();
+ this.errSubject = UniErrorSubject;
+ this.errCode = errCode;
+ this.errMsg = UniErrors[errCode] ?? "";
+ }
+}
\ No newline at end of file
diff --git a/uni_modules/uni-websocket/changelog.md b/uni_modules/uni-websocket/changelog.md
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/uni_modules/uni-websocket/package.json b/uni_modules/uni-websocket/package.json
new file mode 100644
index 0000000000000000000000000000000000000000..0462385377c32c9092a0a65347d2debcc65e7cd3
--- /dev/null
+++ b/uni_modules/uni-websocket/package.json
@@ -0,0 +1,141 @@
+{
+ "id": "uni-websocket",
+ "displayName": "uni-websocket",
+ "version": "1.0.0",
+ "description": "uni-websocket",
+ "keywords": [
+ "uni-websocket"
+ ],
+ "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": {
+ "connectSocket": {
+ "name": "connectSocket",
+ "app": {
+ "js": false,
+ "kotlin": true,
+ "swift": false
+ }
+ },
+ "sendSocketMessage": {
+ "name": "sendSocketMessage",
+ "app": {
+ "js": false,
+ "kotlin": true,
+ "swift": false
+ }
+ },
+ "closeSocket": {
+ "name": "closeSocket",
+ "app": {
+ "js": false,
+ "kotlin": true,
+ "swift": false
+ }
+ },
+ "onSocketOpen": {
+ "name": "onSocketOpen",
+ "app": {
+ "js": false,
+ "kotlin": true,
+ "swift": false
+ }
+ },
+ "onSocketMessage": {
+ "name": "onSocketMessage",
+ "app": {
+ "js": false,
+ "kotlin": true,
+ "swift": false
+ }
+ },
+ "onSocketClose": {
+ "name": "onSocketClose",
+ "app": {
+ "js": false,
+ "kotlin": true,
+ "swift": false
+ }
+ },
+ "onSocketError": {
+ "name": "onSocketError",
+ "app": {
+ "js": false,
+ "kotlin": true,
+ "swift": false
+ }
+ }
+ }
+ },
+ "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"
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/uni_modules/uni-websocket/readme.md b/uni_modules/uni-websocket/readme.md
new file mode 100644
index 0000000000000000000000000000000000000000..7ea24816f2024904b21ec347d3847272958b7bd7
--- /dev/null
+++ b/uni_modules/uni-websocket/readme.md
@@ -0,0 +1,6 @@
+# uni-websocket
+### 开发文档
+[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)
\ No newline at end of file
diff --git a/uni_modules/uni-websocket/utssdk/app-android/config.json b/uni_modules/uni-websocket/utssdk/app-android/config.json
new file mode 100644
index 0000000000000000000000000000000000000000..fcfc9c4a8d0fcd5e82bf401d8892c0089879a5ee
--- /dev/null
+++ b/uni_modules/uni-websocket/utssdk/app-android/config.json
@@ -0,0 +1,6 @@
+{
+ "dependencies": [
+ "com.squareup.okhttp3:okhttp:3.12.12"
+ ],
+ "minSdkVersion": "19"
+}
diff --git a/uni_modules/uni-websocket/utssdk/app-android/index.uts b/uni_modules/uni-websocket/utssdk/app-android/index.uts
new file mode 100644
index 0000000000000000000000000000000000000000..82c2a9450a449aadf253d4b22b79e8da8077524f
--- /dev/null
+++ b/uni_modules/uni-websocket/utssdk/app-android/index.uts
@@ -0,0 +1,31 @@
+import { ConnectSocket, ConnectSocketOptions, SocketTask, SendSocketMessage, SendSocketMessageOptions, CloseSocket, CloseSocketOptions, OnSocketOpen, OnSocketOpenCallback, OnSocketError, OnSocketErrorCallback, OnSocketMessage, OnSocketMessageCallback, OnSocketClose, OnSocketCloseCallback } from "../interface";
+import { WebSocketManager } from "./websocket/WebSocketManager"
+
+
+export const connectSocket : ConnectSocket = (options : ConnectSocketOptions) : SocketTask => {
+ return WebSocketManager.getInstance().connectSocket(options);
+}
+
+export const sendSocketMessage : SendSocketMessage = (options : SendSocketMessageOptions) : void => {
+ return WebSocketManager.getInstance().sendSocketMessage(options);
+}
+
+export const closeSocket : CloseSocket = (options : CloseSocketOptions) : void => {
+ return WebSocketManager.getInstance().closeSocket(options);
+}
+
+export const onSocketOpen : OnSocketOpen = (callback : OnSocketOpenCallback) : void => {
+ return WebSocketManager.getInstance().onSocketOpen(callback);
+}
+
+export const onSocketMessage : OnSocketMessage = (callback : OnSocketMessageCallback) : void => {
+ return WebSocketManager.getInstance().onSocketMessage(callback);
+}
+
+export const onSocketClose : OnSocketClose = (callback : OnSocketCloseCallback) : void => {
+ return WebSocketManager.getInstance().onSocketClose(callback);
+}
+
+export const onSocketError : OnSocketError = (callback : OnSocketErrorCallback) : void => {
+ return WebSocketManager.getInstance().onSocketError(callback);
+}
\ No newline at end of file
diff --git a/uni_modules/uni-websocket/utssdk/app-android/websocket/WebSocketManager.uts b/uni_modules/uni-websocket/utssdk/app-android/websocket/WebSocketManager.uts
new file mode 100644
index 0000000000000000000000000000000000000000..6d3982a17b8e7baf4d5f880cf4432ac2b8a3f96c
--- /dev/null
+++ b/uni_modules/uni-websocket/utssdk/app-android/websocket/WebSocketManager.uts
@@ -0,0 +1,292 @@
+import { ConnectSocket, ConnectSocketOptions, SocketTask, SendSocketMessageOptions, CloseSocketOptions, OnSocketOpenCallbackResult, GeneralCallbackResult, OnSocketMessageCallbackResult, OnSocketOpenCallback, OnSocketMessageCallback, OnSocketCloseCallback, OnSocketErrorCallback, OnSocketCloseCallbackResult, OnSocketErrorCallbackResult, ConnectSocketSuccess } from "../../interface";
+import { WebsockerClient } from "./WebsockerClient"
+import UTSAndroid from 'io.dcloud.uts.UTSAndroid';
+class SimpleSocketTask implements SocketTask {
+
+ private client : WebsockerClient | null = null;
+
+ private openCallbacks : Array<(result : OnSocketOpenCallbackResult) => void> = [];
+ private closeCallbacks : Array<(result : any) => void> = [];
+ private errorCallbacks : Array<(result : GeneralCallbackResult) => void> = [];
+ private messageCallbacks : Array<(result : OnSocketMessageCallbackResult) => void> = [];
+ constructor(client : WebsockerClient) {
+ this.client = client;
+ }
+
+ public dispatchOpen(options : OnSocketOpenCallbackResult) {
+ for (let i = 0; i < this.openCallbacks.length; i++) {
+ const callback = this.openCallbacks[i];
+ callback(options);
+ }
+ }
+
+ public dispatchClose(options : any) {
+ for (let i = 0; i < this.closeCallbacks.length; i++) {
+ const callback = this.closeCallbacks[i];
+ callback(options);
+ }
+ }
+
+ public dispatchError(options : GeneralCallbackResult) {
+ for (let i = 0; i < this.errorCallbacks.length; i++) {
+ const callback = this.errorCallbacks[i];
+ callback(options);
+ }
+ }
+
+ public dispatchMessage(options : OnSocketMessageCallbackResult) {
+ for (let i = 0; i < this.messageCallbacks.length; i++) {
+ const callback = this.messageCallbacks[i];
+ callback(options);
+ }
+ }
+ /**
+ * 通过 WebSocket 连接发送数据
+ */
+ send(options : SendSocketMessageOptions) : void {
+ if (this.client == null) {
+ const fail = options.fail;
+ const complete = options.complete;
+ let result : GeneralCallbackResult = {
+ errMsg: "sendSocketMessage:fail WebSocket is not connected"
+ }
+ fail?.(result);
+ complete?.(result);
+ return
+ }
+ this.client?.send(options)
+ }
+ /**
+ * 关闭 WebSocket 连接
+ */
+ close(options : CloseSocketOptions) : void {
+ if (this.client == null) {
+ const fail = options.fail;
+ const complete = options.complete;
+ let result : GeneralCallbackResult = {
+ errMsg: "closeSocket:fail WebSocket is not connected"
+ }
+ fail?.(result);
+ complete?.(result);
+ return
+ }
+ this.client?.close(options)
+ }
+ /**
+ * 监听 WebSocket 连接打开事件
+ */
+ onOpen(callback : (result : OnSocketOpenCallbackResult) => void) : void {
+ this.openCallbacks.push(callback);
+ }
+ /**
+ * 监听 WebSocket 连接关闭事件
+ */
+ onClose(callback : (result : any) => void) : void {
+ this.closeCallbacks.push(callback);
+ }
+ /**
+ * 监听 WebSocket 错误
+ */
+ onError(callback : (result : GeneralCallbackResult) => void) : void {
+ this.errorCallbacks.push(callback);
+ }
+ /**
+ * 监听WebSocket接受到服务器的消息事件
+ */
+ onMessage(callback : (result : OnSocketMessageCallbackResult) => void) : void {
+ this.messageCallbacks.push(callback);
+ }
+}
+
+export interface WebSocketManagerListener {
+ onOpen(client : WebsockerClient, header : any) : void;
+
+ onMessage(client : WebsockerClient, data : string) : void;
+
+ onClose(client : WebsockerClient, code : number, reason : string) : void;
+
+ onError(client : WebsockerClient, msg : string) : void;
+}
+
+export class WebSocketManager implements WebSocketManagerListener {
+ private static instance : WebSocketManager | null = null;
+
+ // 数组存储sockettask , 当uni.开头调用的时候,只作用于0元素. 这个task数组,当error或者close的时候 ,会删除.
+ private socketTasks : SocketTask[] = [];
+
+ /**
+ * client与task的绑定关系, 用于通过client查找task.
+ */
+ private taskMap : Map = new Map();
+
+ private openCallback : OnSocketOpenCallback | null = null;
+
+ private messageCallback : OnSocketMessageCallback | null = null;
+
+ private closeCallback : OnSocketCloseCallback | null = null;
+
+ private errorCallback : OnSocketErrorCallback | null = null;
+
+
+ public static getInstance() : WebSocketManager {
+ if (this.instance == null) {
+ this.instance = new WebSocketManager();
+ }
+ return this.instance!;
+ }
+
+
+ public connectSocket(options : ConnectSocketOptions) : SocketTask {
+ const webscoketClient = new WebsockerClient(options, this);
+ let task = new SimpleSocketTask(webscoketClient);
+ this.taskMap.set(webscoketClient, task);
+ this.socketTasks.push(task);
+ const success = options.success;
+ const complete = options.complete;
+ let result : ConnectSocketSuccess = {
+ errMsg: "connectSocket:ok"
+ }
+ success?.(result)
+ complete?.(result)
+ webscoketClient.connect();
+ return task;
+ }
+
+ public sendSocketMessage(options : SendSocketMessageOptions) : void {
+ if (this.socketTasks.length > 0) {
+ const task = this.socketTasks[0];
+ task.send(options);
+ } else {
+ const fail = options.fail;
+ const complete = options.complete;
+ let result : GeneralCallbackResult = {
+ errMsg: "sendSocketMessage:fail WebSocket is not connected"
+ }
+ fail?.(result);
+ complete?.(result);
+ }
+ }
+
+ public closeSocket(options : CloseSocketOptions) : void {
+ if (this.socketTasks.length > 0) {
+ const task = this.socketTasks[0];
+ task.close(options);
+ } else {
+ const fail = options.fail;
+ const complete = options.complete;
+ let result : GeneralCallbackResult = {
+ errMsg: "closeSocket:fail WebSocket is not connected"
+ }
+ fail?.(result);
+ complete?.(result);
+ }
+ }
+
+
+ public onSocketOpen(callback : OnSocketOpenCallback) : void {
+ this.openCallback = callback;
+ }
+
+ public onSocketError(callback : OnSocketErrorCallback) : void {
+ this.errorCallback = callback;
+ }
+
+ public onSocketClose(callback : OnSocketCloseCallback) : void {
+ this.closeCallback = callback;
+ }
+
+ public onSocketMessage(callback : OnSocketMessageCallback) : void {
+ this.messageCallback = callback;
+ }
+
+ getTaskWithClient(client : WebsockerClient) : SocketTask | null {
+ return this.taskMap.get(client);
+ }
+
+
+ onOpen(client : WebsockerClient, header : any) : void {
+ const task = this.getTaskWithClient(client);
+ if (task == null) {
+ return
+ }
+ let result : OnSocketOpenCallbackResult = {
+ header: header
+ }
+
+ const openCallback = this.openCallback;
+ if (this.socketTasks.length > 0 && task === this.socketTasks[0] && openCallback != null) {
+ openCallback(result);
+ }
+
+ const simpleTask = task as SimpleSocketTask;
+ simpleTask.dispatchOpen(result);
+ }
+
+ onMessage(client : WebsockerClient, data : string) : void {
+ const task = this.getTaskWithClient(client);
+ if (task == null) {
+ return
+ }
+ let result : OnSocketMessageCallbackResult = {
+ data: data
+ }
+
+ const messageCallback = this.messageCallback;
+ if (this.socketTasks.length > 0 && task === this.socketTasks[0] && messageCallback != null) {
+ messageCallback(result);
+ }
+
+ const simpleTask = task as SimpleSocketTask;
+ simpleTask.dispatchMessage(result);
+ }
+
+ onClose(client : WebsockerClient, code : number, reason : string) : void {
+ const task = this.getTaskWithClient(client);
+ if (task == null) {
+ return
+ }
+ let result : OnSocketCloseCallbackResult = {
+ code: code,
+ reason: reason
+ }
+
+ const closeCallback = this.closeCallback;
+ if (this.socketTasks.length > 0 && task === this.socketTasks[0] && closeCallback != null) {
+ closeCallback(result);
+ }
+
+ const index = this.socketTasks.indexOf(task);
+ this.socketTasks.splice(index, 1)
+
+ const simpleTask = task as SimpleSocketTask;
+ simpleTask.dispatchClose(result);
+
+ this.taskMap.delete(client);
+ }
+
+ onError(client : WebsockerClient, msg : string) : void {
+ const task = this.getTaskWithClient(client);
+ if (task == null) {
+ return
+ }
+ const errorCallback = this.errorCallback;
+ if (this.socketTasks.length > 0 && task === this.socketTasks[0] && errorCallback != null) {
+ let result : OnSocketErrorCallbackResult = {
+ errMsg: msg
+ }
+ errorCallback(result);
+ }
+
+ const index = this.socketTasks.indexOf(task);
+ this.socketTasks.splice(index, 1)
+
+ let result : GeneralCallbackResult = {
+ errMsg: msg
+ }
+
+ const simpleTask = task as SimpleSocketTask;
+ simpleTask.dispatchError(result);
+
+ this.taskMap.delete(client);
+ }
+}
\ No newline at end of file
diff --git a/uni_modules/uni-websocket/utssdk/app-android/websocket/WebsockerClient.uts b/uni_modules/uni-websocket/utssdk/app-android/websocket/WebsockerClient.uts
new file mode 100644
index 0000000000000000000000000000000000000000..fa9d99ff639d0eac3035ff0c736178cd00d8afa2
--- /dev/null
+++ b/uni_modules/uni-websocket/utssdk/app-android/websocket/WebsockerClient.uts
@@ -0,0 +1,299 @@
+import { WebSocketManagerListener } from "./WebSocketManager";
+import { ConnectSocketOptions, SendSocketMessageOptions, CloseSocketOptions, GeneralCallbackResult } from "../../interface";
+import { ConnectSocketFailImpl } from "../../unierror.uts";
+import OkHttpClient from 'okhttp3.OkHttpClient';
+import TimeUnit from 'java.util.concurrent.TimeUnit';
+import ConnectionPool from 'okhttp3.ConnectionPool';
+import Request from 'okhttp3.Request';
+import WebSocketListener from 'okhttp3.WebSocketListener';
+import WebSocket from 'okhttp3.WebSocket';
+import Response from 'okhttp3.Response';
+import Okio from 'okio.Okio';
+import ByteString from 'okio.ByteString';
+import UTSAndroid from 'io.dcloud.uts.UTSAndroid';
+import Base64 from 'android.util.Base64';
+import JSONObject from 'com.alibaba.fastjson.JSONObject';
+import Handler from 'android.os.Handler';
+import Looper from 'android.os.Looper';
+
+export class WebsockerClient {
+ private listener : WebSocketManagerListener | null = null;
+ private options : ConnectSocketOptions | null = null;
+
+ private static connectPool : ConnectionPool | null = null;
+
+ private websocketDelegate : WebsocketDelegate = new WebsocketDelegate();
+ constructor(options : ConnectSocketOptions, listener : WebSocketManagerListener) {
+ this.options = options;
+ this.listener = listener;
+ }
+
+
+ public connect() {
+ const kParam = this.options;
+ if (kParam != null) {
+ const httpClient = this.createHttpClient();
+
+ const request = this.createRequest(kParam);
+
+ if (request == null) {
+ return
+ }
+
+ // 临时解决方案 , 连接时延迟100ms , 等到js层注册了onOpen后再连接.
+ setTimeout(() => {
+ httpClient.newWebSocket(request, new SimpleWebsocketListener(this.listener!, this.websocketDelegate, this))
+ }, 100);
+
+ }
+ }
+
+ public send(options : SendSocketMessageOptions) {
+ const success = options.success;
+ const fail = options.fail;
+ const complete = options.complete;
+ if (this.websocketDelegate.websocket == null) {
+ let result : GeneralCallbackResult = {
+ errMsg: "sendSocketMessage:fail WebSocket is not connected"
+ }
+ fail?.(result);
+ complete?.(result);
+ return
+ }
+
+ try {
+ this.websocketDelegate.websocket?.send(options.data as string);
+ let result : GeneralCallbackResult = {
+ errMsg: "sendSocketMessage:ok"
+ }
+ success?.(result);
+ complete?.(result);
+ } catch (e : Exception) {
+ let result : GeneralCallbackResult = {
+ errMsg: e.message ?? ""
+ }
+ fail?.(result);
+ complete?.(result);
+ this.listener?.onError(this, e.message ?? "");
+ }
+ }
+
+ public close(options : CloseSocketOptions) {
+ const success = options.success;
+ const fail = options.fail;
+ const complete = options.complete;
+ if (this.websocketDelegate.websocket == null) {
+ let result : GeneralCallbackResult = {
+ errMsg: "closeSocket:fail WebSocket is not connected"
+ }
+ fail?.(result);
+ complete?.(result);
+ return
+ }
+ try {
+ var code : Int = 1000;
+ if (options.code != null) {
+ code = options.code as Int
+ }
+ this.websocketDelegate.websocket?.close(code, options.reason ?? "");
+ let result : GeneralCallbackResult = {
+ errMsg: "closeSocket:ok"
+ }
+ success?.(result);
+ complete?.(result);
+ } catch (e : Exception) {
+ let result : GeneralCallbackResult = {
+ errMsg: e.message ?? ""
+ }
+ fail?.(result);
+ complete?.(result);
+ this.listener?.onError(this, e.message ?? "");
+ }
+ }
+
+ private createHttpClient() : OkHttpClient {
+ let clientBuilder = OkHttpClient.Builder();
+ clientBuilder.readTimeout(24, TimeUnit.HOURS);
+ clientBuilder.writeTimeout(24, TimeUnit.HOURS);
+
+
+ if (WebsockerClient.connectPool == null) {
+ WebsockerClient.connectPool = new ConnectionPool();
+ }
+ clientBuilder.connectionPool(WebsockerClient.connectPool);
+
+ return clientBuilder.build();
+ }
+
+ private createRequest(options : ConnectSocketOptions) : Request | null {
+ let requestBilder = new Request.Builder();
+ try {
+ requestBilder.url(options.url);
+ } catch (e : Exception) {
+ let option = new ConnectSocketFailImpl(600009);
+ const listener = options.fail;
+ if (listener != null) {
+ listener(option);
+ }
+ return null;
+ }
+
+
+ const protocols = options.protocols;
+ if (protocols != null) {
+ let protocolsStr = protocols.join(",");
+ requestBilder.addHeader("Sec-WebSocket-Protocol", protocolsStr)
+ }
+
+ const header = options.header;
+ let hasOrigin = false;
+
+ if (header != null) {
+ let map = header.toMap();
+ if (map != null) {
+ for (key in map.keys) {
+ if (key.equals("Origin", true)) {
+ hasOrigin = true;
+ }
+ requestBilder.addHeader(key, "" + map[key]);
+ }
+ }
+ }
+
+ if (!hasOrigin) {
+ requestBilder.addHeader("Origin", "http://localhost"); // 测试时,有服务器检测Origin导致403,∴加上该句
+ }
+
+ return requestBilder.build();
+ }
+
+
+}
+
+class WebsocketDelegate {
+ websocket : WebSocket | null = null;
+}
+
+class RunnableTask extends Runnable {
+ private callback : () => void | null;
+ private looper : Looper | null = null;
+ constructor(looper : Looper | null, callback : () => void) {
+ super();
+ this.looper = looper;
+ this.callback = callback
+ }
+
+ override run() {
+ this.callback?.()
+ }
+
+ public execute() {
+ if (this.looper == null) {
+ this.run();
+ } else {
+ new Handler(this.looper!!).post(this);
+ }
+ }
+}
+
+
+
+
+class SimpleWebsocketListener extends WebSocketListener {
+ private listener : WebSocketManagerListener | null = null;
+ private websocketDelegate : WebsocketDelegate | null = null;
+ private client : WebsockerClient | null = null;
+ private looper : Looper | null = null;
+ constructor(listener : WebSocketManagerListener, delegate : WebsocketDelegate, client : WebsockerClient) {
+ super();
+ this.listener = listener;
+ this.websocketDelegate = delegate;
+ this.client = client;
+ this.looper = Looper.myLooper();
+ }
+
+ override onOpen(webSocket : WebSocket, response : Response) : void {
+ new RunnableTask(this.looper, () => {
+ const delegate = this.websocketDelegate;
+ if (delegate != null) {
+ delegate.websocket = webSocket;
+ }
+ const client = this.client;
+ if (client != null) {
+ const wsHeaders = response.headers();
+ const headers = new Map();
+ for (key in wsHeaders.names()) {
+ headers.set(key, wsHeaders.values(key).toString())
+ }
+ this.listener?.onOpen(client, headers);
+ }
+ }).execute();
+ }
+
+ override onMessage(webSocket : WebSocket, bytes : ByteString) : void {
+ new RunnableTask(this.looper, () => {
+ let sources = bytes.toByteArray();
+ let base64Str = Base64.encodeToString(sources, Base64.NO_WRAP);
+ let object = new JSONObject();
+ object.put("@type", "binary");
+ object.put("base64", base64Str);
+ const client = this.client;
+ if (client != null) {
+ this.listener?.onMessage(client, object.toJSONString());
+ }
+ }).execute();
+ }
+ override onMessage(webSocket : WebSocket, text : string) : void {
+ new RunnableTask(this.looper, () => {
+ const client = this.client;
+ if (client != null) {
+ this.listener?.onMessage(client, text);
+ }
+ }).execute();
+ }
+ override onClosing(webSocket : WebSocket, code : Int, reason : string) : void {
+ new RunnableTask(this.looper, () => {
+ const delegate = this.websocketDelegate;
+ if (delegate != null) {
+ delegate.websocket = null;
+ }
+ const client = this.client;
+ if (client != null) {
+ this.listener?.onClose(client, code, reason);
+ }
+ }).execute();
+
+ }
+
+ override onClosed(webSocket : WebSocket, code : Int, reason : string) : void {
+ new RunnableTask(this.looper, () => {
+ const delegate = this.websocketDelegate;
+ if (delegate != null) {
+ delegate.websocket = null;
+ }
+ const client = this.client;
+ if (client != null) {
+ this.listener?.onClose(client, code, reason);
+ }
+ }).execute();
+
+ }
+
+ override onFailure(webSocket : WebSocket, t : Throwable, response : Response | null) : void {
+ new RunnableTask(this.looper, () => {
+ const delegate = this.websocketDelegate;
+ if (delegate != null) {
+ delegate.websocket = null;
+ }
+ const client = this.client;
+ if (client != null) {
+ if (t.javaClass.simpleName == "EOFException") {
+ this.listener?.onClose(client, 1000, "CLOSE_NORMAL");
+ } else {
+ this.listener?.onError(client, t.message ?? "");
+ }
+ }
+ }).execute();
+ }
+
+}
\ No newline at end of file
diff --git a/uni_modules/uni-websocket/utssdk/app-ios/index.uts b/uni_modules/uni-websocket/utssdk/app-ios/index.uts
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/uni_modules/uni-websocket/utssdk/interface.type.uts b/uni_modules/uni-websocket/utssdk/interface.type.uts
new file mode 100644
index 0000000000000000000000000000000000000000..3a947bdf9a5cf1a1b25878a0ff2f6ce22e24b190
--- /dev/null
+++ b/uni_modules/uni-websocket/utssdk/interface.type.uts
@@ -0,0 +1,38 @@
+
+export type SocketDataOptions =
+ /**
+ * @description 字符串
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "x",
+ * "uniVer": "√",
+ * "unixVer": "x"
+ * },
+ * "ios": {
+ * "osVer": "x",
+ * "uniVer": "√",
+ * "unixVer": "x"
+ * }
+ * }
+ * }
+ */
+ String
+ /**
+ * @description ArrayBuffer
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "x",
+ * "uniVer": "√",
+ * "unixVer": "x"
+ * },
+ * "ios": {
+ * "osVer": "x",
+ * "uniVer": "√",
+ * "unixVer": "x"
+ * }
+ * }
+ * }
+ */
+ | ArrayBuffer;
\ No newline at end of file
diff --git a/uni_modules/uni-websocket/utssdk/interface.uts b/uni_modules/uni-websocket/utssdk/interface.uts
new file mode 100644
index 0000000000000000000000000000000000000000..b6e27a6de4cdb89d03042d4a0eef7fd801637e79
--- /dev/null
+++ b/uni_modules/uni-websocket/utssdk/interface.uts
@@ -0,0 +1,529 @@
+export interface Uni {
+ /**
+ * ConnectSocket()
+ * @description
+ * 创建一个 WebSocket 连接。
+ * @param {ConnectSocketOptions} options
+ * @return {SocketTask}
+ * @tutorial https://uniapp.dcloud.net.cn/api/request/websocket.html#connectsocket
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "4.4",
+ * "uniVer": "√",
+ * "unixVer": "3.9+"
+ * },
+ * "ios": {
+ * "osVer": "9.0",
+ * "uniVer": "√",
+ * "unixVer": "x"
+ * }
+ * }
+ * }
+ * @example
+ ```typescript
+ uni.connectSocket({
+ url: "ws://192.168.12.106:8080/ws",
+ complete: (e) => {
+ console.log("socket :", e);
+ }
+ });
+ ```
+ */
+ connectSocket(options: ConnectSocketOptions): SocketTask;
+ /**
+ * OnSocketOpen()
+ * @description
+ * 监听WebSocket连接打开事件。
+ * @param {OnSocketOpenCallback} options
+ * @return {void}
+ * @tutorial https://uniapp.dcloud.net.cn/api/request/websocket.html#onsocketopen
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "4.4",
+ * "uniVer": "√",
+ * "unixVer": "3.9+"
+ * },
+ * "ios": {
+ * "osVer": "9.0",
+ * "uniVer": "√",
+ * "unixVer": "x"
+ * }
+ * }
+ * }
+ * @example
+ ```typescript
+ uni.onSocketOpen(function (res) {
+ console.log('WebSocket连接已打开!');
+ });
+ ```
+ */
+ onSocketOpen(options: OnSocketOpenCallback): void;
+
+ /**
+ * OnSocketError()
+ * @description
+ * 下载文件资源到本地,客户端直接发起一个 HTTP GET 请求,返回文件的本地临时路径。
+ * @param {OnSocketErrorCallback} callback
+ * @return {void}
+ * @tutorial https://uniapp.dcloud.net.cn/api/request/websocket.html#onsocketerror
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "4.4",
+ * "uniVer": "√",
+ * "unixVer": "3.9+"
+ * },
+ * "ios": {
+ * "osVer": "9.0",
+ * "uniVer": "√",
+ * "unixVer": "x"
+ * }
+ * }
+ * }
+ * @example
+ ```typescript
+ uni.onSocketError(function (res) {
+ console.log('WebSocket连接打开失败,请检查!');
+ });
+ ```
+ */
+ onSocketError(callback: OnSocketErrorCallback): void;
+
+ /**
+ * SendSocketMessage()
+ * @description
+ * 通过 WebSocket 连接发送数据,需要先 uni.connectSocket,并在 uni.onSocketOpen 回调之后才能发送。
+ * @param {SendSocketMessageOptions} options
+ * @return {void}
+ * @tutorial https://uniapp.dcloud.net.cn/api/request/websocket.html#sendsocketmessage
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "4.4",
+ * "uniVer": "√",
+ * "unixVer": "3.9+"
+ * },
+ * "ios": {
+ * "osVer": "9.0",
+ * "uniVer": "√",
+ * "unixVer": "x"
+ * }
+ * }
+ * }
+ * @example
+ ```typescript
+ uni.sendSocketMessage({
+ data: msg
+ });
+ ```
+ */
+ sendSocketMessage(options: SendSocketMessageOptions): void;
+ /**
+ * OnSocketMessage()
+ * @description
+ * 监听WebSocket接受到服务器的消息事件。
+ * @param {OnSocketMessageCallback} callback
+ * @return {void}
+ * @tutorial https://uniapp.dcloud.net.cn/api/request/websocket.html#onsocketmessage
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "4.4",
+ * "uniVer": "√",
+ * "unixVer": "3.9+"
+ * },
+ * "ios": {
+ * "osVer": "9.0",
+ * "uniVer": "√",
+ * "unixVer": "x"
+ * }
+ * }
+ * }
+ * @example
+ ```typescript
+ uni.onSocketMessage(function (res) {
+ console.log('收到服务器内容:' + res.data);
+ });
+ ```
+ */
+ onSocketMessage(callback: OnSocketMessageCallback): void;
+ /**
+ * CloseSocket()
+ * @description
+ * 关闭 WebSocket 连接。
+ * @param {CloseSocketOptions} options
+ * @return {void}
+ * @tutorial https://uniapp.dcloud.net.cn/api/request/websocket.html#closesocket
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "4.4",
+ * "uniVer": "√",
+ * "unixVer": "3.9+"
+ * },
+ * "ios": {
+ * "osVer": "9.0",
+ * "uniVer": "√",
+ * "unixVer": "x"
+ * }
+ * }
+ * }
+ * @example
+ ```typescript
+ uni.closeSocket();
+ ```
+ */
+ closeSocket(options: CloseSocketOptions): void;
+ /**
+ * OnSocketClose()
+ * @description
+ * 监听WebSocket关闭。
+ * @param {OnSocketCloseCallback} callback
+ * @return {void}
+ * @tutorial https://uniapp.dcloud.net.cn/api/request/websocket.html#onsocketclose
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "4.4",
+ * "uniVer": "√",
+ * "unixVer": "3.9+"
+ * },
+ * "ios": {
+ * "osVer": "9.0",
+ * "uniVer": "√",
+ * "unixVer": "x"
+ * }
+ * }
+ * }
+ * @example
+ ```typescript
+ uni.onSocketClose(function (res) {
+ console.log('WebSocket 已关闭!');
+ });
+ ```
+ */
+ onSocketClose(callback: OnSocketCloseCallback): void;
+}
+
+export type ConnectSocket = (options: ConnectSocketOptions) => SocketTask;
+export type ConnectSocketSuccess = {
+ errMsg: string
+};
+type ConnectSocketSuccessCallback = (result: ConnectSocketSuccess) => void;
+/**
+ * 错误码
+ * - 600009 URL格式不合法
+ */
+export type ConnectSocketErrorCode = 600009;
+
+/**
+ * 连接调用失败的错误回调参数
+ */
+export interface ConnectSocketFail extends IUniError {
+ errCode: ConnectSocketErrorCode;
+};
+
+type ConnectSocketFailCallback = (result: ConnectSocketFail) => void;
+type ConnectSocketComplete = any;
+type ConnectSocketCompleteCallback = (result: ConnectSocketComplete) => void;
+export type ConnectSocketOptions = {
+ /**
+ * 开发者服务器接口地址,必须是 wss 协议,且域名必须是后台配置的合法域名
+ */
+ url: string,
+ /**
+ * HTTP 请求 Header,header 中不能设置 Referer
+ * @defaultValue null
+ */
+ header: UTSJSONObject | null,
+ /**
+ * 子协议数组
+ * @defaultValue null
+ */
+ protocols: (string[]) | null,
+ /**
+ * 接口调用成功的回调函数
+ * @defaultValue null
+ */
+ success?: ConnectSocketSuccessCallback | null,
+ /**
+ * 接口调用失败的回调函数
+ * @defaultValue null
+ */
+ fail?: ConnectSocketFailCallback | null,
+ /**
+ * 接口调用结束的回调函数(调用成功、失败都会执行)
+ * @defaultValue null
+ */
+ complete?: ConnectSocketCompleteCallback | null
+};
+export type GeneralCallbackResult = {
+ /**
+ * 错误信息
+ */
+ errMsg: string
+};
+export type SendSocketMessageOptions = {
+ /**
+ * 需要发送的内容
+ * @type string | ArrayBuffer
+ * @type {SocketDataOptions}
+ */
+ data: any,
+ /**
+ * 接口调用成功的回调函数
+ * @defaultValue null
+ */
+ success?: ((result: GeneralCallbackResult) => void) | null,
+ /**
+ * 接口调用失败的回调函数
+ * @defaultValue null
+ */
+ fail?: ((result: GeneralCallbackResult) => void) | null,
+ /**
+ * 接口调用结束的回调函数(调用成功、失败都会执行)
+ * @defaultValue null
+ */
+ complete?: ((result: GeneralCallbackResult) => void) | null
+};
+export type CloseSocketOptions = {
+ /**
+ * 一个数字值表示关闭连接的状态号,表示连接被关闭的原因。如果这个参数没有被指定,默认的取值是1000 (表示正常连接关闭)
+ * @defaultValue 1000
+ */
+ code?: number | null,
+ /**
+ * 一个可读的字符串,表示连接被关闭的原因。这个字符串必须是不长于123字节的UTF-8 文本(不是字符)
+ * @defaultValue ""
+ */
+ reason?: string | null,
+ /**
+ * 接口调用成功的回调函数
+ * @defaultValue null
+ */
+ success?: ((result: GeneralCallbackResult) => void) | null,
+ /**
+ * 接口调用失败的回调函数
+ * @defaultValue null
+ */
+ fail?: ((result: GeneralCallbackResult) => void) | null,
+ /**
+ * 接口调用结束的回调函数(调用成功、失败都会执行)
+ * @defaultValue null
+ */
+ complete?: ((result: GeneralCallbackResult) => void) | null
+};
+export type OnSocketOpenCallbackResult = {
+ /**
+ * 连接成功的 HTTP 响应 Header
+ */
+ header: any
+};
+export type OnSocketMessageCallbackResult = {
+ /**
+ * 服务器返回的消息
+ * @type {SocketDataOptions}
+ */
+ data: any
+};
+export interface SocketTask {
+ /**
+ * send()
+ * @description
+ * 通过 WebSocket 连接发送数据
+ * @param {SendSocketMessageOptions} options
+ * @return {void}
+ * @tutorial https://uniapp.dcloud.net.cn/api/request/socket-task.html#sockettask-send
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "4.4",
+ * "uniVer": "√",
+ * "unixVer": "3.9+"
+ * },
+ * "ios": {
+ * "osVer": "9.0",
+ * "uniVer": "√",
+ * "unixVer": "x"
+ * }
+ * }
+ * }
+ * @example
+ ```typescript
+ task.send({data:"halo"});
+ ```
+ */
+ send(options: SendSocketMessageOptions): void;
+ /**
+ * close()
+ * @description
+ * 关闭 WebSocket 连接
+ * @param {CloseSocketOptions} options
+ * @return {void}
+ * @tutorial https://uniapp.dcloud.net.cn/api/request/socket-task.html#sockettask-close
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "4.4",
+ * "uniVer": "√",
+ * "unixVer": "3.9+"
+ * },
+ * "ios": {
+ * "osVer": "9.0",
+ * "uniVer": "√",
+ * "unixVer": "x"
+ * }
+ * }
+ * }
+ * @example
+ ```typescript
+ task.close();
+ ```
+ */
+ close(options: CloseSocketOptions): void;
+ /**
+ * onOpen()
+ * @description
+ * 监听 WebSocket 连接打开事件
+ * @param {OnSocketOpenCallbackResult} options
+ * @return {void}
+ * @tutorial https://uniapp.dcloud.net.cn/api/request/socket-task.html#sockettask-onopen
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "4.4",
+ * "uniVer": "√",
+ * "unixVer": "3.9+"
+ * },
+ * "ios": {
+ * "osVer": "9.0",
+ * "uniVer": "√",
+ * "unixVer": "x"
+ * }
+ * }
+ * }
+ * @example
+ ```typescript
+ task.onOpen((res) => {})
+ ```
+ */
+ onOpen(callback: (result: OnSocketOpenCallbackResult) => void): void;
+ /**
+ * onClose()
+ * @description
+ * 监听 WebSocket 连接关闭事件
+ * @param {(result : any) => void} callback
+ * @return {void}
+ * @tutorial https://uniapp.dcloud.net.cn/api/request/socket-task.html#sockettask-onclose
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "4.4",
+ * "uniVer": "√",
+ * "unixVer": "3.9+"
+ * },
+ * "ios": {
+ * "osVer": "9.0",
+ * "uniVer": "√",
+ * "unixVer": "x"
+ * }
+ * }
+ * }
+ * @example
+ ```typescript
+ task.onClose((res) => {
+ })
+ ```
+ */
+ onClose(callback: (result: any) => void): void;
+ /**
+ * onError()
+ * @description
+ * 监听 WebSocket 错误
+ * @param {(result : GeneralCallbackResult) => void} callback
+ * @return {void}
+ * @tutorial https://uniapp.dcloud.net.cn/api/request/socket-task.html#sockettask-onerror
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "4.4",
+ * "uniVer": "√",
+ * "unixVer": "3.9+"
+ * },
+ * "ios": {
+ * "osVer": "9.0",
+ * "uniVer": "√",
+ * "unixVer": "x"
+ * }
+ * }
+ * }
+ * @example
+ ```typescript
+ task.onError((res) => {
+ })
+ ```
+ */
+ onError(callback: (result: GeneralCallbackResult) => void): void;
+ /**
+ * onMessage()
+ * @description
+ * 监听 WebSocket 接受到服务器的消息事件
+ * @param {(result : OnSocketMessageCallbackResult) => void} callback
+ * @return {void}
+ * @tutorial https://uniapp.dcloud.net.cn/api/request/socket-task.html#sockettask-onmessage
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "4.4",
+ * "uniVer": "√",
+ * "unixVer": "3.9+"
+ * },
+ * "ios": {
+ * "osVer": "9.0",
+ * "uniVer": "√",
+ * "unixVer": "x"
+ * }
+ * }
+ * }
+ * @example
+ ```typescript
+ task.onMessage((res) => {
+ })
+ ```
+ */
+ onMessage(callback: (result: OnSocketMessageCallbackResult) => void): void;
+};
+export type OnSocketOpenCallback = (result: OnSocketOpenCallbackResult) => void;
+
+export type OnSocketOpen = (options: OnSocketOpenCallback) => void;
+export type OnSocketErrorCallbackResult = {
+ /**
+ * 错误信息
+ */
+ errMsg: string
+};
+export type OnSocketErrorCallback = (result: OnSocketErrorCallbackResult) => void;
+
+export type OnSocketError = (callback: OnSocketErrorCallback) => void;
+
+export type SendSocketMessage = (options: SendSocketMessageOptions) => void;
+export type OnSocketMessageCallback = (result: OnSocketMessageCallbackResult) => void;
+
+export type OnSocketMessage = (callback: OnSocketMessageCallback) => void;
+
+export type CloseSocket = (options: CloseSocketOptions) => void;
+export type OnSocketCloseCallbackResult = {
+ /**
+ * 一个数字值表示关闭连接的状态号,表示连接被关闭的原因。
+ */
+ code: number,
+ /**
+ * 一个可读的字符串,表示连接被关闭的原因。
+ */
+ reason: string
+};
+export type OnSocketCloseCallback = (result: OnSocketCloseCallbackResult) => void;
+
+export type OnSocketClose = (callback: OnSocketCloseCallback) => void;
diff --git a/uni_modules/uni-websocket/utssdk/unierror.uts b/uni_modules/uni-websocket/utssdk/unierror.uts
new file mode 100644
index 0000000000000000000000000000000000000000..9d9177f86b8c329d5441f4fb3ca6b0f247b83bd0
--- /dev/null
+++ b/uni_modules/uni-websocket/utssdk/unierror.uts
@@ -0,0 +1,26 @@
+import {ConnectSocketFail ,ConnectSocketErrorCode} from "./interface.uts"
+
+/**
+ * 错误主题
+ */
+export const UniErrorSubject = 'uni-websocket';
+/**
+ * 错误码
+ * @UniError
+ */
+export const UniErrors : Map = new Map([
+ /**
+ * URL 格式不合法
+ */
+ [600009, 'invalid URL'],
+]);
+
+
+export class ConnectSocketFailImpl extends UniError implements ConnectSocketFail {
+ constructor(errCode : ConnectSocketErrorCode) {
+ super();
+ this.errSubject = UniErrorSubject;
+ this.errCode = errCode;
+ this.errMsg = UniErrors[errCode] ?? ""
+ }
+}
\ No newline at end of file
diff --git a/uni_modules/uni-wifi/package.json b/uni_modules/uni-wifi/package.json
index b44e757fe040858cc150902d83ea207a4e6df987..c4a2ce639111079ab7342a30884d2435be5f9ca3 100644
--- a/uni_modules/uni-wifi/package.json
+++ b/uni_modules/uni-wifi/package.json
@@ -5,7 +5,7 @@
"description": "wifi管理",
"keywords": [
"wifi"
-],
+ ],
"repository": "",
"engines": {
"HBuilderX": "^3.6.11"
@@ -31,21 +31,43 @@
"npmurl": ""
},
"uni_modules": {
- "uni-ext-api":{
- "uni": {
- "startWifi": "startWifi",
- "stopWifi": "stopWifi",
- "connectWifi":"connectWifi",
- "getConnectedWifi": "getConnectedWifi",
- "getWifiList":"getWifiList",
- "onGetWifiList":"onGetWifiList",
- "offGetWifiList":"offGetWifiList",
- "onWifiConnected":"onWifiConnected",
- "offWifiConnected":"offWifiConnected",
- "onWifiConnectedWithPartialInfo":"onWifiConnectedWithPartialInfo",
- "offWifiConnectedWithPartialInfo":"offWifiConnectedWithPartialInfo"
- }
- },
+ "uni-ext-api": {
+ "uni": {
+ "startWifi": {
+ "web": false
+ },
+ "stopWifi": {
+ "web": false
+ },
+ "connectWifi": {
+ "web": false
+ },
+ "getConnectedWifi": {
+ "web": false
+ },
+ "getWifiList": {
+ "web": false
+ },
+ "onGetWifiList": {
+ "web": false
+ },
+ "offGetWifiList": {
+ "web": false
+ },
+ "onWifiConnected": {
+ "web": false
+ },
+ "offWifiConnected": {
+ "web": false
+ },
+ "onWifiConnectedWithPartialInfo": {
+ "web": false
+ },
+ "offWifiConnectedWithPartialInfo": {
+ "web": false
+ }
+ }
+ },
"dependencies": [],
"encrypt": [],
"platforms": {
@@ -61,10 +83,10 @@
"App": {
"app-android": {
"minVersion": "19"
- },
+ },
"app-ios": {
"minVersion": "9"
- }
+ }
},
"H5-mobile": {
"Safari": "n",
@@ -97,4 +119,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/uni_modules/uni-wifi/utssdk/app-android/config.json b/uni_modules/uni-wifi/utssdk/app-android/config.json
new file mode 100644
index 0000000000000000000000000000000000000000..7ed4299898bcce833a4b7b6de7c4ef4d4ac999da
--- /dev/null
+++ b/uni_modules/uni-wifi/utssdk/app-android/config.json
@@ -0,0 +1,3 @@
+{
+ "minSdkVersion": "19"
+}
\ No newline at end of file
diff --git a/uni_modules/uni-wifi/utssdk/app-android/index.uts b/uni_modules/uni-wifi/utssdk/app-android/index.uts
index 955cc858bbd1edd5a5ed70cef15d0bed3d015553..bef663a5624524e8d50f9a7fc96787f563467932 100644
--- a/uni_modules/uni-wifi/utssdk/app-android/index.uts
+++ b/uni_modules/uni-wifi/utssdk/app-android/index.uts
@@ -1,5 +1,4 @@
import Context from "android.content.Context";
-import { UTSAndroid } from "io.dcloud.uts";
import WifiManager from "android.net.wifi.WifiManager";
import WifiInfo from "android.net.wifi.WifiInfo";
import Manifest from "android.Manifest";
@@ -8,9 +7,7 @@ import ScanResult from "android.net.wifi.ScanResult";
import BroadcastReceiver from "android.content.BroadcastReceiver";
import ActivityCompat from "androidx.core.app.ActivityCompat";
import IntentFilter from "android.content.IntentFilter";
-import JSONObject from "com.alibaba.fastjson.JSONObject";
import Intent from "android.content.Intent";
-import Thread from "java.lang.Thread";
import WifiConfiguration from 'android.net.wifi.WifiConfiguration';
import AuthAlgorithm from 'android.net.wifi.WifiConfiguration.AuthAlgorithm';
@@ -18,8 +15,8 @@ import KeyMgmt from 'android.net.wifi.WifiConfiguration.KeyMgmt';
import TextUtils from 'android.text.TextUtils';
import Build from 'android.os.Build';
-import { UniWifiResult, GetConnectedWifiOptions, WifiConnectOption, WifiOption, UniWifiInfo } from "../interface.uts"
-
+import { UniWifiResult, UniWifiInfoWithPartialInfo,GetConnectedWifiOptions, WifiConnectOption, WifiOption, UniWifiInfo,UniWifiCallback ,UniWifiResultCallback,UniWifiResultCallbackWithPartialInfo,UniGetWifiListCallback} from "../interface.uts"
+import { WifiFailImpl, getErrcode,UniErrorSubject } from '../unierror';
/**
@@ -32,12 +29,12 @@ class Global {
// 扫描wifi结果
static scanList : AndroidUniWifiInfo[] = []
// 获取wifi列表监听
- static onGetWifiListCallback : UTSCallback | null = null
- static supendGetWifiSuccess : ((res: UniWifiResult) => void) | null = null
- static supendGetWifiComplete : ((res: UniWifiResult) => void) | null = null
+ static onGetWifiListCallback : UniGetWifiListCallback|null = null
+ static supendGetWifiSuccess : UniWifiResultCallback|null = null
+ static supendGetWifiComplete :UniWifiResultCallback|null = null
// wifi链接监听
- static onWifiConnectCallbackList : UTSCallback[] = []
- static onWifiConnectWithPartialInfoCallbackList : UTSCallback[] = []
+ static onWifiConnectCallbackList : UniWifiResultCallback[] = []
+ static onWifiConnectWithPartialInfoCallbackList : UniWifiResultCallbackWithPartialInfo[] = []
}
@@ -210,8 +207,8 @@ function wrapWifiConfiguration(SSID : string, password ?: string, passwordType :
/**
- * 判断当前wifi的加密类型
- */
+ * 判断当前wifi的加密类型
+ */
function getSecurityType(result : ScanResult) : string {
if (result.capabilities.contains("WEP")) {
return "WEP";
@@ -256,46 +253,37 @@ class CustomBroadcastReceiver extends BroadcastReceiver {
if (intent.action == WifiManager.WIFI_STATE_CHANGED_ACTION) {
+
let state =
intent.getIntExtra(WifiManager.EXTRA_WIFI_STATE, WifiManager.WIFI_STATE_UNKNOWN)
+
if (state == WifiManager.WIFI_STATE_ENABLED) {
// 获取当前的connectInfo 并且进行数据封装
- // let uniWifiInfo = new UniWifiInfo(null)
- let uniWifiInfo : UniWifiInfo = {
- SSID: "",
- secure: false,
- signalStrength: 0,
- frequency: 0,
- }
+ let uniWifiInfo = new UniWifiInfo("","",false,0,0)
//做一些异步操作
setTimeout(function () {
// BroadcastReceiver 中不能执行耗时任务,需要使用setTimeout
// @ts-ignore
let winfo = this.mWifiManager!.getConnectionInfo();
- while (winfo.bssid == null || zeroCountNum(winfo.bssid) > 4) {
- Thread.sleep(1000)
- winfo = this.mWifiManager!.getConnectionInfo();
- }
-
- // 封装成数据对象
- uniWifiInfo = wrapUniWifiInfoFromConnectInfo(winfo)
- let res = {
- errMsg: 'onWifiConnected:ok',
- errCode: 0,
- wifi: uniWifiInfo
- }
- // wifi状态可用了,分发当前的链接状态给已注册的监听集合
- for (let perCallback in Global.onWifiConnectCallbackList) {
- perCallback(res);
- }
- // 封装仅SSID 数据对象
- var connectedWithPartialInfo = {
- SSID: uniWifiInfo.SSID
- }
- for (let perCallback in Global.onWifiConnectWithPartialInfoCallbackList) {
- perCallback(connectedWithPartialInfo);
- }
+ if(winfo != null && winfo.bssid != null && zeroCountNum(winfo.bssid) < 3){
+ // 当前设备链接到了某个具体的wifi.封装成数据对象
+ uniWifiInfo = wrapUniWifiInfoFromConnectInfo(winfo)
+ let res = new UniWifiResult(0,UniErrorSubject,'onWifiConnected:ok',uniWifiInfo)
+
+ // wifi状态可用了,分发当前的链接状态给已注册的监听集合
+ for (let perCallback in Global.onWifiConnectCallbackList) {
+ perCallback(res);
+ }
+ // 封装仅SSID 数据对象
+ let connectedWithPartialInfo = new UniWifiInfoWithPartialInfo(uniWifiInfo.SSID)
+
+ for (let perCallback in Global.onWifiConnectWithPartialInfoCallbackList) {
+ perCallback(connectedWithPartialInfo);
+ }
+ } else {
+ // 开启了wifi 开关,但是尚未链接到某个具体的wifi
+ }
}, 100);
}
@@ -305,23 +293,9 @@ class CustomBroadcastReceiver extends BroadcastReceiver {
if (intent.action == WifiManager.SCAN_RESULTS_AVAILABLE_ACTION) {
startWifiScaning = false;
-
- let ret : UniWifiResult = {
- errCode: 0,
- errSubject: "uni-getWifiList",
- errMsg: "getWifiList:ok"
- }
- if(Global.supendGetWifiSuccess != null){
- Global.supendGetWifiSuccess?.(ret)
- }
- if(Global.supendGetWifiComplete != null){
- Global.supendGetWifiComplete?.(ret)
- }
-
// wifi 扫描结果回调
let results = this.mWifiManager!.scanResults;
-
if (results != null) {
Global.scanList = []
for (let scanResult in results) {
@@ -333,18 +307,26 @@ class CustomBroadcastReceiver extends BroadcastReceiver {
// 挨个通知,所有的监听器
if(Global.onGetWifiListCallback != null){
- const data = new JSONObject();
+ const data = new UTSJSONObject();
data["wifiList"] = Global.scanList
Global.onGetWifiListCallback?.(data);
+ /**
+ * 确保onGetWifiList 只会被执行一次
+ */
+ Global.onGetWifiListCallback = null
}
- // for (let perCallback in Global.onGetWifiListCallback) {
- // const data = new JSONObject();
- // data["wifiList"] = Global.scanList
- // perCallback(data);
- // }
}
+ let ret = new UniWifiResult(0,UniErrorSubject,"getWifiList:ok",null)
+ if(Global.supendGetWifiSuccess != null){
+ Global.supendGetWifiSuccess?.(ret)
+ Global.supendGetWifiSuccess = null
+ }
+ if(Global.supendGetWifiComplete != null){
+ Global.supendGetWifiComplete?.(ret)
+ Global.supendGetWifiComplete = null
+ }
}
}
@@ -362,88 +344,85 @@ var startWifiScaning = false
* 开启wifi
*/
@Suppress("DEPRECATION")
-export function startWifi(option : WifiOption) {
+export function startWifiImpl(option : WifiOption) {
+
+
+ // 具备了权限,继续前进
+ let wifiManager : WifiManager =
+ UTSAndroid.getAppContext()!.getSystemService(Context.WIFI_SERVICE) as WifiManager
+ // 用户没有开启wifi 总开关
+ if (!wifiManager.isWifiEnabled()) {
+ // wifi 没开启
+ let failResult = new WifiFailImpl(getErrcode(12005));
+ option.fail?.(failResult);
+ option.complete?.(failResult);
+ return;
+ }
+ // 初始化wifi 状态广播监听,后续所有的api,均基于此
+ if(Global.mReceiver != null){
+ // 说明已经注册过了
+ let result = UniWifiResult(0,UniErrorSubject,"startWifi:ok",null)
+
+ option.success?.(result)
+ option.complete?.(result)
+ return
+ }
+
+
+ Global.mReceiver = new CustomBroadcastReceiver(wifiManager)
+
+ let filter = new IntentFilter()
+ filter.addAction(WifiManager.SCAN_RESULTS_AVAILABLE_ACTION)
+ // @ts-ignore
+ filter.addAction(WifiManager.WIFI_STATE_CHANGED_ACTION)
+ // @ts-ignore
+ filter.addAction(WifiManager.SUPPLICANT_STATE_CHANGED_ACTION);
+
+ UTSAndroid.getUniActivity()!.registerReceiver(Global.mReceiver, filter)
+
+ /**
+ * activity 被销毁时,取消注册
+ */
+ UTSAndroid.onAppActivityDestroy(function () {
+
+ if (Global.mReceiver != null) {
+ UTSAndroid.getUniActivity()!.unregisterReceiver(Global.mReceiver)
+ Global.mReceiver = null
+
+ Global.scanList = []
+ Global.onGetWifiListCallback = null
+ Global.onWifiConnectCallbackList = []
+ Global.onWifiConnectWithPartialInfoCallbackList = []
+ }
+
+ });
+ startWifiScaning = true
+ // 开始扫描
+ wifiManager.startScan()
+
+ let result = UniWifiResult(0,UniErrorSubject,"startWifi:ok",null)
+ option.success?.(result)
+ option.complete?.(result)
- // 需要先开启wifi,才能使用后续的功能
- let requestCode = 1001;
- let permissionWifi = arrayOf("android.permission.ACCESS_FINE_LOCATION");
- var result : UniWifiResult = {
- errCode: 12001,
- errMsg: "startWifi:premission loss",
- errSubject: "uni-startWifi"
- }
- // 检查权限
- if (ActivityCompat.checkSelfPermission(UTSAndroid.getUniActivity()!, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
-
- ActivityCompat.requestPermissions(UTSAndroid.getUniActivity()!, permissionWifi, requestCode)
- // 尚不具备权限,返回错误
- option.fail?.(result)
- option.complete?.(result)
-
- return;
- }
-
- // 具备了权限,继续前进
- let wifiManager : WifiManager =
- UTSAndroid.getAppContext()!.getSystemService(Context.WIFI_SERVICE) as WifiManager
- // 用户没有开启wifi 总开关
- if (!wifiManager.isWifiEnabled()) {
- // wifi 没开启
- result.errCode = 12005;
- result.errMsg = "wifi not turned on";
-
- option.fail?.(result);
- option.complete?.(result);
- return;
- }
- // 初始化wifi 状态广播监听,后续所有的api,均基于此
- if(Global.mReceiver != null){
- // 说明已经注册过了
- result.errCode = 0
- result.errMsg = "startWifi:ok"
-
- option.success?.(result)
- option.complete?.(result)
- return
- }
-
-
- Global.mReceiver = new CustomBroadcastReceiver(wifiManager)
-
- let filter = new IntentFilter()
- filter.addAction(WifiManager.SCAN_RESULTS_AVAILABLE_ACTION)
- // @ts-ignore
- filter.addAction(WifiManager.WIFI_STATE_CHANGED_ACTION)
- // @ts-ignore
- filter.addAction(WifiManager.SUPPLICANT_STATE_CHANGED_ACTION);
-
- UTSAndroid.getUniActivity()!.registerReceiver(Global.mReceiver, filter)
-
- /**
- * activity 被销毁时,取消注册
- */
- UTSAndroid.onAppActivityDestroy(function () {
-
- if (Global.mReceiver != null) {
- UTSAndroid.getUniActivity()!.unregisterReceiver(Global.mReceiver)
- Global.mReceiver = null
-
- Global.scanList = []
- Global.onGetWifiListCallback = null
- Global.onWifiConnectCallbackList = []
- Global.onWifiConnectWithPartialInfoCallbackList = []
- }
-
- });
- startWifiScaning = true
- // 开始扫描
- wifiManager.startScan()
+}
- result.errCode = 0
- result.errMsg = "startWifi:ok"
+@Suppress("DEPRECATION")
+export function startWifi(option : WifiOption) {
- option.success?.(result)
- option.complete?.(result)
+ /**
+ * 准备权限
+ */
+ let permissionNeed = ["android.permission.ACCESS_FINE_LOCATION"];
+ UTSAndroid.requestSystemPermission(UTSAndroid.getUniActivity()!, permissionNeed, function (allRight:boolean,_grantedList:string[]) {
+ if (allRight) {
+ // 交给目前的location 引擎,真实执行
+ startWifiImpl(option)
+ }
+ }, function (_doNotAskAgain:boolean,_grantedList:string[]) {
+ let err = new WifiFailImpl(getErrcode(12001));
+ option.fail?.(err)
+ option.complete?.(err)
+ })
}
@@ -453,16 +432,12 @@ export function startWifi(option : WifiOption) {
@Suppress("DEPRECATION")
export function getWifiList(option : WifiOption) {
- var result : UniWifiResult = {
- errCode: 12000,
- errMsg: "getWifiList:fail:not invoke startWifi",
- errSubject: "uni-getWifiList"
- }
if (Global.mReceiver == null) {
// 还没调用startWifi 提示报错
- option.fail?.(result)
- option.complete?.(result)
+ let err = new WifiFailImpl(getErrcode(12000));
+ option.fail?.(err)
+ option.complete?.(err)
return
}
@@ -470,13 +445,14 @@ export function getWifiList(option : WifiOption) {
let wifiManager : WifiManager =
UTSAndroid.getAppContext()!.getSystemService(Context.WIFI_SERVICE) as WifiManager
+ if(option.success != null){
+ Global.supendGetWifiSuccess = option.success
+ }
+ if(option.complete != null){
+ Global.supendGetWifiComplete = option.complete
+ }
-
- Global.supendGetWifiSuccess = option.success
- Global.supendGetWifiComplete = option.complete
-
wifiManager.startScan()
-
}
@@ -485,12 +461,12 @@ export function getWifiList(option : WifiOption) {
/**
* wifi 链接成功的回调注册
*/
-export function onWifiConnected(callback : UTSCallback) {
+export function onWifiConnected(callback : UniWifiResultCallback) {
Global.onWifiConnectCallbackList.push(callback)
}
-export function onWifiConnectedWithPartialInfo(callback : UTSCallback) {
+export function onWifiConnectedWithPartialInfo(callback : UniWifiResultCallbackWithPartialInfo) {
Global.onWifiConnectWithPartialInfoCallbackList.push(callback)
}
@@ -498,13 +474,13 @@ export function onWifiConnectedWithPartialInfo(callback : UTSCallback) {
/**
* wifi 链接成功的回调取消注册
*/
-export function offWifiConnected(callback? : UTSCallback) {
-
+export function offWifiConnected(callback? : UniWifiResultCallback) {
+
if(callback == null){
Global.onWifiConnectCallbackList = []
return
}
-
+
let callbackIndex = Global.onWifiConnectCallbackList.indexOf(callback)
if (callbackIndex >= 0) {
Global.onWifiConnectCallbackList.splice(callbackIndex, 1);
@@ -514,13 +490,13 @@ export function offWifiConnected(callback? : UTSCallback) {
/**
* 不具备详细信息的wifi 反注册
*/
-export function offWifiConnectedWithPartialInfo(callback? : UTSCallback) {
-
+export function offWifiConnectedWithPartialInfo(callback? : UniWifiResultCallbackWithPartialInfo) {
+
if(callback == null){
Global.onWifiConnectWithPartialInfoCallbackList = []
return
}
-
+
let callbackIndex = Global.onWifiConnectWithPartialInfoCallbackList.indexOf(callback)
if (callbackIndex >= 0) {
Global.onWifiConnectWithPartialInfoCallbackList.splice(callbackIndex, 1);
@@ -530,14 +506,14 @@ export function offWifiConnectedWithPartialInfo(callback? : UTSCallback) {
/**
* 注册Wifi列表的监听事件
*/
-export function onGetWifiList(callback : UTSCallback) {
+export function onGetWifiList(callback : UniGetWifiListCallback) {
Global.onGetWifiListCallback = callback
}
/**
* 取消注册Wifi列表的监听事件
*/
-export function offGetWifiList(callback? : UTSCallback) {
+export function offGetWifiList(callback? : UniWifiCallback) {
Global.onGetWifiListCallback = null
Global.supendGetWifiComplete = null
Global.supendGetWifiSuccess = null
@@ -547,15 +523,17 @@ export function offGetWifiList(callback? : UTSCallback) {
/**
* 真正执行wifi链接逻辑
*/
-function realWifiConnect(option : WifiConnectOption,result : UniWifiResult){
-
+function realWifiConnect(option : WifiConnectOption){
+
if (Global.mReceiver == null || Global.scanList.length < 1) {
- option.fail?.(result)
- option.complete?.(result)
-
+
+ let err = new WifiFailImpl(getErrcode(12000));
+ option.fail?.(err)
+ option.complete?.(err)
+
return
}
-
+
// 执行后续的逻辑
let scanWifiInfo : AndroidUniWifiInfo | null = null
for (let scanResult in Global.scanList) {
@@ -563,19 +541,20 @@ function realWifiConnect(option : WifiConnectOption,result : UniWifiResult){
scanWifiInfo = scanResult
}
}
-
+
if (scanWifiInfo == null) {
// 不在扫描列表中返回错误
- option.fail?.(result)
- option.complete?.(result)
+ let err = new WifiFailImpl(getErrcode(12000));
+ option.fail?.(err)
+ option.complete?.(err)
return
}
-
+
let wifiConfigration = wrapWifiConfiguration(scanWifiInfo.SSID, option.password, scanWifiInfo.securityType);
wifiConfigration.BSSID = scanWifiInfo.BSSID
let wifiManager : WifiManager =
UTSAndroid.getAppContext()!.getSystemService(Context.WIFI_SERVICE) as WifiManager
-
+
// 如果已经存在了指定wifi 配置,移除之
let targetExistConfig : WifiConfiguration | null = null
let existingConfigs = wifiManager.getConfiguredNetworks();
@@ -587,28 +566,28 @@ function realWifiConnect(option : WifiConnectOption,result : UniWifiResult){
// 如果wifi已经保存了当前ssid的配置,可能是别的应用添加的。android系统要求,需要删除掉重新添加
if (targetExistConfig != null) {
let removeRet = wifiManager.removeNetwork(targetExistConfig.networkId);
-
+
if (!removeRet) {
-
+
// add since 2023-03-28,如果当前系统大于等于android10, 则明确当前系统不支持
if(Build.VERSION.SDK_INT > 28){
// 系统大于android 9
- result.errCode = 12001
- result.errMsg = "connectWifi:system not support"
+ let err = new WifiFailImpl(getErrcode(12001));
+ option.fail?.(err)
+ option.complete?.(err)
}else{
// 移除之前的配置失败了,返回错误,需要用户手动取消保存一下
- result.errCode = 12013
- result.errMsg = "connectWifi:wifi config may be expired"
+ let err = new WifiFailImpl(getErrcode(12013));
+ option.fail?.(err)
+ option.complete?.(err)
}
-
- option.fail?.(result)
- option.complete?.(result)
-
+
+
return
}
-
+
}
-
+
let currentConnect = wifiManager.getConnectionInfo()
if (currentConnect.networkId >= 0) {
wifiManager.disableNetwork(currentConnect.networkId)
@@ -616,52 +595,47 @@ function realWifiConnect(option : WifiConnectOption,result : UniWifiResult){
wifiManager.removeNetwork(currentConnect.networkId)
}
wifiManager.disconnect()
-
+
let connected = false;
try {
-
+
let netID = wifiManager.addNetwork(wifiConfigration);
// 如果-1 说明没添加上,报错即可
if (netID < 0) {
- result.errCode = 12002
- result.errMsg = "connectWifi:password error Wi-Fi"
-
- option.fail?.(result)
- option.complete?.(result)
-
+ let err = new WifiFailImpl(getErrcode(12002));
+ option.fail?.(err)
+ option.complete?.(err)
+
return
}
-
-
+
+
let enabled = wifiManager.enableNetwork(netID, true);
if (!enabled) {
-
- result.errCode = 12007
- result.errMsg = "connectWifi:user denied"
-
- option.fail?.(result)
- option.complete?.(result)
-
+ let err = new WifiFailImpl(getErrcode(12007));
+ option.fail?.(err)
+ option.complete?.(err)
+
return
}
connected = wifiManager.reconnect();
-
+
} catch (e) {
connected = false;
console.log(e);
}
-
+
if (!connected) {
// 出错了,返回错误
// 兜底的报错
- result.errCode = 12010
- result.errMsg = "connectWifi:fail:unknown error"
-
- option.fail?.(result)
- option.complete?.(result)
+ let err = new WifiFailImpl(getErrcode(12010));
+ option.fail?.(err)
+ option.complete?.(err)
return
}
-
+
+ let result = new UniWifiResult(0,UniErrorSubject,"getWifiList:ok",null)
+
wifiManager.saveConfiguration()
//scanWifiInfo 根据 partialInfo 填充给返回字段
if (option.partialInfo != null && option.partialInfo == true) {
@@ -672,11 +646,8 @@ function realWifiConnect(option : WifiConnectOption,result : UniWifiResult){
} else {
result.wifi = wrapUniWifiInfoFromAndroid(scanWifiInfo)
}
-
- // result.wifi = scanWifiInfo.toUTSJSON(option.partialInfo)
- result.errCode = 0
- result.errMsg = "connectWifi:ok"
-
+
+
option.success?.(result)
option.complete?.(result)
}
@@ -687,50 +658,43 @@ function realWifiConnect(option : WifiConnectOption,result : UniWifiResult){
@Suppress("UNUSED_PARAMETER", "DEPRECATION")
export function connectWifi(option : WifiConnectOption) {
-
- var result : UniWifiResult = {
- errCode: 12000,
- errMsg: "connectWifi:fail:not invoke startWifi",
- errSubject: "uni-connectWifi",
- }
-
if (option.maunal == true) {
// 指定了手动模式
let manunalIntent = new Intent(android.provider.Settings.ACTION_WIFI_SETTINGS);
UTSAndroid.getUniActivity()!.startActivity(manunalIntent);
- result.errCode = 0
- result.errMsg = "connectWifi:ok"
+
+ let result = new UniWifiResult(0,UniErrorSubject,"connectWifi:ok",null)
option.success?.(result)
option.complete?.(result)
return
}
-
-
+
+
// add since 2022-03-28 ,增加逻辑,如果正在扫描中,则可以等待5s
if(startWifiScaning){
let taskCount = 0
let taskId:number = 0
taskId = setInterval(function(){
-
+
taskCount += 1;
if(taskCount >= 5 || startWifiScaning == false){
// 超过10s了。或者扫描过程结束了
clearInterval(taskId)
- realWifiConnect(option,result)
+ realWifiConnect(option)
}
},2000)
-
+
UTSAndroid.onAppActivityDestroy(function () {
clearInterval(taskId)
});
}else{
- realWifiConnect(option,result)
+ realWifiConnect(option)
}
-
+
}
@@ -741,13 +705,9 @@ export function connectWifi(option : WifiConnectOption) {
export function stopWifi(option : WifiOption) {
// 需要先开启wifi,才能使用后续的功能
if (Global.mReceiver == null) {
- var result : UniWifiResult = {
- errCode: 12000,
- errSubject: "uni-stopWifi",
- errMsg: "stopWifi:not init"
- }
- option.fail?.(result)
- option.complete?.(result)
+ let err = new WifiFailImpl(getErrcode(12000));
+ option.fail?.(err)
+ option.complete?.(err)
return
}
@@ -757,19 +717,15 @@ export function stopWifi(option : WifiOption) {
// 多次调用
//TODO handle the exception
}
-
+
Global.onGetWifiListCallback = null
Global.onWifiConnectWithPartialInfoCallbackList = []
Global.onWifiConnectCallbackList = []
Global.mReceiver = null
-
- let result : UniWifiResult = {
- errCode: 0,
- errSubject: "uni-stopWifi",
- errMsg: "stopWifi:ok"
- }
- option.success?.(result)
- option.complete?.(result)
+
+ let ret = new UniWifiResult(0,UniErrorSubject,"stopWifi:ok",null)
+ option.success?.(ret)
+ option.complete?.(ret)
}
@@ -783,16 +739,12 @@ export function getConnectedWifi(option : GetConnectedWifiOptions) {
SSID: ""
}
- var res : UniWifiResult = {
- errCode: 12000,
- errMsg: "getConnectedWifi:fail:not invoke startWifi",
- errSubject: "uni-getConnectedWifi",
- }
if (Global.mReceiver == null) {
// 还没调用startWifi 提示报错
- option.fail?.(res)
- option.complete?.(res)
+ let err = new WifiFailImpl(getErrcode(12000));
+ option.fail?.(err)
+ option.complete?.(err)
return
}
@@ -800,14 +752,14 @@ export function getConnectedWifi(option : GetConnectedWifiOptions) {
// 需要先校验权限,没有位置权限无法获取wifi
if (ActivityCompat.checkSelfPermission(UTSAndroid.getUniActivity()!, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
// 尚不具备权限,返回错误
- res.errCode = 12001
- res.errMsg = "getConnectedWifi:permission loss"
-
- option.fail?.(res)
- option.complete?.(res)
+ let err = new WifiFailImpl(getErrcode(12001));
+ option.fail?.(err)
+ option.complete?.(err)
return;
}
+
+
const context = UTSAndroid.getAppContext();
if (context != null) {
const wm = context.getSystemService(
@@ -818,31 +770,33 @@ export function getConnectedWifi(option : GetConnectedWifiOptions) {
const winfo = wm.getConnectionInfo();
wifiInfo = wrapUniWifiInfoFromConnectInfo(winfo);
+
+ let res = new UniWifiResult(0,UniErrorSubject,"getConnectedWifi:ok",null)
+
// 判断一下是否wifi 关闭了
- if (option.partialInfo != null && option.partialInfo == true) {
+ if (option.partialInfo!= null) {
let ret : UniWifiInfo = {
SSID: wifiInfo.SSID
}
res.wifi = ret;
} else {
if (wifiInfo.BSSID == null || zeroCountNum(wifiInfo.BSSID) > 3) {
- res.errCode = 12005
- res.errMsg = "getConnectedWifi:fail:wifi is disable"
-
- option.fail?.(res)
- option.complete?.(res)
+ let err = new WifiFailImpl(getErrcode(12005));
+ option.fail?.(err)
+ option.complete?.(err)
return
}
res.wifi = wifiInfo;
}
- res.errCode = 0
- res.errMsg = "getConnectedWifi:ok"
option.success?.(res)
option.complete?.(res)
return
}
- option.fail?.(res)
- option.complete?.(res)
-}
\ No newline at end of file
+
+ let err = new WifiFailImpl(getErrcode(12000));
+ option.fail?.(err)
+ option.complete?.(err)
+}
+
diff --git a/uni_modules/uni-wifi/utssdk/app-ios/config.json b/uni_modules/uni-wifi/utssdk/app-ios/config.json
index 7308ee7964ed23676c12ec355ab1dcc0aa4c9d91..64d26133e3c8717c0a03dcf2327c09ee0635d86b 100644
--- a/uni_modules/uni-wifi/utssdk/app-ios/config.json
+++ b/uni_modules/uni-wifi/utssdk/app-ios/config.json
@@ -1,8 +1,9 @@
-{
- "frameworks": [
- "CoreLocation",
- "SystemConfiguration"
- ],
- "validArchitectures": [
- "arm64", "armv7" ]
+{
+ "frameworks": [
+ "CoreLocation.framework",
+ "SystemConfiguration.framework"
+ ],
+ "validArchitectures": [
+ "arm64", "armv7"
+ ]
}
\ No newline at end of file
diff --git a/uni_modules/uni-wifi/utssdk/app-ios/index.uts b/uni_modules/uni-wifi/utssdk/app-ios/index.uts
index 27f23ba64a84aa9fc9d040a68b04d55a29a3b858..f2bdb50dec0ca28eea7bb55e59ac7362ca9a21cd 100644
--- a/uni_modules/uni-wifi/utssdk/app-ios/index.uts
+++ b/uni_modules/uni-wifi/utssdk/app-ios/index.uts
@@ -3,20 +3,21 @@ import { CaptiveNetwork, kCNNetworkInfoKeySSID, kCNNetworkInfoKeyBSSID } from 'S
import { NSArray, NSDictionary } from 'Foundation';
import { CFString } from 'CoreFoundation';
import { UIDevice } from 'UIKit';
-import { WifiOption, WifiConnectOption, GetConnectedWifiOptions, UniWifiInfo, UniWifiResult, UniWifiCallback, StartWifi, StopWifi, GetWifiList, OnGetWifiList, OffGetWifiList, GetConnectedWifi, ConnectWifi, OnWifiConnected, OnWifiConnectedWithPartialInfo, OffWifiConnected, OnOffWifiConnectedWithPartialInfo, SetWifiList } from "../interface.uts"
+import { UniWifiResultCallbackWithPartialInfo, UniGetWifiListCallback, UniWifiResultCallback, WifiOption, WifiConnectOption, GetConnectedWifiOptions, UniWifiInfo, UniWifiResult, UniWifiCallback, StartWifi, StopWifi, GetWifiList, OnGetWifiList, OffGetWifiList, GetConnectedWifi, ConnectWifi, OnWifiConnected, OnWifiConnectedWithPartialInfo, OffWifiConnected, OffWifiConnectedWithPartialInfo, SetWifiList } from "../interface.uts"
+import { WifiFailImpl, getErrcode } from '../unierror';
-/*
+/*
* 系统定位权限获取类
*/
class LocationPromiseService implements CLLocationManagerDelegate {
static promiseCompletionHandler: ((res: boolean)=>void)[] = []
-
+
manager?: CLLocationManager
-
+
constructor(manager?: CLLocationManager) {
this.manager = manager
}
-
+
initlizeManager(): boolean {
if (this.manager == null) {
this.manager = new CLLocationManager()
@@ -24,20 +25,20 @@ class LocationPromiseService implements CLLocationManagerDelegate {
}
return true
}
-
+
locationManager(manager: CLLocationManager, @argumentLabel("didChangeAuthorization") status: CLAuthorizationStatus) {
if (status == CLAuthorizationStatus.authorizedAlways || status == CLAuthorizationStatus.authorizedWhenInUse) {
LocationPromiseService.promiseCompletionHandler.forEach((handler): void => {
handler(true)
})
- } else if (status == CLAuthorizationStatus.notDetermined) {
+ } else if (status == CLAuthorizationStatus.notDetermined) {
manager.requestWhenInUseAuthorization()
} else if (status == CLAuthorizationStatus.denied) {
LocationPromiseService.promiseCompletionHandler.forEach((handler): void => {
handler(false)
})
}
- }
+ }
requestPromise(@escaping completion: (res: boolean)=>void) {
let status: CLAuthorizationStatus = CLLocationManager.authorizationStatus()
if (status == CLAuthorizationStatus.notDetermined) {
@@ -52,20 +53,20 @@ class LocationPromiseService implements CLLocationManagerDelegate {
this.manager!.requestWhenInUseAuthorization()
LocationPromiseService.promiseCompletionHandler.push(completion)
}
- }
+ }
}
}
const locationPromiseService: LocationPromiseService = new LocationPromiseService(null)
-/*
- * 获取系统定位权限
+/*
+ * 获取系统定位权限
*/
function requestLocationPromise(@escaping completion: (res: boolean)=>void) {
locationPromiseService.requestPromise(completion)
}
-/*
+/*
* 获取当前连接的wifi信息(通过定位权限)
*/
function fetchConnectedWifiWithLocationPromise(option: GetConnectedWifiOptions) {
@@ -76,20 +77,20 @@ function fetchConnectedWifiWithLocationPromise(option: GetConnectedWifiOptions)
secure: false,
signalStrength: 0,
frequency: 0
- }
-
+ }
+
if (arr != null) {
let list = arr! as NSArray
- let index = 0
- while (index < list.count) {
- let item = list[index]
+ let index: Int = 0
+ while (index < list.count) {
+ let item = list[index]
let interfaceName = item as string
let dic = CNCopyCurrentNetworkInfo(interfaceName as CFString)
if (dic != null) {
let dict = dic! as NSDictionary
- let SSID = dict[kCNNetworkInfoKeySSID as string]
+ let SSID = dict[kCNNetworkInfoKeySSID as string]
let BSSID = dict[kCNNetworkInfoKeyBSSID as string]
-
+
if (SSID != null && BSSID != null) {
let ssid = SSID! as string
let bssid = BSSID! as string
@@ -103,7 +104,7 @@ function fetchConnectedWifiWithLocationPromise(option: GetConnectedWifiOptions)
}
index++
}
-
+
if (wifiInfo.BSSID!.length > 0 && wifiInfo.SSID.length > 0) {
let res: UniWifiResult = {
errSubject: "uni-getConnectedWifi",
@@ -114,30 +115,20 @@ function fetchConnectedWifiWithLocationPromise(option: GetConnectedWifiOptions)
option.success?.(res)
option.complete?.(res)
}else {
- const res: UniWifiResult = {
- errSubject: "uni-getConnectedWifi",
- errCode: 12010,
- errMsg: "getConnectedWifi:system internal error",
- wifi: null
- }
- option.fail?.(res)
- option.complete?.(res)
+ let err = new WifiFailImpl(getErrcode(12010));
+ option.fail?.(err)
+ option.complete?.(err)
}
}else {
- const res: UniWifiResult = {
- errSubject: "uni-getConnectedWifi",
- errCode: 12010,
- errMsg: "getConnectedWifi:system internal error",
- wifi: null
- }
- option.fail?.(res)
- option.complete?.(res)
+ let err = new WifiFailImpl(getErrcode(12010));
+ option.fail?.(err)
+ option.complete?.(err)
}
}
-/*
+/*
* 保存全局数据信息
*/
class UniWiFiModuleGloabInfo {
@@ -148,14 +139,14 @@ class UniWiFiModuleGloabInfo {
-/*
- * 初始化wifi模块
+/*
+ * 初始化wifi模块
*/
export const startWifi: StartWifi = function (option: WifiOption) {
UniWiFiModuleGloabInfo.alreadyStartWifi = true
let res: UniWifiResult = {
errSubject: "uni-startWifi",
- errCode: 0,
+ errCode: 0,
errMsg: "startWifi:ok",
wifi: null
}
@@ -163,44 +154,39 @@ export const startWifi: StartWifi = function (option: WifiOption) {
option.complete?.(res)
}
-/*
- * 停止wifi模块
+/*
+ * 停止wifi模块
*/
export const stopWifi: StopWifi = function (option: WifiOption) {
UniWiFiModuleGloabInfo.alreadyStartWifi = false
- LocationPromiseService.promiseCompletionHandler = []
+ LocationPromiseService.promiseCompletionHandler = []
let res: UniWifiResult = {
errSubject: "uni-stopWifi",
- errCode: 0,
+ errCode: 0,
errMsg: "stopWifi:ok",
wifi: null
- }
+ }
option.success?.(res)
option.complete?.(res)
}
-/*
+/*
* 获取wifi列表, 在调用之前需要引导用户跳转到系统设置-WIFI设置页面,系统搜索周边wifi后app才能接收到回调
*/
export const getWifiList: GetWifiList = function (option: WifiOption) {
- let res: UniWifiResult = {
- errSubject: "uni-getWifiList",
- errCode: 12001,
- errMsg: "getWifiList:system not support",
- wifi: null
- }
- option.fail?.(res)
- option.complete?.(res)
+ let err = new WifiFailImpl(getErrcode(12001));
+ option.fail?.(err)
+ option.complete?.(err)
}
/* 获取wifi列表的回调
* note: 请在getWifiList方法的回调里调用该方法
*/
-export const onGetWifiList: OnGetWifiList = function (callback: UniWifiCallback) {
-
+export const onGetWifiList: OnGetWifiList = function (callback: UniGetWifiListCallback) {
+
}
-/*
+/*
* 注销获取wifi列表的回调
*/
export const offGetWifiList: OffGetWifiList = function (callback: UniWifiCallback) {
@@ -208,33 +194,23 @@ export const offGetWifiList: OffGetWifiList = function (callback: UniWifiCallbac
}
-/*
+/*
* 获取当前连接的wifi信息
*/
export const getConnectedWifi: GetConnectedWifi = function (option: GetConnectedWifiOptions) {
if (UniWiFiModuleGloabInfo.alreadyStartWifi == false) {
- let res: UniWifiResult = {
- errSubject: "uni-getConnectedWifi",
- errCode: 12000,
- errMsg: "getConnectedWifi:not init",
- wifi: null
- }
- option.fail?.(res)
- option.complete?.(res)
+ let err = new WifiFailImpl(getErrcode(12000));
+ option.fail?.(err)
+ option.complete?.(err)
} else{
if (UIDevice.current.systemVersion >= "13.0") {
requestLocationPromise((success) => {
if (success == true) {
fetchConnectedWifiWithLocationPromise(option)
}else {
- let res: UniWifiResult = {
- errSubject: "uni-getConnectedWifi",
- errCode: 12007,
- errMsg: "getConnectedWifi:user denied",
- wifi: null
- }
- option.fail?.(res)
- option.complete?.(res)
+ let err = new WifiFailImpl(getErrcode(12007));
+ option.fail?.(err)
+ option.complete?.(err)
}
})
} else{
@@ -243,59 +219,50 @@ export const getConnectedWifi: GetConnectedWifi = function (option: GetConnected
}
}
-/*
+/*
* 连接wifi
*/
export const connectWifi: ConnectWifi = function (option: WifiConnectOption) {
- let res: UniWifiResult = {
- errSubject: "uni-connectWifi",
- errCode: 12001,
- errMsg: "connectWifi:system not support",
- wifi: null
- }
- option.fail?.(res)
- option.complete?.(res)
+
+ let err = new WifiFailImpl(getErrcode(12001));
+ option.fail?.(err)
+ option.complete?.(err)
}
-/*
+/*
* 连上wifi事件的监听函数
*/
-export const onWifiConnected: OnWifiConnected = function (callback: UniWifiCallback) {
-
+export const onWifiConnected: OnWifiConnected = function (callback: UniWifiResultCallback) {
+
}
-/*
+/*
* 连上wifi事件的监听函数, wifiInfo仅包含ssid
*/
-export const onWifiConnectedWithPartialInfo: OnWifiConnectedWithPartialInfo = function (callback: UniWifiCallback) {
-
+export const onWifiConnectedWithPartialInfo: OnWifiConnectedWithPartialInfo = function (callback: UniWifiResultCallbackWithPartialInfo) {
+
}
-/*
+/*
* 移除连接上wifi的事件的监听函数,不传此参数则移除所有监听函数。
*/
export const offWifiConnected: OffWifiConnected = function (callback: UniWifiCallback | null) {
}
-/*
+/*
* 移除连接上wifi的事件的监听函数,不传此参数则移除所有监听函数。
*/
-export const onOffWifiConnectedWithPartialInfo: OnOffWifiConnectedWithPartialInfo = function (callback: UniWifiCallback | null) {
+export const offWifiConnectedWithPartialInfo: OffWifiConnectedWithPartialInfo = function (callback: UniWifiResultCallbackWithPartialInfo | null) {
}
-/*
+/*
* 设置 wifiList 中 AP 的相关信息。在 onGetWifiList 回调后调用,iOS特有接口。
*/
export const setWifiList: SetWifiList = function (option: WifiOption) {
- let res: UniWifiResult = {
- errSubject: "uni-setWifiList",
- errCode: 12001,
- errMsg: "setWifiList:system not support",
- wifi: null
- }
- option.fail?.(res)
- option.complete?.(res)
-}
\ No newline at end of file
+ let err = new WifiFailImpl(getErrcode(12001));
+ option.fail?.(err)
+ option.complete?.(err)
+}
diff --git a/uni_modules/uni-wifi/utssdk/index.d.ts b/uni_modules/uni-wifi/utssdk/index.d.ts
new file mode 100644
index 0000000000000000000000000000000000000000..64f08293f7e94642d83f3e04c2fb08997966d773
--- /dev/null
+++ b/uni_modules/uni-wifi/utssdk/index.d.ts
@@ -0,0 +1,388 @@
+declare namespace UniNamespace {
+
+ type UniWifiComplete = any
+ type WifiSuccessCallback = (res : UniWifiResult) => void
+ type WifiFailCallback = (err : UniWifiFail) => void
+ type WifiCompleteCallback = (res : UniWifiComplete) => void
+ type UniWifiCallback = () => void
+
+
+ type WifiErrorCode = 1300002
+
+ interface UniWifiInfo {
+ SSID : string;
+ BSSID ?: string;
+ secure ?: boolean;
+ signalStrength ?: number;
+ frequency ?: number;
+ }
+
+ interface UniWifiResult {
+ errCode : number,
+ errSubject : string,
+ errMsg : string,
+ wifi : UniWifiInfo | null
+ }
+
+ interface UniWifiFail {
+ errCode : WifiErrorCode
+ }
+
+ interface WifiConnectOption {
+ SSID : string | null;
+ BSSID : string | null;
+ password : string | null;
+ maunal : boolean | null;
+ partialInfo : boolean | null; //ios不生效
+ success : WifiSuccessCallback | null;
+ fail : WifiFailCallback | null;
+ complete : WifiCompleteCallback | null;
+ }
+
+ interface GetConnectedWifiOptions {
+ partialInfo : boolean | null;
+ success : WifiSuccessCallback | null;
+ fail : WifiFailCallback | null;
+ complete ?: WifiCompleteCallback | null;
+ }
+
+
+ interface WifiOption {
+ success : WifiSuccessCallback | null,
+ fail : WifiFailCallback | null,
+ complete : InstallApkCompleteCallback | null
+ }
+
+ interface UniWifiInfoWithPartialInfo {
+ SSID : string;
+ }
+
+ type UniGetWifiListCallback = (wifiInfo:UTSJSONObject) => void
+
+ type UniWifiResultCallback = (wifiInfo:UniWifiResult) => void
+
+ type UniWifiResultCallbackWithPartialInfo = (wifiInfo:UniWifiInfoWithPartialInfo) => void
+
+}
+
+declare interface Uni {
+
+ /**
+ * 初始化Wi-Fi模块
+ *
+ * @param {WifiOption} option
+ * @tutorial https://uniapp.dcloud.net.cn/api/system/wifi.html#startwifi
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "4.4.4",
+ * "uniVer": "3.7.0",
+ * "unixVer": "3.9.0"
+ * },
+ * "ios": {
+ * "osVer": "9.0",
+ * "uniVer": "3.7.7",
+ * "unixVer": "3.9.0"
+ * }
+ * }
+ * }
+ * @uniVersion 3.7.7
+ * @uniVueVersion 2,3 //支持的vue版本
+ * @autotest { after: 'stopWifi' }
+ */
+ startWifi(option : UniNamespace.WifiOption): void,
+
+ /**
+ * 关闭 Wi-Fi 模块
+ *
+ * @param {WifiOption} option
+ * @tutorial https://uniapp.dcloud.net.cn/api/system/wifi.html#stopwifi
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "4.4.4",
+ * "uniVer": "3.7.0",
+ * "unixVer": "3.9.0"
+ * },
+ * "ios": {
+ * "osVer": "9.0",
+ * "uniVer": "3.7.7",
+ * "unixVer": "3.9.0"
+ * }
+ * }
+ * }
+ * @uniVersion 3.7.7
+ * @uniVueVersion 2,3 //支持的vue版本
+ * @autotest { before: 'startWifi' }
+ */
+ stopWifi(option : UniNamespace.WifiOption) : void,
+ /**
+ * @param {WifiConnectOption} option
+ * @tutorial https://uniapp.dcloud.net.cn/api/system/wifi.html#connectWifi
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": ">=4.4 && <10.0",
+ * "uniVer": "3.7.0",
+ * "unixVer": "3.9.0"
+ * },
+ * "ios": {
+ * "osVer": "9.0",
+ * "uniVer": "3.7.7",
+ * "unixVer": "3.9.0"
+ * }
+ * }
+ * }
+ * @uniVersion 3.7.7
+ * @uniVueVersion 2,3 //支持的vue版本
+ * @autotest {
+ generated: false,
+ pollution: false,
+ cases:[
+ {
+ before: 'startWifi',
+ after: 'stopWifi',
+ input: [{
+ maunal:false,
+ SSID:"Xiaomi_20D0",
+ password:"streamApp!2016",
+ }],
+ output:{
+ callbackType: 'success',
+ value: { errCode: 12013 ,errMsg: "connectWifi:wifi config may be expired",errSubject: "uni-connectWifi"}
+ }
+ }
+ ]
+ }
+ */
+ connectWifi(option : UniNamespace.WifiConnectOption) : void,
+ /**
+ * 请求获取 Wi-Fi 列表。wifiList 数据会在 onGetWifiList 注册的回调中返回。
+ * @param {WifiOption} option
+ * @tutorial https://uniapp.dcloud.net.cn/api/system/wifi.html#getWifiList
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "4.4.4",
+ * "uniVer": "3.7.0",
+ * "unixVer": "3.9.0"
+ * },
+ * "ios": {
+ * "osVer": "9.0",
+ * "uniVer": "3.7.7",
+ * "unixVer": "3.9.0"
+ * }
+ * }
+ * }
+ * @uniVersion 3.7.7
+ * @uniVueVersion 2,3 //支持的vue版本
+ * @autotest { before: 'startWifi', after: 'stopWifi' }
+ */
+ getWifiList(option : UniNamespace.WifiOption) : void,
+ /**
+ * 监听获取到 Wi-Fi 列表数据事件。
+ *
+ * @param {UniWifiCallback} callback
+ * @tutorial https://uniapp.dcloud.net.cn/api/system/wifi.html#onGetWifiList
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "4.4.4",
+ * "uniVer": "3.7.0",
+ * "unixVer": "3.9.0"
+ * },
+ * "ios": {
+ * "osVer": "9.0",
+ * "uniVer": "3.7.7",
+ * "unixVer": "3.9.0"
+ * }
+ * }
+ * }
+ * @uniVersion 3.7.7
+ * @uniVueVersion 2,3 //支持的vue版本
+ * @autotest { expectCallback: true }
+ * @autotest {
+ generated: false,
+ pollution: false,
+ expectCallback: true,
+ before: 'startWifi',
+ after: 'onGetWifiListAfter',
+ cases: [
+ {
+ output: {
+ value: 0,
+ returnKey: '.wifiList.length',
+ jestExpectSyntax: 'toBeGreaterThan'
+ },
+ }
+ ]
+ }
+ */
+ onGetWifiList(callback : UniNamespace.UniGetWifiListCallback) : void,
+ /**
+ * 移除获取到 Wi-Fi 列表数据事件的监听函数。
+ *
+ * @param {UniWifiCallback} callback
+ * @tutorial https://uniapp.dcloud.net.cn/api/system/wifi.html#offGetWifiList
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "4.4.4",
+ * "uniVer": "3.7.0",
+ * "unixVer": "3.9.0"
+ * },
+ * "ios": {
+ * "osVer": "9.0",
+ * "uniVer": "3.7.7",
+ * "unixVer": "3.9.0"
+ * }
+ * }
+ * }
+ * @uniVersion 3.7.7
+ * @uniVueVersion 2,3 //支持的vue版本
+ * @autotest { expectCallback: true }
+ */
+ offGetWifiList(callback : UniNamespace.UniWifiCallback) : void,
+ /**
+ * 获取已连接的 Wi-Fi 信息
+ *
+ * @param {GetConnectedWifiOptions} option
+ * @tutorial https://uniapp.dcloud.net.cn/api/system/wifi.html#getConnectedWifi
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "4.4.4",
+ * "uniVer": "3.7.0",
+ * "unixVer": "3.9.0"
+ * },
+ * "ios": {
+ * "osVer": "9.0",
+ * "uniVer": "3.7.7",
+ * "unixVer": "3.9.0"
+ * }
+ * }
+ * }
+ * @uniVersion 3.7.7
+ * @uniVueVersion 2,3 //支持的vue版本
+ * @autotest { before: 'startWifi', after: 'stopWifi' }
+ */
+ getConnectedWifi(option : UniNamespace.GetConnectedWifiOptions) : void,
+ /**
+ * 监听连接上 Wi-Fi 的事件
+ *
+ * @param {UniWifiCallback} callback
+ * @tutorial https://uniapp.dcloud.net.cn/api/system/wifi.html#onWifiConnected
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "4.4.4",
+ * "uniVer": "3.7.0",
+ * "unixVer": "3.9.0"
+ * },
+ * "ios": {
+ * "osVer": "9.0",
+ * "uniVer": "3.7.7",
+ * "unixVer": "3.9.0"
+ * }
+ * }
+ * }
+ * @uniVersion 3.7.7
+ * @uniVueVersion 2,3 //支持的vue版本
+ * @autotest { expectCallback: true }
+ */
+ onWifiConnected(callback : UniNamespace.UniWifiResultCallback) : void,
+ /**
+ * 监听连接上 Wi-Fi 的事件。
+ *
+ * @param {UniWifiCallback} callback
+ * @tutorial https://uniapp.dcloud.net.cn/api/system/wifi.html#onWifiConnectedWithPartialInfo
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "4.4.4",
+ * "uniVer": "3.7.0",
+ * "unixVer": "3.9.0"
+ * },
+ * "ios": {
+ * "osVer": "9.0",
+ * "uniVer": "3.7.7",
+ * "unixVer": "3.9.0"
+ * }
+ * }
+ * }
+ * @uniVersion 3.7.7
+ * @uniVueVersion 2,3 //支持的vue版本
+ * @autotest { expectCallback: true }
+ */
+ onWifiConnectedWithPartialInfo(callback : UniNamespace.UniWifiResultCallbackWithPartialInfo) : void,
+ /**
+ * 移除连接上 Wi-Fi 的事件的监听函数。
+ *
+ * @param {UniWifiCallback} callback
+ * @tutorial https://uniapp.dcloud.net.cn/api/system/wifi.html#offWifiConnected
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "4.4.4",
+ * "uniVer": "3.7.0",
+ * "unixVer": "3.9.0"
+ * },
+ * "ios": {
+ * "osVer": "9.0",
+ * "uniVer": "3.7.7",
+ * "unixVer": "3.9.0"
+ * }
+ * }
+ * }
+ * @uniVersion 3.7.7
+ * @uniVueVersion 2,3 //支持的vue版本
+ * @autotest { expectCallback: true }
+ */
+ offWifiConnected(callback ?: UniNamespace.UniWifiCallback) : void,
+
+ /**
+ * 移除连接上 Wi-Fi 的事件的监听函数。
+ *
+ * @param {UniWifiCallback} callback
+ * @tutorial https://uniapp.dcloud.net.cn/api/system/wifi.html#offWifiConnectedWithPartialInfo
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "x",
+ * "uniVer": "x",
+ * "unixVer": "x"
+ * },
+ * "ios": {
+ * "osVer": "x",
+ * "uniVer": "x",
+ * "unixVer": "x"
+ * }
+ * }
+ * }
+ * @uniVersion 3.7.7
+ * @uniVueVersion 2,3 //支持的vue版本
+ * @autotest { expectCallback: true }
+ */
+ offWifiConnectedWithPartialInfo(callback ?: UniNamespace.UniWifiResultCallbackWithPartialInfo) : void,
+ /**
+ * SetWifiList 暂未实现
+ *
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "x",
+ * "uniVer": "x",
+ * "unixVer": "x"
+ * },
+ * "ios": {
+ * "osVer": "x",
+ * "uniVer": "x",
+ * "unixVer": "x"
+ * }
+ * }
+ * }
+ */
+ setWifiList(option : UniNamespace.WifiOption) : void,
+
+
+}
diff --git a/uni_modules/uni-wifi/utssdk/interface.uts b/uni_modules/uni-wifi/utssdk/interface.uts
index 8c54c2eb81598df04520c2a466916bcac3824f93..db0ba89fcad6fe4e8a3a965b569347c5f41a9a59 100644
--- a/uni_modules/uni-wifi/utssdk/interface.uts
+++ b/uni_modules/uni-wifi/utssdk/interface.uts
@@ -1,45 +1,49 @@
/**
* Wifi 函数通用入参封装
*/
- export type WifiOption = {
- success?: (res: UniWifiResult) => void;
- fail?: (res: UniWifiResult) => void;
- complete?: (res: UniWifiResult) => void;
+export type WifiOption = {
+ success ?: (res : UniWifiResult) => void;
+ fail ?: (res : UniError) => void;
+ complete ?: (res : any) => void;
};
/**
- * Wifi 链接参数封装
+ * Wifi 链接参数封装
*/
export type WifiConnectOption = {
- SSID?: string;
- BSSID?: string;
- password?: string;
- maunal?: boolean;
- partialInfo?: boolean; //ios不生效
- success?: (res: UniWifiResult) => void;
- fail?: (res: UniWifiResult) => void;
- complete?: (res: UniWifiResult) => void;
+ SSID ?: string;
+ BSSID ?: string;
+ password ?: string;
+ maunal ?: boolean;
+ partialInfo ?: boolean; //ios不生效
+ success ?: (res : UniWifiResult) => void;
+ fail ?: (res : UniError) => void;
+ complete ?: (res : any) => void;
}
/**
* 获取当前链接的wifi信息
*/
export type GetConnectedWifiOptions = {
- partialInfo?: boolean
- success?: (res: UniWifiResult) => void
- fail?: (res: UniWifiResult) => void
- complete?: (res: UniWifiResult) => void
+ partialInfo ?: boolean
+ success ?: (res : UniWifiResult) => void
+ fail ?: (res : UniError) => void
+ complete ?: (res : any) => void
}
-/*
+/*
* 对外暴露的wifi信息
*/
export type UniWifiInfo = {
- SSID: string;
- BSSID?: string;
- secure?: boolean;
- signalStrength?: number;
- frequency?: number;
+ SSID : string;
+ BSSID ?: string;
+ secure ?: boolean;
+ signalStrength ?: number;
+ frequency ?: number;
+}
+
+export type UniWifiInfoWithPartialInfo = {
+ SSID : string;
}
@@ -47,40 +51,129 @@ export type UniWifiResult = {
errCode : number,
errSubject : string,
errMsg : string,
- wifi: UniWifiInfo | null
+ wifi : UniWifiInfo | null
}
export type UniWifiCallback = () => void
+export type UniGetWifiListCallback = (wifiInfo:UTSJSONObject) => void
+
+export type UniWifiResultCallback = (wifiInfo:UniWifiResult) => void
+
+export type UniWifiResultCallbackWithPartialInfo = (wifiInfo:UniWifiInfoWithPartialInfo) => void
+
+
+export type StartWifi = (option : WifiOption) => void
+
+export type StopWifi = (option : WifiOption) => void
+
+export type GetWifiList = (option : WifiOption) => void
-export type StartWifi = (option: WifiOption) => void
+export type OnGetWifiList = (callback : UniGetWifiListCallback) => void
-export type StopWifi = (option: WifiOption) => void
+export type OffGetWifiList = (callback : UniWifiCallback) => void
-export type GetWifiList = (option: WifiOption) => void
+export type GetConnectedWifi = (option : GetConnectedWifiOptions) => void
-export type OnGetWifiList = (callback: UniWifiCallback) => void
+export type ConnectWifi = (option : WifiConnectOption) => void
-export type OffGetWifiList = (callback: UniWifiCallback) => void
+export type OnWifiConnected = (callback : UniWifiResultCallback) => void
-export type GetConnectedWifi = (option: GetConnectedWifiOptions) => void
+export type OnWifiConnectedWithPartialInfo = (callback : UniWifiResultCallbackWithPartialInfo) => void
-export type ConnectWifi = (option: WifiConnectOption) => void
+export type OffWifiConnected = (callback : UniWifiCallback | null) => void
-export type OnWifiConnected = (callback: UniWifiCallback) => void
+export type OffWifiConnectedWithPartialInfo = (callback : UniWifiResultCallbackWithPartialInfo | null) => void
-export type OnWifiConnectedWithPartialInfo = (callback: UniWifiCallback) => void
+export type SetWifiList = (option : WifiOption) => void
-export type OffWifiConnected = (callback: UniWifiCallback | null) => void
-export type OnOffWifiConnectedWithPartialInfo = (callback: UniWifiCallback | null) => void
+/**
+ * 错误码
+ * - 12000 尚未初始化
+ * - 12001 当前系统不支持相关能力
+ * - 12002 密码错误
+ * - 12005 Android 特有,未打开 Wi-Fi 开关
+ * - 12007 用户拒绝授权链接 Wi-Fi
+ * - 12010 系统其他错误
+ * - 12013 系统保存的 Wi-Fi 配置过期,建议忘记 Wi-Fi 后重试,仅 Android 支持
+ */
+export type WifiErrorCode = 12000 |12001 | 12002 | 12005 | 12007 | 12010 | 12013;
+
+export interface WifiFail extends IUniError{
+ errCode: WifiErrorCode
+};
+
-export type SetWifiList = (option: WifiOption) => void
interface Uni {
- startWifi : StartWifi,
- stopWifi : StopWifi,
/**
+ * 初始化Wi-Fi模块
+ *
+ * @param {WifiOption} option
+ * @tutorial https://uniapp.dcloud.net.cn/api/system/wifi.html#startwifi
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "4.4.4",
+ * "uniVer": "3.7.0",
+ * "unixVer": "3.9.0"
+ * },
+ * "ios": {
+ * "osVer": "9.0",
+ * "uniVer": "3.7.7",
+ * "unixVer": "x"
+ * }
+ * }
+ * }
+ * @uniVersion 3.7.7
+ * @uniVueVersion 2,3 //支持的vue版本
+ * @autotest { after: 'stopWifi' }
+ */
+ startWifi(option : WifiOption): void,
+ /**
+ * 关闭 Wi-Fi 模块
+ *
+ * @param {WifiOption} option
+ * @tutorial https://uniapp.dcloud.net.cn/api/system/wifi.html#stopwifi
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "4.4.4",
+ * "uniVer": "3.7.0",
+ * "unixVer": "x"
+ * },
+ * "ios": {
+ * "osVer": "9.0",
+ * "uniVer": "3.7.7",
+ * "unixVer": "x"
+ * }
+ * }
+ * }
+ * @uniVersion 3.7.7
+ * @uniVueVersion 2,3 //支持的vue版本
+ * @autotest { before: 'startWifi' }
+ */
+ stopWifi(option : WifiOption) : void,
+ /**
+ * @param {WifiConnectOption} option
+ * @tutorial https://uniapp.dcloud.net.cn/api/system/wifi.html#connectWifi
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": ">=4.4 && <10.0",
+ * "uniVer": "3.7.0",
+ * "unixVer": "3.9.0"
+ * },
+ * "ios": {
+ * "osVer": "9.0",
+ * "uniVer": "3.7.7",
+ * "unixVer": "x"
+ * }
+ * }
+ * }
+ * @uniVersion 3.7.7
+ * @uniVueVersion 2,3 //支持的vue版本
* @autotest {
generated: false,
pollution: false,
@@ -94,32 +187,238 @@ interface Uni {
password:"streamApp!2016",
}],
output:{
- callbackType: 'success',
- value: { errCode: 12013 ,errMsg: "connectWifi:wifi config may be expired",errSubject: "uni-connectWifi"}
- }
+ callbackType: 'success',
+ value: { errCode: 12013 ,errMsg: "connectWifi:wifi config may be expired",errSubject: "uni-connectWifi"}
+ }
}
]
}
*/
- connectWifi: ConnectWifi,
+ connectWifi(option : WifiConnectOption) : void,
/**
+ * 请求获取 Wi-Fi 列表。wifiList 数据会在 onGetWifiList 注册的回调中返回。
+ * @param {WifiOption} option
+ * @tutorial https://uniapp.dcloud.net.cn/api/system/wifi.html#getWifiList
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "4.4.4",
+ * "uniVer": "3.7.0",
+ * "unixVer": "3.9.0"
+ * },
+ * "ios": {
+ * "osVer": "9.0",
+ * "uniVer": "3.7.7",
+ * "unixVer": "x"
+ * }
+ * }
+ * }
+ * @uniVersion 3.7.7
+ * @uniVueVersion 2,3 //支持的vue版本
+ * @autotest { before: 'startWifi', after: 'stopWifi' }
+ */
+ getWifiList(option : WifiOption) : void,
+ /**
+ * 监听获取到 Wi-Fi 列表数据事件。
+ *
+ * @param {UniWifiCallback} callback
+ * @tutorial https://uniapp.dcloud.net.cn/api/system/wifi.html#onGetWifiList
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "4.4.4",
+ * "uniVer": "3.7.0",
+ * "unixVer": "3.9.0"
+ * },
+ * "ios": {
+ * "osVer": "9.0",
+ * "uniVer": "3.7.7",
+ * "unixVer": "x"
+ * }
+ * }
+ * }
+ * @uniVersion 3.7.7
+ * @uniVueVersion 2,3 //支持的vue版本
+ * @autotest { expectCallback: true }
* @autotest {
- generated: false,
- cases:[
- {
- before: 'startWifi',
- after: 'stopWifi'
- }
- ]
+ generated: false,
+ pollution: false,
+ expectCallback: true,
+ before: 'startWifi',
+ after: 'onGetWifiListAfter',
+ cases: [
+ {
+ output: {
+ value: 0,
+ returnKey: '.wifiList.length',
+ jestExpectSyntax: 'toBeGreaterThan'
+ },
+ }
+ ]
}
- */
- getWifiList : GetWifiList,
- onGetWifiList : OnGetWifiList,
- offGetWifiList : OffGetWifiList,
- getConnectedWifi : GetConnectedWifi,
- onWifiConnected : OnWifiConnected,
- onWifiConnectedWithPartialInfo : OnWifiConnectedWithPartialInfo,
- offWifiConnected : OffWifiConnected,
- onOffWifiConnectedWithPartialInfo : OnOffWifiConnectedWithPartialInfo,
- setWifiList : SetWifiList,
+ */
+ onGetWifiList(callback : UniGetWifiListCallback) : void,
+ /**
+ * 移除获取到 Wi-Fi 列表数据事件的监听函数。
+ *
+ * @param {UniWifiCallback} callback
+ * @tutorial https://uniapp.dcloud.net.cn/api/system/wifi.html#offGetWifiList
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "4.4.4",
+ * "uniVer": "3.7.0",
+ * "unixVer": "3.9.0"
+ * },
+ * "ios": {
+ * "osVer": "9.0",
+ * "uniVer": "3.7.7",
+ * "unixVer": "x"
+ * }
+ * }
+ * }
+ * @uniVersion 3.7.7
+ * @uniVueVersion 2,3 //支持的vue版本
+ * @autotest { expectCallback: true }
+ */
+ offGetWifiList(callback : UniWifiCallback) : void,
+ /**
+ * 获取已连接的 Wi-Fi 信息
+ *
+ * @param {GetConnectedWifiOptions} option
+ * @tutorial https://uniapp.dcloud.net.cn/api/system/wifi.html#getConnectedWifi
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "4.4.4",
+ * "uniVer": "3.7.0",
+ * "unixVer": "3.9.0"
+ * },
+ * "ios": {
+ * "osVer": "9.0",
+ * "uniVer": "3.7.7",
+ * "unixVer": "x"
+ * }
+ * }
+ * }
+ * @uniVersion 3.7.7
+ * @uniVueVersion 2,3 //支持的vue版本
+ * @autotest { before: 'startWifi', after: 'stopWifi' }
+ */
+ getConnectedWifi(option : GetConnectedWifiOptions) : void,
+ /**
+ * 监听连接上 Wi-Fi 的事件
+ *
+ * @param {UniWifiCallback} callback
+ * @tutorial https://uniapp.dcloud.net.cn/api/system/wifi.html#onWifiConnected
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "4.4.4",
+ * "uniVer": "3.7.0",
+ * "unixVer": "3.9.0"
+ * },
+ * "ios": {
+ * "osVer": "9.0",
+ * "uniVer": "3.7.7",
+ * "unixVer": "x"
+ * }
+ * }
+ * }
+ * @uniVersion 3.7.7
+ * @uniVueVersion 2,3 //支持的vue版本
+ * @autotest { expectCallback: true }
+ */
+ onWifiConnected(callback : UniWifiResultCallback) : void,
+ /**
+ * 监听连接上 Wi-Fi 的事件。
+ *
+ * @param {UniWifiCallback} callback
+ * @tutorial https://uniapp.dcloud.net.cn/api/system/wifi.html#onWifiConnectedWithPartialInfo
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "4.4.4",
+ * "uniVer": "3.7.0",
+ * "unixVer": "3.9.0"
+ * },
+ * "ios": {
+ * "osVer": "9.0",
+ * "uniVer": "3.7.7",
+ * "unixVer": "x"
+ * }
+ * }
+ * }
+ * @uniVersion 3.7.7
+ * @uniVueVersion 2,3 //支持的vue版本
+ * @autotest { expectCallback: true }
+ */
+ onWifiConnectedWithPartialInfo(callback : UniWifiResultCallbackWithPartialInfo) : void,
+ /**
+ * 移除连接上 Wi-Fi 的事件的监听函数。
+ *
+ * @param {UniWifiCallback} callback
+ * @tutorial https://uniapp.dcloud.net.cn/api/system/wifi.html#offWifiConnected
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "4.4.4",
+ * "uniVer": "3.7.0",
+ * "unixVer": "3.9.0"
+ * },
+ * "ios": {
+ * "osVer": "9.0",
+ * "uniVer": "3.7.7",
+ * "unixVer": "x"
+ * }
+ * }
+ * }
+ * @uniVersion 3.7.7
+ * @uniVueVersion 2,3 //支持的vue版本
+ * @autotest { expectCallback: true }
+ */
+ offWifiConnected(callback : UniWifiCallback | null) : void,
+ /**
+ * 移除连接上 Wi-Fi 的事件的监听函数。
+ *
+ * @param {UniWifiCallback} callback
+ * @tutorial https://uniapp.dcloud.net.cn/api/system/wifi.html#offWifiConnectedWithPartialInfo
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "x",
+ * "uniVer": "x",
+ * "unixVer": "x"
+ * },
+ * "ios": {
+ * "osVer": "x",
+ * "uniVer": "x",
+ * "unixVer": "x"
+ * }
+ * }
+ * }
+ * @uniVersion 3.7.7
+ * @uniVueVersion 2,3 //支持的vue版本
+ * @autotest { expectCallback: true }
+ */
+ offWifiConnectedWithPartialInfo(callback : UniWifiResultCallbackWithPartialInfo | null) : void,
+ /**
+ * SetWifiList 暂未实现
+ *
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "x",
+ * "uniVer": "x",
+ * "unixVer": "x"
+ * },
+ * "ios": {
+ * "osVer": "x",
+ * "uniVer": "x",
+ * "unixVer": "x"
+ * }
+ * }
+ * }
+ */
+ setWifiList(option : WifiOption) : void,
}
diff --git a/uni_modules/uni-wifi/utssdk/uni.autotest.js b/uni_modules/uni-wifi/utssdk/uni.autotest.js
index 93873d525a3ea40fb0db01ad2d71414106ed9b2e..7f0ac09aca2495568be791c7c702e84a986e48e9 100644
--- a/uni_modules/uni-wifi/utssdk/uni.autotest.js
+++ b/uni_modules/uni-wifi/utssdk/uni.autotest.js
@@ -1,35 +1,35 @@
-function startWifi() {
+export function startWifi() {
return new Promise((resolve, reject) => {
uni.startWifi({
success: () => {
console.log('startWifi success');
resolve()
},
- fail: () => {
+ complete: () => {
console.log('startWifi fail');
- reject()
+ resolve()
}
})
})
}
-function stopWifi() {
+export function stopWifi() {
return new Promise((resolve, reject) => {
uni.stopWifi({
- success: () => {
- console.log('stopWifi success');
- resolve()
- },
- fail: () => {
- console.log('stopWifi success');
- fail()
- }
+ complete: resolve
})
})
}
-
-module.exports = {
- startWifi,
- stopWifi
-}
+export function onGetWifiListAfter() {
+ return new Promise((resolve, reject) => {
+ uni.getWifiList({
+ success() {
+ setTimeout(resolve, 500)
+ },
+ complete() {
+ stopWifi().finally(resolve)
+ }
+ })
+ })
+}
\ No newline at end of file
diff --git a/uni_modules/uni-wifi/utssdk/unierror.uts b/uni_modules/uni-wifi/utssdk/unierror.uts
new file mode 100644
index 0000000000000000000000000000000000000000..023c2de9ae886b844051c8e247ac225e7cfe939e
--- /dev/null
+++ b/uni_modules/uni-wifi/utssdk/unierror.uts
@@ -0,0 +1,59 @@
+import { WifiErrorCode, WifiFail} from "./interface.uts"
+
+/**
+ * 错误主题
+ */
+export const UniErrorSubject = 'uni-wifi';
+/**
+ * 错误码
+ * @UniError
+ */
+export const WifiUniErrors : Map = new Map([
+
+ /**
+ * 未先调用 startWifi 接口
+ */
+ [12000, 'not init.'],
+ /**
+ * 当前系统不支持相关能力
+ */
+ [12001, 'system not support'],
+ /**
+ * 密码错误
+ */
+ [12002, 'password error Wi-Fi'],
+ /**
+ * Android 特有,未打开 Wi-Fi 开关
+ */
+ [12005, 'wifi not turned on'],
+ /**
+ * 用户拒绝授权链接 Wi-Fi
+ */
+ [12007, 'user denied'],
+ /**
+ * 系统其他错误,需要在 errmsg 打印具体的错误原因
+ */
+ [12010, 'unknown error'],
+ /**
+ * 系统保存的 Wi-Fi 配置过期,建议忘记 Wi-Fi 后重试,仅 Android 支持
+ */
+ [12013, 'wifi config may be expired'],
+
+]);
+
+
+export function getErrcode(errCode : number) : WifiErrorCode {
+ const res = WifiUniErrors[errCode];
+ return res == null ? 12000 : errCode;
+}
+
+
+export class WifiFailImpl extends UniError implements WifiFail {
+ constructor(errCode : WifiErrorCode) {
+ super();
+ this.errSubject = UniErrorSubject;
+ this.errCode = errCode;
+ this.errMsg = WifiUniErrors[errCode] ?? "";
+ }
+}
+
diff --git a/uni_modules/uts-progressNotification/changelog.md b/uni_modules/uts-progressNotification/changelog.md
new file mode 100644
index 0000000000000000000000000000000000000000..332470475bb5475b7d3b24b633c91917f4dce414
--- /dev/null
+++ b/uni_modules/uts-progressNotification/changelog.md
@@ -0,0 +1,18 @@
+## 1.0.7(2023-12-11)
+去除无用代码
+## 1.0.6(2023-12-11)
+修改文档
+## 1.0.5(2023-12-11)
+1.修改插件名称
+2.修改插件引入方式为import导入
+## 1.0.4(2023-11-30)
+1. createNotificationProgress增加`onClick`回调
+2.修复在小米部分系统上,通知消息会归类于不重要通知的bug
+## 1.0.3(2023-11-28)
+更新截图
+## 1.0.2(2023-11-28)
+修改资源的包名
+## 1.0.1(2023-11-28)
+更新文档
+## 1.0.0(2023-11-28)
+Android通知栏显示进度插件
diff --git a/uni_modules/uts-progressNotification/package.json b/uni_modules/uts-progressNotification/package.json
new file mode 100644
index 0000000000000000000000000000000000000000..09e670999813e2e6271cbfd74dfbcbd43fe344a5
--- /dev/null
+++ b/uni_modules/uts-progressNotification/package.json
@@ -0,0 +1,83 @@
+{
+ "id": "uts-progressNotification",
+ "displayName": "uts-progressNotification",
+ "version": "1.0.7",
+ "description": "uts-progressNotification",
+ "keywords": [
+ "uts-progressNotification"
+],
+ "repository": "",
+ "engines": {
+ "HBuilderX": "^3.91"
+ },
+ "dcloudext": {
+ "type": "uts",
+ "sale": {
+ "regular": {
+ "price": "0.00"
+ },
+ "sourcecode": {
+ "price": "0.00"
+ }
+ },
+ "contact": {
+ "qq": ""
+ },
+ "declaration": {
+ "ads": "无",
+ "data": "插件不采集任何数据",
+ "permissions": "TargetSDKVersion33以上时需配置\n`android.permission.POST_NOTIFICATIONS`"
+ },
+ "npmurl": ""
+ },
+ "uni_modules": {
+ "dependencies": [],
+ "encrypt": [],
+ "platforms": {
+ "cloud": {
+ "tcb": "y",
+ "aliyun": "y"
+ },
+ "client": {
+ "Vue": {
+ "vue2": "y",
+ "vue3": "y"
+ },
+ "App": {
+ "app-android": {
+ "minVersion": "19"
+ },
+ "app-ios": "n"
+ },
+ "H5-mobile": {
+ "Safari": "n",
+ "Android Browser": "n",
+ "微信浏览器(Android)": "n",
+ "QQ浏览器(Android)": "n"
+ },
+ "H5-pc": {
+ "Chrome": "n",
+ "IE": "n",
+ "Edge": "n",
+ "Firefox": "n",
+ "Safari": "n"
+ },
+ "小程序": {
+ "微信": "n",
+ "阿里": "n",
+ "百度": "n",
+ "字节跳动": "n",
+ "QQ": "n",
+ "钉钉": "n",
+ "快手": "n",
+ "飞书": "n",
+ "京东": "n"
+ },
+ "快应用": {
+ "华为": "n",
+ "联盟": "n"
+ }
+ }
+ }
+ }
+}
diff --git a/uni_modules/uts-progressNotification/readme.md b/uni_modules/uts-progressNotification/readme.md
new file mode 100644
index 0000000000000000000000000000000000000000..87d85766d7694c927555da282bc1bef7d6d3a7d3
--- /dev/null
+++ b/uni_modules/uts-progressNotification/readme.md
@@ -0,0 +1,71 @@
+# uts-progressNotification
+
+## 使用说明
+
+Android平台创建显示进度的通知栏消息
+
+**注意: 需要自定义基座,否则点击通知栏消息不会拉起应用**
+
+### 导入
+
+需要import导入插件
+
+### createNotificationProgress(options : CreateNotificationProgressOptions) : void,
+
+创建显示进度的通知栏消息
+
+参数说明
+
+```
+export type CreateNotificationProgressOptions = {
+ /**
+ * 通知标题
+ * @defaultValue 应用名称
+ */
+ title ?: string | null
+ /**
+ * 通知内容
+ */
+ content : string,
+ /**
+ * 进度
+ */
+ progress : number,
+ /**
+ * 点击通知消息回调
+ * @defaultValue null
+ */
+ onClick? : (() => void) | null
+}
+```
+
+### finishNotificationProgress(options: FinishNotificationProgressOptions) : void
+
+完成时调用的API,比如下载完成后需要显示下载完成并隐藏进度时调用。
+
+参数说明
+
+
+```
+export type FinishNotificationProgressOptions = {
+ /**
+ * 通知标题
+ * @defaultValue 应用名称
+ */
+ title ?: string | null
+ /**
+ * 通知内容
+ */
+ content : string,
+ /**
+ * 点击通知消息回调
+ */
+ onClick : () => void
+}
+```
+
+
+### cancelNotificationProgress() : void
+
+取消通知消息显示
+
diff --git a/uni_modules/uts-progressNotification/utssdk/app-android/AndroidManifest.xml b/uni_modules/uts-progressNotification/utssdk/app-android/AndroidManifest.xml
new file mode 100644
index 0000000000000000000000000000000000000000..93749e96d581dd4446cf670d9406ba4c01291021
--- /dev/null
+++ b/uni_modules/uts-progressNotification/utssdk/app-android/AndroidManifest.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
diff --git a/uni_modules/uts-progressNotification/utssdk/app-android/TransparentActivity.uts b/uni_modules/uts-progressNotification/utssdk/app-android/TransparentActivity.uts
new file mode 100644
index 0000000000000000000000000000000000000000..283e01db3035765dd294f3f40e0d9f52e037da08
--- /dev/null
+++ b/uni_modules/uts-progressNotification/utssdk/app-android/TransparentActivity.uts
@@ -0,0 +1,61 @@
+import Activity from "android.app.Activity";
+import Bundle from 'android.os.Bundle';
+import Build from 'android.os.Build';
+import View from 'android.view.View';
+import Color from 'android.graphics.Color';
+import WindowManager from 'android.view.WindowManager';
+import { globalNotificationProgressFinishCallBack, globalNotificationProgressCallBack } from './index.uts';
+import { ACTION_DOWNLOAD_FINISH, ACTION_DOWNLOAD_PROGRESS } from "./constant.uts"
+
+
+export class TransparentActivity extends Activity {
+ constructor() {
+ super()
+ }
+
+ override onCreate(savedInstanceState : Bundle | null) {
+ super.onCreate(savedInstanceState)
+ this.fullScreen(this)
+ const action = this.getIntent().getAction()
+ if (action == ACTION_DOWNLOAD_FINISH) {
+ setTimeout(() => {
+ globalNotificationProgressFinishCallBack()
+ globalNotificationProgressFinishCallBack = () => { }
+ }, 100)
+ this.overridePendingTransition(0, 0)
+ }
+
+ if (action == ACTION_DOWNLOAD_PROGRESS) {
+ setTimeout(() => {
+ globalNotificationProgressCallBack?.()
+ globalNotificationProgressCallBack = () => { }
+ }, 100)
+ this.overridePendingTransition(0, 0)
+ }
+
+ setTimeout(() => {
+ this.finish()
+ }, 20)
+ }
+
+
+ @Suppress("DEPRECATION")
+ private fullScreen(activity : Activity) {
+ if (Build.VERSION.SDK_INT >= 19) {
+ if (Build.VERSION.SDK_INT >= 21) {
+ const window = activity.getWindow();
+ const decorView = window.getDecorView();
+ const option = View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_STABLE;
+ decorView.setSystemUiVisibility(option);
+ window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
+ window.setStatusBarColor(Color.TRANSPARENT);
+ } else {
+ const window = activity.getWindow();
+ const attributes = window.getAttributes();
+ const flagTranslucentStatus = WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS;
+ attributes.flags |= flagTranslucentStatus;
+ window.setAttributes(attributes);
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/uni_modules/uts-progressNotification/utssdk/app-android/config.json b/uni_modules/uts-progressNotification/utssdk/app-android/config.json
new file mode 100644
index 0000000000000000000000000000000000000000..7deedfa4f1562e221ea6b8bb3e828485447e2f5f
--- /dev/null
+++ b/uni_modules/uts-progressNotification/utssdk/app-android/config.json
@@ -0,0 +1,3 @@
+{
+ "minSdkVersion": "19"
+}
\ No newline at end of file
diff --git a/uni_modules/uts-progressNotification/utssdk/app-android/constant.uts b/uni_modules/uts-progressNotification/utssdk/app-android/constant.uts
new file mode 100644
index 0000000000000000000000000000000000000000..8652ac4be355ac4726516da9a46d99bcd86ce1a5
--- /dev/null
+++ b/uni_modules/uts-progressNotification/utssdk/app-android/constant.uts
@@ -0,0 +1,2 @@
+export const ACTION_DOWNLOAD_FINISH = "ACTION_DOWNLOAD_FINISH"
+export const ACTION_DOWNLOAD_PROGRESS = "ACTION_DOWNLOAD_PROGRESS"
\ No newline at end of file
diff --git a/uni_modules/uts-progressNotification/utssdk/app-android/index.uts b/uni_modules/uts-progressNotification/utssdk/app-android/index.uts
new file mode 100644
index 0000000000000000000000000000000000000000..39d14cd58fb17e0adf913bbd6995e5849345e313
--- /dev/null
+++ b/uni_modules/uts-progressNotification/utssdk/app-android/index.uts
@@ -0,0 +1,159 @@
+import Build from 'android.os.Build';
+import Context from 'android.content.Context';
+import NotificationManager from 'android.app.NotificationManager';
+import NotificationChannel from 'android.app.NotificationChannel';
+import Notification from 'android.app.Notification';
+import Intent from 'android.content.Intent';
+import ComponentName from 'android.content.ComponentName';
+import PendingIntent from 'android.app.PendingIntent';
+import { CreateNotificationProgressOptions, FinishNotificationProgressOptions } from '../interface.uts';
+import { ACTION_DOWNLOAD_FINISH, ACTION_DOWNLOAD_PROGRESS } from "./constant.uts"
+
+
+export { TransparentActivity } from './TransparentActivity.uts';
+
+
+const DOWNLOAD_PROGRESS_NOTIFICATION_ID : Int = 7890
+const DC_DOWNLOAD_CHANNEL_ID = "下载文件"
+const DC_DOWNLOAD_CHANNEL_NAME = "用于显示现在进度的渠道"
+
+
+let notificationBuilder : Notification.Builder | null = null
+
+let timeId = -1
+
+let histroyProgress = 0
+
+let isProgress = false
+
+export let globalNotificationProgressCallBack : (() => void) | null = () => { }
+export let globalNotificationProgressFinishCallBack = () => { }
+
+export function createNotificationProgress(options : CreateNotificationProgressOptions) : void {
+ const { content, progress, onClick } = options
+
+ if (progress == 100) {
+ clearTimeout(timeId)
+ const context = UTSAndroid.getAppContext() as Context
+ realCreateNotificationProgress(options.title ?? getAppName(context), content, progress, onClick)
+ reset()
+ return
+ }
+
+ histroyProgress = progress
+ if (timeId != -1) {
+ return
+ }
+
+ const context = UTSAndroid.getAppContext() as Context
+ if (!isProgress) {
+ realCreateNotificationProgress(options.title ?? getAppName(context), content, histroyProgress, onClick)
+ isProgress = true
+ } else {
+ timeId = setTimeout(() => {
+ realCreateNotificationProgress(options.title ?? getAppName(context), content, histroyProgress, onClick)
+ timeId = -1
+ }, 1000)
+ }
+}
+
+
+export function cancelNotificationProgress() : void {
+ const context = UTSAndroid.getAppContext() as Context
+ const notificationManager = context.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
+ notificationManager.cancel(DOWNLOAD_PROGRESS_NOTIFICATION_ID)
+ reset()
+}
+
+
+function realCreateNotificationProgress(title : string, content : string, progress : number, cb : (() => void) | null) : void {
+ globalNotificationProgressCallBack = cb
+ const context = UTSAndroid.getAppContext() as Context
+ const notificationManager = context.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
+ createDownloadChannel(notificationManager)
+ const builder = createNotificationBuilder(context)
+ builder.setProgress(100, progress.toInt(), false)
+ builder.setContentTitle(title)
+ builder.setContentText(content)
+ builder.setContentIntent(createPendingIntent(context, ACTION_DOWNLOAD_PROGRESS));
+ notificationManager.notify(DOWNLOAD_PROGRESS_NOTIFICATION_ID, builder.build())
+}
+
+
+export function finishNotificationProgress(options : FinishNotificationProgressOptions) {
+ globalNotificationProgressFinishCallBack = options.onClick
+ const context = UTSAndroid.getAppContext() as Context
+ const notificationManager = context.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
+ createDownloadChannel(notificationManager)
+ const builder = createNotificationBuilder(context)
+ builder.setProgress(0, 0, false)
+ builder.setContentTitle(options.title ?? getAppName(context))
+ builder.setContentText(options.content)
+ //小米rom setOngoing未false的时候,会被通知管理器归为不重要通知
+ // builder.setOngoing(false)
+ builder.setAutoCancel(true);
+ builder.setContentIntent(createPendingIntent(context, ACTION_DOWNLOAD_FINISH));
+ notificationManager.notify(DOWNLOAD_PROGRESS_NOTIFICATION_ID, builder.build())
+ reset()
+}
+
+function reset() {
+ isProgress = false
+ notificationBuilder = null
+ histroyProgress = 0
+ if (timeId != -1) {
+ clearTimeout(timeId)
+ timeId = -1
+ }
+}
+
+
+
+function createPendingIntent(context : Context, action : string) : PendingIntent {
+ const i = new Intent(action);
+ i.setComponent(new ComponentName(context.getPackageName(), "uts.sdk.modules.utsProgressNotification.TransparentActivity"));
+ let flags = PendingIntent.FLAG_ONE_SHOT;
+ if (Build.VERSION.SDK_INT >= 23) {
+ flags = PendingIntent.FLAG_ONE_SHOT | PendingIntent.FLAG_IMMUTABLE;
+ }
+ return PendingIntent.getActivity(context, DOWNLOAD_PROGRESS_NOTIFICATION_ID, i, flags);
+}
+
+
+function createDownloadChannel(notificationManager : NotificationManager) {
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
+ const channel = new NotificationChannel(
+ DC_DOWNLOAD_CHANNEL_ID,
+ DC_DOWNLOAD_CHANNEL_NAME,
+ NotificationManager.IMPORTANCE_LOW
+ )
+ notificationManager.createNotificationChannel(channel)
+ }
+}
+@Suppress("DEPRECATION")
+function createNotificationBuilder(context : Context) : Notification.Builder {
+ if (notificationBuilder == null) {
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
+ notificationBuilder = new Notification.Builder(context, DC_DOWNLOAD_CHANNEL_ID)
+ } else {
+ notificationBuilder = new Notification.Builder(context)
+ }
+ notificationBuilder!.setSmallIcon(context.getApplicationInfo().icon)
+ notificationBuilder!.setOngoing(true)
+ notificationBuilder!.setSound(null)
+ }
+ return notificationBuilder!
+}
+
+@Suppress("DEPRECATION")
+function getAppName(context : Context) : string {
+ let appName = ""
+ try {
+ const packageManager = context.getPackageManager()
+ const applicationInfo = packageManager.getApplicationInfo(context.getPackageName(), 0)
+ appName = packageManager.getApplicationLabel(applicationInfo) as string
+ } catch (e : Exception) {
+ e.printStackTrace()
+ }
+ return appName
+}
\ No newline at end of file
diff --git a/uni_modules/uts-progressNotification/utssdk/app-android/res/values/notification_progress_styles.xml b/uni_modules/uts-progressNotification/utssdk/app-android/res/values/notification_progress_styles.xml
new file mode 100644
index 0000000000000000000000000000000000000000..cc01105b78513e66c7e1086ffe5ff564c71ae34f
--- /dev/null
+++ b/uni_modules/uts-progressNotification/utssdk/app-android/res/values/notification_progress_styles.xml
@@ -0,0 +1,11 @@
+
+
+
+
\ No newline at end of file
diff --git a/uni_modules/uts-progressNotification/utssdk/app-ios/config.json b/uni_modules/uts-progressNotification/utssdk/app-ios/config.json
new file mode 100644
index 0000000000000000000000000000000000000000..d6281248a698f70985f2fd54722b527135d860d6
--- /dev/null
+++ b/uni_modules/uts-progressNotification/utssdk/app-ios/config.json
@@ -0,0 +1,3 @@
+{
+ "deploymentTarget": "9"
+}
\ No newline at end of file
diff --git a/uni_modules/uts-progressNotification/utssdk/app-ios/index.uts b/uni_modules/uts-progressNotification/utssdk/app-ios/index.uts
new file mode 100644
index 0000000000000000000000000000000000000000..e45e1e4d3ea5281d36178987e4edaa428cd6ce15
--- /dev/null
+++ b/uni_modules/uts-progressNotification/utssdk/app-ios/index.uts
@@ -0,0 +1,85 @@
+/**
+ * 引用 iOS 系统库,示例如下:
+ * import { UIDevice } from "UIKit";
+ * [可选实现,按需引入]
+ */
+
+/* 引入 interface.uts 文件中定义的变量 */
+import { MyApiOptions, MyApiResult, MyApi, MyApiSync } from '../interface.uts';
+
+/* 引入 unierror.uts 文件中定义的变量 */
+import { MyApiFailImpl } from '../unierror';
+
+/**
+ * 引入三方库
+ * [可选实现,按需引入]
+ *
+ * 在 iOS 平台引入三方库有以下两种方式:
+ * 1、通过引入三方库framework 或者.a 等方式,需要将 .framework 放到 ./Frameworks 目录下,将.a 放到 ./Libs 目录下。更多信息[详见](https://uniapp.dcloud.net.cn/plugin/uts-plugin.html#ios-平台原生配置)
+ * 2、通过 cocoaPods 方式引入,将要引入的 pod 信息配置到 config.json 文件下的 dependencies-pods 字段下。详细配置方式[详见](https://uniapp.dcloud.net.cn/plugin/uts-ios-cocoapods.html)
+ *
+ * 在通过上述任意方式依赖三方库后,使用时需要在文件中 import:
+ * 示例:import { LottieLoopMode } from 'Lottie'
+ */
+
+/**
+ * UTSiOS 为平台内置对象,不需要 import 可直接调用其API,[详见](https://uniapp.dcloud.net.cn/uts/utsios.html)
+ */
+
+/**
+ * 异步方法
+ *
+ * uni-app项目中(vue/nvue)调用示例:
+ * 1、引入方法声明 import { myApi } from "@/uni_modules/uts-api"
+ * 2、方法调用
+ * myApi({
+ * paramA: false,
+ * complete: (res) => {
+ * console.log(res)
+ * }
+ * });
+ *
+ */
+export const myApi : MyApi = function (options : MyApiOptions) {
+
+ if (options.paramA == true) {
+ // 返回数据
+ const res : MyApiResult = {
+ fieldA: 85,
+ fieldB: true,
+ fieldC: 'some message'
+ };
+ options.success?.(res);
+ options.complete?.(res);
+
+ } else {
+ // 返回错误
+ let failResult = new MyApiFailImpl(9010001);
+ options.fail?.(failResult)
+ options.complete?.(failResult)
+ }
+
+}
+
+/**
+ * 同步方法
+ *
+ * uni-app项目中(vue/nvue)调用示例:
+ * 1、引入方法声明 import { myApiSync } from "@/uni_modules/uts-api"
+ * 2、方法调用
+ * myApiSync(true);
+ *
+ */
+export const myApiSync : MyApiSync = function (paramA : boolean) : MyApiResult {
+ // 返回数据,根据插件功能获取实际的返回值
+ const res : MyApiResult = {
+ fieldA: 85,
+ fieldB: paramA,
+ fieldC: 'some message'
+ };
+ return res;
+}
+
+/**
+ * 更多插件开发的信息详见:https://uniapp.dcloud.net.cn/plugin/uts-plugin.html
+ */
diff --git a/uni_modules/uts-progressNotification/utssdk/interface.uts b/uni_modules/uts-progressNotification/utssdk/interface.uts
new file mode 100644
index 0000000000000000000000000000000000000000..957035338481eed25cc286e7032bc4abd1ec6319
--- /dev/null
+++ b/uni_modules/uts-progressNotification/utssdk/interface.uts
@@ -0,0 +1,46 @@
+export type CreateNotificationProgressOptions = {
+ /**
+ * 通知标题
+ * @defaultValue 应用名称
+ */
+ title ?: string | null
+ /**
+ * 通知内容
+ */
+ content : string,
+ /**
+ * 进度
+ */
+ progress : number,
+ /**
+ * 点击通知消息回调
+ * @defaultValue null
+ */
+ onClick? : (() => void) | null
+}
+
+
+export type FinishNotificationProgressOptions = {
+ /**
+ * 通知标题
+ * @defaultValue 应用名称
+ */
+ title ?: string | null
+ /**
+ * 通知内容
+ */
+ content : string,
+ /**
+ * 点击通知消息回调
+ */
+ onClick : () => void
+}
+
+
+export type CreateNotificationProgress = (options : CreateNotificationProgressOptions) => void;
+
+
+export type CancelNotificationProgress = () => void;
+
+
+export type FinishNotificationProgress = (options: FinishNotificationProgressOptions) => void
diff --git a/uni_modules/uts-progressNotification/utssdk/unierror.uts b/uni_modules/uts-progressNotification/utssdk/unierror.uts
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391