Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
Hello UTS
提交
24bf9b23
H
Hello UTS
项目概览
DCloud
/
Hello UTS
通知
1595
Star
27
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看板
提交
24bf9b23
编写于
7月 14, 2023
作者:
杜庆泉
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
增加隐私协议示例
上级
9afad088
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
83 addition
and
7 deletion
+83
-7
pages/SyntaxCase/utsAndroid.vue
pages/SyntaxCase/utsAndroid.vue
+28
-4
uni_modules/uts-platform-api/utssdk/app-android/index.uts
uni_modules/uts-platform-api/utssdk/app-android/index.uts
+55
-3
未找到文件。
pages/SyntaxCase/utsAndroid.vue
浏览文件 @
24bf9b23
...
@@ -14,6 +14,7 @@
...
@@ -14,6 +14,7 @@
<button
@
click=
"singlePermissionFlowClick"
>
单权限申请流程测试
</button>
<button
@
click=
"singlePermissionFlowClick"
>
单权限申请流程测试
</button>
<button
@
click=
"dispatchAsyncClick"
>
任务分发测试
</button>
<button
@
click=
"dispatchAsyncClick"
>
任务分发测试
</button>
<button
@
click=
"pathTestClick"
>
路径转换测试
</button>
<button
@
click=
"pathTestClick"
>
路径转换测试
</button>
<button
@
click=
"privacyStateClick"
>
隐私协议状态测试
</button>
<view
class=
"uni-padding-wrap uni-common-mt"
>
<view
class=
"uni-padding-wrap uni-common-mt"
>
<view
class=
"uni-hello-text"
>
<view
class=
"uni-hello-text"
>
1. 当前页面已通过initAppLifecycle函数注册了生命周期监听。
1. 当前页面已通过initAppLifecycle函数注册了生命周期监听。
...
@@ -27,11 +28,16 @@
...
@@ -27,11 +28,16 @@
<text>
{{
text
}}
</text>
<text>
{{
text
}}
</text>
</view>
</view>
</view>
</view>
<button
class=
"testButton"
@
click=
"gotoSystemPermissionActivityClick"
>
手动申请权限测试
</button>
<button
@
click=
"gotoSystemPermissionActivityClick"
>
手动申请权限测试
</button>
<button
@
tap=
"testGoOtherActivity"
>
跳转拍照界面
</button>
<button
@
tap=
"testGoOtherActivity"
>
跳转拍照界面
</button>
<button
@
tap=
"testUnRegLifecycle"
>
取消注册周期函数
</button>
<button
@
tap=
"testUnRegLifecycle"
>
取消注册周期函数
</button>
<image
:src=
"selectImage"
v-if=
"selectImage"
></image>
<image
:src=
"selectImage"
v-if=
"selectImage"
></image>
<view
class=
"uni-padding-wrap uni-common-mt"
>
<view
class=
"uni-hello-text"
>
获取设备信息,观察是否符合预期
</view>
</view>
<button
@
tap=
"getDeviceInfoClick"
>
获取设备基础信息
</button>
</view>
</view>
</
template
>
</
template
>
...
@@ -48,7 +54,9 @@
...
@@ -48,7 +54,9 @@
convert2AbsFullPathTest
,
convert2AbsFullPathTest
,
unRegLifecycle
,
unRegLifecycle
,
initAppLifecycle
,
initAppLifecycle
,
gotoCameraTake
gotoCameraTake
,
getDeviceInfoTest
,
privacyStateTest
}
from
'
@/uni_modules/uts-platform-api
'
}
from
'
@/uni_modules/uts-platform-api
'
/**
/**
...
@@ -70,6 +78,23 @@
...
@@ -70,6 +78,23 @@
});
});
},
},
methods
:
{
methods
:
{
privacyStateClick
(){
privacyStateTest
(
function
(
ret
,
desc
){
if
(
ret
)
{
uni
.
showToast
({
title
:
'
测试通过
'
})
}
else
{
uni
.
showToast
({
icon
:
'
none
'
,
title
:
'
失败:
'
+
desc
})
}
})
},
getDeviceInfoClick
(){
this
.
text
=
getDeviceInfoTest
()
},
testGoOtherActivity
(){
testGoOtherActivity
(){
var
that
=
this
;
var
that
=
this
;
let
ret
=
gotoCameraTake
(
function
(
file
){
let
ret
=
gotoCameraTake
(
function
(
file
){
...
@@ -142,7 +167,6 @@
...
@@ -142,7 +167,6 @@
dispatchAsyncTest
(
function
(
ret
,
desc
){
dispatchAsyncTest
(
function
(
ret
,
desc
){
if
(
ret
)
{
if
(
ret
)
{
uni
.
showToast
({
uni
.
showToast
({
icon
:
'
none
'
,
title
:
'
测试通过
'
title
:
'
测试通过
'
})
})
}
else
{
}
else
{
...
...
uni_modules/uts-platform-api/utssdk/app-android/index.uts
浏览文件 @
24bf9b23
...
@@ -5,6 +5,7 @@ import MediaStore from "android.provider.MediaStore";
...
@@ -5,6 +5,7 @@ import MediaStore from "android.provider.MediaStore";
import Activity from "android.app.Activity";
import Activity from "android.app.Activity";
import Bitmap from "android.graphics.Bitmap";
import Bitmap from "android.graphics.Bitmap";
import FileOutputStream from "java.io.FileOutputStream";
import FileOutputStream from "java.io.FileOutputStream";
import File from "java.io.File";
import Intent from 'android.content.Intent';
import Intent from 'android.content.Intent';
/**
/**
...
@@ -37,6 +38,30 @@ export function getUniActivityTest() : boolean {
...
@@ -37,6 +38,30 @@ export function getUniActivityTest() : boolean {
return true
return true
}
}
export function privacyStateTest(callback : (ret : boolean, desc : string) => void) {
// 先重置用户同意状态
UTSAndroid.resetPrivacyAgree()
if (UTSAndroid.isPrivacyAgree() == true) {
// 重置没有生效
callback(false,"resetPrivacyAgree error")
}
UTSAndroid.setPrivacyAgree(true)
UTSAndroid.dispatchAsync("io",function(res){
if (UTSAndroid.isPrivacyAgree() == false) {
// 重置没有生效
callback(false,"setPrivacyAgree error")
console.log("setPrivacyAgree error")
}
callback(true,"pass")
},null)
}
/**
/**
* UTSAndroid.getAppTempPath 测试示例
* UTSAndroid.getAppTempPath 测试示例
*/
*/
...
@@ -273,7 +298,34 @@ export function arrayPermissionFlowTest(callback : (ret : boolean, desc : string
...
@@ -273,7 +298,34 @@ export function arrayPermissionFlowTest(callback : (ret : boolean, desc : string
}
}
/**
* 获取设备信息
*/
export function getDeviceInfoTest():string {
let info = ''
info += 'isUniMp: '+UTSAndroid.isUniMp() + "\n ";
info += 'getAppDarkMode: '+UTSAndroid.getAppDarkMode() + "\n ";
info += 'getLanguageInfo: '+UTSAndroid.getLanguageInfo(UTSAndroid.getAppContext()!!) + "\n ";
info += 'getWebViewInfo: '+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 ";
info += 'getUniRuntimeVersion: '+UTSAndroid.getUniRuntimeVersion() + "\n ";
info += 'getAppId: '+UTSAndroid.getAppId() + "\n ";
info += 'getAppVersion: '+UTSAndroid.getAppVersion() + "\n ";
info += 'getAppName: '+UTSAndroid.getAppName() + "\n ";
info += 'getOsTheme: '+UTSAndroid.getOsTheme() + "\n ";
info += 'getScreenInfo: '+UTSAndroid.getScreenInfo() + "\n ";
info += 'getStatusBarHeight: '+UTSAndroid.getStatusBarHeight() + "\n ";
info += 'isTitleNViewShow: '+UTSAndroid.isTitleNViewShow() + "\n ";
info += 'isTabBarShow: '+UTSAndroid.isTabBarShow() + "\n ";
info += 'getWindowHeight: '+UTSAndroid.getWindowHeight() + "\n ";
info += 'getSafeAreaInsets: '+UTSAndroid.getSafeAreaInsets() + "\n ";
info += 'isUniAppX: '+UTSAndroid.isUniAppX() + "\n ";
return info
}
/**
/**
* 任务分发测试
* 任务分发测试
*/
*/
...
@@ -295,11 +347,11 @@ export function dispatchAsyncTest(callback : (ret : boolean, desc : string) => v
...
@@ -295,11 +347,11 @@ export function dispatchAsyncTest(callback : (ret : boolean, desc : string) => v
/**
/**
* dom 参数,只在2.0生效,1.0会自动切换到main线程
* dom 参数,只在2.0生效,1.0会自动切换到main线程
*/
*/
if(!Thread.currentThread().name.
startWith
("DefaultDispatcher")){
if(!Thread.currentThread().name.
contains
("DefaultDispatcher")){
callback(false,"io thread error")
callback(false,"io thread error")
return
return
}
}
callback(true)
callback(true
,"pass"
)
},null)
},null)
},null)
},null)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录