lavva.exalushome
Version:
Library implementing communication and abstraction layers for ExalusHome system
45 lines (44 loc) • 1.96 kB
TypeScript
import { IDIService } from "../IDIService";
export interface IAndroidNotificationsService extends IDIService {
CheckNotificationPermissionAsync(): Promise<boolean>;
RequestNotificationPermissionAsync(): Promise<boolean>;
IsAndroidNotificationsAvailable(): boolean;
GetDeviceFirebaseTokenAsync(): Promise<string | null>;
GetNotificationsQueueAsync(): Promise<INotificationsQueue | null>;
}
export interface INotificationsQueue {
/** Event that is triggered when new notifications arrive. */
OnNotificationsRecived?: (recivedNotificationInfo: ILavvaNotificationRecived) => void;
/** Pulls all pending notifications from the native queue. */
GetNotificationsFromQueueAsync(): Promise<ILavvaNotification[]>;
/**
* Pulls a single notification by its GUID.
* @param guid The GUID of the notification to retrieve - recived by OnNotificationsRecived event obj. .
*/
GetNotificationByGuidAsync(guid: string): Promise<ILavvaNotification | null>;
}
export interface ILavvaNotification {
RecivedAt: Date;
Title: string;
Body: string;
Icon: string;
Data: Record<string, any>;
Intent: string | null;
}
export interface ILavvaNotificationRecived {
/** Number of items in the push queue */
PushQueueCnt: number;
/** GUID of the newly received element */
NewElementGuid: string;
/** True if this was an intent-based push notification (event was emitted when user clicks on intent) */
IsIntentPush: boolean;
}
export declare class AndroidNotificationsService implements IAndroidNotificationsService {
static readonly ServiceName: string;
IsAndroidNotificationsAvailable(): boolean;
CheckNotificationPermissionAsync(): Promise<boolean>;
RequestNotificationPermissionAsync(): Promise<boolean>;
GetDeviceFirebaseTokenAsync(): Promise<string | null>;
GetNotificationsQueueAsync(): Promise<INotificationsQueue | null>;
GetServiceName(): string;
}