WIP - a lot of uncommitted work
This commit is contained in:
@@ -106,38 +106,3 @@ class LocalNotification {
|
||||
UNUserNotificationCenter.current().removeAllPendingNotificationRequests()
|
||||
}
|
||||
}
|
||||
|
||||
class NotificationDelegate: NSObject, ObservableObject, UNUserNotificationCenterDelegate {
|
||||
@Published var notificationCounter = 0
|
||||
|
||||
override init() {
|
||||
super.init()
|
||||
UNUserNotificationCenter.current().delegate = self
|
||||
}
|
||||
|
||||
func requestAuthorization() {
|
||||
|
||||
}
|
||||
|
||||
func userNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification, withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void) {
|
||||
completionHandler([.badge, .banner, .sound])
|
||||
}
|
||||
|
||||
func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -> Void) {
|
||||
if let action = LocalNotification.ActionType(rawValue: response.actionIdentifier) {
|
||||
switch action {
|
||||
case .horrible:
|
||||
PersistenceController.shared.add(mood: .horrible, forDate: Date())
|
||||
case .bad:
|
||||
PersistenceController.shared.add(mood: .bad, forDate: Date())
|
||||
case .average:
|
||||
PersistenceController.shared.add(mood: .average, forDate: Date())
|
||||
case .good:
|
||||
PersistenceController.shared.add(mood: .good, forDate: Date())
|
||||
case .great:
|
||||
PersistenceController.shared.add(mood: .great, forDate: Date())
|
||||
}
|
||||
}
|
||||
completionHandler()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user