1import { PermissionResponse, PermissionHookOptions } from 'expo-modules-core';
2
3export enum IosAlertStyle {
4  NONE = 0,
5  BANNER = 1,
6  ALERT = 2,
7}
8
9export enum IosAllowsPreviews {
10  NEVER = 0,
11  ALWAYS = 1,
12  WHEN_AUTHENTICATED = 2,
13}
14
15export enum IosAuthorizationStatus {
16  NOT_DETERMINED = 0,
17  DENIED = 1,
18  AUTHORIZED = 2,
19  PROVISIONAL = 3,
20  EPHEMERAL = 4,
21}
22
23export { PermissionHookOptions };
24
25// @docsMissing
26export interface NotificationPermissionsStatus extends PermissionResponse {
27  android?: {
28    importance: number;
29    interruptionFilter?: number;
30  };
31  ios?: {
32    status: IosAuthorizationStatus;
33    allowsDisplayInNotificationCenter: boolean | null;
34    allowsDisplayOnLockScreen: boolean | null;
35    allowsDisplayInCarPlay: boolean | null;
36    allowsAlert: boolean | null;
37    allowsBadge: boolean | null;
38    allowsSound: boolean | null;
39    allowsCriticalAlerts?: boolean | null;
40    alertStyle: IosAlertStyle;
41    allowsPreviews?: IosAllowsPreviews;
42    providesAppNotificationSettings?: boolean;
43    allowsAnnouncements?: boolean | null;
44  };
45}
46
47/**
48 * Available configuration for permission request on iOS platform.
49 * See Apple documentation for [`UNAuthorizationOptions`](https://developer.apple.com/documentation/usernotifications/unauthorizationoptions) to learn more.
50 */
51export interface IosNotificationPermissionsRequest {
52  /**
53   * The ability to display alerts.
54   */
55  allowAlert?: boolean;
56  /**
57   * The ability to update the app’s badge.
58   */
59  allowBadge?: boolean;
60  /**
61   * The ability to play sounds.
62   */
63  allowSound?: boolean;
64  /**
65   * The ability to display notifications in a CarPlay environment.
66   */
67  allowDisplayInCarPlay?: boolean;
68  /**
69   * The ability to play sounds for critical alerts.
70   */
71  allowCriticalAlerts?: boolean;
72  /**
73   * An option indicating the system should display a button for in-app notification settings.
74   */
75  provideAppNotificationSettings?: boolean;
76  /**
77   * The ability to post noninterrupting notifications provisionally to the Notification Center.
78   */
79  allowProvisional?: boolean;
80  /**
81   * The ability for Siri to automatically read out messages over AirPods.
82   * @deprecated
83   */
84  allowAnnouncements?: boolean;
85}
86
87export type NativeNotificationPermissionsRequest = IosNotificationPermissionsRequest | object;
88
89/**
90 * An interface representing the permissions request scope configuration.
91 * Each option corresponds to a different native platform authorization option.
92 */
93export interface NotificationPermissionsRequest {
94  /**
95   * Available configuration for permission request on iOS platform.
96   */
97  ios?: IosNotificationPermissionsRequest;
98  /**
99   * On Android, all available permissions are granted by default, and if a user declines any permission, an app cannot prompt the user to change.
100   */
101  android?: object;
102}
103