Skip to content

Commit

Permalink
Fix problem where a discovered instance has a base_url set without a …
Browse files Browse the repository at this point in the history
…port
  • Loading branch information
robbiet480 committed Apr 11, 2017
1 parent 036f323 commit 81d407a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion HomeAssistant/Views/SettingsViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -402,8 +402,12 @@ class SettingsViewController: FormViewController {
if let userInfo = (notification as Notification).userInfo as? [String:Any] {
let discoveryInfo = DiscoveryInfoResponse(JSON: userInfo)!
let needsPass = discoveryInfo.RequiresPassword ? " - Requires password" : ""
var url = "\(discoveryInfo.BaseURL!.host!)"
if let port = discoveryInfo.BaseURL!.port {
url = "\(discoveryInfo.BaseURL!.host!):\(port)"
}
// swiftlint:disable:next line_length
let detailTextLabel = "\(discoveryInfo.BaseURL!.host!):\(discoveryInfo.BaseURL!.port!) - \(discoveryInfo.Version) - \(discoveryInfo.BaseURL!.scheme!.uppercased()) \(needsPass)"
let detailTextLabel = "\(url) - \(discoveryInfo.Version) - \(discoveryInfo.BaseURL!.scheme!.uppercased()) \(needsPass)"
if self.form.rowBy(tag: discoveryInfo.LocationName) == nil {
discoverySection
<<< ButtonRow(discoveryInfo.LocationName) {
Expand Down

0 comments on commit 81d407a

Please sign in to comment.