@@ -1641,82 +1641,6 @@ index 2319f4ec..8a728813 100644
1641
1641
}
1642
1642
1643
1643
// Invalidate cached effects affected by the override
1644
- @@ -992,7 +1009,7 @@ extension LoopDataManager {
1645
-
1646
- let retrospectiveStart = lastGlucoseDate.addingTimeInterval(-type(of: retrospectiveCorrection).retrospectionInterval)
1647
-
1648
- - let earliestEffectDate = Date(timeInterval: .hours(-24), since: now())
1649
- + let earliestEffectDate = Date(timeInterval: .days(-2), since: now())
1650
- let nextCounteractionEffectDate = insulinCounteractionEffects.last?.endDate ?? earliestEffectDate
1651
- let insulinEffectStartDate = nextCounteractionEffectDate.addingTimeInterval(.minutes(-5))
1652
-
1653
- diff --git a/Loop/Loop/View Controllers/CarbAbsorptionViewController.swift b/Loop/Loop/View Controllers/CarbAbsorptionViewController.swift
1654
- index fc770192..45e031a7 100644
1655
- --- a/Loop/Loop/View Controllers/CarbAbsorptionViewController.swift
1656
- +++ b/Loop/Loop/View Controllers/CarbAbsorptionViewController.swift
1657
- @@ -139,7 +139,7 @@ final class CarbAbsorptionViewController: LoopChartsTableViewController, Identif
1658
- charts.updateEndDate(chartStartDate.addingTimeInterval(.hours(totalHours+1))) // When there is no data, this allows presenting current hour + 1
1659
-
1660
- let midnight = Calendar.current.startOfDay(for: Date())
1661
- - let listStart = min(midnight, chartStartDate, Date(timeIntervalSinceNow: -deviceManager.carbStore.maximumAbsorptionTimeInterval))
1662
- + let previousMidnight = midnight - .days(1)
1663
-
1664
- let reloadGroup = DispatchGroup()
1665
- let shouldUpdateGlucose = currentContext.contains(.glucose)
1666
- @@ -157,12 +157,20 @@ final class CarbAbsorptionViewController: LoopChartsTableViewController, Identif
1667
- if shouldUpdateGlucose || shouldUpdateCarbs {
1668
- let allInsulinCounteractionEffects = state.insulinCounteractionEffects
1669
- insulinCounteractionEffects = allInsulinCounteractionEffects.filterDateRange(chartStartDate, nil)
1670
- +
1671
- + let earliestCounteractionEffect = allInsulinCounteractionEffects.first?.startDate ?? Date()
1672
- + // Show carb entries as far back as previous midnight, or only as far back as counteraction effects are available
1673
- + let boundOnCarbList = max(previousMidnight, earliestCounteractionEffect)
1674
- + // If counteraction effects are missing, at least show all the entries for today and those on the chart
1675
- + let displayListStart = min(boundOnCarbList, midnight, chartStartDate)
1676
- + // To estimate dynamic carb absorption for the entry at the start of the list, we need to fetch samples that might still be absorbing
1677
- + let fetchEntriesStart = displayListStart.addingTimeInterval(-self.deviceManager.carbStore.maximumAbsorptionTimeInterval)
1678
-
1679
- reloadGroup.enter()
1680
- - self.deviceManager.carbStore.getCarbStatus(start: listStart, end: nil, effectVelocities: allInsulinCounteractionEffects) { (result) in
1681
- + self.deviceManager.carbStore.getCarbStatus(start: fetchEntriesStart, end: nil, effectVelocities: allInsulinCounteractionEffects) { (result) in
1682
- switch result {
1683
- case .success(let status):
1684
- - carbStatuses = status
1685
- + carbStatuses = status.filterDateRange(displayListStart, nil)
1686
- carbsOnBoard = status.getClampedCarbsOnBoard()
1687
- case .failure(let error):
1688
- self.log.error("CarbStore failed to get carbStatus: %{public}@", String(describing: error))
1689
- @@ -286,6 +294,14 @@ final class CarbAbsorptionViewController: LoopChartsTableViewController, Identif
1690
- formatter.timeStyle = .short
1691
- return formatter
1692
- }()
1693
- +
1694
- + private lazy var relativeTimeFormatter: DateFormatter = {
1695
- + let formatter = DateFormatter()
1696
- + formatter.dateStyle = .medium
1697
- + formatter.doesRelativeDateFormatting = true
1698
- + formatter.timeStyle = .short
1699
- + return formatter
1700
- + }()
1701
-
1702
- override func numberOfSections(in tableView: UITableView) -> Int {
1703
- return Section.count
1704
- @@ -343,7 +359,14 @@ final class CarbAbsorptionViewController: LoopChartsTableViewController, Identif
1705
- }
1706
-
1707
- // Entry time
1708
- - let startTime = timeFormatter.string(from: status.entry.startDate)
1709
- + let startTime: String
1710
- + // Indicate if an entry is from the previous day to avoid potential confusion
1711
- + let midnight = Calendar.current.startOfDay(for: Date())
1712
- + if status.entry.startDate < midnight {
1713
- + startTime = relativeTimeFormatter.string(from: status.entry.startDate)
1714
- + } else {
1715
- + startTime = timeFormatter.string(from: status.entry.startDate)
1716
- + }
1717
- if let absorptionTime = status.entry.absorptionTime,
1718
- let duration = absorptionFormatter.string(from: absorptionTime)
1719
- {
1720
1644
diff --git a/Loop/Loop/Views/AlertManagementView.swift b/Loop/Loop/Views/AlertManagementView.swift
1721
1645
index e9a38e72..94e542a6 100644
1722
1646
--- a/Loop/Loop/Views/AlertManagementView.swift
@@ -2154,19 +2078,6 @@ index 00000000..02a3fbb2
2154
2078
+ self.bottomRowConfiguration = BottomRowConfiguration.defaults
2155
2079
+ }
2156
2080
+ }
2157
- diff --git a/Loop/LoopCore/LoopCoreConstants.swift b/Loop/LoopCore/LoopCoreConstants.swift
2158
- index d56f2ab9..42e9dfa3 100644
2159
- --- a/Loop/LoopCore/LoopCoreConstants.swift
2160
- +++ b/Loop/LoopCore/LoopCoreConstants.swift
2161
- @@ -16,7 +16,7 @@ public enum LoopCoreConstants {
2162
- /// The amount of time in the future a glucose value should be considered valid
2163
- public static let futureGlucoseDataInterval = TimeInterval(minutes: 5)
2164
-
2165
- - public static let defaultCarbAbsorptionTimes: CarbStore.DefaultAbsorptionTimes = (fast: .minutes(30), medium: .hours(3), slow: .hours(5))
2166
- + public static let defaultCarbAbsorptionTimes: CarbStore.DefaultAbsorptionTimes = (fast: .hours(2), medium: .hours(3), slow: .hours(5))
2167
-
2168
- /// How much historical glucose to include in a dosing decision
2169
- /// Somewhat arbitrary, but typical maximum visible in bolus glucose preview
2170
2081
diff --git a/Loop/LoopCore/NSUserDefaults.swift b/Loop/LoopCore/NSUserDefaults.swift
2171
2082
index 93fa7e17..dacf2ecd 100644
2172
2083
--- a/Loop/LoopCore/NSUserDefaults.swift
0 commit comments