android: downloads on Wi-Fi only

One switch the desktop never needed, off by default: on mobile data every
Save the phone can start — a record, a track, a folder, a file, a
playlist's bulk, the now-playing Save — waits, with the reason on the bar;
streaming is never held back. The walk flips the switch, makes the
connection cellular and sees a download refused.
This commit is contained in:
KeelrLeek committed 2026-09-13 22:15:07 -05:00
1 parent 3c8989dfa6
commit 694a29eb0d
10 files changed
+55 -5

No files matched your search

+22
View File
@@ -0,0 +1,22 @@
/* The phone's connection — for the one guard the desktop never needed:
downloads kept to Wi-Fi when the switch says so (You → Downloads).
Streaming is never refused: that is what a phone on the network is for.
navigator.connection is Chrome's; a WebView without it reports nothing,
and nothing is refused. */
import { settings } from "./prefs.svelte.js";
import { player } from "./player.svelte.js";
export const cellular = () => {
const c = typeof navigator !== "undefined" ? navigator.connection : null;
return !!c && c.type === "cellular";
};
export const NO_WIFI = "Downloads wait for Wi-Fi — the switch is under You → Downloads.";
/** true when a download may start now; otherwise the reason is on the bar */
export function downloadsAllowed() {
if (settings.wifiOnly && cellular()) {
player.error = NO_WIFI;
return false;
}
return true;
}