Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
Hello UTS
提交
49ecc180
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看板
提交
49ecc180
编写于
11月 25, 2023
作者:
DCloud-yyl
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'alpha'
上级
0151efca
0b69d56e
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
74 addition
and
10 deletion
+74
-10
AndroidManifest.xml
AndroidManifest.xml
+12
-2
main.uts
main.uts
+2
-2
pages/advance/advance.vue
pages/advance/advance.vue
+11
-1
uni_modules/uts-nativepage/utssdk/app-android/index.uts
uni_modules/uts-nativepage/utssdk/app-android/index.uts
+29
-0
uni_modules/uts-nativepage/utssdk/app-android/res/xml/custom_network_security_config.xml
...dk/app-android/res/xml/custom_network_security_config.xml
+10
-0
uni_modules/uts-nativepage/utssdk/app-android/res/xml/filepaths.xml
...s/uts-nativepage/utssdk/app-android/res/xml/filepaths.xml
+4
-0
uni_modules/uts-platform-api/utssdk/app-android/index.uts
uni_modules/uts-platform-api/utssdk/app-android/index.uts
+3
-3
uni_modules/uts-tests/utssdk/Number.uts
uni_modules/uts-tests/utssdk/Number.uts
+3
-2
未找到文件。
AndroidManifest.xml
浏览文件 @
49ecc180
...
...
@@ -2,9 +2,19 @@
<manifest
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:tools=
"http://schemas.android.com/tools"
package=
"io.dcloud.hellouts"
>
<application>
<application
android:networkSecurityConfig=
"@xml/custom_network_security_config"
>
<!--meta-data-->
<meta-data
android:name=
"TencentMapSDK"
android:value=
"您申请的腾讯定位App Key"
/>
<!--fileprovider注册,请注意authorities 需要替换为自己的唯一标识-->
<provider
android:name=
"androidx.core.content.FileProvider"
android:authorities=
"io.dcloud.hellouts.uts_nativepage.fileprovider"
android:grantUriPermissions=
"true"
android:exported=
"false"
>
<meta-data
android:name=
"android.support.FILE_PROVIDER_PATHS"
android:resource=
"@xml/filepaths"
/>
</provider>
</application>
</manifest>
main.uts
浏览文件 @
49ecc180
import App from './App'
import App from './App
.vue
'
import { createSSRApp } from 'vue'
export function createApp() {
...
...
@@ -7,4 +7,4 @@ export function createApp() {
return {
app
}
}
\ No newline at end of file
}
pages/advance/advance.vue
浏览文件 @
49ecc180
...
...
@@ -27,6 +27,8 @@
quitApp
,
arrayConvert
}
from
"
../../uni_modules/uts-advance
"
;
import
{
openFileWithProvider
}
from
'
../../uni_modules/uts-nativepage
'
export
default
{
data
()
{
...
...
@@ -81,7 +83,12 @@
},
{
name
:
"
播放asset音频(需自定义基座)
"
,
url
:
"
advance/android/assetaudio
"
},
{
},
{
name
:
"
使用三方应用打开项目文件(需自定义基座)
"
,
function
:
"
testOpenFileWithProvider
"
},
{
name
:
"
操作DecorView
"
,
url
:
"
advance/android/decorview
"
},
{
...
...
@@ -215,6 +222,9 @@
},
testQuitApp
()
{
quitApp
()
},
testOpenFileWithProvider
()
{
openFileWithProvider
(
"
apps/__UNI__70BE9D0/www/static/logo.png
"
)
},
testArrayConvert
()
{
let
convertRet
=
arrayConvert
()
...
...
uni_modules/uts-nativepage/utssdk/app-android/index.uts
浏览文件 @
49ecc180
...
...
@@ -27,6 +27,23 @@ import ViewGroup from 'android.view.ViewGroup';
import LayoutInflater from 'android.view.LayoutInflater';
import LinearLayoutManager from 'androidx.recyclerview.widget.LinearLayoutManager';
export {DoAppWidget} from "./DoAppWidget.uts"
import Application from 'android.app.Application';
import File from 'java.io.File';
import Uri from 'android.net.Uri';
export class AppHookProxy implements UTSAndroidHookProxy {
override onCreate(application: Application) {
//当前应用是否 取得用户同意隐私协议
android.util.Log.d("AppHookProxy", "AppHookProxy--onCreate---")
if(UTSAndroid.isPrivacyAgree()) {
//onCreate 初始化三方SDK
android.util.Log.d("AppHookProxy", "AppHookProxy--onCreate---isPrivacyAgree")
}
}
}
class ForeService extends Service {
...
...
@@ -294,3 +311,15 @@ export function gotoDemoActivity():boolean {
}
export function openFileWithProvider(url:String){
let file = new File(UTSAndroid.getResourcePath("static/logo.png"))
// 这里的 io.dcloud.hellouts.uts_nativepage.fileprovider 应该是你唯一的fileprovider 标识
const uri = androidx.core.content.FileProvider.getUriForFile(UTSAndroid.getUniActivity()!,"io.dcloud.hellouts.uts_nativepage.fileprovider",file)
console.log("uri",uri.toString())
const intent = new Intent(Intent.ACTION_VIEW, uri)
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION) // 添加权限标志
const context = UTSAndroid.getUniActivity()!;
context.startActivity(intent);
}
uni_modules/uts-nativepage/utssdk/app-android/res/xml/custom_network_security_config.xml
0 → 100644
浏览文件 @
49ecc180
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<!--https://developer.android.google.cn/training/articles/security-config-->
<base-config
cleartextTrafficPermitted=
"true"
>
<trust-anchors>
<certificates
src=
"system"
/>
<certificates
src=
"user"
/>
</trust-anchors>
</base-config>
</network-security-config>
uni_modules/uts-nativepage/utssdk/app-android/res/xml/filepaths.xml
0 → 100644
浏览文件 @
49ecc180
<?xml version="1.0" encoding="utf-8"?>
<paths>
<external-path
name=
"external"
path=
"."
/>
</paths>
\ No newline at end of file
uni_modules/uts-platform-api/utssdk/app-android/index.uts
浏览文件 @
49ecc180
...
...
@@ -119,7 +119,7 @@ export function gotoSystemPermissionActivityTest() {
*/
export function gotoCameraTake(imageDone : (event : string) => void) : boolean {
let permissionNeed =
utsArrayOf("android.permission.CAMERA")
let permissionNeed =
["android.permission.CAMERA"]
UTSAndroid.requestSystemPermission(UTSAndroid.getUniActivity()!, permissionNeed, function (allRight : boolean, _grantedList : string[]) {
if (allRight) {
...
...
@@ -282,7 +282,7 @@ export function arrayPermissionFlowTest(callback : (ret : boolean, desc : string
/**
* 同时申请日历和联系人权限
*/
let permissionNeed =
utsArrayOf("android.permission.WRITE_EXTERNAL_STORAGE", "android.permission.ACCESS_FINE_LOCATION", "android.permission.READ_PHONE_STATE")
let permissionNeed =
["android.permission.WRITE_EXTERNAL_STORAGE", "android.permission.ACCESS_FINE_LOCATION", "android.permission.READ_PHONE_STATE"]
if (UTSAndroid.getSystemPermissionDenied(UTSAndroid.getUniActivity()!, permissionNeed).isEmpty()) {
callback(false, "已具备请求权限")
...
...
@@ -429,7 +429,7 @@ export function singlePermissionFlowTest(callback : (ret : boolean, desc : strin
return
}
let permissionNeed =
utsArrayOf("android.permission.READ_PHONE_STATE")
let permissionNeed =
["android.permission.READ_PHONE_STATE"]
if (UTSAndroid.getSystemPermissionDenied(UTSAndroid.getUniActivity()!, permissionNeed).isEmpty()) {
callback(false, "已具备权限")
return;
...
...
uni_modules/uts-tests/utssdk/Number.uts
浏览文件 @
49ecc180
...
...
@@ -22,12 +22,13 @@ export function testNumber(): Result {
console.log(JSON.stringify(obj))
// #ifndef APP-IOS
// android 专有数据类型
expect(123456.789.toFixed(2)).toEqual("123456.79");
expect(12345600123.789123.toFixed(2)).toEqual("12345600123.79");
expect((-123456.789).toFixed(5)).toEqual("-123456.78900");
expect(parseFloat("16688995566.369").toFixed(3)).toEqual("16688995566.369");
// #ifndef APP-IOS
// android 专有数据类型
let a1 = 56
let a2 = -122
expect(a1.toByte().toFixed(2)).toEqual("56.00");
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录