forked from Blendman974/faceclaw
Onboarding fixes: Stuck state on the Permissions page, some dark-on-dark text in dark mode
This commit is contained in:
1 parent
b866224909
commit
ac68ba5991
6 files changed
+161
-12
No files matched your search
@@ -236,3 +236,10 @@ Button.permissions-primary-dimmed {
|
||||
.ns-dark .permissions-check {
|
||||
color: #7bc47f;
|
||||
}
|
||||
|
||||
/* Onboarding splash (phone-ui/onboarding-page). The logo art is
|
||||
* black-on-transparent; tint it white in dark mode so it doesn't vanish into
|
||||
* the dark page background. */
|
||||
.ns-dark .onboarding-logo {
|
||||
tint-color: #ffffff;
|
||||
}
|
||||
@@ -107,7 +107,7 @@ const ANDROID_PERMISSIONS: PermissionDefinition[] = [
|
||||
const PERMISSIONS: PermissionDefinition[] = global.isIOS ? [{
|
||||
id: "nearby-devices", title: "Nearby Devices",
|
||||
description: "Needed to communicate with your smart glasses over Bluetooth.", optional: false,
|
||||
isGranted: () => iosBluetooth().state === 5,
|
||||
isGranted: () => iosBluetooth().isAuthorized(),
|
||||
request: () => iosBluetooth().ensureReady(),
|
||||
}, {
|
||||
id: "calendar", title: "Calendar",
|
||||
@@ -143,6 +143,7 @@ export class PermissionsViewModel extends Observable {
|
||||
private readonly onboarding: boolean;
|
||||
private _cards: PermissionCardItem[] = [];
|
||||
private requesting = false;
|
||||
private stopWatchingBluetooth: (() => void) | null = null;
|
||||
|
||||
constructor(options?: { onboarding?: boolean }) {
|
||||
super();
|
||||
@@ -159,11 +160,20 @@ export class PermissionsViewModel extends Observable {
|
||||
|
||||
onPageLoaded(): void {
|
||||
Application.on(Application.resumeEvent, this.onAppResume);
|
||||
// The answer to the Bluetooth prompt can arrive after request() has stopped
|
||||
// waiting for it, and with no resume to re-check on.
|
||||
if (global.isIOS) {
|
||||
this.stopWatchingBluetooth = iosBluetooth().onEvent((event) => {
|
||||
if (event.kind === "state") this.refresh();
|
||||
});
|
||||
}
|
||||
this.refresh();
|
||||
}
|
||||
|
||||
onPageUnloaded(): void {
|
||||
Application.off(Application.resumeEvent, this.onAppResume);
|
||||
this.stopWatchingBluetooth?.();
|
||||
this.stopWatchingBluetooth = null;
|
||||
}
|
||||
|
||||
// --- observable properties -------------------------------------------------
|
||||
@@ -177,7 +187,7 @@ export class PermissionsViewModel extends Observable {
|
||||
}
|
||||
|
||||
get instructions(): string {
|
||||
if (global.isIOS) return "Faceclaw uses Bluetooth to communicate with your smart glasses. Calendar and Apple Music access are optional. Tap a card to allow access; a checkmark means it is ready.";
|
||||
if (global.isIOS) return "Faceclaw uses Bluetooth to communicate with your smart glasses. Calendar and Apple Music access are optional. Tap a card to allow access; a checkmark means access is allowed.";
|
||||
return this.onboarding
|
||||
? `Faceclaw uses these ${global.isIOS ? "iOS" : "Android"} permissions. Tap a card to grant one; a checkmark means it is already granted. ` +
|
||||
"Optional permissions can also be granted later, from the Permissions item in the main-screen menu."
|
||||
|
||||
Reference in new issue
Block a user