Skip to content

Commit e01f7f3

Browse files
committed
Merge remote-tracking branch 'origin/auggie-dev-live' into auggie-smoothing
# Conflicts: # LoopFollow.xcodeproj/project.pbxproj
2 parents 4b91b56 + f4f2594 commit e01f7f3

55 files changed

Lines changed: 7868 additions & 115 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

LoopFollow.xcodeproj/project.pbxproj

Lines changed: 307 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<Scheme
3+
LastUpgradeVersion = "1600"
4+
version = "1.7">
5+
<BuildAction
6+
parallelizeBuildables = "YES"
7+
buildImplicitDependencies = "YES">
8+
<BuildActionEntries>
9+
<BuildActionEntry
10+
buildForTesting = "YES"
11+
buildForRunning = "YES"
12+
buildForProfiling = "YES"
13+
buildForArchiving = "YES"
14+
buildForAnalyzing = "YES">
15+
<BuildableReference
16+
BuildableIdentifier = "primary"
17+
BlueprintIdentifier = "BB01000000000003000000AA"
18+
BuildableName = "LoopFollowWatch.app"
19+
BlueprintName = "LoopFollowWatch"
20+
ReferencedContainer = "container:LoopFollow.xcodeproj">
21+
</BuildableReference>
22+
</BuildActionEntry>
23+
</BuildActionEntries>
24+
</BuildAction>
25+
<TestAction
26+
buildConfiguration = "Debug"
27+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
28+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
29+
shouldUseLaunchSchemeArgsEnv = "YES"
30+
shouldAutocreateTestPlan = "YES">
31+
</TestAction>
32+
<LaunchAction
33+
buildConfiguration = "Debug"
34+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
35+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
36+
launchStyle = "0"
37+
useCustomWorkingDirectory = "NO"
38+
ignoresPersistentStateOnLaunch = "NO"
39+
debugDocumentVersioning = "YES"
40+
debugServiceExtension = "internal"
41+
allowLocationSimulation = "YES">
42+
<BuildableProductRunnable
43+
runnableDebuggingMode = "0">
44+
<BuildableReference
45+
BuildableIdentifier = "primary"
46+
BlueprintIdentifier = "BB01000000000003000000AA"
47+
BuildableName = "LoopFollowWatch.app"
48+
BlueprintName = "LoopFollowWatch"
49+
ReferencedContainer = "container:LoopFollow.xcodeproj">
50+
</BuildableReference>
51+
</BuildableProductRunnable>
52+
</LaunchAction>
53+
<ProfileAction
54+
buildConfiguration = "Release"
55+
shouldUseLaunchSchemeArgsEnv = "YES"
56+
savedToolIdentifier = ""
57+
useCustomWorkingDirectory = "NO"
58+
debugDocumentVersioning = "YES">
59+
<BuildableProductRunnable
60+
runnableDebuggingMode = "0">
61+
<BuildableReference
62+
BuildableIdentifier = "primary"
63+
BlueprintIdentifier = "BB01000000000003000000AA"
64+
BuildableName = "LoopFollowWatch.app"
65+
BlueprintName = "LoopFollowWatch"
66+
ReferencedContainer = "container:LoopFollow.xcodeproj">
67+
</BuildableReference>
68+
</BuildableProductRunnable>
69+
</ProfileAction>
70+
<AnalyzeAction
71+
buildConfiguration = "Debug">
72+
</AnalyzeAction>
73+
<ArchiveAction
74+
buildConfiguration = "Release"
75+
revealArchiveInOrganizer = "YES">
76+
</ArchiveAction>
77+
</Scheme>

LoopFollow/Application/AppDelegate.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import CoreData
55
import EventKit
66
import UIKit
77
import UserNotifications
8+
import WatchConnectivity
89

910
@main
1011
class AppDelegate: UIResponder, UIApplicationDelegate {
@@ -70,6 +71,8 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
7071
Storage.shared.needsBFUReload = bfu
7172
LogManager.shared.log(category: .general, message: "BFU check: isProtectedDataAvailable=\(!bfu), needsBFUReload=\(bfu)")
7273

74+
PhoneSessionManager.shared.startSession()
75+
7376
return true
7477
}
7578

LoopFollow/Controllers/Graphs.swift

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -781,6 +781,41 @@ extension MainViewController {
781781
midnightTimeInterval = midnightTimeInterval.advanced(by: -24 * 60 * 60)
782782
}
783783
}
784+
785+
// Draw "same time" lines on prior days (orange dotted lines)
786+
createSameTimeLines()
787+
}
788+
789+
func createSameTimeLines() {
790+
// Draw orange dotted lines at the current time of day on each prior day
791+
// This helps visualize what was happening at this same time yesterday, etc.
792+
let now = dateTimeUtils.getNowTimeIntervalUTC()
793+
let graphHours = 24 * Storage.shared.downloadDays.value
794+
let graphStart = dateTimeUtils.getTimeIntervalNHoursAgo(N: graphHours)
795+
796+
// Start from 24 hours ago (yesterday at this time) and go back
797+
var priorDayTime = now - (24 * 60 * 60)
798+
799+
while priorDayTime > graphStart {
800+
// Large chart - orange dotted line (same style as teal midnight lines)
801+
let ul = ChartLimitLine()
802+
ul.limit = Double(priorDayTime)
803+
ul.lineColor = NSUIColor.systemOrange.withAlphaComponent(0.5)
804+
ul.lineDashLengths = [CGFloat(2), CGFloat(5)]
805+
ul.lineWidth = 1
806+
BGChart.xAxis.addLimitLine(ul)
807+
808+
// Small chart - orange dotted line
809+
let sl = ChartLimitLine()
810+
sl.limit = Double(priorDayTime)
811+
sl.lineColor = NSUIColor.systemOrange
812+
sl.lineDashLengths = [CGFloat(2), CGFloat(2)]
813+
sl.lineWidth = 1
814+
BGChartFull.xAxis.addLimitLine(sl)
815+
816+
// Move back another 24 hours
817+
priorDayTime = priorDayTime - (24 * 60 * 60)
818+
}
784819
}
785820

786821
func updateBGGraphSettings() {

LoopFollow/Controllers/Nightscout/BGData.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,8 @@ extension MainViewController {
300300
)
301301
}
302302
Storage.shared.lastBGChecked.value = Date()
303+
304+
PhoneSessionManager.shared.sendConfig()
303305
}
304306
}
305307
}

LoopFollow/Nightscout/NightscoutSettingsViewModel.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ class NightscoutSettingsViewModel: ObservableObject {
2525
if newValue != nightscoutURL {
2626
Storage.shared.url.value = newValue
2727
triggerCheckStatus()
28+
PhoneSessionManager.shared.sendConfig()
2829
}
2930
}
3031
}
@@ -34,6 +35,7 @@ class NightscoutSettingsViewModel: ObservableObject {
3435
if newValue != nightscoutToken {
3536
Storage.shared.token.value = newValue
3637
triggerCheckStatus()
38+
PhoneSessionManager.shared.sendConfig()
3739
}
3840
}
3941
}

LoopFollow/Remote/Settings/RemoteSettingsView.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,7 @@ struct RemoteSettingsView: View {
414414
unit: HKUnit.gram(),
415415
allowDecimalSeparator: true,
416416
minValue: HKQuantity(unit: .gram(), doubleValue: 0),
417-
maxValue: HKQuantity(unit: .gram(), doubleValue: 100),
417+
maxValue: HKQuantity(unit: .gram(), doubleValue: 200),
418418
onValidationError: { message in
419419
handleValidationError(message)
420420
}
@@ -434,7 +434,7 @@ struct RemoteSettingsView: View {
434434
unit: HKUnit.gram(),
435435
allowDecimalSeparator: true,
436436
minValue: HKQuantity(unit: .gram(), doubleValue: 0),
437-
maxValue: HKQuantity(unit: .gram(), doubleValue: 100),
437+
maxValue: HKQuantity(unit: .gram(), doubleValue: 200),
438438
onValidationError: { message in
439439
handleValidationError(message)
440440
}
@@ -453,7 +453,7 @@ struct RemoteSettingsView: View {
453453
unit: HKUnit.gram(),
454454
allowDecimalSeparator: true,
455455
minValue: HKQuantity(unit: .gram(), doubleValue: 0),
456-
maxValue: HKQuantity(unit: .gram(), doubleValue: 100),
456+
maxValue: HKQuantity(unit: .gram(), doubleValue: 200),
457457
onValidationError: { message in
458458
handleValidationError(message)
459459
}

LoopFollow/Remote/Settings/RemoteSettingsViewModel.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,10 @@ class RemoteSettingsViewModel: ObservableObject {
160160

161161
$mealWithFatProtein
162162
.dropFirst()
163-
.sink { [weak self] in self?.storage.mealWithFatProtein.value = $0 }
163+
.sink { [weak self] in
164+
self?.storage.mealWithFatProtein.value = $0
165+
PhoneSessionManager.shared.sendConfig()
166+
}
164167
.store(in: &cancellables)
165168

166169
// Device type monitoring

LoopFollow/Settings/DexcomSettingsViewModel.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ class DexcomSettingsViewModel: ObservableObject {
1212
willSet {
1313
if newValue != userName {
1414
Storage.shared.shareUserName.value = newValue
15+
PhoneSessionManager.shared.sendConfig()
1516
}
1617
}
1718
}
@@ -20,6 +21,7 @@ class DexcomSettingsViewModel: ObservableObject {
2021
willSet {
2122
if newValue != password {
2223
Storage.shared.sharePassword.value = newValue
24+
PhoneSessionManager.shared.sendConfig()
2325
}
2426
}
2527
}
@@ -28,6 +30,7 @@ class DexcomSettingsViewModel: ObservableObject {
2830
willSet {
2931
if newValue != server {
3032
Storage.shared.shareServer.value = newValue
33+
PhoneSessionManager.shared.sendConfig()
3134
}
3235
}
3336
}

LoopFollow/Settings/UnitsConfigurationView.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ struct UnitsConfigurationView: View {
2121
.pickerStyle(.segmented)
2222
.onChange(of: glucoseUnit) { newValue in
2323
UnitSettingsStore.shared.glucoseUnit = newValue
24+
PhoneSessionManager.shared.sendConfig()
2425
}
2526
}
2627

@@ -46,6 +47,7 @@ struct UnitsConfigurationView: View {
4647
.onChange(of: lowValue) { newValue in
4748
Storage.shared.lowLine.value = newValue
4849
Observable.shared.chartSettingsChanged.value = true
50+
PhoneSessionManager.shared.sendConfig()
4951
}
5052
BGPicker(
5153
title: "High",
@@ -56,6 +58,7 @@ struct UnitsConfigurationView: View {
5658
.onChange(of: highValue) { newValue in
5759
Storage.shared.highLine.value = newValue
5860
Observable.shared.chartSettingsChanged.value = true
61+
PhoneSessionManager.shared.sendConfig()
5962
}
6063
}
6164
}

0 commit comments

Comments
 (0)