1import { UnavailabilityError } from 'expo-modules-core';
2
3import NotificationPresenter from './NotificationPresenterModule';
4
5/**
6 * Removes notification displayed in the notification tray (Notification Center).
7 * @param notificationIdentifier The notification identifier, obtained either via `setNotificationHandler` method or in the listener added with `addNotificationReceivedListener`.
8 * @return A Promise which resolves once the request to dismiss the notification is successfully dispatched to the notifications manager.
9 * @header dismiss
10 */
11export default async function dismissNotificationAsync(
12  notificationIdentifier: string
13): Promise<void> {
14  if (!NotificationPresenter.dismissNotificationAsync) {
15    throw new UnavailabilityError('Notifications', 'dismissNotificationAsync');
16  }
17
18  return await NotificationPresenter.dismissNotificationAsync(notificationIdentifier);
19}
20