Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
Hello UTS
提交
5cbfb082
H
Hello UTS
项目概览
DCloud
/
Hello UTS
通知
1669
Star
30
Fork
9
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
2
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
H
Hello UTS
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
2
Issue
2
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
5cbfb082
编写于
12月 11, 2023
作者:
杜庆泉
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
处理一批语法报错
上级
f2006e8f
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
31 addition
and
22 deletion
+31
-22
uni_modules/uts-file-manager/utssdk/app-android/index.uts
uni_modules/uts-file-manager/utssdk/app-android/index.uts
+4
-4
uni_modules/uts-file-manager/utssdk/interface.uts
uni_modules/uts-file-manager/utssdk/interface.uts
+2
-2
uni_modules/uts-platform-api/utssdk/app-android/index.uts
uni_modules/uts-platform-api/utssdk/app-android/index.uts
+25
-16
未找到文件。
uni_modules/uts-file-manager/utssdk/app-android/index.uts
浏览文件 @
5cbfb082
...
...
@@ -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()){
...
...
uni_modules/uts-file-manager/utssdk/interface.uts
浏览文件 @
5cbfb082
...
...
@@ -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;
}
...
...
uni_modules/uts-platform-api/utssdk/app-android/index.uts
浏览文件 @
5cbfb082
...
...
@@ -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.getApp
Temp
Path()!.contains("data/io.dcloud.HBuilder/apps/HBuilder/temp")) {
if (UTSAndroid.getApp
Cache
Path()!.contains("data/io.dcloud.HBuilder/apps/HBuilder/temp")) {
return true
}
// 2.0的路径
if (UTSAndroid.getApp
Temp
Path()!.contains("cache/temp")) {
if (UTSAndroid.getApp
Cache
Path()!.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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录