Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
191148f9b9 | ||
|
|
2f40c60520 | ||
|
|
74501fba5c | ||
|
|
710caeb0fb | ||
|
|
8fe56667c6 | ||
|
|
b0625eafc2 | ||
|
|
4b5606dd15 | ||
|
|
e640ae17e5 | ||
|
|
ddb7a907a1 | ||
|
|
be713620ef | ||
|
|
8c766c3bc2 | ||
|
|
87244e5ba3 | ||
|
|
15e29a1d93 | ||
|
|
fa93528b69 | ||
|
|
eaf9d09c32 | ||
|
|
6806a86114 |
@@ -0,0 +1,82 @@
|
||||
name: CI
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
pull_request:
|
||||
branches: [main]
|
||||
|
||||
jobs:
|
||||
frontend:
|
||||
name: Frontend
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 22
|
||||
cache: npm
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
|
||||
- name: Lint
|
||||
run: npm run lint
|
||||
|
||||
- name: Type check
|
||||
run: npx tsc --noEmit
|
||||
|
||||
- name: Prettier check
|
||||
run: npm run format # make sure this is `prettier --check .`
|
||||
|
||||
- name: Build frontend
|
||||
run: npm run build
|
||||
|
||||
rust:
|
||||
name: Rust (Tauri backend)
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Install system dependencies
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y \
|
||||
build-essential curl wget file pkg-config \
|
||||
libwebkit2gtk-4.1-dev libxdo-dev libssl-dev \
|
||||
libayatana-appindicator3-dev librsvg2-dev
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 22
|
||||
cache: npm
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
|
||||
# Tauri's build script checks that frontendDist exists
|
||||
- name: Build frontend
|
||||
run: npm run build
|
||||
|
||||
- name: Setup Rust
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
with:
|
||||
components: rustfmt, clippy
|
||||
|
||||
- name: Rust cache
|
||||
uses: Swatinem/rust-cache@v2
|
||||
with:
|
||||
workspaces: src-tauri
|
||||
|
||||
- name: Format check
|
||||
run: cargo fmt --manifest-path src-tauri/Cargo.toml --all -- --check
|
||||
|
||||
- name: Clippy
|
||||
run: cargo clippy --manifest-path src-tauri/Cargo.toml --all-targets -- -D warnings
|
||||
|
||||
- name: Test
|
||||
run: cargo test --manifest-path src-tauri/Cargo.toml
|
||||
@@ -0,0 +1,151 @@
|
||||
name: Release
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- 'v*'
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
env:
|
||||
API: https://gitea.iceberg.black/api/v1/repos/${{ github.repository }}
|
||||
|
||||
jobs:
|
||||
create-release:
|
||||
name: Create release
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
RELEASE_ID: ${{ steps.create.outputs.RELEASE_ID }}
|
||||
steps:
|
||||
- name: Create Gitea release
|
||||
id: create
|
||||
run: |
|
||||
TAG=${GITHUB_REF#refs/tags/}
|
||||
RELEASE_ID=$(curl -s -X POST "$API/releases" \
|
||||
-H "Authorization: token ${{ secrets.RELEASE_TOKEN }}" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "{\"tag_name\":\"$TAG\",\"name\":\"$TAG\"}" | jq -r '.id')
|
||||
echo "RELEASE_ID=$RELEASE_ID" >> $GITHUB_OUTPUT
|
||||
|
||||
build-linux:
|
||||
name: Build Linux bundles
|
||||
needs: create-release
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Install system dependencies
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y \
|
||||
build-essential curl wget file pkg-config \
|
||||
libwebkit2gtk-4.1-dev libxdo-dev libssl-dev \
|
||||
libayatana-appindicator3-dev librsvg2-dev \
|
||||
xdg-utils
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 22
|
||||
cache: npm
|
||||
|
||||
- name: Setup Rust
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
|
||||
- name: Rust cache
|
||||
uses: Swatinem/rust-cache@v2
|
||||
with:
|
||||
workspaces: src-tauri
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
|
||||
- name: Build Tauri app
|
||||
run: npm run tauri build
|
||||
|
||||
- name: Upload assets
|
||||
run: |
|
||||
for f in src-tauri/target/release/bundle/deb/*.deb \
|
||||
src-tauri/target/release/bundle/rpm/*.rpm \
|
||||
src-tauri/target/release/bundle/appimage/*.AppImage; do
|
||||
[ -f "$f" ] || continue
|
||||
echo "Uploading $f"
|
||||
curl -s -X POST "$API/releases/${{ needs.create-release.outputs.RELEASE_ID }}/assets?name=$(basename "$f")" \
|
||||
-H "Authorization: token ${{ secrets.RELEASE_TOKEN }}" \
|
||||
-F "attachment=@$f"
|
||||
done
|
||||
|
||||
build-android:
|
||||
name: Build Android APK
|
||||
needs: create-release
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
NDK_VERSION: 27.0.12077973
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Java
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
distribution: temurin
|
||||
java-version: 17
|
||||
|
||||
- name: Setup Android SDK
|
||||
uses: https://github.com/android-actions/setup-android@v4
|
||||
with:
|
||||
packages: 'platform-tools'
|
||||
|
||||
- name: Install NDK and platform
|
||||
run: |
|
||||
sdkmanager "platforms;android-36" "build-tools;36.0.0" "ndk;${NDK_VERSION}"
|
||||
echo "NDK_HOME=$ANDROID_HOME/ndk/${NDK_VERSION}" >> $GITHUB_ENV
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 22
|
||||
cache: npm
|
||||
|
||||
- name: Setup Rust
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
with:
|
||||
targets: aarch64-linux-android,armv7-linux-androideabi,i686-linux-android,x86_64-linux-android
|
||||
|
||||
- name: Rust cache
|
||||
uses: Swatinem/rust-cache@v2
|
||||
with:
|
||||
workspaces: src-tauri
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
|
||||
- name: Setup signing
|
||||
env:
|
||||
KEYSTORE_B64: ${{ secrets.ANDROID_KEYSTORE_BASE64 }}
|
||||
STORE_PASS: ${{ secrets.ANDROID_KEYSTORE_PASSWORD }}
|
||||
KEY_ALIAS: ${{ secrets.ANDROID_KEY_ALIAS }}
|
||||
KEY_PASS: ${{ secrets.ANDROID_KEY_PASSWORD }}
|
||||
run: |
|
||||
echo "$KEYSTORE_B64" | base64 -d > src-tauri/gen/android/upload-keystore.jks
|
||||
{
|
||||
echo "storeFile=upload-keystore.jks"
|
||||
echo "storePassword=$STORE_PASS"
|
||||
echo "keyAlias=$KEY_ALIAS"
|
||||
echo "keyPassword=$KEY_PASS"
|
||||
} > src-tauri/gen/android/keystore.properties
|
||||
|
||||
- name: Build APK
|
||||
run: npm run tauri android build -- --apk
|
||||
|
||||
- name: Upload APK
|
||||
run: |
|
||||
for f in src-tauri/gen/android/app/build/outputs/apk/universal/release/*.apk; do
|
||||
[ -f "$f" ] || continue
|
||||
echo "Uploading $f"
|
||||
curl -s -X POST "$API/releases/${{ needs.create-release.outputs.RELEASE_ID }}/assets?name=$(basename "$f")" \
|
||||
-H "Authorization: token ${{ secrets.RELEASE_TOKEN }}" \
|
||||
-F "attachment=@$f"
|
||||
done
|
||||
@@ -22,3 +22,5 @@ dist-ssr
|
||||
*.njsproj
|
||||
*.sln
|
||||
*.sw?
|
||||
*.jks
|
||||
keystore.base64
|
||||
@@ -15,4 +15,11 @@ This template should help get you started developing with Tauri, React and Types
|
||||
|
||||
- Check end to end behavioour
|
||||
|
||||
# TAG
|
||||
|
||||
git tag -a v1.0.0 -m "Release v1.0.0"
|
||||
git push origin v1.0.0
|
||||
git tag -d v1.0.0
|
||||
git push origin --delete v1.0.0
|
||||
|
||||
git tag -d v1.0.0;git push origin --delete v1.0.0;git tag -a v1.0.0 -m "Release v1.0.0";git push origin v1.0.0;
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
|
||||
import js from "@eslint/js";
|
||||
import tseslint from "typescript-eslint";
|
||||
import reactHooks from "eslint-plugin-react-hooks";
|
||||
|
||||
export default tseslint.config(
|
||||
js.configs.recommended,
|
||||
...tseslint.configs.recommended,
|
||||
{
|
||||
ignores: ["node_modules/**", "dist/**", "src-tauri/target/**"],
|
||||
},
|
||||
{
|
||||
files: ["**/*.{js,jsx,ts,tsx}"],
|
||||
plugins: {
|
||||
"react-hooks": reactHooks,
|
||||
},
|
||||
rules: {
|
||||
"react-hooks/rules-of-hooks": "error",
|
||||
"react-hooks/exhaustive-deps": "warn",
|
||||
},
|
||||
}
|
||||
);
|
||||
@@ -9,24 +9,32 @@
|
||||
"preview": "vite preview",
|
||||
"tauri": "tauri",
|
||||
"format": "prettier --write \"src/**/*.{ts,tsx,js,jsx,css}\"",
|
||||
"format:check": "prettier --check \"src/**/*.{ts,tsx,js,jsx,css}\""
|
||||
"format:check": "prettier --check \"src/**/*.{ts,tsx,js,jsx,css}\"",
|
||||
"lint": "eslint .",
|
||||
"lint:fix": "eslint . --fix",
|
||||
"typecheck": "tsc --noEmit"
|
||||
},
|
||||
"dependencies": {
|
||||
"@tauri-apps/api": "^2",
|
||||
"@tauri-apps/plugin-opener": "^2.7.2",
|
||||
"@tauri-apps/plugin-os": "^2.4.0",
|
||||
"@tauri-apps/plugin-store": "^2.5.0",
|
||||
"react": "^19.2.8",
|
||||
"react-dom": "^19.2.8"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@eslint/js": "^10.0.1",
|
||||
"@tauri-apps/cli": "^2",
|
||||
"@types/react": "^19.1.8",
|
||||
"@types/react-dom": "^19.1.6",
|
||||
"@vitejs/plugin-react": "^4.6.0",
|
||||
"eslint": "^10.14.0",
|
||||
"eslint-config-prettier": "^10.1.8",
|
||||
"eslint-plugin-prettier": "^5.5.6",
|
||||
"eslint-plugin-react-hooks": "^7.1.1",
|
||||
"prettier": "^3.9.6",
|
||||
"typescript": "~5.8.3",
|
||||
"typescript-eslint": "^8.72.1",
|
||||
"vite": "^7.0.4"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,9 +18,10 @@ crate-type = ["staticlib", "cdylib", "rlib"]
|
||||
tauri-build = { version = "2", features = [] }
|
||||
|
||||
[dependencies]
|
||||
tauri = { version = "2.12.4", features = [] }
|
||||
tauri = { version = "2.12.5", features = [] }
|
||||
tauri-plugin-opener = "2.7.2"
|
||||
tauri-plugin-os = "2"
|
||||
serde = { version = "1", features = ["derive"] }
|
||||
serde_json = "1.0.154"
|
||||
dsp_thomann = { path = "../../dsp-thomann", features = ["serialization"] }
|
||||
dsp_thomann = { git = "https://gitea.iceberg.black/LucasDLTG/dsp-thomann", features = ["serialization"] }
|
||||
tauri-plugin-store = "2"
|
||||
|
||||
@@ -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.io.FileInputStream
|
||||
|
||||
plugins {
|
||||
id("com.android.application")
|
||||
@@ -15,13 +13,19 @@ val tauriProperties = Properties().apply {
|
||||
}
|
||||
}
|
||||
|
||||
// Load release keystore properties
|
||||
// Load signing credentials.
|
||||
// Locally: optional (debug builds and `tauri android dev` work without it).
|
||||
// In CI: mandatory, so a broken secrets setup fails loudly instead of
|
||||
// producing an unsigned APK.
|
||||
val keystoreProperties = Properties().apply {
|
||||
val keystoreFile = rootProject.file("keystore.properties")
|
||||
if (keystoreFile.exists()) {
|
||||
keystoreFile.inputStream().use { load(it) }
|
||||
} else if (System.getenv("CI") != null) {
|
||||
error("Missing keystore.properties in CI")
|
||||
}
|
||||
}
|
||||
val hasKeystore = keystoreProperties.containsKey("storeFile")
|
||||
|
||||
android {
|
||||
compileSdk = 36
|
||||
@@ -32,20 +36,28 @@ android {
|
||||
applicationId = "com.lucas.thomann_dsp_app"
|
||||
minSdk = 24
|
||||
targetSdk = 36
|
||||
versionCode = tauriProperties.getProperty("tauri.android.versionCode", "1").toInt()
|
||||
versionName = tauriProperties.getProperty("tauri.android.versionName", "1.0")
|
||||
versionCode = tauriProperties
|
||||
.getProperty("tauri.android.versionCode", "1").toInt()
|
||||
versionName = tauriProperties
|
||||
.getProperty("tauri.android.versionName", "1.0")
|
||||
}
|
||||
|
||||
// Release signing configuration
|
||||
signingConfigs {
|
||||
create("release") {
|
||||
val keystorePath = keystoreProperties.getProperty("storeFile")
|
||||
if (hasKeystore) {
|
||||
create("release") {
|
||||
val keystorePath = keystoreProperties.getProperty("storeFile")
|
||||
?: error("Missing storeFile")
|
||||
|
||||
storeFile = rootProject.file(keystorePath)
|
||||
|
||||
storePassword = keystoreProperties.getProperty("storePassword")
|
||||
?: error("Missing storePassword")
|
||||
|
||||
if (keystorePath != null) {
|
||||
storeFile = file(keystorePath)
|
||||
storePassword = keystoreProperties.getProperty("password")
|
||||
keyAlias = keystoreProperties.getProperty("keyAlias")
|
||||
keyPassword = keystoreProperties.getProperty("password")
|
||||
?: error("Missing keyAlias")
|
||||
|
||||
keyPassword = keystoreProperties.getProperty("keyPassword")
|
||||
?: error("Missing keyPassword")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -56,6 +68,7 @@ android {
|
||||
isDebuggable = true
|
||||
isJniDebuggable = true
|
||||
isMinifyEnabled = false
|
||||
|
||||
packaging {
|
||||
jniLibs.keepDebugSymbols.add("*/arm64-v8a/*.so")
|
||||
jniLibs.keepDebugSymbols.add("*/armeabi-v7a/*.so")
|
||||
@@ -65,14 +78,16 @@ android {
|
||||
}
|
||||
|
||||
getByName("release") {
|
||||
isMinifyEnabled = true
|
||||
|
||||
signingConfig = signingConfigs.getByName("release")
|
||||
isMinifyEnabled = false
|
||||
if (hasKeystore) {
|
||||
signingConfig = signingConfigs.getByName("release")
|
||||
}
|
||||
|
||||
proguardFiles(
|
||||
*fileTree(".") { include("**/*.pro") }
|
||||
.plus(getDefaultProguardFile("proguard-android-optimize.txt"))
|
||||
.toList().toTypedArray()
|
||||
.toList()
|
||||
.toTypedArray()
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -96,9 +111,10 @@ dependencies {
|
||||
implementation("androidx.activity:activity-ktx:1.10.1")
|
||||
implementation("com.google.android.material:material:1.12.0")
|
||||
implementation("androidx.lifecycle:lifecycle-process:2.10.0")
|
||||
|
||||
testImplementation("junit:junit:4.13.2")
|
||||
androidTestImplementation("androidx.test.ext:junit:1.1.4")
|
||||
androidTestImplementation("androidx.test.espresso:espresso-core:3.5.0")
|
||||
}
|
||||
|
||||
apply(from = "tauri.build.gradle.kts")
|
||||
apply(from = "tauri.build.gradle.kts")
|
||||
@@ -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
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:roundIcon="@mipmap/ic_launcher_round"
|
||||
android:label="@string/app_name"
|
||||
android:theme="@style/Theme.thomann_dsp_app"
|
||||
android:usesCleartextTraffic="${usesCleartextTraffic}">
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
package com.lucas.thomann_dsp_app
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.KeyEvent
|
||||
import android.webkit.JavascriptInterface
|
||||
import android.webkit.WebView
|
||||
import androidx.activity.enableEdgeToEdge
|
||||
|
||||
class MainActivity : TauriActivity() {
|
||||
private var webView: WebView? = null
|
||||
@Volatile private var interceptVolume = false
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
enableEdgeToEdge()
|
||||
super.onCreate(savedInstanceState)
|
||||
}
|
||||
|
||||
override fun onWebViewCreate(webView: WebView) {
|
||||
super.onWebViewCreate(webView)
|
||||
this.webView = webView
|
||||
webView.addJavascriptInterface(object {
|
||||
@JavascriptInterface
|
||||
fun setIntercept(enabled: Boolean) {
|
||||
interceptVolume = enabled
|
||||
}
|
||||
}, "VolumeBridge")
|
||||
}
|
||||
|
||||
private fun isVolumeKey(keyCode: Int) =
|
||||
keyCode == KeyEvent.KEYCODE_VOLUME_UP || keyCode == KeyEvent.KEYCODE_VOLUME_DOWN
|
||||
|
||||
override fun onKeyDown(keyCode: Int, event: KeyEvent?): Boolean {
|
||||
if (interceptVolume && isVolumeKey(keyCode)) {
|
||||
val name = if (keyCode == KeyEvent.KEYCODE_VOLUME_UP) "volumeupbutton" else "volumedownbutton"
|
||||
webView?.post {
|
||||
webView?.evaluateJavascript("document.dispatchEvent(new Event('$name'))", null)
|
||||
}
|
||||
return true // consumed, so the system volume doesn't change
|
||||
}
|
||||
return super.onKeyDown(keyCode, event)
|
||||
}
|
||||
|
||||
override fun onKeyUp(keyCode: Int, event: KeyEvent?): Boolean {
|
||||
if (interceptVolume && isVolumeKey(keyCode)) return true
|
||||
return super.onKeyUp(keyCode, event)
|
||||
}
|
||||
}
|
||||
@@ -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>
|
||||
|
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 3.1 KiB |
|
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 3.7 KiB After Width: | Height: | Size: 3.7 KiB |
|
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 3.0 KiB |
|
Before Width: | Height: | Size: 9.8 KiB After Width: | Height: | Size: 9.8 KiB |
|
Before Width: | Height: | Size: 3.5 KiB After Width: | Height: | Size: 3.5 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: 25 KiB |
|
Before Width: | Height: | Size: 8.8 KiB After Width: | Height: | Size: 8.8 KiB |
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 44 KiB After Width: | Height: | Size: 44 KiB |
|
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 20 KiB |
|
Before Width: | Height: | Size: 69 KiB After Width: | Height: | Size: 68 KiB |
|
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 23 KiB |
@@ -1,4 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="ic_launcher_background">#00000000</color>
|
||||
<color name="ic_launcher_background">#fff</color>
|
||||
</resources>
|
||||
@@ -1,2 +1,2 @@
|
||||
#Mon Oct 26 13:42:11 CET 2026
|
||||
#Fri Oct 30 19:15:34 CET 2026
|
||||
gradle.version=8.14.3
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
password=gitgit
|
||||
keyAlias=upload
|
||||
storeFile=C:\\Users\\lsdg\\upload-keystore.jks
|
||||
@@ -1,5 +1,5 @@
|
||||
// THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
|
||||
include ':tauri-android'
|
||||
project(':tauri-android').projectDir = new File("C:\\Users\\lsdg\\.cargo\\registry\\src\\index.crates.io-1949cf8c6b5b557f\\tauri-2.12.4\\mobile\\android")
|
||||
project(':tauri-android').projectDir = new File("C:\\Users\\lsdg\\.cargo\\registry\\src\\index.crates.io-1949cf8c6b5b557f\\tauri-2.12.5\\mobile\\android")
|
||||
include ':tauri-plugin-opener'
|
||||
project(':tauri-plugin-opener').projectDir = new File("C:\\Users\\lsdg\\.cargo\\registry\\src\\index.crates.io-1949cf8c6b5b557f\\tauri-plugin-opener-2.7.2\\android")
|
||||
|
||||
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 32 KiB After Width: | Height: | Size: 32 KiB |
|
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 4.8 KiB After Width: | Height: | Size: 4.8 KiB |
|
Before Width: | Height: | Size: 9.7 KiB After Width: | Height: | Size: 9.6 KiB |
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 36 KiB After Width: | Height: | Size: 36 KiB |
|
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 41 KiB After Width: | Height: | Size: 41 KiB |
|
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 2.9 KiB |
|
Before Width: | Height: | Size: 5.7 KiB After Width: | Height: | Size: 5.7 KiB |
|
Before Width: | Height: | Size: 7.7 KiB After Width: | Height: | Size: 7.7 KiB |
|
Before Width: | Height: | Size: 3.5 KiB After Width: | Height: | Size: 3.5 KiB |
|
Before Width: | Height: | Size: 46 KiB After Width: | Height: | Size: 46 KiB |
|
Before Width: | Height: | Size: 61 KiB After Width: | Height: | Size: 60 KiB |
|
Before Width: | Height: | Size: 1004 B After Width: | Height: | Size: 1000 B |
|
Before Width: | Height: | Size: 2.5 KiB After Width: | Height: | Size: 2.5 KiB |
|
Before Width: | Height: | Size: 2.5 KiB After Width: | Height: | Size: 2.5 KiB |
|
Before Width: | Height: | Size: 4.3 KiB After Width: | Height: | Size: 4.3 KiB |
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 4.2 KiB |
|
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 4.2 KiB |
|
Before Width: | Height: | Size: 7.1 KiB After Width: | Height: | Size: 7.1 KiB |
|
Before Width: | Height: | Size: 2.5 KiB After Width: | Height: | Size: 2.5 KiB |
|
Before Width: | Height: | Size: 6.3 KiB After Width: | Height: | Size: 6.3 KiB |
|
Before Width: | Height: | Size: 6.3 KiB After Width: | Height: | Size: 6.3 KiB |
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 194 KiB After Width: | Height: | Size: 194 KiB |
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 18 KiB |
|
Before Width: | Height: | Size: 6.0 KiB After Width: | Height: | Size: 6.0 KiB |
|
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 17 KiB |
@@ -69,8 +69,15 @@ pub fn create_dsp408(
|
||||
let id = *next_id;
|
||||
*next_id += 1;
|
||||
|
||||
#[cfg(mobile)]
|
||||
let mut device = DSPDevice { dsp };
|
||||
|
||||
#[cfg(not(mobile))]
|
||||
let device = DSPDevice { dsp };
|
||||
|
||||
#[cfg(mobile)]
|
||||
device.dsp.set_auto_reconnect(false);
|
||||
|
||||
let mut devices = state.devices.lock().map_err(|e| e.to_string())?;
|
||||
|
||||
devices.insert(id, Arc::new(Mutex::new(device)));
|
||||
@@ -249,6 +256,7 @@ pub async fn lock_device(
|
||||
}
|
||||
|
||||
// Command `0x30`
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
#[tauri::command]
|
||||
pub async fn set_compressor(
|
||||
state: State<'_, AppState>,
|
||||
@@ -303,6 +311,7 @@ pub async fn set_high_pass(
|
||||
}
|
||||
|
||||
// Command `0x33`
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
#[tauri::command]
|
||||
pub async fn set_peq_band(
|
||||
state: State<'_, AppState>,
|
||||
|
||||
@@ -4,11 +4,26 @@ mod state;
|
||||
use state::AppState;
|
||||
use tauri::Manager;
|
||||
|
||||
#[cfg(mobile)]
|
||||
fn handle_run_event(app: &tauri::AppHandle, event: &tauri::RunEvent) {
|
||||
if let tauri::RunEvent::WindowEvent {
|
||||
event: tauri::WindowEvent::Focused(false),
|
||||
..
|
||||
} = event
|
||||
{
|
||||
app.state::<AppState>().disconnect_all();
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(mobile))]
|
||||
fn handle_run_event(_app: &tauri::AppHandle, _event: &tauri::RunEvent) {}
|
||||
|
||||
#[cfg_attr(mobile, tauri::mobile_entry_point)]
|
||||
pub fn run() {
|
||||
tauri::Builder::default()
|
||||
let app = tauri::Builder::default()
|
||||
.plugin(tauri_plugin_store::Builder::new().build())
|
||||
.plugin(tauri_plugin_opener::init())
|
||||
.plugin(tauri_plugin_os::init()) // added by `tauri add os`
|
||||
.manage(AppState::new())
|
||||
.invoke_handler(tauri::generate_handler![
|
||||
commands::create_dsp408,
|
||||
@@ -51,6 +66,8 @@ pub fn run() {
|
||||
state.shutdown();
|
||||
}
|
||||
})
|
||||
.run(tauri::generate_context!())
|
||||
.expect("error while running tauri application");
|
||||
.build(tauri::generate_context!())
|
||||
.expect("error while building tauri application");
|
||||
|
||||
app.run(|app, event| handle_run_event(app, &event));
|
||||
}
|
||||
|
||||
@@ -30,4 +30,23 @@ impl AppState {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(mobile)]
|
||||
pub fn disconnect_all(&self) {
|
||||
// clone the Arcs so the map lock isn't held while waiting on devices
|
||||
let devices: Vec<Arc<Mutex<DSPDevice>>> = {
|
||||
let map = self.devices.lock().unwrap_or_else(|e| e.into_inner());
|
||||
map.values().cloned().collect()
|
||||
};
|
||||
|
||||
// one thread per device so a stuck device doesn't delay the others
|
||||
for device in devices {
|
||||
std::thread::spawn(move || {
|
||||
let mut d = device.lock().unwrap_or_else(|e| e.into_inner());
|
||||
if d.dsp.connected() {
|
||||
let _ = d.dsp.disconnect();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ import DSPPage from './pages/DspPage/DspPage';
|
||||
import AddDSPForm from './pages/AddDspPage/AddDspPage';
|
||||
import { useNotifications } from './hooks/useNotifications';
|
||||
import Notifications from './components/Notifications/Notifications';
|
||||
import CreditsPage from './pages/CreditsPage/CreditsPage';
|
||||
import SettingsPage from './pages/SettingsPage/SettingsPage';
|
||||
import HomePage from './pages/HomePage/HomePage';
|
||||
import { addDSP, createDSPInstance, restoreDSPs } from './dsp/dspApi';
|
||||
import { removeDSP } from './dsp/dspShared';
|
||||
@@ -14,13 +14,14 @@ import { stopAllPolling } from './dsp/pollRegistry';
|
||||
import { loadSavedDSPs, saveDSPs, toSaved } from './dsp/dspStorage';
|
||||
import { DSPMode } from './features/dsp408/types';
|
||||
import { useIsMobile } from './hooks/useIsMobile';
|
||||
import { useMobileBackgroundDisconnect } from './dsp/useMobileBackgroundDisconnect';
|
||||
|
||||
function App() {
|
||||
const [dsps, setDsps] = useState<DSP[]>([]);
|
||||
const [selected, setSelected] = useState<number | null>(null);
|
||||
const [page, setPage] = useState<AppPage>('home');
|
||||
const [loaded, setLoaded] = useState(false);
|
||||
const { notifications, notify, removeNotification, hoverNotification } = useNotifications();
|
||||
const { notifications, notify, removeNotification, hoverNotification, setNotificationsDisabled } = useNotifications();
|
||||
const connectedDspCount = dsps.filter((dsp) => isConnected(dsp)).length;
|
||||
const restoreStarted = useRef(false);
|
||||
const isMobile = useIsMobile();
|
||||
@@ -30,6 +31,9 @@ function App() {
|
||||
|
||||
const dspsRef = useRef(dsps);
|
||||
dspsRef.current = dsps;
|
||||
|
||||
useMobileBackgroundDisconnect(dsps, setDsps, notify); // NEW
|
||||
|
||||
useEffect(() => {
|
||||
return () => stopAllPolling(dspsRef.current);
|
||||
}, []);
|
||||
@@ -96,8 +100,10 @@ function App() {
|
||||
/>
|
||||
|
||||
<main className="stage">
|
||||
{page === 'credits' ? (
|
||||
<CreditsPage />
|
||||
{page === 'settings' ? (
|
||||
<SettingsPage
|
||||
onNotificationsDisabledChange={setNotificationsDisabled}
|
||||
/>
|
||||
) : page === 'add-dsp' ? (
|
||||
<AddDSPForm
|
||||
onCancel={() => setPage('home')}
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
export function SettingsIcon(props: React.SVGProps<SVGSVGElement>) {
|
||||
return (
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
strokeWidth="2"
|
||||
strokeLinecap="round"
|
||||
strokeLinejoin="round"
|
||||
{...props}
|
||||
>
|
||||
<path d="M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915" />
|
||||
<circle cx="12" cy="12" r="3" />
|
||||
</svg>
|
||||
);
|
||||
}
|
||||
@@ -17,6 +17,12 @@
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
.choice-select.is-selected {
|
||||
outline: 2px solid var(--accent-brand);
|
||||
outline-offset: -2px;
|
||||
border-radius: 1.6cqh;
|
||||
}
|
||||
|
||||
.choice-select[data-disabled] {
|
||||
opacity: 0.5;
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
import { useEffect, useRef, useState } from 'react';
|
||||
import { createPortal } from 'react-dom';
|
||||
import { TriangleDownIcon } from '../../assets/icons/Triangle';
|
||||
import { useVolumeKeys } from '../../hooks/useVolumeKeys';
|
||||
import './ChoiceSelect.css';
|
||||
|
||||
type CommitResult = Promise<boolean | void> | boolean | void;
|
||||
@@ -212,7 +213,6 @@ function ChoiceSelect<T extends string>({
|
||||
latest.current = value;
|
||||
lastCommitted.current = value;
|
||||
setDisplayValue(value);
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [value]);
|
||||
|
||||
// When disabled, drop any in-progress interaction, close the list and show the real value.
|
||||
@@ -231,7 +231,6 @@ function ChoiceSelect<T extends string>({
|
||||
latest.current = v;
|
||||
lastCommitted.current = v;
|
||||
setDisplayValue(v);
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [disabled]);
|
||||
|
||||
useEffect(() => {
|
||||
@@ -285,7 +284,6 @@ function ChoiceSelect<T extends string>({
|
||||
window.removeEventListener('scroll', recalc, true);
|
||||
window.removeEventListener('resize', recalc);
|
||||
};
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [open]);
|
||||
|
||||
// --- wheel on the trigger ----------------------------------------------
|
||||
@@ -299,6 +297,20 @@ function ChoiceSelect<T extends string>({
|
||||
return true;
|
||||
};
|
||||
|
||||
const { isSelected, select } = useVolumeKeys({
|
||||
rootRef,
|
||||
disabled,
|
||||
onStep: (volumeDirection) => {
|
||||
// Same mapping as the wheel: up = previous item, down = next item.
|
||||
const direction = volumeDirection === 1 ? -1 : 1;
|
||||
if (open) {
|
||||
setHighlight((h) => Math.min(options.length - 1, Math.max(0, h + direction)));
|
||||
} else if (step(direction)) {
|
||||
scheduleWheelCommit();
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
useNonPassiveWheel(triggerRef, (e) => {
|
||||
e.preventDefault();
|
||||
if (disabled) return;
|
||||
@@ -347,10 +359,10 @@ function ChoiceSelect<T extends string>({
|
||||
preview(opt);
|
||||
commitLatest();
|
||||
} else {
|
||||
// Picking the already-shown value still flushes any wheel change that is waiting on its debounce.
|
||||
commitLatest();
|
||||
}
|
||||
setOpen(false);
|
||||
select();
|
||||
triggerRef.current?.focus();
|
||||
}
|
||||
|
||||
@@ -383,10 +395,11 @@ function ChoiceSelect<T extends string>({
|
||||
|
||||
return (
|
||||
<div
|
||||
className={`choice-select ${className}`}
|
||||
className={`choice-select ${isSelected ? 'is-selected' : ''} ${className}`}
|
||||
data-disabled={disabled || undefined}
|
||||
ref={rootRef}
|
||||
style={style}
|
||||
onPointerDown={select}
|
||||
>
|
||||
<button
|
||||
id={id}
|
||||
|
||||
@@ -11,6 +11,20 @@
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
.choice-stepper.is-selected {
|
||||
outline: 2px solid var(--accent-brand);
|
||||
outline-offset: -2px;
|
||||
border-radius: 1.6cqh;
|
||||
}
|
||||
|
||||
.choice-stepper.is-touch .choice-stepper__input {
|
||||
pointer-events: none; /* taps go to the root, so the whole stepper gets selected */
|
||||
caret-color: transparent;
|
||||
user-select: none;
|
||||
-webkit-user-select: none;
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.choice-stepper__input {
|
||||
flex: 1 1 auto;
|
||||
min-width: 0;
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import { JSX, useEffect, useRef, useState } from 'react';
|
||||
import Button from '../Button/Button';
|
||||
import { TriangleUpIcon, TriangleDownIcon } from '../../assets/icons/Triangle';
|
||||
import { useVolumeKeys } from '../../hooks/useVolumeKeys';
|
||||
import { useIsTouch } from '../../hooks/useIsTouch';
|
||||
import './ChoiceStepper.css';
|
||||
|
||||
const WHEEL_COMMIT_DELAY = 250;
|
||||
@@ -114,6 +116,8 @@ function StepperCore<T>({
|
||||
const [text, setText] = useState(formatLabel(value));
|
||||
|
||||
const inputRef = useRef<HTMLInputElement>(null);
|
||||
|
||||
const isMobile = useIsTouch();
|
||||
|
||||
// Latest-value refs, safe to read from async code and timers.
|
||||
const valueRef = useRef(value);
|
||||
@@ -245,6 +249,15 @@ function StepperCore<T>({
|
||||
}, WHEEL_COMMIT_DELAY);
|
||||
}
|
||||
|
||||
const rootRef = useRef<HTMLDivElement>(null);
|
||||
const { isSelected, select, deselect } = useVolumeKeys({
|
||||
rootRef,
|
||||
disabled,
|
||||
onStep: (direction) => {
|
||||
if (step(direction) !== null) scheduleWheelCommit();
|
||||
},
|
||||
});
|
||||
|
||||
useNonPassiveWheel(inputRef, (e) => {
|
||||
if (disabled) return;
|
||||
e.preventDefault();
|
||||
@@ -275,7 +288,6 @@ function StepperCore<T>({
|
||||
lastCommitted.current = value;
|
||||
setLocalValue(value);
|
||||
setText(formatLabel(value));
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [value, formatLabel]);
|
||||
|
||||
// When disabled, drop any in-progress interaction and show the real value.
|
||||
@@ -296,7 +308,6 @@ function StepperCore<T>({
|
||||
lastCommitted.current = v;
|
||||
setLocalValue(v);
|
||||
setText(formatLabelRef.current(v));
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [disabled]);
|
||||
|
||||
useEffect(() => {
|
||||
@@ -330,13 +341,20 @@ function StepperCore<T>({
|
||||
};
|
||||
|
||||
return (
|
||||
<div className={`choice-stepper ${className ?? ''}`} data-disabled={disabled || undefined}>
|
||||
<div
|
||||
ref={rootRef}
|
||||
className={`choice-stepper ${isMobile ? 'is-touch' : ''} ${isSelected ? 'is-selected' : ''} ${className ?? ''}`}
|
||||
data-disabled={disabled || undefined}
|
||||
onPointerDown={select}
|
||||
>
|
||||
<input
|
||||
ref={inputRef}
|
||||
id={id}
|
||||
className="choice-stepper__input"
|
||||
value={text}
|
||||
disabled={disabled}
|
||||
readOnly={isMobile}
|
||||
onFocus={deselect}
|
||||
onChange={(e) => {
|
||||
typing.current = true;
|
||||
setText(e.target.value);
|
||||
|
||||
@@ -431,6 +431,7 @@ export const LinearGraph = forwardRef<LinearGraphHandle, LinearGraphProps>(funct
|
||||
formatX,
|
||||
formatY,
|
||||
draw,
|
||||
cq.w
|
||||
]);
|
||||
|
||||
useEffect(() => {
|
||||
|
||||
@@ -1,23 +1,20 @@
|
||||
.notifications {
|
||||
position: fixed;
|
||||
right: var(--space-5);
|
||||
top: var(--space-5);
|
||||
top: calc(var(--topbar-h) + var(--space-3));
|
||||
z-index: 9999;
|
||||
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: var(--space-3);
|
||||
|
||||
width: 320px;
|
||||
width: min(320px, calc(100vw - 2 * var(--space-5)));
|
||||
pointer-events: none;
|
||||
|
||||
animation: notification-in var(--dur-slow) var(--ease-out); /* no "forwards" */
|
||||
touch-action: pan-y;
|
||||
}
|
||||
|
||||
.notification {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
align-items: flex-start;
|
||||
justify-content: space-between;
|
||||
gap: var(--space-3);
|
||||
|
||||
@@ -25,14 +22,34 @@
|
||||
border-radius: var(--radius-md);
|
||||
|
||||
font-size: 14px;
|
||||
line-height: 1.45;
|
||||
|
||||
box-shadow: var(--shadow-md);
|
||||
|
||||
animation: notification-in var(--dur-slow) var(--ease-out) forwards;
|
||||
/* no "forwards": it would keep overriding the inline drag transform */
|
||||
animation: notification-in var(--dur-slow) var(--ease-out);
|
||||
|
||||
pointer-events: auto;
|
||||
min-width: 0;
|
||||
|
||||
/* swipe behavior */
|
||||
touch-action: pan-y; /* browser keeps vertical scroll, we handle horizontal */
|
||||
user-select: none;
|
||||
-webkit-user-select: none;
|
||||
cursor: grab;
|
||||
will-change: transform, opacity;
|
||||
}
|
||||
|
||||
.notification--dragging {
|
||||
cursor: grabbing;
|
||||
}
|
||||
|
||||
/* once the user touches it, the inline style fully controls transform/opacity */
|
||||
.notification--touched:not(.notification-out) {
|
||||
animation: none;
|
||||
}
|
||||
|
||||
/* must stay "forwards" so it holds its end state until removal */
|
||||
.notification-out {
|
||||
animation: notification-out var(--dur-slow) var(--ease-in) forwards;
|
||||
}
|
||||
@@ -76,9 +93,10 @@
|
||||
|
||||
.notification-message {
|
||||
flex: 1;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
min-width: 0;
|
||||
white-space: normal;
|
||||
overflow-wrap: anywhere;
|
||||
word-break: normal;
|
||||
}
|
||||
|
||||
@keyframes notification-in {
|
||||
@@ -105,13 +123,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
/* After a swipe-dismiss, the inline transition takes over (no restart from translateX(0)) */
|
||||
.notification--swiped {
|
||||
animation: none;
|
||||
}
|
||||
|
||||
@media (pointer: coarse) {
|
||||
/* Undo the global 44px min-height on the small × button */
|
||||
.notification-close {
|
||||
min-height: 0;
|
||||
}
|
||||
@@ -119,11 +131,30 @@
|
||||
|
||||
@media (max-width: 768px) {
|
||||
.notifications {
|
||||
top: calc(var(--topbar-h, 0px) + var(--space-2));
|
||||
left: max(var(--space-3), var(--safe-left, 0px));
|
||||
right: max(var(--space-3), var(--safe-right, 0px));
|
||||
top: calc(var(--topbar-h) + var(--space-2));
|
||||
left: max(var(--space-3), var(--safe-left));
|
||||
right: max(var(--space-3), var(--safe-right));
|
||||
width: auto;
|
||||
max-width: 420px;
|
||||
margin-inline: auto;
|
||||
}
|
||||
|
||||
.notification {
|
||||
padding: var(--space-3);
|
||||
font-size: 14px;
|
||||
align-items: flex-start;
|
||||
}
|
||||
|
||||
.notification-message {
|
||||
white-space: normal;
|
||||
overflow: visible;
|
||||
text-overflow: unset;
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.notification {
|
||||
animation-duration: 1ms;
|
||||
}
|
||||
}
|
||||
@@ -8,9 +8,11 @@ type Props = {
|
||||
onHover: (id: number, hovering: boolean) => void;
|
||||
};
|
||||
|
||||
const DRAG_START_PX = 8; // movement before it counts as a swipe
|
||||
const DISMISS_RATIO = 0.35; // fraction of the width to drag before it dismisses
|
||||
const DISMISS_MS = 160;
|
||||
const DRAG_START_PX = 6; // movement before it counts as a swipe
|
||||
const DISMISS_RATIO = 0.35; // fraction of width to drag before it dismisses
|
||||
const FLICK_VELOCITY = 0.5; // px/ms, a fast flick dismisses even below the threshold
|
||||
const DISMISS_MS = 180;
|
||||
const SNAP_MS = 220;
|
||||
|
||||
function NotificationItem({
|
||||
n,
|
||||
@@ -23,25 +25,34 @@ function NotificationItem({
|
||||
}) {
|
||||
const ref = useRef<HTMLDivElement>(null);
|
||||
const startX = useRef<number | null>(null);
|
||||
const dxRef = useRef(0);
|
||||
const locked = useRef(false);
|
||||
const last = useRef({ x: 0, t: 0, v: 0 }); // for velocity
|
||||
|
||||
const [dx, setDx] = useState(0);
|
||||
const [dragging, setDragging] = useState(false);
|
||||
const [swiped, setSwiped] = useState(false);
|
||||
const [interacted, setInteracted] = useState(false); // disables the entry animation after first touch
|
||||
|
||||
function updateDx(v: number) {
|
||||
dxRef.current = v;
|
||||
setDx(v);
|
||||
}
|
||||
|
||||
function reset() {
|
||||
const wasLocked = locked.current;
|
||||
startX.current = null;
|
||||
locked.current = false;
|
||||
setDragging(false);
|
||||
setDx(0);
|
||||
updateDx(0); // transition handles the snap-back
|
||||
if (wasLocked) onHover(n.id, false);
|
||||
}
|
||||
|
||||
function onPointerDown(e: React.PointerEvent<HTMLDivElement>) {
|
||||
if (swiped || n.removing) return;
|
||||
if ((e.target as HTMLElement).closest('button')) return; // let the × button work
|
||||
if ((e.target as HTMLElement).closest('button')) return;
|
||||
startX.current = e.clientX;
|
||||
last.current = { x: e.clientX, t: performance.now(), v: 0 };
|
||||
locked.current = false;
|
||||
}
|
||||
|
||||
@@ -53,13 +64,25 @@ function NotificationItem({
|
||||
if (Math.abs(delta) < DRAG_START_PX) return;
|
||||
locked.current = true;
|
||||
e.currentTarget.setPointerCapture(e.pointerId);
|
||||
setInteracted(true);
|
||||
setDragging(true);
|
||||
onHover(n.id, true); // pause the auto-dismiss timer
|
||||
onHover(n.id, true); // pause auto-dismiss timer
|
||||
}
|
||||
setDx(delta);
|
||||
|
||||
// velocity (smoothed)
|
||||
const now = performance.now();
|
||||
const dt = now - last.current.t;
|
||||
if (dt > 0) {
|
||||
const instant = (e.clientX - last.current.x) / dt;
|
||||
last.current.v = last.current.v * 0.6 + instant * 0.4;
|
||||
}
|
||||
last.current.x = e.clientX;
|
||||
last.current.t = now;
|
||||
|
||||
updateDx(delta);
|
||||
}
|
||||
|
||||
function onPointerUp(e: React.PointerEvent<HTMLDivElement>) {
|
||||
function finish(e: React.PointerEvent<HTMLDivElement>) {
|
||||
if (startX.current === null) return;
|
||||
|
||||
if (!locked.current) {
|
||||
@@ -68,13 +91,18 @@ function NotificationItem({
|
||||
}
|
||||
|
||||
const width = ref.current?.offsetWidth ?? 300;
|
||||
if (Math.abs(dx) > width * DISMISS_RATIO) {
|
||||
const dir = dx > 0 ? 1 : -1;
|
||||
const dist = dxRef.current;
|
||||
const v = last.current.v;
|
||||
const flicked = Math.abs(v) > FLICK_VELOCITY && Math.sign(v) === Math.sign(dist);
|
||||
const farEnough = Math.abs(dist) > width * DISMISS_RATIO;
|
||||
|
||||
if (flicked || farEnough) {
|
||||
const dir = dist > 0 ? 1 : -1;
|
||||
startX.current = null;
|
||||
locked.current = false;
|
||||
setSwiped(true);
|
||||
setDragging(false);
|
||||
setDx(dir * width * 1.2);
|
||||
updateDx(dir * width * 1.1);
|
||||
window.setTimeout(() => onRemove(n.id), DISMISS_MS);
|
||||
} else {
|
||||
reset();
|
||||
@@ -85,14 +113,17 @@ function NotificationItem({
|
||||
}
|
||||
}
|
||||
|
||||
const touched = dx !== 0 || swiped;
|
||||
const style: React.CSSProperties | undefined = touched
|
||||
const width = ref.current?.offsetWidth ?? 300;
|
||||
const progress = Math.min(1, Math.abs(dx) / (width * 0.8));
|
||||
|
||||
const style: React.CSSProperties | undefined = interacted
|
||||
? {
|
||||
transform: `translateX(${dx}px)`,
|
||||
opacity: swiped ? 0 : Math.max(0.3, 1 - Math.abs(dx) / 300),
|
||||
opacity: swiped ? 0 : 1 - progress * 0.9,
|
||||
transition: dragging
|
||||
? 'none'
|
||||
: `transform ${DISMISS_MS}ms ease-out, opacity ${DISMISS_MS}ms ease-out`,
|
||||
: `transform ${swiped ? DISMISS_MS : SNAP_MS}ms cubic-bezier(0.22, 1, 0.36, 1),
|
||||
opacity ${swiped ? DISMISS_MS : SNAP_MS}ms ease-out`,
|
||||
}
|
||||
: undefined;
|
||||
|
||||
@@ -103,7 +134,8 @@ function NotificationItem({
|
||||
'notification',
|
||||
n.type,
|
||||
n.removing && !swiped ? 'notification-out' : '',
|
||||
swiped ? 'notification--swiped' : '',
|
||||
interacted ? 'notification--touched' : '',
|
||||
dragging ? 'notification--dragging' : '',
|
||||
]
|
||||
.filter(Boolean)
|
||||
.join(' ')}
|
||||
@@ -112,7 +144,7 @@ function NotificationItem({
|
||||
onMouseLeave={() => onHover(n.id, false)}
|
||||
onPointerDown={onPointerDown}
|
||||
onPointerMove={onPointerMove}
|
||||
onPointerUp={onPointerUp}
|
||||
onPointerUp={finish}
|
||||
onPointerCancel={reset}
|
||||
>
|
||||
<span className="notification-message" title={n.message}>
|
||||
|
||||
@@ -163,9 +163,16 @@ function SignalFlowMatrix({
|
||||
const commitTimers = useRef<Map<string, ReturnType<typeof setTimeout>>>(new Map());
|
||||
|
||||
useEffect(() => {
|
||||
const timers = commitTimers.current;
|
||||
const tooltipTimer = hideTooltipTimer.current;
|
||||
|
||||
return () => {
|
||||
if (hideTooltipTimer.current) clearTimeout(hideTooltipTimer.current);
|
||||
commitTimers.current.forEach(clearTimeout);
|
||||
if (tooltipTimer) {
|
||||
clearTimeout(tooltipTimer);
|
||||
}
|
||||
|
||||
timers.forEach((timer) => clearTimeout(timer));
|
||||
timers.clear();
|
||||
};
|
||||
}, []);
|
||||
|
||||
|
||||
@@ -88,25 +88,22 @@
|
||||
aspect-ratio: 1;
|
||||
}
|
||||
|
||||
.crown-action {
|
||||
height: 70%;
|
||||
aspect-ratio: 1;
|
||||
border-radius: 50%;
|
||||
color: #facc15;
|
||||
width: auto;
|
||||
}
|
||||
|
||||
.crown-action:hover {
|
||||
color: #fde047;
|
||||
}
|
||||
|
||||
.icon-crown,
|
||||
.icon-settings,
|
||||
.icon-tab-add,
|
||||
.icon-tab-add-empty {
|
||||
aspect-ratio: 1/1;
|
||||
height: 80%;
|
||||
}
|
||||
|
||||
.settings-action {
|
||||
height: 70%;
|
||||
width: auto;
|
||||
aspect-ratio: 1 / 1;
|
||||
border-radius: 50%;
|
||||
color: var(--text-muted);
|
||||
flex: 0 0 auto;
|
||||
}
|
||||
|
||||
.tab-add-empty {
|
||||
height: 70%;
|
||||
border-radius: var(--radius-pill);
|
||||
@@ -364,7 +361,7 @@
|
||||
|
||||
/* Buttons at least ~40px wide */
|
||||
.tab-add,
|
||||
.crown-action {
|
||||
.settings-action {
|
||||
height: 40px;
|
||||
width: 40px;
|
||||
}
|
||||
|
||||