working android example. File access still not working
This commit is contained in:
parent
a04fd0293f
commit
340833ea7b
6 changed files with 50 additions and 17 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
|
@ -11,7 +11,7 @@ node_modules
|
|||
dist
|
||||
dist-ssr
|
||||
*.local
|
||||
|
||||
src-tauri/gen/android/keystore.properties
|
||||
# Editor directories and files
|
||||
.vscode/*
|
||||
!.vscode/extensions.json
|
||||
|
|
|
|||
|
|
@ -6,9 +6,15 @@
|
|||
"main"
|
||||
],
|
||||
"permissions": [
|
||||
{
|
||||
"identifier": "fs:allow-read",
|
||||
"allow": [{ "path": "$HOME/**" }]
|
||||
},
|
||||
"core:default",
|
||||
"shell:allow-open",
|
||||
"fs:default",
|
||||
"log:default"
|
||||
"log:default",
|
||||
"fs:allow-home-read-recursive",
|
||||
"fs:scope-home-recursive",
|
||||
"fs:read-all"
|
||||
]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import java.util.Properties
|
||||
import java.io.FileInputStream
|
||||
|
||||
plugins {
|
||||
id("com.android.application")
|
||||
|
|
@ -24,6 +25,22 @@ android {
|
|||
versionCode = tauriProperties.getProperty("tauri.android.versionCode", "1").toInt()
|
||||
versionName = tauriProperties.getProperty("tauri.android.versionName", "1.0")
|
||||
}
|
||||
signingConfigs {
|
||||
create("release") {
|
||||
val keystorePropertiesFile = rootProject.file("keystore.properties")
|
||||
val keystoreProperties = Properties()
|
||||
if (keystorePropertiesFile.exists()) {
|
||||
keystoreProperties.load(FileInputStream(keystorePropertiesFile))
|
||||
}
|
||||
|
||||
keyAlias = keystoreProperties["keyAlias"] as String
|
||||
keyPassword = keystoreProperties["password"] as String
|
||||
storeFile = file(keystoreProperties["storeFile"] as String)
|
||||
storePassword = keystoreProperties["password"] as String
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
buildTypes {
|
||||
getByName("debug") {
|
||||
manifestPlaceholders["usesCleartextTraffic"] = "true"
|
||||
|
|
@ -37,6 +54,7 @@ android {
|
|||
}
|
||||
}
|
||||
getByName("release") {
|
||||
signingConfig = signingConfigs.getByName("release")
|
||||
isMinifyEnabled = true
|
||||
proguardFiles(
|
||||
*fileTree(".") { include("**/*.pro") }
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||
|
||||
<!-- AndroidTV support -->
|
||||
<uses-feature android:name="android.software.leanback" android:required="false" />
|
||||
|
|
|
|||
|
|
@ -20,7 +20,8 @@
|
|||
"assetProtocol": {
|
||||
"enable": true,
|
||||
"scope": [
|
||||
"$HOME/**"
|
||||
"$HOME/**",
|
||||
"**"
|
||||
]
|
||||
}
|
||||
|
||||
|
|
|
|||
26
src/main.js
26
src/main.js
|
|
@ -1,4 +1,5 @@
|
|||
const { convertFileSrc, invoke } = window.__TAURI__.core;
|
||||
// const { invoke } = window.__TAURI__.core;
|
||||
const { homeDir, join } = window.__TAURI__.path;
|
||||
const { readFile } = window.__TAURI__.fs;
|
||||
|
||||
|
|
@ -7,20 +8,25 @@ const filePath = await join(appDataDirPath, 'Pictures/wallpaper.png');
|
|||
|
||||
const assetUrl = convertFileSrc(filePath);
|
||||
|
||||
|
||||
let text = "";
|
||||
window.addEventListener("DOMCharacterDataModified", () => {
|
||||
// window.addEventListener("DOMCharacterDataModified", () => {
|
||||
// var tag_id = document.getElementById('rendered_markdown');
|
||||
// tag_id.innerHTML = "<p>HI</p>"
|
||||
// window.addEventListener("DOMContentLoaded", () => {
|
||||
let textarea = document.getElementById('markdown_input');
|
||||
textarea.addEventListener('input', ()=> {
|
||||
let textarea = document.getElementById('markdown_input');
|
||||
textarea.addEventListener('input', ()=> {
|
||||
text = textarea.innerText;
|
||||
invoke("parse_markdown", { document: text }).then(
|
||||
(ret)=>{
|
||||
var tag_id = document.getElementById('rendered_markdown');
|
||||
// tag_id.innerHTML = "<pre>".concat("", ret).concat("", "</pre>");
|
||||
tag_id.innerHTML = "<p>HI</p>"
|
||||
// invoke("parse_markdown", { document: text }).then(
|
||||
// (ret)=>{
|
||||
// var tag_id = document.getElementById('rendered_markdown');
|
||||
// // tag_id.innerHTML = assetUrl.concat(" ", ' \n <img src="'.concat("", assetUrl).concat("", '" alt="Girl in a jacket" width="500" height="600">'))
|
||||
// tag_id.innerHTML = "<p>HI</p>"
|
||||
// // tag_id.innerHTML = "<pre>".concat("", ret).concat("", "</pre>");
|
||||
tag_id.innerHTML = assetUrl.concat(" ", ' \n <img src="'.concat("", assetUrl).concat("", '" alt="Girl in a jacket" width="500" height="600">'))
|
||||
}
|
||||
);
|
||||
// }
|
||||
// );
|
||||
|
||||
});
|
||||
// });
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue