From d130a5ed81e85a729858b81291a450458361d579 Mon Sep 17 00:00:00 2001 From: VK <370725567@qq.com> Date: Mon, 16 Dec 2024 17:36:17 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=91=E5=B8=83uts-openSchema=201.1.1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- uni_modules/uts-openSchema/changelog.md | 2 ++ uni_modules/uts-openSchema/package.json | 2 +- uni_modules/uts-openSchema/utssdk/app-android/index.uts | 4 ++-- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/uni_modules/uts-openSchema/changelog.md b/uni_modules/uts-openSchema/changelog.md index b10de426..c77ddbd9 100644 --- a/uni_modules/uts-openSchema/changelog.md +++ b/uni_modules/uts-openSchema/changelog.md @@ -1,3 +1,5 @@ +## 1.1.1(2024-12-16) +- 修复 canOpenURL 在安卓端可能会报类型错误的问题 ## 1.1.0(2024-12-06) - 新增 canOpenURL UTS API,可用此API判断url是否可以跳转 ## 1.0.1(2024-11-13) diff --git a/uni_modules/uts-openSchema/package.json b/uni_modules/uts-openSchema/package.json index c3183f96..c5a09f83 100644 --- a/uni_modules/uts-openSchema/package.json +++ b/uni_modules/uts-openSchema/package.json @@ -1,7 +1,7 @@ { "id": "uts-openSchema", "displayName": "uts-openSchema", - "version": "1.1.0", + "version": "1.1.1", "description": "在 Android 和 iOS 上打开链接的 UTS API", "keywords": [ "uts-openSchema" diff --git a/uni_modules/uts-openSchema/utssdk/app-android/index.uts b/uni_modules/uts-openSchema/utssdk/app-android/index.uts index 145860dd..683d39fc 100644 --- a/uni_modules/uts-openSchema/utssdk/app-android/index.uts +++ b/uni_modules/uts-openSchema/utssdk/app-android/index.uts @@ -15,12 +15,12 @@ export const openSchema : OpenSchema = function (url : string) { } } -export const canOpenURL : CanOpenURL = function (url : string) { +export const canOpenURL : CanOpenURL = function (url : string) : boolean { if (typeof url === 'string' && url.length > 0) { const context = UTSAndroid.getUniActivity()! const uri = Uri.parse(url) const intent = new Intent(Intent.ACTION_VIEW, uri) - return intent.resolveActivity(context.packageManager) != null + return intent.resolveActivity(context.packageManager) != null ? true : false } else { return false } -- GitLab