Skip to content

Commit

Permalink
Fix notification preferences
Browse files Browse the repository at this point in the history
  • Loading branch information
robbiet480 committed Sep 23, 2016
1 parent bf86f57 commit 17c32f1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
3 changes: 2 additions & 1 deletion HomeAssistant/HAAPI.swift
Original file line number Diff line number Diff line change
Expand Up @@ -770,7 +770,8 @@ public class HomeAssistantAPI {
}

var notificationsEnabled : Bool {
return PermissionScope().statusNotifications() == .authorized && prefs.string(forKey: "endpointARN") != nil
// return PermissionScope().statusNotifications() == .authorized && prefs.string(forKey: "endpointARN") != nil
return prefs.string(forKey: "endpointARN") != nil
}

var enabledPermissions : [String] {
Expand Down
4 changes: 1 addition & 3 deletions HomeAssistant/SettingsViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,6 @@ class SettingsViewController: FormViewController {
<<< ButtonRow("enableNotifications"){
$0.title = "Enable notifications"
$0.hidden = Condition(booleanLiteral: HomeAssistantAPI.sharedInstance.notificationsEnabled)
$0.evaluateHidden()
}.onCellSelection { cell, row in
let pscope = PermissionScope()

Expand All @@ -274,8 +273,7 @@ class SettingsViewController: FormViewController {

<<< ButtonRow("notificationSettings") {
$0.title = "Notification Settings"
$0.hidden = Condition(booleanLiteral: (HomeAssistantAPI.sharedInstance.notificationsEnabled == true))
$0.evaluateHidden()
$0.hidden = Condition(booleanLiteral: !HomeAssistantAPI.sharedInstance.notificationsEnabled)
$0.presentationMode = .show(controllerProvider: ControllerProvider.callback {
print("HomeAssistantAPI.sharedInstance.notificationsEnabled", HomeAssistantAPI.sharedInstance.notificationsEnabled)
let view = SettingsDetailViewController()
Expand Down

0 comments on commit 17c32f1

Please sign in to comment.