Skip to content

Commit

Permalink
Merge pull request #2189 from LoopKit/release-3.4
Browse files Browse the repository at this point in the history
Release 3.4
  • Loading branch information
ps2 authored Jul 13, 2024
2 parents c6b058b + 49feb51 commit 4074b04
Show file tree
Hide file tree
Showing 350 changed files with 9,648 additions and 11,398 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/inactive_issues.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Close inactive issues
on:
schedule:
- cron: "30 1 * * *"

jobs:
close-issues:
runs-on: ubuntu-latest
permissions:
issues: write
pull-requests: write
steps:
- uses: actions/stale@v5
with:
operations-per-run: 100
days-before-issue-stale: 30
days-before-issue-close: 14
stale-issue-label: "stale"
stale-issue-message: "This issue is stale because it has been open for 30 days with no activity."
close-issue-message: "This issue was closed because it has been inactive for 14 days since being marked as stale."
days-before-pr-stale: -1
days-before-pr-close: -1
repo-token: ${{ secrets.GITHUB_TOKEN }}
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,12 @@ VersionOverride.xcconfig

Loop/DerivedAssets.xcassets/*
WatchApp/DerivedAssets.xcassets/*
Loop\ Widget\ Extension/DerivedAssets.xcassets/*
# ...except, keep Contents.json
!Loop/DerivedAssets.xcassets/Contents.json
!WatchApp/DerivedAssets.xcassets/Contents.json
!Loop\ Widget\ Extension/DerivedAssets.xcassets/Contents.json

Loop/DerivedAssetsOverride.xcassets
WatchApp/DerivedAssetsOverride.xcassets
Loop\ Widget\ Extension/DerivedAssetsOverride.xcassets
10 changes: 2 additions & 8 deletions Common/Extensions/GlucoseRangeSchedule.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,7 @@ extension GlucoseRangeSchedule {
func minQuantity(at date: Date) -> HKQuantity {
return HKQuantity(unit: unit, doubleValue: value(at: date).minValue)
}
}


extension ClosedRange where Bound == HKQuantity {
func averageValue(for unit: HKUnit) -> Double {
let minValue = lowerBound.doubleValue(for: unit)
let maxValue = upperBound.doubleValue(for: unit)
return (maxValue + minValue) / 2
func maxQuantity(at date: Date) -> HKQuantity {
return HKQuantity(unit: unit, doubleValue: value(at: date).maxValue)
}
}
1 change: 1 addition & 0 deletions Common/Extensions/NSBundle.swift
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,4 @@ extension Bundle {
return .days(localCacheDurationDays)
}
}

38 changes: 33 additions & 5 deletions Common/FeatureFlags.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,10 @@ struct FeatureFlagConfiguration: Decodable {
let siriEnabled: Bool
let simpleBolusCalculatorEnabled: Bool
let usePositiveMomentumAndRCForManualBoluses: Bool
let dynamicCarbAbsorptionEnabled: Bool
let adultChildInsulinModelSelectionEnabled: Bool
let profileExpirationSettingsViewEnabled: Bool
let missedMealNotifications: Bool
let allowAlgorithmExperiments: Bool


fileprivate init() {
Expand Down Expand Up @@ -212,14 +213,25 @@ struct FeatureFlagConfiguration: Decodable {
self.adultChildInsulinModelSelectionEnabled = false
#endif

self.dynamicCarbAbsorptionEnabled = true

// ProfileExpirationSettingsView is inverse, since the default state is enabled.
#if PROFILE_EXPIRATION_SETTINGS_VIEW_DISABLED
self.profileExpirationSettingsViewEnabled = false
#else
self.profileExpirationSettingsViewEnabled = true
#endif

// Missed meal notifications compiler flag is inverse, since the default state is enabled.
#if MISSED_MEAL_NOTIFICATIONS_DISABLED
self.missedMealNotifications = false
#else
self.missedMealNotifications = true
#endif

#if ALLOW_ALGORITHM_EXPERIMENTS
self.allowAlgorithmExperiments = true
#else
self.allowAlgorithmExperiments = false
#endif
}
}

Expand Down Expand Up @@ -251,9 +263,11 @@ extension FeatureFlagConfiguration : CustomDebugStringConvertible {
"* allowDebugFeatures: \(allowDebugFeatures)",
"* simpleBolusCalculatorEnabled: \(simpleBolusCalculatorEnabled)",
"* usePositiveMomentumAndRCForManualBoluses: \(usePositiveMomentumAndRCForManualBoluses)",
"* dynamicCarbAbsorptionEnabled: \(dynamicCarbAbsorptionEnabled)",
"* adultChildInsulinModelSelectionEnabled: \(adultChildInsulinModelSelectionEnabled)",
"* profileExpirationSettingsViewEnabled: \(profileExpirationSettingsViewEnabled)"
"* profileExpirationSettingsViewEnabled: \(profileExpirationSettingsViewEnabled)",
"* missedMealNotifications: \(missedMealNotifications)",
"* allowAlgorithmExperiments: \(allowAlgorithmExperiments)",
"* allowExperimentalFeatures: \(allowExperimentalFeatures)"
].joined(separator: "\n")
}
}
Expand All @@ -277,6 +291,20 @@ extension FeatureFlagConfiguration {
#endif
}

var allowExperimentalFeatures: Bool {
#if EXPERIMENTAL_FEATURES_ENABLED
return true
#elseif EXPERIMENTAL_FEATURES_ENABLED_CONDITIONALLY
if debugEnabled {
return true
} else {
return UserDefaults.appGroup?.allowExperimentalFeatures ?? false
}
#else
return false
#endif
}

var allowSimulators: Bool {
#if SIMULATORS_ENABLED
return true
Expand Down
6 changes: 3 additions & 3 deletions Common/Models/PumpManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ import MockKit
import MockKitUI

let staticPumpManagersByIdentifier: [String: PumpManagerUI.Type] = [
MockPumpManager.managerIdentifier : MockPumpManager.self
MockPumpManager.pluginIdentifier : MockPumpManager.self
]

var availableStaticPumpManagers: [PumpManagerDescriptor] {
if FeatureFlags.allowSimulators {
return [
PumpManagerDescriptor(identifier: MockPumpManager.managerIdentifier, localizedTitle: MockPumpManager.localizedTitle)
PumpManagerDescriptor(identifier: MockPumpManager.pluginIdentifier, localizedTitle: MockPumpManager.localizedTitle)
]
} else {
return []
Expand All @@ -31,7 +31,7 @@ extension PumpManager {

var rawValue: RawValue {
return [
"managerIdentifier": self.managerIdentifier,
"managerIdentifier": self.pluginIdentifier,
"state": self.rawState
]
}
Expand Down
14 changes: 11 additions & 3 deletions Common/Models/StatusExtensionContext.swift
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,8 @@ extension GlucoseDisplayableContext: RawRepresentable {
trendType = nil
}

if let trendRateUnit = rawValue["trendRateUnit"] as? String, let trendRateValue = rawValue["trendRateValue"] as? Double {
trendRate = HKQuantity(unit: HKUnit(from: trendRateUnit), doubleValue: trendRateValue)
if let trendRateValue = rawValue["trendRateValue"] as? Double {
trendRate = HKQuantity(unit: .milligramsPerDeciliterPerMinute, doubleValue: trendRateValue)
} else {
trendRate = nil
}
Expand All @@ -181,7 +181,6 @@ extension GlucoseDisplayableContext: RawRepresentable {
]
raw["trendType"] = trendType?.rawValue
if let trendRate = trendRate {
raw["trendRateUnit"] = HKUnit.milligramsPerDeciliterPerMinute.unitString
raw["trendRateValue"] = trendRate.doubleValue(for: HKUnit.milligramsPerDeciliterPerMinute)
}
raw["glucoseRangeCategory"] = glucoseRangeCategory?.rawValue
Expand Down Expand Up @@ -298,6 +297,9 @@ struct StatusExtensionContext: RawRepresentable {
var lastLoopCompleted: Date?
var createdAt: Date?
var isClosedLoop: Bool?
var preMealPresetAllowed: Bool?
var preMealPresetActive: Bool?
var customPresetActive: Bool?
var netBasal: NetBasalContext?
var batteryPercentage: Double?
var reservoirCapacity: Double?
Expand Down Expand Up @@ -327,6 +329,9 @@ struct StatusExtensionContext: RawRepresentable {
lastLoopCompleted = rawValue["lastLoopCompleted"] as? Date
createdAt = rawValue["createdAt"] as? Date
isClosedLoop = rawValue["isClosedLoop"] as? Bool
preMealPresetAllowed = rawValue["preMealPresetAllowed"] as? Bool
preMealPresetActive = rawValue["preMealPresetActive"] as? Bool
customPresetActive = rawValue["customPresetActive"] as? Bool
batteryPercentage = rawValue["batteryPercentage"] as? Double
reservoirCapacity = rawValue["reservoirCapacity"] as? Double
carbsOnBoard = rawValue["carbsOnBoard"] as? Double
Expand Down Expand Up @@ -365,6 +370,9 @@ struct StatusExtensionContext: RawRepresentable {
raw["lastLoopCompleted"] = lastLoopCompleted
raw["createdAt"] = createdAt
raw["isClosedLoop"] = isClosedLoop
raw["preMealPresetAllowed"] = preMealPresetAllowed
raw["preMealPresetActive"] = preMealPresetActive
raw["customPresetActive"] = customPresetActive
raw["netBasal"] = netBasal?.rawValue
raw["batteryPercentage"] = batteryPercentage
raw["reservoirCapacity"] = reservoirCapacity
Expand Down
4 changes: 2 additions & 2 deletions Common/Models/WatchContext.swift
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ final class WatchContext: RawRepresentable {
if let rawGlucoseTrend = rawValue["gt"] as? GlucoseTrend.RawValue {
glucoseTrend = GlucoseTrend(rawValue: rawGlucoseTrend)
}
if let glucoseTrendRateUnitString = rawValue["gtru"] as? String, let glucoseTrendRateValue = rawValue["gtrv"] as? Double {
glucoseTrendRate = HKQuantity(unit: HKUnit(from: glucoseTrendRateUnitString), doubleValue: glucoseTrendRateValue)
if let glucoseTrendRateValue = rawValue["gtrv"] as? Double {
glucoseTrendRate = HKQuantity(unit: .milligramsPerDeciliterPerMinute, doubleValue: glucoseTrendRateValue)
}
glucoseDate = rawValue["gd"] as? Date
glucoseIsDisplayOnly = rawValue["gdo"] as? Bool
Expand Down
8 changes: 4 additions & 4 deletions Common/de.lproj/Intents.strings
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,22 @@
"9KhaIS" = "Voreinstellung gesetzt";

/* (No Comment) */
"80eo5o" = "Kohlenhydrate hinzufügen";
"80eo5o" = "KH-Eintrag hinzufügen";

/* (No Comment) */
"b085BW" = "Voreinstellung konnte nicht gesetzt werden.";

/* (No Comment) */
"I4OZy8" = "Enable Override Preset";
"I4OZy8" = "Aktiviere Voreinstellung";

/* (No Comment) */
"lYMuWV" = "Voreinstellungs-Name";

/* (No Comment) */
"nDKAmn" = "Welche Voreinstellung möchten Sie aktivieren?";
"nDKAmn" = "Welche Voreinstellung möchtest Du aktivieren?";

/* (No Comment) */
"OcNxIj" = "Kohlenhydrate hinzufügen";
"OcNxIj" = "KH hinzufügen";

/* (No Comment) */
"oLQSsJ" = "Aktiviere '${overrideName}' Voreinstellung";
Expand Down
24 changes: 12 additions & 12 deletions Common/he.lproj/Intents.strings
Original file line number Diff line number Diff line change
@@ -1,36 +1,36 @@
/* (No Comment) */
"9KhaIS" = "I've set the preset";
"9KhaIS" = "ההגדרה נקבעה";

/* (No Comment) */
"80eo5o" = "Add Carb Entry";
"80eo5o" = "הוסף שורת פחמימות";

/* (No Comment) */
"b085BW" = "I wasn't able to set the preset.";
"b085BW" = "לא הצלחתי לקבוע את ההגדרה.";

/* (No Comment) */
"I4OZy8" = "Enable Override Preset";
"I4OZy8" = "אפשר מעקף מוגדר";

/* (No Comment) */
"lYMuWV" = "Override Name";
"lYMuWV" = "שם המעקף";

/* (No Comment) */
"nDKAmn" = "What's the name of the override you'd like to set?";
"nDKAmn" = "מה שם המעקף שברצונך ליצור?";

/* (No Comment) */
"OcNxIj" = "Add Carb Entry";
"OcNxIj" = "הוסף שורת פחמימות";

/* (No Comment) */
"oLQSsJ" = "Enable '${overrideName}' Override Preset";
"oLQSsJ" = "אפשר מעקף ${overrideName} מוגדר";

/* (No Comment) */
"XNNmtH" = "Enable preset in Loop";
"XNNmtH" = "אפשר את ההגדרה ב-Loop";

/* (No Comment) */
"yBzwCL" = "Override Selection";
"yBzwCL" = "בחירת מעקף";

/* (No Comment) */
"yc02Yq" = "Add a carb entry to Loop";
"yc02Yq" = "הוסף שורת פחמימות ל-Loop";

/* (No Comment) */
"ZZ3mtM" = "Enable an override preset in Loop";
"ZZ3mtM" = "אפשר את המעקף ב-Loop";

24 changes: 24 additions & 0 deletions Common/hi.lproj/Intents.strings
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
"80eo5o" = "Add Carb Entry";

"9KhaIS" = "I've set the preset";

"I4OZy8" = "Enable Override Preset";

"OcNxIj" = "Add Carb Entry";

"XNNmtH" = "Enable preset in Loop";

"ZZ3mtM" = "Enable an override preset in Loop";

"b085BW" = "I wasn't able to set the preset.";

"lYMuWV" = "Override Name";

"nDKAmn" = "What's the name of the override you'd like to set?";

"oLQSsJ" = "Enable '${overrideName}' Override Preset";

"yBzwCL" = "Override Selection";

"yc02Yq" = "Add a carb entry to Loop";

2 changes: 1 addition & 1 deletion Common/pl.lproj/Intents.strings
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* (No Comment) */
"9KhaIS" = "Ustawiłem Cel Tymczas.";
"9KhaIS" = "Ustawiłem Cel Tymczasowy";

/* (No Comment) */
"80eo5o" = "Wprowadź węglowodany";
Expand Down
26 changes: 0 additions & 26 deletions DoseMathTests/Base.lproj/Localizable.strings

This file was deleted.

Loading

0 comments on commit 4074b04

Please sign in to comment.