提交 5cbfb082 编写于 作者: 杜庆泉's avatar 杜庆泉

处理一批语法报错

上级 f2006e8f
......@@ -51,7 +51,7 @@ class AndroidFileSystemManager implements FileSystemManager{
/**
* 执行真正的加载行为,为了避免阻塞分发到 io任务序列
*/
UTSAndroid.dispatchAsync('io',function(_){
UTSAndroid.getDispatcher('io').async(function(_){
let ret : ReadFileSuccessResult = {
data : ""
......@@ -92,13 +92,13 @@ class AndroidFileSystemManager implements FileSystemManager{
let currentDispatcher = UTSAndroid.getDispatcher()
UTSAndroid.dispatchAsync('io',function(_){
UTSAndroid.getDispatcher('io').async(function(_){
/**
* 如果上一级目录不存在,创建之
*/
if(!nextFile.parentFile.exists()){
nextFile.parentFile.mkdirs()
if(!nextFile.parentFile!.exists()){
nextFile.parentFile!.mkdirs()
}
if(!nextFile.exists()){
......
......@@ -73,8 +73,8 @@ export type WriteFileOptions = {
export interface FileSystemManager {
readFile(config: ReadFileOptions): void;
writeFile(config: WriteFileOptions): void;
readFile(options: ReadFileOptions): void;
writeFile(options: WriteFileOptions): void;
}
......
......@@ -46,7 +46,7 @@ export function privacyStateTest(callback : (ret : boolean, desc : string) => vo
}
UTSAndroid.setPrivacyAgree(true)
UTSAndroid.dispatchAsync("io",function(res){
UTSAndroid.getDispatcher("io").async(function(_){
if (UTSAndroid.isPrivacyAgree() == false) {
// 重置没有生效
callback(false,"setPrivacyAgree error")
......@@ -54,6 +54,15 @@ export function privacyStateTest(callback : (ret : boolean, desc : string) => vo
}
callback(true,"pass")
},null)
// UTSAndroid.dispatchAsync("io",function(res){
// if (UTSAndroid.isPrivacyAgree() == false) {
// // 重置没有生效
// callback(false,"setPrivacyAgree error")
// console.log("setPrivacyAgree error")
// }
// callback(true,"pass")
// },null)
}
......@@ -62,13 +71,12 @@ export function privacyStateTest(callback : (ret : boolean, desc : string) => vo
* UTSAndroid.getAppTempPath 测试示例
*/
export function getAppTempPathTest() : boolean {
console.log(UTSAndroid.getAppTempPath())
// 1.0 的路径
if (UTSAndroid.getAppTempPath()!.contains("data/io.dcloud.HBuilder/apps/HBuilder/temp")) {
if (UTSAndroid.getAppCachePath()!.contains("data/io.dcloud.HBuilder/apps/HBuilder/temp")) {
return true
}
// 2.0的路径
if (UTSAndroid.getAppTempPath()!.contains("cache/temp")) {
if (UTSAndroid.getAppCachePath()!.contains("cache/temp")) {
return true
}
......@@ -120,7 +128,7 @@ export function gotoCameraTake(imageDone : (event : string) => void) : boolean {
let permissionNeed = ["android.permission.CAMERA"]
UTSAndroid.requestSystemPermission(UTSAndroid.getUniActivity()!, permissionNeed, function (allRight : boolean, _grantedList : string[]) {
UTSAndroid.requestSystemPermission(UTSAndroid.getUniActivity()!, permissionNeed, function (allRight : boolean, _ : string[]) {
if (allRight) {
// 交给目前的location 引擎,真实执行
UTSAndroid.onAppActivityResult((requestCode : Int, resultCode : Int, data ?: Intent) => {
......@@ -148,7 +156,7 @@ export function gotoCameraTake(imageDone : (event : string) => void) : boolean {
} else {
//callback(false,"用户拒绝了部分权限")
}
}, function (_doNotAskAgain : boolean, _grantedList : string[]) {
}, function (_ : boolean, _ : string[]) {
//callback(false,"用户拒绝了部分权限")
})
......@@ -288,7 +296,7 @@ export function arrayPermissionFlowTest(callback : (ret : boolean, desc : string
return;
}
UTSAndroid.requestSystemPermission(UTSAndroid.getUniActivity()!, permissionNeed, function (allRight : boolean, _grantedList : string[]) {
UTSAndroid.requestSystemPermission(UTSAndroid.getUniActivity()!, permissionNeed, function (allRight : boolean, _ : string[]) {
if (allRight) {
// 交给目前的location 引擎,真实执行
// 测试权限api 返回值
......@@ -305,7 +313,7 @@ export function arrayPermissionFlowTest(callback : (ret : boolean, desc : string
} else {
callback(false, "用户拒绝了部分权限")
}
}, function (_doNotAskAgain : boolean, _grantedList : string[]) {
}, function (_ : boolean, _ : string[]) {
callback(false, "用户拒绝了部分权限")
})
......@@ -319,9 +327,9 @@ export function getDeviceInfoTest():string {
let info = ''
info += 'isUniMp: '+UTSAndroid.isUniMp() + "\n ";
info += 'getAppDarkMode: '+UTSAndroid.getAppDarkMode() + "\n ";
info += 'getLanguageInfo: '+ JSON.stringify(UTSAndroid.getLanguageInfo(UTSAndroid.getAppContext()!!)) + "\n ";
info += 'getWebViewInfo: '+ JSON.stringify(UTSAndroid.getWebViewInfo(UTSAndroid.getAppContext()!!)) + "\n ";
info += 'getDeviceID: '+UTSAndroid.getDeviceID(UTSAndroid.getAppContext()!!) + "\n ";
info += 'getLanguageInfo: '+ JSON.stringify(UTSAndroid.getLanguageInfo(UTSAndroid.getAppContext()!)) + "\n ";
info += 'getWebViewInfo: '+ JSON.stringify(UTSAndroid.getWebViewInfo(UTSAndroid.getAppContext()!)) + "\n ";
info += 'getDeviceID: '+UTSAndroid.getDeviceID(UTSAndroid.getAppContext()!) + "\n ";
info += 'getOAID: '+UTSAndroid.getOAID() + "\n ";
info += 'getInnerVersion: '+UTSAndroid.getInnerVersion() + "\n ";
info += 'getUniCompileVersion: '+UTSAndroid.getUniCompileVersion() + "\n ";
......@@ -344,12 +352,12 @@ export function getDeviceInfoTest():string {
* 任务分发测试
*/
export function dispatchAsyncTest(callback : (ret : boolean, desc : string) => void) {
UTSAndroid.dispatchAsync("main",function(res){
UTSAndroid.getDispatcher("main").async(function(_){
if(Thread.currentThread().name != 'main'){
callback(false,"main thread error")
return
}
UTSAndroid.dispatchAsync("dom",function(res){
UTSAndroid.getDispatcher("dom").async(function(_){
/**
* dom 参数,只在2.0生效,1.0会自动切换到main线程
*/
......@@ -357,7 +365,7 @@ export function dispatchAsyncTest(callback : (ret : boolean, desc : string) => v
callback(false,"dom thread error")
return
}
UTSAndroid.dispatchAsync("io",function(res){
UTSAndroid.getDispatcher("io").async(function(_){
/**
* dom 参数,只在2.0生效,1.0会自动切换到main线程
*/
......@@ -370,6 +378,7 @@ export function dispatchAsyncTest(callback : (ret : boolean, desc : string) => v
},null)
},null)
}
......@@ -434,7 +443,7 @@ export function singlePermissionFlowTest(callback : (ret : boolean, desc : strin
return;
}
UTSAndroid.requestSystemPermission(UTSAndroid.getUniActivity()!, permissionNeed, function (allRight : boolean, _grantedList : string[]) {
UTSAndroid.requestSystemPermission(UTSAndroid.getUniActivity()!, permissionNeed, function (allRight : boolean, _ : string[]) {
if (allRight) {
// 测试权限api 返回值
if (!UTSAndroid.getSystemPermissionDenied(UTSAndroid.getUniActivity()!, permissionNeed).isEmpty()) {
......@@ -449,7 +458,7 @@ export function singlePermissionFlowTest(callback : (ret : boolean, desc : strin
} else {
callback(false, "用户拒绝了部分权限")
}
}, function (_doNotAskAgain : boolean, _grantedList : string[]) {
}, function (_ : boolean, _ : string[]) {
callback(false, "用户拒绝了部分权限")
})
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册