1import { ProxyNativeModule } from 'expo-modules-core';
2
3// @docsMissing
4export enum AndroidNotificationVisibility {
5  UNKNOWN = 0,
6  PUBLIC = 1,
7  PRIVATE = 2,
8  SECRET = 3,
9}
10
11// @docsMissing
12export enum AndroidAudioContentType {
13  UNKNOWN = 0,
14  SPEECH = 1,
15  MUSIC = 2,
16  MOVIE = 3,
17  SONIFICATION = 4,
18}
19
20// @docsMissing
21export enum AndroidImportance {
22  UNKNOWN = 0,
23  UNSPECIFIED = 1,
24  NONE = 2,
25  MIN = 3,
26  LOW = 4,
27  DEFAULT = 5,
28  /**
29   * @deprecated Use `DEFAULT` instead.
30   */
31  DEEFAULT = 5,
32  HIGH = 6,
33  MAX = 7,
34}
35
36// @docsMissing
37export enum AndroidAudioUsage {
38  UNKNOWN = 0,
39  MEDIA = 1,
40  VOICE_COMMUNICATION = 2,
41  VOICE_COMMUNICATION_SIGNALLING = 3,
42  ALARM = 4,
43  NOTIFICATION = 5,
44  NOTIFICATION_RINGTONE = 6,
45  NOTIFICATION_COMMUNICATION_REQUEST = 7,
46  NOTIFICATION_COMMUNICATION_INSTANT = 8,
47  NOTIFICATION_COMMUNICATION_DELAYED = 9,
48  NOTIFICATION_EVENT = 10,
49  ASSISTANCE_ACCESSIBILITY = 11,
50  ASSISTANCE_NAVIGATION_GUIDANCE = 12,
51  ASSISTANCE_SONIFICATION = 13,
52  GAME = 14,
53}
54
55// @docsMissing
56export interface AudioAttributes {
57  usage: AndroidAudioUsage;
58  contentType: AndroidAudioContentType;
59  flags: {
60    enforceAudibility: boolean;
61    requestHardwareAudioVideoSynchronization: boolean;
62  };
63}
64
65// We're making inner flags required to set intentionally.
66// Not providing `true` for a flag makes it false, it doesn't make sense
67// to let it be left undefined.
68export type AudioAttributesInput = Partial<AudioAttributes>;
69
70/**
71 * An object represents a notification channel.
72 * @platform android
73 */
74export interface NotificationChannel {
75  id: string;
76  name: string | null;
77  importance: AndroidImportance;
78  bypassDnd: boolean;
79  description: string | null;
80  groupId?: string | null;
81  lightColor: string;
82  lockscreenVisibility: AndroidNotificationVisibility;
83  showBadge: boolean;
84  sound: 'default' | 'custom' | null;
85  audioAttributes: AudioAttributes;
86  vibrationPattern: number[] | null;
87  enableLights: boolean;
88  enableVibrate: boolean;
89}
90
91type RequiredBy<T, K extends keyof T> = Partial<Omit<T, K>> & Required<Pick<T, K>>;
92
93/**
94 * An object represents a notification channel to be set.
95 * @platform android
96 */
97export type NotificationChannelInput = RequiredBy<
98  Omit<
99    NotificationChannel,
100    | 'id' // id is handled separately as a function argument
101    | 'audioAttributes' // need to make it AudioAttributesInput
102    | 'sound'
103  > & { audioAttributes?: AudioAttributesInput; sound?: string | null },
104  'name' | 'importance'
105>;
106
107export interface NotificationChannelManager extends ProxyNativeModule {
108  getNotificationChannelsAsync?: () => Promise<NotificationChannel[] | null>;
109  getNotificationChannelAsync?: (channelId: string) => Promise<NotificationChannel | null>;
110  setNotificationChannelAsync?: (
111    channelId: string,
112    channelConfiguration: NotificationChannelInput
113  ) => Promise<NotificationChannel | null>;
114  deleteNotificationChannelAsync?: (channelId: string) => Promise<void>;
115}
116