Notifications app checks for and requests notifications access

This commit is contained in:
James Babcock committed 2026-07-10 23:44:17 -07:00
1 parent 17cc0bba83
commit c71dbbc9f2
3 files changed
+48 -1

No files matched your search

+33
View File
@@ -0,0 +1,33 @@
import { Utils } from "@nativescript/core";
declare const com: any;
/**
* Notification-listener access ("read notifications") checks. Faceclaw reads
* the phone's active notifications through
* FaceclawMediaNotificationListenerService to mirror them onto the glasses
* (top-bar icons and the Notifications app). That service only connects once
* the user grants notification access in system settings; until then it never
* binds, so getActiveNotifications() returns nothing and the mirror is blank.
*
* The underlying check/launch live in FaceclawEvenAppDetector (which also uses
* them to detect the stock Even app's notification-service conflict); these are
* thin wrappers so the Notifications app can gate on the permission without
* reaching through the Even-app-conflict API.
*/
/** True when the user has granted Faceclaw notification-listener access. */
export function isNotificationListenerEnabled(): boolean {
if (!global.isAndroid) return true;
const context = Utils.android.getApplicationContext();
if (!context) return false;
return Boolean(com.faceclaw.app.FaceclawEvenAppDetector.isNotificationAccessEnabled(context));
}
/** Open the system screen where the user grants Faceclaw notification access. */
export function requestNotificationListenerAccess(): void {
if (!global.isAndroid) return;
const context = Utils.android.getApplicationContext();
if (!context) return;
com.faceclaw.app.FaceclawEvenAppDetector.openNotificationAccessSettings(context);
}