mirror of
https://git.undefined-dev.fr/Blendman974/faceclaw.git
synced 2026-11-29 13:03:11 +00:00
Don't show EvenHub store, and show compatibility warning on sideloaded apps, when using RayNeo iO
This commit is contained in:
1 parent
43738b181d
commit
b866224909
10 files changed
+701
-183
No files matched your search
@@ -0,0 +1,38 @@
|
||||
/**
|
||||
* EvenHub with glasses that aren't Even Realities': with a RayNeo iO paired,
|
||||
* the store is off (it is Even's, and its apps are made for their glasses),
|
||||
* while apps sideloaded through Files or the Developer app still run, after a
|
||||
* warning the first time each one launches that it won't display correctly
|
||||
* (EvenHub apps lay out for the G2's 576x288 display; the iO's is 540x220).
|
||||
*/
|
||||
import { glassesTypeSetting } from "../../ui/dashboard-settings";
|
||||
import { getStringSetting, setStringSetting } from "../../native/settings-store";
|
||||
|
||||
/** The package IDs whose RayNeo iO display warning has been answered, as a JSON array. */
|
||||
const DISPLAY_WARNED_KEY = "evenhub.rayneoDisplayWarned";
|
||||
|
||||
/** Whether the EvenHub store can be used: with Even Realities glasses paired, not a RayNeo iO. */
|
||||
export function isEvenHubStoreAvailable(): boolean {
|
||||
return glassesTypeSetting.get() !== "rayneo-io";
|
||||
}
|
||||
|
||||
/** Whether launching this package should warn that it won't display correctly on these glasses. */
|
||||
export function needsDisplayWarning(packageId: string): boolean {
|
||||
return glassesTypeSetting.get() === "rayneo-io" && !displayWarnedPackages().includes(packageId);
|
||||
}
|
||||
|
||||
/** The user answered the package's display warning: don't show it again. */
|
||||
export function markDisplayWarningShown(packageId: string): void {
|
||||
const warned = displayWarnedPackages();
|
||||
if (warned.includes(packageId)) return;
|
||||
setStringSetting(DISPLAY_WARNED_KEY, JSON.stringify([...warned, packageId]));
|
||||
}
|
||||
|
||||
function displayWarnedPackages(): string[] {
|
||||
try {
|
||||
const parsed: unknown = JSON.parse(getStringSetting(DISPLAY_WARNED_KEY, "[]"));
|
||||
return Array.isArray(parsed) ? parsed.filter((id): id is string => typeof id === "string") : [];
|
||||
} catch {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user