Skip to content

Commit 033ed2d

Browse files
committed
Fix sonar
1 parent 9b4b089 commit 033ed2d

File tree

2 files changed

+6
-51
lines changed

2 files changed

+6
-51
lines changed

android-env.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ export ANDROID_HOME="$HOME/Android/Sdk"
77
export ANDROID_SDK_ROOT="$ANDROID_HOME"
88

99
# Find the NDK version automatically (uses the first one found)
10-
if [ -d "$ANDROID_HOME/ndk" ]; then
10+
if [[ -d "$ANDROID_HOME/ndk" ]]; then
1111
NDK_VERSION=$(ls -1 "$ANDROID_HOME/ndk" | head -n 1)
12-
if [ -n "$NDK_VERSION" ]; then
12+
if [[ -n "$NDK_VERSION" ]]; then
1313
export NDK_HOME="$ANDROID_HOME/ndk/$NDK_VERSION"
1414
echo "Found NDK version: $NDK_VERSION"
1515
else
@@ -23,7 +23,7 @@ fi
2323

2424
# Add Android tools to PATH
2525
export PATH="$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools"
26-
if [ -n "$NDK_HOME" ]; then
26+
if [[ -n "$NDK_HOME" ]]; then
2727
export PATH="$PATH:$NDK_HOME"
2828
fi
2929

@@ -36,9 +36,9 @@ echo "NDK_HOME=$NDK_HOME"
3636
echo ""
3737

3838
# Check if SDK exists
39-
if [ ! -d "$ANDROID_HOME" ]; then
40-
echo "ERROR: Android SDK not found at $ANDROID_HOME"
41-
echo "Please install Android SDK or update the ANDROID_HOME path in this script"
39+
if [[ ! -d "$ANDROID_HOME" ]]; then
40+
echo "ERROR: Android SDK not found at $ANDROID_HOME" >&2
41+
echo "Please install Android SDK or update the ANDROID_HOME path in this script" >&2
4242
return 1 2>/dev/null || exit 1
4343
fi
4444

src/js/utils/checkBrowserCompatibility.js

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,6 @@
11
import { Capacitor } from "@capacitor/core";
22
import { isTauri } from "@tauri-apps/api/core";
33

4-
// In dev on Android/WebView, a previously installed service worker can cache assets
5-
// and prevent hot updates from Vite. Proactively unregister all SW and clear caches
6-
// when running in dev or in a native (Capacitor/Tauri) context.
7-
async function disableServiceWorkersForDev() {
8-
try {
9-
const isDev = (() => {
10-
try {
11-
return !!(import.meta && import.meta.env && import.meta.env.DEV);
12-
} catch (_) {
13-
return false;
14-
}
15-
})();
16-
const isNative = Capacitor?.isNativePlatform?.() === true;
17-
if ((isDev || isNative) && typeof navigator !== "undefined" && "serviceWorker" in navigator) {
18-
const regs = await navigator.serviceWorker.getRegistrations();
19-
for (const r of regs) {
20-
try {
21-
await r.unregister();
22-
} catch (_) {}
23-
}
24-
if (typeof caches !== "undefined" && caches?.keys) {
25-
const keys = await caches.keys();
26-
for (const k of keys) {
27-
try {
28-
await caches.delete(k);
29-
} catch (_) {}
30-
}
31-
}
32-
// Also attempt to stop active controller
33-
if (navigator.serviceWorker.controller) {
34-
try {
35-
navigator.serviceWorker.controller.postMessage({ type: "SKIP_WAITING" });
36-
} catch (_) {}
37-
}
38-
// Small delay to ensure SW is cleared before app logic proceeds
39-
await new Promise((res) => setTimeout(res, 50));
40-
}
41-
} catch (_) {
42-
// best-effort; ignore
43-
}
44-
}
45-
46-
// Fire and forget; we don't block app init
47-
// disableServiceWorkersForDev();
48-
494
// Detects OS using modern userAgentData API with fallback to legacy platform
505
// Returns standardized OS name string or "unknown"
516
export function getOS() {

0 commit comments

Comments
 (0)