forked from Blendman974/faceclaw
Refinements to bulitin games
All: settings persistence All: pause on menu Flappy: both swipe directions trigger flaps Freecell: skip irrelevant locations Blocks: Lower speed/difficulty Pinball: remove the half-implemented Nudge gesture.
This commit is contained in:
1 parent
937c73d81b
commit
c9e95a3f69
12 files changed
+317
-108
No files matched your search
@@ -0,0 +1,26 @@
|
||||
/**
|
||||
* The "Sound: on/off" entry in a game's context menu, persisted per app under
|
||||
* `<appId>.soundOn` so each game remembers its own choice across launches.
|
||||
* Reads default to on; storage failures fall back to on and never throw.
|
||||
*/
|
||||
import { getBooleanSetting, setBooleanSetting } from "../native/settings-store";
|
||||
|
||||
function soundKey(appId: string): string {
|
||||
return `${appId}.soundOn`;
|
||||
}
|
||||
|
||||
export function loadSoundEnabled(appId: string): boolean {
|
||||
try {
|
||||
return getBooleanSetting(soundKey(appId), true);
|
||||
} catch {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
export function saveSoundEnabled(appId: string, enabled: boolean): void {
|
||||
try {
|
||||
setBooleanSetting(soundKey(appId), enabled);
|
||||
} catch (error) {
|
||||
console.warn(`${appId} sound setting save failed: ${error}`);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user