Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6806a86114 |
@@ -6,13 +6,8 @@ This template should help get you started developing with Tauri, React and Types
|
|||||||
|
|
||||||
- [VS Code](https://code.visualstudio.com/) + [Tauri](https://marketplace.visualstudio.com/items?itemName=tauri-apps.tauri-vscode) + [rust-analyzer](https://marketplace.visualstudio.com/items?itemName=rust-lang.rust-analyzer)
|
- [VS Code](https://code.visualstudio.com/) + [Tauri](https://marketplace.visualstudio.com/items?itemName=tauri-apps.tauri-vscode) + [rust-analyzer](https://marketplace.visualstudio.com/items?itemName=rust-lang.rust-analyzer)
|
||||||
|
|
||||||
# Mobile Install
|
|
||||||
- npm run tauri android build -- --apk
|
|
||||||
- adb uninstall com.lucas.thomann_dsp_app
|
|
||||||
- adb install src-tauri/gen/android/app/build/outputs/apk/universal/release/app-universal-release.apk
|
|
||||||
|
|
||||||
# TODO
|
# TODO
|
||||||
|
|
||||||
- Check end to end behavioour
|
- Check end to end behavioour
|
||||||
|
|
||||||
|
- Make phone version
|
||||||
@@ -5,5 +5,3 @@
|
|||||||
# Generated by Tauri
|
# Generated by Tauri
|
||||||
# will have schema files for capabilities auto-completion
|
# will have schema files for capabilities auto-completion
|
||||||
/gen/schemas
|
/gen/schemas
|
||||||
|
|
||||||
/src-tauri/gen/android/keystore.properties
|
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
# EditorConfig is awesome: https://EditorConfig.org
|
||||||
|
|
||||||
|
# top-most EditorConfig file
|
||||||
|
root = true
|
||||||
|
|
||||||
|
[*]
|
||||||
|
indent_style = space
|
||||||
|
indent_size = 2
|
||||||
|
end_of_line = lf
|
||||||
|
charset = utf-8
|
||||||
|
trim_trailing_whitespace = false
|
||||||
|
insert_final_newline = false
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
*.iml
|
||||||
|
.gradle
|
||||||
|
/local.properties
|
||||||
|
/.idea/caches
|
||||||
|
/.idea/libraries
|
||||||
|
/.idea/modules.xml
|
||||||
|
/.idea/workspace.xml
|
||||||
|
/.idea/navEditor.xml
|
||||||
|
/.idea/assetWizardSettings.xml
|
||||||
|
.DS_Store
|
||||||
|
build
|
||||||
|
/captures
|
||||||
|
.externalNativeBuild
|
||||||
|
.cxx
|
||||||
|
local.properties
|
||||||
|
key.properties
|
||||||
|
keystore.properties
|
||||||
|
|
||||||
|
/.tauri
|
||||||
|
/tauri.settings.gradle
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
/src/main/**/generated
|
||||||
|
/src/main/jniLibs/**/*.so
|
||||||
|
/src/main/assets/tauri.conf.json
|
||||||
|
/tauri.build.gradle.kts
|
||||||
|
/proguard-tauri.pro
|
||||||
|
/tauri.properties
|
||||||
@@ -1,6 +1,4 @@
|
|||||||
|
|
||||||
import java.util.Properties
|
import java.util.Properties
|
||||||
import java.io.FileInputStream
|
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
id("com.android.application")
|
id("com.android.application")
|
||||||
@@ -15,18 +13,9 @@ val tauriProperties = Properties().apply {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Load release keystore properties
|
|
||||||
val keystoreProperties = Properties().apply {
|
|
||||||
val keystoreFile = rootProject.file("keystore.properties")
|
|
||||||
if (keystoreFile.exists()) {
|
|
||||||
keystoreFile.inputStream().use { load(it) }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdk = 36
|
compileSdk = 36
|
||||||
namespace = "com.lucas.thomann_dsp_app"
|
namespace = "com.lucas.thomann_dsp_app"
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
manifestPlaceholders["usesCleartextTraffic"] = "false"
|
manifestPlaceholders["usesCleartextTraffic"] = "false"
|
||||||
applicationId = "com.lucas.thomann_dsp_app"
|
applicationId = "com.lucas.thomann_dsp_app"
|
||||||
@@ -35,40 +24,20 @@ android {
|
|||||||
versionCode = tauriProperties.getProperty("tauri.android.versionCode", "1").toInt()
|
versionCode = tauriProperties.getProperty("tauri.android.versionCode", "1").toInt()
|
||||||
versionName = tauriProperties.getProperty("tauri.android.versionName", "1.0")
|
versionName = tauriProperties.getProperty("tauri.android.versionName", "1.0")
|
||||||
}
|
}
|
||||||
|
|
||||||
// Release signing configuration
|
|
||||||
signingConfigs {
|
|
||||||
create("release") {
|
|
||||||
val keystorePath = keystoreProperties.getProperty("storeFile")
|
|
||||||
|
|
||||||
if (keystorePath != null) {
|
|
||||||
storeFile = file(keystorePath)
|
|
||||||
storePassword = keystoreProperties.getProperty("password")
|
|
||||||
keyAlias = keystoreProperties.getProperty("keyAlias")
|
|
||||||
keyPassword = keystoreProperties.getProperty("password")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
buildTypes {
|
buildTypes {
|
||||||
getByName("debug") {
|
getByName("debug") {
|
||||||
manifestPlaceholders["usesCleartextTraffic"] = "true"
|
manifestPlaceholders["usesCleartextTraffic"] = "true"
|
||||||
isDebuggable = true
|
isDebuggable = true
|
||||||
isJniDebuggable = true
|
isJniDebuggable = true
|
||||||
isMinifyEnabled = false
|
isMinifyEnabled = false
|
||||||
packaging {
|
packaging { jniLibs.keepDebugSymbols.add("*/arm64-v8a/*.so")
|
||||||
jniLibs.keepDebugSymbols.add("*/arm64-v8a/*.so")
|
|
||||||
jniLibs.keepDebugSymbols.add("*/armeabi-v7a/*.so")
|
jniLibs.keepDebugSymbols.add("*/armeabi-v7a/*.so")
|
||||||
jniLibs.keepDebugSymbols.add("*/x86/*.so")
|
jniLibs.keepDebugSymbols.add("*/x86/*.so")
|
||||||
jniLibs.keepDebugSymbols.add("*/x86_64/*.so")
|
jniLibs.keepDebugSymbols.add("*/x86_64/*.so")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
getByName("release") {
|
getByName("release") {
|
||||||
isMinifyEnabled = true
|
isMinifyEnabled = true
|
||||||
|
|
||||||
signingConfig = signingConfigs.getByName("release")
|
|
||||||
|
|
||||||
proguardFiles(
|
proguardFiles(
|
||||||
*fileTree(".") { include("**/*.pro") }
|
*fileTree(".") { include("**/*.pro") }
|
||||||
.plus(getDefaultProguardFile("proguard-android-optimize.txt"))
|
.plus(getDefaultProguardFile("proguard-android-optimize.txt"))
|
||||||
@@ -76,11 +45,9 @@ android {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
kotlinOptions {
|
kotlinOptions {
|
||||||
jvmTarget = "1.8"
|
jvmTarget = "1.8"
|
||||||
}
|
}
|
||||||
|
|
||||||
buildFeatures {
|
buildFeatures {
|
||||||
buildConfig = true
|
buildConfig = true
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,21 @@
|
|||||||
|
# Add project specific ProGuard rules here.
|
||||||
|
# You can control the set of applied configuration files using the
|
||||||
|
# proguardFiles setting in build.gradle.
|
||||||
|
#
|
||||||
|
# For more details, see
|
||||||
|
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||||
|
|
||||||
|
# If your project uses WebView with JS, uncomment the following
|
||||||
|
# and specify the fully qualified class name to the JavaScript interface
|
||||||
|
# class:
|
||||||
|
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||||
|
# public *;
|
||||||
|
#}
|
||||||
|
|
||||||
|
# Uncomment this to preserve the line number information for
|
||||||
|
# debugging stack traces.
|
||||||
|
#-keepattributes SourceFile,LineNumberTable
|
||||||
|
|
||||||
|
# If you keep the line number information, uncomment this to
|
||||||
|
# hide the original source file name.
|
||||||
|
#-renamesourcefileattribute SourceFile
|
||||||
@@ -7,7 +7,6 @@
|
|||||||
|
|
||||||
<application
|
<application
|
||||||
android:icon="@mipmap/ic_launcher"
|
android:icon="@mipmap/ic_launcher"
|
||||||
android:roundIcon="@mipmap/ic_launcher_round"
|
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
android:theme="@style/Theme.thomann_dsp_app"
|
android:theme="@style/Theme.thomann_dsp_app"
|
||||||
android:usesCleartextTraffic="${usesCleartextTraffic}">
|
android:usesCleartextTraffic="${usesCleartextTraffic}">
|
||||||
|
|||||||
@@ -0,0 +1,11 @@
|
|||||||
|
package com.lucas.thomann_dsp_app
|
||||||
|
|
||||||
|
import android.os.Bundle
|
||||||
|
import androidx.activity.enableEdgeToEdge
|
||||||
|
|
||||||
|
class MainActivity : TauriActivity() {
|
||||||
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
|
enableEdgeToEdge()
|
||||||
|
super.onCreate(savedInstanceState)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
/* THIS FILE IS AUTO-GENERATED. DO NOT MODIFY!! */
|
|
||||||
|
|
||||||
// Copyright 2020-2023 Tauri Programme within The Commons Conservancy
|
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
|
||||||
// SPDX-License-Identifier: MIT
|
|
||||||
|
|
||||||
@file:Suppress("unused")
|
|
||||||
|
|
||||||
package com.lucas.thomann_dsp_app
|
|
||||||
|
|
||||||
import android.webkit.*
|
|
||||||
|
|
||||||
class Ipc(val webView: RustWebView, val webViewClient: RustWebViewClient) {
|
|
||||||
@JavascriptInterface
|
|
||||||
fun postMessage(message: String?) {
|
|
||||||
message?.let {m ->
|
|
||||||
// we're not using WebView::getUrl() here because it needs to be executed on the main thread
|
|
||||||
// and it would slow down the Ipc
|
|
||||||
// so instead we track the current URL on the webview client
|
|
||||||
Rust.ipc(webView.id, webViewClient.currentUrl, m)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,89 +0,0 @@
|
|||||||
/* THIS FILE IS AUTO-GENERATED. DO NOT MODIFY!! */
|
|
||||||
|
|
||||||
// Copyright 2020-2023 Tauri Programme within The Commons Conservancy
|
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
|
||||||
// SPDX-License-Identifier: MIT
|
|
||||||
|
|
||||||
@file:Suppress("unused", "MemberVisibilityCanBePrivate")
|
|
||||||
|
|
||||||
package com.lucas.thomann_dsp_app
|
|
||||||
|
|
||||||
// taken from https://github.com/ionic-team/capacitor/blob/6658bca41e78239347e458175b14ca8bd5c1d6e8/android/capacitor/src/main/java/com/getcapacitor/Logger.java
|
|
||||||
|
|
||||||
import android.text.TextUtils
|
|
||||||
import android.util.Log
|
|
||||||
|
|
||||||
class Logger {
|
|
||||||
companion object {
|
|
||||||
private const val LOG_TAG_CORE = "Tauri"
|
|
||||||
|
|
||||||
fun tags(vararg subtags: String): String {
|
|
||||||
return if (subtags.isNotEmpty()) {
|
|
||||||
LOG_TAG_CORE + "/" + TextUtils.join("/", subtags)
|
|
||||||
} else LOG_TAG_CORE
|
|
||||||
}
|
|
||||||
|
|
||||||
fun verbose(message: String) {
|
|
||||||
verbose(LOG_TAG_CORE, message)
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun verbose(tag: String, message: String) {
|
|
||||||
if (!shouldLog()) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
Log.v(tag, message)
|
|
||||||
}
|
|
||||||
|
|
||||||
fun debug(message: String) {
|
|
||||||
debug(LOG_TAG_CORE, message)
|
|
||||||
}
|
|
||||||
|
|
||||||
fun debug(tag: String, message: String) {
|
|
||||||
if (!shouldLog()) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
Log.d(tag, message)
|
|
||||||
}
|
|
||||||
|
|
||||||
fun info(message: String) {
|
|
||||||
info(LOG_TAG_CORE, message)
|
|
||||||
}
|
|
||||||
|
|
||||||
fun info(tag: String, message: String) {
|
|
||||||
if (!shouldLog()) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
Log.i(tag, message)
|
|
||||||
}
|
|
||||||
|
|
||||||
fun warn(message: String) {
|
|
||||||
warn(LOG_TAG_CORE, message)
|
|
||||||
}
|
|
||||||
|
|
||||||
fun warn(tag: String, message: String) {
|
|
||||||
if (!shouldLog()) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
Log.w(tag, message)
|
|
||||||
}
|
|
||||||
|
|
||||||
fun error(message: String) {
|
|
||||||
error(LOG_TAG_CORE, message, null)
|
|
||||||
}
|
|
||||||
|
|
||||||
fun error(message: String, e: Throwable?) {
|
|
||||||
error(LOG_TAG_CORE, message, e)
|
|
||||||
}
|
|
||||||
|
|
||||||
fun error(tag: String, message: String, e: Throwable?) {
|
|
||||||
if (!shouldLog()) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
Log.e(tag, message, e)
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun shouldLog(): Boolean {
|
|
||||||
return BuildConfig.DEBUG
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,117 +0,0 @@
|
|||||||
/* THIS FILE IS AUTO-GENERATED. DO NOT MODIFY!! */
|
|
||||||
|
|
||||||
// Copyright 2020-2023 Tauri Programme within The Commons Conservancy
|
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
|
||||||
// SPDX-License-Identifier: MIT
|
|
||||||
|
|
||||||
package com.lucas.thomann_dsp_app
|
|
||||||
|
|
||||||
// taken from https://github.com/ionic-team/capacitor/blob/6658bca41e78239347e458175b14ca8bd5c1d6e8/android/capacitor/src/main/java/com/getcapacitor/PermissionHelper.java
|
|
||||||
|
|
||||||
import android.content.Context
|
|
||||||
import android.content.pm.PackageManager
|
|
||||||
import android.os.Build
|
|
||||||
import androidx.core.app.ActivityCompat
|
|
||||||
import java.util.ArrayList
|
|
||||||
|
|
||||||
object PermissionHelper {
|
|
||||||
/**
|
|
||||||
* Checks if a list of given permissions are all granted by the user
|
|
||||||
*
|
|
||||||
* @param permissions Permissions to check.
|
|
||||||
* @return True if all permissions are granted, false if at least one is not.
|
|
||||||
*/
|
|
||||||
fun hasPermissions(context: Context?, permissions: Array<String>): Boolean {
|
|
||||||
for (perm in permissions) {
|
|
||||||
if (ActivityCompat.checkSelfPermission(
|
|
||||||
context!!,
|
|
||||||
perm
|
|
||||||
) != PackageManager.PERMISSION_GRANTED
|
|
||||||
) {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Check whether the given permission has been defined in the AndroidManifest.xml
|
|
||||||
*
|
|
||||||
* @param permission A permission to check.
|
|
||||||
* @return True if the permission has been defined in the Manifest, false if not.
|
|
||||||
*/
|
|
||||||
fun hasDefinedPermission(context: Context, permission: String): Boolean {
|
|
||||||
var hasPermission = false
|
|
||||||
val requestedPermissions = getManifestPermissions(context)
|
|
||||||
if (!requestedPermissions.isNullOrEmpty()) {
|
|
||||||
val requestedPermissionsList = listOf(*requestedPermissions)
|
|
||||||
val requestedPermissionsArrayList = ArrayList(requestedPermissionsList)
|
|
||||||
if (requestedPermissionsArrayList.contains(permission)) {
|
|
||||||
hasPermission = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return hasPermission
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Check whether all of the given permissions have been defined in the AndroidManifest.xml
|
|
||||||
* @param context the app context
|
|
||||||
* @param permissions a list of permissions
|
|
||||||
* @return true only if all permissions are defined in the AndroidManifest.xml
|
|
||||||
*/
|
|
||||||
fun hasDefinedPermissions(context: Context, permissions: Array<String>): Boolean {
|
|
||||||
for (permission in permissions) {
|
|
||||||
if (!hasDefinedPermission(context, permission)) {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the permissions defined in AndroidManifest.xml
|
|
||||||
*
|
|
||||||
* @return The permissions defined in AndroidManifest.xml
|
|
||||||
*/
|
|
||||||
private fun getManifestPermissions(context: Context): Array<String>? {
|
|
||||||
var requestedPermissions: Array<String>? = null
|
|
||||||
try {
|
|
||||||
val pm = context.packageManager
|
|
||||||
val packageInfo = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
|
|
||||||
pm.getPackageInfo(context.packageName, PackageManager.PackageInfoFlags.of(PackageManager.GET_PERMISSIONS.toLong()))
|
|
||||||
} else {
|
|
||||||
@Suppress("DEPRECATION")
|
|
||||||
pm.getPackageInfo(context.packageName, PackageManager.GET_PERMISSIONS)
|
|
||||||
}
|
|
||||||
if (packageInfo != null) {
|
|
||||||
requestedPermissions = packageInfo.requestedPermissions
|
|
||||||
}
|
|
||||||
} catch (_: Exception) {
|
|
||||||
}
|
|
||||||
return requestedPermissions
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Given a list of permissions, return a new list with the ones not present in AndroidManifest.xml
|
|
||||||
*
|
|
||||||
* @param neededPermissions The permissions needed.
|
|
||||||
* @return The permissions not present in AndroidManifest.xml
|
|
||||||
*/
|
|
||||||
fun getUndefinedPermissions(context: Context, neededPermissions: Array<String?>): Array<String?> {
|
|
||||||
val undefinedPermissions = ArrayList<String?>()
|
|
||||||
val requestedPermissions = getManifestPermissions(context)
|
|
||||||
if (!requestedPermissions.isNullOrEmpty()) {
|
|
||||||
val requestedPermissionsList = listOf(*requestedPermissions)
|
|
||||||
val requestedPermissionsArrayList = ArrayList(requestedPermissionsList)
|
|
||||||
for (permission in neededPermissions) {
|
|
||||||
if (!requestedPermissionsArrayList.contains(permission)) {
|
|
||||||
undefinedPermissions.add(permission)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
var undefinedPermissionArray = arrayOfNulls<String>(undefinedPermissions.size)
|
|
||||||
undefinedPermissionArray = undefinedPermissions.toArray(undefinedPermissionArray)
|
|
||||||
return undefinedPermissionArray
|
|
||||||
}
|
|
||||||
return neededPermissions
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,46 +0,0 @@
|
|||||||
/* THIS FILE IS AUTO-GENERATED. DO NOT MODIFY!! */
|
|
||||||
|
|
||||||
// Copyright 2020-2023 Tauri Programme within The Commons Conservancy
|
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
|
||||||
// SPDX-License-Identifier: MIT
|
|
||||||
|
|
||||||
@file:Suppress("unused")
|
|
||||||
|
|
||||||
package com.lucas.thomann_dsp_app
|
|
||||||
|
|
||||||
import android.content.Intent
|
|
||||||
import android.webkit.WebView
|
|
||||||
import android.webkit.WebResourceRequest
|
|
||||||
import android.webkit.WebResourceResponse
|
|
||||||
|
|
||||||
object Rust {
|
|
||||||
init {
|
|
||||||
System.loadLibrary("thomann_dsp_app_lib")
|
|
||||||
}
|
|
||||||
|
|
||||||
// Tao bindings
|
|
||||||
@JvmStatic external fun onFirstActivityCreate()
|
|
||||||
@JvmStatic external fun onCreate(activity: WryActivity)
|
|
||||||
@JvmStatic external fun onStart(activity: WryActivity)
|
|
||||||
@JvmStatic external fun onResume(activity: WryActivity)
|
|
||||||
@JvmStatic external fun onPause(activity: WryActivity)
|
|
||||||
@JvmStatic external fun onStop(activity: WryActivity)
|
|
||||||
@JvmStatic external fun onDestroy(activity: WryActivity)
|
|
||||||
@JvmStatic external fun onWindowFocusChanged(activity: WryActivity, focus: Boolean)
|
|
||||||
@JvmStatic external fun onLowMemory()
|
|
||||||
@JvmStatic external fun onNewIntent(intent: Intent)
|
|
||||||
|
|
||||||
@JvmStatic external fun onFirstActivityCreateWry()
|
|
||||||
@JvmStatic external fun onWebviewDestroy(activity: WryActivity, webviewId: String)
|
|
||||||
|
|
||||||
@JvmStatic external fun ipc(webviewId: String, url: String, message: String)
|
|
||||||
|
|
||||||
@JvmStatic external fun assetLoaderDomain(webviewId: String): String?
|
|
||||||
@JvmStatic external fun handleRequest(webviewId: String, request: WebResourceRequest, isDocumentStartScriptEnabled: Boolean): WebResourceResponse?
|
|
||||||
@JvmStatic external fun shouldOverride(webviewId: String, url: String): Boolean
|
|
||||||
@JvmStatic external fun onPageLoading(webviewId: String, url: String)
|
|
||||||
@JvmStatic external fun onPageLoaded(webviewId: String, url: String)
|
|
||||||
@JvmStatic external fun onEval(webviewId: String, id: Int, result: String)
|
|
||||||
|
|
||||||
@JvmStatic external fun handleReceivedTitle(webviewId: String, title: String)
|
|
||||||
}
|
|
||||||
@@ -1,519 +0,0 @@
|
|||||||
/* THIS FILE IS AUTO-GENERATED. DO NOT MODIFY!! */
|
|
||||||
|
|
||||||
// Copyright 2020-2023 Tauri Programme within The Commons Conservancy
|
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
|
||||||
// SPDX-License-Identifier: MIT
|
|
||||||
|
|
||||||
@file:Suppress("ObsoleteSdkInt", "RedundantOverride", "QueryPermissionsNeeded", "SimpleDateFormat")
|
|
||||||
|
|
||||||
package com.lucas.thomann_dsp_app
|
|
||||||
|
|
||||||
// taken from https://github.com/ionic-team/capacitor/blob/6658bca41e78239347e458175b14ca8bd5c1d6e8/android/capacitor/src/main/java/com/getcapacitor/BridgeWebChromeClient.java
|
|
||||||
|
|
||||||
import android.Manifest
|
|
||||||
import android.app.Activity
|
|
||||||
import android.app.AlertDialog
|
|
||||||
import android.content.ActivityNotFoundException
|
|
||||||
import android.content.DialogInterface
|
|
||||||
import android.content.Intent
|
|
||||||
import android.graphics.Bitmap
|
|
||||||
import android.net.Uri
|
|
||||||
import android.os.Build
|
|
||||||
import android.os.Environment
|
|
||||||
import android.provider.MediaStore
|
|
||||||
import android.view.View
|
|
||||||
import android.webkit.*
|
|
||||||
import android.widget.EditText
|
|
||||||
import androidx.core.content.FileProvider
|
|
||||||
import java.io.File
|
|
||||||
import java.io.IOException
|
|
||||||
import java.text.SimpleDateFormat
|
|
||||||
import java.util.*
|
|
||||||
|
|
||||||
class RustWebChromeClient(private val activity: WryActivity, private val webViewId: String) : WebChromeClient() {
|
|
||||||
private companion object {
|
|
||||||
const val PERMISSION_REQUEST_DEFAULT = 0
|
|
||||||
const val PERMISSION_REQUEST_ALLOW = 1
|
|
||||||
const val PERMISSION_REQUEST_DENY = 2
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Render web content in `view`.
|
|
||||||
*
|
|
||||||
* Both this method and [.onHideCustomView] are required for
|
|
||||||
* rendering web content in full screen.
|
|
||||||
*
|
|
||||||
* @see [](https://developer.android.com/reference/android/webkit/WebChromeClient.onShowCustomView
|
|
||||||
) */
|
|
||||||
override fun onShowCustomView(view: View, callback: CustomViewCallback) {
|
|
||||||
callback.onCustomViewHidden()
|
|
||||||
super.onShowCustomView(view, callback)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Render web content in the original Web View again.
|
|
||||||
*
|
|
||||||
* Do not remove this method--@see #onShowCustomView(View, CustomViewCallback).
|
|
||||||
*/
|
|
||||||
override fun onHideCustomView() {
|
|
||||||
super.onHideCustomView()
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onPermissionRequest(request: PermissionRequest) {
|
|
||||||
val requestedResources = request.resources
|
|
||||||
if (requestedResources.isEmpty()) {
|
|
||||||
request.deny()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
val allowedResources = ArrayList<String>()
|
|
||||||
val defaultResources = ArrayList<String>()
|
|
||||||
|
|
||||||
for (resource in requestedResources) {
|
|
||||||
when (onPermissionRequestNative(webViewId, resource)) {
|
|
||||||
PERMISSION_REQUEST_DENY -> {}
|
|
||||||
PERMISSION_REQUEST_ALLOW -> allowedResources.add(resource)
|
|
||||||
PERMISSION_REQUEST_DEFAULT -> defaultResources.add(resource)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
val resources =
|
|
||||||
allowedResources.plus(filterKnownPermissions(defaultResources)).toList().toTypedArray()
|
|
||||||
grantPermissionRequest(request, resources)
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun grantPermissionRequest(request: PermissionRequest, resources: Array<String>) {
|
|
||||||
if (resources.isEmpty()) {
|
|
||||||
request.deny()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
val isRequestPermissionRequired = Build.VERSION.SDK_INT >= Build.VERSION_CODES.M
|
|
||||||
val permissionList = androidPermissionsForResources(resources)
|
|
||||||
if (permissionList.isNotEmpty() && isRequestPermissionRequired) {
|
|
||||||
val permissions = permissionList.toTypedArray()
|
|
||||||
activity.requestPermissions(permissions) { isGranted ->
|
|
||||||
if (isGranted == true) {
|
|
||||||
request.grant(resources)
|
|
||||||
} else {
|
|
||||||
request.deny()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
request.grant(resources)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun androidPermissionsForResources(resources: Array<String>): MutableList<String> {
|
|
||||||
val permissionList: MutableList<String> = ArrayList()
|
|
||||||
if (resources.contains(PermissionRequest.RESOURCE_VIDEO_CAPTURE)) {
|
|
||||||
permissionList.add(Manifest.permission.CAMERA)
|
|
||||||
}
|
|
||||||
if (resources.contains(PermissionRequest.RESOURCE_AUDIO_CAPTURE)) {
|
|
||||||
permissionList.add(Manifest.permission.MODIFY_AUDIO_SETTINGS)
|
|
||||||
permissionList.add(Manifest.permission.RECORD_AUDIO)
|
|
||||||
}
|
|
||||||
return permissionList
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return one of the PERMISSION_REQUEST_* constants.
|
|
||||||
*/
|
|
||||||
private external fun onPermissionRequestNative(webviewId: String, resource: String): Int
|
|
||||||
|
|
||||||
override fun getDefaultVideoPoster(): Bitmap {
|
|
||||||
// Return a transparent bitmap so Chromium doesn't paint its default gray play-button placeholder on <video> elements.
|
|
||||||
// Matches react-native-webview's approach — see https://github.com/react-native-webview/react-native-webview/blob/58daac9e2e532ca1dcb49003b86568218b9b2b1d/android/src/main/java/com/reactnativecommunity/webview/RNCWebViewManager.kt
|
|
||||||
return Bitmap.createBitmap(50, 50, Bitmap.Config.ARGB_8888)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return true when Rust denies geolocation; false continues the normal Android permission flow.
|
|
||||||
*/
|
|
||||||
private external fun onGeolocationPermissionRequestNative(webviewId: String, origin: String): Boolean
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Show the browser alert modal
|
|
||||||
* @param view
|
|
||||||
* @param url
|
|
||||||
* @param message
|
|
||||||
* @param result
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
override fun onJsAlert(view: WebView, url: String, message: String, result: JsResult): Boolean {
|
|
||||||
if (activity.isFinishing) {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
val builder = AlertDialog.Builder(view.context)
|
|
||||||
builder
|
|
||||||
.setMessage(message)
|
|
||||||
.setPositiveButton(
|
|
||||||
"OK"
|
|
||||||
) { dialog: DialogInterface, _: Int ->
|
|
||||||
dialog.dismiss()
|
|
||||||
result.confirm()
|
|
||||||
}
|
|
||||||
.setOnCancelListener { dialog: DialogInterface ->
|
|
||||||
dialog.dismiss()
|
|
||||||
result.cancel()
|
|
||||||
}
|
|
||||||
val dialog = builder.create()
|
|
||||||
dialog.show()
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Show the browser confirm modal
|
|
||||||
* @param view
|
|
||||||
* @param url
|
|
||||||
* @param message
|
|
||||||
* @param result
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
override fun onJsConfirm(view: WebView, url: String, message: String, result: JsResult): Boolean {
|
|
||||||
if (activity.isFinishing) {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
val builder = AlertDialog.Builder(view.context)
|
|
||||||
builder
|
|
||||||
.setMessage(message)
|
|
||||||
.setPositiveButton(
|
|
||||||
"OK"
|
|
||||||
) { dialog: DialogInterface, _: Int ->
|
|
||||||
dialog.dismiss()
|
|
||||||
result.confirm()
|
|
||||||
}
|
|
||||||
.setNegativeButton(
|
|
||||||
"Cancel"
|
|
||||||
) { dialog: DialogInterface, _: Int ->
|
|
||||||
dialog.dismiss()
|
|
||||||
result.cancel()
|
|
||||||
}
|
|
||||||
.setOnCancelListener { dialog: DialogInterface ->
|
|
||||||
dialog.dismiss()
|
|
||||||
result.cancel()
|
|
||||||
}
|
|
||||||
val dialog = builder.create()
|
|
||||||
dialog.show()
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Show the browser prompt modal
|
|
||||||
* @param view
|
|
||||||
* @param url
|
|
||||||
* @param message
|
|
||||||
* @param defaultValue
|
|
||||||
* @param result
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
override fun onJsPrompt(
|
|
||||||
view: WebView,
|
|
||||||
url: String,
|
|
||||||
message: String,
|
|
||||||
defaultValue: String,
|
|
||||||
result: JsPromptResult
|
|
||||||
): Boolean {
|
|
||||||
if (activity.isFinishing) {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
val builder = AlertDialog.Builder(view.context)
|
|
||||||
val input = EditText(view.context)
|
|
||||||
builder
|
|
||||||
.setMessage(message)
|
|
||||||
.setView(input)
|
|
||||||
.setPositiveButton(
|
|
||||||
"OK"
|
|
||||||
) { dialog: DialogInterface, _: Int ->
|
|
||||||
dialog.dismiss()
|
|
||||||
val inputText1 = input.text.toString().trim { it <= ' ' }
|
|
||||||
result.confirm(inputText1)
|
|
||||||
}
|
|
||||||
.setNegativeButton(
|
|
||||||
"Cancel"
|
|
||||||
) { dialog: DialogInterface, _: Int ->
|
|
||||||
dialog.dismiss()
|
|
||||||
result.cancel()
|
|
||||||
}
|
|
||||||
.setOnCancelListener { dialog: DialogInterface ->
|
|
||||||
dialog.dismiss()
|
|
||||||
result.cancel()
|
|
||||||
}
|
|
||||||
val dialog = builder.create()
|
|
||||||
dialog.show()
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Handle the browser geolocation permission prompt
|
|
||||||
* @param origin
|
|
||||||
* @param callback
|
|
||||||
*/
|
|
||||||
override fun onGeolocationPermissionsShowPrompt(
|
|
||||||
origin: String,
|
|
||||||
callback: GeolocationPermissions.Callback
|
|
||||||
) {
|
|
||||||
super.onGeolocationPermissionsShowPrompt(origin, callback)
|
|
||||||
if (onGeolocationPermissionRequestNative(webViewId, origin)) {
|
|
||||||
callback.invoke(origin, false, false)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
Logger.debug("onGeolocationPermissionsShowPrompt: DOING IT HERE FOR ORIGIN: $origin")
|
|
||||||
val geoPermissions = definedGeolocationPermissions()
|
|
||||||
if (geoPermissions.isEmpty()) {
|
|
||||||
callback.invoke(origin, false, false)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!PermissionHelper.hasPermissions(activity, geoPermissions)) {
|
|
||||||
activity.requestPermissions(geoPermissions) { isGranted ->
|
|
||||||
if (isGranted == true) {
|
|
||||||
callback.invoke(origin, true, false)
|
|
||||||
} else {
|
|
||||||
val coarsePermission =
|
|
||||||
arrayOf(Manifest.permission.ACCESS_COARSE_LOCATION)
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S &&
|
|
||||||
PermissionHelper.hasPermissions(activity, coarsePermission)
|
|
||||||
) {
|
|
||||||
callback.invoke(origin, true, false)
|
|
||||||
} else {
|
|
||||||
callback.invoke(origin, false, false)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// permission is already granted
|
|
||||||
callback.invoke(origin, true, false)
|
|
||||||
Logger.debug("onGeolocationPermissionsShowPrompt: has required permission")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun filterKnownPermissions(resources: List<String>): Array<String> {
|
|
||||||
return resources.filter {
|
|
||||||
it == PermissionRequest.RESOURCE_AUDIO_CAPTURE ||
|
|
||||||
it == PermissionRequest.RESOURCE_VIDEO_CAPTURE ||
|
|
||||||
it == PermissionRequest.RESOURCE_PROTECTED_MEDIA_ID ||
|
|
||||||
it == PermissionRequest.RESOURCE_MIDI_SYSEX
|
|
||||||
}.toTypedArray()
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun definedGeolocationPermissions(): Array<String> {
|
|
||||||
val permissions = ArrayList<String>()
|
|
||||||
if (PermissionHelper.hasDefinedPermission(activity, Manifest.permission.ACCESS_COARSE_LOCATION)) {
|
|
||||||
permissions.add(Manifest.permission.ACCESS_COARSE_LOCATION)
|
|
||||||
}
|
|
||||||
if (PermissionHelper.hasDefinedPermission(activity, Manifest.permission.ACCESS_FINE_LOCATION)) {
|
|
||||||
permissions.add(Manifest.permission.ACCESS_FINE_LOCATION)
|
|
||||||
}
|
|
||||||
return permissions.toTypedArray()
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onShowFileChooser(
|
|
||||||
webView: WebView,
|
|
||||||
filePathCallback: ValueCallback<Array<Uri?>?>,
|
|
||||||
fileChooserParams: FileChooserParams
|
|
||||||
): Boolean {
|
|
||||||
val acceptTypes = listOf(*fileChooserParams.acceptTypes)
|
|
||||||
val captureEnabled = fileChooserParams.isCaptureEnabled
|
|
||||||
val capturePhoto = captureEnabled && acceptTypes.contains("image/*")
|
|
||||||
val captureVideo = captureEnabled && acceptTypes.contains("video/*")
|
|
||||||
if (capturePhoto || captureVideo) {
|
|
||||||
if (isMediaCaptureSupported) {
|
|
||||||
showMediaCaptureOrFilePicker(filePathCallback, fileChooserParams, captureVideo)
|
|
||||||
} else {
|
|
||||||
val camPermission = arrayOf(Manifest.permission.CAMERA)
|
|
||||||
activity.requestPermissions(camPermission) { isGranted ->
|
|
||||||
if (isGranted == true) {
|
|
||||||
showMediaCaptureOrFilePicker(filePathCallback, fileChooserParams, captureVideo)
|
|
||||||
} else {
|
|
||||||
Logger.warn(Logger.tags("FileChooser"), "Camera permission not granted")
|
|
||||||
filePathCallback.onReceiveValue(null)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
showFilePicker(filePathCallback, fileChooserParams)
|
|
||||||
}
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
private val isMediaCaptureSupported: Boolean
|
|
||||||
get() {
|
|
||||||
val permissions = arrayOf(Manifest.permission.CAMERA)
|
|
||||||
return PermissionHelper.hasPermissions(activity, permissions) ||
|
|
||||||
!PermissionHelper.hasDefinedPermission(activity, Manifest.permission.CAMERA)
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun showMediaCaptureOrFilePicker(
|
|
||||||
filePathCallback: ValueCallback<Array<Uri?>?>,
|
|
||||||
fileChooserParams: FileChooserParams,
|
|
||||||
isVideo: Boolean
|
|
||||||
) {
|
|
||||||
val isVideoCaptureSupported = true
|
|
||||||
val shown = if (isVideo && isVideoCaptureSupported) {
|
|
||||||
showVideoCapturePicker(filePathCallback)
|
|
||||||
} else {
|
|
||||||
showImageCapturePicker(filePathCallback)
|
|
||||||
}
|
|
||||||
if (!shown) {
|
|
||||||
Logger.warn(
|
|
||||||
Logger.tags("FileChooser"),
|
|
||||||
"Media capture intent could not be launched. Falling back to default file picker."
|
|
||||||
)
|
|
||||||
showFilePicker(filePathCallback, fileChooserParams)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun showImageCapturePicker(filePathCallback: ValueCallback<Array<Uri?>?>): Boolean {
|
|
||||||
val takePictureIntent = Intent(MediaStore.ACTION_IMAGE_CAPTURE)
|
|
||||||
if (takePictureIntent.resolveActivity(activity.packageManager) == null) {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
val imageFileUri: Uri = try {
|
|
||||||
createImageFileUri()
|
|
||||||
} catch (ex: Exception) {
|
|
||||||
Logger.error("Unable to create temporary media capture file: " + ex.message)
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, imageFileUri)
|
|
||||||
activity.launchActivityForResult(takePictureIntent) { result ->
|
|
||||||
var res: Array<Uri?>? = null
|
|
||||||
if (result?.resultCode == Activity.RESULT_OK) {
|
|
||||||
res = arrayOf(imageFileUri)
|
|
||||||
}
|
|
||||||
filePathCallback.onReceiveValue(res)
|
|
||||||
}
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun showVideoCapturePicker(filePathCallback: ValueCallback<Array<Uri?>?>): Boolean {
|
|
||||||
val takeVideoIntent = Intent(MediaStore.ACTION_VIDEO_CAPTURE)
|
|
||||||
if (takeVideoIntent.resolveActivity(activity.packageManager) == null) {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
activity.launchActivityForResult(takeVideoIntent) { result ->
|
|
||||||
var res: Array<Uri?>? = null
|
|
||||||
if (result?.resultCode == Activity.RESULT_OK) {
|
|
||||||
res = arrayOf(result.data!!.data)
|
|
||||||
}
|
|
||||||
filePathCallback.onReceiveValue(res)
|
|
||||||
}
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun showFilePicker(
|
|
||||||
filePathCallback: ValueCallback<Array<Uri?>?>,
|
|
||||||
fileChooserParams: FileChooserParams
|
|
||||||
) {
|
|
||||||
val intent = fileChooserParams.createIntent()
|
|
||||||
if (fileChooserParams.mode == FileChooserParams.MODE_OPEN_MULTIPLE) {
|
|
||||||
intent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true)
|
|
||||||
}
|
|
||||||
if (fileChooserParams.acceptTypes.size > 1 || intent.type!!.startsWith(".")) {
|
|
||||||
val validTypes = getValidTypes(fileChooserParams.acceptTypes)
|
|
||||||
intent.putExtra(Intent.EXTRA_MIME_TYPES, validTypes)
|
|
||||||
if (intent.type!!.startsWith(".")) {
|
|
||||||
intent.type = validTypes[0]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
activity.launchActivityForResult(intent) { result ->
|
|
||||||
val res: Array<Uri?>?
|
|
||||||
val resultIntent = result?.data
|
|
||||||
if (result?.resultCode == Activity.RESULT_OK && resultIntent!!.clipData != null) {
|
|
||||||
val numFiles = resultIntent.clipData!!.itemCount
|
|
||||||
res = arrayOfNulls(numFiles)
|
|
||||||
for (i in 0 until numFiles) {
|
|
||||||
res[i] = resultIntent.clipData!!.getItemAt(i).uri
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
res = FileChooserParams.parseResult(
|
|
||||||
result?.resultCode ?: 0,
|
|
||||||
resultIntent
|
|
||||||
)
|
|
||||||
}
|
|
||||||
filePathCallback.onReceiveValue(res)
|
|
||||||
}
|
|
||||||
} catch (e: ActivityNotFoundException) {
|
|
||||||
filePathCallback.onReceiveValue(null)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun getValidTypes(currentTypes: Array<String>): Array<String> {
|
|
||||||
val validTypes: MutableList<String> = ArrayList()
|
|
||||||
val mtm = MimeTypeMap.getSingleton()
|
|
||||||
for (mime in currentTypes) {
|
|
||||||
if (mime.startsWith(".")) {
|
|
||||||
val extension = mime.substring(1)
|
|
||||||
val extensionMime = mtm.getMimeTypeFromExtension(extension)
|
|
||||||
if (extensionMime != null && !validTypes.contains(extensionMime)) {
|
|
||||||
validTypes.add(extensionMime)
|
|
||||||
}
|
|
||||||
} else if (!validTypes.contains(mime)) {
|
|
||||||
validTypes.add(mime)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
val validObj: Array<Any> = validTypes.toTypedArray()
|
|
||||||
return Arrays.copyOf(
|
|
||||||
validObj, validObj.size,
|
|
||||||
Array<String>::class.java
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onConsoleMessage(consoleMessage: ConsoleMessage): Boolean {
|
|
||||||
val tag: String = Logger.tags("Console")
|
|
||||||
if (consoleMessage.message() != null && isValidMsg(consoleMessage.message())) {
|
|
||||||
val msg = String.format(
|
|
||||||
"File: %s - Line %d - Msg: %s",
|
|
||||||
consoleMessage.sourceId(),
|
|
||||||
consoleMessage.lineNumber(),
|
|
||||||
consoleMessage.message()
|
|
||||||
)
|
|
||||||
val level = consoleMessage.messageLevel().name
|
|
||||||
if ("ERROR".equals(level, ignoreCase = true)) {
|
|
||||||
Logger.error(tag, msg, null)
|
|
||||||
} else if ("WARNING".equals(level, ignoreCase = true)) {
|
|
||||||
Logger.warn(tag, msg)
|
|
||||||
} else if ("TIP".equals(level, ignoreCase = true)) {
|
|
||||||
Logger.debug(tag, msg)
|
|
||||||
} else {
|
|
||||||
Logger.info(tag, msg)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun isValidMsg(msg: String): Boolean {
|
|
||||||
return !(msg.contains("%cresult %c") ||
|
|
||||||
msg.contains("%cnative %c") ||
|
|
||||||
msg.equals("[object Object]", ignoreCase = true) ||
|
|
||||||
msg.equals("console.groupEnd", ignoreCase = true))
|
|
||||||
}
|
|
||||||
|
|
||||||
@Throws(IOException::class)
|
|
||||||
private fun createImageFileUri(): Uri {
|
|
||||||
val photoFile = createImageFile(activity)
|
|
||||||
return FileProvider.getUriForFile(
|
|
||||||
activity,
|
|
||||||
activity.packageName.toString() + ".fileprovider",
|
|
||||||
photoFile
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
@Throws(IOException::class)
|
|
||||||
private fun createImageFile(activity: Activity): File {
|
|
||||||
// Create an image file name
|
|
||||||
val timeStamp = SimpleDateFormat("yyyyMMdd_HHmmss").format(Date())
|
|
||||||
val imageFileName = "JPEG_" + timeStamp + "_"
|
|
||||||
val storageDir = activity.getExternalFilesDir(Environment.DIRECTORY_PICTURES)
|
|
||||||
return File.createTempFile(imageFileName, ".jpg", storageDir)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onReceivedTitle(
|
|
||||||
view: WebView,
|
|
||||||
title: String
|
|
||||||
) {
|
|
||||||
Rust.handleReceivedTitle((view as RustWebView).id, title)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,98 +0,0 @@
|
|||||||
/* THIS FILE IS AUTO-GENERATED. DO NOT MODIFY!! */
|
|
||||||
|
|
||||||
// Copyright 2020-2023 Tauri Programme within The Commons Conservancy
|
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
|
||||||
// SPDX-License-Identifier: MIT
|
|
||||||
|
|
||||||
@file:Suppress("unused", "SetJavaScriptEnabled")
|
|
||||||
|
|
||||||
package com.lucas.thomann_dsp_app
|
|
||||||
|
|
||||||
import android.annotation.SuppressLint
|
|
||||||
import android.webkit.*
|
|
||||||
import android.content.Context
|
|
||||||
import androidx.webkit.WebViewCompat
|
|
||||||
import androidx.webkit.WebViewFeature
|
|
||||||
import kotlin.collections.Map
|
|
||||||
|
|
||||||
@SuppressLint("RestrictedApi")
|
|
||||||
class RustWebView(context: Context, val initScripts: Array<String>, val id: String): WebView(context) {
|
|
||||||
val isDocumentStartScriptEnabled: Boolean
|
|
||||||
|
|
||||||
init {
|
|
||||||
settings.javaScriptEnabled = true
|
|
||||||
settings.domStorageEnabled = true
|
|
||||||
settings.setGeolocationEnabled(true)
|
|
||||||
settings.databaseEnabled = true
|
|
||||||
settings.mediaPlaybackRequiresUserGesture = false
|
|
||||||
settings.javaScriptCanOpenWindowsAutomatically = true
|
|
||||||
|
|
||||||
if (WebViewFeature.isFeatureSupported(WebViewFeature.DOCUMENT_START_SCRIPT)) {
|
|
||||||
isDocumentStartScriptEnabled = true
|
|
||||||
for (script in initScripts) {
|
|
||||||
WebViewCompat.addDocumentStartJavaScript(this, script, setOf("*"));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
isDocumentStartScriptEnabled = false
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
fun loadUrlMainThread(url: String) {
|
|
||||||
post {
|
|
||||||
loadUrl(url)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fun loadUrlMainThread(url: String, additionalHttpHeaders: Map<String, String>) {
|
|
||||||
post {
|
|
||||||
loadUrl(url, additionalHttpHeaders)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun loadUrl(url: String) {
|
|
||||||
if (!Rust.shouldOverride(id, url)) {
|
|
||||||
super.loadUrl(url);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun loadUrl(url: String, additionalHttpHeaders: Map<String, String>) {
|
|
||||||
if (!Rust.shouldOverride(id, url)) {
|
|
||||||
super.loadUrl(url, additionalHttpHeaders);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fun loadHTMLMainThread(html: String) {
|
|
||||||
post {
|
|
||||||
super.loadData(html, "text/html", null)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fun evalScript(id: Int, script: String) {
|
|
||||||
post {
|
|
||||||
super.evaluateJavascript(script) { result ->
|
|
||||||
Rust.onEval(this.id, id, result)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fun clearAllBrowsingData() {
|
|
||||||
try {
|
|
||||||
super.getContext().deleteDatabase("webviewCache.db")
|
|
||||||
super.getContext().deleteDatabase("webview.db")
|
|
||||||
super.clearCache(true)
|
|
||||||
super.clearHistory()
|
|
||||||
super.clearFormData()
|
|
||||||
} catch (ex: Exception) {
|
|
||||||
Logger.error("Unable to create temporary media capture file: " + ex.message)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fun getCookies(url: String): String {
|
|
||||||
val cookieManager = CookieManager.getInstance()
|
|
||||||
return cookieManager.getCookie(url)
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,103 +0,0 @@
|
|||||||
/* THIS FILE IS AUTO-GENERATED. DO NOT MODIFY!! */
|
|
||||||
|
|
||||||
// Copyright 2020-2023 Tauri Programme within The Commons Conservancy
|
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
|
||||||
// SPDX-License-Identifier: MIT
|
|
||||||
|
|
||||||
package com.lucas.thomann_dsp_app
|
|
||||||
|
|
||||||
import android.net.Uri
|
|
||||||
import android.webkit.*
|
|
||||||
import android.content.Context
|
|
||||||
import android.graphics.Bitmap
|
|
||||||
import android.os.Handler
|
|
||||||
import android.os.Looper
|
|
||||||
import androidx.webkit.WebViewAssetLoader
|
|
||||||
|
|
||||||
class RustWebViewClient(webView: RustWebView, context: Context): WebViewClient() {
|
|
||||||
private val interceptedState = mutableMapOf<String, Boolean>()
|
|
||||||
var currentUrl: String = "about:blank"
|
|
||||||
private var lastInterceptedUrl: Uri? = null
|
|
||||||
private var pendingUrlRedirect: String? = null
|
|
||||||
|
|
||||||
private val assetLoader = Rust.assetLoaderDomain(webView.id)?.let { domain ->
|
|
||||||
WebViewAssetLoader.Builder()
|
|
||||||
.setDomain(domain)
|
|
||||||
.addPathHandler("/", WebViewAssetLoader.AssetsPathHandler(context))
|
|
||||||
.build()
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun shouldInterceptRequest(
|
|
||||||
view: WebView,
|
|
||||||
request: WebResourceRequest
|
|
||||||
): WebResourceResponse? {
|
|
||||||
pendingUrlRedirect?.let {
|
|
||||||
Handler(Looper.getMainLooper()).post {
|
|
||||||
view.loadUrl(it)
|
|
||||||
}
|
|
||||||
pendingUrlRedirect = null
|
|
||||||
return null
|
|
||||||
}
|
|
||||||
|
|
||||||
lastInterceptedUrl = request.url
|
|
||||||
return if (assetLoader != null) {
|
|
||||||
assetLoader.shouldInterceptRequest(request.url)
|
|
||||||
} else {
|
|
||||||
val rustWebView = view as RustWebView
|
|
||||||
val response = Rust.handleRequest(rustWebView.id, request, rustWebView.isDocumentStartScriptEnabled)
|
|
||||||
if (response != null) {
|
|
||||||
if (response.responseHeaders != null) {
|
|
||||||
response.responseHeaders["Cache-Control"] = "no-store"
|
|
||||||
} else {
|
|
||||||
response.responseHeaders = mapOf("Cache-Control" to "no-store")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
interceptedState[request.url.toString()] = response != null
|
|
||||||
return response
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun shouldOverrideUrlLoading(
|
|
||||||
view: WebView,
|
|
||||||
request: WebResourceRequest
|
|
||||||
): Boolean {
|
|
||||||
return Rust.shouldOverride((view as RustWebView).id, request.url.toString())
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onPageStarted(view: WebView, url: String, favicon: Bitmap?) {
|
|
||||||
currentUrl = url
|
|
||||||
if (interceptedState[url] == false) {
|
|
||||||
val webView = view as RustWebView
|
|
||||||
for (script in webView.initScripts) {
|
|
||||||
view.evaluateJavascript(script, null)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return Rust.onPageLoading((view as RustWebView).id, url)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onPageFinished(view: WebView, url: String) {
|
|
||||||
Rust.onPageLoaded((view as RustWebView).id, url)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onReceivedError(
|
|
||||||
view: WebView,
|
|
||||||
request: WebResourceRequest,
|
|
||||||
error: WebResourceError
|
|
||||||
) {
|
|
||||||
// we get a net::ERR_CONNECTION_REFUSED when an external URL redirects to a custom protocol
|
|
||||||
// e.g. oauth flow, because shouldInterceptRequest is not called on redirects
|
|
||||||
// so we must force retry here with loadUrl() to get a chance of the custom protocol to kick in
|
|
||||||
if (error.errorCode == ERROR_CONNECT && request.isForMainFrame && request.url != lastInterceptedUrl) {
|
|
||||||
// prevent the default error page from showing
|
|
||||||
view.stopLoading()
|
|
||||||
// without this initial loadUrl the app is stuck
|
|
||||||
view.loadUrl(request.url.toString())
|
|
||||||
// ensure the URL is actually loaded - for some reason there's a race condition and we need to call loadUrl() again later
|
|
||||||
pendingUrlRedirect = request.url.toString()
|
|
||||||
} else {
|
|
||||||
super.onReceivedError(view, request, error)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,60 +0,0 @@
|
|||||||
// Copyright 2019-2024 Tauri Programme within The Commons Conservancy
|
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
|
||||||
// SPDX-License-Identifier: MIT
|
|
||||||
|
|
||||||
/* THIS FILE IS AUTO-GENERATED. DO NOT MODIFY!! */
|
|
||||||
|
|
||||||
package com.lucas.thomann_dsp_app
|
|
||||||
|
|
||||||
import android.content.Intent
|
|
||||||
import android.content.res.Configuration
|
|
||||||
import android.os.Bundle
|
|
||||||
import app.tauri.plugin.PluginManager
|
|
||||||
|
|
||||||
abstract class TauriActivity : WryActivity() {
|
|
||||||
override val handleBackNavigation: Boolean = false
|
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
|
||||||
super.onCreate(savedInstanceState)
|
|
||||||
PluginManager.onCreate(this)
|
|
||||||
}
|
|
||||||
|
|
||||||
fun getPluginManager(): PluginManager {
|
|
||||||
return PluginManager
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onNewIntent(intent: Intent) {
|
|
||||||
super.onNewIntent(intent)
|
|
||||||
PluginManager.onNewIntent(intent)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onRestart() {
|
|
||||||
super.onRestart()
|
|
||||||
PluginManager.onRestart(this)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onResume() {
|
|
||||||
super.onResume()
|
|
||||||
PluginManager.onResume(this)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onPause() {
|
|
||||||
super.onPause()
|
|
||||||
PluginManager.onPause(this)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onStop() {
|
|
||||||
super.onStop()
|
|
||||||
PluginManager.onStop(this)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onDestroy() {
|
|
||||||
super.onDestroy()
|
|
||||||
PluginManager.onDestroy(this)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onConfigurationChanged(newConfig: Configuration) {
|
|
||||||
super.onConfigurationChanged(newConfig)
|
|
||||||
PluginManager.onConfigurationChanged(newConfig)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,199 +0,0 @@
|
|||||||
/* THIS FILE IS AUTO-GENERATED. DO NOT MODIFY!! */
|
|
||||||
|
|
||||||
// Copyright 2020-2023 Tauri Programme within The Commons Conservancy
|
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
|
||||||
// SPDX-License-Identifier: MIT
|
|
||||||
|
|
||||||
package com.lucas.thomann_dsp_app
|
|
||||||
|
|
||||||
import android.annotation.SuppressLint
|
|
||||||
import android.content.Intent
|
|
||||||
import android.os.Build
|
|
||||||
import android.os.Bundle
|
|
||||||
import android.webkit.WebView
|
|
||||||
import androidx.activity.OnBackPressedCallback
|
|
||||||
import androidx.activity.result.ActivityResult
|
|
||||||
import androidx.activity.result.ActivityResultLauncher
|
|
||||||
import androidx.activity.result.contract.ActivityResultContracts
|
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
|
||||||
import androidx.lifecycle.DefaultLifecycleObserver
|
|
||||||
import androidx.lifecycle.LifecycleOwner
|
|
||||||
import androidx.lifecycle.ProcessLifecycleOwner
|
|
||||||
|
|
||||||
private const val ACTIVITY_ID_KEY = "__wryActivityId"
|
|
||||||
|
|
||||||
object WryLifecycleObserver : DefaultLifecycleObserver {
|
|
||||||
// This only runs once: https://developer.android.com/reference/androidx/lifecycle/ProcessLifecycleOwner
|
|
||||||
override fun onCreate(owner: LifecycleOwner) {
|
|
||||||
super.onCreate(owner)
|
|
||||||
Rust.onFirstActivityCreate()
|
|
||||||
Rust.onFirstActivityCreateWry()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
abstract class WryActivity : AppCompatActivity() {
|
|
||||||
private lateinit var mWebView: RustWebView
|
|
||||||
private lateinit var permissionLauncher: ActivityResultLauncher<Array<String>>
|
|
||||||
private lateinit var activityLauncher: ActivityResultLauncher<Intent>
|
|
||||||
private var permissionListener: ((Boolean?) -> Unit)? = null
|
|
||||||
private var activityListener: ((ActivityResult?) -> Unit)? = null
|
|
||||||
var id: Int = 0
|
|
||||||
open val handleBackNavigation: Boolean = true
|
|
||||||
|
|
||||||
open fun onWebViewCreate(webView: WebView) { }
|
|
||||||
|
|
||||||
fun requestPermissions(permissions: Array<String>, listener: (Boolean?) -> Unit) {
|
|
||||||
permissionListener = listener
|
|
||||||
permissionLauncher.launch(permissions)
|
|
||||||
}
|
|
||||||
|
|
||||||
fun launchActivityForResult(intent: Intent, listener: (ActivityResult?) -> Unit) {
|
|
||||||
activityListener = listener
|
|
||||||
activityLauncher.launch(intent)
|
|
||||||
}
|
|
||||||
|
|
||||||
fun setWebView(webView: RustWebView) {
|
|
||||||
mWebView = webView
|
|
||||||
|
|
||||||
if (handleBackNavigation) {
|
|
||||||
val callback = object : OnBackPressedCallback(true) {
|
|
||||||
override fun handleOnBackPressed() {
|
|
||||||
if (this@WryActivity::mWebView.isInitialized) {
|
|
||||||
if (this@WryActivity.mWebView.canGoBack()) {
|
|
||||||
this@WryActivity.mWebView.goBack()
|
|
||||||
} else {
|
|
||||||
this.isEnabled = false
|
|
||||||
this@WryActivity.onBackPressed()
|
|
||||||
this.isEnabled = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
onBackPressedDispatcher.addCallback(this, callback)
|
|
||||||
}
|
|
||||||
|
|
||||||
onWebViewCreate(webView)
|
|
||||||
}
|
|
||||||
|
|
||||||
val version: String
|
|
||||||
@SuppressLint("WebViewApiAvailability", "ObsoleteSdkInt")
|
|
||||||
get() {
|
|
||||||
// Check getCurrentWebViewPackage() directly if above Android 8
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
|
||||||
return WebView.getCurrentWebViewPackage()?.versionName ?: ""
|
|
||||||
}
|
|
||||||
|
|
||||||
// Otherwise manually check WebView versions
|
|
||||||
var webViewPackage = "com.google.android.webview"
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
|
||||||
webViewPackage = "com.android.chrome"
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
@Suppress("DEPRECATION")
|
|
||||||
val info = packageManager.getPackageInfo(webViewPackage, 0)
|
|
||||||
return info.versionName.toString()
|
|
||||||
} catch (ex: Exception) {
|
|
||||||
Logger.warn("Unable to get package info for '$webViewPackage'$ex")
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
@Suppress("DEPRECATION")
|
|
||||||
val info = packageManager.getPackageInfo("com.android.webview", 0)
|
|
||||||
return info.versionName.toString()
|
|
||||||
} catch (ex: Exception) {
|
|
||||||
Logger.warn("Unable to get package info for 'com.android.webview'$ex")
|
|
||||||
}
|
|
||||||
|
|
||||||
// Could not detect any webview, return empty string
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
|
||||||
super.onCreate(savedInstanceState)
|
|
||||||
id = savedInstanceState?.getInt(ACTIVITY_ID_KEY) ?: intent.extras?.getInt(ACTIVITY_ID_KEY) ?: hashCode()
|
|
||||||
|
|
||||||
permissionLauncher = registerForActivityResult(
|
|
||||||
ActivityResultContracts.RequestMultiplePermissions(),
|
|
||||||
) { isGranted ->
|
|
||||||
permissionListener?.let { listener ->
|
|
||||||
val allGranted = isGranted.values.all { it }
|
|
||||||
listener(allGranted)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
activityLauncher = registerForActivityResult(
|
|
||||||
ActivityResultContracts.StartActivityForResult()
|
|
||||||
) { result ->
|
|
||||||
activityListener?.invoke(result)
|
|
||||||
}
|
|
||||||
|
|
||||||
Rust.onCreate(this)
|
|
||||||
ProcessLifecycleOwner.get().lifecycle.addObserver(WryLifecycleObserver)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onStart() {
|
|
||||||
super.onStart()
|
|
||||||
Rust.onStart(this)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onWindowFocusChanged(hasFocus: Boolean) {
|
|
||||||
super.onWindowFocusChanged(hasFocus)
|
|
||||||
Rust.onWindowFocusChanged(this, hasFocus)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onSaveInstanceState(outState: Bundle) {
|
|
||||||
super.onSaveInstanceState(outState)
|
|
||||||
outState.putInt(ACTIVITY_ID_KEY, id)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onPause() {
|
|
||||||
super.onPause()
|
|
||||||
Rust.onPause(this)
|
|
||||||
if (::mWebView.isInitialized) {
|
|
||||||
mWebView.onPause()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onResume() {
|
|
||||||
super.onResume()
|
|
||||||
Rust.onResume(this)
|
|
||||||
if (::mWebView.isInitialized) {
|
|
||||||
mWebView.onResume()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onStop() {
|
|
||||||
super.onStop()
|
|
||||||
Rust.onStop(this)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onDestroy() {
|
|
||||||
super.onDestroy()
|
|
||||||
Rust.onDestroy(this)
|
|
||||||
Rust.onWebviewDestroy(this, if (::mWebView.isInitialized) { mWebView.id } else { "" })
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onLowMemory() {
|
|
||||||
super.onLowMemory()
|
|
||||||
Rust.onLowMemory()
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onNewIntent(intent: Intent) {
|
|
||||||
super.onNewIntent(intent)
|
|
||||||
Rust.onNewIntent(intent)
|
|
||||||
}
|
|
||||||
|
|
||||||
fun getAppClass(name: String): Class<*> {
|
|
||||||
return Class.forName(name)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Called by tao through JNI
|
|
||||||
fun startActivity(cls: Class<*>): Int {
|
|
||||||
val intent = Intent(this, cls)
|
|
||||||
val id = kotlin.random.Random.nextInt()
|
|
||||||
intent.putExtra(ACTIVITY_ID_KEY, id)
|
|
||||||
startActivity(intent)
|
|
||||||
return id
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,37 +0,0 @@
|
|||||||
# THIS FILE IS AUTO-GENERATED. DO NOT MODIFY!!
|
|
||||||
|
|
||||||
# Copyright 2020-2023 Tauri Programme within The Commons Conservancy
|
|
||||||
# SPDX-License-Identifier: Apache-2.0
|
|
||||||
# SPDX-License-Identifier: MIT
|
|
||||||
|
|
||||||
-keep class com.lucas.thomann_dsp_app.* {
|
|
||||||
native <methods>;
|
|
||||||
}
|
|
||||||
|
|
||||||
-keep class com.lucas.thomann_dsp_app.WryActivity {
|
|
||||||
public <init>(...);
|
|
||||||
|
|
||||||
void setWebView(com.lucas.thomann_dsp_app.RustWebView);
|
|
||||||
java.lang.Class getAppClass(...);
|
|
||||||
int getId();
|
|
||||||
java.lang.String getVersion();
|
|
||||||
int startActivity(...);
|
|
||||||
}
|
|
||||||
|
|
||||||
-keep class com.lucas.thomann_dsp_app.Ipc {
|
|
||||||
public <init>(...);
|
|
||||||
|
|
||||||
@android.webkit.JavascriptInterface public <methods>;
|
|
||||||
}
|
|
||||||
|
|
||||||
-keep class com.lucas.thomann_dsp_app.RustWebView {
|
|
||||||
public <init>(...);
|
|
||||||
|
|
||||||
void loadUrlMainThread(...);
|
|
||||||
void loadHTMLMainThread(...);
|
|
||||||
void evalScript(...);
|
|
||||||
}
|
|
||||||
|
|
||||||
-keep class com.lucas.thomann_dsp_app.RustWebChromeClient,com.lucas.thomann_dsp_app.RustWebViewClient {
|
|
||||||
public <init>(...);
|
|
||||||
}
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
C:/Users/lsdg/OneDrive - ETS ROBERT SAS 49/Bureau/Projects/dsp-thomann-interface/src-tauri/target/aarch64-linux-android/release/libthomann_dsp_app_lib.so
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
C:/Users/lsdg/OneDrive - ETS ROBERT SAS 49/Bureau/Projects/dsp-thomann-interface/src-tauri/target/armv7-linux-androideabi/release/libthomann_dsp_app_lib.so
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
C:/Users/lsdg/OneDrive - ETS ROBERT SAS 49/Bureau/Projects/dsp-thomann-interface/src-tauri/target/i686-linux-android/release/libthomann_dsp_app_lib.so
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
C:/Users/lsdg/OneDrive - ETS ROBERT SAS 49/Bureau/Projects/dsp-thomann-interface/src-tauri/target/x86_64-linux-android/release/libthomann_dsp_app_lib.so
|
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:aapt="http://schemas.android.com/aapt"
|
||||||
|
android:width="108dp"
|
||||||
|
android:height="108dp"
|
||||||
|
android:viewportWidth="108"
|
||||||
|
android:viewportHeight="108">
|
||||||
|
<path android:pathData="M31,63.928c0,0 6.4,-11 12.1,-13.1c7.2,-2.6 26,-1.4 26,-1.4l38.1,38.1L107,108.928l-32,-1L31,63.928z">
|
||||||
|
<aapt:attr name="android:fillColor">
|
||||||
|
<gradient
|
||||||
|
android:endX="85.84757"
|
||||||
|
android:endY="92.4963"
|
||||||
|
android:startX="42.9492"
|
||||||
|
android:startY="49.59793"
|
||||||
|
android:type="linear">
|
||||||
|
<item
|
||||||
|
android:color="#44000000"
|
||||||
|
android:offset="0.0" />
|
||||||
|
<item
|
||||||
|
android:color="#00000000"
|
||||||
|
android:offset="1.0" />
|
||||||
|
</gradient>
|
||||||
|
</aapt:attr>
|
||||||
|
</path>
|
||||||
|
<path
|
||||||
|
android:fillColor="#FFFFFF"
|
||||||
|
android:fillType="nonZero"
|
||||||
|
android:pathData="M65.3,45.828l3.8,-6.6c0.2,-0.4 0.1,-0.9 -0.3,-1.1c-0.4,-0.2 -0.9,-0.1 -1.1,0.3l-3.9,6.7c-6.3,-2.8 -13.4,-2.8 -19.7,0l-3.9,-6.7c-0.2,-0.4 -0.7,-0.5 -1.1,-0.3C38.8,38.328 38.7,38.828 38.9,39.228l3.8,6.6C36.2,49.428 31.7,56.028 31,63.928h46C76.3,56.028 71.8,49.428 65.3,45.828zM43.4,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2c-0.3,-0.7 -0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C45.3,56.528 44.5,57.328 43.4,57.328L43.4,57.328zM64.6,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2s-0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C66.5,56.528 65.6,57.328 64.6,57.328L64.6,57.328z"
|
||||||
|
android:strokeWidth="1"
|
||||||
|
android:strokeColor="#00000000" />
|
||||||
|
</vector>
|
||||||
@@ -0,0 +1,170 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="108dp"
|
||||||
|
android:height="108dp"
|
||||||
|
android:viewportWidth="108"
|
||||||
|
android:viewportHeight="108">
|
||||||
|
<path
|
||||||
|
android:fillColor="#3DDC84"
|
||||||
|
android:pathData="M0,0h108v108h-108z" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M9,0L9,108"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M19,0L19,108"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M29,0L29,108"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M39,0L39,108"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M49,0L49,108"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M59,0L59,108"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M69,0L69,108"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M79,0L79,108"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M89,0L89,108"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M99,0L99,108"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M0,9L108,9"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M0,19L108,19"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M0,29L108,29"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M0,39L108,39"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M0,49L108,49"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M0,59L108,59"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M0,69L108,69"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M0,79L108,79"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M0,89L108,89"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M0,99L108,99"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M19,29L89,29"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M19,39L89,39"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M19,49L89,49"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M19,59L89,59"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M19,69L89,69"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M19,79L89,79"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M29,19L29,89"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M39,19L39,89"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M49,19L49,89"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M59,19L59,89"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M69,19L69,89"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
<path
|
||||||
|
android:fillColor="#00000000"
|
||||||
|
android:pathData="M79,19L79,89"
|
||||||
|
android:strokeWidth="0.8"
|
||||||
|
android:strokeColor="#33FFFFFF" />
|
||||||
|
</vector>
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
tools:context=".MainActivity">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="Hello World!"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintLeft_toLeftOf="parent"
|
||||||
|
app:layout_constraintRight_toRightOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
|
||||||
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
|
|
||||||
<background android:drawable="@color/ic_launcher_background"/>
|
|
||||||
</adaptive-icon>
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
|
||||||
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
|
|
||||||
<background android:drawable="@color/ic_launcher_background"/>
|
|
||||||
</adaptive-icon>
|
|
||||||
|
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 3.4 KiB |
|
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 3.7 KiB After Width: | Height: | Size: 3.4 KiB |
|
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 3.3 KiB |
|
Before Width: | Height: | Size: 9.8 KiB After Width: | Height: | Size: 8.9 KiB |
|
Before Width: | Height: | Size: 3.5 KiB After Width: | Height: | Size: 3.3 KiB |
|
Before Width: | Height: | Size: 7.9 KiB After Width: | Height: | Size: 7.8 KiB |
|
Before Width: | Height: | Size: 25 KiB After Width: | Height: | Size: 18 KiB |
|
Before Width: | Height: | Size: 8.8 KiB After Width: | Height: | Size: 7.8 KiB |
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 44 KiB After Width: | Height: | Size: 29 KiB |
|
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 69 KiB After Width: | Height: | Size: 40 KiB |
|
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 16 KiB |
@@ -1,4 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<resources>
|
|
||||||
<color name="ic_launcher_background">#00000000</color>
|
|
||||||
</resources>
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
// THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
|
|
||||||
val implementation = configurations.getByName("implementation")
|
|
||||||
dependencies {
|
|
||||||
implementation("androidx.lifecycle:lifecycle-process:2.10.0")
|
|
||||||
implementation(project(":tauri-android"))
|
|
||||||
implementation(project(":tauri-plugin-opener"))
|
|
||||||
}
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
// THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
|
|
||||||
tauri.android.versionName=0.1.0
|
|
||||||
tauri.android.versionCode=1000
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
#Mon Oct 26 13:42:11 CET 2026
|
|
||||||
gradle.version=8.14.3
|
|
||||||