Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
Hello UTS
提交
8ffe1e04
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看板
提交
8ffe1e04
编写于
10月 18, 2023
作者:
lizhongyi_
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'dev' of
https://gitcode.net/dcloud/hello-uts
into dev
上级
f3513a42
57d4e972
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
54 addition
and
35 deletion
+54
-35
pages/SDKIntegration/SDKIntegration.uvue
pages/SDKIntegration/SDKIntegration.uvue
+6
-21
uni_modules/uts-platform-api/utssdk/app-android/index.uts
uni_modules/uts-platform-api/utssdk/app-android/index.uts
+48
-14
未找到文件。
pages/SDKIntegration/SDKIntegration.uvue
浏览文件 @
8ffe1e04
...
@@ -67,29 +67,14 @@
...
@@ -67,29 +67,14 @@
})
})
},
},
gotoLottie: function () {
gotoLottie: function () {
// if (checkHasLottieIntegration()) {
uni.showToast({
// uni.navigateTo({
title:'暂时不支持uni-appx'
// url: '/pages/SDKIntegration/Lottie/index'
})
// })
// } else {
// uni.showToast({
// icon: 'none',
// title: '需要在自定义基座中运行'
// })
// }
},
},
gotoTencentLocation: function () {
gotoTencentLocation: function () {
// let ret = checkHasIntegration();
uni.showToast({
// if (!ret) {
title:'暂时不支持uni-appx'
// uni.showToast({
})
// icon: 'none',
// title: '需要在自定义基座中运行'
// })
// } else {
// uni.navigateTo({
// url: '/pages/SDKIntegration/TencentLocation/TencentLocation'
// })
// }
},
},
gotoTencentMap: function () {
gotoTencentMap: function () {
uni.navigateTo({
uni.navigateTo({
...
...
uni_modules/uts-platform-api/utssdk/app-android/index.uts
浏览文件 @
8ffe1e04
...
@@ -63,9 +63,16 @@ export function privacyStateTest(callback : (ret : boolean, desc : string) => vo
...
@@ -63,9 +63,16 @@ export function privacyStateTest(callback : (ret : boolean, desc : string) => vo
* UTSAndroid.getAppTempPath 测试示例
* UTSAndroid.getAppTempPath 测试示例
*/
*/
export function getAppTempPathTest() : boolean {
export function getAppTempPathTest() : boolean {
console.log(UTSAndroid.getAppTempPath())
// 1.0 的路径
if (UTSAndroid.getAppTempPath()!.contains("data/io.dcloud.HBuilder/apps/HBuilder/temp")) {
if (UTSAndroid.getAppTempPath()!.contains("data/io.dcloud.HBuilder/apps/HBuilder/temp")) {
return true
return true
}
}
// 2.0的路径
if (UTSAndroid.getAppTempPath()!.contains("cache/temp")) {
return true
}
return false
return false
}
}
...
@@ -261,13 +268,24 @@ export function unRegLifecycle() {
...
@@ -261,13 +268,24 @@ export function unRegLifecycle() {
*/
*/
export function arrayPermissionFlowTest(callback : (ret : boolean, desc : string) => void) {
export function arrayPermissionFlowTest(callback : (ret : boolean, desc : string) => void) {
if("io.dcloud.uniappx" != UTSAndroid.getAppContext()?.packageName && "io.dcloud.HBuilder" != UTSAndroid.getAppContext()?.packageName){
/**
* 说明是自定义基座,不支持权限测试
*/
uni.showToast({
title:'自定义基座不支持当前测试'
})
return
}
/**
/**
* 同时申请日历和联系人权限
* 同时申请日历和联系人权限
*/
*/
let permissionNeed = utsArrayOf("android.permission.
READ_CALENDAR", "android.permission.WRITE_CALENDAR", "android.permission.READ_CONTACTS", "android.permission.WRITE_CONTACTS", "android.permission.GET_ACCOUNTS
")
let permissionNeed = utsArrayOf("android.permission.
WRITE_EXTERNAL_STORAGE", "android.permission.ACCESS_FINE_LOCATION", "android.permission.READ_PHONE_STATE
")
if (UTSAndroid.getSystemPermissionDenied(UTSAndroid.getUniActivity()!, permissionNeed).isEmpty()) {
if (UTSAndroid.getSystemPermissionDenied(UTSAndroid.getUniActivity()!, permissionNeed).isEmpty()) {
callback(false, "已具备
日历/联系人
权限")
callback(false, "已具备
请求
权限")
return;
return;
}
}
...
@@ -302,23 +320,23 @@ export function getDeviceInfoTest():string {
...
@@ -302,23 +320,23 @@ export function getDeviceInfoTest():string {
let info = ''
let info = ''
info += 'isUniMp: '+UTSAndroid.isUniMp() + "\n ";
info += 'isUniMp: '+UTSAndroid.isUniMp() + "\n ";
info += 'getAppDarkMode: '+UTSAndroid.getAppDarkMode() + "\n ";
info += 'getAppDarkMode: '+UTSAndroid.getAppDarkMode() + "\n ";
info += 'getLanguageInfo: '+
UTSAndroid.getLanguageInfo(UTSAndroid.getAppContext()!!
) + "\n ";
info += 'getLanguageInfo: '+
JSON.stringify(UTSAndroid.getLanguageInfo(UTSAndroid.getAppContext()!!)
) + "\n ";
info += 'getWebViewInfo: '+
UTSAndroid.getWebViewInfo(UTSAndroid.getAppContext()!!
) + "\n ";
info += 'getWebViewInfo: '+
JSON.stringify(UTSAndroid.getWebViewInfo(UTSAndroid.getAppContext()!!)
) + "\n ";
info += 'getDeviceID: '+UTSAndroid.getDeviceID(UTSAndroid.getAppContext()!!) + "\n ";
info += 'getDeviceID: '+UTSAndroid.getDeviceID(UTSAndroid.getAppContext()!!) + "\n ";
info += 'getOAID: '+UTSAndroid.getOAID() + "\n ";
info += 'getOAID: '+UTSAndroid.getOAID() + "\n ";
info += 'getInnerVersion: '+UTSAndroid.getInnerVersion() + "\n ";
info += 'getInnerVersion: '+UTSAndroid.getInnerVersion() + "\n ";
info += 'getUniCompileVersion: '+UTSAndroid.getUniCompileVersion() + "\n ";
info += 'getUniCompileVersion: '+UTSAndroid.getUniCompileVersion() + "\n ";
info += 'getUniRuntimeVersion: '+UTSAndroid.getUniRuntimeVersion() + "\n ";
info += 'getUniRuntimeVersion: '+UTSAndroid.getUniRuntimeVersion() + "\n ";
info += 'getAppId: '+UTSAndroid.getAppId() + "\n ";
info += 'getAppId: '+UTSAndroid.getAppId() + "\n ";
info += 'getAppVersion: '+
UTSAndroid.getAppVersion(
) + "\n ";
info += 'getAppVersion: '+
JSON.stringify(UTSAndroid.getAppVersion()
) + "\n ";
info += 'getAppName: '+UTSAndroid.getAppName() + "\n ";
info += 'getAppName: '+UTSAndroid.getAppName() + "\n ";
info += 'getOsTheme: '+UTSAndroid.getOsTheme() + "\n ";
info += 'getOsTheme: '+UTSAndroid.getOsTheme() + "\n ";
info += 'getScreenInfo: '+
UTSAndroid.getScreenInfo(
) + "\n ";
info += 'getScreenInfo: '+
JSON.stringify(UTSAndroid.getScreenInfo()
) + "\n ";
info += 'getStatusBarHeight: '+UTSAndroid.getStatusBarHeight() + "\n ";
info += 'getStatusBarHeight: '+UTSAndroid.getStatusBarHeight() + "\n ";
info += 'isTitleNViewShow: '+UTSAndroid.isTitleNViewShow() + "\n ";
info += 'isTitleNViewShow: '+UTSAndroid.isTitleNViewShow() + "\n ";
info += 'isTabBarShow: '+UTSAndroid.isTabBarShow() + "\n ";
info += 'isTabBarShow: '+UTSAndroid.isTabBarShow() + "\n ";
info += 'getWindowHeight: '+UTSAndroid.getWindowHeight() + "\n ";
info += 'getWindowHeight: '+UTSAndroid.getWindowHeight() + "\n ";
info += 'getSafeAreaInsets: '+
UTSAndroid.getSafeAreaInsets(
) + "\n ";
info += 'getSafeAreaInsets: '+
JSON.stringify(UTSAndroid.getSafeAreaInsets()
) + "\n ";
info += 'isUniAppX: '+UTSAndroid.isUniAppX() + "\n ";
info += 'isUniAppX: '+UTSAndroid.isUniAppX() + "\n ";
return info
return info
...
@@ -370,10 +388,18 @@ export function convert2AbsFullPathTest() : boolean {
...
@@ -370,10 +388,18 @@ export function convert2AbsFullPathTest() : boolean {
return false;
return false;
}
}
if (!resourcePath.contains("Android/data/io.dcloud")) {
console.log("路径转换结果错误")
if("io.dcloud.uniappx" == UTSAndroid.getAppContext()?.packageName || "io.dcloud.HBuilder" == UTSAndroid.getAppContext()?.packageName){
return false;
/**
* 只有标准基座,校验这个选项
*/
if (!resourcePath.contains("Android/data/io.dcloud")) {
console.log("路径转换结果错误")
return false;
}
}
}
let sdcardPath = UTSAndroid.convert2AbsFullPath(resourcePath)
let sdcardPath = UTSAndroid.convert2AbsFullPath(resourcePath)
console.log(sdcardPath)
console.log(sdcardPath)
...
@@ -392,19 +418,27 @@ export function convert2AbsFullPathTest() : boolean {
...
@@ -392,19 +418,27 @@ export function convert2AbsFullPathTest() : boolean {
* 单个权限,申请流程测试
* 单个权限,申请流程测试
*/
*/
export function singlePermissionFlowTest(callback : (ret : boolean, desc : string) => void) {
export function singlePermissionFlowTest(callback : (ret : boolean, desc : string) => void) {
if("io.dcloud.uniappx" != UTSAndroid.getAppContext()?.packageName && "io.dcloud.HBuilder" != UTSAndroid.getAppContext()?.packageName){
/**
* 说明是自定义基座,不支持权限测试
*/
uni.showToast({
title:'自定义基座不支持当前测试'
})
return
}
let permissionNeed = utsArrayOf("android.permission.RE
CORD_AUDIO
")
let permissionNeed = utsArrayOf("android.permission.RE
AD_PHONE_STATE
")
if (UTSAndroid.getSystemPermissionDenied(UTSAndroid.getUniActivity()!, permissionNeed).isEmpty()) {
if (UTSAndroid.getSystemPermissionDenied(UTSAndroid.getUniActivity()!, permissionNeed).isEmpty()) {
callback(false, "
预期当前不具备 录音的
权限")
callback(false, "
已具备
权限")
return;
return;
}
}
UTSAndroid.requestSystemPermission(UTSAndroid.getUniActivity()!, permissionNeed, function (allRight : boolean, _grantedList : string[]) {
UTSAndroid.requestSystemPermission(UTSAndroid.getUniActivity()!, permissionNeed, function (allRight : boolean, _grantedList : string[]) {
if (allRight) {
if (allRight) {
// 交给目前的location 引擎,真实执行
// 测试权限api 返回值
// 测试权限api 返回值
if (!UTSAndroid.getSystemPermissionDenied(UTSAndroid.getUniActivity()!, permissionNeed).isEmpty()) {
if (!UTSAndroid.getSystemPermissionDenied(UTSAndroid.getUniActivity()!, permissionNeed).isEmpty()) {
// 预期当前基座具备了读写日历的权限
callback(false, "权限请求完成,getSystemPermissionDenied 失败")
callback(false, "权限请求完成,getSystemPermissionDenied 失败")
return;
return;
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录