Skip to content

Commit

Permalink
Show the notification permission error message if granted is false
Browse files Browse the repository at this point in the history
  • Loading branch information
robbiet480 committed Sep 24, 2018
1 parent 491718b commit dfc1cb1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions HomeAssistant/Views/SettingsViewController.swift
Expand Up @@ -386,7 +386,7 @@ class SettingsViewController: FormViewController, CLLocationManagerDelegate, SFS
}

center.requestAuthorization(options: opts) { (granted, error) in
if error != nil {
if error != nil || granted == false {
let title = L10n.Settings.ConnectionSection.ErrorEnablingNotifications.title
let message = L10n.Settings.ConnectionSection.ErrorEnablingNotifications.message
let alert = UIAlertController(title: title,
Expand All @@ -396,7 +396,7 @@ class SettingsViewController: FormViewController, CLLocationManagerDelegate, SFS
handler: nil))
self.present(alert, animated: true, completion: nil)
} else {
print("Notifications Permissions finished!", granted)
print("Notifications Permissions finished with success!", granted)
prefs.setValue(granted, forKey: "notificationsEnabled")
prefs.synchronize()
if granted, let api = api {
Expand Down

0 comments on commit dfc1cb1

Please sign in to comment.