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

修复部分编译警告

上级 6a6d410f
......@@ -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<string>)){
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<string>)){
if(utsArr2[0] != "hello"){
return false
}
let b1 = byteArrayOf(-1,2,0,3,4,5)
let c1 = Array.fromNative(b1)
if(!(c1 instanceof UTSArray<Number>)){
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<Number>)){
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<Number>)){
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<Number>)){
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);
}
......@@ -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
}
// /**
// * 编译出来的位置信息可能有差异,排除单独验证后,排除掉这个字段
// */
......
......@@ -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);// 停止前台服务--参数:表示是否移除之前的通知
......
......@@ -187,7 +187,7 @@ export function testArray(): Result {
// #ifndef APP-IOS
const s = JSON.parse<P[]>(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
......
......@@ -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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册