@ua/react-native-airship
Version:
Airship plugin for React Native apps.
161 lines • 5.4 kB
TypeScript
import { Android, iOS, PushNotificationStatus, PushPayload, PromptPermissionFallback } from './types';
/**
* Airship Push.
*/
export declare class AirshipPush {
private readonly module;
/**
* iOS only push methods.
*/
readonly iOS: AirshipPushIOS;
/**
* Android only push methods.
*/
readonly android: AirshipPushAndroid;
constructor(module: any);
/**
* Enables/disables notifications on Airship.
*
* When enabled, it will cause the user to be prompted for
* the permission on platforms that support it.
* To get the result of the prompt, use `enableUserNotifications`.
* @param enabled true to enable, false to disable
* @returns A promise.
*/
setUserNotificationsEnabled(enabled: boolean): Promise<void>;
/**
* Checks if user notifications are enabled or not on Airship.
* @returns A promise with the result.
*/
isUserNotificationsEnabled(): Promise<boolean>;
/**
* Enables user notifications.
* @param options Optional options.
* @returns A promise with the permission result.
*/
enableUserNotifications(options?: {
fallback?: PromptPermissionFallback;
}): Promise<boolean>;
/**
* Gets the notification status.
* @returns A promise with the result.
*/
getNotificationStatus(): Promise<PushNotificationStatus>;
/**
* Gets the registration token if generated.
* Use the event EventType.PushTokenReceived to be notified
* when available.
* @returns A promise with the result.
*/
getRegistrationToken(): Promise<string | null | undefined>;
/**
* Gets the list of active notifications.
*
* On Android, this list only includes notifications
* sent through Airship.
* @returns A promise with the result.
*/
getActiveNotifications(): Promise<PushPayload[]>;
/**
* Clears all notifications for the app.
*/
clearNotifications(): void;
/**
* Clears a specific notification.
*
* On Android, you can use this method to clear
* notifications outside of Airship, The identifier is in
* the format of <tag>:<id>.
* @param identifier The identifier.
*/
clearNotification(identifier: string): void;
}
/**
* iOS Push.
*/
export declare class AirshipPushIOS {
private readonly module;
private eventEmitter;
private presentationOverridesCallback?;
constructor(module: any);
/**
* Overrides the presentation options per notification. If a `null` is returned, the default
* options will be used. The callback should return as quickly as possible to avoid delaying notification delivery.
*
* @param callback A callback that can override the foreground presentation options.
*/
setForegroundPresentationOptionsCallback(callback?: (pushPayload: PushPayload) => Promise<iOS.ForegroundPresentationOption[] | null>): void;
/**
* Sets the foreground presentation options.
* @param options The foreground options.
* @returns A promise.
*/
setForegroundPresentationOptions(options: iOS.ForegroundPresentationOption[]): Promise<void>;
/**
* Sets the notification options.
* @param options The notification options.
* @returns A promise.
*/
setNotificationOptions(options: iOS.NotificationOption[]): Promise<void>;
/**
* Checks if autobadge is enabled.
* @returns A promise with the result.
*/
isAutobadgeEnabled(): Promise<boolean>;
/**
* Enables/disables autobadge.
* @param enabled true to enable, false to disable.
* @returns A promise.
*/
setAutobadgeEnabled(enabled: boolean): Promise<void>;
/**
* Set the badge number.
* @param badge The badge number.
* @returns A promise.
*/
setBadgeNumber(badge: number): Promise<void>;
/**
* Gets the badge number.
* @returns A promise with the result.
*/
getBadgeNumber(): Promise<number>;
/**
* Gets the list of authorized notification settings.
* @returns A promise with the result.
*/
getAuthorizedNotificationSettings(): Promise<iOS.AuthorizedNotificationSetting[]>;
/**
* Gets the authorized notification status.
* @returns A promise with the result.
*/
getAuthorizedNotificationStatus(): Promise<iOS.AuthorizedNotificationStatus>;
}
/**
* Android Push.
*/
export declare class AirshipPushAndroid {
private readonly module;
private eventEmitter;
private foregroundDisplayPredicate?;
constructor(module: any);
/**
* Checks if a notification category/channel is enabled.
* @param channel The channel name.
* @returns A promise with the result.
*/
isNotificationChannelEnabled(channel: string): Promise<boolean>;
/**
* Sets the notification config.
* @param config The notification config.
*/
setNotificationConfig(config: Android.NotificationConfig): void;
/**
* Overrides the foreground display per notification.
*
* The predicate should return as quickly as possible to avoid delaying notification delivery.
*
* @param predicate A foreground display predicate.
*/
setForegroundDisplayPredicate(predicate?: (pushPayload: PushPayload) => Promise<boolean>): void;
}
//# sourceMappingURL=AirshipPush.d.ts.map