提交 4331efc8 编写于 作者: 杜庆泉's avatar 杜庆泉

修复部分编译警告

上级 6a6d410f
...@@ -228,6 +228,7 @@ export function stopAssetAudio() { ...@@ -228,6 +228,7 @@ export function stopAssetAudio() {
} }
@Suppress("DEPRECATION")
export function goOtherActivity(imageDone : (event : string) => void) : boolean { export function goOtherActivity(imageDone : (event : string) => void) : boolean {
// 检查相关权限是否已经具备 // 检查相关权限是否已经具备
...@@ -238,12 +239,14 @@ export function goOtherActivity(imageDone : (event : string) => void) : boolean ...@@ -238,12 +239,14 @@ export function goOtherActivity(imageDone : (event : string) => void) : boolean
return false; return false;
} }
UTSAndroid.onAppActivityResult((requestCode : Int, resultCode : Int, data ?: Intent) => { UTSAndroid.onAppActivityResult((requestCode : Int, resultCode : Int, data ?: Intent) => {
let eventName = "onAppActivityResult - requestCode:" + requestCode + " -resultCode:" + resultCode + " -data:" + JSON.stringify(data); let eventName = "onAppActivityResult - requestCode:" + requestCode + " -resultCode:" + resultCode + " -data:" + JSON.stringify(data);
console.log(eventName); console.log(eventName);
if ((requestCode == 1001) && (resultCode == Activity.RESULT_OK)) { if ((requestCode == 1001) && (resultCode == Activity.RESULT_OK)) {
if (data != null) { if (data != null) {
let bundle = data.getExtras(); let bundle = data.getExtras();
let mImageBitmap = bundle!.get("data") as Bitmap; let mImageBitmap = bundle!.get("data") as Bitmap;
let bitmapPath = UTSAndroid.getUniActivity()!.getExternalCacheDir()!.getPath() + "/photo.png" let bitmapPath = UTSAndroid.getUniActivity()!.getExternalCacheDir()!.getPath() + "/photo.png"
console.log(bitmapPath); console.log(bitmapPath);
...@@ -465,7 +468,7 @@ export function arrayConvert():boolean{ ...@@ -465,7 +468,7 @@ export function arrayConvert():boolean{
let kotlinList = mutableListOf("hello","world") let kotlinList = mutableListOf("hello","world")
let utsArr1 = Array.fromNative(kotlinList) let utsArr1 = Array.fromNative(kotlinList)
if(!(utsArr1 instanceof UTSArray<string>)){ if(utsArr1[0] != "hello"){
return false return false
} }
...@@ -473,37 +476,36 @@ export function arrayConvert():boolean{ ...@@ -473,37 +476,36 @@ export function arrayConvert():boolean{
let kotlinArray = arrayOf("hello","world") let kotlinArray = arrayOf("hello","world")
let utsArr2 = Array.fromNative(kotlinArray) let utsArr2 = Array.fromNative(kotlinArray)
if(!(utsArr2 instanceof UTSArray<string>)){ if(utsArr2[0] != "hello"){
return false return false
} }
let b1 = byteArrayOf(-1,2,0,3,4,5) let b1 = byteArrayOf(-1,2,0,3,4,5)
let c1 = Array.fromNative(b1) let c1 = Array.fromNative(b1)
if(!(c1 instanceof UTSArray<Number>)){
if(c1[0] != (-1 as Number).toByte()){
return false return false
} }
let b2 = longArrayOf(-1,2,0,3,4,5) let b2 = longArrayOf(-1,2,0,3,4,5)
let c2 = Array.fromNative(b2) let c2 = Array.fromNative(b2)
if(!(c2 instanceof UTSArray<Number>)){ if(c2[0] != (-1 as Number).toLong()){
return false return false
} }
let b3 = shortArrayOf(-1,2,0,3,4,5) let b3 = shortArrayOf(-1,2,0,3,4,5)
let c3 = Array.fromNative(b3) let c3 = Array.fromNative(b3)
if(!(c3 instanceof UTSArray<Number>)){ if(c3[0] != (-1 as Number).toShort()){
return false return false
} }
let b4 = intArrayOf(-1,2,0,3,4,5) let b4 = intArrayOf(-1,2,0,3,4,5)
let c4 = Array.fromNative(b4) let c4 = Array.fromNative(b4)
if(!(c4 instanceof UTSArray<Number>)){ if(c4[0] != (-1 as Number).toInt()){
return false return false
} }
return true return true
} }
...@@ -513,7 +515,8 @@ export function openFileWithProvider(url:String){ ...@@ -513,7 +515,8 @@ export function openFileWithProvider(url:String){
const uri = UTSAndroid.getFileProviderUri(file) const uri = UTSAndroid.getFileProviderUri(file)
console.log("uri",uri.toString()) console.log("uri",uri.toString())
const intent = new Intent(Intent.ACTION_VIEW, uri) 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()!; const context = UTSAndroid.getUniActivity()!;
context.startActivity(intent); context.startActivity(intent);
} }
...@@ -45,10 +45,10 @@ export function frequentlyObjectTest():boolean{ ...@@ -45,10 +45,10 @@ export function frequentlyObjectTest():boolean{
console.log(typeLogRet) console.log(typeLogRet)
let typeLogObj = JSON.parseObject(typeLogRet)! let typeLogObj = JSON.parseObject(typeLogRet)!
// let typeLogObjPos = typeLogObj.getJSON("__$originalPosition")! let typeLogObjPos = typeLogObj.getJSON("__$originalPosition")!
// if("ParamOptions" != typeLogObjPos['name']){ if("ParamOptions" != typeLogObjPos['name']){
// return false return false
// } }
// /** // /**
// * 编译出来的位置信息可能有差异,排除单独验证后,排除掉这个字段 // * 编译出来的位置信息可能有差异,排除单独验证后,排除掉这个字段
// */ // */
......
...@@ -75,7 +75,7 @@ export class AppHookProxy implements UTSAndroidHookProxy { ...@@ -75,7 +75,7 @@ export class AppHookProxy implements UTSAndroidHookProxy {
} }
@Suppress("DEPRECATION")
class ForeService extends Service { class ForeService extends Service {
constructor (){ constructor (){
...@@ -130,6 +130,7 @@ class ForeService extends Service { ...@@ -130,6 +130,7 @@ class ForeService extends Service {
return super.onStartCommand(intent, flags, startId); return super.onStartCommand(intent, flags, startId);
} }
override onDestroy():void { override onDestroy():void {
super.onDestroy(); super.onDestroy();
this.stopForeground(true);// 停止前台服务--参数:表示是否移除之前的通知 this.stopForeground(true);// 停止前台服务--参数:表示是否移除之前的通知
......
...@@ -187,7 +187,7 @@ export function testArray(): Result { ...@@ -187,7 +187,7 @@ export function testArray(): Result {
// #ifndef APP-IOS // #ifndef APP-IOS
const s = JSON.parse<P[]>(JSON.stringify([{ x: 0, y: 0 }])) as P[] const s = JSON.parse<P[]>(JSON.stringify([{ x: 0, y: 0 }])) as P[]
s[0].x += 0; 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); expect(clearList.includes(0)).toEqual(true);
// #endif // #endif
// #ifdef APP-IOS // #ifdef APP-IOS
......
...@@ -36,11 +36,11 @@ export function testDate() : Result { ...@@ -36,11 +36,11 @@ export function testDate() : Result {
const date1 = new Date('01 Jan 1970 00:00:00 GMT'); const date1 = new Date('01 Jan 1970 00:00:00 GMT');
const date2 = new Date('December 17, 1995 03:24:00'); 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(date1.toTimeString()).toEqual("08:00:00 GMT+0800 (中国标准时间)");
expect(date2.toTimeString()).toEqual("03:24:00 GMT+0800 (中国标准时间)"); expect(date2.toTimeString()).toEqual("03:24:00 GMT+0800 (中国标准时间)");
// #endif // #endif
// #ifndef APP-ANDROID // #ifdef APP-ANDROID
expect(date1.toTimeString()).toEqual("08:00:00 GMT+0800"); expect(date1.toTimeString()).toEqual("08:00:00 GMT+0800");
expect(date2.toTimeString()).toEqual("03:24:00 GMT+0800"); expect(date2.toTimeString()).toEqual("03:24:00 GMT+0800");
// #endif // #endif
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册