forked from Blendman974/faceclaw
Add stats collection and first-run on-glasses onboarding app
This commit is contained in:
1 parent
84baee9c76
commit
406cefe0c5
73 files changed
+3906
-98
No files matched your search
@@ -0,0 +1,34 @@
|
||||
/**
|
||||
* Whether the on-glasses onboarding is due: it is recorded as finished per
|
||||
* Faceclaw version, so it runs on the first connection after phone-side
|
||||
* setup and again after any upgrade. The key shares the phone onboarding's
|
||||
* "onboarding." prefix so scripts/resetOnboarding.sh clears it too.
|
||||
*/
|
||||
import { getStringSetting, setStringSetting } from "../../native/settings-store";
|
||||
import { FACECLAW_VERSION } from "../../version";
|
||||
|
||||
export const ONBOARDING_APP_ID = "onboarding";
|
||||
|
||||
const FINISHED_VERSION_KEY = "onboarding.glassesFinishedVersion";
|
||||
|
||||
export function isGlassesOnboardingDue(): boolean {
|
||||
return getStringSetting(FINISHED_VERSION_KEY, "") !== FACECLAW_VERSION;
|
||||
}
|
||||
|
||||
export function markGlassesOnboardingFinished(): void {
|
||||
setStringSetting(FINISHED_VERSION_KEY, FACECLAW_VERSION);
|
||||
}
|
||||
|
||||
let autoLaunchChecked = false;
|
||||
|
||||
/**
|
||||
* Asked by the connection controllers on each rendered frame (the session
|
||||
* is warm by then, so the onboarding's welcome jingle won't be dropped).
|
||||
* True at most once per run, and only when onboarding is due: closing it
|
||||
* unfinished brings it back on the next app start, not on every reconnect.
|
||||
*/
|
||||
export function claimGlassesOnboardingAutoLaunch(): boolean {
|
||||
if (autoLaunchChecked) return false;
|
||||
autoLaunchChecked = true;
|
||||
return isGlassesOnboardingDue();
|
||||
}
|
||||
Reference in new issue
Block a user