Files
SoulStream/src/mobile/network.svelte.js
T
KeelrLeek 694a29eb0d 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.
2026-09-13 22:15:07 -05:00

23 lines
904 B
JavaScript

/* 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;
}