-
Notifications
You must be signed in to change notification settings - Fork 2.9k
/
UserNotificationCenterProtocol.swift
23 lines (20 loc) · 1.24 KB
/
UserNotificationCenterProtocol.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/
import Foundation
import UserNotifications
// Protocol with UNUserNotificationCenter methods so we can mock UNUserNotificationCenter for unit testing
protocol UserNotificationCenterProtocol {
func getNotificationSettings(completionHandler: @escaping (UNNotificationSettings) -> Void)
func requestAuthorization(options: UNAuthorizationOptions,
completionHandler: @escaping (Bool, Error?) -> Void)
func add(_ request: UNNotificationRequest, withCompletionHandler completionHandler: ((Error?) -> Void)?)
func getPendingNotificationRequests(completionHandler: @escaping ([UNNotificationRequest]) -> Void)
func removePendingNotificationRequests(withIdentifiers identifiers: [String])
func removeAllPendingNotificationRequests()
func getDeliveredNotifications(completionHandler: @escaping ([UNNotification]) -> Void)
func removeDeliveredNotifications(withIdentifiers identifiers: [String])
func removeAllDeliveredNotifications()
}
extension UNUserNotificationCenter: UserNotificationCenterProtocol {
}