@talkjs/react-native
Version:
Official TalkJS SDK for React Native
87 lines • 3.08 kB
TypeScript
import type { Event as NotifeeEvent } from '@notifee/react-native';
import type { FirebaseMessagingTypes } from '@react-native-firebase/messaging';
export interface DeviceToken {
provider: 'fcm' | 'apns';
pushRegistrationId: string;
}
export interface NotificationPressedEvent {
id: string;
isForegroundEvent: boolean;
body?: string;
title?: string;
data?: {
senderId: string;
conversationId: string;
timestamp: number;
messageId: string;
};
}
export type TokenRefreshHandler = (oldToken: DeviceToken, newToken: DeviceToken) => void;
export type NotificationPressedHandler = (notification: NotificationPressedEvent) => void;
export declare enum AuthorizationStatus {
notDetermined = 0,// The user hasn't yet made a choice about whether the app is allowed to schedule notifications.
denied = 1,// The app isn't authorized to schedule or receive notifications.
authorized = 2,// The app is authorized to schedule or receive notifications.
provisional = 3,// The application is provisionally authorized to post noninterruptive user notifications.
ephemeral = 4
}
export declare enum AndroidVisibility {
/**
* Show the notification on all lockscreens, but conceal sensitive or private information on secure lockscreens.
*/
PRIVATE = 0,
/**
* Show this notification in its entirety on all lockscreens.
*/
PUBLIC = 1,
/**
* Do not reveal any part of this notification on a secure lockscreen.
*
* Useful for notifications showing sensitive information such as banking apps.
*/
SECRET = -1
}
export declare enum AndroidImportance {
HIGH = 4,
DEFAULT = 3,
LOW = 2,
MIN = 1,
NONE = 0
}
export interface AndroidSettings {
channelId: string;
channelName: string;
badge?: boolean;
channelDescription?: string;
lights?: boolean;
lightColor?: string;
bypassDnd?: boolean;
playSound?: string;
importance?: AndroidImportance;
visibility?: AndroidVisibility;
vibrate?: boolean;
vibrationPattern?: number[];
}
export interface IOSSettings {
useFirebase?: boolean;
}
export interface NotificationHandler {
deviceToken: DeviceToken;
onTokenRefresh(handler: TokenRefreshHandler): void;
onNotificationPressed(handler: NotificationPressedHandler): void;
}
export interface InternalNotificationHandler extends NotificationHandler {
_getTokenPromise(): Promise<void>;
}
export declare class TokenHandler implements InternalNotificationHandler {
#private;
resolveTokenPromise: () => void;
constructor(provider: 'fcm' | 'apns');
get deviceToken(): DeviceToken;
_getTokenPromise(): Promise<void>;
onTokenRefresh(handler: TokenRefreshHandler): void;
onNotificationPressed(handler: NotificationPressedHandler): void;
protected notificationPressed(event: NotifeeEvent | FirebaseMessagingTypes.RemoteMessage, isForegroundEvent: boolean): void;
protected setPushRegistrationId(value: string): void;
}
//# sourceMappingURL=Notification.d.ts.map