Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
fall back to getting cgm data from share if no others are configured
  • Loading branch information
ps2 committed Apr 3, 2017
commit 5439c7b02504fb3cbde5b2d9b3929e62bb489af6
2 changes: 1 addition & 1 deletion Loop/Extensions/NSUserDefaults.swift
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ extension UserDefaults {
return .g5(transmitterID: transmitterID)
}

return nil
return .share
}
}
set {
Expand Down
9 changes: 8 additions & 1 deletion Loop/Models/CGM.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@ enum CGM {
case g5(transmitterID: String?)
case g4
case enlite
case share

var appURL: URL? {
switch self {
case .g4:
case .g4, .share:
return URL(string: "dexcomshare://")
case .g5:
return URL(string: "dexcomcgm://")
Expand All @@ -32,6 +33,8 @@ enum CGM {
return G4CGMManager()
case .g5(let transmitterID):
return G5CGMManager(transmitterID: transmitterID)
case .share:
return ShareClientManager()
}
}
}
Expand All @@ -57,6 +60,8 @@ extension CGM: RawRepresentable {
self = .g4
case .enlite?:
self = .enlite
case .share?:
self = .share
case .none:
return nil
}
Expand All @@ -66,13 +71,15 @@ extension CGM: RawRepresentable {
case g5
case g4
case enlite
case share
}

private var type: CGMType {
switch self {
case .g5: return .g5
case .g4: return .g4
case .enlite: return .enlite
case .share: return .share
}
}

Expand Down
6 changes: 3 additions & 3 deletions Loop/View Controllers/SettingsTableViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -687,7 +687,7 @@ final class SettingsTableViewController: UITableViewController, DailyValueSchedu
tableView.insertRows(at: [IndexPath(row: CGMRow.g5TransmitterID.rawValue, section:Section.cgm.rawValue)], with: .top)
} else {
removeG5TransmitterIDRow()
dataManager.cgm = nil
dataManager.cgm = .share
}
tableView.endUpdates()
}
Expand All @@ -699,7 +699,7 @@ final class SettingsTableViewController: UITableViewController, DailyValueSchedu
setEnliteSwitchOff()
dataManager.cgm = .g4
} else {
dataManager.cgm = nil
dataManager.cgm = .share
}
tableView.endUpdates()
}
Expand All @@ -711,7 +711,7 @@ final class SettingsTableViewController: UITableViewController, DailyValueSchedu
setG4SwitchOff()
dataManager.cgm = .enlite
} else {
dataManager.cgm = nil
dataManager.cgm = .share
}
tableView.endUpdates()
}
Expand Down