From 4331efc8950eaca24940f4df43409b22d6e2a149 Mon Sep 17 00:00:00 2001 From: duqingquan Date: Wed, 26 Jun 2024 14:56:25 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=83=A8=E5=88=86=E7=BC=96?= =?UTF-8?q?=E8=AF=91=E8=AD=A6=E5=91=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../uts-advance/utssdk/app-android/index.uts | 21 +++++++++++-------- .../uts-api-test/utssdk/app-android/index.uts | 8 +++---- .../utssdk/app-android/index.uts | 3 ++- uni_modules/uts-tests/utssdk/Array.uts | 2 +- uni_modules/uts-tests/utssdk/Date.uts | 4 ++-- 5 files changed, 21 insertions(+), 17 deletions(-) diff --git a/uni_modules/uts-advance/utssdk/app-android/index.uts b/uni_modules/uts-advance/utssdk/app-android/index.uts index 5379767..4154af8 100644 --- a/uni_modules/uts-advance/utssdk/app-android/index.uts +++ b/uni_modules/uts-advance/utssdk/app-android/index.uts @@ -228,6 +228,7 @@ export function stopAssetAudio() { } +@Suppress("DEPRECATION") export function goOtherActivity(imageDone : (event : string) => void) : boolean { // 检查相关权限是否已经具备 @@ -238,12 +239,14 @@ export function goOtherActivity(imageDone : (event : string) => void) : boolean return false; } + UTSAndroid.onAppActivityResult((requestCode : Int, resultCode : Int, data ?: Intent) => { let eventName = "onAppActivityResult - requestCode:" + requestCode + " -resultCode:" + resultCode + " -data:" + JSON.stringify(data); console.log(eventName); if ((requestCode == 1001) && (resultCode == Activity.RESULT_OK)) { if (data != null) { let bundle = data.getExtras(); + let mImageBitmap = bundle!.get("data") as Bitmap; let bitmapPath = UTSAndroid.getUniActivity()!.getExternalCacheDir()!.getPath() + "/photo.png" console.log(bitmapPath); @@ -465,7 +468,7 @@ export function arrayConvert():boolean{ let kotlinList = mutableListOf("hello","world") let utsArr1 = Array.fromNative(kotlinList) - if(!(utsArr1 instanceof UTSArray)){ + if(utsArr1[0] != "hello"){ return false } @@ -473,37 +476,36 @@ export function arrayConvert():boolean{ let kotlinArray = arrayOf("hello","world") let utsArr2 = Array.fromNative(kotlinArray) - if(!(utsArr2 instanceof UTSArray)){ + if(utsArr2[0] != "hello"){ return false } let b1 = byteArrayOf(-1,2,0,3,4,5) let c1 = Array.fromNative(b1) - if(!(c1 instanceof UTSArray)){ + + if(c1[0] != (-1 as Number).toByte()){ return false } let b2 = longArrayOf(-1,2,0,3,4,5) let c2 = Array.fromNative(b2) - if(!(c2 instanceof UTSArray)){ + if(c2[0] != (-1 as Number).toLong()){ return false } - let b3 = shortArrayOf(-1,2,0,3,4,5) let c3 = Array.fromNative(b3) - if(!(c3 instanceof UTSArray)){ + if(c3[0] != (-1 as Number).toShort()){ return false } let b4 = intArrayOf(-1,2,0,3,4,5) let c4 = Array.fromNative(b4) - if(!(c4 instanceof UTSArray)){ + if(c4[0] != (-1 as Number).toInt()){ return false } - return true } @@ -513,7 +515,8 @@ export function openFileWithProvider(url:String){ const uri = UTSAndroid.getFileProviderUri(file) console.log("uri",uri.toString()) const intent = new Intent(Intent.ACTION_VIEW, uri) - intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION) // 添加权限标志 + // 添加权限标志 + intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION) const context = UTSAndroid.getUniActivity()!; context.startActivity(intent); } diff --git a/uni_modules/uts-api-test/utssdk/app-android/index.uts b/uni_modules/uts-api-test/utssdk/app-android/index.uts index 78c9800..cd6cdfb 100644 --- a/uni_modules/uts-api-test/utssdk/app-android/index.uts +++ b/uni_modules/uts-api-test/utssdk/app-android/index.uts @@ -45,10 +45,10 @@ export function frequentlyObjectTest():boolean{ console.log(typeLogRet) let typeLogObj = JSON.parseObject(typeLogRet)! - // let typeLogObjPos = typeLogObj.getJSON("__$originalPosition")! - // if("ParamOptions" != typeLogObjPos['name']){ - // return false - // } + let typeLogObjPos = typeLogObj.getJSON("__$originalPosition")! + if("ParamOptions" != typeLogObjPos['name']){ + return false + } // /** // * 编译出来的位置信息可能有差异,排除单独验证后,排除掉这个字段 // */ diff --git a/uni_modules/uts-nativepage/utssdk/app-android/index.uts b/uni_modules/uts-nativepage/utssdk/app-android/index.uts index 6523769..1038f61 100644 --- a/uni_modules/uts-nativepage/utssdk/app-android/index.uts +++ b/uni_modules/uts-nativepage/utssdk/app-android/index.uts @@ -75,7 +75,7 @@ export class AppHookProxy implements UTSAndroidHookProxy { } - +@Suppress("DEPRECATION") class ForeService extends Service { constructor (){ @@ -130,6 +130,7 @@ class ForeService extends Service { return super.onStartCommand(intent, flags, startId); } + override onDestroy():void { super.onDestroy(); this.stopForeground(true);// 停止前台服务--参数:表示是否移除之前的通知 diff --git a/uni_modules/uts-tests/utssdk/Array.uts b/uni_modules/uts-tests/utssdk/Array.uts index a12dc0d..3c0fcd1 100644 --- a/uni_modules/uts-tests/utssdk/Array.uts +++ b/uni_modules/uts-tests/utssdk/Array.uts @@ -187,7 +187,7 @@ export function testArray(): Result { // #ifndef APP-IOS const s = JSON.parse(JSON.stringify([{ x: 0, y: 0 }])) as P[] s[0].x += 0; - const clearList = s.map((v : P, _, _a) : number => v.x) + const clearList = s.map((v : P, _, _) : number => v.x) expect(clearList.includes(0)).toEqual(true); // #endif // #ifdef APP-IOS diff --git a/uni_modules/uts-tests/utssdk/Date.uts b/uni_modules/uts-tests/utssdk/Date.uts index 8d74a5b..2a304ba 100644 --- a/uni_modules/uts-tests/utssdk/Date.uts +++ b/uni_modules/uts-tests/utssdk/Date.uts @@ -36,11 +36,11 @@ export function testDate() : Result { const date1 = new Date('01 Jan 1970 00:00:00 GMT'); const date2 = new Date('December 17, 1995 03:24:00'); - // #ifndef APP-IOS + // #ifdef APP-IOS expect(date1.toTimeString()).toEqual("08:00:00 GMT+0800 (中国标准时间)"); expect(date2.toTimeString()).toEqual("03:24:00 GMT+0800 (中国标准时间)"); // #endif - // #ifndef APP-ANDROID + // #ifdef APP-ANDROID expect(date1.toTimeString()).toEqual("08:00:00 GMT+0800"); expect(date2.toTimeString()).toEqual("03:24:00 GMT+0800"); // #endif -- GitLab