Skip to content

Commit

Permalink
LOOP-1489: use InsulinModelSettings with TherapySettings instead of S…
Browse files Browse the repository at this point in the history
…toredSettings.InsulinModel (#176)
  • Loading branch information
novalegra authored Jul 28, 2020
1 parent 4e97766 commit 1fae2c9
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Loop/Managers/LoopDataManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1767,6 +1767,6 @@ extension LoopDataManager {
insulinSensitivitySchedule: insulinSensitivitySchedule,
carbRatioSchedule: carbRatioSchedule,
basalRateSchedule: basalRateSchedule,
insulinModel: insulinModelSettings.map { StoredSettings.InsulinModel($0) })
insulinModel: insulinModelSettings)
}
}
1 change: 1 addition & 0 deletions Loop/Managers/ServicesManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ class ServicesManager {
loopDataManager?.insulinSensitivitySchedule = settings.insulinSensitivitySchedule
loopDataManager?.carbRatioSchedule = settings.carbRatioSchedule
loopDataManager?.basalRateSchedule = settings.basalRateSchedule
loopDataManager?.insulinModelSettings = settings.insulinModel
}

private func restoreState() {
Expand Down
8 changes: 3 additions & 5 deletions Loop/View Controllers/SettingsTableViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,8 @@ final class SettingsTableViewController: UITableViewController, IdentifiableClas
viewModel: viewModel,
glucoseUnit: glucoseUnit,
supportedModelSettings: SupportedInsulinModelSettings(fiaspModelEnabled: FeatureFlags.fiaspInsulinModelEnabled, walshModelEnabled: FeatureFlags.walshInsulinModelEnabled),
appName: appName
appName: appName,
mode: .settings
)

let hostingController = DismissibleHostingController(rootView: modelSelectionView, onDisappear: {
Expand Down Expand Up @@ -802,10 +803,7 @@ final class SettingsTableViewController: UITableViewController, IdentifiableClas
dataManager?.loopManager.settings.maximumBasalRatePerHour = therapySettings.maximumBasalRatePerHour
dataManager?.loopManager.settings.maximumBolus = therapySettings.maximumBolus
case .insulinModel:
if let insulinModel = therapySettings.insulinModel {
// TODO: Unify InsulinModelSettings and SettingsStore.InsulinModel
dataManager?.loopManager.insulinModelSettings = InsulinModelSettings(from: insulinModel)
}
dataManager?.loopManager.insulinModelSettings = therapySettings.insulinModel
case .carbRatio:
dataManager?.loopManager.carbRatioSchedule = therapySettings.carbRatioSchedule
dataManager?.analyticsServicesManager.didChangeCarbRatioSchedule()
Expand Down

0 comments on commit 1fae2c9

Please sign in to comment.