Skip to content

Commit 5db433a

Browse files
committed
transfer v2.2.4 updates from LF to LF_3
1 parent 6808858 commit 5db433a

12 files changed

Lines changed: 88 additions & 39 deletions

File tree

.github/workflows/add_identifiers.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111

1212
identifiers:
1313
needs: validate
14-
runs-on: macos-13
14+
runs-on: macos-14
1515
steps:
1616
# Uncomment to manually select latest Xcode if needed
1717
#- name: Select Latest Xcode

.github/workflows/build_LoopFollow.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ jobs:
2020
build:
2121
name: Build
2222
needs: validate
23-
runs-on: macos-13
23+
runs-on: macos-14
2424
steps:
2525
# Uncomment to manually select latest Xcode if needed
2626
- name: Select Latest Xcode
27-
run: "sudo xcode-select --switch /Applications/Xcode_15.0.app/Contents/Developer"
27+
run: "sudo xcode-select --switch /Applications/Xcode_15.4.app/Contents/Developer"
2828

2929
# Checks-out the repo
3030
- name: Checkout Repo

.github/workflows/create_certs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
certificates:
1313
name: Create Certificates
1414
needs: validate
15-
runs-on: macos-13
15+
runs-on: macos-14
1616
steps:
1717
# Uncomment to manually select latest Xcode if needed
1818
#- name: Select Latest Xcode

.github/workflows/validate_secrets.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ on: [workflow_call, workflow_dispatch]
55
jobs:
66
validate-access-token:
77
name: Access
8-
runs-on: macos-13
8+
runs-on: macos-14
99
env:
1010
GH_PAT: ${{ secrets.GH_PAT }}
1111
GH_TOKEN: ${{ secrets.GH_PAT }}
@@ -74,7 +74,7 @@ jobs:
7474
validate-match-secrets:
7575
name: Match-Secrets
7676
needs: validate-access-token
77-
runs-on: macos-13
77+
runs-on: macos-14
7878
env:
7979
GH_TOKEN: ${{ secrets.GH_PAT }}
8080
steps:
@@ -112,7 +112,7 @@ jobs:
112112
validate-fastlane-secrets:
113113
name: Fastlane
114114
needs: [validate-access-token, validate-match-secrets]
115-
runs-on: macos-13
115+
runs-on: macos-14
116116
env:
117117
GH_PAT: ${{ secrets.GH_PAT }}
118118
GH_TOKEN: ${{ secrets.GH_PAT }}

Config.xcconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@
66
unique_id = ${DEVELOPMENT_TEAM}
77

88
//Version (DEFAULT)
9-
LOOP_FOLLOW_MARKETING_VERSION = 2.2.3
9+
LOOP_FOLLOW_MARKETING_VERSION = 2.2.4

Gemfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
source "https://rubygems.org"
22

33
gem "fastlane"
4+
gem "rexml", "= 3.2.9"

Gemfile.lock

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,22 @@ GEM
55
base64
66
nkf
77
rexml
8-
addressable (2.8.6)
9-
public_suffix (>= 2.0.2, < 6.0)
8+
addressable (2.8.7)
9+
public_suffix (>= 2.0.2, < 7.0)
1010
artifactory (3.0.17)
1111
atomos (0.1.3)
1212
aws-eventstream (1.3.0)
13-
aws-partitions (1.921.0)
14-
aws-sdk-core (3.193.0)
13+
aws-partitions (1.949.0)
14+
aws-sdk-core (3.200.0)
1515
aws-eventstream (~> 1, >= 1.3.0)
1616
aws-partitions (~> 1, >= 1.651.0)
1717
aws-sigv4 (~> 1.8)
1818
jmespath (~> 1, >= 1.6.1)
19-
aws-sdk-kms (1.80.0)
20-
aws-sdk-core (~> 3, >= 3.193.0)
19+
aws-sdk-kms (1.87.0)
20+
aws-sdk-core (~> 3, >= 3.199.0)
2121
aws-sigv4 (~> 1.1)
22-
aws-sdk-s3 (1.148.0)
23-
aws-sdk-core (~> 3, >= 3.193.0)
22+
aws-sdk-s3 (1.155.0)
23+
aws-sdk-core (~> 3, >= 3.199.0)
2424
aws-sdk-kms (~> 1)
2525
aws-sigv4 (~> 1.8)
2626
aws-sigv4 (1.8.0)
@@ -69,7 +69,7 @@ GEM
6969
faraday_middleware (1.2.0)
7070
faraday (~> 1.0)
7171
fastimage (2.3.1)
72-
fastlane (2.220.0)
72+
fastlane (2.221.1)
7373
CFPropertyList (>= 2.3, < 4.0.0)
7474
addressable (>= 2.8, < 3.0.0)
7575
artifactory (~> 3.0)
@@ -148,31 +148,32 @@ GEM
148148
os (>= 0.9, < 2.0)
149149
signet (>= 0.16, < 2.a)
150150
highline (2.0.3)
151-
http-cookie (1.0.5)
151+
http-cookie (1.0.6)
152152
domain_name (~> 0.5)
153153
httpclient (2.8.3)
154154
jmespath (1.6.2)
155155
json (2.7.2)
156-
jwt (2.8.1)
156+
jwt (2.8.2)
157157
base64
158-
mini_magick (4.12.0)
158+
mini_magick (4.13.1)
159159
mini_mime (1.1.5)
160160
multi_json (1.15.0)
161-
multipart-post (2.4.0)
161+
multipart-post (2.4.1)
162162
nanaimo (0.3.0)
163163
naturally (2.2.1)
164164
nkf (0.2.0)
165165
optparse (0.5.0)
166166
os (1.1.4)
167167
plist (3.7.1)
168-
public_suffix (5.0.5)
168+
public_suffix (5.1.1)
169169
rake (13.2.1)
170170
representable (3.2.0)
171171
declarative (< 0.1.0)
172172
trailblazer-option (>= 0.1.1, < 0.2.0)
173173
uber (< 0.2.0)
174174
retriable (3.1.2)
175-
rexml (3.2.6)
175+
rexml (3.2.9)
176+
strscan
176177
rouge (2.0.7)
177178
ruby2_keywords (0.0.5)
178179
rubyzip (2.3.2)
@@ -185,6 +186,7 @@ GEM
185186
simctl (1.6.10)
186187
CFPropertyList
187188
naturally
189+
strscan (3.1.0)
188190
terminal-notifier (2.0.0)
189191
terminal-table (3.0.2)
190192
unicode-display_width (>= 1.1.1, < 3)
@@ -216,9 +218,11 @@ PLATFORMS
216218
arm64-darwin-22
217219
arm64-darwin-23
218220
x86_64-darwin-19
221+
x86_64-linux
219222

220223
DEPENDENCIES
221224
fastlane
225+
rexml (= 3.2.9)
222226

223227
BUNDLED WITH
224228
2.4.19

LoopFollow/Controllers/Nightscout/BGData.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ extension MainViewController {
6363
var parameters: [String: String] = [:]
6464
let utcISODateFormatter = ISO8601DateFormatter()
6565
let date = Calendar.current.date(byAdding: .day, value: -1 * UserDefaultsRepository.downloadDays.value, to: Date())!
66-
parameters["count"] = "1000"
66+
parameters["count"] = "\(UserDefaultsRepository.downloadDays.value * 2 * 24 * 60 / 5)"
6767
parameters["find[dateString][$gte]"] = utcISODateFormatter.string(from: date)
6868

6969
NightscoutUtils.executeRequest(eventType: .sgv, parameters: parameters) { (result: Result<[ShareGlucoseData], Error>) in

LoopFollow/Controllers/Nightscout/DeviceStatus.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ extension MainViewController {
1717
self.writeDebugLog(value: "Download: device status")
1818
}
1919

20-
let parameters: [String: String] = ["count": "288"]
20+
let parameters: [String: String] = ["count": "1"]
2121
NightscoutUtils.executeDynamicRequest(eventType: .deviceStatus, parameters: parameters) { result in
2222
switch result {
2323
case .success(let json):

LoopFollow/Controllers/Nightscout/DeviceStatusOpenAPS.swift

Lines changed: 56 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,25 @@ import UIKit
1212
extension MainViewController {
1313
func DeviceStatusOpenAPS(formatter: ISO8601DateFormatter, lastDeviceStatus: [String: AnyObject]?, lastLoopRecord: [String: AnyObject]) {
1414

15-
if let lastLoopTime = formatter.date(from: (lastDeviceStatus?["created_at"] as! String))?.timeIntervalSince1970 {
15+
if let lastLoopTime = formatter.date(from: (lastDeviceStatus?["created_at"] as! String))?.timeIntervalSince1970 {
1616
UserDefaultsRepository.alertLastLoopTime.value = lastLoopTime
17-
if UserDefaultsRepository.debugLog.value { self.writeDebugLog(value: "lastLoopTime: " + String(lastLoopTime)) }
1817
if lastLoopRecord["failureReason"] != nil {
1918
LoopStatusLabel.text = "X"
2019
latestLoopStatusString = "X"
2120
if UserDefaultsRepository.debugLog.value { self.writeDebugLog(value: "Loop Failure: X") }
2221
} else {
23-
if let iobdata = lastLoopRecord["iob"] as? [String:AnyObject] {
24-
tableData[0].value = String(format:"%.2f", (iobdata["iob"] as! Double))
25-
latestIOB = String(format:"%.2f", (iobdata["iob"] as! Double))
22+
var wasEnacted = false
23+
if let enacted = lastLoopRecord["enacted"] as? [String: AnyObject] {
24+
wasEnacted = true
2625
}
27-
if let cobdata = lastLoopRecord["enacted"] as? [String:AnyObject] {
28-
tableData[1].value = String(format:"%.0f", cobdata["COB"] as! Double)
29-
latestCOB = String(format:"%.0f", cobdata["COB"] as! Double)
26+
27+
if let iobdata = lastLoopRecord["iob"] as? [String: AnyObject] {
28+
tableData[0].value = String(format: "%.2f", (iobdata["iob"] as! Double))
29+
latestIOB = String(format: "%.2f", (iobdata["iob"] as! Double))
30+
}
31+
if let cobdata = lastLoopRecord["enacted"] as? [String: AnyObject] {
32+
tableData[1].value = String(format: "%.0f", cobdata["COB"] as! Double)
33+
latestCOB = String(format: "%.0f", cobdata["COB"] as! Double)
3034
}
3135
if let recbolusdata = lastLoopRecord["enacted"] as? [String: AnyObject],
3236
let insulinReq = recbolusdata["insulinReq"] as? Double {
@@ -37,15 +41,22 @@ extension MainViewController {
3741
UserDefaultsRepository.deviceRecBolus.value = 0
3842
}
3943

40-
if let autosensdata = lastLoopRecord["enacted"] as? [String:AnyObject] {
44+
if let autosensdata = lastLoopRecord["enacted"] as? [String: AnyObject] {
4145
let sens = autosensdata["sensitivityRatio"] as! Double * 100.0
42-
tableData[11].value = String(format:"%.0f", sens) + "%"
46+
tableData[11].value = String(format: "%.0f", sens) + "%"
47+
}
48+
49+
if let eventualdata = lastLoopRecord["enacted"] as? [String: AnyObject] {
50+
if let eventualBGValue = eventualdata["eventualBG"] as? NSNumber {
51+
let eventualBGStringValue = String(describing: eventualBGValue)
52+
PredictionLabel.text = bgUnits.toDisplayUnits(eventualBGStringValue)
53+
}
4354
}
4455

4556
var predictioncolor = UIColor.systemGray
4657
PredictionLabel.textColor = predictioncolor
4758
topPredictionBG = UserDefaultsRepository.minBGScale.value
48-
if let enactdata = lastLoopRecord["enacted"] as? [String:AnyObject],
59+
if let enactdata = lastLoopRecord["enacted"] as? [String: AnyObject],
4960
let predbgdata = enactdata["predBGs"] as? [String: AnyObject] {
5061
let predictionTypes: [(type: String, colorName: String, dataIndex: Int)] = [
5162
("ZT", "ZT", 12),
@@ -54,6 +65,9 @@ extension MainViewController {
5465
("UAM", "UAM", 15)
5566
]
5667

68+
var minPredBG = Double.infinity
69+
var maxPredBG = -Double.infinity
70+
5771
for (type, colorName, dataIndex) in predictionTypes {
5872
var predictionData = [ShareGlucoseData]()
5973
if let graphdata = predbgdata[type] as? [Double] {
@@ -62,7 +76,11 @@ extension MainViewController {
6276

6377
for i in 0...toLoad {
6478
if i < graphdata.count {
65-
let prediction = ShareGlucoseData(sgv: Int(round(graphdata[i])), date: predictionTime, direction: "flat")
79+
let predictionValue = graphdata[i]
80+
minPredBG = min(minPredBG, predictionValue)
81+
maxPredBG = max(maxPredBG, predictionValue)
82+
83+
let prediction = ShareGlucoseData(sgv: Int(round(predictionValue)), date: predictionTime, direction: "flat")
6684
predictionData.append(prediction)
6785
predictionTime += 300
6886
}
@@ -77,8 +95,34 @@ extension MainViewController {
7795
color: color
7896
)
7997
}
98+
99+
if minPredBG != Double.infinity && maxPredBG != -Double.infinity {
100+
tableData[9].value = "\(bgUnits.toDisplayUnits(String(minPredBG)))/\(bgUnits.toDisplayUnits(String(maxPredBG)))"
101+
} else {
102+
tableData[9].value = "N/A"
103+
}
104+
}
105+
106+
if let loopStatus = lastLoopRecord["recommendedTempBasal"] as? [String: AnyObject] {
107+
if let tempBasalTime = formatter.date(from: (loopStatus["timestamp"] as! String))?.timeIntervalSince1970 {
108+
var lastBGTime = lastLoopTime
109+
if bgData.count > 0 {
110+
lastBGTime = bgData[bgData.count - 1].date
111+
}
112+
if tempBasalTime > lastBGTime && !wasEnacted {
113+
LoopStatusLabel.text = ""
114+
latestLoopStatusString = ""
115+
} else {
116+
LoopStatusLabel.text = ""
117+
latestLoopStatusString = ""
118+
}
119+
}
120+
} else {
121+
LoopStatusLabel.text = ""
122+
latestLoopStatusString = ""
80123
}
81124
}
125+
evaluateNotLooping(lastLoopTime: lastLoopTime)
82126
}
83127
}
84128
}

0 commit comments

Comments
 (0)