提交 49ecc180 编写于 作者: DCloud-yyl's avatar DCloud-yyl

Merge branch 'alpha'

......@@ -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>
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
}
......@@ -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()
......
......@@ -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);
}
<?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>
<?xml version="1.0" encoding="utf-8"?>
<paths>
<external-path name="external" path="." />
</paths>
\ No newline at end of file
......@@ -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;
......
......@@ -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.
先完成此消息的编辑!
想要评论请 注册