The Android sideload APK never showed the consent gate and the file-load toast surfaced opaque content-URI document ids: 1. Legal gate: `consentStore` skipped the gate for ALL Tauri builds, justified by the desktop installer's license page — which the sideload APK doesn't have, so Android users never saw or accepted the terms. Add a build-time `__IS_ANDROID_BUILD__` define (`TAURI_ENV_PLATFORM === 'android'`) and gate only on desktop Tauri (`__IS_TAURI_BUILD__ && !__IS_ANDROID_BUILD__`); Android now shows the gate like the web build. Acceptance persists in the Android WebView's localStorage, so it asks only once. 2. Legal links: add an `openExternal()` helper that routes through `@tauri-apps/plugin-shell` inside Tauri (web keeps `window.open`), and wire the gate's License/Terms/Privacy/Disclaimer links to it — plain `target="_blank"` is swallowed by the Android WebView. 3. File-load toast: when the picked name has no usable extension (opaque Android content URIs like `msf:1000000123`), fall back to a count-based "N file(s) loaded" via new `toast.files_loaded` keys; keep the clean "Loaded <name>" when a real filename is available. Desktop/web are unchanged. Also reword `consent.intro` "in your browser" -> "on your device" (accurate on the native app). typecheck / lint / 215 tests / web build all green; verified on the Android emulator (gate shows once, links open the system browser, toast). Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
46 lines
1.1 KiB
TypeScript
46 lines
1.1 KiB
TypeScript
import { defineConfig } from 'vitest/config';
|
|
import react from '@vitejs/plugin-react';
|
|
import path from 'node:path';
|
|
import pkg from './package.json';
|
|
|
|
export default defineConfig({
|
|
plugins: [react()],
|
|
define: {
|
|
__APP_VERSION__: JSON.stringify(pkg.version),
|
|
__IS_TAURI_BUILD__: 'false',
|
|
__IS_ANDROID_BUILD__: 'false',
|
|
__APP_COMMIT__: '"test"',
|
|
__APP_BUILD_DATE__: '"1970-01-01"',
|
|
},
|
|
resolve: {
|
|
alias: {
|
|
'@': path.resolve(__dirname, './src'),
|
|
},
|
|
},
|
|
test: {
|
|
environment: 'jsdom',
|
|
// jsdom binds localStorage to the document origin; the default `about:blank`
|
|
// returns a stripped Storage shim. A proper http URL gives the full API.
|
|
environmentOptions: {
|
|
jsdom: {
|
|
url: 'http://localhost/',
|
|
},
|
|
},
|
|
setupFiles: ['./src/test/setup.ts'],
|
|
globals: true,
|
|
css: false,
|
|
coverage: {
|
|
provider: 'v8',
|
|
reporter: ['text', 'html'],
|
|
include: ['src/**/*.{ts,tsx}'],
|
|
exclude: [
|
|
'src/**/*.test.{ts,tsx}',
|
|
'src/**/__tests__/**',
|
|
'src/test/**',
|
|
'src/main.tsx',
|
|
'src/vite-env.d.ts',
|
|
],
|
|
},
|
|
},
|
|
});
|