diff --git a/uni_modules/uni-authentication/utssdk/app-harmony/index.uts b/uni_modules/uni-authentication/utssdk/app-harmony/index.uts
index d0d813eeef26a5fe77d5914a588b9935df05f3a0..11ae92c113adda480951902aff872bd7ffe3655e 100644
--- a/uni_modules/uni-authentication/utssdk/app-harmony/index.uts
+++ b/uni_modules/uni-authentication/utssdk/app-harmony/index.uts
@@ -158,6 +158,9 @@ function fingerPrintAvailable() {
userAuth.getAvailableStatus(userAuth.UserAuthType.FINGERPRINT, userAuth.AuthTrustLevel.ATL1);
return true
} catch (error) {
+ if ([userAuth.UserAuthResultCode.NOT_ENROLLED, userAuth.UserAuthResultCode.PIN_EXPIRED].includes((error as BusinessError).code)) {
+ return true
+ }
return false
}
}
@@ -167,6 +170,9 @@ function faceAvailable() {
userAuth.getAvailableStatus(userAuth.UserAuthType.FACE, userAuth.AuthTrustLevel.ATL1);
return true
} catch (error) {
+ if ([userAuth.UserAuthResultCode.NOT_ENROLLED, userAuth.UserAuthResultCode.PIN_EXPIRED].includes((error as BusinessError).code)) {
+ return true
+ }
return false
}
}
diff --git a/uni_modules/uni-chooseLocation/changelog.md b/uni_modules/uni-chooseLocation/changelog.md
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/uni_modules/uni-chooseLocation/package.json b/uni_modules/uni-chooseLocation/package.json
new file mode 100644
index 0000000000000000000000000000000000000000..27a8e9a0f6dec8afc0fa4d551cef98c8bd93ed96
--- /dev/null
+++ b/uni_modules/uni-chooseLocation/package.json
@@ -0,0 +1,102 @@
+{
+ "id": "uni-chooseLocation",
+ "displayName": "uni-chooseLocation",
+ "version": "1.0.0",
+ "description": "uni-chooseLocation",
+ "keywords": [
+ "uni-chooseLocation"
+ ],
+ "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-framework",
+ "uni-theme",
+ "uni-getSystemInfo",
+ "uni-getLocation",
+ "uni-cloud-client",
+ "uni-getLocation",
+ "uni-map-tencent"
+ ],
+ "uni-ext-api": {
+ "uni": {
+ "chooseLocation": {
+ "name": "chooseLocation",
+ "app": {
+ "js": true,
+ "kotlin": true,
+ "swift": true,
+ "arkts": 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"
+ }
+ }
+ }
+ }
+}
diff --git a/uni_modules/uni-chooseLocation/pages/chooseLocation/chooseLocation.vue b/uni_modules/uni-chooseLocation/pages/chooseLocation/chooseLocation.vue
new file mode 100644
index 0000000000000000000000000000000000000000..b09eff3ccb873110f59bdba6ed67225b3f36d831
--- /dev/null
+++ b/uni_modules/uni-chooseLocation/pages/chooseLocation/chooseLocation.vue
@@ -0,0 +1,1090 @@
+
+
+
+
+
+ {{ icon.target }}
+
+
+ {{ icon.position }}
+
+
+
+ {{ languageCom['back'] }}
+
+ {{ languageCom['ok'] }}
+
+
+
+
+
+ {{ icon.search }}
+
+
+ {{ languageCom['cancel'] }}
+
+
+
+ {{ errMsg }}
+
+ {{ languageCom['locationLoading'] }}
+
+
+
+
+
+
+ {{ item.title }}
+ {{ item.distance as number > 0 ? item.distanceStr + ' | ' : '' }}{{ item.address }}
+
+
+ {{ icon.success }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/uni_modules/uni-chooseLocation/readme.md b/uni_modules/uni-chooseLocation/readme.md
new file mode 100644
index 0000000000000000000000000000000000000000..e6a2932f631ef65915d10dcc8331e9f9a630d649
--- /dev/null
+++ b/uni_modules/uni-chooseLocation/readme.md
@@ -0,0 +1,6 @@
+# uni-actionSheet
+### 开发文档
+[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-chooseLocation/utssdk/app-android/index.uts b/uni_modules/uni-chooseLocation/utssdk/app-android/index.uts
new file mode 100644
index 0000000000000000000000000000000000000000..848a54cf1ce751876e724dccefd5dad7b3c34daa
--- /dev/null
+++ b/uni_modules/uni-chooseLocation/utssdk/app-android/index.uts
@@ -0,0 +1,42 @@
+import { registerSystemRoute } from "@dcloudio/uni-runtime";
+import uniChooseLocationPage from "@/uni_modules/uni-chooseLocation/pages/chooseLocation/chooseLocation.vue";
+import {
+ ChooseLocation,
+ ChooseLocationOptions,
+ ChooseLocationSuccessImpl,
+ ChooseLocationFailImpl
+} from "../interface.uts";
+
+export const chooseLocation: ChooseLocation = function (options: ChooseLocationOptions) {
+ registerSystemRoute("uni:chooseLocation", uniChooseLocationPage);
+
+ const uuid = Date.now() + '' + Math.floor(Math.random() * 1e7)
+ const baseEventName = `uni_choose_location_${uuid}`
+ const readyEventName = `${baseEventName}_ready`
+ const optionsEventName = `${baseEventName}_options`
+ const successEventName = `${baseEventName}_success`
+ const failEventName = `${baseEventName}_fail`
+
+ uni.$on(readyEventName, () => {
+ uni.$emit(optionsEventName, JSON.parse(JSON.stringify(options)));
+ })
+ uni.$on(successEventName, (result: UTSJSONObject) => {
+ let name = result['name'] as string;
+ let address = result['address'] as string;
+ let latitude = result.getNumber('latitude') as number;
+ let longitude = result.getNumber('longitude') as number;
+ options.success?.(new ChooseLocationSuccessImpl(name, address, latitude, longitude))
+ })
+ uni.$on(failEventName, () => {
+ options.fail?.(new ChooseLocationFailImpl())
+ })
+ uni.openDialogPage({
+ url: `uni:chooseLocation?readyEventName=${readyEventName}&optionsEventName=${optionsEventName}&successEventName=${successEventName}&failEventName=${failEventName}`,
+ fail(err) {
+ options.fail?.(new ChooseLocationFailImpl(`showActionSheet failed, ${err.errMsg}`, 4))
+ uni.$off(readyEventName)
+ uni.$off(successEventName)
+ uni.$off(failEventName)
+ }
+ })
+};
diff --git a/uni_modules/uni-chooseLocation/utssdk/app-ios/index.uts b/uni_modules/uni-chooseLocation/utssdk/app-ios/index.uts
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/uni_modules/uni-chooseLocation/utssdk/app-js/chooseLocation.uts b/uni_modules/uni-chooseLocation/utssdk/app-js/chooseLocation.uts
new file mode 100644
index 0000000000000000000000000000000000000000..2dfc8a1698cf7103f4a22c896a7217c580fd8a21
--- /dev/null
+++ b/uni_modules/uni-chooseLocation/utssdk/app-js/chooseLocation.uts
@@ -0,0 +1,38 @@
+import { defineAsyncApi, registerSystemRoute } from "@dcloudio/uni-runtime";
+import uniChooseLocationPage from "@/uni_modules/uni-chooseLocation/pages/chooseLocation/chooseLocation.vue";
+import { ChooseLocation, ChooseLocationOptions, ChooseLocationSuccess } from "../interface.uts"
+
+export const chooseLocation: ChooseLocation = defineAsyncApi('chooseLocation', (
+ options: ChooseLocationOptions, { resolve, reject }
+) => {
+ registerSystemRoute("uni:chooseLocation", uniChooseLocationPage, {
+ disableSwipeBack: false
+ });
+
+ const uuid = Date.now() + '' + Math.floor(Math.random() * 1e7)
+ const baseEventName = `uni_choose_location_${uuid}`
+ const readyEventName = `${baseEventName}_ready`
+ const optionsEventName = `${baseEventName}_options`
+ const successEventName = `${baseEventName}_success`
+ const failEventName = `${baseEventName}_fail`
+ uni.$on(readyEventName, () => {
+ uni.$emit(optionsEventName, JSON.parse(JSON.stringify(options)))
+ })
+ uni.$on(successEventName, (result: ChooseLocationSuccess) => {
+ resolve(result)
+ })
+ uni.$on(failEventName, () => {
+ reject('cancel', {
+ errCode: 1
+ })
+ })
+ uni.openDialogPage({
+ url: `uni:chooseLocation?readyEventName=${readyEventName}&optionsEventName=${optionsEventName}&successEventName=${successEventName}&failEventName=${failEventName}`,
+ fail(err) {
+ options.fail?.({ errMsg: `chooseLocation:fail ${err.errMsg}`, errCode: 4 })
+ uni.$off(readyEventName)
+ uni.$off(successEventName)
+ uni.$off(failEventName)
+ }
+ })
+});
diff --git a/uni_modules/uni-chooseLocation/utssdk/app-js/index.uts b/uni_modules/uni-chooseLocation/utssdk/app-js/index.uts
new file mode 100644
index 0000000000000000000000000000000000000000..b99c4a16b4dacda9e93141d8401eafac0e5360a6
--- /dev/null
+++ b/uni_modules/uni-chooseLocation/utssdk/app-js/index.uts
@@ -0,0 +1 @@
+export * from "./chooseLocation.uts";
diff --git a/uni_modules/uni-chooseLocation/utssdk/interface.uts b/uni_modules/uni-chooseLocation/utssdk/interface.uts
new file mode 100644
index 0000000000000000000000000000000000000000..7cbcc1e6926e2e9bee5c93360d829c636f390b72
--- /dev/null
+++ b/uni_modules/uni-chooseLocation/utssdk/interface.uts
@@ -0,0 +1,160 @@
+/**
+ * 错误码
+ */
+export type ChooseLocationErrorCode =
+ /**
+ * 取消
+ */
+ 1 |
+ /**
+ * 框架内部错误
+ */
+ 4;
+export interface ChooseLocationSuccess extends AsyncApiSuccessResult {
+ name : string,
+ address : string,
+ latitude : number,
+ longitude : number
+}
+type ChooseLocationSuccessCallback = (result : ChooseLocationSuccess) => void
+
+export interface ChooseLocationFail extends IUniError {
+ errCode : ChooseLocationErrorCode
+}
+type ChooseLocationFailCallback = (result : ChooseLocationFail) => void
+
+export type ChooseLocationComplete = AsyncApiResult
+type ChooseLocationCompleteCallback = (result : ChooseLocationComplete) => void
+
+/**
+ * uni.chooseLocation函数参数定义
+ */
+export type ChooseLocationOptions = {
+ /**
+ * 指示位置的经度
+ */
+ latitude ?: number | null,
+ /**
+ * 指示位置的纬度
+ */
+ longitude ?: number | null,
+ /**
+ * 指示位置的名称
+ */
+ keyword ?: string | null,
+ /**
+ * 接口调用成功的回调函数
+ */
+ success ?: ChooseLocationSuccessCallback | null,
+ /**
+ * 接口调用失败的回调函数
+ */
+ fail ?: ChooseLocationFailCallback | null,
+ /**
+ * 接口调用结束的回调函数(调用成功、失败都会执行)
+ */
+ complete ?: ChooseLocationCompleteCallback | null
+};
+
+/**
+ * 打开地图选择位置
+ *
+ * @param {ChooseLocationOptions} options
+ * @tutorial https://doc.dcloud.net.cn/uni-app-x/api/prompt.html#chooselocation
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "5.0",
+ * "uniVer": "√",
+ * "unixVer": "3.9.0"
+ * },
+ * "ios": {
+ * "osVer": "12.0",
+ * "uniVer": "√",
+ * "unixVer": "4.11"
+ * },
+ * "harmony": {
+ * "osVer": "3.0",
+ * "uniVer": "4.23",
+ * "unixVer": "x"
+ * }
+ * },
+ * "web": {
+ * "uniVer": "√",
+ * "unixVer": "4.0"
+ * }
+ * }
+ */
+export type ChooseLocation = (options : ChooseLocationOptions) => void;
+
+export interface Uni {
+ /**
+ * @description 打开地图选择位置
+ * @example
+ * ```typescript
+ uni.chooseLocation({
+ success: (res) => {
+ console.log('res: ', res)
+ },
+ fail: (err) => {
+ console.log('err: ', err)
+ },
+ complete: (res) => {
+ console.log('complete: ', res)
+ }
+ });
+ * ```
+ * @tutorial https://doc.dcloud.net.cn/uni-app-x/api/choose-location.html
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "5.0",
+ * "uniVer": "√",
+ * "unixVer": "4.33"
+ * },
+ * "ios": {
+ * "osVer": "12.0",
+ * "uniVer": "√",
+ * "unixVer": "4.33"
+ * },
+ * "harmony": {
+ * "osVer": "3.0",
+ * "uniVer": "4.23",
+ * "unixVer": "x"
+ * }
+ * },
+ * "web": {
+ * "uniVer": "√",
+ * "unixVer": "4.0"
+ * }
+ * }
+ */
+ chooseLocation(options : ChooseLocationOptions) : void;
+}
+// #ifdef APP-ANDROID
+// @ts-expect-error
+export class ChooseLocationSuccessImpl extends AsyncApiSuccessResult implements ChooseLocationSuccess {
+ name : string
+ address : string
+ latitude : number
+ longitude : number
+ // @ts-expect-error
+ override errMsg : string
+ constructor(name : string, address : string, latitude : number, longitude : number, errMsg : string = 'chooseLocation:ok') {
+ super()
+ this.errMsg = errMsg
+ this.name = name
+ this.address = address
+ this.latitude = latitude
+ this.longitude = longitude
+ }
+}
+export class ChooseLocationFailImpl extends UniError implements ChooseLocationFail {
+ override errCode : ChooseLocationErrorCode
+ constructor(errMsg : string = 'chooseLocation:fail cancel', errCode : ChooseLocationErrorCode = 4) {
+ super(errMsg)
+ this.errCode = errCode
+ }
+}
+
+// #endif
diff --git a/uni_modules/uni-chooseLocation/utssdk/web/chooseLocation.uts b/uni_modules/uni-chooseLocation/utssdk/web/chooseLocation.uts
new file mode 100644
index 0000000000000000000000000000000000000000..0f18f353e8db58402a11116d71c33695393298ad
--- /dev/null
+++ b/uni_modules/uni-chooseLocation/utssdk/web/chooseLocation.uts
@@ -0,0 +1,36 @@
+import { defineAsyncApi, registerSystemRoute } from "@dcloudio/uni-runtime";
+import uniChooseLocationPage from "@/uni_modules/uni-chooseLocation/pages/chooseLocation/chooseLocation.vue";
+import { ChooseLocation, ChooseLocationOptions, ChooseLocationSuccess, ChooseLocationFail } from "../interface.uts"
+
+export const chooseLocation: ChooseLocation = defineAsyncApi('chooseLocation', (
+ options: ChooseLocationOptions, { resolve, reject }
+) => {
+ registerSystemRoute("uni:chooseLocation", uniChooseLocationPage);
+
+ const uuid = Date.now() + '' + Math.floor(Math.random() * 1e7)
+ const baseEventName = `uni_choose_location_${uuid}`
+ const readyEventName = `${baseEventName}_ready`
+ const optionsEventName = `${baseEventName}_options`
+ const successEventName = `${baseEventName}_success`
+ const failEventName = `${baseEventName}_fail`
+ uni.$on(readyEventName, () => {
+ uni.$emit(optionsEventName, JSON.parse(JSON.stringify(options)))
+ })
+ uni.$on(successEventName, (result: ChooseLocationSuccess) => {
+ resolve(result)
+ })
+ uni.$on(failEventName, () => {
+ reject('cancel', {
+ errCode: 1
+ })
+ })
+ uni.openDialogPage({
+ url: `uni:chooseLocation?readyEventName=${readyEventName}&optionsEventName=${optionsEventName}&successEventName=${successEventName}&failEventName=${failEventName}`,
+ fail(err) {
+ options.fail?.({ errMsg: `chooseLocation:fail ${err.errMsg}`, errCode: 4 } as ChooseLocationFail)
+ uni.$off(readyEventName)
+ uni.$off(successEventName)
+ uni.$off(failEventName)
+ }
+ })
+});
diff --git a/uni_modules/uni-chooseLocation/utssdk/web/index.uts b/uni_modules/uni-chooseLocation/utssdk/web/index.uts
new file mode 100644
index 0000000000000000000000000000000000000000..b99c4a16b4dacda9e93141d8401eafac0e5360a6
--- /dev/null
+++ b/uni_modules/uni-chooseLocation/utssdk/web/index.uts
@@ -0,0 +1 @@
+export * from "./chooseLocation.uts";
diff --git a/uni_modules/uni-createInnerAudioContext/package.json b/uni_modules/uni-createInnerAudioContext/package.json
index f9f49ff0f902ea1b9ef6dba71432712142dddc10..d2ea5a18f7ebd75eb6771f2222eeebed8938829c 100644
--- a/uni_modules/uni-createInnerAudioContext/package.json
+++ b/uni_modules/uni-createInnerAudioContext/package.json
@@ -37,7 +37,7 @@
"name": "createInnerAudioContext",
"app": {
"js": false,
- "kotlin": false,
+ "kotlin": true,
"swift": false,
"arkts": true
}
diff --git a/uni_modules/uni-createInnerAudioContext/utssdk/app-android/AudioPlayer.kt b/uni_modules/uni-createInnerAudioContext/utssdk/app-android/AudioPlayer.kt
new file mode 100644
index 0000000000000000000000000000000000000000..7913dab519679114363a66a9e933237f89ae6034
--- /dev/null
+++ b/uni_modules/uni-createInnerAudioContext/utssdk/app-android/AudioPlayer.kt
@@ -0,0 +1,601 @@
+@file:Suppress(
+ "UNCHECKED_CAST",
+ "USELESS_CAST",
+ "INAPPLICABLE_JVM_NAME",
+ "UNUSED_ANONYMOUS_PARAMETER"
+)
+
+package uts.sdk.modules.uniCreateInnerAudioContext;
+
+import android.content.Context
+import android.media.AudioManager
+import android.net.Uri
+import android.webkit.CookieManager
+import com.google.android.exoplayer2.DeviceInfo
+import com.google.android.exoplayer2.ExoPlaybackException
+import com.google.android.exoplayer2.ExoPlayer
+import com.google.android.exoplayer2.MediaItem
+import com.google.android.exoplayer2.MediaMetadata
+import com.google.android.exoplayer2.PlaybackException
+import com.google.android.exoplayer2.PlaybackParameters
+import com.google.android.exoplayer2.Player
+import com.google.android.exoplayer2.Timeline
+import com.google.android.exoplayer2.Tracks
+import com.google.android.exoplayer2.audio.AudioAttributes
+import com.google.android.exoplayer2.source.ProgressiveMediaSource
+import com.google.android.exoplayer2.text.Cue
+import com.google.android.exoplayer2.text.CueGroup
+import com.google.android.exoplayer2.trackselection.TrackSelectionParameters
+import com.google.android.exoplayer2.upstream.DefaultHttpDataSource
+import com.google.android.exoplayer2.upstream.HttpDataSource
+import com.google.android.exoplayer2.upstream.cache.CacheDataSource
+import com.google.android.exoplayer2.upstream.cache.LeastRecentlyUsedCacheEvictor
+import com.google.android.exoplayer2.upstream.cache.SimpleCache
+import com.google.android.exoplayer2.video.VideoSize
+import io.dcloud.uts.UTSAndroid
+import io.dcloud.uts.UTSArray
+import io.dcloud.uts.UTSJSONObject
+import io.dcloud.uts.clearInterval
+import io.dcloud.uts.compareTo
+import io.dcloud.uts.console
+import io.dcloud.uts.includes
+import io.dcloud.uts.setInterval
+import io.dcloud.uts.times
+import io.dcloud.uts.utsArrayOf
+import java.io.File
+import java.io.IOException
+
+typealias EventCallback = (result: Any) -> Unit;
+
+object CacheManager {
+
+ private var simpleCache: SimpleCache? = null
+
+ // 获取 SimpleCache 实例的方法
+ fun getSimpleCache(): SimpleCache {
+ if (simpleCache == null) {
+ // 创建缓存目录
+ val cacheDir = File(UTSAndroid.getAppCachePath(), "uni-audio")
+ if (!cacheDir.exists()) {
+ cacheDir.mkdirs()
+ }
+ System.out.println("cacheDir=>" + cacheDir.path)
+ // 创建缓存对象,最大缓存100MB
+ simpleCache =
+ SimpleCache(cacheDir, LeastRecentlyUsedCacheEvictor(100 * 1024 * 1024))
+ }
+ return simpleCache!!
+ }
+
+ // 释放 SimpleCache 资源的方法
+ fun releaseCache() {
+ simpleCache?.release() // 清理缓存并释放资源
+ simpleCache = null
+ }
+}
+
+
+open class AudioPlayer : InnerAudioContext, Player.Listener,
+ AudioManager.OnAudioFocusChangeListener {
+ open var _src: String = "";
+ private var cacheDataSourceFactory: CacheDataSource.Factory? = null
+ override var src: String
+ get(): String {
+ return this._src;
+ }
+ set(src: String) {
+ if (this._src == src) {
+ return;
+ }
+ if (this._src == "") {
+ this.changeSRC(src);
+ return;
+ } else {
+ this.stop();
+ }
+ this.changeSRC(src);
+ }
+
+ open fun changeSRC(src: String) {
+ if (src.startsWith("http:") || src.startsWith("https:")) {
+ this._src = src;
+ } else {
+ this._src = UTSAndroid.convert2AbsFullPath(src);
+ }
+ setMediaItem()
+ this.player.prepare();
+ if (this._startTime > 0) {
+ this.player.seekTo((this._startTime * 1000).toLong());
+ }
+ if (this._autoplay) {
+ this.play();
+ }
+ }
+
+ private fun setMediaItem() {
+ val mediaItem = MediaItem.fromUri(this._src)
+ if (_src.startsWith("http:") || _src.startsWith("https:")) {
+ var uri = Uri.parse(_src)
+ val userAgent =
+ UTSAndroid.getWebViewInfo(UTSAndroid.getAppContext()!!)["ua"].toString();
+ val cookies = CookieManager.getInstance()
+ .getCookie(uri.scheme + "://" + uri.host)
+
+ val httpDataSourceFactory = DefaultHttpDataSource.Factory()
+ .setUserAgent(userAgent) // 设置 User-Agent
+ .setDefaultRequestProperties(mapOf("Cookie" to cookies)) // 设置 Cookies
+
+ cacheDataSourceFactory?.setUpstreamDataSourceFactory(httpDataSourceFactory)
+ ?.setCache(CacheManager.getSimpleCache())
+ ?.setFlags(CacheDataSource.FLAG_BLOCK_ON_CACHE) // 等待直到缓存加载完
+ cacheDataSourceFactory?.let {
+ this.player.setMediaSource(
+ ProgressiveMediaSource.Factory(it)
+ .createMediaSource(mediaItem)
+ )
+ }
+ } else {
+ this.player.setMediaItem(mediaItem);
+ }
+ }
+
+ open var _startTime: Number = 0;
+ override var startTime: Number
+ get(): Number {
+ return this._startTime;
+ }
+ set(startTime: Number) {
+ if (startTime <= 0) {
+ return;
+ }
+ this._startTime = startTime;
+ if (this._src != "" && !this.player.isPlaying() && !this.isPausedByUser) {
+ this.player.seekTo((this._startTime * 1000).toLong());
+ }
+ }
+ open var _autoplay: Boolean = false;
+ override var autoplay: Boolean
+ get(): Boolean {
+ return this._autoplay;
+ }
+ set(autoplay) {
+ this._autoplay = autoplay;
+ if (this._src == "") {
+ return;
+ }
+ if (!this.player.isPlaying() && !this.isPausedByUser) {
+ this.play();
+ }
+ }
+ open var _loop: Boolean = false;
+ override var loop: Boolean
+ get(): Boolean {
+ return this._loop;
+ }
+ set(startTime: Boolean) {
+ this._loop = startTime;
+ if (this._loop) {
+ this.player.repeatMode = Player.REPEAT_MODE_ONE;
+ } else {
+ this.player.repeatMode = Player.REPEAT_MODE_OFF;
+ }
+ }
+ open var _obeyMuteSwitch: Boolean = true;
+ override var obeyMuteSwitch: Boolean
+ get(): Boolean {
+ return this._obeyMuteSwitch;
+ }
+ set(startTime: Boolean) {
+ this._obeyMuteSwitch = startTime;
+ }
+ override var duration: Number
+ get(): Number {
+ if (this.player.playbackState == Player.STATE_READY || this.player.playbackState == Player.STATE_ENDED) {
+ return this.player.duration / 1000;
+ } else {
+ return 0;
+ }
+ }
+ set(_) {
+
+ }
+ override var currentTime: Number
+ get(): Number {
+ if (this.player.isPlaying) {
+ return this.player.currentPosition / 1000;
+ }
+ return 0;
+ }
+ set(currentTime) {
+ val positionInMillis = (currentTime.toDouble() * 1000).toLong()
+ this.player.seekTo(positionInMillis)
+ }
+ override var paused: Boolean
+ get(): Boolean {
+ return !this.player.isPlaying;
+ }
+ set(_) {}
+ override var buffered: Number
+ get(): Number {
+ return this.player.bufferedPosition;
+ }
+ set(_) {}
+ open var _volume: Number = 0;
+ override var volume: Number
+ get(): Number {
+ return this.player.volume;
+ }
+ set(volume) {
+ var tVolume = volume;
+ if (volume > 1) {
+ tVolume = 1;
+ } else if (volume < 0) {
+ tVolume = 0;
+ }
+ this.player.volume = tVolume.toFloat();
+ this._volume = tVolume;
+ }
+ open var _playbackRate: Number? = 1.0;
+ override var playbackRate: Number?
+ get(): Number? {
+ return this._playbackRate;
+ }
+ set(rate) {
+ if (utsArrayOf(
+ 0.5,
+ 0.8,
+ 1.0,
+ 1.25,
+ 1.5,
+ 2.0
+ ).indexOf(rate?.toDouble()) >= 0
+ ) {
+ this.player.setPlaybackSpeed(rate!!.toFloat());
+ }
+ }
+ open var player: ExoPlayer;
+ open var callbacks = HashMap>();
+ private var errorCallBack: ((result: ICreateInnerAudioContextFail) -> Unit)? = null
+ open var isPausedByUser: Boolean = false;
+ open var isSeeking: Boolean = false;
+ open var audioManager: AudioManager;
+
+ constructor() {
+ // 创建 CacheDataSourceFactory
+ cacheDataSourceFactory = CacheDataSource.Factory()
+ // 创建 ExoPlayer 实例
+ this.player = ExoPlayer.Builder(UTSAndroid.getAppContext()!!).build();
+ this.player.addListener(this);
+
+ this.audioManager =
+ UTSAndroid.getAppContext()!!.getSystemService(Context.AUDIO_SERVICE) as AudioManager;
+
+ }
+
+ override fun play() {
+ try {
+ if (this._src == "") {
+ errorCallBack?.invoke(CreateInnerAudioContextFailImpl(1107609))
+ return;
+ }
+ when (this.player.playbackState) {
+ Player.STATE_IDLE -> {//停止
+ setMediaItem()
+ this.player.prepare();
+ }
+
+ Player.STATE_READY -> {//暂停或者准备好
+ if (this.isSeeking) {
+ console.log("1");
+ this.isSeeking = false;
+ invokeCallBack("seeked")
+ }
+ invokeCallBack("play")
+ }
+ }
+ this.isPausedByUser = false;
+ this.player.playWhenReady = true;
+// this.registerAudioManager();
+
+ } catch (e: Exception) {
+ var fail = CreateInnerAudioContextFailImpl(1107601)
+ e.message?.let {
+ fail.errMsg = it
+ }
+ errorCallBack?.invoke(fail)
+ }
+ }
+
+ override fun pause() {
+ this.isPausedByUser = true;
+ this.player.playWhenReady = false;
+ this.player.pause();
+ console.log(
+ "pause",
+ this.player.playbackState,
+ this.player.playbackState == Player.STATE_IDLE
+ );
+// this.unregisterAudioManager();
+ invokeCallBack("pause")
+ }
+
+ fun invokeCallBack(action: String, result: Any? = null) {
+ this.callbacks[action]?.forEach(fun(item: EventCallback) {
+ if (result != null) {
+ item(result)
+ } else {
+ item(UTSJSONObject());
+ }
+ })
+ }
+
+ override fun stop() {
+ this.isPausedByUser = true;
+ this.player.playWhenReady = false;
+ this.player.stop();
+// this.unregisterAudioManager();
+ invokeCallBack("stop")
+ }
+
+ override fun seek(position: Number) {
+ if (position >= 0) {
+ this.isSeeking = true;
+ this.player.seekTo((position * 1000).toLong());
+ invokeCallBack("seeking")
+ }
+ }
+
+ override fun destroy() {
+ this.callbacks.clear()
+ this.errorCallBack = null
+ stopTimeUpdate()
+ this.player.release()
+ CacheManager.releaseCache()
+ }
+
+ @Suppress("DEPRECATION")
+// open fun registerAudioManager() {
+// this.audioManager.requestAudioFocus(
+// this,
+// AudioManager.STREAM_MUSIC,
+// AudioManager.AUDIOFOCUS_GAIN_TRANSIENT_MAY_DUCK
+// );
+// }
+
+// @Suppress("DEPRECATION")
+// open fun unregisterAudioManager() {
+// this.audioManager.abandonAudioFocus(this);
+// }
+
+ override fun onAudioFocusChange(focusChange: Int) {
+ if (focusChange == AudioManager.AUDIOFOCUS_LOSS || focusChange == AudioManager.AUDIOFOCUS_LOSS_TRANSIENT || focusChange == AudioManager.AUDIOFOCUS_LOSS_TRANSIENT_CAN_DUCK) {
+ this.pause();
+ } else if (focusChange == AudioManager.AUDIOFOCUS_GAIN) {
+ }
+ }
+
+ open fun addEvent(action: String, callback: EventCallback) {
+ var playArray = this.callbacks.get(action);
+ if (playArray == null) {
+ playArray = UTSArray();
+ }
+ if (playArray.indexOf(callback) < 0) {
+ playArray.push(callback);
+ this.callbacks.put(action, playArray);
+ }
+ }
+
+ open fun removeEvent(action: String, callback: EventCallback) {
+ var playArray = this.callbacks.get(action);
+ if (playArray == null) {
+ return;
+ }
+ if (playArray.indexOf(callback) >= 0) {
+ playArray.splice(playArray.indexOf(callback), 1);
+ this.callbacks.put(action, playArray);
+ }
+ }
+
+ override fun onCanplay(callback: EventCallback) {
+ this.addEvent("canplay", callback);
+ }
+
+ override fun offCanplay(callback: EventCallback) {
+ this.removeEvent("canplay", callback);
+ }
+
+ override fun onPlay(callback: EventCallback) {
+ this.addEvent("play", callback);
+ }
+
+ override fun offPlay(callback: EventCallback) {
+ this.removeEvent("play", callback);
+ }
+
+ override fun onPause(callback: EventCallback) {
+ this.addEvent("pause", callback);
+ }
+
+ override fun offPause(callback: EventCallback) {
+ this.removeEvent("pause", callback);
+ }
+
+ override fun onStop(callback: EventCallback) {
+ this.addEvent("stop", callback);
+ }
+
+ override fun offStop(callback: EventCallback) {
+ this.removeEvent("stop", callback);
+ }
+
+ override fun onEnded(callback: EventCallback) {
+ this.addEvent("ended", callback);
+ }
+
+ override fun offEnded(callback: EventCallback) {
+ this.removeEvent("ended", callback);
+ }
+
+ override fun onTimeUpdate(callback: EventCallback) {
+ this.addEvent("timeUpdate", callback);
+ this.startTimeUpdate();
+ }
+
+ override fun offTimeUpdate(callback: EventCallback) {
+ this.removeEvent("timeUpdate", callback);
+ this.stopTimeUpdate();
+ }
+
+ override fun onError(callback: (result: ICreateInnerAudioContextFail) -> Unit) {
+ this.errorCallBack = callback
+ }
+
+ override fun offError(callback: (result: ICreateInnerAudioContextFail) -> Unit) {
+ if (this.errorCallBack == callback) {
+ this.errorCallBack = null
+ }
+ }
+
+ override fun onWaiting(callback: EventCallback) {
+ this.addEvent("waiting", callback);
+ }
+
+ override fun offWaiting(callback: EventCallback) {
+ this.removeEvent("waiting", callback);
+ }
+
+ override fun onSeeking(callback: EventCallback) {
+ this.addEvent("seeking", callback);
+ }
+
+ override fun offSeeking(callback: EventCallback) {
+ this.removeEvent("seeking", callback);
+ }
+
+ override fun onSeeked(callback: EventCallback) {
+ this.addEvent("seeked", callback);
+ }
+
+ override fun offSeeked(callback: EventCallback) {
+ this.removeEvent("seeked", callback);
+ }
+
+ open var isTriggerTimeUpdate = false;
+ open var timeUpdateInterval: Number = 0;
+ open fun startTimeUpdate() {
+ if (this.isTriggerTimeUpdate) {
+ return;
+ }
+ this.isTriggerTimeUpdate = true;
+ this.timeUpdateInterval = setInterval(fun() {
+ if (this.player.isPlaying) {
+ invokeCallBack("timeUpdate")
+ }
+ }, 750);
+ }
+
+ open fun stopTimeUpdate() {
+ if (!this.isTriggerTimeUpdate) {
+ return;
+ }
+ var timeUpdate = this.callbacks.get("timeUpdate");
+ if (timeUpdate == null || timeUpdate.size == 0) {
+ clearInterval(this.timeUpdateInterval.toInt());
+ this.timeUpdateInterval = 0;
+ this.isTriggerTimeUpdate = false;
+ }
+ }
+
+ override fun onPlayerError(error: PlaybackException) {
+ var fail = CreateInnerAudioContextFailImpl(1107605)
+ error.message?.let {
+ fail.errMsg = it
+ }
+ if (error is ExoPlaybackException) {
+ val exoError: ExoPlaybackException = error as ExoPlaybackException;
+ if (exoError.type == ExoPlaybackException.TYPE_SOURCE) {
+ val sourceException: IOException = exoError.sourceException;
+ if (sourceException is HttpDataSource.HttpDataSourceException) {
+ fail = CreateInnerAudioContextFailImpl(1107602)
+ val httpException: HttpDataSource.HttpDataSourceException = sourceException;
+ httpException.message?.let {
+ fail.errMsg = it
+ }
+ } else {
+ val message = sourceException.message as String;
+ if (message.includes("None of the available extractors")) {
+ fail = CreateInnerAudioContextFailImpl(1107604)
+ fail.errMsg = message
+ } else {
+ fail = CreateInnerAudioContextFailImpl(1107603)
+ fail.errMsg = message
+ }
+ }
+ }
+ }
+ this.errorCallBack?.invoke(fail)
+ }
+
+ override fun onPlaybackStateChanged(playbackState: Int) {
+ if (playbackState == Player.STATE_BUFFERING) {
+ invokeCallBack("waiting")
+ } else if (playbackState == Player.STATE_READY) {
+ if (!this.isPausedByUser && this.isSeeking) {
+ this.isSeeking = false;
+ invokeCallBack("seeked")
+ } else {
+ invokeCallBack("canplay")
+ if (this.player.playWhenReady) {
+ invokeCallBack("play")
+ }
+ }
+ } else if (playbackState == Player.STATE_ENDED) {
+ invokeCallBack("ended")
+ this.player.playWhenReady = false
+ this.player.seekTo(0)
+ }
+ }
+
+
+ override fun onEvents(player: Player, events: Player.Events) {}
+ override fun onTimelineChanged(timeline: Timeline, reason: Int) {}
+ override fun onMediaItemTransition(mediaItem: MediaItem?, reason: Int) {}
+ override fun onTracksChanged(tracks: Tracks) {}
+ override fun onMediaMetadataChanged(mediaMetadata: MediaMetadata) {}
+ override fun onPlaylistMetadataChanged(mediaMetadata: MediaMetadata) {}
+ override fun onIsLoadingChanged(isLoading: Boolean) {}
+ override fun onLoadingChanged(isLoading: Boolean) {}
+ override fun onAvailableCommandsChanged(availableCommands: Player.Commands) {}
+ override fun onTrackSelectionParametersChanged(parameters: TrackSelectionParameters) {}
+ override fun onPlayWhenReadyChanged(playWhenReady: Boolean, reason: Int) {}
+ override fun onPlaybackSuppressionReasonChanged(playbackSuppressionReason: Int) {}
+ override fun onIsPlayingChanged(isPlaying: Boolean) {}
+ override fun onRepeatModeChanged(repeatMode: Int) {}
+ override fun onShuffleModeEnabledChanged(shuffleModeEnabled: Boolean) {}
+ override fun onPlayerErrorChanged(error: PlaybackException?) {}
+ override fun onPositionDiscontinuity(reason: Int) {}
+ override fun onPositionDiscontinuity(
+ oldPosition: Player.PositionInfo,
+ newPosition: Player.PositionInfo,
+ reason: Int
+ ) {
+ }
+
+ override fun onPlaybackParametersChanged(playbackParameters: PlaybackParameters) {}
+ override fun onSeekBackIncrementChanged(seekBackIncrementMs: Long) {}
+ override fun onSeekForwardIncrementChanged(seekForwardIncrementMs: Long) {}
+ override fun onMaxSeekToPreviousPositionChanged(maxSeekToPreviousPositionMs: Long) {}
+ override fun onSeekProcessed() {}
+ override fun onAudioSessionIdChanged(audioSessionId: Int) {}
+ override fun onAudioAttributesChanged(audioAttributes: AudioAttributes) {}
+ override fun onVolumeChanged(volume: Float) {}
+ override fun onSkipSilenceEnabledChanged(skipSilenceEnabled: Boolean) {}
+ override fun onDeviceInfoChanged(deviceInfo: DeviceInfo) {}
+ override fun onDeviceVolumeChanged(volume: Int, muted: Boolean) {}
+ override fun onVideoSizeChanged(videoSize: VideoSize) {}
+ override fun onSurfaceSizeChanged(width: Int, height: Int) {}
+ override fun onRenderedFirstFrame() {}
+ override fun onCues(cues: MutableList) {}
+ override fun onCues(cueGroup: CueGroup) {}
+ override fun onPlayerStateChanged(playWhenReady: Boolean, playbackState: Int) {}
+}
diff --git a/uni_modules/uni-createInnerAudioContext/utssdk/app-android/config.json b/uni_modules/uni-createInnerAudioContext/utssdk/app-android/config.json
new file mode 100644
index 0000000000000000000000000000000000000000..ea037125883150079be5d144e7b043fcdf91f473
--- /dev/null
+++ b/uni_modules/uni-createInnerAudioContext/utssdk/app-android/config.json
@@ -0,0 +1,5 @@
+{
+ "dependencies": [
+ "com.google.android.exoplayer:exoplayer-core:2.18.0"
+ ]
+}
\ No newline at end of file
diff --git a/uni_modules/uni-createInnerAudioContext/utssdk/app-android/index.uts b/uni_modules/uni-createInnerAudioContext/utssdk/app-android/index.uts
new file mode 100644
index 0000000000000000000000000000000000000000..dc32cf15310522b76e74b77bde49928c888306be
--- /dev/null
+++ b/uni_modules/uni-createInnerAudioContext/utssdk/app-android/index.uts
@@ -0,0 +1,9 @@
+import { InnerAudioContext, CreateInnerAudioContext } from "../interface.uts"
+export { CreateInnerAudioContextFailImpl } from '../unierror.uts'
+
+export const createInnerAudioContext : CreateInnerAudioContext = function () : InnerAudioContext {
+
+ let player = new AudioPlayer()
+ return player
+
+}
\ No newline at end of file
diff --git a/uni_modules/uni-createInnerAudioContext/utssdk/app-harmony/index.uts b/uni_modules/uni-createInnerAudioContext/utssdk/app-harmony/index.uts
index 3f76d385d6d406224e1f022446b4b3b28881c640..4840658c6f33c0b5d7d22ee49ed5605d106ef111 100644
--- a/uni_modules/uni-createInnerAudioContext/utssdk/app-harmony/index.uts
+++ b/uni_modules/uni-createInnerAudioContext/utssdk/app-harmony/index.uts
@@ -1,7 +1,7 @@
import { media } from '@kit.MediaKit';
import { audio } from '@kit.AudioKit';
-import { InnerAudioContext, CreateInnerAudioContext } from '../interface.uts';
+import { InnerAudioContext, CreateInnerAudioContext, type ICreateInnerAudioContextFail } from '../interface.uts';
import { API_CREATE_INNER_AUDIO_CONTEXT } from '../protocol.uts';
import { getFdFromUriOrSandBoxPath, isFileUri, isSandboxPath, AudioPlayerCallback, AudioPlayerError } from './utils.uts';
@@ -254,7 +254,7 @@ class AudioPlayer implements InnerAudioContext {
onTimeUpdate(callback: (result: any) => void): void {
this.audioPlayerCallback.onTimeUpdate(callback)
}
- onError(callback: (result: any) => void): void {
+ onError(callback: (result: ICreateInnerAudioContextFail) => void): void {
this.audioPlayerCallback.onError(callback)
}
onWaiting(callback: (result: any) => void): void {
@@ -284,7 +284,7 @@ class AudioPlayer implements InnerAudioContext {
offTimeUpdate(callback: (result: any) => void): void {
this.audioPlayerCallback.offTimeUpdate(callback)
}
- offError(callback: (result: any) => void): void {
+ offError(callback: (result: ICreateInnerAudioContextFail) => void): void {
this.audioPlayerCallback.offError(callback)
}
offWaiting(callback: (result: any) => void): void {
diff --git a/uni_modules/uni-createInnerAudioContext/utssdk/interface.uts b/uni_modules/uni-createInnerAudioContext/utssdk/interface.uts
index 1ac603967d495d443a8b509dc63d4c507e57cccf..5ccb95770e1d31d624db206c03e168ede8c01c55 100644
--- a/uni_modules/uni-createInnerAudioContext/utssdk/interface.uts
+++ b/uni_modules/uni-createInnerAudioContext/utssdk/interface.uts
@@ -1,1733 +1,1191 @@
+
export interface Uni {
- /**
- * 创建并返回 audio 上下文 audioContext 对象
- *
- * @tutorial https://doc.dcloud.net.cn/uni-app-x/api/create-inner-audio-context.html
- * @tutorial-uni-app http://uniapp.dcloud.io/api/media/audio-context.html
- * @tutorial-uni-app-x https://doc.dcloud.net.cn/uni-app-x/api/create-inner-audio-context.html
- *
- * @uniPlatform {
- * "app": {
- * "android": {
- * "osVer": "5.0",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "ios": {
- * "osVer": "12.0",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "harmony": {
- * "osVer": "3.0",
- * "uniVer": "4.25",
- * "unixVer": "x"
- * }
- * },
- * "web": {
- * "uniVer": "√",
- * "unixVer": "4.0"
- * }
- * "mp":{
- * "weixin": {
- * "hostVer": "√",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "alipay": {
- * "hostVer": "1.23.4",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "baidu": {
- * "hostVer": "√",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "toutiao": {
- * "hostVer": "√",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "lark": {
- * "hostVer": "√",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "qq": {
- * "hostVer": "√",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "kuaishou": {
- * "hostVer": "√",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "jd": {
- * "hostVer": "√",
- * "uniVer": "√",
- * "unixVer": "x"
- * }
- * }
- * }
- */
- createInnerAudioContext: CreateInnerAudioContext;
+ /**
+ * 创建并返回 audio 上下文 audioContext 对象
+ *
+ * @tutorial https://doc.dcloud.net.cn/uni-app-x/api/create-inner-audio-context.html
+ * @tutorial-uni-app http://uniapp.dcloud.io/api/media/audio-context.html
+ * @tutorial-uni-app-x https://doc.dcloud.net.cn/uni-app-x/api/create-inner-audio-context.html
+ * @uniPlatform
+ {
+ "app": {
+ "android": {
+ "osVer": "5.0",
+ "uniVer": "√",
+ "uniUtsPlugin": "x",
+ "unixVer": "4.33",
+ "unixUtsPlugin": "4.33"
+ },
+ "ios": {
+ "osVer": "12.0",
+ "uniVer": "√",
+ "uniUtsPlugin": "x",
+ "unixVer": "x",
+ "unixUtsPlugin": "x"
+ }
+ },
+ "web": {
+ "uniVer": "√",
+ "unixVer": "4.0"
+ }
+ }
+ */
+ createInnerAudioContext : CreateInnerAudioContext;
}
export type CreateInnerAudioContext = () => InnerAudioContext;
export interface InnerAudioContext {
- /**
- * 当前音频的长度(单位:s),只有在当前有合法的 src 时返回
- */
- duration: number;
- /**
- * 当前音频的播放位置(单位:s),只有在当前有合法的 src 时返回
- */
- currentTime: number;
- /**
- * 当前是是否暂停或停止状态,true 表示暂停或停止,false 表示正在播放
- * @type boolean
- */
- paused: boolean;
- /**
- * 音频的数据链接,用于直接播放。
- */
- src: string;
- /**
- * 音频开始播放的位置(单位:s)
- */
- startTime: number;
- /**
- * 音频缓冲的时间点,仅保证当前播放时间点到此时间点内容已缓冲
- */
- buffered: number;
- /**
- * 是否自动开始播放,默认 false
- * @type boolean
- */
- autoplay: boolean;
- /**
- * 是否循环播放,默认 false
- * @type boolean
- */
- loop: boolean;
- /**
- * 是否遵循系统静音开关,当此参数为 false 时,即使用户打开了静音开关,也能继续发出声音,默认值 true
- * @type boolean
- */
- obeyMuteSwitch: boolean;
- /**
- * 音量。范围 0~1。
- */
- volume: number;
- /**
- * 播放的倍率。可取值: 0.5/0.8/1.0/1.25/1.5/2.0,默认值为1.0。(仅 App 支持)
- */
- playbackRate?: number;
- /**
- * 暂停
- */
- pause(): void;
- /**
- * 停止
- * @uniPlatform {
- * "app": {
- * "android": {
- * "osVer": "5.0",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "ios": {
- * "osVer": "12.0",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "harmony": {
- * "osVer": "3.0",
- * "uniVer": "4.25",
- * "unixVer": "x"
- * }
- * },
- * "web": {
- * "uniVer": "√",
- * "unixVer": "x"
- * }
- * "mp":{
- * "weixin": {
- * "hostVer": "√",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "alipay": {
- * "hostVer": "√",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "baidu": {
- * "hostVer": "√",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "toutiao": {
- * "hostVer": "√",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "lark": {
- * "hostVer": "√",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "qq": {
- * "hostVer": "√",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "kuaishou": {
- * "hostVer": "√",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "jd": {
- * "hostVer": "√",
- * "uniVer": "√",
- * "unixVer": "x"
- * }
- * }
- * }
- */
- stop(): void;
- /**
- * 播放
- * @uniPlatform {
- * "app": {
- * "android": {
- * "osVer": "5.0",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "ios": {
- * "osVer": "12.0",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "harmony": {
- * "osVer": "3.0",
- * "uniVer": "4.25",
- * "unixVer": "x"
- * }
- * },
- * "web": {
- * "uniVer": "√",
- * "unixVer": "x"
- * }
- * "mp":{
- * "weixin": {
- * "hostVer": "√",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "alipay": {
- * "hostVer": "√",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "baidu": {
- * "hostVer": "√",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "toutiao": {
- * "hostVer": "√",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "lark": {
- * "hostVer": "√",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "qq": {
- * "hostVer": "√",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "kuaishou": {
- * "hostVer": "√",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "jd": {
- * "hostVer": "√",
- * "uniVer": "√",
- * "unixVer": "x"
- * }
- * }
- * }
- */
- play(): void;
- /**
- * 跳转到指定位置,单位 s
- * @uniPlatform {
- * "app": {
- * "android": {
- * "osVer": "5.0",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "ios": {
- * "osVer": "12.0",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "harmony": {
- * "osVer": "3.0",
- * "uniVer": "4.25",
- * "unixVer": "x"
- * }
- * },
- * "web": {
- * "uniVer": "√",
- * "unixVer": "x"
- * }
- * "mp":{
- * "weixin": {
- * "hostVer": "√",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "alipay": {
- * "hostVer": "√",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "baidu": {
- * "hostVer": "√",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "toutiao": {
- * "hostVer": "√",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "lark": {
- * "hostVer": "√",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "qq": {
- * "hostVer": "√",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "kuaishou": {
- * "hostVer": "√",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "jd": {
- * "hostVer": "√",
- * "uniVer": "√",
- * "unixVer": "x"
- * }
- * }
- * }
- */
- seek(position: number): void;
- /**
- * 销毁当前实例
- * @uniPlatform {
- * "app": {
- * "android": {
- * "osVer": "5.0",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "ios": {
- * "osVer": "12.0",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "harmony": {
- * "osVer": "3.0",
- * "uniVer": "4.25",
- * "unixVer": "x"
- * }
- * },
- * "web": {
- * "uniVer": "√",
- * "unixVer": "x"
- * }
- * "mp":{
- * "weixin": {
- * "hostVer": "√",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "alipay": {
- * "hostVer": "√",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "baidu": {
- * "hostVer": "√",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "toutiao": {
- * "hostVer": "√",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "lark": {
- * "hostVer": "√",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "qq": {
- * "hostVer": "√",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "kuaishou": {
- * "hostVer": "√",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "jd": {
- * "hostVer": "√",
- * "uniVer": "√",
- * "unixVer": "x"
- * }
- * }
- * }
- */
- destroy(): void;
- /**
- * 音频进入可以播放状态,但不保证后面可以流畅播放
- * @uniPlatform {
- * "app": {
- * "android": {
- * "osVer": "5.0",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "ios": {
- * "osVer": "12.0",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "harmony": {
- * "osVer": "3.0",
- * "uniVer": "4.25",
- * "unixVer": "x"
- * }
- * },
- * "web": {
- * "uniVer": "√",
- * "unixVer": "x"
- * }
- * "mp":{
- * "weixin": {
- * "hostVer": "√",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "alipay": {
- * "hostVer": "√",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "baidu": {
- * "hostVer": "√",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "toutiao": {
- * "hostVer": "√",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "lark": {
- * "hostVer": "√",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "qq": {
- * "hostVer": "√",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "kuaishou": {
- * "hostVer": "√",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "jd": {
- * "hostVer": "√",
- * "uniVer": "√",
- * "unixVer": "x"
- * }
- * }
- * }
- */
- onCanplay(callback: (result: any) => void): void;
- /**
- * 音频播放事件
- * @uniPlatform {
- * "app": {
- * "android": {
- * "osVer": "5.0",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "ios": {
- * "osVer": "12.0",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "harmony": {
- * "osVer": "3.0",
- * "uniVer": "4.25",
- * "unixVer": "x"
- * }
- * },
- * "web": {
- * "uniVer": "√",
- * "unixVer": "x"
- * }
- * "mp":{
- * "weixin": {
- * "hostVer": "√",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "alipay": {
- * "hostVer": "√",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "baidu": {
- * "hostVer": "√",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "toutiao": {
- * "hostVer": "√",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "lark": {
- * "hostVer": "√",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "qq": {
- * "hostVer": "√",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "kuaishou": {
- * "hostVer": "√",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "jd": {
- * "hostVer": "√",
- * "uniVer": "√",
- * "unixVer": "x"
- * }
- * }
- * }
- */
- onPlay(callback: (result: any) => void): void;
- /**
- * 音频暂停事件
- * @uniPlatform {
- * "app": {
- * "android": {
- * "osVer": "4.4",
- * "uniVer": "√",
- * "unixVer": "3.9.0"
- * }
- * }
- * }
- */
- onPause(callback: (result: any) => void): void;
- /**
- * 音频停止事件
- * @uniPlatform {
- * "app": {
- * "android": {
- * "osVer": "5.0",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "ios": {
- * "osVer": "12.0",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "harmony": {
- * "osVer": "3.0",
- * "uniVer": "4.25",
- * "unixVer": "x"
- * }
- * },
- * "web": {
- * "uniVer": "√",
- * "unixVer": "x"
- * }
- * "mp":{
- * "weixin": {
- * "hostVer": "√",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "alipay": {
- * "hostVer": "√",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "baidu": {
- * "hostVer": "√",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "toutiao": {
- * "hostVer": "√",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "lark": {
- * "hostVer": "√",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "qq": {
- * "hostVer": "√",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "kuaishou": {
- * "hostVer": "√",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "jd": {
- * "hostVer": "√",
- * "uniVer": "√",
- * "unixVer": "x"
- * }
- * }
- * }
- */
- onStop(callback: (result: any) => void): void;
- /**
- * 音频自然播放结束事件
- * @uniPlatform {
- * "app": {
- * "android": {
- * "osVer": "5.0",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "ios": {
- * "osVer": "12.0",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "harmony": {
- * "osVer": "3.0",
- * "uniVer": "4.25",
- * "unixVer": "x"
- * }
- * },
- * "web": {
- * "uniVer": "√",
- * "unixVer": "x"
- * }
- * "mp":{
- * "weixin": {
- * "hostVer": "√",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "alipay": {
- * "hostVer": "√",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "baidu": {
- * "hostVer": "√",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "toutiao": {
- * "hostVer": "√",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "lark": {
- * "hostVer": "√",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "qq": {
- * "hostVer": "√",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "kuaishou": {
- * "hostVer": "√",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "jd": {
- * "hostVer": "√",
- * "uniVer": "√",
- * "unixVer": "x"
- * }
- * }
- * }
- */
- onEnded(callback: (result: any) => void): void;
- /**
- * 音频播放进度更新事件
- * @uniPlatform {
- * "app": {
- * "android": {
- * "osVer": "5.0",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "ios": {
- * "osVer": "12.0",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "harmony": {
- * "osVer": "3.0",
- * "uniVer": "4.25",
- * "unixVer": "x"
- * }
- * },
- * "web": {
- * "uniVer": "√",
- * "unixVer": "x"
- * }
- * "mp":{
- * "weixin": {
- * "hostVer": "√",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "alipay": {
- * "hostVer": "√",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "baidu": {
- * "hostVer": "√",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "toutiao": {
- * "hostVer": "√",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "lark": {
- * "hostVer": "√",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "qq": {
- * "hostVer": "√",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "kuaishou": {
- * "hostVer": "√",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "jd": {
- * "hostVer": "√",
- * "uniVer": "√",
- * "unixVer": "x"
- * }
- * }
- * }
- */
- onTimeUpdate(callback: (result: any) => void): void;
- /**
- * 音频播放错误事件
- * @uniPlatform {
- * "app": {
- * "android": {
- * "osVer": "5.0",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "ios": {
- * "osVer": "12.0",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "harmony": {
- * "osVer": "3.0",
- * "uniVer": "4.25",
- * "unixVer": "x"
- * }
- * },
- * "web": {
- * "uniVer": "√",
- * "unixVer": "x"
- * }
- * "mp":{
- * "weixin": {
- * "hostVer": "√",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "alipay": {
- * "hostVer": "√",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "baidu": {
- * "hostVer": "√",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "toutiao": {
- * "hostVer": "√",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "lark": {
- * "hostVer": "√",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "qq": {
- * "hostVer": "√",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "kuaishou": {
- * "hostVer": "√",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "jd": {
- * "hostVer": "√",
- * "uniVer": "√",
- * "unixVer": "x"
- * }
- * }
- * }
- */
- onError(callback: (result: any) => void): void;
- /**
- * 音频加载中事件,当音频因为数据不足,需要停下来加载时会触发
- * @uniPlatform {
- * "app": {
- * "android": {
- * "osVer": "5.0",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "ios": {
- * "osVer": "12.0",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "harmony": {
- * "osVer": "3.0",
- * "uniVer": "4.25",
- * "unixVer": "x"
- * }
- * },
- * "web": {
- * "uniVer": "√",
- * "unixVer": "x"
- * }
- * "mp":{
- * "weixin": {
- * "hostVer": "√",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "alipay": {
- * "hostVer": "√",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "baidu": {
- * "hostVer": "√",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "toutiao": {
- * "hostVer": "√",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "lark": {
- * "hostVer": "√",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "qq": {
- * "hostVer": "√",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "kuaishou": {
- * "hostVer": "√",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "jd": {
- * "hostVer": "√",
- * "uniVer": "√",
- * "unixVer": "x"
- * }
- * }
- * }
- */
- onWaiting(callback: (result: any) => void): void;
- /**
- * 音频进行 seek 操作事件
- * @uniPlatform {
- * "app": {
- * "android": {
- * "osVer": "5.0",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "ios": {
- * "osVer": "12.0",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "harmony": {
- * "osVer": "3.0",
- * "uniVer": "4.25",
- * "unixVer": "x"
- * }
- * },
- * "web": {
- * "uniVer": "√",
- * "unixVer": "x"
- * }
- * "mp":{
- * "weixin": {
- * "hostVer": "√",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "alipay": {
- * "hostVer": "√",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "baidu": {
- * "hostVer": "√",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "toutiao": {
- * "hostVer": "√",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "lark": {
- * "hostVer": "√",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "qq": {
- * "hostVer": "√",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "kuaishou": {
- * "hostVer": "√",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "jd": {
- * "hostVer": "√",
- * "uniVer": "√",
- * "unixVer": "x"
- * }
- * }
- * }
- */
- onSeeking(callback: (result: any) => void): void;
- /**
- * 音频完成 seek 操作事件
- * @uniPlatform {
- * "app": {
- * "android": {
- * "osVer": "5.0",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "ios": {
- * "osVer": "12.0",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "harmony": {
- * "osVer": "3.0",
- * "uniVer": "4.25",
- * "unixVer": "x"
- * }
- * },
- * "web": {
- * "uniVer": "√",
- * "unixVer": "x"
- * }
- * "mp":{
- * "weixin": {
- * "hostVer": "√",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "alipay": {
- * "hostVer": "√",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "baidu": {
- * "hostVer": "√",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "toutiao": {
- * "hostVer": "√",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "lark": {
- * "hostVer": "√",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "qq": {
- * "hostVer": "√",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "kuaishou": {
- * "hostVer": "√",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "jd": {
- * "hostVer": "√",
- * "uniVer": "√",
- * "unixVer": "x"
- * }
- * }
- * }
- */
- onSeeked(callback: (result: any) => void): void;
- /**
- * 取消监听 onCanplay 事件
- * @uniPlatform {
- * "app": {
- * "android": {
- * "osVer": "5.0",
- * "uniVer": "x",
- * "unixVer": "x"
- * },
- * "ios": {
- * "osVer": "12.0",
- * "uniVer": "x",
- * "unixVer": "x"
- * },
- * "harmony": {
- * "osVer": "3.0",
- * "uniVer": "x",
- * "unixVer": "x"
- * }
- * },
- * "web": {
- * "uniVer": "√",
- * "unixVer": "x"
- * }
- * "mp":{
- * "weixin": {
- * "hostVer": "1.9.0",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "alipay": {
- * "hostVer": "√",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "baidu": {
- * "hostVer": "√",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "toutiao": {
- * "hostVer": "√",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "lark": {
- * "hostVer": "x",
- * "uniVer": "x",
- * "unixVer": "x"
- * },
- * "qq": {
- * "hostVer": "x",
- * "uniVer": "x",
- * "unixVer": "x"
- * },
- * "kuaishou": {
- * "hostVer": "x",
- * "uniVer": "x",
- * "unixVer": "x"
- * },
- * "jd": {
- * "hostVer": "x",
- * "uniVer": "x",
- * "unixVer": "x"
- * }
- * }
- * }
- */
- offCanplay(callback: (result: any) => void): void;
- /**
- * 取消监听 onPlay 事件
- * @uniPlatform {
- * "app": {
- * "android": {
- * "osVer": "5.0",
- * "uniVer": "x",
- * "unixVer": "x"
- * },
- * "ios": {
- * "osVer": "12.0",
- * "uniVer": "x",
- * "unixVer": "x"
- * },
- * "harmony": {
- * "osVer": "3.0",
- * "uniVer": "x",
- * "unixVer": "x"
- * }
- * },
- * "web": {
- * "uniVer": "√",
- * "unixVer": "x"
- * }
- * "mp":{
- * "weixin": {
- * "hostVer": "1.9.0",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "alipay": {
- * "hostVer": "√",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "baidu": {
- * "hostVer": "√",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "toutiao": {
- * "hostVer": "√",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "lark": {
- * "hostVer": "x",
- * "uniVer": "x",
- * "unixVer": "x"
- * },
- * "qq": {
- * "hostVer": "x",
- * "uniVer": "x",
- * "unixVer": "x"
- * },
- * "kuaishou": {
- * "hostVer": "x",
- * "uniVer": "x",
- * "unixVer": "x"
- * },
- * "jd": {
- * "hostVer": "x",
- * "uniVer": "x",
- * "unixVer": "x"
- * }
- * }
- * }
- */
- offPlay(callback: (result: any) => void): void;
- /**
- * 取消监听 onPause 事件
- * @uniPlatform {
- * "app": {
- * "android": {
- * "osVer": "5.0",
- * "uniVer": "x",
- * "unixVer": "x"
- * },
- * "ios": {
- * "osVer": "12.0",
- * "uniVer": "x",
- * "unixVer": "x"
- * },
- * "harmony": {
- * "osVer": "3.0",
- * "uniVer": "x",
- * "unixVer": "x"
- * }
- * },
- * "web": {
- * "uniVer": "√",
- * "unixVer": "x"
- * }
- * "mp":{
- * "weixin": {
- * "hostVer": "1.9.0",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "alipay": {
- * "hostVer": "√",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "baidu": {
- * "hostVer": "√",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "toutiao": {
- * "hostVer": "√",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "lark": {
- * "hostVer": "x",
- * "uniVer": "x",
- * "unixVer": "x"
- * },
- * "qq": {
- * "hostVer": "x",
- * "uniVer": "x",
- * "unixVer": "x"
- * },
- * "kuaishou": {
- * "hostVer": "x",
- * "uniVer": "x",
- * "unixVer": "x"
- * },
- * "jd": {
- * "hostVer": "x",
- * "uniVer": "x",
- * "unixVer": "x"
- * }
- * }
- * }
- */
- offPause(callback: (result: any) => void): void;
- /**
- * 取消监听 onStop 事件
- * @uniPlatform {
- * "app": {
- * "android": {
- * "osVer": "5.0",
- * "uniVer": "x",
- * "unixVer": "x"
- * },
- * "ios": {
- * "osVer": "12.0",
- * "uniVer": "x",
- * "unixVer": "x"
- * },
- * "harmony": {
- * "osVer": "3.0",
- * "uniVer": "4.25",
- * "unixVer": "x"
- * }
- * },
- * "web": {
- * "uniVer": "√",
- * "unixVer": "x"
- * }
- * "mp":{
- * "weixin": {
- * "hostVer": "1.9.0",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "alipay": {
- * "hostVer": "√",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "baidu": {
- * "hostVer": "√",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "toutiao": {
- * "hostVer": "√",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "lark": {
- * "hostVer": "x",
- * "uniVer": "x",
- * "unixVer": "x"
- * },
- * "qq": {
- * "hostVer": "x",
- * "uniVer": "x",
- * "unixVer": "x"
- * },
- * "kuaishou": {
- * "hostVer": "x",
- * "uniVer": "x",
- * "unixVer": "x"
- * },
- * "jd": {
- * "hostVer": "x",
- * "uniVer": "x",
- * "unixVer": "x"
- * }
- * }
- * }
- */
- offStop(callback: (result: any) => void): void;
- /**
- * 取消监听 onEnded 事件
- * @uniPlatform {
- * "app": {
- * "android": {
- * "osVer": "5.0",
- * "uniVer": "x",
- * "unixVer": "x"
- * },
- * "ios": {
- * "osVer": "12.0",
- * "uniVer": "x",
- * "unixVer": "x"
- * },
- * "harmony": {
- * "osVer": "3.0",
- * "uniVer": "x",
- * "unixVer": "x"
- * }
- * },
- * "web": {
- * "uniVer": "√",
- * "unixVer": "x"
- * }
- * "mp":{
- * "weixin": {
- * "hostVer": "1.9.0",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "alipay": {
- * "hostVer": "√",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "baidu": {
- * "hostVer": "√",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "toutiao": {
- * "hostVer": "√",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "lark": {
- * "hostVer": "x",
- * "uniVer": "x",
- * "unixVer": "x"
- * },
- * "qq": {
- * "hostVer": "x",
- * "uniVer": "x",
- * "unixVer": "x"
- * },
- * "kuaishou": {
- * "hostVer": "x",
- * "uniVer": "x",
- * "unixVer": "x"
- * },
- * "jd": {
- * "hostVer": "x",
- * "uniVer": "x",
- * "unixVer": "x"
- * }
- * }
- * }
- */
- offEnded(callback: (result: any) => void): void;
- /**
- * 取消监听 onTimeUpdate 事件
- * @uniPlatform {
- * "app": {
- * "android": {
- * "osVer": "5.0",
- * "uniVer": "x",
- * "unixVer": "x"
- * },
- * "ios": {
- * "osVer": "12.0",
- * "uniVer": "x",
- * "unixVer": "x"
- * },
- * "harmony": {
- * "osVer": "3.0",
- * "uniVer": "x",
- * "unixVer": "x"
- * }
- * },
- * "web": {
- * "uniVer": "√",
- * "unixVer": "x"
- * }
- * "mp":{
- * "weixin": {
- * "hostVer": "1.9.0",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "alipay": {
- * "hostVer": "√",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "baidu": {
- * "hostVer": "√",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "toutiao": {
- * "hostVer": "√",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "lark": {
- * "hostVer": "x",
- * "uniVer": "x",
- * "unixVer": "x"
- * },
- * "qq": {
- * "hostVer": "x",
- * "uniVer": "x",
- * "unixVer": "x"
- * },
- * "kuaishou": {
- * "hostVer": "x",
- * "uniVer": "x",
- * "unixVer": "x"
- * },
- * "jd": {
- * "hostVer": "x",
- * "uniVer": "x",
- * "unixVer": "x"
- * }
- * }
- * }
- */
- offTimeUpdate(callback: (result: any) => void): void;
- /**
- * 取消监听 onWaiting 事件
- * @uniPlatform {
- * "app": {
- * "android": {
- * "osVer": "5.0",
- * "uniVer": "x",
- * "unixVer": "x"
- * },
- * "ios": {
- * "osVer": "12.0",
- * "uniVer": "x",
- * "unixVer": "x"
- * },
- * "harmony": {
- * "osVer": "3.0",
- * "uniVer": "x",
- * "unixVer": "x"
- * }
- * },
- * "web": {
- * "uniVer": "√",
- * "unixVer": "x"
- * }
- * "mp":{
- * "weixin": {
- * "hostVer": "1.9.0",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "alipay": {
- * "hostVer": "√",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "baidu": {
- * "hostVer": "√",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "toutiao": {
- * "hostVer": "√",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "lark": {
- * "hostVer": "x",
- * "uniVer": "x",
- * "unixVer": "x"
- * },
- * "qq": {
- * "hostVer": "x",
- * "uniVer": "x",
- * "unixVer": "x"
- * },
- * "kuaishou": {
- * "hostVer": "x",
- * "uniVer": "x",
- * "unixVer": "x"
- * },
- * "jd": {
- * "hostVer": "x",
- * "uniVer": "x",
- * "unixVer": "x"
- * }
- * }
- * }
- */
- offError(callback: (result: any) => void): void;
- /**
- * 取消监听 onWaiting 事件
- * @uniPlatform {
- * "app": {
- * "android": {
- * "osVer": "5.0",
- * "uniVer": "x",
- * "unixVer": "x"
- * },
- * "ios": {
- * "osVer": "12.0",
- * "uniVer": "x",
- * "unixVer": "x"
- * },
- * "harmony": {
- * "osVer": "3.0",
- * "uniVer": "x",
- * "unixVer": "x"
- * }
- * },
- * "web": {
- * "uniVer": "√",
- * "unixVer": "x"
- * }
- * "mp":{
- * "weixin": {
- * "hostVer": "1.9.0",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "alipay": {
- * "hostVer": "√",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "baidu": {
- * "hostVer": "√",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "toutiao": {
- * "hostVer": "√",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "lark": {
- * "hostVer": "x",
- * "uniVer": "x",
- * "unixVer": "x"
- * },
- * "qq": {
- * "hostVer": "x",
- * "uniVer": "x",
- * "unixVer": "x"
- * },
- * "kuaishou": {
- * "hostVer": "x",
- * "uniVer": "x",
- * "unixVer": "x"
- * },
- * "jd": {
- * "hostVer": "x",
- * "uniVer": "x",
- * "unixVer": "x"
- * }
- * }
- * }
- */
- offWaiting(callback: (result: any) => void): void;
- /**
- * 取消监听 onSeeking 事件
- * @uniPlatform {
- * "app": {
- * "android": {
- * "osVer": "5.0",
- * "uniVer": "x",
- * "unixVer": "x"
- * },
- * "ios": {
- * "osVer": "12.0",
- * "uniVer": "x",
- * "unixVer": "x"
- * },
- * "harmony": {
- * "osVer": "3.0",
- * "uniVer": "x",
- * "unixVer": "x"
- * }
- * },
- * "web": {
- * "uniVer": "√",
- * "unixVer": "x"
- * }
- * "mp":{
- * "weixin": {
- * "hostVer": "1.9.0",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "alipay": {
- * "hostVer": "√",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "baidu": {
- * "hostVer": "√",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "toutiao": {
- * "hostVer": "√",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "lark": {
- * "hostVer": "x",
- * "uniVer": "x",
- * "unixVer": "x"
- * },
- * "qq": {
- * "hostVer": "x",
- * "uniVer": "x",
- * "unixVer": "x"
- * },
- * "kuaishou": {
- * "hostVer": "x",
- * "uniVer": "x",
- * "unixVer": "x"
- * },
- * "jd": {
- * "hostVer": "x",
- * "uniVer": "x",
- * "unixVer": "x"
- * }
- * }
- * }
- */
- offSeeking(callback: (result: any) => void): void;
- /**
- * 取消监听 onSeeked 事件
- * @uniPlatform {
- * "app": {
- * "android": {
- * "osVer": "5.0",
- * "uniVer": "x",
- * "unixVer": "x"
- * },
- * "ios": {
- * "osVer": "12.0",
- * "uniVer": "x",
- * "unixVer": "x"
- * },
- * "harmony": {
- * "osVer": "3.0",
- * "uniVer": "x",
- * "unixVer": "x"
- * }
- * },
- * "web": {
- * "uniVer": "√",
- * "unixVer": "x"
- * }
- * "mp":{
- * "weixin": {
- * "hostVer": "1.9.0",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "alipay": {
- * "hostVer": "√",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "baidu": {
- * "hostVer": "√",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "toutiao": {
- * "hostVer": "√",
- * "uniVer": "√",
- * "unixVer": "x"
- * },
- * "lark": {
- * "hostVer": "x",
- * "uniVer": "x",
- * "unixVer": "x"
- * },
- * "qq": {
- * "hostVer": "x",
- * "uniVer": "x",
- * "unixVer": "x"
- * },
- * "kuaishou": {
- * "hostVer": "x",
- * "uniVer": "x",
- * "unixVer": "x"
- * },
- * "jd": {
- * "hostVer": "x",
- * "uniVer": "x",
- * "unixVer": "x"
- * }
- * }
- * }
- */
- offSeeked(callback: (result: any) => void): void;
+ /**
+ * 当前音频的长度(单位:s),只有在当前有合法的 src 时返回
+ * @uniPlatform
+ {
+ "app": {
+ "android": {
+ "osVer": "5.0",
+ "uniVer": "√",
+ "uniUtsPlugin": "x",
+ "unixVer": "4.33",
+ "unixUtsPlugin": "4.33"
+ },
+ "ios": {
+ "osVer": "12.0",
+ "uniVer": "√",
+ "uniUtsPlugin": "x",
+ "unixVer": "x",
+ "unixUtsPlugin": "x"
+ }
+ },
+ "web": {
+ "uniVer": "√",
+ "unixVer": "4.0"
+ }
+ }
+ */
+ duration : number;
+ /**
+ * 当前音频的播放位置(单位:s),只有在当前有合法的 src 时返回
+ * @uniPlatform
+ {
+ "app": {
+ "android": {
+ "osVer": "5.0",
+ "uniVer": "√",
+ "uniUtsPlugin": "x",
+ "unixVer": "4.33",
+ "unixUtsPlugin": "4.33"
+ },
+ "ios": {
+ "osVer": "12.0",
+ "uniVer": "√",
+ "uniUtsPlugin": "x",
+ "unixVer": "x",
+ "unixUtsPlugin": "x"
+ }
+ },
+ "web": {
+ "uniVer": "√",
+ "unixVer": "4.0"
+ }
+ }
+ */
+ currentTime : number;
+ /**
+ * 当前是是否暂停或停止状态,true 表示暂停或停止,false 表示正在播放
+ * @uniPlatform
+ {
+ "app": {
+ "android": {
+ "osVer": "5.0",
+ "uniVer": "√",
+ "uniUtsPlugin": "x",
+ "unixVer": "4.33",
+ "unixUtsPlugin": "4.33"
+ },
+ "ios": {
+ "osVer": "12.0",
+ "uniVer": "√",
+ "uniUtsPlugin": "x",
+ "unixVer": "x",
+ "unixUtsPlugin": "x"
+ }
+ },
+ "web": {
+ "uniVer": "√",
+ "unixVer": "4.0"
+ }
+ }
+ * @type boolean
+ */
+ paused : boolean;
+ /**
+ * 音频的数据链接,用于直接播放
+ * @uniPlatform
+ {
+ "app": {
+ "android": {
+ "osVer": "5.0",
+ "uniVer": "√",
+ "uniUtsPlugin": "x",
+ "unixVer": "4.33",
+ "unixUtsPlugin": "4.33"
+ },
+ "ios": {
+ "osVer": "12.0",
+ "uniVer": "√",
+ "uniUtsPlugin": "x",
+ "unixVer": "x",
+ "unixUtsPlugin": "x"
+ }
+ },
+ "web": {
+ "uniVer": "√",
+ "unixVer": "4.0"
+ }
+ }
+ */
+ src : string;
+ /**
+ * 音频开始播放的位置(单位:s)
+ * @uniPlatform
+ {
+ "app": {
+ "android": {
+ "osVer": "5.0",
+ "uniVer": "√",
+ "uniUtsPlugin": "x",
+ "unixVer": "4.33",
+ "unixUtsPlugin": "4.33"
+ },
+ "ios": {
+ "osVer": "12.0",
+ "uniVer": "√",
+ "uniUtsPlugin": "x",
+ "unixVer": "x",
+ "unixUtsPlugin": "x"
+ }
+ },
+ "web": {
+ "uniVer": "√",
+ "unixVer": "4.0"
+ }
+ }
+ */
+ startTime : number;
+ /**
+ * 音频缓冲的时间点,仅保证当前播放时间点到此时间点内容已缓冲
+ * @uniPlatform
+ {
+ "app": {
+ "android": {
+ "osVer": "5.0",
+ "uniVer": "√",
+ "uniUtsPlugin": "x",
+ "unixVer": "4.33",
+ "unixUtsPlugin": "4.33"
+ },
+ "ios": {
+ "osVer": "12.0",
+ "uniVer": "√",
+ "uniUtsPlugin": "x",
+ "unixVer": "x",
+ "unixUtsPlugin": "x"
+ }
+ },
+ "web": {
+ "uniVer": "√",
+ "unixVer": "4.0"
+ }
+ }
+ */
+ buffered : number;
+ /**
+ * 是否自动开始播放,默认 false
+ * @defaultValue false
+ * @uniPlatform
+ {
+ "app": {
+ "android": {
+ "osVer": "5.0",
+ "uniVer": "√",
+ "uniUtsPlugin": "x",
+ "unixVer": "4.33",
+ "unixUtsPlugin": "4.33"
+ },
+ "ios": {
+ "osVer": "12.0",
+ "uniVer": "√",
+ "uniUtsPlugin": "x",
+ "unixVer": "x",
+ "unixUtsPlugin": "x"
+ }
+ },
+ "web": {
+ "uniVer": "√",
+ "unixVer": "4.0"
+ }
+ }
+ * @type boolean
+ */
+ autoplay : boolean;
+ /**
+ * 是否循环播放,默认 false
+ * @defaultValue false
+ * @uniPlatform
+ {
+ "app": {
+ "android": {
+ "osVer": "5.0",
+ "uniVer": "√",
+ "uniUtsPlugin": "x",
+ "unixVer": "4.33",
+ "unixUtsPlugin": "4.33"
+ },
+ "ios": {
+ "osVer": "12.0",
+ "uniVer": "√",
+ "uniUtsPlugin": "x",
+ "unixVer": "x",
+ "unixUtsPlugin": "x"
+ }
+ },
+ "web": {
+ "uniVer": "√",
+ "unixVer": "4.0"
+ }
+ }
+ * @type boolean
+ */
+ loop : boolean;
+ /**
+ * 是否遵循系统静音开关,当此参数为 false 时,即使用户打开了静音开关,也能继续发出声音,默认值 true
+ * @type boolean
+ * @uniPlatform
+ {
+ "app": {
+ "android": {
+ "osVer": "5.0",
+ "uniVer": "√",
+ "uniUtsPlugin": "x",
+ "unixVer": "4.33",
+ "unixUtsPlugin": "4.33"
+ },
+ "ios": {
+ "osVer": "12.0",
+ "uniVer": "√",
+ "uniUtsPlugin": "x",
+ "unixVer": "x",
+ "unixUtsPlugin": "x"
+ }
+ },
+ "web": {
+ "uniVer": "x",
+ "unixVer": "x"
+ }
+ }
+ */
+ obeyMuteSwitch : boolean;
+ /**
+ * 音量。范围 0~1。
+ * @uniPlatform
+ {
+ "app": {
+ "android": {
+ "osVer": "5.0",
+ "uniVer": "√",
+ "uniUtsPlugin": "x",
+ "unixVer": "4.33",
+ "unixUtsPlugin": "4.33"
+ },
+ "ios": {
+ "osVer": "12.0",
+ "uniVer": "√",
+ "uniUtsPlugin": "x",
+ "unixVer": "x",
+ "unixUtsPlugin": "x"
+ }
+ },
+ "web": {
+ "uniVer": "√",
+ "unixVer": "4.0"
+ }
+ }
+ */
+ volume : number;
+ /**
+ * 播放的倍率。可取值: 0.5/0.8/1.0/1.25/1.5/2.0,默认值为1.0。(仅 App 支持)
+ * @defaultValue 1.0
+ * @uniPlatform
+ {
+ "app": {
+ "android": {
+ "osVer": "5.0",
+ "uniVer": "√",
+ "uniUtsPlugin": "x",
+ "unixVer": "4.33",
+ "unixUtsPlugin": "4.33"
+ },
+ "ios": {
+ "osVer": "12.0",
+ "uniVer": "√",
+ "uniUtsPlugin": "x",
+ "unixVer": "x",
+ "unixUtsPlugin": "x"
+ }
+ },
+ "web": {
+ "uniVer": "x",
+ "unixVer": "x"
+ }
+ }
+ */
+ playbackRate ?: number;
+ /**
+ * 暂停
+ * @uniPlatform
+ {
+ "app": {
+ "android": {
+ "osVer": "5.0",
+ "uniVer": "√",
+ "uniUtsPlugin": "x",
+ "unixVer": "4.33",
+ "unixUtsPlugin": "4.33"
+ },
+ "ios": {
+ "osVer": "12.0",
+ "uniVer": "√",
+ "uniUtsPlugin": "x",
+ "unixVer": "x",
+ "unixUtsPlugin": "x"
+ }
+ },
+ "web": {
+ "uniVer": "√",
+ "unixVer": "4.0"
+ }
+ }
+ */
+ pause() : void;
+ /**
+ * 停止
+ * @uniPlatform
+ {
+ "app": {
+ "android": {
+ "osVer": "5.0",
+ "uniVer": "√",
+ "uniUtsPlugin": "x",
+ "unixVer": "4.33",
+ "unixUtsPlugin": "4.33"
+ },
+ "ios": {
+ "osVer": "12.0",
+ "uniVer": "√",
+ "uniUtsPlugin": "x",
+ "unixVer": "x",
+ "unixUtsPlugin": "x"
+ }
+ },
+ "web": {
+ "uniVer": "√",
+ "unixVer": "4.0"
+ }
+ }
+ */
+ stop() : void;
+ /**
+ * 播放
+ * @uniPlatform
+ {
+ "app": {
+ "android": {
+ "osVer": "5.0",
+ "uniVer": "√",
+ "uniUtsPlugin": "x",
+ "unixVer": "4.33",
+ "unixUtsPlugin": "4.33"
+ },
+ "ios": {
+ "osVer": "12.0",
+ "uniVer": "√",
+ "uniUtsPlugin": "x",
+ "unixVer": "x",
+ "unixUtsPlugin": "x"
+ }
+ },
+ "web": {
+ "uniVer": "√",
+ "unixVer": "4.0"
+ }
+ }
+ */
+ play() : void;
+ /**
+ * 跳转到指定位置,单位 s
+ * @uniPlatform
+ {
+ "app": {
+ "android": {
+ "osVer": "5.0",
+ "uniVer": "√",
+ "uniUtsPlugin": "x",
+ "unixVer": "4.33",
+ "unixUtsPlugin": "4.33"
+ },
+ "ios": {
+ "osVer": "12.0",
+ "uniVer": "√",
+ "uniUtsPlugin": "x",
+ "unixVer": "x",
+ "unixUtsPlugin": "x"
+ }
+ },
+ "web": {
+ "uniVer": "√",
+ "unixVer": "4.0"
+ }
+ }
+ */
+ seek(position : number) : void;
+ /**
+ * 销毁当前实例
+ * @uniPlatform
+ {
+ "app": {
+ "android": {
+ "osVer": "5.0",
+ "uniVer": "√",
+ "uniUtsPlugin": "x",
+ "unixVer": "4.33",
+ "unixUtsPlugin": "4.33"
+ },
+ "ios": {
+ "osVer": "12.0",
+ "uniVer": "√",
+ "uniUtsPlugin": "x",
+ "unixVer": "x",
+ "unixUtsPlugin": "x"
+ }
+ },
+ "web": {
+ "uniVer": "√",
+ "unixVer": "4.0"
+ }
+ }
+ */
+ destroy() : void;
+ /**
+ * 音频进入可以播放状态,但不保证后面可以流畅播放
+ * @uniPlatform
+ {
+ "app": {
+ "android": {
+ "osVer": "5.0",
+ "uniVer": "√",
+ "uniUtsPlugin": "x",
+ "unixVer": "4.33",
+ "unixUtsPlugin": "4.33"
+ },
+ "ios": {
+ "osVer": "12.0",
+ "uniVer": "√",
+ "uniUtsPlugin": "x",
+ "unixVer": "x",
+ "unixUtsPlugin": "x"
+ }
+ },
+ "web": {
+ "uniVer": "√",
+ "unixVer": "4.0"
+ }
+ }
+ */
+ onCanplay(callback : (result : any) => void) : void;
+ /**
+ * 音频播放事件
+ * @uniPlatform
+ {
+ "app": {
+ "android": {
+ "osVer": "5.0",
+ "uniVer": "√",
+ "uniUtsPlugin": "x",
+ "unixVer": "4.33",
+ "unixUtsPlugin": "4.33"
+ },
+ "ios": {
+ "osVer": "12.0",
+ "uniVer": "√",
+ "uniUtsPlugin": "x",
+ "unixVer": "x",
+ "unixUtsPlugin": "x"
+ }
+ },
+ "web": {
+ "uniVer": "√",
+ "unixVer": "4.0"
+ }
+ }
+ * }
+ */
+ onPlay(callback : (result : any) => void) : void;
+ /**
+ * 音频暂停事件
+ * @uniPlatform
+ {
+ "app": {
+ "android": {
+ "osVer": "5.0",
+ "uniVer": "√",
+ "uniUtsPlugin": "x",
+ "unixVer": "4.33",
+ "unixUtsPlugin": "4.33"
+ },
+ "ios": {
+ "osVer": "12.0",
+ "uniVer": "√",
+ "uniUtsPlugin": "x",
+ "unixVer": "x",
+ "unixUtsPlugin": "x"
+ }
+ },
+ "web": {
+ "uniVer": "√",
+ "unixVer": "4.0"
+ }
+ }
+ * }
+ */
+ onPause(callback : (result : any) => void) : void;
+ /**
+ * 音频停止事件
+ * @uniPlatform
+ {
+ "app": {
+ "android": {
+ "osVer": "5.0",
+ "uniVer": "√",
+ "uniUtsPlugin": "x",
+ "unixVer": "4.33",
+ "unixUtsPlugin": "4.33"
+ },
+ "ios": {
+ "osVer": "12.0",
+ "uniVer": "√",
+ "uniUtsPlugin": "x",
+ "unixVer": "x",
+ "unixUtsPlugin": "x"
+ }
+ },
+ "web": {
+ "uniVer": "√",
+ "unixVer": "4.0"
+ }
+ }
+ */
+ onStop(callback : (result : any) => void) : void;
+ /**
+ * 音频自然播放结束事件
+ * @uniPlatform
+ {
+ "app": {
+ "android": {
+ "osVer": "5.0",
+ "uniVer": "√",
+ "uniUtsPlugin": "x",
+ "unixVer": "4.33",
+ "unixUtsPlugin": "4.33"
+ },
+ "ios": {
+ "osVer": "12.0",
+ "uniVer": "√",
+ "uniUtsPlugin": "x",
+ "unixVer": "x",
+ "unixUtsPlugin": "x"
+ }
+ },
+ "web": {
+ "uniVer": "√",
+ "unixVer": "4.0"
+ }
+ }
+ */
+ onEnded(callback : (result : any) => void) : void;
+ /**
+ * 音频播放进度更新事件
+ * @uniPlatform
+ {
+ "app": {
+ "android": {
+ "osVer": "5.0",
+ "uniVer": "√",
+ "uniUtsPlugin": "x",
+ "unixVer": "4.33",
+ "unixUtsPlugin": "4.33"
+ },
+ "ios": {
+ "osVer": "12.0",
+ "uniVer": "√",
+ "uniUtsPlugin": "x",
+ "unixVer": "x",
+ "unixUtsPlugin": "x"
+ }
+ },
+ "web": {
+ "uniVer": "√",
+ "unixVer": "4.0"
+ }
+ }
+ */
+ onTimeUpdate(callback : (result : any) => void) : void;
+ /**
+ * 音频播放错误事件
+ * @uniPlatform
+ {
+ "app": {
+ "android": {
+ "osVer": "5.0",
+ "uniVer": "√",
+ "uniUtsPlugin": "x",
+ "unixVer": "4.33",
+ "unixUtsPlugin": "4.33"
+ },
+ "ios": {
+ "osVer": "12.0",
+ "uniVer": "√",
+ "uniUtsPlugin": "x",
+ "unixVer": "x",
+ "unixUtsPlugin": "x"
+ }
+ },
+ "web": {
+ "uniVer": "√",
+ "unixVer": "4.0"
+ }
+ }
+ */
+ onError(callback : (result : ICreateInnerAudioContextFail) => void) : void;
+ /**
+ * 音频加载中事件,当音频因为数据不足,需要停下来加载时会触发
+ * @uniPlatform
+ {
+ "app": {
+ "android": {
+ "osVer": "5.0",
+ "uniVer": "√",
+ "uniUtsPlugin": "x",
+ "unixVer": "4.33",
+ "unixUtsPlugin": "4.33"
+ },
+ "ios": {
+ "osVer": "12.0",
+ "uniVer": "√",
+ "uniUtsPlugin": "x",
+ "unixVer": "x",
+ "unixUtsPlugin": "x"
+ }
+ },
+ "web": {
+ "uniVer": "√",
+ "unixVer": "4.0"
+ }
+ }
+ */
+ onWaiting(callback : (result : any) => void) : void;
+ /**
+ * 音频进行 seek 操作事件
+ * @uniPlatform
+ {
+ "app": {
+ "android": {
+ "osVer": "5.0",
+ "uniVer": "√",
+ "uniUtsPlugin": "x",
+ "unixVer": "4.33",
+ "unixUtsPlugin": "4.33"
+ },
+ "ios": {
+ "osVer": "12.0",
+ "uniVer": "√",
+ "uniUtsPlugin": "x",
+ "unixVer": "x",
+ "unixUtsPlugin": "x"
+ }
+ },
+ "web": {
+ "uniVer": "√",
+ "unixVer": "4.0"
+ }
+ }
+ */
+ onSeeking(callback : (result : any) => void) : void;
+ /**
+ * 音频完成 seek 操作事件
+ * @uniPlatform
+ {
+ "app": {
+ "android": {
+ "osVer": "5.0",
+ "uniVer": "√",
+ "uniUtsPlugin": "x",
+ "unixVer": "4.33",
+ "unixUtsPlugin": "4.33"
+ },
+ "ios": {
+ "osVer": "12.0",
+ "uniVer": "√",
+ "uniUtsPlugin": "x",
+ "unixVer": "x",
+ "unixUtsPlugin": "x"
+ }
+ },
+ "web": {
+ "uniVer": "√",
+ "unixVer": "4.0"
+ }
+ }
+ */
+ onSeeked(callback : (result : any) => void) : void;
+ /**
+ * 取消监听 onCanplay 事件
+ * @uniPlatform
+ {
+ "app": {
+ "android": {
+ "osVer": "5.0",
+ "uniVer": "√",
+ "uniUtsPlugin": "x",
+ "unixVer": "4.33",
+ "unixUtsPlugin": "4.33"
+ },
+ "ios": {
+ "osVer": "12.0",
+ "uniVer": "√",
+ "uniUtsPlugin": "x",
+ "unixVer": "x",
+ "unixUtsPlugin": "x"
+ }
+ },
+ "web": {
+ "uniVer": "√",
+ "unixVer": "4.0"
+ }
+ }
+ */
+ offCanplay(callback : (result : any) => void) : void;
+ /**
+ * 取消监听 onPlay 事件
+ * @uniPlatform
+ {
+ "app": {
+ "android": {
+ "osVer": "5.0",
+ "uniVer": "√",
+ "uniUtsPlugin": "x",
+ "unixVer": "4.33",
+ "unixUtsPlugin": "4.33"
+ },
+ "ios": {
+ "osVer": "12.0",
+ "uniVer": "√",
+ "uniUtsPlugin": "x",
+ "unixVer": "x",
+ "unixUtsPlugin": "x"
+ }
+ },
+ "web": {
+ "uniVer": "√",
+ "unixVer": "4.0"
+ }
+ }
+ */
+ offPlay(callback : (result : any) => void) : void;
+ /**
+ * 取消监听 onPause 事件
+ * @uniPlatform
+ {
+ "app": {
+ "android": {
+ "osVer": "5.0",
+ "uniVer": "√",
+ "uniUtsPlugin": "x",
+ "unixVer": "4.33",
+ "unixUtsPlugin": "4.33"
+ },
+ "ios": {
+ "osVer": "12.0",
+ "uniVer": "√",
+ "uniUtsPlugin": "x",
+ "unixVer": "x",
+ "unixUtsPlugin": "x"
+ }
+ },
+ "web": {
+ "uniVer": "√",
+ "unixVer": "4.0"
+ }
+ }
+ */
+ offPause(callback : (result : any) => void) : void;
+ /**
+ * 取消监听 onStop 事件
+ * @uniPlatform
+ {
+ "app": {
+ "android": {
+ "osVer": "5.0",
+ "uniVer": "√",
+ "uniUtsPlugin": "x",
+ "unixVer": "4.33",
+ "unixUtsPlugin": "4.33"
+ },
+ "ios": {
+ "osVer": "12.0",
+ "uniVer": "√",
+ "uniUtsPlugin": "x",
+ "unixVer": "x",
+ "unixUtsPlugin": "x"
+ }
+ },
+ "web": {
+ "uniVer": "√",
+ "unixVer": "4.0"
+ }
+ }
+ */
+ offStop(callback : (result : any) => void) : void;
+ /**
+ * 取消监听 onEnded 事件
+ * @uniPlatform
+ {
+ "app": {
+ "android": {
+ "osVer": "5.0",
+ "uniVer": "√",
+ "uniUtsPlugin": "x",
+ "unixVer": "4.33",
+ "unixUtsPlugin": "4.33"
+ },
+ "ios": {
+ "osVer": "12.0",
+ "uniVer": "√",
+ "uniUtsPlugin": "x",
+ "unixVer": "x",
+ "unixUtsPlugin": "x"
+ }
+ },
+ "web": {
+ "uniVer": "√",
+ "unixVer": "4.0"
+ }
+ }
+ */
+ offEnded(callback : (result : any) => void) : void;
+ /**
+ * 取消监听 onTimeUpdate 事件
+ * @uniPlatform
+ {
+ "app": {
+ "android": {
+ "osVer": "5.0",
+ "uniVer": "√",
+ "uniUtsPlugin": "x",
+ "unixVer": "4.33",
+ "unixUtsPlugin": "4.33"
+ },
+ "ios": {
+ "osVer": "12.0",
+ "uniVer": "√",
+ "uniUtsPlugin": "x",
+ "unixVer": "x",
+ "unixUtsPlugin": "x"
+ }
+ },
+ "web": {
+ "uniVer": "√",
+ "unixVer": "4.0"
+ }
+ }
+ */
+ offTimeUpdate(callback : (result : any) => void) : void;
+ /**
+ * 取消监听 onWaiting 事件
+ * @uniPlatform
+ {
+ "app": {
+ "android": {
+ "osVer": "5.0",
+ "uniVer": "√",
+ "uniUtsPlugin": "x",
+ "unixVer": "4.33",
+ "unixUtsPlugin": "4.33"
+ },
+ "ios": {
+ "osVer": "12.0",
+ "uniVer": "√",
+ "uniUtsPlugin": "x",
+ "unixVer": "x",
+ "unixUtsPlugin": "x"
+ }
+ },
+ "web": {
+ "uniVer": "√",
+ "unixVer": "4.0"
+ }
+ }
+ */
+ offError(callback : (result : ICreateInnerAudioContextFail) => void) : void;
+ /**
+ * 取消监听 onWaiting 事件
+ * @uniPlatform
+ {
+ "app": {
+ "android": {
+ "osVer": "5.0",
+ "uniVer": "√",
+ "uniUtsPlugin": "x",
+ "unixVer": "4.33",
+ "unixUtsPlugin": "4.33"
+ },
+ "ios": {
+ "osVer": "12.0",
+ "uniVer": "√",
+ "uniUtsPlugin": "x",
+ "unixVer": "x",
+ "unixUtsPlugin": "x"
+ }
+ },
+ "web": {
+ "uniVer": "√",
+ "unixVer": "4.0"
+ }
+ }
+ */
+ offWaiting(callback : (result : any) => void) : void;
+ /**
+ * 取消监听 onSeeking 事件
+ * @uniPlatform
+ {
+ "app": {
+ "android": {
+ "osVer": "5.0",
+ "uniVer": "√",
+ "uniUtsPlugin": "x",
+ "unixVer": "4.33",
+ "unixUtsPlugin": "4.33"
+ },
+ "ios": {
+ "osVer": "12.0",
+ "uniVer": "√",
+ "uniUtsPlugin": "x",
+ "unixVer": "x",
+ "unixUtsPlugin": "x"
+ }
+ },
+ "web": {
+ "uniVer": "√",
+ "unixVer": "4.0"
+ }
+ }
+ */
+ offSeeking(callback : (result : any) => void) : void;
+ /**
+ * 取消监听 onSeeked 事件
+ * @uniPlatform
+ {
+ "app": {
+ "android": {
+ "osVer": "5.0",
+ "uniVer": "√",
+ "uniUtsPlugin": "x",
+ "unixVer": "4.33",
+ "unixUtsPlugin": "4.33"
+ },
+ "ios": {
+ "osVer": "12.0",
+ "uniVer": "√",
+ "uniUtsPlugin": "x",
+ "unixVer": "x",
+ "unixUtsPlugin": "x"
+ }
+ },
+ "web": {
+ "uniVer": "√",
+ "unixVer": "4.0"
+ }
+ }
+ */
+ offSeeked(callback : (result : any) => void) : void;
}
+
+/**
+ * 错误码
+ */
+export type CreateInnerAudioContextErrorCode =
+ /**
+ * 系统错误
+ * @uniPlatform
+ {
+ "app": {
+ "android": {
+ "osVer": "5.0",
+ "uniVer": "√",
+ "uniUtsPlugin": "x",
+ "unixVer": "4.33",
+ "unixUtsPlugin": "4.33"
+ },
+ "ios": {
+ "osVer": "12.0",
+ "uniVer": "√",
+ "uniUtsPlugin": "x",
+ "unixVer": "x",
+ "unixUtsPlugin": "x"
+ }
+ },
+ "web": {
+ "uniVer": "x",
+ "unixVer": "x"
+ }
+ }
+ */
+ 1107601 |
+ /**
+ * 网络错误
+ * @uniPlatform
+ {
+ "app": {
+ "android": {
+ "osVer": "5.0",
+ "uniVer": "√",
+ "uniUtsPlugin": "x",
+ "unixVer": "4.33",
+ "unixUtsPlugin": "4.33"
+ },
+ "ios": {
+ "osVer": "12.0",
+ "uniVer": "√",
+ "uniUtsPlugin": "x",
+ "unixVer": "x",
+ "unixUtsPlugin": "x"
+ }
+ },
+ "web": {
+ "uniVer": "x",
+ "unixVer": "x"
+ }
+ }
+ */
+ 1107602 |
+ /**
+ * 文件错误
+ * @uniPlatform
+ {
+ "app": {
+ "android": {
+ "osVer": "5.0",
+ "uniVer": "√",
+ "uniUtsPlugin": "x",
+ "unixVer": "4.33",
+ "unixUtsPlugin": "4.33"
+ },
+ "ios": {
+ "osVer": "12.0",
+ "uniVer": "√",
+ "uniUtsPlugin": "x",
+ "unixVer": "x",
+ "unixUtsPlugin": "x"
+ }
+ },
+ "web": {
+ "uniVer": "x",
+ "unixVer": "x"
+ }
+ }
+ */
+ 1107603 |
+ /**
+ * 格式错误
+ * @uniPlatform
+ {
+ "app": {
+ "android": {
+ "osVer": "5.0",
+ "uniVer": "√",
+ "uniUtsPlugin": "x",
+ "unixVer": "4.33",
+ "unixUtsPlugin": "4.33"
+ },
+ "ios": {
+ "osVer": "12.0",
+ "uniVer": "√",
+ "uniUtsPlugin": "x",
+ "unixVer": "x",
+ "unixUtsPlugin": "x"
+ }
+ },
+ "web": {
+ "uniVer": "x",
+ "unixVer": "x"
+ }
+ }
+ */
+ 1107604 |
+ /**
+ * 未知错误
+ * @uniPlatform
+ {
+ "app": {
+ "android": {
+ "osVer": "5.0",
+ "uniVer": "√",
+ "uniUtsPlugin": "x",
+ "unixVer": "4.33",
+ "unixUtsPlugin": "4.33"
+ },
+ "ios": {
+ "osVer": "12.0",
+ "uniVer": "√",
+ "uniUtsPlugin": "x",
+ "unixVer": "x",
+ "unixUtsPlugin": "x"
+ }
+ },
+ "web": {
+ "uniVer": "x",
+ "unixVer": "x"
+ }
+ }
+ */
+ 1107605 |
+ /**
+ * 播放路径不能为空
+ * @uniPlatform
+ {
+ "app": {
+ "android": {
+ "osVer": "5.0",
+ "uniVer": "√",
+ "uniUtsPlugin": "x",
+ "unixVer": "4.33",
+ "unixUtsPlugin": "4.33"
+ },
+ "ios": {
+ "osVer": "12.0",
+ "uniVer": "√",
+ "uniUtsPlugin": "x",
+ "unixVer": "x",
+ "unixUtsPlugin": "x"
+ }
+ },
+ "web": {
+ "uniVer": "x",
+ "unixVer": "x"
+ }
+ }
+ */
+ 1107609;
+
+export interface ICreateInnerAudioContextFail extends IUniError {
+ errCode : CreateInnerAudioContextErrorCode
+};
\ No newline at end of file
diff --git a/uni_modules/uni-createInnerAudioContext/utssdk/unierror.uts b/uni_modules/uni-createInnerAudioContext/utssdk/unierror.uts
new file mode 100644
index 0000000000000000000000000000000000000000..75bce43f32339cbd0e8ed88cbbdc1851ca1b3a42
--- /dev/null
+++ b/uni_modules/uni-createInnerAudioContext/utssdk/unierror.uts
@@ -0,0 +1,47 @@
+import { CreateInnerAudioContextErrorCode, ICreateInnerAudioContextFail } from "./interface.uts"
+
+/**
+ * 错误主题
+ */
+
+export const CreateInnerAudioUniErrorSubject = 'uni-createInnerAudioContext';
+
+/**
+ * 错误码
+ * @UniError
+ */
+export const CreateInnerAudioContextUniErrors : Map = new Map([
+ /**
+ * 系统错误
+ */
+ [1107601, 'system error.'],
+ /**
+ * 网络错误
+ */
+ [1107602, 'network error.'],
+ /**
+ * 文件错误
+ */
+ [1107603, 'file error.'],
+ /**
+ * 格式错误
+ */
+ [1107604, 'format error.'],
+ /**
+ * 未知错误
+ */
+ [1107605, 'unknown error.'],
+ /**
+ * 播放路径不能为空
+ */
+ [1107609, 'empty src.'],
+]);
+
+export class CreateInnerAudioContextFailImpl extends UniError implements ICreateInnerAudioContextFail {
+ constructor(errCode : CreateInnerAudioContextErrorCode) {
+ super();
+ this.errSubject = CreateInnerAudioUniErrorSubject;
+ this.errCode = errCode;
+ this.errMsg = CreateInnerAudioContextUniErrors[errCode] ?? "";
+ }
+}
\ No newline at end of file
diff --git a/uni_modules/uni-dialogPage/utssdk/app-android/closeDialogPage.uts b/uni_modules/uni-dialogPage/utssdk/app-android/closeDialogPage.uts
index d314e3ff3e5ddddd3f3adea0ab5cf3b6970f4d62..2dbdc933de81fb079f566dbd76e412f579549407 100644
--- a/uni_modules/uni-dialogPage/utssdk/app-android/closeDialogPage.uts
+++ b/uni_modules/uni-dialogPage/utssdk/app-android/closeDialogPage.uts
@@ -3,14 +3,28 @@ import {
ANIMATION_TYPE,
getCurrentPage,
Page,
+ isSystemDialogPage,
} from '@dcloudio/uni-runtime'
+import {
+ DEFAULT_ANIMATION_DURATION,
+ DEFAULT_ANIMATION_OUT,
+} from '../constants.uts'
import { CloseDialogPageOptions } from '../interface.uts'
import { CloseDialogPageSuccessImpl, CloseDialogPageFailImpl } from '../unierror.uts'
export const closeDialogPage = (options: CloseDialogPageOptions | null) => {
+ if (options?.animationType === 'pop-out') {
+ options.animationType = 'none'
+ }
const closeOptions = new Map([
- [ANIMATION_TYPE, 'none'],
- [ANIMATION_DURATION, 0],
+ [
+ ANIMATION_TYPE,
+ options?.animationType ?? DEFAULT_ANIMATION_OUT,
+ ],
+ [
+ ANIMATION_DURATION,
+ options?.animationDuration ?? DEFAULT_ANIMATION_DURATION,
+ ],
])
if (options?.dialogPage === null) {
const currentPage = getCurrentPage()
@@ -35,6 +49,10 @@ export const closeDialogPage = (options: CloseDialogPageOptions | null) => {
const dialogPage = options?.dialogPage!
const currentPages = getCurrentPages()
const parentPage = dialogPage.getParentPage()
+ if (isSystemDialogPage(dialogPage)) {
+ (dialogPage.$vm as Page).$close(closeOptions)
+ return
+ }
if ((dialogPage.$vm as Page).$dialog === null ||
currentPages.indexOf(parentPage) === -1 ||
parentPage!.getDialogPages().indexOf(dialogPage) === -1) {
@@ -44,7 +62,7 @@ export const closeDialogPage = (options: CloseDialogPageOptions | null) => {
options.complete?.(errRes)
}
} else {
- (dialogPage!.$vm as Page).$close(closeOptions)
+ (dialogPage.$vm as Page).$close(closeOptions)
if (options !== null) {
const successRes = new CloseDialogPageSuccessImpl()
options.success?.(successRes)
diff --git a/uni_modules/uni-dialogPage/utssdk/app-android/openDialogPage.uts b/uni_modules/uni-dialogPage/utssdk/app-android/openDialogPage.uts
index fb5f89dccddb92b22084f050bb57ab6269522fd8..9f4ae3f89bce05ecf1d9d5b017f9110b30c22b8a 100644
--- a/uni_modules/uni-dialogPage/utssdk/app-android/openDialogPage.uts
+++ b/uni_modules/uni-dialogPage/utssdk/app-android/openDialogPage.uts
@@ -5,6 +5,11 @@ import {
navigateDialogPage,
} from '@dcloudio/uni-runtime'
import { normalizeRouteOptions } from '../protocols.uts'
+import {
+ DEFAULT_ANIMATION_DURATION,
+ DEFAULT_ANIMATION_IN,
+} from '../constants.uts'
+
import { OpenDialogPageOptions } from '../interface.uts'
import { OpenDialogPageSuccessImpl, OpenDialogPageFailImpl } from '../unierror.uts'
@@ -34,15 +39,24 @@ export const openDialogPage = (options: OpenDialogPageOptions): UniPage | null =
options.url = normalizeRouteOptionsResult.url
+ if (options.animationType === 'pop-in') {
+ options.animationType = 'none'
+ }
const dialogPage = navigateDialogPage(
options.url as string,
new Map([
- [ANIMATION_TYPE, 'none'],
- [ANIMATION_DURATION, 0],
+ [
+ ANIMATION_TYPE,
+ options.animationType ?? DEFAULT_ANIMATION_IN,
+ ],
+ [
+ ANIMATION_DURATION,
+ options.animationDuration ?? DEFAULT_ANIMATION_DURATION,
+ ],
]),
NAVIGATE_TO,
navigationStart,
- new Map([
+ new Map([
['disableEscBack', options.disableEscBack],
['parentPage', options.parentPage],
]),
diff --git a/uni_modules/uni-dialogPage/utssdk/constants.uts b/uni_modules/uni-dialogPage/utssdk/constants.uts
new file mode 100644
index 0000000000000000000000000000000000000000..3c29faff9143f787cba57a26ea1820f9290c25a7
--- /dev/null
+++ b/uni_modules/uni-dialogPage/utssdk/constants.uts
@@ -0,0 +1,28 @@
+export const DEFAULT_ANIMATION_IN = 'none'
+export const DEFAULT_ANIMATION_OUT = 'none'
+export const DEFAULT_ANIMATION_DURATION = 300
+export const DEFAULT_ANIMATION_NAVIGATE_BACK = 'auto'
+
+export const ANIMATION_IN = [
+ 'slide-in-right',
+ 'slide-in-left',
+ 'slide-in-top',
+ 'slide-in-bottom',
+ 'fade-in',
+ 'zoom-out',
+ // 'zoom-fade-out',
+ // 'pop-in',
+ 'none',
+]
+
+export const ANIMATION_OUT = [
+ 'slide-out-right',
+ 'slide-out-left',
+ 'slide-out-top',
+ 'slide-out-bottom',
+ 'fade-out',
+ 'zoom-in',
+ // 'zoom-fade-in',
+ // 'pop-out',
+ 'none',
+]
diff --git a/uni_modules/uni-dialogPage/utssdk/interface.uts b/uni_modules/uni-dialogPage/utssdk/interface.uts
index e4a1331505f682ee1073a26a03a97486469f064b..40a0214652e615cc54de4664d4a9f0c59e72980c 100644
--- a/uni_modules/uni-dialogPage/utssdk/interface.uts
+++ b/uni_modules/uni-dialogPage/utssdk/interface.uts
@@ -17,440 +17,642 @@ export interface OpenDialogPageFail extends IUniError {
}
type OpenDialogPageFailCallback = (result : OpenDialogPageFail) => void
export type OpenDialogPageComplete = AsyncApiResult
-type OpenDialogPageCompleteCallback = (result : OpenDialogPageComplete) => void
+type OpenDialogPageCompleteCallback = (result: OpenDialogPageComplete) => void
+
export type OpenDialogPageOptions = {
/**
* 需要跳转的应用内非 tabBar 的页面的路径 , 路径后可以带参数
- * @uniPlatform {
- * "app": {
- * "android": {
- * "osVer": "5.0",
- * "uniVer": "x",
- * "unixVer": "4.31"
- * },
- * "ios": {
- * "osVer": "12.0",
- * "uniVer": "x",
- * "unixVer": "4.31",
- * "uniUtsPlugin": "x",
- * "unixUtsPlugin": "4.31"
- * },
- * "harmony": {
- * "osVer": "3.0",
- * "uniVer": "x",
- * "unixVer": "x"
- * }
- * },
- * "mp": {
- * "weixin": {
- * "hostVer": "√",
- * "uniVer": "x",
- * "unixVer": "x"
- * },
- * "alipay": {
- * "hostVer": "√",
- * "uniVer": "x",
- * "unixVer": "x"
- * },
- * "baidu": {
- * "hostVer": "√",
- * "uniVer": "x",
- * "unixVer": "x"
- * },
- * "toutiao": {
- * "hostVer": "√",
- * "uniVer": "x",
- * "unixVer": "x"
- * },
- * "lark": {
- * "hostVer": "√",
- * "uniVer": "x",
- * "unixVer": "x"
- * },
- * "qq": {
- * "hostVer": "√",
- * "uniVer": "x",
- * "unixVer": "x"
- * },
- * "kuaishou": {
- * "hostVer": "√",
- * "uniVer": "x",
- * "unixVer": "x"
- * },
- * "jd": {
- * "hostVer": "√",
- * "uniVer": "x",
- * "unixVer": "x"
- * }
- * },
- * "web": {
- * "uniVer": "x",
- * "unixVer": "4.31"
- * }
- * }
+ * @uniPlatform
+ {
+ "app": {
+ "android": {
+ "osVer": "5.0",
+ "uniVer": "x",
+ "uniUtsPlugin": "x",
+ "unixVer": "4.31",
+ "unixUtsPlugin": "4.31"
+ },
+ "ios": {
+ "osVer": "12.0",
+ "uniVer": "x",
+ "uniUtsPlugin": "x",
+ "unixVer": "4.31",
+ "unixUtsPlugin": "4.31"
+ },
+ "harmony": {
+ "osVer": "3.0",
+ "uniVer": "x",
+ "unixVer": "x"
+ }
+ },
+ "mp": {
+ "weixin": {
+ "hostVer": "√",
+ "uniVer": "x",
+ "unixVer": "x"
+ },
+ "alipay": {
+ "hostVer": "√",
+ "uniVer": "x",
+ "unixVer": "x"
+ },
+ "baidu": {
+ "hostVer": "√",
+ "uniVer": "x",
+ "unixVer": "x"
+ },
+ "toutiao": {
+ "hostVer": "√",
+ "uniVer": "x",
+ "unixVer": "x"
+ },
+ "lark": {
+ "hostVer": "√",
+ "uniVer": "x",
+ "unixVer": "x"
+ },
+ "qq": {
+ "hostVer": "√",
+ "uniVer": "x",
+ "unixVer": "x"
+ },
+ "kuaishou": {
+ "hostVer": "√",
+ "uniVer": "x",
+ "unixVer": "x"
+ },
+ "jd": {
+ "hostVer": "√",
+ "uniVer": "x",
+ "unixVer": "x"
+ }
+ },
+ "web": {
+ "uniVer": "x",
+ "unixVer": "4.31"
+ }
+ }
*/
url : string | string.PageURIString
+ /**
+ * 窗口显示的动画类型
+ *
+ * @uniPlatform
+ {
+ "app": {
+ "android": {
+ "osVer": "5.0",
+ "uniVer": "x",
+ "uniUtsPlugin": "x",
+ "unixVer": "4.31",
+ "unixUtsPlugin": "4.31"
+ },
+ "ios": {
+ "osVer": "12.0",
+ "uniVer": "x",
+ "uniUtsPlugin": "x",
+ "unixVer": "4.31",
+ "unixUtsPlugin": "4.31"
+ },
+ "harmony": {
+ "osVer": "3.0",
+ "uniVer": "x",
+ "unixVer": "x"
+ }
+ },
+ "mp": {
+ "weixin": {
+ "hostVer": "√",
+ "uniVer": "x",
+ "unixVer": "x"
+ },
+ "alipay": {
+ "hostVer": "√",
+ "uniVer": "x",
+ "unixVer": "x"
+ },
+ "baidu": {
+ "hostVer": "√",
+ "uniVer": "x",
+ "unixVer": "x"
+ },
+ "toutiao": {
+ "hostVer": "√",
+ "uniVer": "x",
+ "unixVer": "x"
+ },
+ "lark": {
+ "hostVer": "√",
+ "uniVer": "x",
+ "unixVer": "x"
+ },
+ "qq": {
+ "hostVer": "√",
+ "uniVer": "x",
+ "unixVer": "x"
+ },
+ "kuaishou": {
+ "hostVer": "√",
+ "uniVer": "x",
+ "unixVer": "x"
+ },
+ "jd": {
+ "hostVer": "√",
+ "uniVer": "x",
+ "unixVer": "x"
+ }
+ },
+ "web": {
+ "uniVer": "x",
+ "unixVer": "4.31"
+ }
+ }
+ */
+ animationType ?:
+ /**
+ * 自动选择动画效果
+ */
+ 'auto' |
+ /**
+ * 无动画效果
+ */
+ 'none' |
+ /**
+ * 从右侧横向滑动效果
+ */
+ 'slide-in-right' |
+ /**
+ * 左侧横向滑动效果
+ */
+ 'slide-in-left' |
+ /**
+ * 从上侧竖向滑动效果
+ */
+ 'slide-in-top' |
+ /**
+ * 从下侧竖向滑动效果
+ */
+ 'slide-in-bottom' |
+ /**
+ * 从透明到不透明逐渐显示效果
+ */
+ 'fade-in' |
+ /**
+ * 从小到大逐渐放大显示效果
+ */
+ 'zoom-out' |
+ /**
+ * 从小到大逐渐放大并且从透明到不透明逐渐显示效果
+ */
+ 'zoom-fade-out' | null
+ /**
+ * 窗口关闭动画的持续时间,单位为 ms
+ * @uniPlatform
+ {
+ "app": {
+ "android": {
+ "osVer": "5.0",
+ "uniVer": "x",
+ "uniUtsPlugin": "x",
+ "unixVer": "4.31",
+ "unixUtsPlugin": "4.31"
+ },
+ "ios": {
+ "osVer": "12.0",
+ "uniVer": "x",
+ "uniUtsPlugin": "x",
+ "unixVer": "4.31",
+ "unixUtsPlugin": "4.31"
+ },
+ "harmony": {
+ "osVer": "3.0",
+ "uniVer": "x",
+ "unixVer": "x"
+ }
+ },
+ "mp": {
+ "weixin": {
+ "hostVer": "√",
+ "uniVer": "x",
+ "unixVer": "x"
+ },
+ "alipay": {
+ "hostVer": "√",
+ "uniVer": "x",
+ "unixVer": "x"
+ },
+ "baidu": {
+ "hostVer": "√",
+ "uniVer": "x",
+ "unixVer": "x"
+ },
+ "toutiao": {
+ "hostVer": "√",
+ "uniVer": "x",
+ "unixVer": "x"
+ },
+ "lark": {
+ "hostVer": "√",
+ "uniVer": "x",
+ "unixVer": "x"
+ },
+ "qq": {
+ "hostVer": "√",
+ "uniVer": "x",
+ "unixVer": "x"
+ },
+ "kuaishou": {
+ "hostVer": "√",
+ "uniVer": "x",
+ "unixVer": "x"
+ },
+ "jd": {
+ "hostVer": "√",
+ "uniVer": "x",
+ "unixVer": "x"
+ }
+ },
+ "web": {
+ "uniVer": "x",
+ "unixVer": "4.31"
+ }
+ }
+ */
+ animationDuration ?: number | null
/**
* 是否禁用按键盘 ESC 时关闭
- * @uniPlatform {
- * "app": {
- * "android": {
- * "osVer": "5.0",
- * "uniVer": "x",
- * "unixVer": "4.31"
- * },
- * "ios": {
- * "osVer": "12.0",
- * "uniVer": "x",
- * "unixVer": "4.31",
- * "uniUtsPlugin": "x",
- * "unixUtsPlugin": "4.31"
- * },
- * "harmony": {
- * "osVer": "3.0",
- * "uniVer": "x",
- * "unixVer": "x"
- * }
- * },
- * "mp": {
- * "weixin": {
- * "hostVer": "√",
- * "uniVer": "x",
- * "unixVer": "x"
- * },
- * "alipay": {
- * "hostVer": "√",
- * "uniVer": "x",
- * "unixVer": "x"
- * },
- * "baidu": {
- * "hostVer": "√",
- * "uniVer": "x",
- * "unixVer": "x"
- * },
- * "toutiao": {
- * "hostVer": "√",
- * "uniVer": "x",
- * "unixVer": "x"
- * },
- * "lark": {
- * "hostVer": "√",
- * "uniVer": "x",
- * "unixVer": "x"
- * },
- * "qq": {
- * "hostVer": "√",
- * "uniVer": "x",
- * "unixVer": "x"
- * },
- * "kuaishou": {
- * "hostVer": "√",
- * "uniVer": "x",
- * "unixVer": "x"
- * },
- * "jd": {
- * "hostVer": "√",
- * "uniVer": "x",
- * "unixVer": "x"
- * }
- * },
- * "web": {
- * "uniVer": "x",
- * "unixVer": "4.31"
- * }
- * }
+ * @uniPlatform
+ {
+ "app": {
+ "android": {
+ "osVer": "5.0",
+ "uniVer": "x",
+ "uniUtsPlugin": "x",
+ "unixVer": "4.31",
+ "unixUtsPlugin": "4.31"
+ },
+ "ios": {
+ "osVer": "12.0",
+ "uniVer": "x",
+ "uniUtsPlugin": "x",
+ "unixVer": "4.31",
+ "unixUtsPlugin": "4.31"
+ },
+ "harmony": {
+ "osVer": "3.0",
+ "uniVer": "x",
+ "unixVer": "x"
+ }
+ },
+ "mp": {
+ "weixin": {
+ "hostVer": "√",
+ "uniVer": "x",
+ "unixVer": "x"
+ },
+ "alipay": {
+ "hostVer": "√",
+ "uniVer": "x",
+ "unixVer": "x"
+ },
+ "baidu": {
+ "hostVer": "√",
+ "uniVer": "x",
+ "unixVer": "x"
+ },
+ "toutiao": {
+ "hostVer": "√",
+ "uniVer": "x",
+ "unixVer": "x"
+ },
+ "lark": {
+ "hostVer": "√",
+ "uniVer": "x",
+ "unixVer": "x"
+ },
+ "qq": {
+ "hostVer": "√",
+ "uniVer": "x",
+ "unixVer": "x"
+ },
+ "kuaishou": {
+ "hostVer": "√",
+ "uniVer": "x",
+ "unixVer": "x"
+ },
+ "jd": {
+ "hostVer": "√",
+ "uniVer": "x",
+ "unixVer": "x"
+ }
+ },
+ "web": {
+ "uniVer": "x",
+ "unixVer": "4.31"
+ }
+ }
*/
disableEscBack ?: boolean | null
/**
* 要绑定的父级页面实例
- * @uniPlatform {
- * "app": {
- * "android": {
- * "osVer": "5.0",
- * "uniVer": "x",
- * "unixVer": "4.31"
- * },
- * "ios": {
- * "osVer": "12.0",
- * "uniVer": "x",
- * "unixVer": "4.31",
- * "uniUtsPlugin": "x",
- * "unixUtsPlugin": "4.31"
- * },
- * "harmony": {
- * "osVer": "3.0",
- * "uniVer": "x",
- * "unixVer": "x"
- * }
- * },
- * "mp": {
- * "weixin": {
- * "hostVer": "√",
- * "uniVer": "x",
- * "unixVer": "x"
- * },
- * "alipay": {
- * "hostVer": "√",
- * "uniVer": "x",
- * "unixVer": "x"
- * },
- * "baidu": {
- * "hostVer": "√",
- * "uniVer": "x",
- * "unixVer": "x"
- * },
- * "toutiao": {
- * "hostVer": "√",
- * "uniVer": "x",
- * "unixVer": "x"
- * },
- * "lark": {
- * "hostVer": "√",
- * "uniVer": "x",
- * "unixVer": "x"
- * },
- * "qq": {
- * "hostVer": "√",
- * "uniVer": "x",
- * "unixVer": "x"
- * },
- * "kuaishou": {
- * "hostVer": "√",
- * "uniVer": "x",
- * "unixVer": "x"
- * },
- * "jd": {
- * "hostVer": "√",
- * "uniVer": "x",
- * "unixVer": "x"
- * }
- * },
- * "web": {
- * "uniVer": "x",
- * "unixVer": "4.31"
- * }
- * }
+ * @uniPlatform
+ {
+ "app": {
+ "android": {
+ "osVer": "5.0",
+ "uniVer": "x",
+ "uniUtsPlugin": "x",
+ "unixVer": "4.31",
+ "unixUtsPlugin": "4.31"
+ },
+ "ios": {
+ "osVer": "12.0",
+ "uniVer": "x",
+ "uniUtsPlugin": "x",
+ "unixVer": "4.31",
+ "unixUtsPlugin": "4.31"
+ },
+ "harmony": {
+ "osVer": "3.0",
+ "uniVer": "x",
+ "unixVer": "x"
+ }
+ },
+ "mp": {
+ "weixin": {
+ "hostVer": "√",
+ "uniVer": "x",
+ "unixVer": "x"
+ },
+ "alipay": {
+ "hostVer": "√",
+ "uniVer": "x",
+ "unixVer": "x"
+ },
+ "baidu": {
+ "hostVer": "√",
+ "uniVer": "x",
+ "unixVer": "x"
+ },
+ "toutiao": {
+ "hostVer": "√",
+ "uniVer": "x",
+ "unixVer": "x"
+ },
+ "lark": {
+ "hostVer": "√",
+ "uniVer": "x",
+ "unixVer": "x"
+ },
+ "qq": {
+ "hostVer": "√",
+ "uniVer": "x",
+ "unixVer": "x"
+ },
+ "kuaishou": {
+ "hostVer": "√",
+ "uniVer": "x",
+ "unixVer": "x"
+ },
+ "jd": {
+ "hostVer": "√",
+ "uniVer": "x",
+ "unixVer": "x"
+ }
+ },
+ "web": {
+ "uniVer": "x",
+ "unixVer": "4.31"
+ }
+ }
*/
parentPage?: UniPage | null
/**
* 接口调用成功的回调函数
- * @uniPlatform {
- * "app": {
- * "android": {
- * "osVer": "5.0",
- * "uniVer": "x",
- * "unixVer": "4.31"
- * },
- * "ios": {
- * "osVer": "12.0",
- * "uniVer": "x",
- * "unixVer": "4.31",
- * "uniUtsPlugin": "x",
- * "unixUtsPlugin": "4.31"
- * },
- * "harmony": {
- * "osVer": "3.0",
- * "uniVer": "x",
- * "unixVer": "x"
- * }
- * },
- * "mp": {
- * "weixin": {
- * "hostVer": "√",
- * "uniVer": "x",
- * "unixVer": "x"
- * },
- * "alipay": {
- * "hostVer": "√",
- * "uniVer": "x",
- * "unixVer": "x"
- * },
- * "baidu": {
- * "hostVer": "√",
- * "uniVer": "x",
- * "unixVer": "x"
- * },
- * "toutiao": {
- * "hostVer": "√",
- * "uniVer": "x",
- * "unixVer": "x"
- * },
- * "lark": {
- * "hostVer": "√",
- * "uniVer": "x",
- * "unixVer": "x"
- * },
- * "qq": {
- * "hostVer": "√",
- * "uniVer": "x",
- * "unixVer": "x"
- * },
- * "kuaishou": {
- * "hostVer": "√",
- * "uniVer": "x",
- * "unixVer": "x"
- * },
- * "jd": {
- * "hostVer": "√",
- * "uniVer": "x",
- * "unixVer": "x"
- * }
- * },
- * "web": {
- * "uniVer": "x",
- * "unixVer": "4.31"
- * }
- * }
+ * @uniPlatform
+ {
+ "app": {
+ "android": {
+ "osVer": "5.0",
+ "uniVer": "x",
+ "uniUtsPlugin": "x",
+ "unixVer": "4.31",
+ "unixUtsPlugin": "4.31"
+ },
+ "ios": {
+ "osVer": "12.0",
+ "uniVer": "x",
+ "uniUtsPlugin": "x",
+ "unixVer": "4.31",
+ "unixUtsPlugin": "4.31"
+ },
+ "harmony": {
+ "osVer": "3.0",
+ "uniVer": "x",
+ "unixVer": "x"
+ }
+ },
+ "mp": {
+ "weixin": {
+ "hostVer": "√",
+ "uniVer": "x",
+ "unixVer": "x"
+ },
+ "alipay": {
+ "hostVer": "√",
+ "uniVer": "x",
+ "unixVer": "x"
+ },
+ "baidu": {
+ "hostVer": "√",
+ "uniVer": "x",
+ "unixVer": "x"
+ },
+ "toutiao": {
+ "hostVer": "√",
+ "uniVer": "x",
+ "unixVer": "x"
+ },
+ "lark": {
+ "hostVer": "√",
+ "uniVer": "x",
+ "unixVer": "x"
+ },
+ "qq": {
+ "hostVer": "√",
+ "uniVer": "x",
+ "unixVer": "x"
+ },
+ "kuaishou": {
+ "hostVer": "√",
+ "uniVer": "x",
+ "unixVer": "x"
+ },
+ "jd": {
+ "hostVer": "√",
+ "uniVer": "x",
+ "unixVer": "x"
+ }
+ },
+ "web": {
+ "uniVer": "x",
+ "unixVer": "4.31"
+ }
+ }
*/
success ?: OpenDialogPageSuccessCallback | null
/**
* 接口调用失败的回调函数
- * @uniPlatform {
- * "app": {
- * "android": {
- * "osVer": "5.0",
- * "uniVer": "x",
- * "unixVer": "4.31"
- * },
- * "ios": {
- * "osVer": "12.0",
- * "uniVer": "x",
- * "unixVer": "4.31",
- * "uniUtsPlugin": "x",
- * "unixUtsPlugin": "4.31"
- * },
- * "harmony": {
- * "osVer": "3.0",
- * "uniVer": "x",
- * "unixVer": "x"
- * }
- * },
- * "mp": {
- * "weixin": {
- * "hostVer": "√",
- * "uniVer": "x",
- * "unixVer": "x"
- * },
- * "alipay": {
- * "hostVer": "√",
- * "uniVer": "x",
- * "unixVer": "x"
- * },
- * "baidu": {
- * "hostVer": "√",
- * "uniVer": "x",
- * "unixVer": "x"
- * },
- * "toutiao": {
- * "hostVer": "√",
- * "uniVer": "x",
- * "unixVer": "x"
- * },
- * "lark": {
- * "hostVer": "√",
- * "uniVer": "x",
- * "unixVer": "x"
- * },
- * "qq": {
- * "hostVer": "√",
- * "uniVer": "x",
- * "unixVer": "x"
- * },
- * "kuaishou": {
- * "hostVer": "√",
- * "uniVer": "x",
- * "unixVer": "x"
- * },
- * "jd": {
- * "hostVer": "√",
- * "uniVer": "x",
- * "unixVer": "x"
- * }
- * },
- * "web": {
- * "uniVer": "x",
- * "unixVer": "4.31"
- * }
- * }
+ * @uniPlatform
+ {
+ "app": {
+ "android": {
+ "osVer": "5.0",
+ "uniVer": "x",
+ "uniUtsPlugin": "x",
+ "unixVer": "4.31",
+ "unixUtsPlugin": "4.31"
+ },
+ "ios": {
+ "osVer": "12.0",
+ "uniVer": "x",
+ "uniUtsPlugin": "x",
+ "unixVer": "4.31",
+ "unixUtsPlugin": "4.31"
+ },
+ "harmony": {
+ "osVer": "3.0",
+ "uniVer": "x",
+ "unixVer": "x"
+ }
+ },
+ "mp": {
+ "weixin": {
+ "hostVer": "√",
+ "uniVer": "x",
+ "unixVer": "x"
+ },
+ "alipay": {
+ "hostVer": "√",
+ "uniVer": "x",
+ "unixVer": "x"
+ },
+ "baidu": {
+ "hostVer": "√",
+ "uniVer": "x",
+ "unixVer": "x"
+ },
+ "toutiao": {
+ "hostVer": "√",
+ "uniVer": "x",
+ "unixVer": "x"
+ },
+ "lark": {
+ "hostVer": "√",
+ "uniVer": "x",
+ "unixVer": "x"
+ },
+ "qq": {
+ "hostVer": "√",
+ "uniVer": "x",
+ "unixVer": "x"
+ },
+ "kuaishou": {
+ "hostVer": "√",
+ "uniVer": "x",
+ "unixVer": "x"
+ },
+ "jd": {
+ "hostVer": "√",
+ "uniVer": "x",
+ "unixVer": "x"
+ }
+ },
+ "web": {
+ "uniVer": "x",
+ "unixVer": "4.31"
+ }
+ }
*/
fail ?: OpenDialogPageFailCallback | null
/**
* 接口调用结束的回调函数(调用成功、失败都会执行)
- * @uniPlatform {
- * "app": {
- * "android": {
- * "osVer": "5.0",
- * "uniVer": "x",
- * "unixVer": "4.31"
- * },
- * "ios": {
- * "osVer": "12.0",
- * "uniVer": "x",
- * "unixVer": "4.31",
- * "uniUtsPlugin": "x",
- * "unixUtsPlugin": "4.31"
- * },
- * "harmony": {
- * "osVer": "3.0",
- * "uniVer": "x",
- * "unixVer": "x"
- * }
- * },
- * "mp": {
- * "weixin": {
- * "hostVer": "√",
- * "uniVer": "x",
- * "unixVer": "x"
- * },
- * "alipay": {
- * "hostVer": "√",
- * "uniVer": "x",
- * "unixVer": "x"
- * },
- * "baidu": {
- * "hostVer": "√",
- * "uniVer": "x",
- * "unixVer": "x"
- * },
- * "toutiao": {
- * "hostVer": "√",
- * "uniVer": "x",
- * "unixVer": "x"
- * },
- * "lark": {
- * "hostVer": "√",
- * "uniVer": "x",
- * "unixVer": "x"
- * },
- * "qq": {
- * "hostVer": "√",
- * "uniVer": "x",
- * "unixVer": "x"
- * },
- * "kuaishou": {
- * "hostVer": "√",
- * "uniVer": "x",
- * "unixVer": "x"
- * },
- * "jd": {
- * "hostVer": "√",
- * "uniVer": "x",
- * "unixVer": "x"
- * }
- * },
- * "web": {
- * "uniVer": "x",
- * "unixVer": "4.31"
- * }
- * }
+ * @uniPlatform
+ {
+ "app": {
+ "android": {
+ "osVer": "5.0",
+ "uniVer": "x",
+ "uniUtsPlugin": "x",
+ "unixVer": "4.31",
+ "unixUtsPlugin": "4.31"
+ },
+ "ios": {
+ "osVer": "12.0",
+ "uniVer": "x",
+ "uniUtsPlugin": "x",
+ "unixVer": "4.31",
+ "unixUtsPlugin": "4.31"
+ },
+ "harmony": {
+ "osVer": "3.0",
+ "uniVer": "x",
+ "unixVer": "x"
+ }
+ },
+ "mp": {
+ "weixin": {
+ "hostVer": "√",
+ "uniVer": "x",
+ "unixVer": "x"
+ },
+ "alipay": {
+ "hostVer": "√",
+ "uniVer": "x",
+ "unixVer": "x"
+ },
+ "baidu": {
+ "hostVer": "√",
+ "uniVer": "x",
+ "unixVer": "x"
+ },
+ "toutiao": {
+ "hostVer": "√",
+ "uniVer": "x",
+ "unixVer": "x"
+ },
+ "lark": {
+ "hostVer": "√",
+ "uniVer": "x",
+ "unixVer": "x"
+ },
+ "qq": {
+ "hostVer": "√",
+ "uniVer": "x",
+ "unixVer": "x"
+ },
+ "kuaishou": {
+ "hostVer": "√",
+ "uniVer": "x",
+ "unixVer": "x"
+ },
+ "jd": {
+ "hostVer": "√",
+ "uniVer": "x",
+ "unixVer": "x"
+ }
+ },
+ "web": {
+ "uniVer": "x",
+ "unixVer": "4.31"
+ }
+ }
*/
complete ?: OpenDialogPageCompleteCallback | null
}
-
-
export type CloseDialogPageSuccess = AsyncApiSuccessResult
type CloseDialogPageSuccessCallback = (result : CloseDialogPageSuccess) => void
export interface CloseDialogPageFail extends IUniError {
@@ -462,286 +664,493 @@ type CloseDialogPageCompleteCallback = (result : CloseDialogPageComplete) => voi
export type CloseDialogPageOptions = {
/**
* 要关闭的 dialogPage 实例
- * @uniPlatform {
- * "app": {
- * "android": {
- * "osVer": "5.0",
- * "uniVer": "x",
- * "unixVer": "4.31"
- * },
- * "ios": {
- * "osVer": "12.0",
- * "uniVer": "x",
- * "unixVer": "4.31",
- * "uniUtsPlugin": "x",
- * "unixUtsPlugin": "4.31"
- * },
- * "harmony": {
- * "osVer": "3.0",
- * "uniVer": "x",
- * "unixVer": "x"
- * }
- * },
- * "mp": {
- * "weixin": {
- * "hostVer": "√",
- * "uniVer": "x",
- * "unixVer": "x"
- * },
- * "alipay": {
- * "hostVer": "√",
- * "uniVer": "x",
- * "unixVer": "x"
- * },
- * "baidu": {
- * "hostVer": "√",
- * "uniVer": "x",
- * "unixVer": "x"
- * },
- * "toutiao": {
- * "hostVer": "√",
- * "uniVer": "x",
- * "unixVer": "x"
- * },
- * "lark": {
- * "hostVer": "√",
- * "uniVer": "x",
- * "unixVer": "x"
- * },
- * "qq": {
- * "hostVer": "√",
- * "uniVer": "x",
- * "unixVer": "x"
- * },
- * "kuaishou": {
- * "hostVer": "√",
- * "uniVer": "x",
- * "unixVer": "x"
- * },
- * "jd": {
- * "hostVer": "√",
- * "uniVer": "x",
- * "unixVer": "x"
- * }
- * },
- * "web": {
- * "uniVer": "x",
- * "unixVer": "4.31"
- * }
- * }
+ * @uniPlatform
+ {
+ "app": {
+ "android": {
+ "osVer": "5.0",
+ "uniVer": "x",
+ "uniUtsPlugin": "x",
+ "unixVer": "4.31",
+ "unixUtsPlugin": "4.31"
+ },
+ "ios": {
+ "osVer": "12.0",
+ "uniVer": "x",
+ "uniUtsPlugin": "x",
+ "unixVer": "4.31",
+ "unixUtsPlugin": "4.31"
+ },
+ "harmony": {
+ "osVer": "3.0",
+ "uniVer": "x",
+ "unixVer": "x"
+ }
+ },
+ "mp": {
+ "weixin": {
+ "hostVer": "√",
+ "uniVer": "x",
+ "unixVer": "x"
+ },
+ "alipay": {
+ "hostVer": "√",
+ "uniVer": "x",
+ "unixVer": "x"
+ },
+ "baidu": {
+ "hostVer": "√",
+ "uniVer": "x",
+ "unixVer": "x"
+ },
+ "toutiao": {
+ "hostVer": "√",
+ "uniVer": "x",
+ "unixVer": "x"
+ },
+ "lark": {
+ "hostVer": "√",
+ "uniVer": "x",
+ "unixVer": "x"
+ },
+ "qq": {
+ "hostVer": "√",
+ "uniVer": "x",
+ "unixVer": "x"
+ },
+ "kuaishou": {
+ "hostVer": "√",
+ "uniVer": "x",
+ "unixVer": "x"
+ },
+ "jd": {
+ "hostVer": "√",
+ "uniVer": "x",
+ "unixVer": "x"
+ }
+ },
+ "web": {
+ "uniVer": "x",
+ "unixVer": "4.31"
+ }
+ }
*/
dialogPage?: UniPage | null
+ /**
+ * 窗口关闭的动画类型
+ * - auto: 自动选择动画效果
+ * - none: 无动画效果
+ * - slide-out-right: 横向向右侧滑出屏幕动画
+ * - slide-out-left: 横向向左侧滑出屏幕动画
+ * - slide-out-top: 竖向向上侧滑出屏幕动画
+ * - slide-out-bottom: 竖向向下侧滑出屏幕动画
+ * - fade-out: 从不透明到透明逐渐隐藏动画
+ * - zoom-in: 从大逐渐缩小关闭动画
+ * - zoom-fade-in: 从大逐渐缩小并且从不透明到透明逐渐隐藏关闭动画
+ *
+ * @uniPlatform
+ {
+ "app": {
+ "android": {
+ "osVer": "5.0",
+ "uniVer": "x",
+ "uniUtsPlugin": "x",
+ "unixVer": "4.31",
+ "unixUtsPlugin": "4.31"
+ },
+ "ios": {
+ "osVer": "12.0",
+ "uniVer": "x",
+ "uniUtsPlugin": "x",
+ "unixVer": "4.31",
+ "unixUtsPlugin": "4.31"
+ },
+ "harmony": {
+ "osVer": "3.0",
+ "uniVer": "x",
+ "unixVer": "x"
+ }
+ },
+ "mp": {
+ "weixin": {
+ "hostVer": "√",
+ "uniVer": "x",
+ "unixVer": "x"
+ },
+ "alipay": {
+ "hostVer": "√",
+ "uniVer": "x",
+ "unixVer": "x"
+ },
+ "baidu": {
+ "hostVer": "√",
+ "uniVer": "x",
+ "unixVer": "x"
+ },
+ "toutiao": {
+ "hostVer": "√",
+ "uniVer": "x",
+ "unixVer": "x"
+ },
+ "lark": {
+ "hostVer": "√",
+ "uniVer": "x",
+ "unixVer": "x"
+ },
+ "qq": {
+ "hostVer": "√",
+ "uniVer": "x",
+ "unixVer": "x"
+ },
+ "kuaishou": {
+ "hostVer": "√",
+ "uniVer": "x",
+ "unixVer": "x"
+ },
+ "jd": {
+ "hostVer": "√",
+ "uniVer": "x",
+ "unixVer": "x"
+ }
+ },
+ "web": {
+ "uniVer": "x",
+ "unixVer": "4.31"
+ }
+ }
+ */
+ animationType ?:
+ /**
+ * 自动选择动画效果
+ */
+ 'auto' |
+ /**
+ * 无动画效果
+ */
+ 'none' |
+ /**
+ * 横向向右侧滑出屏幕动画
+ */
+ 'slide-out-right' |
+ /**
+ * 横向向左侧滑出屏幕动画
+ */
+ 'slide-out-left' |
+ /**
+ * 竖向向上侧滑出屏幕动画
+ */
+ 'slide-out-top' |
+ /**
+ * 竖向向下侧滑出屏幕动画
+ */
+ 'slide-out-bottom' |
+ /**
+ * 从不透明到透明逐渐隐藏动画
+ */
+ 'fade-out' |
+ /**
+ * 从大逐渐缩小关闭动画
+ */
+ 'zoom-in' |
+ /**
+ * 从大逐渐缩小并且从不透明到透明逐渐隐藏关闭动画
+ */
+ 'zoom-fade-in' | null
+ /**
+ * 窗口关闭动画的持续时间,单位为 ms
+ * @uniPlatform
+ {
+ "app": {
+ "android": {
+ "osVer": "5.0",
+ "uniVer": "x",
+ "uniUtsPlugin": "x",
+ "unixVer": "4.31",
+ "unixUtsPlugin": "4.31"
+ },
+ "ios": {
+ "osVer": "12.0",
+ "uniVer": "x",
+ "uniUtsPlugin": "x",
+ "unixVer": "4.31",
+ "unixUtsPlugin": "4.31"
+ },
+ "harmony": {
+ "osVer": "3.0",
+ "uniVer": "x",
+ "unixVer": "x"
+ }
+ },
+ "mp": {
+ "weixin": {
+ "hostVer": "√",
+ "uniVer": "x",
+ "unixVer": "x"
+ },
+ "alipay": {
+ "hostVer": "√",
+ "uniVer": "x",
+ "unixVer": "x"
+ },
+ "baidu": {
+ "hostVer": "√",
+ "uniVer": "x",
+ "unixVer": "x"
+ },
+ "toutiao": {
+ "hostVer": "√",
+ "uniVer": "x",
+ "unixVer": "x"
+ },
+ "lark": {
+ "hostVer": "√",
+ "uniVer": "x",
+ "unixVer": "x"
+ },
+ "qq": {
+ "hostVer": "√",
+ "uniVer": "x",
+ "unixVer": "x"
+ },
+ "kuaishou": {
+ "hostVer": "√",
+ "uniVer": "x",
+ "unixVer": "x"
+ },
+ "jd": {
+ "hostVer": "√",
+ "uniVer": "x",
+ "unixVer": "x"
+ }
+ },
+ "web": {
+ "uniVer": "x",
+ "unixVer": "4.31"
+ }
+ }
+ */
+ animationDuration ?: number | null
+
/**
* 接口调用成功的回调函数
- * @uniPlatform {
- * "app": {
- * "android": {
- * "osVer": "5.0",
- * "uniVer": "x",
- * "unixVer": "4.31"
- * },
- * "ios": {
- * "osVer": "12.0",
- * "uniVer": "x",
- * "unixVer": "4.31",
- * "uniUtsPlugin": "x",
- * "unixUtsPlugin": "4.31"
- * },
- * "harmony": {
- * "osVer": "3.0",
- * "uniVer": "x",
- * "unixVer": "x"
- * }
- * },
- * "mp": {
- * "weixin": {
- * "hostVer": "√",
- * "uniVer": "x",
- * "unixVer": "x"
- * },
- * "alipay": {
- * "hostVer": "√",
- * "uniVer": "x",
- * "unixVer": "x"
- * },
- * "baidu": {
- * "hostVer": "√",
- * "uniVer": "x",
- * "unixVer": "x"
- * },
- * "toutiao": {
- * "hostVer": "√",
- * "uniVer": "x",
- * "unixVer": "x"
- * },
- * "lark": {
- * "hostVer": "√",
- * "uniVer": "x",
- * "unixVer": "x"
- * },
- * "qq": {
- * "hostVer": "√",
- * "uniVer": "x",
- * "unixVer": "x"
- * },
- * "kuaishou": {
- * "hostVer": "√",
- * "uniVer": "x",
- * "unixVer": "x"
- * },
- * "jd": {
- * "hostVer": "√",
- * "uniVer": "x",
- * "unixVer": "x"
- * }
- * },
- * "web": {
- * "uniVer": "x",
- * "unixVer": "4.31"
- * }
- * }
+ * @uniPlatform
+ {
+ "app": {
+ "android": {
+ "osVer": "5.0",
+ "uniVer": "x",
+ "uniUtsPlugin": "x",
+ "unixVer": "4.31",
+ "unixUtsPlugin": "4.31"
+ },
+ "ios": {
+ "osVer": "12.0",
+ "uniVer": "x",
+ "uniUtsPlugin": "x",
+ "unixVer": "4.31",
+ "unixUtsPlugin": "4.31"
+ },
+ "harmony": {
+ "osVer": "3.0",
+ "uniVer": "x",
+ "unixVer": "x"
+ }
+ },
+ "mp": {
+ "weixin": {
+ "hostVer": "√",
+ "uniVer": "x",
+ "unixVer": "x"
+ },
+ "alipay": {
+ "hostVer": "√",
+ "uniVer": "x",
+ "unixVer": "x"
+ },
+ "baidu": {
+ "hostVer": "√",
+ "uniVer": "x",
+ "unixVer": "x"
+ },
+ "toutiao": {
+ "hostVer": "√",
+ "uniVer": "x",
+ "unixVer": "x"
+ },
+ "lark": {
+ "hostVer": "√",
+ "uniVer": "x",
+ "unixVer": "x"
+ },
+ "qq": {
+ "hostVer": "√",
+ "uniVer": "x",
+ "unixVer": "x"
+ },
+ "kuaishou": {
+ "hostVer": "√",
+ "uniVer": "x",
+ "unixVer": "x"
+ },
+ "jd": {
+ "hostVer": "√",
+ "uniVer": "x",
+ "unixVer": "x"
+ }
+ },
+ "web": {
+ "uniVer": "x",
+ "unixVer": "4.31"
+ }
+ }
*/
success ?: CloseDialogPageSuccessCallback | null
/**
* 接口调用失败的回调函数
- * @uniPlatform {
- * "app": {
- * "android": {
- * "osVer": "5.0",
- * "uniVer": "x",
- * "unixVer": "4.31"
- * },
- * "ios": {
- * "osVer": "12.0",
- * "uniVer": "x",
- * "unixVer": "4.31",
- * "uniUtsPlugin": "x",
- * "unixUtsPlugin": "4.31"
- * },
- * "harmony": {
- * "osVer": "3.0",
- * "uniVer": "x",
- * "unixVer": "x"
- * }
- * },
- * "mp": {
- * "weixin": {
- * "hostVer": "√",
- * "uniVer": "x",
- * "unixVer": "x"
- * },
- * "alipay": {
- * "hostVer": "√",
- * "uniVer": "x",
- * "unixVer": "x"
- * },
- * "baidu": {
- * "hostVer": "√",
- * "uniVer": "x",
- * "unixVer": "x"
- * },
- * "toutiao": {
- * "hostVer": "√",
- * "uniVer": "x",
- * "unixVer": "x"
- * },
- * "lark": {
- * "hostVer": "√",
- * "uniVer": "x",
- * "unixVer": "x"
- * },
- * "qq": {
- * "hostVer": "√",
- * "uniVer": "x",
- * "unixVer": "x"
- * },
- * "kuaishou": {
- * "hostVer": "√",
- * "uniVer": "x",
- * "unixVer": "x"
- * },
- * "jd": {
- * "hostVer": "√",
- * "uniVer": "x",
- * "unixVer": "x"
- * }
- * },
- * "web": {
- * "uniVer": "x",
- * "unixVer": "4.31"
- * }
- * }
+ * @uniPlatform
+ {
+ "app": {
+ "android": {
+ "osVer": "5.0",
+ "uniVer": "x",
+ "uniUtsPlugin": "x",
+ "unixVer": "4.31",
+ "unixUtsPlugin": "4.31"
+ },
+ "ios": {
+ "osVer": "12.0",
+ "uniVer": "x",
+ "uniUtsPlugin": "x",
+ "unixVer": "4.31",
+ "unixUtsPlugin": "4.31"
+ },
+ "harmony": {
+ "osVer": "3.0",
+ "uniVer": "x",
+ "unixVer": "x"
+ }
+ },
+ "mp": {
+ "weixin": {
+ "hostVer": "√",
+ "uniVer": "x",
+ "unixVer": "x"
+ },
+ "alipay": {
+ "hostVer": "√",
+ "uniVer": "x",
+ "unixVer": "x"
+ },
+ "baidu": {
+ "hostVer": "√",
+ "uniVer": "x",
+ "unixVer": "x"
+ },
+ "toutiao": {
+ "hostVer": "√",
+ "uniVer": "x",
+ "unixVer": "x"
+ },
+ "lark": {
+ "hostVer": "√",
+ "uniVer": "x",
+ "unixVer": "x"
+ },
+ "qq": {
+ "hostVer": "√",
+ "uniVer": "x",
+ "unixVer": "x"
+ },
+ "kuaishou": {
+ "hostVer": "√",
+ "uniVer": "x",
+ "unixVer": "x"
+ },
+ "jd": {
+ "hostVer": "√",
+ "uniVer": "x",
+ "unixVer": "x"
+ }
+ },
+ "web": {
+ "uniVer": "x",
+ "unixVer": "4.31"
+ }
+ }
*/
fail ?: CloseDialogPageFailCallback | null
/**
* 接口调用结束的回调函数(调用成功、失败都会执行)
- * @uniPlatform {
- * "app": {
- * "android": {
- * "osVer": "5.0",
- * "uniVer": "x",
- * "unixVer": "4.31"
- * },
- * "ios": {
- * "osVer": "12.0",
- * "uniVer": "x",
- * "unixVer": "4.31",
- * "uniUtsPlugin": "x",
- * "unixUtsPlugin": "4.31"
- * },
- * "harmony": {
- * "osVer": "3.0",
- * "uniVer": "x",
- * "unixVer": "x"
- * }
- * },
- * "mp": {
- * "weixin": {
- * "hostVer": "√",
- * "uniVer": "x",
- * "unixVer": "x"
- * },
- * "alipay": {
- * "hostVer": "√",
- * "uniVer": "x",
- * "unixVer": "x"
- * },
- * "baidu": {
- * "hostVer": "√",
- * "uniVer": "x",
- * "unixVer": "x"
- * },
- * "toutiao": {
- * "hostVer": "√",
- * "uniVer": "x",
- * "unixVer": "x"
- * },
- * "lark": {
- * "hostVer": "√",
- * "uniVer": "x",
- * "unixVer": "x"
- * },
- * "qq": {
- * "hostVer": "√",
- * "uniVer": "x",
- * "unixVer": "x"
- * },
- * "kuaishou": {
- * "hostVer": "√",
- * "uniVer": "x",
- * "unixVer": "x"
- * },
- * "jd": {
- * "hostVer": "√",
- * "uniVer": "x",
- * "unixVer": "x"
- * }
- * },
- * "web": {
- * "uniVer": "x",
- * "unixVer": "4.31"
- * }
- * }
+ * @uniPlatform
+ {
+ "app": {
+ "android": {
+ "osVer": "5.0",
+ "uniVer": "x",
+ "uniUtsPlugin": "x",
+ "unixVer": "4.31",
+ "unixUtsPlugin": "4.31"
+ },
+ "ios": {
+ "osVer": "12.0",
+ "uniVer": "x",
+ "uniUtsPlugin": "x",
+ "unixVer": "4.31",
+ "unixUtsPlugin": "4.31"
+ },
+ "harmony": {
+ "osVer": "3.0",
+ "uniVer": "x",
+ "unixVer": "x"
+ }
+ },
+ "mp": {
+ "weixin": {
+ "hostVer": "√",
+ "uniVer": "x",
+ "unixVer": "x"
+ },
+ "alipay": {
+ "hostVer": "√",
+ "uniVer": "x",
+ "unixVer": "x"
+ },
+ "baidu": {
+ "hostVer": "√",
+ "uniVer": "x",
+ "unixVer": "x"
+ },
+ "toutiao": {
+ "hostVer": "√",
+ "uniVer": "x",
+ "unixVer": "x"
+ },
+ "lark": {
+ "hostVer": "√",
+ "uniVer": "x",
+ "unixVer": "x"
+ },
+ "qq": {
+ "hostVer": "√",
+ "uniVer": "x",
+ "unixVer": "x"
+ },
+ "kuaishou": {
+ "hostVer": "√",
+ "uniVer": "x",
+ "unixVer": "x"
+ },
+ "jd": {
+ "hostVer": "√",
+ "uniVer": "x",
+ "unixVer": "x"
+ }
+ },
+ "web": {
+ "uniVer": "x",
+ "unixVer": "4.31"
+ }
+ }
*/
complete ?: CloseDialogPageCompleteCallback | null
}
@@ -751,147 +1160,153 @@ export interface Uni {
* 打开模态弹窗页面
* @tutorial-uni-app-x https://doc.dcloud.net.cn/uni-app-x/api/dialog-page.html
* @tutorial https://doc.dcloud.net.cn/uni-app-x/api/dialog-page.html
- * @uniPlatform {
- * "app": {
- * "android": {
- * "osVer": "5.0",
- * "uniVer": "x",
- * "unixVer": "4.31"
- * },
- * "ios": {
- * "osVer": "12.0",
- * "uniVer": "x",
- * "unixVer": "4.31",
- * "uniUtsPlugin": "x",
- * "unixUtsPlugin": "4.31"
- * },
- * "harmony": {
- * "osVer": "3.0",
- * "uniVer": "x",
- * "unixVer": "x"
- * }
- * },
- * "mp": {
- * "weixin": {
- * "hostVer": "√",
- * "uniVer": "x",
- * "unixVer": "x"
- * },
- * "alipay": {
- * "hostVer": "√",
- * "uniVer": "x",
- * "unixVer": "x"
- * },
- * "baidu": {
- * "hostVer": "√",
- * "uniVer": "x",
- * "unixVer": "x"
- * },
- * "toutiao": {
- * "hostVer": "√",
- * "uniVer": "x",
- * "unixVer": "x"
- * },
- * "lark": {
- * "hostVer": "√",
- * "uniVer": "x",
- * "unixVer": "x"
- * },
- * "qq": {
- * "hostVer": "√",
- * "uniVer": "x",
- * "unixVer": "x"
- * },
- * "kuaishou": {
- * "hostVer": "√",
- * "uniVer": "x",
- * "unixVer": "x"
- * },
- * "jd": {
- * "hostVer": "√",
- * "uniVer": "x",
- * "unixVer": "x"
- * }
- * },
- * "web": {
- * "uniVer": "x",
- * "unixVer": "4.31"
- * }
- * }
- */
+ * @uniPlatform
+ {
+ "app": {
+ "android": {
+ "osVer": "5.0",
+ "uniVer": "x",
+ "uniUtsPlugin": "x",
+ "unixVer": "4.31",
+ "unixUtsPlugin": "4.31"
+ },
+ "ios": {
+ "osVer": "12.0",
+ "uniVer": "x",
+ "uniUtsPlugin": "x",
+ "unixVer": "4.31",
+ "unixUtsPlugin": "4.31"
+ },
+ "harmony": {
+ "osVer": "3.0",
+ "uniVer": "x",
+ "unixVer": "x"
+ }
+ },
+ "mp": {
+ "weixin": {
+ "hostVer": "√",
+ "uniVer": "x",
+ "unixVer": "x"
+ },
+ "alipay": {
+ "hostVer": "√",
+ "uniVer": "x",
+ "unixVer": "x"
+ },
+ "baidu": {
+ "hostVer": "√",
+ "uniVer": "x",
+ "unixVer": "x"
+ },
+ "toutiao": {
+ "hostVer": "√",
+ "uniVer": "x",
+ "unixVer": "x"
+ },
+ "lark": {
+ "hostVer": "√",
+ "uniVer": "x",
+ "unixVer": "x"
+ },
+ "qq": {
+ "hostVer": "√",
+ "uniVer": "x",
+ "unixVer": "x"
+ },
+ "kuaishou": {
+ "hostVer": "√",
+ "uniVer": "x",
+ "unixVer": "x"
+ },
+ "jd": {
+ "hostVer": "√",
+ "uniVer": "x",
+ "unixVer": "x"
+ }
+ },
+ "web": {
+ "uniVer": "x",
+ "unixVer": "4.31"
+ }
+ }
+ */
openDialogPage(options: OpenDialogPageOptions): UniPage | null
/**
* 关闭模态弹窗页面
*
* @tutorial-uni-app-x https://doc.dcloud.net.cn/uni-app-x/api/dialog-page.html
* @tutorial https://doc.dcloud.net.cn/uni-app-x/api/dialog-page.html
- * @uniPlatform {
- * "app": {
- * "android": {
- * "osVer": "5.0",
- * "uniVer": "x",
- * "unixVer": "4.31"
- * },
- * "ios": {
- * "osVer": "12.0",
- * "uniVer": "x",
- * "unixVer": "4.31",
- * "uniUtsPlugin": "x",
- * "unixUtsPlugin": "4.31"
- * },
- * "harmony": {
- * "osVer": "3.0",
- * "uniVer": "x",
- * "unixVer": "x"
- * }
- * },
- * "mp": {
- * "weixin": {
- * "hostVer": "√",
- * "uniVer": "x",
- * "unixVer": "x"
- * },
- * "alipay": {
- * "hostVer": "√",
- * "uniVer": "x",
- * "unixVer": "x"
- * },
- * "baidu": {
- * "hostVer": "√",
- * "uniVer": "x",
- * "unixVer": "x"
- * },
- * "toutiao": {
- * "hostVer": "√",
- * "uniVer": "x",
- * "unixVer": "x"
- * },
- * "lark": {
- * "hostVer": "√",
- * "uniVer": "x",
- * "unixVer": "x"
- * },
- * "qq": {
- * "hostVer": "√",
- * "uniVer": "x",
- * "unixVer": "x"
- * },
- * "kuaishou": {
- * "hostVer": "√",
- * "uniVer": "x",
- * "unixVer": "x"
- * },
- * "jd": {
- * "hostVer": "√",
- * "uniVer": "x",
- * "unixVer": "x"
- * }
- * },
- * "web": {
- * "uniVer": "x",
- * "unixVer": "4.31"
- * }
- * }
+ * @uniPlatform
+ {
+ "app": {
+ "android": {
+ "osVer": "5.0",
+ "uniVer": "x",
+ "uniUtsPlugin": "x",
+ "unixVer": "4.31",
+ "unixUtsPlugin": "4.31"
+ },
+ "ios": {
+ "osVer": "12.0",
+ "uniVer": "x",
+ "uniUtsPlugin": "x",
+ "unixVer": "4.31",
+ "unixUtsPlugin": "4.31"
+ },
+ "harmony": {
+ "osVer": "3.0",
+ "uniVer": "x",
+ "unixVer": "x"
+ }
+ },
+ "mp": {
+ "weixin": {
+ "hostVer": "√",
+ "uniVer": "x",
+ "unixVer": "x"
+ },
+ "alipay": {
+ "hostVer": "√",
+ "uniVer": "x",
+ "unixVer": "x"
+ },
+ "baidu": {
+ "hostVer": "√",
+ "uniVer": "x",
+ "unixVer": "x"
+ },
+ "toutiao": {
+ "hostVer": "√",
+ "uniVer": "x",
+ "unixVer": "x"
+ },
+ "lark": {
+ "hostVer": "√",
+ "uniVer": "x",
+ "unixVer": "x"
+ },
+ "qq": {
+ "hostVer": "√",
+ "uniVer": "x",
+ "unixVer": "x"
+ },
+ "kuaishou": {
+ "hostVer": "√",
+ "uniVer": "x",
+ "unixVer": "x"
+ },
+ "jd": {
+ "hostVer": "√",
+ "uniVer": "x",
+ "unixVer": "x"
+ }
+ },
+ "web": {
+ "uniVer": "x",
+ "unixVer": "4.31"
+ }
+ }
*/
closeDialogPage(options ?: CloseDialogPageOptions | null) : null
}
\ No newline at end of file
diff --git a/uni_modules/uni-dialogPage/utssdk/protocols.uts b/uni_modules/uni-dialogPage/utssdk/protocols.uts
index 84af0f25afc9dc30b56290d5f62a53903e7d371f..1346bc666f3166ac5797f28ce9e6014940cb6d09 100644
--- a/uni_modules/uni-dialogPage/utssdk/protocols.uts
+++ b/uni_modules/uni-dialogPage/utssdk/protocols.uts
@@ -25,6 +25,9 @@ export function normalizeRouteOptions(
url,
} as NormalizeRouteOptionsResult
}
+ if (url.startsWith('uni:')) {
+ return { errMsg: '', url } as NormalizeRouteOptionsResult
+ }
// 格式化为绝对路径路由
url = normalizeRoute(url)
const pagePath = parseUrl(url!).path
@@ -86,7 +89,7 @@ function getRealRoute(fromRoute: string, toRoute: string): string {
const toRouteArray = toRoute.split('/')
const toRouteLength = toRouteArray.length
let i = 0
- for (; i < toRouteLength && toRouteArray[i] == '..'; i++) {
+ for (;i < toRouteLength && toRouteArray[i] == '..';i++) {
// noop
}
toRouteArray.splice(0, i)
diff --git a/uni_modules/uni-dialogPage/utssdk/unierror.uts b/uni_modules/uni-dialogPage/utssdk/unierror.uts
index 9e267f37316a7ce2dbdb319ab83dac1024c0fb4a..9f1cbff0058f8e634b2abdb40d4b8fb5dc57f367 100644
--- a/uni_modules/uni-dialogPage/utssdk/unierror.uts
+++ b/uni_modules/uni-dialogPage/utssdk/unierror.uts
@@ -7,6 +7,7 @@ import {
export class OpenDialogPageSuccessImpl extends AsyncApiSuccessResult {
override errMsg: string
constructor(errMsg: string = 'openDialogPage: ok') {
+ super()
this.errMsg = errMsg
}
}
@@ -22,6 +23,7 @@ export class OpenDialogPageFailImpl extends UniError implements OpenDialogPageFa
export class CloseDialogPageSuccessImpl extends AsyncApiSuccessResult {
override errMsg: string
constructor(errMsg: string = 'closeDialogPage: ok') {
+ super()
this.errMsg = errMsg
}
}
diff --git a/uni_modules/uni-event/utssdk/app-android/index.uts b/uni_modules/uni-event/utssdk/app-android/index.uts
index 027790a28e295c65dab1eb8a31b7a79414404c2c..6d66ceba71bfa4341decc3897acb6d76a732f5e7 100644
--- a/uni_modules/uni-event/utssdk/app-android/index.uts
+++ b/uni_modules/uni-event/utssdk/app-android/index.uts
@@ -1,5 +1,5 @@
import { Emitter } from '@dcloudio/uni-runtime'
-import { $Emit, $Off, $On, $Once } from '../interface.uts'
+import { $Off, $On, $Once } from '../interface.uts'
const emitter = new Emitter()
@@ -16,7 +16,6 @@ export const $once = defineSyncApi<$Once>('$once', (eventName, callback): number
return emitter.once(eventName, callback)
})
-export const $emit = defineSyncApi<$Emit>('$emit', (eventName, arg) => {
- // TODO muti args
- emitter.emit(eventName, arg)
-})
+export function $emit(eventName: string, ...args: Array): void {
+ emitter.emit(eventName, ...args)
+}
diff --git a/uni_modules/uni-event/utssdk/app-harmony/index.uts b/uni_modules/uni-event/utssdk/app-harmony/index.uts
index b569c3a2c9227f170d1d25d114d93f739ffbda15..d644fc52820303238ff11d698fb7d76025dd885b 100644
--- a/uni_modules/uni-event/utssdk/app-harmony/index.uts
+++ b/uni_modules/uni-event/utssdk/app-harmony/index.uts
@@ -1,5 +1,6 @@
import {
- Emitter
+ Emitter,
+ getCurrentMP
} from '@dcloudio/uni-runtime'
import {
$Emit,
@@ -21,32 +22,46 @@ interface IUniEventEmitter {
emit: (eventName: string, ...args: (Object | undefined | null)[]) => void
}
-const emitter: IUniEventEmitter = new Emitter() as IUniEventEmitter
+const emitterStore = new Map()
+
+function getEmitter(): IUniEventEmitter {
+ const mp = getCurrentMP()
+ const id = mp.id as string
+ if (emitterStore.has(id)) {
+ return emitterStore.get(id) as IUniEventEmitter
+ }
+ const emitter = new Emitter() as IUniEventEmitter
+ emitterStore.set(id, emitter)
+ mp.on('beforeClose', () => {
+ emitterStore.delete(id)
+ })
+ return emitter
+}
export const $on: $On = defineSyncApi(
API_$_ON,
(eventName: string, callback: Function) => {
- return emitter.on(eventName, callback)
+ return getEmitter().on(eventName, callback)
}
) as $On
export const $once: $Once = defineSyncApi(
API_$_ONCE,
(eventName: string, callback: Function) => {
- return emitter.once(eventName, callback)
+ return getEmitter().once(eventName, callback)
}
) as $Once
export const $off: $Off = defineSyncApi(
API_$_OFF,
(eventName: string, callback: Function) => {
- emitter.off(eventName, callback)
+ getEmitter().off(eventName, callback)
}
) as $Off
export const $emit: $Emit = defineSyncApi(
API_$_EMIT,
(eventName: string, ...args: (Object | undefined | null)[]) => {
- emitter.emit(eventName, ...args)
+ getEmitter().emit(eventName, ...args)
}
) as $Emit
diff --git a/uni_modules/uni-event/utssdk/interface.uts b/uni_modules/uni-event/utssdk/interface.uts
index 8daf7955385fd3c926a094c4f3df09ff0f8c6cef..c2e77f569d5103069a870b02fe26b3eece9b18d0 100644
--- a/uni_modules/uni-event/utssdk/interface.uts
+++ b/uni_modules/uni-event/utssdk/interface.uts
@@ -6,7 +6,7 @@ export type $Once = (eventName: string, callback: $OnceCallback) => number
export type $Off = (eventName: string, callback?: any | null) => void
-export type $Emit = (eventName: string, args: any | null) => void
+export type $Emit = (eventName: string, ...args: Array) => void
export interface Uni {
/**
@@ -89,7 +89,7 @@ export interface Uni {
/**
* 移除自定义事件监听器。如果提供了事件名和回调,则只移除这个回调的监听器。
* 4.13+ 开始支持第二个参数为可选,如果仅提供事件名,则移除该事件的所有监听器。
- * 4.31+ 开始第二个参数的类型由 `Function \| null` 调整为 `any \| null`, 支持传入 `uni.$on`、`uni.$once` 返回的事件监听器 id, 移除指定事件监听器。
+ * 4.31+ 开始第二个参数的类型由 `Function | null` 调整为 `any | null`, 支持传入 `uni.$on`、`uni.$once` 返回的事件监听器 id, 移除指定事件监听器。
* @tutorial-uni-app-x https://doc.dcloud.net.cn/uni-app-x/api/event-bus.html#off
* @tutorial https://doc.dcloud.net.cn/uni-app-x/api/event-bus.html#off
* @tutorial-uni-app https://uniapp.dcloud.net.cn/api/window/communication.html#off
@@ -315,5 +315,5 @@ export interface Uni {
* @param eventName 事件名称
* @param args 触发事件时传递的参数
*/
- $emit(eventName: string, args: any | null): void
+ $emit(eventName: string, ...args: Array): void
}
diff --git a/uni_modules/uni-exit/package.json b/uni_modules/uni-exit/package.json
index a19ee114fb950ca16c3ad90ae396851940334e46..810ebab7a07ed26b0e4a395b5c901ec1c8ad52dd 100644
--- a/uni_modules/uni-exit/package.json
+++ b/uni_modules/uni-exit/package.json
@@ -39,7 +39,7 @@
"app": {
"js": true,
"kotlin": true,
- "swift": false,
+ "swift": true,
"arkts": true
}
}
diff --git a/uni_modules/uni-exit/utssdk/app-ios/index.uts b/uni_modules/uni-exit/utssdk/app-ios/index.uts
index 5be055badece05c639c6499763ec0b26db86fd07..c19a6c6811616dae576ea8af4132d1e9ba657c7b 100644
--- a/uni_modules/uni-exit/utssdk/app-ios/index.uts
+++ b/uni_modules/uni-exit/utssdk/app-ios/index.uts
@@ -1,13 +1,23 @@
-import { ExitOptions, Exit} from "../interface.uts"
-import { ExitFailImpl } from "../unierror.uts"
+import { ExitOptions, Exit, ExitSuccess} from "../interface.uts"
+import { ExitFailImpl} from "../unierror.uts"
+import { UTSiOS } from "DCloudUTSFoundation";
/**
* 实现uni.exit
- * iOS平台不支持,触发错误回调
*/
export const exit : Exit = function (options: ExitOptions | null) {
- let err = new ExitFailImpl(12001);
- options?.fail?.(err)
- options?.complete?.(err)
+
+ const result = UTSiOS.exit();
+ if(result){
+ let ret : ExitSuccess ={
+ errMsg: "exit:ok"
+ }
+ options?.success?.(ret)
+ options?.complete?.(ret)
+ }else{
+ let error = new ExitFailImpl(12003);
+ options?.fail?.(error)
+ options?.complete?.(error)
+ }
}
diff --git a/uni_modules/uni-exit/utssdk/interface.uts b/uni_modules/uni-exit/utssdk/interface.uts
index e364179480cfdbb7d4c38f8be75a7ef624196168..20d7eaf8252dfd431d6ed279d2140c7d487a02b3 100644
--- a/uni_modules/uni-exit/utssdk/interface.uts
+++ b/uni_modules/uni-exit/utssdk/interface.uts
@@ -16,7 +16,11 @@ export type ExitErrorCode =
/**
* 未知错误
*/
-12002
+12002 |
+/**
+ * iOS平台,仅在uni-app x SDK模式中支持应用退出
+ */
+12003
/**
* uni.exit失败回调参数
@@ -62,33 +66,34 @@ export interface Uni {
/**
* 退出当前应用
- * @uniPlatform {
- * "app": {
- * "android": {
- * "osVer": "5.0",
- * "uniVer": "3.8.15",
- * "uniUtsPlugin": "3.9.0",
- * "unixVer": "3.9.0",
- * "unixUtsPlugin": "3.9.0"
- * },
- * "ios": {
- * "osVer": "x",
- * "uniVer": "x",
- * "uniUtsPlugin": "x",
- * "unixVer": "x",
- * "unixUtsPlugin": "x"
- * },
- * "harmony": {
- * "osVer": "3.0",
- * "uniVer": "4.23",
- * "unixVer": "x"
- * }
- * },
- * "web": {
- * "uniVer": "x",
- * "unixVer": "x"
- * }
- * }
+ * @uniPlatform
+ {
+ "app": {
+ "android": {
+ "osVer": "5.0",
+ "uniVer": "3.8.15",
+ "uniUtsPlugin": "3.91",
+ "unixVer": "3.91",
+ "unixUtsPlugin": "3.91"
+ },
+ "ios": {
+ "osVer": "x",
+ "uniVer": "x",
+ "uniUtsPlugin": "x",
+ "unixVer": "4.33",
+ "unixUtsPlugin": "4.33"
+ },
+ "harmony": {
+ "osVer": "3.0",
+ "uniVer": "4.23",
+ "unixVer": "x"
+ }
+ },
+ "web": {
+ "uniVer": "x",
+ "unixVer": "x"
+ }
+ }
* @uniVueVersion 2,3 //支持的vue版本
*/
exit(options?: ExitOptions | null):void;
diff --git a/uni_modules/uni-exit/utssdk/unierror.uts b/uni_modules/uni-exit/utssdk/unierror.uts
index 039fbe41ce7947cbba9b77963d7bb9b6dc9fe1d1..16a64b73b90c7dfc6b931726a3f5d1793ec98be2 100644
--- a/uni_modules/uni-exit/utssdk/unierror.uts
+++ b/uni_modules/uni-exit/utssdk/unierror.uts
@@ -11,6 +11,7 @@ export const ExitUniErrorSubject = 'uni-exit';
* @UniError
*/
export const ExitUniErrors:Map = new Map([
+
/**
* 系统不支持
*/
@@ -18,7 +19,11 @@ export const ExitUniErrors:Map = new Map([
/**
* 未知错误
*/
- [12002, 'unknown error']
+ [12002, 'unknown error'],
+ /**
+ * iOS平台,仅在uni-app x SDK模式中支持应用退出
+ */
+ [12003, 'app exit is supported only in uni-app x SDK mode']
]);
/**
diff --git a/uni_modules/uni-getNetworkType/utssdk/app-harmony/index.uts b/uni_modules/uni-getNetworkType/utssdk/app-harmony/index.uts
index 42c6b9a94d01c8a6ea9bcbff762cc666b3a177e7..22d2c72d1946ab3b62f0f1fdf3fec3a1a2b67f3e 100644
--- a/uni_modules/uni-getNetworkType/utssdk/app-harmony/index.uts
+++ b/uni_modules/uni-getNetworkType/utssdk/app-harmony/index.uts
@@ -194,7 +194,14 @@ export const getNetworkType: GetNetworkType = defineAsyncApi {
- res.reject(err.message)
+ // NOTE 在 pad 上无网络
+ if (err.code === 2100001) {
+ res.resolve({
+ networkType: NetworkinfoType[1].toLocaleLowerCase()
+ } as GetNetworkTypeSuccess)
+ } else {
+ res.reject(err.message)
+ }
})
}
) as GetNetworkType
diff --git a/uni_modules/uni-getRecorderManager/utssdk/app-harmony/index.uts b/uni_modules/uni-getRecorderManager/utssdk/app-harmony/index.uts
index df2505ce75fb2494ebea2ba8493e44078b5805af..13310aaaccebe97e0b30a8fc91695114afa4840f 100644
--- a/uni_modules/uni-getRecorderManager/utssdk/app-harmony/index.uts
+++ b/uni_modules/uni-getRecorderManager/utssdk/app-harmony/index.uts
@@ -4,15 +4,17 @@ import AVRecorder, { supportFormats as avRecorderSupportFormats } from './AVReco
import { onRecorderStateChange, setRecordStateCallback, StateChangeRes } from './utils.uts';
// NOTE 避免被 vue Proxy 污染
-let RECORDER_MANAGER: RecorderManager | null = null
+let RECORDER_MANAGER: AVRecorder | null = null
+const DEFAULT_DURATION = 1000 * 60
+const MAX_DURATION = DEFAULT_DURATION * 10
+const DEFAULT_FORMAT = 'aac'
class RecorderManagerImpl implements RecorderManager {
- start(options: RecorderManagerStartOptions): void {
- if (!options.format) options.format = 'aac'
+ start(options: RecorderManagerStartOptions | null = null): void {
+ if (options == null) options = {} as RecorderManagerStartOptions
+ if (!options.format) options.format = DEFAULT_FORMAT
- const DEFAULT_DURATION = 1000 * 60
- const MAX_DURATION = DEFAULT_DURATION * 10
- if (typeof options.duration === 'undefined' || options.duration === null) {
+ if (options.duration == null) {
options.duration = DEFAULT_DURATION
}
if (options.duration > MAX_DURATION) {
diff --git a/uni_modules/uni-getSystemInfo/utssdk/app-ios/index.uts b/uni_modules/uni-getSystemInfo/utssdk/app-ios/index.uts
index 00e5a0fd46d0cc768a5a3a15e36b409afab11056..b96184ceb1452d2052afda7653e6f4385719f053 100644
--- a/uni_modules/uni-getSystemInfo/utssdk/app-ios/index.uts
+++ b/uni_modules/uni-getSystemInfo/utssdk/app-ios/index.uts
@@ -111,11 +111,11 @@ function getWindowInfoResult() : GetWindowInfoResult {
}
const safeAreaLeft = insetLeft
- const safeAreaRight = windowWidth - insetRight
+ const safeAreaRight = screenWidth - insetRight
const safeAreaTop = insetTop
- const safeAreaBottom = windowHeight - insetBottom
- const safeAreaWidth = windowWidth - insetLeft - insetRight
- const safeAreaHeight = windowHeight - insetTop - insetBottom
+ const safeAreaBottom = screenHeight - insetBottom
+ const safeAreaWidth = screenWidth - insetLeft - insetRight
+ const safeAreaHeight = screenHeight - insetTop - insetBottom
const safeArea : SafeArea = {
left: safeAreaLeft,
diff --git a/uni_modules/uni-loadFontFace/utssdk/app-android/index.uts b/uni_modules/uni-loadFontFace/utssdk/app-android/index.uts
index 1a773d6ca39894ac811eea2f5bf8d90c2150adb7..78395c68815612e9aeb15509b52d2cc2e85e77f1 100644
--- a/uni_modules/uni-loadFontFace/utssdk/app-android/index.uts
+++ b/uni_modules/uni-loadFontFace/utssdk/app-android/index.uts
@@ -37,7 +37,7 @@ export const loadFontFace = defineAsyncApi<
}
})
-const SOURCE_REG = /(.+\.((ttf)|(otf)|(woff2?))$)|(^(http|https):\/\/.+)/
+const SOURCE_REG = /(.+\.((ttf)|(otf)|(woff2?))$)|(^(http|https):\/\/.+)|(^(data:font).+)/
function checkOptionSource(
options: LoadFontFaceOptions,
res: ApiExecutor,
@@ -57,6 +57,11 @@ function checkOptionSource(
function removeUrlWrap(source: string): string {
if (source.startsWith('url(')) {
+ // url("xxx") format("xxx") 时移除 format("xxx")
+ const FormatParts = source.split('format(')
+ if (FormatParts.length > 1) {
+ source = FormatParts[0].trim()
+ }
source = source.substring(4, source.length - 1)
}
if (source.startsWith('"') || source.startsWith("'")) {
diff --git a/uni_modules/uni-media/package.json b/uni_modules/uni-media/package.json
index a9c7d24d576c49342d4a1e16d4fcfd1552a0fb2e..4fd1d3751b2505a9da67bde437ffd7c4f3f30fce 100644
--- a/uni_modules/uni-media/package.json
+++ b/uni_modules/uni-media/package.json
@@ -146,7 +146,8 @@
"dependencies": [
"uni-prompt",
"app-ios:permission-album",
- "app-ios:permission-camera"
+ "app-ios:permission-camera",
+ "uni-framework"
],
"encrypt": [],
"platforms": {
diff --git a/uni_modules/uni-media/utssdk/app-android/config.json b/uni_modules/uni-media/utssdk/app-android/config.json
index 1a9e9238affa90778e875710656c82fd726d7032..b96ecb3fd3352811c58c7dffffcbbe6b45085647 100644
--- a/uni_modules/uni-media/utssdk/app-android/config.json
+++ b/uni_modules/uni-media/utssdk/app-android/config.json
@@ -2,6 +2,7 @@
"dependencies": [
"com.github.bumptech.glide:glide:4.9.0",
"androidx.recyclerview:recyclerview:1.0.0",
- "androidx.appcompat:appcompat:1.0.0"
+ "androidx.appcompat:appcompat:1.6.1",
+ "androidx.activity:activity-ktx:1.9.2"
]
}
\ 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
index 6b126a73576f61130503b22249457340491740f5..3949ef2c6a9ad3c718ab5b4259e3aa0042c0022e 100644
--- a/uni_modules/uni-media/utssdk/app-android/index.uts
+++ b/uni_modules/uni-media/utssdk/app-android/index.uts
@@ -11,14 +11,14 @@ import {
SaveVideoToPhotosAlbum, SaveVideoToPhotosAlbumOptions, SaveVideoToPhotosAlbumSuccess,
CompressVideo, CompressVideoOptions,
} from "../interface.uts"
-export { ChooseFileSuccess, ChooseFileOptions, ChooseMediaFileType, ChooseMediaTempFile, ChooseMediaSuccess, ChooseMediaOptions, ChooseFileFail, ChooseFileComplete, ChooseMediaFail } from '../interface.uts';
+export { ChooseFileSuccess, ChooseFileOptions, ChooseMediaFileType, ChooseMediaTempFile, ChooseMediaSuccess, ChooseMediaOptions, ChooseFileFail, ChooseFileComplete, ChooseMediaFail, LongPressActionsSuccessData, LongPressActionsOptions } from '../interface.uts';
import {
UniError_PreviewImage, UniError_GetImageInfo, UniError_SaveImageToPhotosAlbum, UniError_SaveVideoToPhotosAlbum,
MediaErrorImpl
} from "../unierror.uts"
import { chooseMediaImage, chooseMediaVideo } from "./utils/ChooseMediaUtils.uts"
import { transcodeImage, transcodeVideo } from './utils/CompressUtils.uts'
-import { getVideoMetadata, copyFile } from "./utils/MediaUtils.uts"
+import { getVideoMetadata, copyFile, getOrientation } from "./utils/MediaUtils.uts"
import Intent from 'android.content.Intent';
import Manifest from 'android.Manifest';
import Build from 'android.os.Build';
@@ -118,18 +118,18 @@ class LongClick implements LongClickEventManager.OnLongClickListener {
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!
- }
+ // 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!,
@@ -259,7 +259,7 @@ class ImageInfoTarget extends CustomTarget {
function getExif(src : string, options : GetImageInfoOptions, bitmapOption : BitmapFactory.Options | null) {
var exifInfo : ExifInterface | null = null
- if(bitmapOption == null) {
+ if (bitmapOption == null) {
bitmapOption = new BitmapFactory.Options();
bitmapOption.inJustDecodeBounds = true;
}
@@ -378,16 +378,16 @@ function loadFile(options : SaveImageToPhotosAlbumOptions, saveToAlbum : boolean
}
}
-function getInputStream(fromFilePath:string):InputStream|null {
+function getInputStream(fromFilePath : string) : InputStream | null {
var fis : InputStream | null = null
try {
- if (fromFilePath.startsWith(ASSETS_PATH)) {
- fis = UTSAndroid.getUniActivity()!.getAssets().open(fromFilePath.replace(ASSETS_PATH, ""));
- } else {
- fis = new FileInputStream(fromFilePath)
- }
- } catch(e){
-
+ if (fromFilePath.startsWith(ASSETS_PATH)) {
+ fis = UTSAndroid.getUniActivity()!.getAssets().open(fromFilePath.replace(ASSETS_PATH, ""));
+ } else {
+ fis = new FileInputStream(fromFilePath)
+ }
+ } catch (e) {
+
}
return fis
}
@@ -409,6 +409,11 @@ function copyFileToPublicPath(fromFilePath : string, toFilePath : string, isVide
var mimeType : string | null = null
if (isVideo) {
var retriever = new MediaMetadataRetriever()
+ if (fromFilePath.startsWith(ASSETS_PATH)) {
+ var mediaCachePath = UTSAndroid.getAppCachePath() + "uni-media/_" + System.currentTimeMillis()
+ copyFile(fromFilePath,mediaCachePath)
+ fromFilePath = mediaCachePath
+ }
retriever.setDataSource(fromFilePath)
mimeType = retriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_MIMETYPE);
} else {
@@ -445,7 +450,7 @@ function copyFileToPublicPath(fromFilePath : string, toFilePath : string, isVide
return false
}
fis = getInputStream(fromFilePath)
- if(fis == null) {
+ if (fis == null) {
return false
}
var byteArrays = ByteArray(102400 * 2)
@@ -568,15 +573,10 @@ function loadFile(options : SaveVideoToPhotosAlbumOptions) {
options.complete?.(error)
return
}
- let originalPath = UTSAndroid.convert2AbsFullPath(options.filePath)
- if (originalPath.startsWith(ASSETS_PATH)) {
- originalPath = originalPath.replace(ASSETS_PATH, "")
- }
- if (!new File(originalPath).exists()) {
- let error = new MediaErrorImpl(1101003, UniError_SaveVideoToPhotosAlbum);
- options.fail?.(error)
- options.complete?.(error)
- return
+ var originalPath = options.filePath
+ var file = new File(originalPath)
+ if (!file.exists()) {
+ originalPath = UTSAndroid.convert2AbsFullPath(options.filePath)
}
let path = DCIM_PATH + originalPath.substring(originalPath.lastIndexOf("/") + 1)
if (copyFileToPublicPath(originalPath, path, true)) {
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
index 55c0efe2c70c530f0d47c6c39ea0d3a371aa2801..ea1576a94b52d06f2ea42044525880b29332f9b8 100644
Binary files a/uni_modules/uni-media/utssdk/app-android/libs/nativeobj-preview-release.aar 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/uni_media_slide_in_bottom.xml b/uni_modules/uni-media/utssdk/app-android/res/anim/uni_media_slide_in_bottom.xml
deleted file mode 100644
index 5c0de2a5b0eccc3918e7aa01ab20bfe09d3adadb..0000000000000000000000000000000000000000
--- a/uni_modules/uni-media/utssdk/app-android/res/anim/uni_media_slide_in_bottom.xml
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
\ No newline at end of file
diff --git a/uni_modules/uni-media/utssdk/app-android/res/anim/uni_media_slide_out_top.xml b/uni_modules/uni-media/utssdk/app-android/res/anim/uni_media_slide_out_top.xml
deleted file mode 100644
index 7fba593bf0140d08929aca1cf789ad65c9d3a301..0000000000000000000000000000000000000000
--- a/uni_modules/uni-media/utssdk/app-android/res/anim/uni_media_slide_out_top.xml
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
\ No newline at end of file
diff --git a/uni_modules/uni-media/utssdk/app-android/res/drawable/uni_media_dialog_bg_rounded.xml b/uni_modules/uni-media/utssdk/app-android/res/drawable/uni_media_dialog_bg_rounded.xml
deleted file mode 100644
index 8a05570ccb67dc626f7908b1de7de17380f9ba19..0000000000000000000000000000000000000000
--- a/uni_modules/uni-media/utssdk/app-android/res/drawable/uni_media_dialog_bg_rounded.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/uni_modules/uni-media/utssdk/app-android/res/drawable/uni_media_dialog_bg_rounded_night.xml b/uni_modules/uni-media/utssdk/app-android/res/drawable/uni_media_dialog_bg_rounded_night.xml
deleted file mode 100644
index 66614aad3a176f7efce4df7db7aacbf50661534a..0000000000000000000000000000000000000000
--- a/uni_modules/uni-media/utssdk/app-android/res/drawable/uni_media_dialog_bg_rounded_night.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/uni_modules/uni-media/utssdk/app-android/res/layout/uni_media_action_sheet.xml b/uni_modules/uni-media/utssdk/app-android/res/layout/uni_media_action_sheet.xml
deleted file mode 100644
index babb9f0708c91cda17b0a265b7dc84b59c559259..0000000000000000000000000000000000000000
--- a/uni_modules/uni-media/utssdk/app-android/res/layout/uni_media_action_sheet.xml
+++ /dev/null
@@ -1,60 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/uni_modules/uni-media/utssdk/app-android/res/layout/uni_media_action_sheet_night.xml b/uni_modules/uni-media/utssdk/app-android/res/layout/uni_media_action_sheet_night.xml
deleted file mode 100644
index 60c742c27f1b066bc36b675e75d069df80bee74b..0000000000000000000000000000000000000000
--- a/uni_modules/uni-media/utssdk/app-android/res/layout/uni_media_action_sheet_night.xml
+++ /dev/null
@@ -1,60 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/uni_modules/uni-media/utssdk/app-android/res/layout/uni_media_recyclerview_layout.xml b/uni_modules/uni-media/utssdk/app-android/res/layout/uni_media_recyclerview_layout.xml
deleted file mode 100644
index 43a7e5c4792344a67cd0527121b12b13a9465288..0000000000000000000000000000000000000000
--- a/uni_modules/uni-media/utssdk/app-android/res/layout/uni_media_recyclerview_layout.xml
+++ /dev/null
@@ -1,27 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/uni_modules/uni-media/utssdk/app-android/res/layout/uni_media_recyclerview_layout_night.xml b/uni_modules/uni-media/utssdk/app-android/res/layout/uni_media_recyclerview_layout_night.xml
deleted file mode 100644
index d4d8a13c7f16d2bf82be48e15c26adec405e9e87..0000000000000000000000000000000000000000
--- a/uni_modules/uni-media/utssdk/app-android/res/layout/uni_media_recyclerview_layout_night.xml
+++ /dev/null
@@ -1,24 +0,0 @@
-
-
-
-
-
-
-
-
\ 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
deleted file mode 100644
index a410b07981c0c51b85c1403a893063c64375926e..0000000000000000000000000000000000000000
--- a/uni_modules/uni-media/utssdk/app-android/res/values-zh/strings.xml
+++ /dev/null
@@ -1,4 +0,0 @@
-
- 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
deleted file mode 100644
index 861edbc94d44ce43a3d83ffc53becacff7e87625..0000000000000000000000000000000000000000
--- a/uni_modules/uni-media/utssdk/app-android/res/values/colors.xml
+++ /dev/null
@@ -1,46 +0,0 @@
-
-
-
- #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
deleted file mode 100644
index a0c4c014e80791ca2ce22a81ae4c7322ed229018..0000000000000000000000000000000000000000
--- a/uni_modules/uni-media/utssdk/app-android/res/values/strings.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
- 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
deleted file mode 100644
index 00da0872198e02671fe63c38e957f2d656871e88..0000000000000000000000000000000000000000
--- a/uni_modules/uni-media/utssdk/app-android/res/values/styles.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
diff --git a/uni_modules/uni-media/utssdk/app-android/utils/ChooseMediaUtils.uts b/uni_modules/uni-media/utssdk/app-android/utils/ChooseMediaUtils.uts
index aa76a935a4bee3ad47e681f8cca325b0cefd7d4c..35ef98e4aeb65809dba9cbf1f380bdd45f7ef075 100644
--- a/uni_modules/uni-media/utssdk/app-android/utils/ChooseMediaUtils.uts
+++ b/uni_modules/uni-media/utssdk/app-android/utils/ChooseMediaUtils.uts
@@ -2,12 +2,13 @@ import {
ChooseImageOptions, ChooseImageSuccess, ChooseImageCropOptions,
ChooseVideoOptions, ChooseVideoSuccess, ChooseImageTempFile,
GetVideoInfoSuccess,
+ ChooseImagePageOrientation,
} from "../../interface.uts"
import {
UniError_ChooseImage, UniError_ChooseVideo,
MediaErrorImpl
} from "../../unierror.uts"
-import { getVideoMetadata } from "./MediaUtils.uts"
+import { getOrientation, getVideoMetadata } from "./MediaUtils.uts"
import { uniChooseImage, uniChooseVideo } from "./ChooseImageUtils.uts"
import { getUniActivity } from "io.dcloud.uts.android";
import Intent from 'android.content.Intent';
@@ -31,31 +32,49 @@ const mediaCachePath = UTSAndroid.getAppCachePath() + "uni-media/"
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"]
- }
+ if (option.albumMode == "system" && index != 0) {
+ if (Build.VERSION.SDK_INT > 32) {
+ openAlbumForImage(option, count, 100)
+ } else {
+ UTSAndroid.requestSystemPermission(UTSAndroid.getUniActivity()!, [android.Manifest.permission.READ_EXTERNAL_STORAGE], (a : boolean, b : string[]) => {
+ if (index == 0) {
+ openCameraForImage(option, compressed)
+ } else {
+ openAlbumForImage(option, count, 100)
+ }
+ }, (a : boolean, b : string[]) => {
+ let error = new MediaErrorImpl(1101005, UniError_ChooseImage);
+ option.fail?.(error)
+ option.complete?.(error)
+ })
}
- UTSAndroid.requestSystemPermission(UTSAndroid.getUniActivity()!, requestPermissionList, (a : boolean, b : string[]) => {
+ } else {
+ 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 = new MediaErrorImpl(1101005, UniError_ChooseImage);
+ option.fail?.(error)
+ option.complete?.(error)
+ })
+ } else {
if (index == 0) {
openCameraForImage(option, compressed)
- } else {
- openAlbumForImage(option, count, 100)
+ } else if (index == 1) {
+ openAlbumForImage(option, count, 101)
}
- }, (a : boolean, b : string[]) => {
- // 失败回调
- let error = new MediaErrorImpl(1101005, UniError_ChooseImage);
- option.fail?.(error)
- option.complete?.(error)
- })
- } else {
- if (index == 0) {
- openCameraForImage(option, compressed)
- } else if (index == 1) {
- openAlbumForImage(option, count, 101)
}
}
})
@@ -182,7 +201,7 @@ function openAlbumForImage(option : ChooseImageOptions, count : number, type : n
let path = (current as Media).path;
picPaths.push("file://" + (current as Media).path);
try {
- let tempPathJson : ChooseImageTempFile = {"path":"file://" + path,"size":new File(path).length()}
+ let tempPathJson : ChooseImageTempFile = { "path": "file://" + path, "size": new File(path).length() }
picTempPathJson.push(tempPathJson)
} catch (e) { }
})
@@ -205,42 +224,60 @@ function openAlbumForImage(option : ChooseImageOptions, count : number, type : n
}
}
UTSAndroid.onAppActivityResult(albumFunction!)
- openGalleryActivity(count, type, false, option.sizeType, option.crop);
+ openGalleryActivity(count, type, false, option.sizeType, option.crop, option.pageOrientation, option.albumMode);
}
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"]
- }
+ if (options.albumMode == "system" && index != 0) {
+ if (Build.VERSION.SDK_INT > 32) {
+ openAlbumForVideo(options, count, 102, compressed)
+ } else {
+ UTSAndroid.requestSystemPermission(UTSAndroid.getUniActivity()!, [android.Manifest.permission.READ_EXTERNAL_STORAGE], (a : boolean, b : string[]) => {
+ if (index == 0) {
+ openCameraForVideo(options, compressed)
+ } else {
+ openAlbumForVideo(options, count, 102, compressed)
+ }
+ }, (a : boolean, b : string[]) => {
+ let error = new MediaErrorImpl(1101005, UniError_ChooseVideo);
+ options.fail?.(error)
+ options.complete?.(error)
+ })
}
- UTSAndroid.requestSystemPermission(UTSAndroid.getUniActivity()!, requestPermissionList, (a : boolean, b : string[]) => {
+ } else {
+ 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 = new MediaErrorImpl(1101005, UniError_ChooseVideo);
+ options.fail?.(error)
+ options.complete?.(error)
+ } else {
+ let error = new MediaErrorImpl(1101005, UniError_ChooseVideo);
+ options.fail?.(error)
+ options.complete?.(error)
+ }
+ })
+ } else {
if (index == 0) {
openCameraForVideo(options, compressed)
- } else {
+ } else if (index == 1) {
openAlbumForVideo(options, count, 102, compressed)
}
- }, (a : boolean, b : string[]) => {
- // 失败回调
- if (index == 0) {
- let error = new MediaErrorImpl(1101005, UniError_ChooseVideo);
- options.fail?.(error)
- options.complete?.(error)
- } else {
- let error = new MediaErrorImpl(1101005, UniError_ChooseVideo);
- options.fail?.(error)
- options.complete?.(error)
- }
- })
- } else {
- if (index == 0) {
- openCameraForVideo(options, compressed)
- } else if (index == 1) {
- openAlbumForVideo(options, count, 102, compressed)
}
}
})
@@ -406,10 +443,10 @@ function openAlbumForVideo(option : ChooseVideoOptions, count : number, type : n
}
}
UTSAndroid.onAppActivityResult(openAlbumFunction!)
- openGalleryActivity(count, type, compressed, null, null);
+ openGalleryActivity(count, type, compressed, null, null, option.pageOrientation, option.albumMode);
}
-function openGalleryActivity(count : number, type : number, compressed : boolean, sizeType ?: (string[]) | null, crop ?: ChooseImageCropOptions | null) {
+function openGalleryActivity(count : number, type : number, compressed : boolean, sizeType ?: (string[]) | null, crop ?: ChooseImageCropOptions | null, pageOrientation ?: ChooseImagePageOrientation | null, useSystem : string | null) {
let selected : Array = [];// 已选中的图片
let maximum = -1;
let editable = true; // 是否可编辑,对应editable
@@ -417,7 +454,11 @@ function openGalleryActivity(count : number, type : number, compressed : boolean
// let compressed = false; // 视频压缩,对应“videoCompress”
let albumIntent = new Intent()
- albumIntent.setClassName(getUniActivity()!!, "io.dcloud.uts.dmcbig.mediapicker.PickerActivity");
+ if (useSystem == "system") {
+ albumIntent.setClassName(getUniActivity()!!, "io.dcloud.uts.pick.SystemPickerActivity");
+ } else {
+ 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)
@@ -434,5 +475,7 @@ function openGalleryActivity(count : number, type : number, compressed : boolean
albumIntent.putExtra(/* IMAGE_CROP = */"image_crop", JSON.stringify(crop))
albumIntent.putExtra(/* MAX_SELECT_COUNT = */"max_select_count", 1) // 编辑模式下只能选中一个
}
+ albumIntent.putExtra("page_orientation", getOrientation(pageOrientation))
+ albumIntent.putExtra("copy_privacy_path", !UTSAndroid.isUniAppX())
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
index 2977ce16475b3a154022cb07f35988367de5a136..11cc86cd4bbf79c4879abd84c837a9839941ea9a 100644
--- a/uni_modules/uni-media/utssdk/app-android/utils/CompressUtils.uts
+++ b/uni_modules/uni-media/utssdk/app-android/utils/CompressUtils.uts
@@ -3,7 +3,7 @@ import {
CompressVideoOptions, CompressVideoSuccess
} from "../../interface.uts"
import {
- UniError_CompressVideo,UniError_CompressImage,
+ UniError_CompressVideo, UniError_CompressImage,
MediaErrorImpl
} from "../../unierror.uts"
import TextUtils from 'android.text.TextUtils';
@@ -17,8 +17,9 @@ 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';
+import { copyFile } from "./MediaUtils.uts";
-const mediaCachePath = UTSAndroid.getAppCachePath()+"uni-media/"
+const mediaCachePath = UTSAndroid.getAppCachePath() + "uni-media/"
// export function threadCompress() {
// }
export function transcodeImage(options : CompressImageOptions) {
@@ -201,8 +202,24 @@ class CompressOptions {
}
export function transcodeVideo(options : CompressVideoOptions) {
- let inPath = UTSAndroid.convert2AbsFullPath(options.src)
- let inFile = new File(inPath)
+ var inPath = options.src
+ var inFile = new File(inPath)
+ if (!inFile.exists()) {
+ inPath = UTSAndroid.convert2AbsFullPath(options.src)
+ }
+ if (inPath.startsWith("/android_asset/")) {
+ var mediaCachePath = UTSAndroid.getAppCachePath() + "uni-media/_" + System.currentTimeMillis()
+ if (copyFile(inPath, mediaCachePath)) {
+ inPath = mediaCachePath
+ } else {
+ let error = new MediaErrorImpl(1101010, UniError_CompressVideo);
+ options.fail?.(error)
+ options.complete?.(error)
+ }
+ }
+ if (!inFile.exists()) {
+ inFile = new File(inPath)
+ }
if (!inFile.exists()) {
let error = new MediaErrorImpl(1101003, UniError_CompressVideo);
options.fail?.(error)
@@ -234,7 +251,6 @@ export function transcodeVideo(options : CompressVideoOptions) {
if (!outFile.getParentFile().exists()) {
outFile.getParentFile().mkdirs()
}
-
MediaTranscoder.getInstance().transcodeVideo(inPath, outPath, MediaFormatStrategyPresets.createAndroid720pStrategy(compressLevel, resolution!), new MediaTranscoderListener(inPath, outPath, options))
}
diff --git a/uni_modules/uni-media/utssdk/app-android/utils/MediaUtils.uts b/uni_modules/uni-media/utssdk/app-android/utils/MediaUtils.uts
index 0941c0d3669b766c96b38db7f662f7633df2e99d..85ad5cdaf15d67d39286a9981304f6d655beec4e 100644
--- a/uni_modules/uni-media/utssdk/app-android/utils/MediaUtils.uts
+++ b/uni_modules/uni-media/utssdk/app-android/utils/MediaUtils.uts
@@ -1,4 +1,5 @@
import {
+ ChooseImagePageOrientation,
GetVideoInfoSuccess,
} from "../../interface.uts"
import {
@@ -15,6 +16,7 @@ import TextUtils from 'android.text.TextUtils';
import FileOutputStream from 'java.io.FileOutputStream';
import FileInputStream from 'java.io.FileInputStream';
import InputStream from 'java.io.InputStream';
+import UniConfig from 'io.dcloud.uniapp.framework.UniConfig';
const ASSETS_PATH = '/android_asset/'
@@ -25,7 +27,11 @@ export function getVideoMetadata(src : string) : any {
height: 0,
width: 0
}
- var path = UTSAndroid.convert2AbsFullPath(src)
+ var path = src
+ var videoFile = new File(src)
+ if(!videoFile.exists()) {
+ path = UTSAndroid.convert2AbsFullPath(src)
+ }
if (path.startsWith("/android_asset/")) {
var mediaCachePath = UTSAndroid.getAppCachePath() + "uni-media/_" + System.currentTimeMillis()
if (copyFile(path, mediaCachePath)) {
@@ -35,7 +41,9 @@ export function getVideoMetadata(src : string) : any {
return error
}
}
- let videoFile = new File(path)
+ if(!videoFile.exists()) {
+ videoFile = new File(path)
+ }
if (!videoFile.exists()) {
let error = new MediaErrorImpl(1101003, UniError_GetVideoInfo);
return error
@@ -160,4 +168,54 @@ export function copyFile(fromFilePath : string, toFilePath : string) : boolean {
} catch (e) {
return false;
}
+}
+
+/**
+ * 0 LANDSCAPE
+ * 1 PORTRAIT
+ * 2 USER/AUTO
+ */
+export function getOrientation(pageOrientation ?: ChooseImagePageOrientation | null) : number {
+ if (pageOrientation == null) {
+ var __uniConfig = getGlobalConfig()
+ if (__uniConfig != null) {
+ var styles = __uniConfig.globalStyle
+ if (styles['pageOrientation'] != null) {
+ pageOrientation = styles['pageOrientation']!.toString()
+ } else {
+ return 1
+ }
+ } else {
+ return 1
+ }
+ }
+ switch (pageOrientation!) {
+ case "auto": {
+ return 2
+ }
+ case "portrait": {
+ return 1
+ }
+ case "landscape": {
+ return 6
+ }
+ default: {
+ return 1
+ }
+ }
+}
+
+function getGlobalConfig() : UniConfig | null {
+ try {
+ var config = Class.forName("io.dcloud.uniapp.framework.IndexKt")
+ if (config != null) {
+ var cc = config.getDeclaredField("__uniConfig")
+ cc.setAccessible(true)
+ return cc.get(null) as UniConfig
+ } else {
+ return null
+ }
+ } catch (e) {
+ return null
+ }
}
\ 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
deleted file mode 100644
index 32a53804210d49c9d42574d0b4987c56961bd75a..0000000000000000000000000000000000000000
--- a/uni_modules/uni-media/utssdk/app-android/utils/showActionSheet.uts
+++ /dev/null
@@ -1,311 +0,0 @@
-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.uni_media_action_sheet_night, null)
- } else {
- v = LayoutInflater.from(this.hostActivity).inflate(R.layout.uni_media_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.uni_media_recyclerview_layout_night, parent, false)
- } else {
- view =
- LayoutInflater.from(parent.context).inflate(R.layout.uni_media_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/Frameworks/DCloudMediaPicker.xcframework/ios-arm64/DCloudMediaPicker.framework/DCloudMediaPicker b/uni_modules/uni-media/utssdk/app-ios/Frameworks/DCloudMediaPicker.xcframework/ios-arm64/DCloudMediaPicker.framework/DCloudMediaPicker
index 54214b1a71cfd173c7d6491ed2f2b81ebff48f55..ae9d43a2c80f336317d3ae159b4ee67f3139f901 100644
Binary files a/uni_modules/uni-media/utssdk/app-ios/Frameworks/DCloudMediaPicker.xcframework/ios-arm64/DCloudMediaPicker.framework/DCloudMediaPicker and b/uni_modules/uni-media/utssdk/app-ios/Frameworks/DCloudMediaPicker.xcframework/ios-arm64/DCloudMediaPicker.framework/DCloudMediaPicker differ
diff --git a/uni_modules/uni-media/utssdk/app-ios/Frameworks/DCloudMediaPicker.xcframework/ios-arm64/DCloudMediaPicker.framework/Info.plist b/uni_modules/uni-media/utssdk/app-ios/Frameworks/DCloudMediaPicker.xcframework/ios-arm64/DCloudMediaPicker.framework/Info.plist
index 0189d973f5cd013085d6b34149d97cf93abbf280..c01f81a49d9a87f11eed599bfa9c71c1614df1a5 100644
Binary files a/uni_modules/uni-media/utssdk/app-ios/Frameworks/DCloudMediaPicker.xcframework/ios-arm64/DCloudMediaPicker.framework/Info.plist and b/uni_modules/uni-media/utssdk/app-ios/Frameworks/DCloudMediaPicker.xcframework/ios-arm64/DCloudMediaPicker.framework/Info.plist differ
diff --git a/uni_modules/uni-media/utssdk/app-ios/Frameworks/DCloudMediaPicker.xcframework/ios-arm64_x86_64-simulator/DCloudMediaPicker.framework/DCloudMediaPicker b/uni_modules/uni-media/utssdk/app-ios/Frameworks/DCloudMediaPicker.xcframework/ios-arm64_x86_64-simulator/DCloudMediaPicker.framework/DCloudMediaPicker
index 91750eaa63569fd54be2f60f4d2fa255e1f0770d..e6cd6aa31fc9c3238037190bae00f5f0bca596fe 100644
Binary files a/uni_modules/uni-media/utssdk/app-ios/Frameworks/DCloudMediaPicker.xcframework/ios-arm64_x86_64-simulator/DCloudMediaPicker.framework/DCloudMediaPicker and b/uni_modules/uni-media/utssdk/app-ios/Frameworks/DCloudMediaPicker.xcframework/ios-arm64_x86_64-simulator/DCloudMediaPicker.framework/DCloudMediaPicker differ
diff --git a/uni_modules/uni-media/utssdk/app-ios/Frameworks/DCloudMediaPicker.xcframework/ios-arm64_x86_64-simulator/DCloudMediaPicker.framework/Info.plist b/uni_modules/uni-media/utssdk/app-ios/Frameworks/DCloudMediaPicker.xcframework/ios-arm64_x86_64-simulator/DCloudMediaPicker.framework/Info.plist
index 01322a7e001f5ba42dc43987fd433b52f187df1e..d508c5276cbde7a79e37998289e07219478abd71 100644
Binary files a/uni_modules/uni-media/utssdk/app-ios/Frameworks/DCloudMediaPicker.xcframework/ios-arm64_x86_64-simulator/DCloudMediaPicker.framework/Info.plist and b/uni_modules/uni-media/utssdk/app-ios/Frameworks/DCloudMediaPicker.xcframework/ios-arm64_x86_64-simulator/DCloudMediaPicker.framework/Info.plist differ
diff --git a/uni_modules/uni-media/utssdk/app-ios/Frameworks/DCloudMediaPicker.xcframework/ios-arm64_x86_64-simulator/DCloudMediaPicker.framework/_CodeSignature/CodeDirectory b/uni_modules/uni-media/utssdk/app-ios/Frameworks/DCloudMediaPicker.xcframework/ios-arm64_x86_64-simulator/DCloudMediaPicker.framework/_CodeSignature/CodeDirectory
index 01385e99ffab8970cbc6169a1d7524e52d06c5ec..bc256205fbe8b4a6a1ce71b6db9e5d65db663f6c 100644
Binary files a/uni_modules/uni-media/utssdk/app-ios/Frameworks/DCloudMediaPicker.xcframework/ios-arm64_x86_64-simulator/DCloudMediaPicker.framework/_CodeSignature/CodeDirectory and b/uni_modules/uni-media/utssdk/app-ios/Frameworks/DCloudMediaPicker.xcframework/ios-arm64_x86_64-simulator/DCloudMediaPicker.framework/_CodeSignature/CodeDirectory differ
diff --git a/uni_modules/uni-media/utssdk/app-ios/Frameworks/DCloudMediaPicker.xcframework/ios-arm64_x86_64-simulator/DCloudMediaPicker.framework/_CodeSignature/CodeRequirements-1 b/uni_modules/uni-media/utssdk/app-ios/Frameworks/DCloudMediaPicker.xcframework/ios-arm64_x86_64-simulator/DCloudMediaPicker.framework/_CodeSignature/CodeRequirements-1
index 03fce436b4cc1ffd35fb7edcc3d6b5af7e5709f5..6d4a5c82ffcda28425a683a6a58b4f31250e1efc 100644
Binary files a/uni_modules/uni-media/utssdk/app-ios/Frameworks/DCloudMediaPicker.xcframework/ios-arm64_x86_64-simulator/DCloudMediaPicker.framework/_CodeSignature/CodeRequirements-1 and b/uni_modules/uni-media/utssdk/app-ios/Frameworks/DCloudMediaPicker.xcframework/ios-arm64_x86_64-simulator/DCloudMediaPicker.framework/_CodeSignature/CodeRequirements-1 differ
diff --git a/uni_modules/uni-media/utssdk/app-ios/Frameworks/DCloudMediaPicker.xcframework/ios-arm64_x86_64-simulator/DCloudMediaPicker.framework/_CodeSignature/CodeResources b/uni_modules/uni-media/utssdk/app-ios/Frameworks/DCloudMediaPicker.xcframework/ios-arm64_x86_64-simulator/DCloudMediaPicker.framework/_CodeSignature/CodeResources
index d26ac100ed2219e51b25bb4260540d132b1ea70f..e57e391360b7a7659c6af31395bc196f43bc55e4 100644
--- a/uni_modules/uni-media/utssdk/app-ios/Frameworks/DCloudMediaPicker.xcframework/ios-arm64_x86_64-simulator/DCloudMediaPicker.framework/_CodeSignature/CodeResources
+++ b/uni_modules/uni-media/utssdk/app-ios/Frameworks/DCloudMediaPicker.xcframework/ios-arm64_x86_64-simulator/DCloudMediaPicker.framework/_CodeSignature/CodeResources
@@ -30,7 +30,7 @@
Info.plist
- rlIVej37Dv8+mPAAcqHurvPtaGw=
+ Y5IlEsVd971z5pHeLcH1MMmFJyY=
Modules/module.modulemap
diff --git a/uni_modules/uni-media/utssdk/app-ios/utils/mediaPicker.uts b/uni_modules/uni-media/utssdk/app-ios/utils/mediaPicker.uts
index e588a35972a5e04b0f7be57d88abac3ed5d99614..cf505f1ce6bd518bf9aedcb4a98c7839cbff5c26 100644
--- a/uni_modules/uni-media/utssdk/app-ios/utils/mediaPicker.uts
+++ b/uni_modules/uni-media/utssdk/app-ios/utils/mediaPicker.uts
@@ -12,7 +12,8 @@ import {
import {
UniError_ChooseImage, MediaErrorImpl, UniError_PreviewImage, UniError_ChooseVideo, UniError_CompressImage, UniError_GetVideoInfo, UniError_CompressVideo
} from "../../unierror.uts";
-import { isExistFilePath, createFilePath } from "./handleImageUtils.uts";
+import { isExistFilePath, createFilePath } from "./handleImageUtils.uts";
+import { UIInterfaceOrientationMask } from "UIKit";
export class DCUniMediaPicker {
private mediaAlbum : DCloudMediaAlbum | null = null;
@@ -210,7 +211,8 @@ export class DCUniMediaPicker {
options.set('videoCompress', option.compressed);
options.set('filePath', path);
options.set('maximum', 1);
- options.set('filter', "video");
+ options.set('filter', "video");
+ options.set('pageOrientation', this.convertPageOrientation(option.pageOrientation).rawValue);
DispatchQueue.main.async(execute = () : void => {
if (this.mediaAlbum == null) {
this.mediaAlbum = new DCloudMediaAlbum();
@@ -238,6 +240,19 @@ export class DCUniMediaPicker {
option.complete?.(mediaError)
})
})
+ }
+
+ private convertPageOrientation(orientationStr: string | null) : UIInterfaceOrientationMask{
+ if(orientationStr == "auto"){
+ return UIInterfaceOrientationMask.allButUpsideDown;
+ }
+ if(orientationStr == "portrait"){
+ return UIInterfaceOrientationMask.portrait;
+ }
+ if(orientationStr == "landscape"){
+ return UIInterfaceOrientationMask.landscape;
+ }
+ return UTSiOS.getSupportOrientation();
}
private _chooseImageWithAlbum(option : ChooseImageOptions, count : number) {
@@ -249,7 +264,9 @@ export class DCUniMediaPicker {
if (count > 0) {
options.set('maximum', count);
- }
+ }
+ options.set('pageOrientation', this.convertPageOrientation(option.pageOrientation).rawValue);
+
if (option.crop != null) {
let crop : Map = new Map();
if (option.crop!.width != null) {
diff --git a/uni_modules/uni-media/utssdk/interface.uts b/uni_modules/uni-media/utssdk/interface.uts
index 9145066e552a5495c782234c40b498bc804b3bcf..1b302ac05703e617463f9686b9c622af9fc64792 100644
--- a/uni_modules/uni-media/utssdk/interface.uts
+++ b/uni_modules/uni-media/utssdk/interface.uts
@@ -1,57 +1,57 @@
export type MediaOrientation =
-| 'up'
-| 'down'
-| 'left'
-| 'right'
-| 'up-mirrored'
-| 'down-mirrored'
-| 'left-mirrored'
-| 'right-mirrored'
+ | 'up'
+ | 'down'
+ | 'left'
+ | 'right'
+ | 'up-mirrored'
+ | 'down-mirrored'
+ | 'left-mirrored'
+ | 'right-mirrored'
/**
* 错误码
*/
export type MediaErrorCode =
-/**
- * 用户取消
- */
-1101001 |
-/**
- * urls至少包含一张图片地址
- */
-1101002 |
-/**
- * 文件不存在
- */
-1101003 |
-/**
- * 图片加载失败
- */
-1101004 |
-/**
- * 未获取权限
- */
-1101005 |
-/**
- * 图片或视频保存失败
- */
-1101006 |
-/**
- * 图片裁剪失败
- */
-1101007 |
-/**
- * 拍照或录像失败
- */
-1101008 |
-/**
- * 图片压缩失败
- */
-1101009 |
-/**
- * 其他错误
- */
-1101010;
+ /**
+ * 用户取消
+ */
+ 1101001 |
+ /**
+ * urls至少包含一张图片地址
+ */
+ 1101002 |
+ /**
+ * 文件不存在
+ */
+ 1101003 |
+ /**
+ * 图片加载失败
+ */
+ 1101004 |
+ /**
+ * 未获取权限
+ */
+ 1101005 |
+ /**
+ * 图片或视频保存失败
+ */
+ 1101006 |
+ /**
+ * 图片裁剪失败
+ */
+ 1101007 |
+ /**
+ * 拍照或录像失败
+ */
+ 1101008 |
+ /**
+ * 图片压缩失败
+ */
+ 1101009 |
+ /**
+ * 其他错误
+ */
+ 1101010;
/**
* 图片或视频操作失败的错误回调
@@ -64,19 +64,19 @@ export type ChooseImageTempFile = {
/**
* 本地文件路径
*/
- path: string,
+ path : string,
/**
* 本地文件大小,单位:B
*/
- size: number,
+ size : number,
/**
* 包含扩展名的文件名称,仅H5支持
*/
- name?: string | null,
+ name ?: string | null,
/**
* 文件类型,仅H5支持
*/
- type?: string | null
+ type ?: string | null
}
export type ChooseImageSuccess = {
/**
@@ -124,7 +124,86 @@ export type ChooseImageCropOptions = {
resize ?: (boolean) | null;
}
+export type ChooseImagePageOrientation =
+ /**
+ * 自动
+ */
+ "auto" |
+ /**
+ * 竖屏显示
+ */
+ "portrait" |
+ /**
+ * 横屏显示
+ */
+ "landscape"
+
+export type ChooseImageAlbumMode =
+/**
+ * 自定义媒体选择器
+ */
+"custom" |
+/**
+ * 系统媒体选择器
+ */
+"system"
+
export type ChooseImageOptions = {
+ /**
+ * 屏幕方向。默认为page.json中的pageOrientation。
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "5.0",
+ * "uniVer": "4.33",
+ * "unixVer": "4.33"
+ * },
+ * "ios": {
+ * "osVer": "10.0",
+ * "uniVer": "4.33",
+ * "unixVer": "4.33"
+ * },
+ * "harmony": {
+ * "osVer": "3.0",
+ * "uniVer": "x",
+ * "unixVer": "x"
+ * }
+ * },
+ * "web": {
+ * "uniVer": "x",
+ * "unixVer": "x"
+ * }
+ * }
+ */
+ pageOrientation ?: ChooseImagePageOrientation | null,
+ /**
+ * 图片选择模式
+ * @default "custom"
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "5.0",
+ * "uniVer": "4.33",
+ * "unixVer": "4.33"
+ * },
+ * "ios": {
+ * "osVer": "10.0",
+ * "uniVer": "x",
+ * "unixVer": "x"
+ * },
+ * "harmony": {
+ * "osVer": "3.0",
+ * "uniVer": "x",
+ * "unixVer": "x"
+ * }
+ * },
+ * "web": {
+ * "uniVer": "x",
+ * "unixVer": "x"
+ * }
+ * }
+ */
+ albumMode ?: ChooseImageAlbumMode | null,
/**
* 最多可以选择的图片张数,app端不限制,微信小程序最多可支持20个。
* @defaultValue 9
@@ -135,16 +214,26 @@ export type ChooseImageOptions = {
* @defaultValue ['original','compressed']
* @uniPlatform {
* "app":{
- * "harmony": {
- * "osVer": "3.0",
- * "uniVer": "4.23",
- * "unixVer": "x"
- * }
+ * "android": {
+ * "osVer": "5.0",
+ * "uniVer": "√",
+ * "unixVer": "3.9"
+ * },
+ * "ios": {
+ * "osVer": "10.0",
+ * "uniVer": "√",
+ * "unixVer": "4.11"
+ * },
+ * "harmony": {
+ * "osVer": "3.0",
+ * "uniVer": "4.23",
+ * "unixVer": "x"
+ * }
* },
- * "web": {
- * "uniVer": "x",
- * "unixVer": "x"
- * }
+ * "web": {
+ * "uniVer": "x",
+ * "unixVer": "x"
+ * }
* }
*/
sizeType ?: (string[]) | null,
@@ -159,14 +248,19 @@ export type ChooseImageOptions = {
* "app": {
* "android": {
* "osVer": "5.0",
- * "uniVer": "√",
+ * "uniVer": "x",
+ * "unixVer": "x"
+ * },
+ * "ios": {
+ * "osVer": "10.0",
+ * "uniVer": "x",
* "unixVer": "x"
* },
* "harmony": {
- * "osVer": "x",
- * "uniVer": "x",
- * "unixVer": "x"
- * }
+ * "osVer": "x",
+ * "uniVer": "x",
+ * "unixVer": "x"
+ * }
* },
* "web": {
* "uniVer": "2.9.9",
@@ -179,16 +273,26 @@ export type ChooseImageOptions = {
* 图像裁剪参数,设置后 sizeType 失效。
* @uniPlatform {
* "app":{
- * "harmony": {
- * "osVer": "x",
- * "uniVer": "x",
- * "unixVer": "x"
- * }
+ * "android": {
+ * "osVer": "5.0",
+ * "uniVer": "√",
+ * "unixVer": "3.9"
+ * },
+ * "ios": {
+ * "osVer": "10.0",
+ * "uniVer": "√",
+ * "unixVer": "4.11"
+ * },
+ * "harmony": {
+ * "osVer": "x",
+ * "uniVer": "x",
+ * "unixVer": "x"
+ * }
* },
- * "web": {
- * "uniVer": "x",
- * "unixVer": "x"
- * }
+ * "web": {
+ * "uniVer": "x",
+ * "unixVer": "x"
+ * }
* }
*/
crop ?: (ChooseImageCropOptions) | null,
@@ -291,7 +395,7 @@ export type PreviewImageOptions = {
* },
* "web": {
* "uniVer": "√",
- * "unixVer": "4.0"
+ * "unixVer": "x"
* }
* }
*/
@@ -301,11 +405,25 @@ export type PreviewImageOptions = {
*
* @uniPlatform {
* "app": {
+ * "android": {
+ * "osVer": "5.0",
+ * "uniVer": "√",
+ * "unixVer": "3.9"
+ * },
+ * "ios": {
+ * "osVer": "10.0",
+ * "uniVer": "√",
+ * "unixVer": "4.11"
+ * },
* "harmony": {
* "osVer": "x",
* "uniVer": "x",
* "unixVer": "x"
* }
+ * },
+ * "web": {
+ * "uniVer": "√",
+ * "unixVer": "x"
* }
* }
*/
@@ -326,6 +444,29 @@ export type PreviewImageOptions = {
/**
* 是否可循环预览
* @type boolean
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "5.0",
+ * "uniVer": "√",
+ * "unixVer": "3.9"
+ * },
+ * "ios": {
+ * "osVer": "10.0",
+ * "uniVer": "√",
+ * "unixVer": "4.11"
+ * },
+ * "harmony": {
+ * "osVer": "x",
+ * "uniVer": "x",
+ * "unixVer": "x"
+ * }
+ * },
+ * "web": {
+ * "uniVer": "√",
+ * "unixVer": "x"
+ * }
+ * }
*/
loop ?: boolean | null,
/**
@@ -337,15 +478,68 @@ export type PreviewImageOptions = {
* "uniVer": "√",
* "unixVer": "x"
* },
+ * "ios": {
+ * "osVer": "5.0",
+ * "uniVer": "√",
+ * "unixVer": "x"
+ * },
* "harmony": {
* "osVer": "x",
* "uniVer": "x",
* "unixVer": "x"
* }
* }
+ * },
+ * "web": {
+ * "osVer": "x",
+ * "uniVer": "x",
+ * "unixVer": "x"
+ * },
+ * "mp": {
+ * "weixin": {
+ * "hostVer": "√",
+ * "uniVer": "√",
+ * "unixVer": "4.35"
+ * },
+ * "alipay": {
+ * "hostVer": "√",
+ * "uniVer": "√",
+ * "unixVer": "x"
+ * },
+ * "baidu": {
+ * "hostVer": "√",
+ * "uniVer": "√",
+ * "unixVer": "x"
+ * },
+ * "toutiao": {
+ * "hostVer": "√",
+ * "uniVer": "√",
+ * "unixVer": "x"
+ * },
+ * "lark": {
+ * "hostVer": "√",
+ * "uniVer": "√",
+ * "unixVer": "x"
+ * },
+ * "qq": {
+ * "hostVer": "√",
+ * "uniVer": "√",
+ * "unixVer": "x"
+ * },
+ * "kuaishou": {
+ * "hostVer": "√",
+ * "uniVer": "√",
+ * "unixVer": "x"
+ * },
+ * "jd": {
+ * "hostVer": "√",
+ * "uniVer": "√",
+ * "unixVer": "x"
+ * }
+ * }
* }
*/
- longPressActions ?: LongPressActionsOptions | null,
+ // longPressActions ?: LongPressActionsOptions | null,
/**
* 接口调用成功的回调函数
*/
@@ -407,20 +601,20 @@ export type GetImageInfoSuccess = {
/**
* 返回图片的方向
* @uniPlatform {
- * "web": {
- * "uniVer": "x",
- * "unixVer": "x"
- * }
+ * "web": {
+ * "uniVer": "x",
+ * "unixVer": "x"
+ * }
* }
*/
orientation ?: MediaOrientation,
/**
* 返回图片的格式
* @uniPlatform {
- * "web": {
- * "uniVer": "x",
- * "unixVer": "x"
- * }
+ * "web": {
+ * "uniVer": "x",
+ * "unixVer": "x"
+ * }
* }
*/
type : string | null
@@ -575,8 +769,64 @@ export type ChooseVideoFail = IMediaError;
export type ChooseVideoSuccessCallback = (callback : ChooseVideoSuccess) => void
export type ChooseVideoFailCallback = (callback : ChooseVideoFail) => void
export type ChooseVideoCompleteCallback = ChooseImageCompleteCallback
-
+export type ChooseVideoPageOrientation = ChooseImagePageOrientation
+export type ChooseVideoAlbumMode = ChooseImageAlbumMode
export type ChooseVideoOptions = {
+ /**
+ * 屏幕方向。默认为page.json中的pageOrientation。
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "5.0",
+ * "uniVer": "4.33",
+ * "unixVer": "4.33"
+ * },
+ * "ios": {
+ * "osVer": "10.0",
+ * "uniVer": "4.33",
+ * "unixVer": "4.33"
+ * },
+ * "harmony": {
+ * "osVer": "3.0",
+ * "uniVer": "x",
+ * "unixVer": "x"
+ * }
+ * },
+ * "web": {
+ * "uniVer": "x",
+ * "unixVer": "x"
+ * }
+ * }
+ */
+ pageOrientation ?: ChooseVideoPageOrientation | null,
+ /**
+ * 视频选择模式
+ * @default "custom"
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "5.0",
+ * "uniVer": "4.33",
+ * "unixVer": "4.33"
+ * },
+ * "ios": {
+ * "osVer": "10.0",
+ * "uniVer": "x",
+ * "unixVer": "x"
+ * },
+ * "harmony": {
+ * "osVer": "3.0",
+ * "uniVer": "x",
+ * "unixVer": "x"
+ * }
+ * },
+ * "web": {
+ * "uniVer": "x",
+ * "unixVer": "x"
+ * }
+ * }
+ */
+ albumMode ?: ChooseVideoAlbumMode | null,
/**
* album 从相册选视频,camera 使用相机拍摄,默认为:['album', 'camera']
*/
@@ -587,6 +837,16 @@ export type ChooseVideoOptions = {
* @default true
* @uniPlatform {
* "app": {
+ * "android": {
+ * "osVer": "5.0",
+ * "uniVer": "√",
+ * "unixVer": "3.9"
+ * },
+ * "ios": {
+ * "osVer": "10.0",
+ * "uniVer": "√",
+ * "unixVer": "4.18"
+ * },
* "harmony": {
* "osVer": "x",
* "uniVer": "x",
@@ -604,16 +864,26 @@ export type ChooseVideoOptions = {
* 拍摄视频最长拍摄时间,单位秒。最长支持 60 秒
* @uniPlatform {
* "app": {
+ * "android": {
+ * "osVer": "5.0",
+ * "uniVer": "√",
+ * "unixVer": "3.9"
+ * },
+ * "ios": {
+ * "osVer": "10.0",
+ * "uniVer": "√",
+ * "unixVer": "4.18"
+ * },
* "harmony": {
* "osVer": "3.0",
* "uniVer": "4.25",
* "unixVer": "x"
* }
* },
- * "web": {
- * "uniVer": "x",
- * "unixVer": "x"
- * }
+ * "web": {
+ * "uniVer": "x",
+ * "unixVer": "x"
+ * }
* }
*/
maxDuration ?: number | null,
@@ -622,16 +892,26 @@ export type ChooseVideoOptions = {
*
* @uniPlatform {
* "app": {
+ * "android": {
+ * "osVer": "5.0",
+ * "uniVer": "√",
+ * "unixVer": "3.9"
+ * },
+ * "ios": {
+ * "osVer": "10.0",
+ * "uniVer": "√",
+ * "unixVer": "4.18"
+ * },
* "harmony": {
* "osVer": "3.0",
* "uniVer": "4.25",
* "unixVer": "x"
* }
* },
- * "web": {
- * "uniVer": "x",
- * "unixVer": "x"
- * }
+ * "web": {
+ * "uniVer": "x",
+ * "unixVer": "x"
+ * }
* }
*/
camera ?:
@@ -652,11 +932,16 @@ export type ChooseVideoOptions = {
* "uniVer": "√",
* "unixVer": "x"
* },
- * "harmony": {
- * "osVer": "x",
- * "uniVer": "x",
- * "unixVer": "x"
- * }
+ * "ios": {
+ * "osVer": "10.0",
+ * "uniVer": "√",
+ * "unixVer": "x"
+ * },
+ * "harmony": {
+ * "osVer": "x",
+ * "uniVer": "x",
+ * "unixVer": "x"
+ * }
* }
* }
*/
@@ -682,16 +967,26 @@ export type GetVideoInfoSuccess = {
* 画面方向
* @uniPlatform {
* "app": {
+ * "android": {
+ * "osVer": "5.0",
+ * "uniVer": "√",
+ * "unixVer": "3.9"
+ * },
+ * "ios": {
+ * "osVer": "10.0",
+ * "uniVer": "√",
+ * "unixVer": "4.11"
+ * },
* "harmony": {
* "osVer": "3.0",
* "uniVer": "4.23",
* "unixVer": "x"
* }
* },
- * "web": {
- * "uniVer": "x",
- * "unixVer": "x"
- * }
+ * "web": {
+ * "uniVer": "x",
+ * "unixVer": "x"
+ * }
* }
*/
orientation ?: MediaOrientation,
@@ -699,16 +994,26 @@ export type GetVideoInfoSuccess = {
* 视频格式
* @uniPlatform {
* "app": {
+ * "android": {
+ * "osVer": "5.0",
+ * "uniVer": "√",
+ * "unixVer": "3.9"
+ * },
+ * "ios": {
+ * "osVer": "10.0",
+ * "uniVer": "√",
+ * "unixVer": "4.11"
+ * },
* "harmony": {
* "osVer": "3.0",
* "uniVer": "4.23",
* "unixVer": "x"
* }
* },
- * "web": {
- * "uniVer": "x",
- * "unixVer": "x"
- * }
+ * "web": {
+ * "uniVer": "x",
+ * "unixVer": "x"
+ * }
* }
*/
type : string | null,
@@ -732,16 +1037,26 @@ export type GetVideoInfoSuccess = {
* 视频帧率
* @uniPlatform {
* "app": {
+ * "android": {
+ * "osVer": "5.0",
+ * "uniVer": "√",
+ * "unixVer": "3.9"
+ * },
+ * "ios": {
+ * "osVer": "10.0",
+ * "uniVer": "√",
+ * "unixVer": "4.11"
+ * },
* "harmony": {
* "osVer": "x",
* "uniVer": "x",
* "unixVer": "x"
* }
* },
- * "web": {
- * "uniVer": "x",
- * "unixVer": "x"
- * }
+ * "web": {
+ * "uniVer": "x",
+ * "unixVer": "x"
+ * }
* }
*/
fps : number | null,
@@ -749,16 +1064,26 @@ export type GetVideoInfoSuccess = {
* 视频码率,单位 kbps
* @uniPlatform {
* "app": {
+ * "android": {
+ * "osVer": "5.0",
+ * "uniVer": "√",
+ * "unixVer": "3.9"
+ * },
+ * "ios": {
+ * "osVer": "10.0",
+ * "uniVer": "√",
+ * "unixVer": "4.11"
+ * },
* "harmony": {
* "osVer": "x",
* "uniVer": "x",
* "unixVer": "x"
* }
* },
- * "web": {
- * "uniVer": "x",
- * "unixVer": "x"
- * }
+ * "web": {
+ * "uniVer": "x",
+ * "unixVer": "x"
+ * }
* }
*/
bitrate : number | null
@@ -891,61 +1216,61 @@ export type CompressVideoOptions = {
export type CompressVideo = (options : CompressVideoOptions) => void;
-export type ChooseFile = (options: ChooseFileOptions) => void;
+export type ChooseFile = (options : ChooseFileOptions) => void;
export type ChooseFileSuccess = {
- /**
- * 文件的本地文件路径列表
- * @type string | string []
- */
- tempFilePaths: string[],
- /**
- * 文件的本地文件列表,每一项是一个 File 对象
- * @type ChooseFileSuccessCallbackResultFile | ChooseFileSuccessCallbackResultFile [] | File | File []
- */
- tempFiles: any
+ /**
+ * 文件的本地文件路径列表
+ * @type string | string []
+ */
+ tempFilePaths : string[],
+ /**
+ * 文件的本地文件列表,每一项是一个 File 对象
+ * @type ChooseFileSuccessCallbackResultFile | ChooseFileSuccessCallbackResultFile [] | File | File []
+ */
+ tempFiles : any
};
-export type ChooseFileSuccessCallback = (result: ChooseFileSuccess) => void;
+export type ChooseFileSuccessCallback = (result : ChooseFileSuccess) => void;
export type ChooseFileFail = IMediaError;
-export type ChooseFileFailCallback = (result: ChooseFileFail) => void;
+export type ChooseFileFailCallback = (result : ChooseFileFail) => void;
export type ChooseFileComplete = any;
-export type ChooseFileCompleteCallback = (result: ChooseFileComplete) => void;
+export type ChooseFileCompleteCallback = (result : ChooseFileComplete) => void;
export type ChooseFileOptions = {
- /**
- * 最多可以选择的文件数,默认100
- */
- count?: number | null,
- /**
- * 选择文件的类型,默认all,可选image、video
- * - image: 选择图片文件
- * - video: 选择视频文件
- * - all: 默认值,选择本地文件,包含图片和视频
- */
- type?: 'image' | 'video' | 'all' | null,
- /**
- * 选择文件的后缀名,暂只支持.zip、.png等,不支持application/msword等值
- */
- extension?: (string[]) | null,
- /**
- * original 原图,compressed 压缩图,默认二者都有
- * @type string | string []
- */
- sizeType?: any | null,
- /**
- * album 从相册选图,camera 使用相机,默认二者都有
- */
- sourceType?: (string[]) | null,
- /**
- * 成功则返回图片的本地文件路径列表 tempFilePaths、tempFiles
- */
- success?: ChooseFileSuccessCallback | null,
- /**
- * 接口调用失败的回调函数
- */
- fail?: ChooseFileFailCallback | null,
- /**
- * 接口调用结束的回调函数(调用成功、失败都会执行)
- */
- complete?: ChooseFileCompleteCallback | null
+ /**
+ * 最多可以选择的文件数,默认100
+ */
+ count ?: number | null,
+ /**
+ * 选择文件的类型,默认all,可选image、video
+ * - image: 选择图片文件
+ * - video: 选择视频文件
+ * - all: 默认值,选择本地文件,包含图片和视频
+ */
+ type ?: 'image' | 'video' | 'all' | null,
+ /**
+ * 选择文件的后缀名,暂只支持.zip、.png等,不支持application/msword等值
+ */
+ extension ?: (string[]) | null,
+ /**
+ * original 原图,compressed 压缩图,默认二者都有
+ * @type string | string []
+ */
+ sizeType ?: any | null,
+ /**
+ * album 从相册选图,camera 使用相机,默认二者都有
+ */
+ sourceType ?: (string[]) | null,
+ /**
+ * 成功则返回图片的本地文件路径列表 tempFilePaths、tempFiles
+ */
+ success ?: ChooseFileSuccessCallback | null,
+ /**
+ * 接口调用失败的回调函数
+ */
+ fail ?: ChooseFileFailCallback | null,
+ /**
+ * 接口调用结束的回调函数(调用成功、失败都会执行)
+ */
+ complete ?: ChooseFileCompleteCallback | null
};
@@ -958,7 +1283,7 @@ export type ChooseMediaTempFile = {
/**
* 文件类型
*/
- fileType: ChooseMediaFileType
+ fileType : ChooseMediaFileType
/**
* 选定视频的数据量大小
*/
@@ -978,11 +1303,11 @@ export type ChooseMediaTempFile = {
/**
* 视频缩略图临时文件路径
*/
- thumbTempFilePath?: string | null
+ thumbTempFilePath ?: string | null
}
export type ChooseMediaSuccess = {
- tempFiles: ChooseMediaTempFile[],
- type: 'image' | 'video' | 'mix'
+ tempFiles : ChooseMediaTempFile[],
+ type : 'image' | 'video' | 'mix'
};
export type ChooseMediaFail = IMediaError;
@@ -995,7 +1320,7 @@ export type ChooseMediaOptions = {
* 最多可以选择的文件个数
* @defaultValue 9
*/
- count?: number | null
+ count ?: number | null
/**
* album 从相册选视频,camera 使用相机拍摄,合法值:'image'、'video'、'mix'
* @defaultValue ['image', 'video']
@@ -1011,6 +1336,16 @@ export type ChooseMediaOptions = {
* @defaultValue ['original','compressed']
* @uniPlatform {
* "app":{
+ * "android": {
+ * "osVer": "5.0",
+ * "uniVer": "√",
+ * "unixVer": "3.9"
+ * },
+ * "ios": {
+ * "osVer": "10.0",
+ * "uniVer": "√",
+ * "unixVer": "4.11"
+ * },
* "harmony": {
* "osVer": "3.0",
* "uniVer": "4.23",
@@ -1029,6 +1364,16 @@ export type ChooseMediaOptions = {
* @defaultValue 10
* @uniPlatform {
* "app": {
+ * "android": {
+ * "osVer": "5.0",
+ * "uniVer": "√",
+ * "unixVer": "3.9"
+ * },
+ * "ios": {
+ * "osVer": "10.0",
+ * "uniVer": "√",
+ * "unixVer": "4.11"
+ * },
* "harmony": {
* "osVer": "3.0",
* "uniVer": "4.31",
@@ -1047,16 +1392,26 @@ export type ChooseMediaOptions = {
*
* @uniPlatform {
* "app": {
+ * "android": {
+ * "osVer": "5.0",
+ * "uniVer": "√",
+ * "unixVer": "3.9"
+ * },
+ * "ios": {
+ * "osVer": "10.0",
+ * "uniVer": "√",
+ * "unixVer": "4.11"
+ * },
* "harmony": {
* "osVer": "3.0",
* "uniVer": "4.25",
* "unixVer": "x"
* }
* },
- * "web": {
- * "uniVer": "x",
- * "unixVer": "x"
- * }
+ * "web": {
+ * "uniVer": "x",
+ * "unixVer": "x"
+ * }
* }
*/
camera ?:
@@ -1100,16 +1455,16 @@ export interface Uni {
* "uniVer": "√",
* "unixVer": "4.11"
* },
- * "harmony": {
- * "osVer": "3.0",
- * "uniVer": "4.23",
- * "unixVer": "x"
- * }
+ * "harmony": {
+ * "osVer": "3.0",
+ * "uniVer": "4.23",
+ * "unixVer": "x"
+ * }
* },
- * "web": {
- * "uniVer": "√",
- * "unixVer": "4.0"
- * },
+ * "web": {
+ * "uniVer": "√",
+ * "unixVer": "4.0"
+ * },
* "mp": {
* "weixin": {
* "hostVer": "√",
@@ -1186,16 +1541,16 @@ export interface Uni {
* "uniVer": "√",
* "unixVer": "4.11"
* },
- * "harmony": {
- * "osVer": "3.0",
- * "uniVer": "4.23",
- * "unixVer": "x"
- * }
+ * "harmony": {
+ * "osVer": "3.0",
+ * "uniVer": "4.23",
+ * "unixVer": "x"
+ * }
* },
- * "web": {
- * "uniVer": "√",
- * "unixVer": "4.0"
- * },
+ * "web": {
+ * "uniVer": "√",
+ * "unixVer": "4.0"
+ * },
* "mp": {
* "weixin": {
* "hostVer": "√",
@@ -1272,16 +1627,16 @@ export interface Uni {
* "uniVer": "√",
* "unixVer": "4.11"
* },
- * "harmony": {
- * "osVer": "3.0",
- * "uniVer": "4.23",
- * "unixVer": "x"
- * }
+ * "harmony": {
+ * "osVer": "3.0",
+ * "uniVer": "4.23",
+ * "unixVer": "x"
+ * }
* },
- * "web": {
- * "uniVer": "√",
- * "unixVer": "4.0"
- * }
+ * "web": {
+ * "uniVer": "√",
+ * "unixVer": "4.0"
+ * }
* }
* @uniVueVersion 2,3
* @example
@@ -1315,16 +1670,16 @@ export interface Uni {
* "uniVer": "√",
* "unixVer": "4.25"
* },
- * "harmony": {
- * "osVer": "3.0",
- * "uniVer": "4.23",
- * "unixVer": "x"
- * }
+ * "harmony": {
+ * "osVer": "3.0",
+ * "uniVer": "4.23",
+ * "unixVer": "x"
+ * }
* },
- * "web": {
- * "uniVer": "√",
- * "unixVer": "4.0"
- * }
+ * "web": {
+ * "uniVer": "√",
+ * "unixVer": "4.0"
+ * }
* }
* @uniVueVersion 2,3
* @example
@@ -1364,16 +1719,16 @@ export interface Uni {
* "uniVer": "√",
* "unixVer": "4.11"
* },
- * "harmony": {
- * "osVer": "3.0",
- * "uniVer": "4.23",
- * "unixVer": "x"
- * }
+ * "harmony": {
+ * "osVer": "3.0",
+ * "uniVer": "4.23",
+ * "unixVer": "x"
+ * }
* },
- * "web": {
- * "uniVer": "x",
- * "unixVer": "x"
- * }
+ * "web": {
+ * "uniVer": "x",
+ * "unixVer": "x"
+ * }
* }
* @uniVueVersion 2,3
* @example
@@ -1413,16 +1768,16 @@ export interface Uni {
* "uniVer": "√",
* "unixVer": "4.25"
* },
- * "harmony": {
- * "osVer": "3.0",
- * "uniVer": "4.31",
- * "unixVer": "x"
- * }
+ * "harmony": {
+ * "osVer": "3.0",
+ * "uniVer": "4.31",
+ * "unixVer": "x"
+ * }
* },
- * "web": {
- * "uniVer": "x",
- * "unixVer": "x"
- * }
+ * "web": {
+ * "uniVer": "x",
+ * "unixVer": "x"
+ * }
* }
* @uniVueVersion 2,3
* @example
@@ -1463,16 +1818,16 @@ export interface Uni {
* "uniVer": "√",
* "unixVer": "4.18"
* },
- * "harmony": {
- * "osVer": "3.0",
- * "uniVer": "4.23",
- * "unixVer": "x"
- * }
+ * "harmony": {
+ * "osVer": "3.0",
+ * "uniVer": "4.23",
+ * "unixVer": "x"
+ * }
* },
- * "web": {
- * "uniVer": "√",
- * "unixVer": "4.0"
- * }
+ * "web": {
+ * "uniVer": "√",
+ * "unixVer": "4.0"
+ * }
* }
* @uniVueVersion 2,3
* @example
@@ -1504,16 +1859,16 @@ export interface Uni {
* "uniVer": "√",
* "unixVer": "4.25"
* },
- * "harmony": {
- * "osVer": "3.0",
- * "uniVer": "4.23",
- * "unixVer": "x"
- * }
+ * "harmony": {
+ * "osVer": "3.0",
+ * "uniVer": "4.23",
+ * "unixVer": "x"
+ * }
* },
- * "web": {
- * "uniVer": "√",
- * "unixVer": "4.0"
- * }
+ * "web": {
+ * "uniVer": "√",
+ * "unixVer": "4.0"
+ * }
* }
* @uniVueVersion 2,3
* @example
@@ -1546,16 +1901,16 @@ export interface Uni {
* "uniVer": "√",
* "unixVer": "4.18"
* },
- * "harmony": {
- * "osVer": "3.0",
- * "uniVer": "4.23",
- * "unixVer": "x"
- * }
+ * "harmony": {
+ * "osVer": "3.0",
+ * "uniVer": "4.23",
+ * "unixVer": "x"
+ * }
* },
- * "web": {
- * "uniVer": "x",
- * "unixVer": "x"
- * }
+ * "web": {
+ * "uniVer": "x",
+ * "unixVer": "x"
+ * }
* }
* @uniVueVersion 2,3
* @example
@@ -1594,10 +1949,10 @@ export interface Uni {
* "unixVer": "x"
* }
* },
- * "web": {
- * "uniVer": "x",
- * "unixVer": "x"
- * }
+ * "web": {
+ * "uniVer": "x",
+ * "unixVer": "x"
+ * }
* }
* @uniVueVersion 2,3
* @example
@@ -1645,7 +2000,7 @@ export interface Uni {
* }
* }
*/
- chooseFile: ChooseFile;
+ chooseFile : ChooseFile;
/**
* 拍摄或从手机相册中选择图片或视频。
*
@@ -1675,6 +2030,6 @@ export interface Uni {
* }
* }
*/
- chooseMedia: ChooseMedia;
+ chooseMedia : ChooseMedia;
-}
+}
\ No newline at end of file
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
index 32feedea4470ef6b3c9b5406f759d83285a56703..b06be32de467ae01153b0fd485295c3fd66aeb4a 100644
--- a/uni_modules/uni-network/utssdk/app-android/network/download/DownloadController.uts
+++ b/uni_modules/uni-network/utssdk/app-android/network/download/DownloadController.uts
@@ -336,8 +336,8 @@ class SimpleDownloadCallback implements Callback {
const segment = segments[i];
if (segment != null) {
if (segment.contains("filename")) {
- const pair = this.stringSplit(segment.trim(), "=") //目前认为只存在一个键值对
- if (pair != null) {
+ const pair = this.stringSplit(segment.trim(), "=") //目前认为只存在一个键值对
+ if (pair != null && pair.size > 1) {
let key = pair[0];
let value = pair[1];
const reg = new RegExp("^\"|\"$","g")
@@ -361,19 +361,18 @@ class SimpleDownloadCallback implements Callback {
}
if (TextUtils.isEmpty(fileName)) {
- let path = response.request().url().encodedPath()
+ let path = response.request().url().encodedPath()
let pos = path.lastIndexOf('/')
if (pos >= 0) {
- path = path.substring(pos + 1)
- if (path.indexOf('.') >= 0) { //存在后缀,则认为成功
+ path = path.substring(pos + 1)
+ if (path.indexOf('.') >= 0 || path.length > 0) { //存在类型后缀或者没有文件格式后缀的情况,取最后LastPathComponent的名称当做文件名。
if (path.contains("?")) {
path = path.substring(0, path.indexOf("?"))
}
fileName = path
}
}
- }
-
+ }
if (TextUtils.isEmpty(fileName)) {
fileName = System.currentTimeMillis().toString()
@@ -394,23 +393,31 @@ class SimpleDownloadCallback implements Callback {
fileName = subFileName + System.currentTimeMillis()
}
- targetPath += fileName
-
- if (new File(targetPath).exists()) {
- const index = targetPath.lastIndexOf(".");
- let tFileName = targetPath;
+
+ if (new File(targetPath + fileName).exists()) {
+ const index = fileName.lastIndexOf(".");
+ let tFileName = fileName;
let tFileType = "";
if (index >= 0) {
- tFileName = targetPath.substring(0, index)
- tFileType = targetPath.substring(index)
- }
-
+ tFileName = fileName.substring(0, index)
+ tFileType = fileName.substring(index)
+
+ //fileName是 .xxx的情况
+ if(tFileName == ""){
+ tFileName = tFileType
+ tFileType = ""
+ }
+ } else {
+ tFileName = fileName
+ }
var number = 1
- while (new File(targetPath).exists()) {
- targetPath = tFileName + "(" + number + ")" + tFileType;
+ while (new File(targetPath + fileName).exists()) {
+ fileName = tFileName + "(" + number + ")" + tFileType;
number++
}
- }
+ }
+
+ targetPath += fileName
const file = new File(targetPath)
const parentFile = file.getParentFile()
@@ -420,9 +427,9 @@ class SimpleDownloadCallback implements Callback {
}
}
if (!file.exists()) {
- try {
+ try {
file.createNewFile()
- } catch (exception : Exception) {
+ } catch (exception : Exception) {
let option: UTSJSONObject = {};
option['statusCode'] = '-1';
option['errorCode'] = '602001';
diff --git a/uni_modules/uni-network/utssdk/app-harmony/network/cookie.uts b/uni_modules/uni-network/utssdk/app-harmony/network/cookie.uts
index 04c0d0f4d639f716ec8b8f1ad6a243696532aad2..67e3b8d279776bf12881472e64b946ded869df63 100644
--- a/uni_modules/uni-network/utssdk/app-harmony/network/cookie.uts
+++ b/uni_modules/uni-network/utssdk/app-harmony/network/cookie.uts
@@ -1,15 +1,20 @@
import webview from '@ohos.web.webview';
+// 鸿蒙非secure cookie无法保存
+function replaceHttpWithHttps(url: string): string {
+ return url.replace(/^http:/, 'https:');
+}
+
export function getCookie(url: string): Promise {
- return webview.WebCookieManager.fetchCookie(url);
+ return webview.WebCookieManager.fetchCookie(replaceHttpWithHttps(url));
}
export function getCookieSync(url: string): string {
- return webview.WebCookieManager.fetchCookieSync(url);
+ return webview.WebCookieManager.fetchCookieSync(replaceHttpWithHttps(url));
}
export function setCookie(url: string, cookies: string[]): Promise {
- return Promise.all(cookies.map(cookie => webview.WebCookieManager.configCookie(url, cookie))).then(() => {
+ return Promise.all(cookies.map(cookie => webview.WebCookieManager.configCookie(replaceHttpWithHttps(url), cookie))).then(() => {
return webview.WebCookieManager.saveCookieAsync();
});
}
@@ -37,7 +42,10 @@ export function setCookieSync(url: string, cookies: string[]): void {
if (!hasSameSite) {
savedCookie += '; samesite=none';
}
- webview.WebCookieManager.configCookieSync(url, savedCookie);
+ try {
+ // https://baidu.com/ 会返回一条 Set-Cookie: __bsi=; max-age=3600; domain=m.baidu.com; path=/(无重定向) m.baidu.com与baidu.com不一致configCookieSync会抛出错误导致崩溃
+ webview.WebCookieManager.configCookieSync(replaceHttpWithHttps(url), savedCookie);
+ } catch (error) { }
});
webview.WebCookieManager.saveCookieAsync();
}
diff --git a/uni_modules/uni-network/utssdk/app-harmony/network/downloadFile.uts b/uni_modules/uni-network/utssdk/app-harmony/network/downloadFile.uts
index d5e164919893b4adb62839014e6c2d4660541798..5dd637cd74d8d5b609b37f149d830322cae3fe6a 100644
--- a/uni_modules/uni-network/utssdk/app-harmony/network/downloadFile.uts
+++ b/uni_modules/uni-network/utssdk/app-harmony/network/downloadFile.uts
@@ -24,7 +24,6 @@ import {
import {
getClientCertificate,
parseUrl,
- IUniNetworkMP
} from './utils.uts'
import {
getCookieSync,
@@ -121,7 +120,7 @@ export const downloadFile = defineTaskApi {
const realHeaders = headers as Record
responseContentType =
@@ -167,7 +166,11 @@ export const downloadFile = defineTaskApi, UniRequestSucces
}
const httpRequest = http.createHttp()
- const mp = getCurrentMP() as IUniNetworkMP
+ const mp = getCurrentMP()
const userAgent = mp.userAgent.fullUserAgent
if (userAgent && headers && !headers!['User-Agent'] && !headers!['user-agent']) {
headers!['User-Agent'] = userAgent
@@ -174,13 +173,18 @@ export const request = defineTaskApi, UniRequestSucces
mp.on('beforeClose', destroy)
let latestHeaders: Object | null = null
+ let lastUrl = url
httpRequest.on('headersReceive', (headers: Object) => {
const realHeaders = headers as Record
const setCookieHeader = realHeaders['set-cookie'] || realHeaders['Set-Cookie']
if (setCookieHeader) {
- setCookieSync(url, setCookieHeader as string[])
+ setCookieSync(lastUrl, setCookieHeader as string[])
}
latestHeaders = headers
+ const location = realHeaders['location'] || realHeaders['Location']
+ if (location) {
+ lastUrl = location as string
+ }
// TODO headersReceive存在bug,暂不支持回调给用户。注意重定向时会多次触发,但是只需要给用户回调最后一次
// emitter.emit('headersReceive', headers);
})
diff --git a/uni_modules/uni-network/utssdk/app-harmony/network/uploadFile.uts b/uni_modules/uni-network/utssdk/app-harmony/network/uploadFile.uts
index 421f93b1d33b54a973d8fc3f7ba533d7330c3bee..76bb11918805d70f0420ddd174cd9431be00b702 100644
--- a/uni_modules/uni-network/utssdk/app-harmony/network/uploadFile.uts
+++ b/uni_modules/uni-network/utssdk/app-harmony/network/uploadFile.uts
@@ -23,7 +23,6 @@ import {
import {
getClientCertificate,
parseUrl,
- IUniNetworkMP
} from './utils.uts'
import {
getCookieSync,
@@ -155,7 +154,7 @@ export const uploadFile = defineTaskApi {
const realHeaders = headers as Record
const setCookieHeader = realHeaders['set-cookie'] || realHeaders['Set-Cookie']
if (setCookieHeader) {
- setCookieSync(url, setCookieHeader as string[])
+ setCookieSync(lastUrl, setCookieHeader as string[])
+ }
+ const location = realHeaders['location'] || realHeaders['Location']
+ if (location) {
+ lastUrl = location as string
}
// TODO headersReceive存在bug,暂不支持回调给用户。注意重定向时会多次触发,但是只需要给用户回调最后一次
// emitter.emit('headersReceive', header);
diff --git a/uni_modules/uni-network/utssdk/app-harmony/network/utils.uts b/uni_modules/uni-network/utssdk/app-harmony/network/utils.uts
index a459153fa319a64eadc34665e90423b86342271e..0ae3c0d50745337fd01d6df4cb694fe6334b9e5c 100644
--- a/uni_modules/uni-network/utssdk/app-harmony/network/utils.uts
+++ b/uni_modules/uni-network/utssdk/app-harmony/network/utils.uts
@@ -19,23 +19,17 @@ function needsEncoding(str: string) {
}
export function parseUrl(url: string) {
- const urlObj = harmonyUrl.URL.parseURL(url);
- urlObj.params.forEach((value, key) => {
- if (needsEncoding(value)) {
- urlObj.params.set(key, value);
- }
- })
- return urlObj.toString()
-}
-
-interface IUniNetworkMPUserAgent {
- fullUserAgent: string
-}
-
-export interface IUniNetworkMP {
- on: Function
- off: Function
- userAgent: IUniNetworkMPUserAgent
+ try {
+ const urlObj = harmonyUrl.URL.parseURL(url);
+ urlObj.params.forEach((value, key) => {
+ if (needsEncoding(value)) {
+ urlObj.params.set(key, value);
+ }
+ })
+ return urlObj.toString()
+ } catch (error) {
+ return url
+ }
}
export const certificates: Certificate[] = []
diff --git a/uni_modules/uni-network/utssdk/app-ios/index.uts b/uni_modules/uni-network/utssdk/app-ios/index.uts
index 6f16604a7a7be636ce112651062525f5512bb34b..110b4a1877e4a064b8a2e0aa005b504fc502bb01 100644
--- a/uni_modules/uni-network/utssdk/app-ios/index.uts
+++ b/uni_modules/uni-network/utssdk/app-ios/index.uts
@@ -375,8 +375,11 @@ class DownloadNetworkListener extends NetworkDownloadFileListener {
errCode = 602001;
}
- let failResult = new DownloadFileFailImpl(getErrcode(Number.from(errCode)));
- failResult.cause = new SourceError(cause);
+ let failResult = new DownloadFileFailImpl(getErrcode(Number.from(errCode)));
+ let codeCause = StatusCode.getStatus(new String(code))
+ const sourceError = new SourceError(codeCause == "unknown status" ? cause : codeCause);
+ sourceError.code = Number.from(code);
+ failResult.cause = sourceError;
let fail = kParam?.fail;
let complete = kParam?.complete;
fail?.(failResult);
diff --git a/uni_modules/uni-network/utssdk/app-ios/network/download/DownloadController.uts b/uni_modules/uni-network/utssdk/app-ios/network/download/DownloadController.uts
index 253a355eef982de0251fbda80a3c8bf46b7561bb..c92a351dc1502cefc4c3efe67c0c83a54e25724a 100644
--- a/uni_modules/uni-network/utssdk/app-ios/network/download/DownloadController.uts
+++ b/uni_modules/uni-network/utssdk/app-ios/network/download/DownloadController.uts
@@ -1,6 +1,6 @@
import { DownloadFileOptions, DownloadTask, DownloadFileProgressUpdateCallback, OnProgressDownloadResult } from '../../interface.uts';
import { NetworkDownloadFileListener } from '../NetworkManager.uts';
-import { UUID, Data, URL, URLResourceKey, URLSessionDataTask, URLSessionTask, URLSession, URLSessionConfiguration, OperationQueue, URLSessionDataDelegate, URLSessionDownloadTask, NSError, URLSessionDownloadDelegate, URLRequest, FileManager, NSString, NSTemporaryDirectory, NSHomeDirectory , CharacterSet } from 'Foundation';
+import { UUID, Data, URL, URLResourceKey, URLSessionDataTask, URLSessionTask, URLSession, URLSessionConfiguration, OperationQueue, URLSessionDataDelegate, URLSessionDownloadTask, NSError, URLSessionDownloadDelegate, URLRequest, FileManager, NSString, NSTemporaryDirectory, NSHomeDirectory , CharacterSet , HTTPURLResponse } from 'Foundation';
import { } from 'CommonCrypto';
import { UnsafeBufferPointer, UnsafeRawBufferPointer } from 'Swift';
import { ObjCBool } from "ObjectiveC";
@@ -251,22 +251,28 @@ export class DownloadController implements URLSessionDownloadDelegate {
urlSession(session : URLSession, @argumentLabel("") downloadTask : URLSessionDownloadTask, @argumentLabel("didFinishDownloadingTo") location : URL) {
let listener = this.taskMap.get(downloadTask);
- let suggestedFilename = downloadTask.response?.suggestedFilename
- const fileName = this.getFileName(suggestedFilename ?? "", downloadTask.response?.url)
- let destPath = this.getTargetPath(listener?.options, fileName, listener);
- if (destPath != null) {
- let fileManager = FileManager.default
- try {
- let directoryPath = (destPath as NSString).deletingLastPathComponent
- if (!fileManager.fileExists(atPath = directoryPath)) {
- UTSiOS.try(fileManager.createDirectory(atPath = directoryPath, withIntermediateDirectories = true, attributes = null), "?")
- }
- UTSiOS.try(fileManager.moveItem(atPath = location.path, toPath = destPath!), "?")
- listener?.onFinished(downloadTask.response as HTTPURLResponse, destPath!);
- } catch {
- let error = new NSError(domain = "file move fail", code = 602001);
- listener?.onFail(error);
- }
+ let suggestedFilename = downloadTask.response?.suggestedFilename
+ const statusCode = (downloadTask.response as HTTPURLResponse).statusCode
+ if(statusCode - 200 < 100 && statusCode - 200 >= 0) {
+ const fileName = this.getFileName(suggestedFilename ?? "", downloadTask.response?.url)
+ let destPath = this.getTargetPath(listener?.options, fileName, listener);
+ if (destPath != null) {
+ let fileManager = FileManager.default
+ try {
+ let directoryPath = (destPath as NSString).deletingLastPathComponent
+ if (!fileManager.fileExists(atPath = directoryPath)) {
+ UTSiOS.try(fileManager.createDirectory(atPath = directoryPath, withIntermediateDirectories = true, attributes = null), "?")
+ }
+ UTSiOS.try(fileManager.moveItem(atPath = location.path, toPath = destPath!), "?")
+ listener?.onFinished(downloadTask.response as HTTPURLResponse, destPath!);
+ } catch {
+ let error = new NSError(domain = "file move fail", code = 602001);
+ listener?.onFail(error);
+ }
+ }
+ } else {
+ let error = new NSError(domain = "request fail", code = statusCode);
+ listener?.onFail(error);
}
this.taskMap.delete(downloadTask);
}
diff --git a/uni_modules/uni-pageScrollTo/utssdk/app-harmony/index.uts b/uni_modules/uni-pageScrollTo/utssdk/app-harmony/index.uts
deleted file mode 100644
index 9b9bf65766adeb0b5e46edae615f419468e1f428..0000000000000000000000000000000000000000
--- a/uni_modules/uni-pageScrollTo/utssdk/app-harmony/index.uts
+++ /dev/null
@@ -1,20 +0,0 @@
-import { UniServiceJSBridge, getCurrentPageVm, getPageIdByVm } from '@dcloudio/uni-runtime'
-import { PageScrollTo, PageScrollToOptions, PageScrollToSuccess } from '../interface.uts';
-import { API_PAGE_SCROLL_TO, PageScrollToApiOptions, PageScrollToProtocol } from '../protocol.uts'
-
-export { PageScrollTo, PageScrollToOptions, PageScrollToSuccess }
-
-export const pageScrollTo: PageScrollTo = defineAsyncApi(
- API_PAGE_SCROLL_TO,
- (options: PageScrollToOptions, res: ApiExecutor) => {
- const pageId = getPageIdByVm(getCurrentPageVm()!)! as number
- UniServiceJSBridge.invokeViewMethod(
- API_PAGE_SCROLL_TO,
- options,
- pageId,
- res.resolve
- )
- },
- PageScrollToProtocol,
- PageScrollToApiOptions
-) as PageScrollTo
diff --git a/uni_modules/uni-pageScrollTo/utssdk/protocol.uts b/uni_modules/uni-pageScrollTo/utssdk/protocol.uts
deleted file mode 100644
index a400ad863a566cb02e0bf35cb161734cc836154a..0000000000000000000000000000000000000000
--- a/uni_modules/uni-pageScrollTo/utssdk/protocol.uts
+++ /dev/null
@@ -1,30 +0,0 @@
-import { PageScrollToOptions, PageScrollToSuccess } from './interface.uts';
-
-export const API_PAGE_SCROLL_TO = 'pageScrollTo'
-
-export const PageScrollToProtocol = new Map([
- [
- 'scrollTo',
- {
- type: 'number'
- }
- ],
- [
- 'selector',
- {
- type: 'string'
- }
- ],
- [
- 'duration',
- {
- type: 'number'
- }
- ]
-])
-
-export const PageScrollToApiOptions: ApiOptions = {
- formatArgs: new Map([
- ['duration', 300]
- ])
-}
diff --git a/uni_modules/uni-prompt/utssdk/app-harmony/loading.uts b/uni_modules/uni-prompt/utssdk/app-harmony/loading.uts
index 55847152ca43d585549aa5319fdcf4c987434cbf..067a25fecd7f28fb522bc65eee5783b83c80c740 100644
--- a/uni_modules/uni-prompt/utssdk/app-harmony/loading.uts
+++ b/uni_modules/uni-prompt/utssdk/app-harmony/loading.uts
@@ -24,6 +24,8 @@ interface IShowLoadingOptions {
title: string,
mask: boolean
}
+interface IHideLoadingOptions { }
+interface IHideLoadingSuccess { }
export const showLoading: ShowLoading = defineAsyncApi(
API_SHOW_LOADING,
@@ -40,11 +42,12 @@ export const showLoading: ShowLoading = defineAsyncApi(
+export const hideLoading: HideLoading = defineAsyncApi(
API_HIDE_LOADING,
- function () {
+ function (options: IHideLoadingOptions, exec: ApiExecutor) {
onNativePageReady().then((nativePage: Object) => {
getOSRuntime().hideLoading()
+ exec.resolve({} as IHideLoadingSuccess)
})
},
) as HideLoading
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-prompt.bundle/uni_uts_toast_error.png
similarity index 100%
rename from uni_modules/uni-prompt/utssdk/app-ios/Resources/uni_uts_toast_error.png
rename to uni_modules/uni-prompt/utssdk/app-ios/Resources/uni-prompt.bundle/uni_uts_toast_error.png
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-prompt.bundle/uni_uts_toast_success.png
similarity index 100%
rename from uni_modules/uni-prompt/utssdk/app-ios/Resources/uni_uts_toast_success.png
rename to uni_modules/uni-prompt/utssdk/app-ios/Resources/uni-prompt.bundle/uni_uts_toast_success.png
diff --git a/uni_modules/uni-prompt/utssdk/app-ios/showToast.uts b/uni_modules/uni-prompt/utssdk/app-ios/showToast.uts
index e4e4e227ecf9330f03420fe7e9e721951906541b..b02a4bdc829916e5af735753ca94551412d14b66 100644
--- a/uni_modules/uni-prompt/utssdk/app-ios/showToast.uts
+++ b/uni_modules/uni-prompt/utssdk/app-ios/showToast.uts
@@ -34,9 +34,27 @@ export function toShowToast(options : ShowToastOptions) {
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")
+ } else {
+ let successImage = new UIImage(named = "uni_uts_toast_success.png")
+ let failureImage = new UIImage(named = "uni_uts_toast_error.png")
+ const bundleUrl = Bundle.main.url(forResource = "uni-prompt", withExtension = "bundle")
+ if (bundleUrl != null) {
+ const bundle = Bundle(url = bundleUrl!)
+ if (bundle != null) {
+ const success_img = new UIImage(named = "uni_uts_toast_success.png", in = bundle!, compatibleWith = null)
+ if (success_img != null) {
+ successImage = success_img
+ }
+
+ const failure_img = new UIImage(named = "uni_uts_toast_error.png", in = bundle!, compatibleWith = null)
+ if (failure_img != null) {
+ failureImage = failure_img
+ }
+ }
+ }
+ MCToastConfig.shared.icon.successImage = successImage
+ MCToastConfig.shared.icon.failureImage = failureImage
+
if (options.image != null) {
const imagePath = UTSiOS.getResourcePath(options.image!)
const image = new UIImage(contentsOfFile = imagePath)
diff --git a/uni_modules/uni-route/utssdk/app-android/navigateBack.uts b/uni_modules/uni-route/utssdk/app-android/navigateBack.uts
index 57159deeedfb0c6d2e33d81b155270bddcb9e1b4..84fb43b0363360842f929f93f8b57c4ef66cdc41 100644
--- a/uni_modules/uni-route/utssdk/app-android/navigateBack.uts
+++ b/uni_modules/uni-route/utssdk/app-android/navigateBack.uts
@@ -5,6 +5,7 @@ import {
ON_LAST_PAGE_BACK_PRESS,
ON_SHOW,
Page,
+ REDIRECT_TO,
invokeAfterRouteHooks,
invokeBeforeRouteHooks,
invokeCurrentAppHook,
@@ -76,15 +77,22 @@ export const _navigateBack = (
)
})
}
+ let animationType = options?.animationType ?? DEFAULT_ANIMATION_NAVIGATE_BACK
+ let animationDuration = options?.animationDuration ?? DEFAULT_ANIMATION_DURATION
+ if (currentPage.vm!.openType == REDIRECT_TO) {
+ // 如果是 redirectTo 跳转的,需要指定 back 动画
+ animationType = DEFAULT_ANIMATION_OUT
+ animationDuration = DEFAULT_ANIMATION_DURATION
+ }
currentPage.vm!.$close(
new Map([
[
ANIMATION_TYPE,
- options?.animationType ?? DEFAULT_ANIMATION_NAVIGATE_BACK,
+ animationType,
],
[
ANIMATION_DURATION,
- options?.animationDuration ?? DEFAULT_ANIMATION_DURATION,
+ animationDuration,
],
]),
)
diff --git a/uni_modules/uni-shareWithSystem/package.json b/uni_modules/uni-shareWithSystem/package.json
index b2d597556eaa0f6836f51a517115fc37fc5281fd..64fb7715c2c75aa6df317f7381babdc09d8fb74e 100644
--- a/uni_modules/uni-shareWithSystem/package.json
+++ b/uni_modules/uni-shareWithSystem/package.json
@@ -37,8 +37,8 @@
"name": "shareWithSystem",
"app": {
"js": false,
- "kotlin": false,
- "swift": false,
+ "kotlin": true,
+ "swift": true,
"arkts": true
}
}
diff --git a/uni_modules/uni-shareWithSystem/utssdk/app-android/ShareWithSystemHook.kt b/uni_modules/uni-shareWithSystem/utssdk/app-android/ShareWithSystemHook.kt
new file mode 100644
index 0000000000000000000000000000000000000000..ea695af4ae254167bb9ee418e39a01792e992fc5
--- /dev/null
+++ b/uni_modules/uni-shareWithSystem/utssdk/app-android/ShareWithSystemHook.kt
@@ -0,0 +1,31 @@
+package uts.sdk.modules.uniShareWithSystem;
+
+import android.app.Application
+import io.dcloud.uts.UTSAndroidHookProxy
+import kotlinx.coroutines.Dispatchers
+import kotlinx.coroutines.GlobalScope
+import kotlinx.coroutines.launch
+import java.io.File
+
+
+class ShareWithSystemHook : UTSAndroidHookProxy {
+ override fun onCreate(application: Application) {
+ deleteFilesOnly(File(application.externalCacheDir?.path+ "/share"))
+ }
+
+ private fun deleteFilesOnly(folder: File) {
+ if (folder.exists() && folder.isDirectory()) {
+ GlobalScope.launch(Dispatchers.IO) {
+ val files = folder.listFiles()
+ if (files != null) {
+ for (file in files) {
+ if (file.isFile()) {
+ // 删除文件
+ file.delete()
+ }
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/uni_modules/uni-shareWithSystem/utssdk/app-android/UniShareWithSystem.kt b/uni_modules/uni-shareWithSystem/utssdk/app-android/UniShareWithSystem.kt
new file mode 100644
index 0000000000000000000000000000000000000000..b9221c760107cabcafb81c199a9d59fd5b80c9d1
--- /dev/null
+++ b/uni_modules/uni-shareWithSystem/utssdk/app-android/UniShareWithSystem.kt
@@ -0,0 +1,220 @@
+package uts.sdk.modules.uniShareWithSystem;
+
+import android.content.Context
+import android.content.Intent
+import android.net.Uri
+import android.os.Build
+import android.text.TextUtils
+import io.dcloud.uniapp.util.DHFile
+import io.dcloud.uts.UTSAndroid
+import io.dcloud.uts.UTSArray
+import io.dcloud.uts.utsArrayOf
+import java.io.File
+import java.util.UUID
+
+object UniShareWithSystem {
+ fun sendWithSystem(
+ context: Context,
+ type: String?,
+ summary: String?,
+ href: String?,
+ imageUrl: String?,
+ imagePaths: UTSArray?,
+ videoPaths: UTSArray?,
+ filePaths: UTSArray?,
+ audioPaths: UTSArray?,
+ cbSuccess: () -> Unit?,
+ cbFail: (code: Int, msg: String) -> Unit?,
+ cbComplete: () -> Unit?
+ ) {
+ try {
+ var tempType = "text"
+ if (type != null) {
+ tempType = type
+ }
+ var content = summary
+ if (!TextUtils.isEmpty(href)) {
+ if (content == null) {
+ content = "$href"
+ } else content = "$content $href"
+ }
+ val listImageUrl = utsArrayOf()
+ if (imagePaths != null) {
+ listImageUrl.addAll(imagePaths)
+ }
+ imageUrl?.let {
+ listImageUrl.add(it)
+ }
+ val intent = Intent()
+ var error = true
+
+ when (tempType) {
+ "text" -> {
+ setSysShareIntent(intent, content, null, tempType)
+ error = false
+ }
+
+ "image" -> {
+ var imageList = checkPath(context, tempType, listImageUrl, cbFail, cbComplete)
+ if (imageList != null) {
+ setSysShareIntent(intent, content, imageList, tempType)
+ error = false
+ }
+ }
+
+ "video" -> {
+ val tempMediaPathList = utsArrayOf()
+ if (videoPaths != null) {
+ tempMediaPathList.addAll(videoPaths)
+ }
+ var list = checkPath(context, tempType, tempMediaPathList, cbFail, cbComplete)
+ if (list != null) {
+ setSysShareIntent(intent, content, list, tempType)
+ error = false
+ }
+ }
+
+ "audio" -> {
+ val tempMediaPathList = utsArrayOf()
+ if (audioPaths != null) {
+ tempMediaPathList.addAll(audioPaths)
+ }
+ var list = checkPath(context, tempType, tempMediaPathList, cbFail, cbComplete)
+ if (list != null) {
+ setSysShareIntent(intent, content, list, tempType)
+ error = false
+ }
+ }
+
+ "file" -> {
+ val tempFilePathList = utsArrayOf()
+ if (filePaths != null) {
+ tempFilePathList.addAll(filePaths)
+ }
+ var list = checkPath(context, tempType, tempFilePathList, cbFail, cbComplete)
+ if (list != null) {
+ setSysShareIntent(intent, content, list, tempType)
+ error = false
+ }
+ }
+ }
+ if (!error) {
+ val shareIntent = Intent.createChooser(intent, "")
+ shareIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)
+ context.startActivity(shareIntent)
+ cbComplete.invoke()
+ cbSuccess.invoke()
+ }
+ } catch (e: Exception) {
+ cbFail.invoke(1310602, "" + e.message)
+ }
+ }
+
+ private fun checkPath(
+ context: Context,
+ type: String,
+ pathList: UTSArray,
+ cbFail: (code: Int, msg: String) -> Unit?,
+ cbComplete: () -> Unit?
+ ): ArrayList? {
+ val localArrayList = ArrayList()
+ for (i in 0 until pathList.size) {
+ var path = UTSAndroid.convert2AbsFullPath(pathList[i])
+ if (path.startsWith("/android_asset/")) { //应用私有路径无法正常分享需要将私有路径资源拷贝到外置卡路径
+ var lastIndex = path.lastIndexOf(
+ "."
+ )
+ if (lastIndex==-1){
+ lastIndex = path.length
+ }
+ val destPath =
+ context.externalCacheDir?.path + "/share/" + UUID.randomUUID() + path.substring(
+ lastIndex
+ )
+ var copySuccess = false
+ try {
+ var assetName = path.substring("/android_asset/".length)
+ copySuccess =
+ DHFile.copyAssetsFile(UTSAndroid.getAppContext()!!, assetName, destPath)
+ } catch (e: Exception) {
+ fail(type, pathList[i], cbFail)
+ cbComplete.invoke()
+ return null
+ }
+ if (!copySuccess) {
+ fail(type, pathList[i], cbFail)
+ cbComplete.invoke()
+ return null
+ }
+ path = destPath
+ } else {
+ val srcFile = File(path)
+ if (!srcFile.exists()) {
+ fail(type, pathList[i], cbFail)
+ cbComplete.invoke()
+ return null
+ }
+ }
+ val fileUri: Uri = if (Build.VERSION.SDK_INT >= 24) {
+ UTSAndroid.getFileProviderUri(File(path))!!
+ } else {
+ Uri.fromFile(File(path))
+ }
+ localArrayList.add(fileUri)
+ }
+ return localArrayList
+ }
+
+ private fun fail(type: String, url: String, cbFail: (code: Int, msg: String) -> Unit?) {
+ when (type) {
+ "image" -> {
+ cbFail.invoke(1310603, "Invalid imageUrl:" + url)
+ }
+
+ "video" -> {
+ cbFail.invoke(1310605, "Invalid videoPaths:" + url)
+ }
+
+ "file" -> {
+ cbFail.invoke(1310606, "Invalid filePaths:" + url)
+ }
+
+ "audio" -> {
+ cbFail.invoke(1310607, "Invalid audioPaths:" + url)
+ }
+ }
+
+ }
+
+ /**
+ * 设置系统分享intent携带参数
+ * @param content
+ * @param localArrayList
+ * @return
+ */
+ private fun setSysShareIntent(
+ intent: Intent, content: String?, localArrayList: ArrayList?, type: String
+ ): Intent {
+ if (content != null) {
+ intent.putExtra(Intent.EXTRA_TEXT, content)
+ }
+ if (type == "file") {
+ intent.setType("*/*");
+ } else {
+ intent.setType("$type/*")
+ }
+ if (localArrayList != null && localArrayList.size > 0) {
+ if (localArrayList.size > 1) {
+ intent.setAction(Intent.ACTION_SEND_MULTIPLE)
+ intent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, localArrayList)
+ } else {
+ intent.setAction(Intent.ACTION_SEND)
+ intent.putExtra(Intent.EXTRA_STREAM, localArrayList[0])
+ }
+ } else {
+ intent.setAction(Intent.ACTION_SEND)
+ }
+ return intent
+ }
+
+}
\ No newline at end of file
diff --git a/uni_modules/uni-shareWithSystem/utssdk/app-android/config.json b/uni_modules/uni-shareWithSystem/utssdk/app-android/config.json
new file mode 100644
index 0000000000000000000000000000000000000000..ee28dc30054d4cf6de7b73fdbfcbc0c83b828977
--- /dev/null
+++ b/uni_modules/uni-shareWithSystem/utssdk/app-android/config.json
@@ -0,0 +1,3 @@
+{
+ "hooksClass": "uts.sdk.modules.uniShareWithSystem.ShareWithSystemHook"
+}
\ No newline at end of file
diff --git a/uni_modules/uni-shareWithSystem/utssdk/app-android/index.uts b/uni_modules/uni-shareWithSystem/utssdk/app-android/index.uts
new file mode 100644
index 0000000000000000000000000000000000000000..a690445dec7def5250ca5514a94141e4253a02fc
--- /dev/null
+++ b/uni_modules/uni-shareWithSystem/utssdk/app-android/index.uts
@@ -0,0 +1,50 @@
+import {
+ ShareWithSystem,
+ ShareWithSystemOptions,
+ ShareWithSystemSuccess,
+ ShareWithSystemFail,
+} from "../interface.uts";
+import { ShareWithSystemFailImpl } from '../unierror.uts';
+
+export const shareWithSystem : ShareWithSystem = function (options : ShareWithSystemOptions) {
+
+ ShareManager.options = options
+
+ if (options.href == null
+ && options.imageUrl == null
+ && options.imagePaths == null
+ && options.summary == null
+ && options.videoPaths == null
+ && options.audioPaths == null
+ && options.filePaths == null) {
+ ShareManager.failedAction(1310601, null)
+ return
+ }
+
+ UniShareWithSystem.sendWithSystem(UTSAndroid.getTopPageActivity()!,options.type, options.summary,
+ options.href, options.imageUrl, options.imagePaths,options.videoPaths,options.filePaths,options.audioPaths,
+ function () {
+ options.success?.(new ShareWithSystemSuccess())
+ },
+ function (code:number,err:string) {
+ ShareManager.failedAction(code, err)
+ },
+ function () {
+ options.complete?.(new Any())
+ })
+}
+class ShareManager {
+ static options : ShareWithSystemOptions | null= null
+
+ static failedAction(errCode : number, errMsg ?: string | null) {
+ let err = new ShareWithSystemFailImpl(errCode, errMsg);
+ this.options?.fail?.(err)
+ this.options?.complete?.(err)
+ }
+
+ static successAction() {
+ let success = new ShareWithSystemSuccess()
+ this.options?.success?.(success)
+ this.options?.complete?.(success)
+ }
+}
diff --git a/uni_modules/uni-shareWithSystem/utssdk/app-ios/index.uts b/uni_modules/uni-shareWithSystem/utssdk/app-ios/index.uts
new file mode 100644
index 0000000000000000000000000000000000000000..061945c9eacba873bb933a9b2273ed275c8840b4
--- /dev/null
+++ b/uni_modules/uni-shareWithSystem/utssdk/app-ios/index.uts
@@ -0,0 +1,310 @@
+import { UTSiOS } from "DCloudUniappRuntime";
+import { UIActivityViewController, UIActivity, UIImage } from "UIKit";
+import { URL, Data, FileManager, URLResourceKey } from "Foundation";
+import { UTType } from "UniformTypeIdentifiers";
+
+import { DispatchGroup, DispatchQueue } from "Dispatch"
+import {
+ ShareWithSystem,
+ ShareWithSystemOptions,
+ ShareWithSystemSuccess
+} from "../interface.uts";
+import { ShareWithSystemFailImpl } from '../unierror.uts';
+
+export const shareWithSystem : ShareWithSystem = function (options : ShareWithSystemOptions) {
+
+ ShareManager.options = options
+
+ if (options.href == null
+ && options.imageUrl == null
+ && options.imagePaths == null
+ && options.summary == null
+ && options.videoPaths == null
+ && options.audioPaths == null
+ && options.filePaths == null) {
+
+ ShareManager.failedAction(1310601, null)
+ return
+ }
+
+ let items : Array = []
+
+ if (options.summary != null) {
+ items.push(options.summary!)
+ }
+
+ const dispatchGroup = DispatchGroup()
+
+ if (options.imageUrl != null) {
+ dispatchGroup.enter()
+ UTSiOS.loadImage(options.imageUrl!, (image ?: UIImage, data ?: Data) : void => {
+ if (image != null && ShareManager.getValidPath(options.imageUrl!) != null) {
+ items.push(ShareManager.getValidPath(options.imageUrl!)!)
+ dispatchGroup.leave()
+ } else {
+ const errMsg = "Invalid imageUrl: " + options.imageUrl!
+ ShareManager.failedAction(1310603, errMsg)
+ }
+
+ })
+ }
+
+ if (options.imagePaths != null && options.imagePaths!.count > 0) {
+ let temp = "Invalid imagePaths: "
+ let list : string[] = Array()
+ let index = 0
+ options.imagePaths!.forEach((value, key) => {
+ dispatchGroup.enter()
+ UTSiOS.loadImage(value, (image : UIImage | null, data : Data | null) : void => {
+ index += 1
+ if (image != null && ShareManager.getValidPath(value) != null) {
+ items.push(ShareManager.getValidPath(value)!)
+ } else {
+ list.add(value)
+ ShareManager.tempBreak = true
+ }
+ if (index == options.imagePaths!.count && ShareManager.tempBreak) {
+ temp = temp + list.toString()
+ ShareManager.failedAction(1310603, temp)
+ }
+ dispatchGroup.leave()
+ })
+ })
+ }
+
+ if (options.href != null) {
+ if (ShareManager.isValidHref(options.href!)) {
+ const url = URL(string = options.href!)
+ items.push(url!)
+ } else {
+ const errMsg = "Invalid href: " + options.href!
+ ShareManager.failedAction(1310604, errMsg)
+ return
+ }
+ }
+
+ if (options.videoPaths != null && options.videoPaths!.count > 0) {
+ let temp = "Invalid videoPaths: "
+ let list : string[] = Array()
+ let tempBreak = false
+
+ options.videoPaths!.forEach((value, key) => {
+ if (ShareManager.isValidVideoFile(value) && ShareManager.getValidPath(value) != null) {
+ items.push(ShareManager.getValidPath(value)!)
+ } else {
+ list.add(value)
+ tempBreak = true
+ }
+ })
+ if (tempBreak) {
+ temp = temp + list.toString()
+ ShareManager.failedAction(1310605, temp)
+ return
+ }
+ }
+
+ if (options.audioPaths != null && options.audioPaths!.count > 0) {
+ let temp = "Invalid audioPaths: "
+ let list : string[] = Array()
+ let tempBreak = false
+
+ options.audioPaths!.forEach((value, key) => {
+ if (ShareManager.isValidAudioFile(value) && ShareManager.getValidPath(value) != null) {
+ items.push(ShareManager.getValidPath(value)!)
+ } else {
+ list.add(value)
+ tempBreak = true
+ }
+ })
+ if (tempBreak) {
+ temp = temp + list.toString()
+ ShareManager.failedAction(1310607, temp)
+ return
+ }
+ }
+
+ if (options.filePaths != null && options.filePaths!.count > 0) {
+ let temp = "Invalid filePaths: "
+ let list : string[] = Array()
+ let tempBreak = false
+ options.filePaths!.forEach((value, key) => {
+ if (ShareManager.isValidPath(value) && ShareManager.getValidPath(value) != null) {
+ items.push(ShareManager.getValidPath(value)!)
+ } else {
+ list.add(value)
+ tempBreak = true
+ }
+ })
+ if (tempBreak) {
+ temp = temp + list.toString()
+ ShareManager.failedAction(1310606, temp)
+ return
+ }
+ }
+
+ dispatchGroup.notify(queue = DispatchQueue.main, execute = () : void => {
+ if (ShareManager.tempBreak) {
+ ShareManager.tempBreak = false
+ return
+ }
+
+ const activityVC = UIActivityViewController(activityItems = items, applicationActivities = null)
+
+ let completionWithItemsHandler : UIActivityViewController.CompletionWithItemsHandler = (activityType ?: UIActivity.ActivityType, completed : boolean, returnedItems ?: any[], activityError ?: NSError) : void => {
+ if (activityError != null) {
+ ShareManager.failedAction(1310602, activityError!.localizedDescription)
+ } else if (completed == true) {
+ ShareManager.successAction()
+ } else {
+ ShareManager.failedAction(1310600, null)
+ }
+ }
+ activityVC.completionWithItemsHandler = completionWithItemsHandler
+
+ const isPad = UIDevice.current.userInterfaceIdiom == UIUserInterfaceIdiom.pad
+ if (isPad) {
+ let popoverController = activityVC.popoverPresentationController
+ if (popoverController != null) {
+ let sourceView = UTSiOS.getCurrentViewController().view
+ if (sourceView != null) {
+ let sourceRect = CGRect(x = sourceView!.bounds.midX, y = sourceView!.bounds.midY, width = 0.0, height = 0.0)
+ popoverController!.sourceView = sourceView
+ popoverController!.sourceRect = sourceRect
+ popoverController!.permittedArrowDirections = UIPopoverArrowDirection.any
+ }
+ }
+ }
+
+ if (UIApplication.shared.keyWindow?.rootViewController != null) {
+ UIApplication.shared.keyWindow?.rootViewController?.present(activityVC, animated = true)
+ } else {
+ UTSiOS.getCurrentViewController().present(activityVC, animated = true)
+ }
+ })
+}
+
+class ShareManager {
+ static options : ShareWithSystemOptions | null
+ static tempBreak = false
+
+ static failedAction(errCode : number, errMsg ?: string | null) {
+ let err = new ShareWithSystemFailImpl(errCode, errMsg);
+ this.options?.fail?.(err)
+ this.options?.complete?.(err)
+ }
+
+ static successAction() {
+ let success = new ShareWithSystemSuccess()
+ this.options?.success?.(success)
+ this.options?.complete?.(success)
+ }
+
+ static isValidHref(href ?: string) : boolean {
+ if (href == null) {
+ return false
+ }
+ const url = URL(string = href!)
+ if (url == null || url?.scheme == null || url?.host == null) {
+ return false
+ }
+
+ if (["http", "https"].contains(url?.scheme?.lowercased())) {
+ return true
+ }
+ return false
+ }
+
+ static isValidPath(path : string) : boolean {
+ let temp = path
+ if (path.startsWith("file://")) {
+ temp = path.substring(7)
+ } else if (path.startsWith("/var/") == false) {
+ temp = UTSiOS.getResourcePath(path);
+ }
+ const url = URL(fileURLWithPath = temp)
+ if (FileManager.default.fileExists(atPath = url.path)) {
+ return true
+ }
+ return false
+ }
+
+ static getValidPath(path : string) : URL | null {
+ let temp = path
+ if (path.startsWith("file://")) {
+ temp = path.substring(7)
+ } else if (path.startsWith("/var/") == false) {
+ temp = UTSiOS.getResourcePath(path);
+ }
+ const url = URL(fileURLWithPath = temp)
+ if (FileManager.default.fileExists(atPath = url.path)) {
+ return url
+ }
+ return null
+ }
+
+ static isValidVideoFile(path : string) : boolean {
+ if (ShareManager.isValidPath(path)) {
+ const url = ShareManager.getValidPath(path)
+ if (url == null) {
+ return false
+ }
+ if (UTSiOS.available("iOS 14.0, *")) {
+ try {
+ const fileType = UTSiOS.try(url?.resourceValues(forKeys = [URLResourceKey.contentTypeKey]).contentType)
+
+ if (fileType != null) {
+ if (fileType!.conforms(to = UTType.movie) || fileType!.conforms(to = UTType.video)) {
+ return true
+ }
+ }
+ } catch (e) {
+ console.error(e)
+ }
+ } else {
+ const fileExtension = url?.pathExtension.lowercased()
+
+ const mediaExtensions : Array = [
+ // Video formats
+ "mp4", "mov", "avi", "mkv", "flv", "webm", "3gp", "3g2", "wmv", "mpg", "mpeg", "m4v", "f4v", "f4p", "f4a", "f4b",
+ "ts", "mts", "m2ts", "vob", "rm", "rmvb", "asf", "swf", "divx", "xvid", "dv", "ogv", "ogm", "mxf", "roq", "nsv"
+ ]
+
+ return mediaExtensions.contains(fileExtension ?? "")
+ }
+ }
+ return false
+ }
+
+ static isValidAudioFile(path : string) : boolean {
+ if (ShareManager.isValidPath(path)) {
+ const url = ShareManager.getValidPath(path)
+ if (url == null) {
+ return false
+ }
+ if (UTSiOS.available("iOS 14.0, *")) {
+ try {
+ const fileType = UTSiOS.try(url?.resourceValues(forKeys = [URLResourceKey.contentTypeKey]).contentType)
+
+ if (fileType != null) {
+ if (fileType!.conforms(to = UTType.movie) || fileType!.conforms(to = UTType.audio)) {
+ return true
+ }
+ }
+ } catch (e) {
+ console.error(e)
+ }
+ } else {
+ const fileExtension = url?.pathExtension.lowercased()
+
+ const mediaExtensions : Array = [
+ // Audio formats
+ "mp3", "aac", "wav", "flac", "alac", "wma", "m4a", "ogg", "opus", "amr", "aiff", "aif", "aifc", "pcm", "au",
+ "ac3", "eac3", "caf", "dts", "mka"
+ ]
+
+ return mediaExtensions.contains(fileExtension ?? "")
+ }
+ }
+ return false
+ }
+}
\ No newline at end of file
diff --git a/uni_modules/uni-shareWithSystem/utssdk/interface.uts b/uni_modules/uni-shareWithSystem/utssdk/interface.uts
index 0ef264df10ef444a93b1411ffc03e75d6a8096ce..c5a45acde16e48e156d52f37195ef5476248e74c 100644
--- a/uni_modules/uni-shareWithSystem/utssdk/interface.uts
+++ b/uni_modules/uni-shareWithSystem/utssdk/interface.uts
@@ -5,12 +5,232 @@ export type ShareWithSystemSuccess = {
}
+
+export type ShareWithSystemFail = IShareWithSystemFail;
+
+export interface IShareWithSystemFail extends IUniError {
+ errCode : ShareWithSystemErrorCode
+};
/**
- * uni.shareWithSystem失败回调参数
+ * 错误码
*/
-export type ShareWithSystemFail = {
-
-}
+export type ShareWithSystemErrorCode =
+/**
+ * 取消分享
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "5.0",
+ * "uniVer": "x",
+ * "unixVer": "4.33"
+ * },
+ * "ios": {
+ * "osVer": "12.0",
+ * "uniVer": "√",
+ * "unixVer": "4.33"
+ * },
+ * "harmony": {
+ * "osVer": "3.0",
+ * "uniVer": "x",
+ * "unixVer": "x"
+ * }
+ * },
+ * "web": {
+ * "uniVer": "x",
+ * "unixVer": "x"
+ * }
+ * }
+ */
+1310600 |
+/**
+ * 分享内容不可以为空
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "5.0",
+ * "uniVer": "√",
+ * "unixVer": "4.33"
+ * },
+ * "ios": {
+ * "osVer": "12.0",
+ * "uniVer": "√",
+ * "unixVer": "4.33"
+ * },
+ * "harmony": {
+ * "osVer": "3.0",
+ * "uniVer": "x",
+ * "unixVer": "x"
+ * }
+ * },
+ * "web": {
+ * "uniVer": "x",
+ * "unixVer": "x"
+ * }
+ * }
+ */
+1310601 |
+/**
+ * 已经成功调用系统分享接口,系统分享出错
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "5.0",
+ * "uniVer": "√",
+ * "unixVer": "4.33"
+ * },
+ * "ios": {
+ * "osVer": "12.0",
+ * "uniVer": "√",
+ * "unixVer": "4.33"
+ * },
+ * "harmony": {
+ * "osVer": "3.0",
+ * "uniVer": "x",
+ * "unixVer": "x"
+ * }
+ * },
+ * "web": {
+ * "uniVer": "x",
+ * "unixVer": "x"
+ * }
+ * }
+ */
+1310602 |
+/**
+ * 图片路径无效
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "5.0",
+ * "uniVer": "√",
+ * "unixVer": "4.33"
+ * },
+ * "ios": {
+ * "osVer": "12.0",
+ * "uniVer": "√",
+ * "unixVer": "4.33"
+ * },
+ * "harmony": {
+ * "osVer": "3.0",
+ * "uniVer": "x",
+ * "unixVer": "x"
+ * }
+ * },
+ * "web": {
+ * "uniVer": "x",
+ * "unixVer": "x"
+ * }
+ * }
+ */
+1310603 |
+/**
+ * 无效的链接
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "5.0",
+ * "uniVer": "√",
+ * "unixVer": "4.33"
+ * },
+ * "ios": {
+ * "osVer": "12.0",
+ * "uniVer": "√",
+ * "unixVer": "4.33"
+ * },
+ * "harmony": {
+ * "osVer": "3.0",
+ * "uniVer": "x",
+ * "unixVer": "x"
+ * }
+ * },
+ * "web": {
+ * "uniVer": "x",
+ * "unixVer": "x"
+ * }
+ * }
+ */
+1310604 |
+/**
+ * video 路径无效
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "5.0",
+ * "uniVer": "√",
+ * "unixVer": "4.33"
+ * },
+ * "ios": {
+ * "osVer": "12.0",
+ * "uniVer": "√",
+ * "unixVer": "4.33"
+ * },
+ * "harmony": {
+ * "osVer": "3.0",
+ * "uniVer": "x",
+ * "unixVer": "x"
+ * }
+ * },
+ * "web": {
+ * "uniVer": "x",
+ * "unixVer": "x"
+ * }
+ * }
+ */
+1310605 |
+/**
+ * file 文件不存在
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "5.0",
+ * "uniVer": "√",
+ * "unixVer": "4.33"
+ * },
+ * "ios": {
+ * "osVer": "12.0",
+ * "uniVer": "√",
+ * "unixVer": "4.33"
+ * },
+ * "harmony": {
+ * "osVer": "3.0",
+ * "uniVer": "x",
+ * "unixVer": "x"
+ * }
+ * },
+ * "web": {
+ * "uniVer": "x",
+ * "unixVer": "x"
+ * }
+ * }
+ */
+1310606 |
+/**
+ * audio 路径无效
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "5.0",
+ * "uniVer": "√",
+ * "unixVer": "4.33"
+ * },
+ * "ios": {
+ * "osVer": "12.0",
+ * "uniVer": "√",
+ * "unixVer": "4.33"
+ * },
+ * "harmony": {
+ * "osVer": "3.0",
+ * "uniVer": "x",
+ * "unixVer": "x"
+ * }
+ * },
+ * "web": {
+ * "uniVer": "x",
+ * "unixVer": "x"
+ * }
+ * }
+ */
+1310607;
/**
* uni.shareWithSystem成功回调函数定义
@@ -29,14 +249,13 @@ export type ShareWithSystemCallback = (res: any) => void
*/
export type ShareWithSystemOptions = {
/**
- * 分享类型,只支持text,image,默认为text。
- * harmonyOS不支持此参数,如果传了多个类型的数据,分享弹框上可以由用户选择分享什么类型。类型优先级:href > imageUrl > summary,优先级最高的类型会成为默认类型。
+ * 分享类型,默认为text。
* @uniPlatform {
* "app": {
* "android": {
* "osVer": "5.0",
* "uniVer": "√",
- * "unixVer": "x"
+ * "unixVer": "4.33"
* },
* "ios": {
* "osVer": "12.0",
@@ -55,29 +274,412 @@ export type ShareWithSystemOptions = {
* }
* }
*/
- type?: 'text' | 'image',
+ type?:
+ /**
+ * text类型
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "5.0",
+ * "uniVer": "√",
+ * "unixVer": "4.33"
+ * },
+ * "ios": {
+ * "osVer": "12.0",
+ * "uniVer": "√",
+ * "unixVer": "x"
+ * },
+ * "harmony": {
+ * "osVer": "3.0",
+ * "uniVer": "x",
+ * "unixVer": "x"
+ * }
+ * },
+ * "web": {
+ * "uniVer": "x",
+ * "unixVer": "x"
+ * }
+ * }
+ */
+ 'text' |
+ /**
+ * image类型
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "5.0",
+ * "uniVer": "√",
+ * "unixVer": "4.33"
+ * },
+ * "ios": {
+ * "osVer": "12.0",
+ * "uniVer": "√",
+ * "unixVer": "x"
+ * },
+ * "harmony": {
+ * "osVer": "3.0",
+ * "uniVer": "x",
+ * "unixVer": "x"
+ * }
+ * },
+ * "web": {
+ * "uniVer": "x",
+ * "unixVer": "x"
+ * }
+ * }
+ */
+ 'image' |
+ /**
+ * video类型
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "5.0",
+ * "uniVer": "√",
+ * "unixVer": "4.33"
+ * },
+ * "ios": {
+ * "osVer": "12.0",
+ * "uniVer": "√",
+ * "unixVer": "x"
+ * },
+ * "harmony": {
+ * "osVer": "3.0",
+ * "uniVer": "x",
+ * "unixVer": "x"
+ * }
+ * },
+ * "web": {
+ * "uniVer": "x",
+ * "unixVer": "x"
+ * }
+ * }
+ */
+ 'video' |
+ /**
+ * audio类型
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "5.0",
+ * "uniVer": "√",
+ * "unixVer": "4.33"
+ * },
+ * "ios": {
+ * "osVer": "12.0",
+ * "uniVer": "√",
+ * "unixVer": "x"
+ * },
+ * "harmony": {
+ * "osVer": "3.0",
+ * "uniVer": "x",
+ * "unixVer": "x"
+ * }
+ * },
+ * "web": {
+ * "uniVer": "x",
+ * "unixVer": "x"
+ * }
+ * }
+ */
+ 'audio' |
+ /**
+ * file类型
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "5.0",
+ * "uniVer": "√",
+ * "unixVer": "4.33"
+ * },
+ * "ios": {
+ * "osVer": "12.0",
+ * "uniVer": "√",
+ * "unixVer": "x"
+ * },
+ * "harmony": {
+ * "osVer": "3.0",
+ * "uniVer": "x",
+ * "unixVer": "x"
+ * }
+ * },
+ * "web": {
+ * "uniVer": "x",
+ * "unixVer": "x"
+ * }
+ * }
+ */
+ 'file',
/**
* 分享的文字内容
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "5.0",
+ * "uniVer": "√",
+ * "unixVer": "4.33"
+ * },
+ * "ios": {
+ * "osVer": "12.0",
+ * "uniVer": "√",
+ * "unixVer": "4.33"
+ * },
+ * "harmony": {
+ * "osVer": "3.0",
+ * "uniVer": "x",
+ * "unixVer": "x"
+ * }
+ * },
+ * "web": {
+ * "uniVer": "x",
+ * "unixVer": "x"
+ * }
+ * }
*/
summary?: string,
/**
* 分享链接
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "5.0",
+ * "uniVer": "√",
+ * "unixVer": "4.33"
+ * },
+ * "ios": {
+ * "osVer": "12.0",
+ * "uniVer": "√",
+ * "unixVer": "4.33"
+ * },
+ * "harmony": {
+ * "osVer": "3.0",
+ * "uniVer": "x",
+ * "unixVer": "x"
+ * }
+ * },
+ * "web": {
+ * "uniVer": "x",
+ * "unixVer": "x"
+ * }
+ * }
*/
href?: string,
/**
- * 分享图片,仅支持本地路径
+ * 分享单个图片,仅支持本地路径
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "5.0",
+ * "uniVer": "√",
+ * "unixVer": "4.33"
+ * },
+ * "ios": {
+ * "osVer": "12.0",
+ * "uniVer": "√",
+ * "unixVer": "4.33"
+ * },
+ * "harmony": {
+ * "osVer": "3.0",
+ * "uniVer": "x",
+ * "unixVer": "x"
+ * }
+ * },
+ * "web": {
+ * "uniVer": "x",
+ * "unixVer": "x"
+ * }
+ * }
*/
imageUrl?: string,
+ /**
+ * 分享图片,仅支持本地路径
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "5.0",
+ * "uniVer": "√",
+ * "unixVer": "4.33"
+ * },
+ * "ios": {
+ * "osVer": "12.0",
+ * "uniVer": "√",
+ * "unixVer": "4.33"
+ * },
+ * "harmony": {
+ * "osVer": "3.0",
+ * "uniVer": "x",
+ * "unixVer": "x"
+ * }
+ * },
+ * "web": {
+ * "uniVer": "x",
+ * "unixVer": "x"
+ * }
+ * }
+ */
+ imagePaths?: Array,
+ /**
+ * 分享video,仅支持本地路径
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "5.0",
+ * "uniVer": "√",
+ * "unixVer": "4.33"
+ * },
+ * "ios": {
+ * "osVer": "12.0",
+ * "uniVer": "√",
+ * "unixVer": "4.33"
+ * },
+ * "harmony": {
+ * "osVer": "3.0",
+ * "uniVer": "x",
+ * "unixVer": "x"
+ * }
+ * },
+ * "web": {
+ * "uniVer": "x",
+ * "unixVer": "x"
+ * }
+ * }
+ */
+
+ videoPaths?: Array,
+ /**
+ * 分享audio,仅支持本地路径
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "5.0",
+ * "uniVer": "√",
+ * "unixVer": "4.33"
+ * },
+ * "ios": {
+ * "osVer": "12.0",
+ * "uniVer": "√",
+ * "unixVer": "4.33"
+ * },
+ * "harmony": {
+ * "osVer": "3.0",
+ * "uniVer": "x",
+ * "unixVer": "x"
+ * }
+ * },
+ * "web": {
+ * "uniVer": "x",
+ * "unixVer": "x"
+ * }
+ * }
+ */
+ audioPaths?: Array,
+ /**
+ * 分享文件,仅支持本地路径
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "5.0",
+ * "uniVer": "√",
+ * "unixVer": "4.33"
+ * },
+ * "ios": {
+ * "osVer": "12.0",
+ * "uniVer": "√",
+ * "unixVer": "4.33"
+ * },
+ * "harmony": {
+ * "osVer": "3.0",
+ * "uniVer": "x",
+ * "unixVer": "x"
+ * }
+ * },
+ * "web": {
+ * "uniVer": "x",
+ * "unixVer": "x"
+ * }
+ * }
+ */
+
+ filePaths?: Array,
/**
* 接口调用成功的回调函数
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "5.0",
+ * "uniVer": "√",
+ * "unixVer": "4.33"
+ * },
+ * "ios": {
+ * "osVer": "12.0",
+ * "uniVer": "√",
+ * "unixVer": "4.33"
+ * },
+ * "harmony": {
+ * "osVer": "3.0",
+ * "uniVer": "x",
+ * "unixVer": "x"
+ * }
+ * },
+ * "web": {
+ * "uniVer": "x",
+ * "unixVer": "x"
+ * }
+ * }
*/
success?: ShareWithSystemSuccessCallback | null,
/**
* 接口调用失败的回调函数
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "5.0",
+ * "uniVer": "√",
+ * "unixVer": "4.33"
+ * },
+ * "ios": {
+ * "osVer": "12.0",
+ * "uniVer": "√",
+ * "unixVer": "4.33"
+ * },
+ * "harmony": {
+ * "osVer": "3.0",
+ * "uniVer": "x",
+ * "unixVer": "x"
+ * }
+ * },
+ * "web": {
+ * "uniVer": "x",
+ * "unixVer": "x"
+ * }
+ * }
*/
fail?: ShareWithSystemFailCallback | null,
/**
* 接口调用结束的回调函数(调用成功、失败都会执行)
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "5.0",
+ * "uniVer": "√",
+ * "unixVer": "4.33"
+ * },
+ * "ios": {
+ * "osVer": "12.0",
+ * "uniVer": "√",
+ * "unixVer": "4.33"
+ * },
+ * "harmony": {
+ * "osVer": "3.0",
+ * "uniVer": "x",
+ * "unixVer": "x"
+ * }
+ * },
+ * "web": {
+ * "uniVer": "x",
+ * "unixVer": "x"
+ * }
+ * }
*/
complete?: ShareWithSystemCallback | null
}
@@ -86,8 +688,7 @@ export type ShareWithSystem = (options: ShareWithSystemOptions) => void
export interface Uni {
/**
- * uni.shareWithSystem函数定义
- * 使用系统分享。harmonyOS
+ * 使用系统分享。
*
* @param {ShareWithSystemOptions} options
* @uniPlatform {
@@ -95,12 +696,12 @@ export interface Uni {
* "android": {
* "osVer": "5.0",
* "uniVer": "√",
- * "unixVer": "x"
+ * "unixVer": "4.33"
* },
* "ios": {
* "osVer": "12.0",
* "uniVer": "√",
- * "unixVer": "x"
+ * "unixVer": "4.33"
* },
* "harmony": {
* "osVer": "3.0",
@@ -113,8 +714,6 @@ export interface Uni {
* "unixVer": "x"
* }
* }
- * @uniVersion 2.0.3
- * @uniVueVersion 2,3 //支持的vue版本
*/
shareWithSystem(options: ShareWithSystemOptions): void,
}
diff --git a/uni_modules/uni-shareWithSystem/utssdk/unierror.uts b/uni_modules/uni-shareWithSystem/utssdk/unierror.uts
new file mode 100644
index 0000000000000000000000000000000000000000..853278b1e31cc5d429dd251305cb2ac7e1b1b867
--- /dev/null
+++ b/uni_modules/uni-shareWithSystem/utssdk/unierror.uts
@@ -0,0 +1,64 @@
+import { ShareWithSystemErrorCode, IShareWithSystemFail } from "./interface.uts"
+
+/**
+ * 错误主题
+ */
+export const ShareWithSystemUniErrorSubject = 'uni-shareWithSystem';
+/**
+ * 错误码
+ * @UniError
+ */
+export const ShareWithSystemUniErrors : Map = new Map([
+ /**
+ * 取消分享。
+ */
+ [1310600, 'Cancel share'],
+ /**
+ * 分享内容不可以为空。
+ */
+ [1310601, 'Shared content can not be empty'],
+ /**
+ * 分享失败的其他错误。
+ */
+ [1310602, 'Failed to share'],
+ /**
+ * 图片路径加载失败。
+ */
+ [1310603, 'Failed to load image paths'],
+ /**
+ * herf 格式无效。
+ */
+ [1310604, 'Invalid herf'],
+ /**
+ * Video 路径无效。
+ */
+ [1310605, 'Invalid video paths'],
+ /**
+ * file 文件不存在。
+ */
+ [1310606, 'Invalid file paths'],
+ /**
+ * Audio 路径无效。
+ */
+ [1310607, 'Invalid audio paths']
+
+]);
+
+export class ShareWithSystemFailImpl extends UniError implements IShareWithSystemFail {
+ constructor(errCode : ShareWithSystemErrorCode, errMsg : string | null) {
+ super();
+ this.errSubject = ShareWithSystemUniErrorSubject;
+ this.errCode = errCode;
+ const error = ShareWithSystemUniErrors.get(errCode) ?? ""
+ if (errMsg != null) {
+ // #ifdef APP-IOS
+ this.errMsg = error + ", the reason: " + errMsg!;
+ // #endif
+ // #ifdef APP-ANDROID
+ this.errMsg = error + ", the reason: " + errMsg;
+ // #endif
+ } else {
+ this.errMsg = error;
+ }
+ }
+}
\ No newline at end of file
diff --git a/uni_modules/uni-storage/utssdk/app-harmony/index.uts b/uni_modules/uni-storage/utssdk/app-harmony/index.uts
index e93e76ddd9ded957841ed979495417ea9442531b..9d3b0ee453de7408b2c8f7e29960242d03edf337 100644
--- a/uni_modules/uni-storage/utssdk/app-harmony/index.uts
+++ b/uni_modules/uni-storage/utssdk/app-harmony/index.uts
@@ -73,21 +73,17 @@ function stringifyStorageValue(value: any): string {
return JSON.stringify({ type: typeof value, data: value } as ESObject);
}
-interface UniStorageMP {
- id: string
-}
-
// TODO 回收Preference
const stores = new Map()
function createStore(): dataPreferences.Preferences {
- const appId = (getCurrentMP() as UniStorageMP).id
- if (stores.has(appId)) {
- return stores.get(appId)!
+ const id = getCurrentMP().id
+ if (stores.has(id)) {
+ return stores.get(id)!
}
const store = dataPreferences.getPreferencesSync(UTSHarmony.getUIAbilityContext() as common.UIAbilityContext, {
- name: `storage.${appId}`
+ name: `storage.${id}`
} as dataPreferences.Options)
- stores.set(appId, store)
+ stores.set(id, store)
return store
}
diff --git a/uni_modules/uni-storage/utssdk/interface.uts b/uni_modules/uni-storage/utssdk/interface.uts
index 7ebd0bf23d72e6535b396407c804c5950acbdcdf..1875be1b572f280596720c710ac75da2d0c62247 100644
--- a/uni_modules/uni-storage/utssdk/interface.uts
+++ b/uni_modules/uni-storage/utssdk/interface.uts
@@ -250,34 +250,29 @@ export interface Uni {
* @tutorial-uni-app https://uniapp.dcloud.net.cn/api/storage/storage.html#setstorage
* @tutorial-uni-app-x https://doc.dcloud.net.cn/uni-app-x/api/storage.html#setstorage
* @tutorial https://doc.dcloud.net.cn/uni-app-x/api/storage.html#setstorage
- * @uniPlatform
- {
- "app": {
- "android": {
- "osVer": "5.0",
- "uniVer": "2.0.3",
- "uniUtsPlugin": "3.91",
- "unixVer": "3.91",
- "unixUtsPlugin": "3.91"
- },
- "ios": {
- "osVer": "12.0",
- "uniVer": "2.0.3",
- "uniUtsPlugin": "4.11",
- "unixVer": "4.11",
- "unixUtsPlugin": "4.11"
- },
- "harmony": {
- "osVer": "3.0",
- "uniVer": "4.23",
- "unixVer": "x"
- }
- },
- "web": {
- "uniVer": "√",
- "unixVer": "4.0"
- }
- }
+ * @uniPlatform {
+ * "app": {
+ * "android": {
+ * "osVer": "5.0",
+ * "uniVer": "2.0.3",
+ * "unixVer": "3.9.0"
+ * },
+ * "ios": {
+ * "osVer": "12.0",
+ * "uniVer": "2.0.3",
+ * "unixVer": "4.11"
+ * },
+ * "harmony": {
+ * "osVer": "3.0",
+ * "uniVer": "4.23",
+ * "unixVer": "x"
+ * }
+ * },
+ * "web": {
+ * "uniVer": "√",
+ * "unixVer": "4.0"
+ * }
+ * }
* @uniVersion 2.0.3
* @uniVueVersion 2,3 //支持的vue版本
*/
@@ -292,33 +287,28 @@ export interface Uni {
* @tutorial-uni-app-x https://doc.dcloud.net.cn/uni-app-x/api/storage.html#setstoragesync
* @tutorial https://doc.dcloud.net.cn/uni-app-x/api/storage.html#setstoragesync
* @uniPlatform {
- {
- "app": {
- "android": {
- "osVer": "5.0",
- "uniVer": "2.0.3",
- "uniUtsPlugin": "3.91",
- "unixVer": "3.91",
- "unixUtsPlugin": "3.91"
- },
- "ios": {
- "osVer": "12.0",
- "uniVer": "2.0.3",
- "uniUtsPlugin": "4.11",
- "unixVer": "4.11",
- "unixUtsPlugin": "4.11"
- },
- "harmony": {
- "osVer": "3.0",
- "uniVer": "4.23",
- "unixVer": "x"
- }
- },
- "web": {
- "uniVer": "√",
- "unixVer": "4.0"
- }
- }
+ * "app": {
+ * "android": {
+ * "osVer": "5.0",
+ * "uniVer": "2.0.3",
+ * "unixVer": "3.9.0"
+ * },
+ * "ios": {
+ * "osVer": "12.0",
+ * "uniVer": "2.0.3",
+ * "unixVer": "4.11"
+ * },
+ * "harmony": {
+ * "osVer": "3.0",
+ * "uniVer": "4.23",
+ * "unixVer": "x"
+ * }
+ * },
+ * "web": {
+ * "uniVer": "√",
+ * "unixVer": "4.0"
+ * }
+ * }
* @uniVersion 2.0.3
* @uniVueVersion 2,3 //支持的vue版本
*/
diff --git a/uni_modules/uni-websocket/utssdk/app-harmony/index.uts b/uni_modules/uni-websocket/utssdk/app-harmony/index.uts
index 643398a7df24562bfc39e68d944c0be4b20b7dee..581c03f7abd38fddeb1baeb7d1d330e459dffa6f 100644
--- a/uni_modules/uni-websocket/utssdk/app-harmony/index.uts
+++ b/uni_modules/uni-websocket/utssdk/app-harmony/index.uts
@@ -39,12 +39,6 @@ export {
OnSocketErrorCallbackResult
}
-interface UniWebsocketMP {
- id: string
- on: Function
- off: Function
-}
-
interface IUniWebsocketEmitter {
on: (eventName: string, callback: Function) => void
once: (eventName: string, callback: Function) => void
@@ -77,7 +71,7 @@ class SocketTask implements UniSocketTask {
private _ws: webSocket.WebSocket;
private _emitter: IUniWebsocketEmitter = new Emitter() as IUniWebsocketEmitter
constructor(ws: webSocket.WebSocket) {
- const mp = getCurrentMP() as UniWebsocketMP
+ const mp = getCurrentMP()
this._ws = ws;
this._ws.on('message', (_, data) => {
const message = {
@@ -170,7 +164,7 @@ class SocketTask implements UniSocketTask {
const socketTasksMap: Map = new Map()
function addSocketTask(task: SocketTask) {
- const mp = getCurrentMP() as UniWebsocketMP
+ const mp = getCurrentMP()
mp.on('beforeClose', task._destroy)
task.onClose(() => {
mp.off('beforeClose', task._destroy)
@@ -185,17 +179,17 @@ function addSocketTask(task: SocketTask) {
function getSocketTasks(id?: string) {
if (!id) {
- const mp = getCurrentMP() as UniWebsocketMP
+ const mp = getCurrentMP()
id = mp.id
}
- return socketTasksMap.get(id) || []
+ return socketTasksMap.get(id!) || []
}
export const connectSocket = defineTaskApi(
API_CONNECT_SOCKET,
function (args: ConnectSocketOptions, exec: ApiExecutor) {
const ws = webSocket.createWebSocket();
- const mp = getCurrentMP() as UniWebsocketMP
+ const mp = getCurrentMP()
ws.connect(args.url, {
header: args.header ? args.header as Object : undefined,
protocol: args.protocols ?
diff --git a/uni_modules/uni-websocket/utssdk/interface.uts b/uni_modules/uni-websocket/utssdk/interface.uts
index 1bfb4f0f400d762c4dc699c07d148643d5f01afd..c4276c2933e9f7f6c03ef195267b6e11ccaf4e7a 100644
--- a/uni_modules/uni-websocket/utssdk/interface.uts
+++ b/uni_modules/uni-websocket/utssdk/interface.uts
@@ -135,8 +135,8 @@ export interface Uni {
* "unixVer": "4.11"
* },
* "harmony": {
- * "osVer": "x",
- * "uniVer": "x",
+ * "osVer": "3,0",
+ * "uniVer": "4.23",
* "unixVer": "x"
* }
* },