Skip to content

Commit

Permalink
Merge pull request #575 from JohanDegraeve/staging-5.4
Browse files Browse the repository at this point in the history
Staging 5.4.0
  • Loading branch information
JohanDegraeve authored Oct 14, 2024
2 parents 9edb0e6 + 7629b2b commit 6138290
Show file tree
Hide file tree
Showing 182 changed files with 2,922 additions and 2,194 deletions.
8 changes: 4 additions & 4 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,8 @@ GEM
trailblazer-option (>= 0.1.1, < 0.2.0)
uber (< 0.2.0)
retriable (3.1.2)
rexml (3.2.8)
strscan (>= 3.0.9)
rexml (3.3.6)
strscan
rouge (2.0.7)
ruby2_keywords (0.0.5)
rubyzip (2.3.2)
Expand Down Expand Up @@ -201,13 +201,13 @@ GEM
unf_ext (0.0.9.1)
unicode-display_width (2.5.0)
word_wrap (1.0.0)
xcodeproj (1.24.0)
xcodeproj (1.25.0)
CFPropertyList (>= 2.3.3, < 4.0)
atomos (~> 0.1.3)
claide (>= 1.0.2, < 2.0)
colored2 (~> 3.1)
nanaimo (~> 0.3.0)
rexml (~> 3.2.4)
rexml (>= 3.3.2, < 4.0)
xcpretty (0.3.0)
rouge (~> 2.0.7)
xcpretty-travis-formatter (1.0.1)
Expand Down
16 changes: 6 additions & 10 deletions xDrip Notification Context Extension/NotificationView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ struct NotificationView: View {
var bgReadingDates: [Date]?
var isMgDl: Bool?
var slopeOrdinal: Int?
var deltaChangeInMgDl: Double?
var deltaValueInUserUnit: Double?
var urgentLowLimitInMgDl: Double?
var lowLimitInMgDl: Double?
var highLimitInMgDl: Double?
Expand Down Expand Up @@ -64,7 +64,7 @@ struct NotificationView: View {
}
.padding(12)

GlucoseChartView(glucoseChartType: .notificationExpanded, bgReadingValues: bgReadingValues, bgReadingDates: bgReadingDates, isMgDl: isMgDl ?? true, urgentLowLimitInMgDl: urgentLowLimitInMgDl ?? 60, lowLimitInMgDl: lowLimitInMgDl ?? 70, highLimitInMgDl: highLimitInMgDl ?? 180, urgentHighLimitInMgDl: urgentHighLimitInMgDl ?? 250, liveActivitySize: nil, hoursToShowScalingHours: nil, glucoseCircleDiameterScalingHours: nil, overrideChartHeight: nil, overrideChartWidth: nil, highContrast: nil)
GlucoseChartView(glucoseChartType: .notificationExpanded, bgReadingValues: bgReadingValues, bgReadingDates: bgReadingDates, isMgDl: isMgDl ?? true, urgentLowLimitInMgDl: urgentLowLimitInMgDl ?? 60, lowLimitInMgDl: lowLimitInMgDl ?? 70, highLimitInMgDl: highLimitInMgDl ?? 180, urgentHighLimitInMgDl: urgentHighLimitInMgDl ?? 250, liveActivityType: nil, hoursToShowScalingHours: nil, glucoseCircleDiameterScalingHours: nil, overrideChartHeight: nil, overrideChartWidth: nil, highContrast: nil)
}
.background(ConstantsAlerts.notificationBackgroundColor)
}
Expand Down Expand Up @@ -104,17 +104,13 @@ struct NotificationView: View {
/// convert the optional delta change int (in mg/dL) to a formatted change value in the user chosen unit making sure all zero values are shown as a positive change to follow Nightscout convention
/// - Returns: a string holding the formatted delta change value (i.e. +0.4 or -6)
func deltaChangeStringInUserChosenUnit() -> String {
if let deltaChangeInMgDl = deltaChangeInMgDl, let isMgDl = isMgDl {
let deltaSign: String = deltaChangeInMgDl > 0 ? "+" : ""
let valueAsString = deltaChangeInMgDl.mgdlToMmolAndToString(mgdl: isMgDl)
if let deltaValueInUserUnit = deltaValueInUserUnit, let isMgDl = isMgDl {
let deltaSign: String = deltaValueInUserUnit > 0 ? "+" : ""
let deltaValueAsString = isMgDl ? deltaValueInUserUnit.mgDlToMmolAndToString(mgDl: isMgDl) : deltaValueInUserUnit.mmolToString()

// quickly check "value" and prevent "-0mg/dl" or "-0.0mmol/l" being displayed
// show unitized zero deltas as +0 or +0.0 as per Nightscout format
if isMgDl {
return (deltaChangeInMgDl > -1 && deltaChangeInMgDl < 1) ? "+0" : (deltaSign + valueAsString)
} else {
return (deltaChangeInMgDl > -0.1 && deltaChangeInMgDl < 0.1) ? "+0.0" : (deltaSign + valueAsString)
}
return deltaValueInUserUnit == 0.0 ? (isMgDl ? "+0" : "+0.0") : (deltaSign + deltaValueAsString)
} else {
return (isMgDl ?? true) ? "-" : "-.-"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class NotificationViewController: UIViewController, UNNotificationContentExtensi
var bgReadingDates: [Date]?
var isMgDl: Bool?
var slopeOrdinal: Int?
var deltaChangeInMgDl: Double?
var deltaValueInUserUnit: Double?
var urgentLowLimitInMgDl: Double?
var lowLimitInMgDl: Double?
var highLimitInMgDl: Double?
Expand Down Expand Up @@ -50,7 +50,7 @@ class NotificationViewController: UIViewController, UNNotificationContentExtensi
bgReadingValues = userInfo["bgReadingValues"] as? [Double] ?? [0]
isMgDl = userInfo["isMgDl"] as? Bool ?? true
slopeOrdinal = userInfo["slopeOrdinal"] as? Int ?? 0
deltaChangeInMgDl = userInfo["deltaChangeInMgDl"] as? Double ?? 0
deltaValueInUserUnit = userInfo["deltaValueInUserUnit"] as? Double ?? 0
urgentLowLimitInMgDl = userInfo["urgentLowLimitInMgDl"] as? Double ?? 0
lowLimitInMgDl = userInfo["lowLimitInMgDl"] as? Double ?? 0
highLimitInMgDl = userInfo["highLimitInMgDl"] as? Double ?? 0
Expand All @@ -65,15 +65,15 @@ class NotificationViewController: UIViewController, UNNotificationContentExtensi
bgValueInMgDl = (bgReadingValues?.count ?? 0) > 0 ? bgReadingValues?[0] : nil
bgReadingDate = (bgReadingDates?.count ?? 0) > 0 ? bgReadingDates?[0] : nil

bgValueStringInUserChosenUnit = (bgReadingValues?.count ?? 0) > 0 ? bgReadingValues?[0].mgdlToMmolAndToString(mgdl: isMgDl ?? true) ?? "" : ""
bgValueStringInUserChosenUnit = (bgReadingValues?.count ?? 0) > 0 ? bgReadingValues?[0].mgDlToMmolAndToString(mgDl: isMgDl ?? true) ?? "" : ""

let vc = UIHostingController(rootView: NotificationView(
alertTitle: alertTitle,
bgReadingValues: bgReadingValues,
bgReadingDates: bgReadingDates,
isMgDl: isMgDl,
slopeOrdinal: slopeOrdinal,
deltaChangeInMgDl: deltaChangeInMgDl,
deltaValueInUserUnit: deltaValueInUserUnit,
urgentLowLimitInMgDl: urgentLowLimitInMgDl,
lowLimitInMgDl: lowLimitInMgDl,
highLimitInMgDl: highLimitInMgDl,
Expand Down
8 changes: 4 additions & 4 deletions xDrip Watch App/DataModels/NotificationController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class NotificationController: WKUserNotificationHostingController<NotificationVi
var bgReadingDates: [Date]?
var isMgDl: Bool?
var slopeOrdinal: Int?
var deltaChangeInMgDl: Double?
var deltaValueInUserUnit: Double?
var urgentLowLimitInMgDl: Double?
var lowLimitInMgDl: Double?
var highLimitInMgDl: Double?
Expand All @@ -35,7 +35,7 @@ class NotificationController: WKUserNotificationHostingController<NotificationVi
bgReadingDates: bgReadingDates,
isMgDl: isMgDl,
slopeOrdinal: slopeOrdinal,
deltaChangeInMgDl: deltaChangeInMgDl,
deltaValueInUserUnit: deltaValueInUserUnit,
urgentLowLimitInMgDl: urgentLowLimitInMgDl,
lowLimitInMgDl: lowLimitInMgDl,
highLimitInMgDl: highLimitInMgDl,
Expand All @@ -61,7 +61,7 @@ class NotificationController: WKUserNotificationHostingController<NotificationVi
bgReadingValues = userInfo["bgReadingValues"] as? [Double] ?? [0]
isMgDl = userInfo["isMgDl"] as? Bool ?? true
slopeOrdinal = userInfo["slopeOrdinal"] as? Int ?? 0
deltaChangeInMgDl = userInfo["deltaChangeInMgDl"] as? Double ?? 0
deltaValueInUserUnit = userInfo["deltaValueInUserUnit"] as? Double ?? 0
urgentLowLimitInMgDl = userInfo["urgentLowLimitInMgDl"] as? Double ?? 0
lowLimitInMgDl = userInfo["lowLimitInMgDl"] as? Double ?? 0
highLimitInMgDl = userInfo["highLimitInMgDl"] as? Double ?? 0
Expand All @@ -76,7 +76,7 @@ class NotificationController: WKUserNotificationHostingController<NotificationVi
bgValueInMgDl = (bgReadingValues?.count ?? 0) > 0 ? bgReadingValues?[0] : nil
bgReadingDate = (bgReadingDates?.count ?? 0) > 0 ? bgReadingDates?[0] : nil

bgValueStringInUserChosenUnit = (bgReadingValues?.count ?? 0) > 0 ? bgReadingValues?[0].mgdlToMmolAndToString(mgdl: isMgDl ?? true) ?? "" : ""
bgValueStringInUserChosenUnit = (bgReadingValues?.count ?? 0) > 0 ? bgReadingValues?[0].mgDlToMmolAndToString(mgDl: isMgDl ?? true) ?? "" : ""

}
}
Loading

0 comments on commit 6138290

Please sign in to comment.