From b6c463cb8a1599aa87976d894f9cb194f8935f79 Mon Sep 17 00:00:00 2001 From: m1rosh Date: Tue, 21 May 2024 15:19:36 +0300 Subject: [PATCH] notify fix --- .../BlinkingText + TimerView.swift | 31 +++++++++---------- 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/LiveRecipes/Modules/Cooking/AnimatedElements/BlinkingText + TimerView.swift b/LiveRecipes/Modules/Cooking/AnimatedElements/BlinkingText + TimerView.swift index 8cd277a..d5c34f5 100644 --- a/LiveRecipes/Modules/Cooking/AnimatedElements/BlinkingText + TimerView.swift +++ b/LiveRecipes/Modules/Cooking/AnimatedElements/BlinkingText + TimerView.swift @@ -85,24 +85,21 @@ struct TimerView: View { print("add") } - addRequest() + + center.getNotificationSettings { settings in + if settings.authorizationStatus == .authorized { + addRequest() + } else { + center.requestAuthorization(options: [.alert, .badge, .sound]) { success, _ in + if success { + addRequest() + } else { + print("Authorization declined") + } + } + } + } return identifier - - - -// center.getNotificationSettings { settings in -// if settings.authorizationStatus == .authorized { -// addRequest() -// } else { -// center.requestAuthorization(options: [.alert, .badge, .sound]) { success, _ in -// if success { -// addRequest() -// } else { -// print("Authorization declined") -// } -// } -// } -// } } func removeNotification(identifier: String) {