Skip to content

Commit

Permalink
Fix misleading location warning on pull to refresh. Fixes #474.
Browse files Browse the repository at this point in the history
  • Loading branch information
robbiet480 committed Feb 12, 2020
1 parent 82ced4f commit c6cac5d
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions HomeAssistant/Views/WebViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -342,10 +342,12 @@ class WebViewController: UIViewController, WKNavigationDelegate, WKUIDelegate {
}
firstly {
HomeAssistantAPI.authenticatedAPIPromise
}.then { api in
api.GetAndSendLocation(trigger: .Manual)
}.done {_ in
Current.Log.verbose("Sending current location via button press")
}.then { api -> Promise<Void> in
if Current.settingsStore.locationEnabled {
return api.GetAndSendLocation(trigger: .Manual).asVoid()
} else {
return when(fulfilled: [api.UpdateSensors(.Manual).asVoid(), api.updateComplications().asVoid()])
}
}.catch {error in
self.showSwiftMessageError((error as NSError).localizedDescription)
// let message = L10n.ManualLocationUpdateFailedNotification.message(nserror.localizedDescription)
Expand Down

0 comments on commit c6cac5d

Please sign in to comment.