diff --git a/LeCountdown.xcodeproj/project.pbxproj b/LeCountdown.xcodeproj/project.pbxproj index 0c92ce2..04e8887 100644 --- a/LeCountdown.xcodeproj/project.pbxproj +++ b/LeCountdown.xcodeproj/project.pbxproj @@ -1512,7 +1512,7 @@ ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_ENTITLEMENTS = LeCountdown/LeCountdown.entitlements; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 2; + CURRENT_PROJECT_VERSION = 3; DEVELOPMENT_ASSET_PATHS = "\"LeCountdown/Preview Content\""; DEVELOPMENT_TEAM = 526E96RFNP; ENABLE_PREVIEWS = YES; @@ -1549,7 +1549,7 @@ ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_ENTITLEMENTS = LeCountdown/LeCountdown.entitlements; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 2; + CURRENT_PROJECT_VERSION = 3; DEVELOPMENT_ASSET_PATHS = "\"LeCountdown/Preview Content\""; DEVELOPMENT_TEAM = 526E96RFNP; ENABLE_PREVIEWS = YES; @@ -1661,7 +1661,7 @@ ASSETCATALOG_COMPILER_WIDGET_BACKGROUND_COLOR_NAME = WidgetBackground; CODE_SIGN_ENTITLEMENTS = LaunchWidgetExtension.entitlements; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 2; + CURRENT_PROJECT_VERSION = 3; DEVELOPMENT_TEAM = 526E96RFNP; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = LaunchWidget/Info.plist; @@ -1689,7 +1689,7 @@ ASSETCATALOG_COMPILER_WIDGET_BACKGROUND_COLOR_NAME = WidgetBackground; CODE_SIGN_ENTITLEMENTS = LaunchWidgetExtension.entitlements; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 2; + CURRENT_PROJECT_VERSION = 3; DEVELOPMENT_TEAM = 526E96RFNP; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = LaunchWidget/Info.plist; @@ -1715,7 +1715,7 @@ buildSettings = { CODE_SIGN_ENTITLEMENTS = LaunchIntents/LaunchIntents.entitlements; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 2; + CURRENT_PROJECT_VERSION = 3; DEVELOPMENT_TEAM = 526E96RFNP; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = LaunchIntents/Info.plist; @@ -1742,7 +1742,7 @@ buildSettings = { CODE_SIGN_ENTITLEMENTS = LaunchIntents/LaunchIntents.entitlements; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 2; + CURRENT_PROJECT_VERSION = 3; DEVELOPMENT_TEAM = 526E96RFNP; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = LaunchIntents/Info.plist; diff --git a/LeCountdown/TimerRouter.swift b/LeCountdown/TimerRouter.swift index 8e74554..c734d68 100644 --- a/LeCountdown/TimerRouter.swift +++ b/LeCountdown/TimerRouter.swift @@ -57,20 +57,15 @@ class TimerRouter { } fileprivate static func _launchCountdown(_ countdown: Countdown, handler: @escaping (Result) -> Void) { + UNUserNotificationCenter.current().getNotificationSettings { settings in - DispatchQueue.main.async { - switch settings.authorizationStatus { - case .notDetermined, .denied: - handler(.failure(TimerRouterError.notificationAuthorizationMissing)) - default: - CountdownScheduler.master.scheduleIfPossible(countdown: countdown) { result in - switch result { - case .success: - handler(.success(Void())) - case .failure(let failure): - handler(.failure(failure)) - } + CountdownScheduler.master.scheduleIfPossible(countdown: countdown) { result in + switch result { + case .success: + handler(.success(Void())) + case .failure(let failure): + handler(.failure(failure)) } } }