Skip to content

Commit 95635d0

Browse files
committed
test
1 parent 54d55f0 commit 95635d0

8 files changed

+4208
-0
lines changed

ab_ramp/add_ab_ramp_option_LoopWorkspace_3.2.x.patch

Lines changed: 424 additions & 0 deletions
Large diffs are not rendered by default.

ab_ramp/add_ab_ramp_option_LoopWorkspace_dev.patch

Lines changed: 424 additions & 0 deletions
Large diffs are not rendered by default.

ab_ramp/add_ab_ramp_option_LoopWorkspace_dev_0493004.patch

Lines changed: 420 additions & 0 deletions
Large diffs are not rendered by default.

ab_ramp_cto/add_ab_ramp_plus_cto_no_switcher_LoopWorkspace_3.2.x.patch

Lines changed: 906 additions & 0 deletions
Large diffs are not rendered by default.

ab_ramp_cto/add_ab_ramp_plus_cto_no_switcher_LoopWorkspace_dev.patch

Lines changed: 906 additions & 0 deletions
Large diffs are not rendered by default.

ab_ramp_cto/add_ab_ramp_plus_cto_no_switcher_LoopWorkspace_dev_0493004.patch

Lines changed: 902 additions & 0 deletions
Large diffs are not rendered by default.

cage/cage.patch

Lines changed: 176 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,176 @@
1+
Submodule OmniBLE contains modified content
2+
diff --git a/OmniBLE/OmniBLE/PumpManager/OmniBLEPumpManager.swift b/OmniBLE/OmniBLE/PumpManager/OmniBLEPumpManager.swift
3+
index af0516f..257ccaf 100644
4+
--- a/OmniBLE/OmniBLE/PumpManager/OmniBLEPumpManager.swift
5+
+++ b/OmniBLE/OmniBLE/PumpManager/OmniBLEPumpManager.swift
6+
@@ -874,6 +874,56 @@ extension OmniBLEPumpManager {
7+
#endif
8+
}
9+
10+
+ private func SiteChange()
11+
+ {
12+
+ do { // Silence all errors and return
13+
+ let keychain = KeychainManager()
14+
+ let credentials = try keychain.getInternetCredentials(account: "NightscoutAPI")
15+
+
16+
+ let date = Date()
17+
+ let formatter = ISO8601DateFormatter()
18+
+ formatter.timeZone = TimeZone(abbreviation: "UTC")
19+
+ let dateString = formatter.string(from: date)
20+
+
21+
+ let json: [String: Any] = [
22+
+ "enteredBy": "Loop",
23+
+ "timestamp": dateString,
24+
+ "eventType": "Site Change",
25+
+ "secret": credentials.password.sha1()
26+
+ ]
27+
+
28+
+ guard var urlComponents = URLComponents(url: credentials.url, resolvingAgainstBaseURL: false) else {return }
29+
+ if urlComponents.path.hasSuffix("/") {
30+
+ urlComponents.path = String(urlComponents.path.dropLast())
31+
+ }
32+
+ urlComponents.path += "/api/v1/treatments.json"
33+
+
34+
+ guard let apiURL = urlComponents.url else { return }
35+
+
36+
+ var request = URLRequest(url: apiURL)
37+
+ request.httpMethod = "POST"
38+
+ request.setValue("application/json", forHTTPHeaderField: "Content-Type")
39+
+ request.httpBody = try? JSONSerialization.data(withJSONObject: json)
40+
+
41+
+ let task = URLSession.shared.dataTask(with: request) { data, response, error in
42+
+ if let error = error {
43+
+ // Handle network error
44+
+ print("Error: \(error)")
45+
+ return
46+
+ }
47+
+
48+
+ guard let response = response as? HTTPURLResponse, response.statusCode == 200 else {
49+
+ // Handle server error
50+
+ print("Error: Invalid response")
51+
+ return
52+
+ }
53+
+ }
54+
+ task.resume()
55+
+ } catch {
56+
+ return
57+
+ }
58+
+ }
59+
+
60+
// Called on the main thread
61+
public func insertCannula(completion: @escaping (Result<TimeInterval,OmniBLEPumpManagerError>) -> Void) {
62+
63+
@@ -894,6 +944,7 @@ extension OmniBLEPumpManager {
64+
var podState = state.podState
65+
podState?.setupProgress = .completed
66+
state.updatePodStateFromPodComms(podState)
67+
+ self.SiteChange()
68+
return .success(mockDelay)
69+
})
70+
71+
@@ -944,6 +995,7 @@ extension OmniBLEPumpManager {
72+
]
73+
74+
let finishWait = try session.insertCannula(optionalAlerts: alerts)
75+
+ self.SiteChange()
76+
completion(.success(finishWait))
77+
} catch let error {
78+
completion(.failure(.communication(error)))
79+
Submodule OmniKit contains modified content
80+
diff --git a/OmniKit/OmniKit/PumpManager/OmnipodPumpManager.swift b/OmniKit/OmniKit/PumpManager/OmnipodPumpManager.swift
81+
index f3082f9..a6d39f5 100644
82+
--- a/OmniKit/OmniKit/PumpManager/OmnipodPumpManager.swift
83+
+++ b/OmniKit/OmniKit/PumpManager/OmnipodPumpManager.swift
84+
@@ -12,7 +12,19 @@ import RileyLinkKit
85+
import RileyLinkBLEKit
86+
import UserNotifications
87+
import os.log
88+
+import CommonCrypto
89+
90+
+extension String {
91+
+ func sha1() -> String {
92+
+ let data = Data(self.utf8)
93+
+ var digest = [UInt8](repeating: 0, count:Int(CC_SHA1_DIGEST_LENGTH))
94+
+ data.withUnsafeBytes {
95+
+ _ = CC_SHA1($0.baseAddress, CC_LONG(data.count), &digest)
96+
+ }
97+
+ let hexBytes = digest.map { String(format: "%02hhx", $0) }
98+
+ return hexBytes.joined()
99+
+ }
100+
+}
101+
102+
public enum ReservoirAlertState {
103+
case ok
104+
@@ -813,6 +825,56 @@ extension OmnipodPumpManager {
105+
}
106+
#endif
107+
}
108+
+
109+
+ private func SiteChange()
110+
+ {
111+
+ do { // Silence all errors and return
112+
+ let keychain = KeychainManager()
113+
+ let credentials = try keychain.getInternetCredentials(account: "NightscoutAPI")
114+
+
115+
+ let date = Date()
116+
+ let formatter = ISO8601DateFormatter()
117+
+ formatter.timeZone = TimeZone(abbreviation: "UTC")
118+
+ let dateString = formatter.string(from: date)
119+
+
120+
+ let json: [String: Any] = [
121+
+ "enteredBy": "Loop",
122+
+ "timestamp": dateString,
123+
+ "eventType": "Site Change",
124+
+ "secret": credentials.password.sha1()
125+
+ ]
126+
+
127+
+ guard var urlComponents = URLComponents(url: credentials.url, resolvingAgainstBaseURL: false) else {return }
128+
+ if urlComponents.path.hasSuffix("/") {
129+
+ urlComponents.path = String(urlComponents.path.dropLast())
130+
+ }
131+
+ urlComponents.path += "/api/v1/treatments.json"
132+
+
133+
+ guard let apiURL = urlComponents.url else { return }
134+
+
135+
+ var request = URLRequest(url: apiURL)
136+
+ request.httpMethod = "POST"
137+
+ request.setValue("application/json", forHTTPHeaderField: "Content-Type")
138+
+ request.httpBody = try? JSONSerialization.data(withJSONObject: json)
139+
+
140+
+ let task = URLSession.shared.dataTask(with: request) { data, response, error in
141+
+ if let error = error {
142+
+ // Handle network error
143+
+ print("Error: \(error)")
144+
+ return
145+
+ }
146+
+
147+
+ guard let response = response as? HTTPURLResponse, response.statusCode == 200 else {
148+
+ // Handle server error
149+
+ print("Error: Invalid response")
150+
+ return
151+
+ }
152+
+ }
153+
+ task.resume()
154+
+ } catch {
155+
+ return
156+
+ }
157+
+ }
158+
159+
// Called on the main thread
160+
public func insertCannula(completion: @escaping (Result<TimeInterval,OmnipodPumpManagerError>) -> Void) {
161+
@@ -834,6 +896,7 @@ extension OmnipodPumpManager {
162+
var podState = state.podState
163+
podState?.setupProgress = .completed
164+
state.updatePodStateFromPodComms(podState)
165+
+ self.SiteChange()
166+
return .success(mockDelay)
167+
})
168+
169+
@@ -885,6 +948,7 @@ extension OmnipodPumpManager {
170+
]
171+
172+
let finishWait = try messageSender.insertCannula(optionalAlerts: alerts)
173+
+ self.SiteChange()
174+
completion(.success(finishWait))
175+
} catch let error {
176+
completion(.failure(.communication(error)))
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
Submodule CGMBLEKit contains modified content
2+
diff --git a/CGMBLEKit/CGMBLEKit/TransmitterManager.swift b/CGMBLEKit/CGMBLEKit/TransmitterManager.swift
3+
index 4942087..371b7bd 100644
4+
--- a/CGMBLEKit/CGMBLEKit/TransmitterManager.swift
5+
+++ b/CGMBLEKit/CGMBLEKit/TransmitterManager.swift
6+
@@ -22,7 +22,7 @@ public struct TransmitterManagerState: RawRepresentable, Equatable {
7+
8+
public var shouldSyncToRemoteService: Bool
9+
10+
- public init(transmitterID: String, shouldSyncToRemoteService: Bool = false) {
11+
+ public init(transmitterID: String, shouldSyncToRemoteService: Bool = true) {
12+
self.transmitterID = transmitterID
13+
self.shouldSyncToRemoteService = shouldSyncToRemoteService
14+
}
15+
Submodule G7SensorKit contains modified content
16+
diff --git a/G7SensorKit/G7SensorKit/G7CGMManager/G7CGMManagerState.swift b/G7SensorKit/G7SensorKit/G7CGMManager/G7CGMManagerState.swift
17+
index 948b02f..95538dd 100644
18+
--- a/G7SensorKit/G7SensorKit/G7CGMManager/G7CGMManagerState.swift
19+
+++ b/G7SensorKit/G7SensorKit/G7CGMManager/G7CGMManagerState.swift
20+
@@ -18,7 +18,7 @@ public struct G7CGMManagerState: RawRepresentable, Equatable {
21+
public var latestReading: G7GlucoseMessage?
22+
public var latestReadingTimestamp: Date?
23+
public var latestConnect: Date?
24+
- public var uploadReadings: Bool = false
25+
+ public var uploadReadings: Bool = true
26+
27+
init() {
28+
}
29+
@@ -31,7 +31,7 @@ public struct G7CGMManagerState: RawRepresentable, Equatable {
30+
}
31+
self.latestReadingTimestamp = rawValue["latestReadingTimestamp"] as? Date
32+
self.latestConnect = rawValue["latestConnect"] as? Date
33+
- self.uploadReadings = rawValue["uploadReadings"] as? Bool ?? false
34+
+ self.uploadReadings = rawValue["uploadReadings"] as? Bool ?? true
35+
}
36+
37+
public var rawValue: RawValue {
38+
diff --git a/G7SensorKit/G7SensorKitUI/Views/G7SettingsViewModel.swift b/G7SensorKit/G7SensorKitUI/Views/G7SettingsViewModel.swift
39+
index 8513d2b..e2e275c 100644
40+
--- a/G7SensorKit/G7SensorKitUI/Views/G7SettingsViewModel.swift
41+
+++ b/G7SensorKit/G7SensorKitUI/Views/G7SettingsViewModel.swift
42+
@@ -23,7 +23,7 @@ class G7SettingsViewModel: ObservableObject {
43+
@Published private(set) var activatedAt: Date?
44+
@Published private(set) var lastConnect: Date?
45+
@Published private(set) var latestReadingTimestamp: Date?
46+
- @Published var uploadReadings: Bool = false {
47+
+ @Published var uploadReadings: Bool = true {
48+
didSet {
49+
cgmManager.uploadReadings = uploadReadings
50+
}

0 commit comments

Comments
 (0)