Skip to content

Commit

Permalink
Release 4 0 4 (#688)
Browse files Browse the repository at this point in the history
* Remove unnecessary conversion Nightscout (#672)

* IOB correction

* Sync IOB count for overrides

* Contact Image - small optimizations (#683)

* Contact Image - don't do anything if no contacts configured or access to contacts is not granted

* Contact Image - only save contacts in store if they get changed

* Update add_identifiers.yml

Xcode15/Node 20 support

* Update build_iAPS.yml

Xcode 15.3

* Update create_certs.yml

Xcode 15.3/Node 20

* Update validate_secrets.yml

Xcode 15.3/Node 20

* Update Gemfile.lock

New versions

* Sharing View UI edits.

* Defaults

---------

Co-authored-by: Mike Plante <82073483+MikePlante1@users.noreply.github.com>
Co-authored-by: yurique <i@yurique.com>
  • Loading branch information
3 people authored May 18, 2024
1 parent 68484bb commit 53fa2d8
Show file tree
Hide file tree
Showing 13 changed files with 138 additions and 130 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/add_identifiers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ jobs:

identifiers:
needs: validate
runs-on: macos-13
runs-on: macos-14
steps:
# Uncomment to manually select Xcode version if needed
- name: Select Xcode version
run: "sudo xcode-select --switch /Applications/Xcode_15.0.1.app/Contents/Developer"

# Checks-out the repo
- name: Checkout Repo
uses: actions/checkout@v3
uses: actions/checkout@v4

# Patch Fastlane Match to not print tables
- name: Patch Match Tables
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/build_iAPS.yml
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ jobs:
build:
name: Build
needs: [validate, check_alive_and_permissions, check_latest_from_upstream]
runs-on: macos-13
runs-on: macos-14
permissions:
contents: write
if: | # runs if started manually, or if sync schedule is set and enabled and scheduled on the first Saturday each month, or if sync schedule is set and enabled and new commits were found
Expand All @@ -136,7 +136,7 @@ jobs:
)
steps:
- name: Select Xcode version
run: "sudo xcode-select --switch /Applications/Xcode_15.0.1.app/Contents/Developer"
run: "sudo xcode-select --switch /Applications/Xcode_15.3.app/Contents/Developer"

- name: Checkout Repo for syncing
if: |
Expand Down Expand Up @@ -225,7 +225,7 @@ jobs:
# Upload Build artifacts
- name: Upload build log, IPA and Symbol artifacts
if: always()
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: build-artifacts
path: |
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/create_certs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ jobs:
certificates:
name: Create Certificates
needs: validate
runs-on: macos-13
runs-on: macos-14
steps:
# Uncomment to manually select Xcode version if needed
- name: Select Xcode version
run: "sudo xcode-select --switch /Applications/Xcode_15.0.1.app/Contents/Developer"

# Checks-out the repo
- name: Checkout Repo
uses: actions/checkout@v3
uses: actions/checkout@v4

# Patch Fastlane Match to not print tables
- name: Patch Match Tables
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/validate_secrets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on: [workflow_call, workflow_dispatch]
jobs:
validate-access-token:
name: Access
runs-on: macos-13
runs-on: macos-14
env:
GH_PAT: ${{ secrets.GH_PAT }}
GH_TOKEN: ${{ secrets.GH_PAT }}
Expand Down Expand Up @@ -74,7 +74,7 @@ jobs:
validate-match-secrets:
name: Match-Secrets
needs: validate-access-token
runs-on: macos-13
runs-on: macos-14
env:
GH_TOKEN: ${{ secrets.GH_PAT }}
steps:
Expand Down Expand Up @@ -112,7 +112,7 @@ jobs:
validate-fastlane-secrets:
name: Fastlane
needs: [validate-access-token, validate-match-secrets]
runs-on: macos-13
runs-on: macos-14
env:
GH_PAT: ${{ secrets.GH_PAT }}
GH_TOKEN: ${{ secrets.GH_PAT }}
Expand All @@ -123,7 +123,7 @@ jobs:
TEAMID: ${{ secrets.TEAMID }}
steps:
- name: Checkout Repo
uses: actions/checkout@v3
uses: actions/checkout@v4

# Install project dependencies
- name: Install Project Dependencies
Expand Down
2 changes: 1 addition & 1 deletion Config.xcconfig
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
APP_DISPLAY_NAME = iAPS
APP_VERSION = 4.0.3
APP_VERSION = 4.0.4
APP_BUILD_NUMBER = 1
COPYRIGHT_NOTICE =
DEVELOPER_TEAM = ##TEAM_ID##
Expand Down
8 changes: 7 additions & 1 deletion FreeAPS/Resources/javascript/prepare/profile.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//для pumpprofile.json параметры: settings/settings.json settings/bg_targets.json settings/insulin_sensitivities.json settings/basal_profile.json preferences.json settings/carb_ratios.json settings/temptargets.json settings/model.json
//для profile.json параметры: settings/settings.json settings/bg_targets.json settings/insulin_sensitivities.json settings/basal_profile.json preferences.json settings/carb_ratios.json settings/temptargets.json settings/model.json settings/autotune.json

function generate(pumpsettings_data, bgtargets_data, isf_data, basalprofile_data, preferences_input = false, carbratio_input = false, temptargets_input = false, model_input = false, autotune_input = false, freeaps_data) {
function generate(pumpsettings_data, bgtargets_data, isf_data, basalprofile_data, preferences_input = false, carbratio_input = false, temptargets_input = false, model_input = false, autotune_input = false, freeaps_data, dynamicVariables) {
if (bgtargets_data.units !== 'mg/dL') {
if (bgtargets_data.units === 'mmol/L') {
for (var i = 0, len = bgtargets_data.targets.length; i < len; i++) {
Expand Down Expand Up @@ -95,6 +95,12 @@ function generate(pumpsettings_data, bgtargets_data, isf_data, basalprofile_data
//set these after to make sure nothing happens if they are also set in preferences
inputs.settings = pumpsettings_data;
inputs.targets = bgtargets_data;

if (dynamicVariables.useOverride && dynamicVariables.overridePercentage != 100) {
basalprofile_data.forEach( basal => basal.rate *= (dynamicVariables.overridePercentage / 100));
console.log("Override basal IOB");
}

inputs.basals = basalprofile_data;
inputs.isf = isf_data;
inputs.carbratio = carbratio_data;
Expand Down
52 changes: 21 additions & 31 deletions FreeAPS/Sources/APS/OpenAPS/OpenAPS.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,17 @@ final class OpenAPS {
debug(.openAPS, "Start determineBasal")
// clock
self.storage.save(clock, as: Monitor.clock)

// temp_basal
let tempBasal = currentTemp.rawJSON
self.storage.save(tempBasal, as: Monitor.tempBasal)

// meal
let pumpHistory = self.loadFileFromStorage(name: OpenAPS.Monitor.pumpHistory)
let carbs = self.loadFileFromStorage(name: Monitor.carbHistory)
let glucose = self.loadFileFromStorage(name: Monitor.glucose)
let preferences = self.loadFileFromStorage(name: Settings.preferences)
let preferencesData = Preferences(from: preferences)
let profile = self.loadFileFromStorage(name: Settings.profile)
let basalProfile = self.loadFileFromStorage(name: Settings.basalProfile)
// To do: remove this struct.
let dynamicVariables = self.loadFileFromStorage(name: Monitor.dynamicVariables)

var now = Date.now
let meal = self.meal(
Expand Down Expand Up @@ -63,17 +63,6 @@ final class OpenAPS {

// determine-basal
let reservoir = self.loadFileFromStorage(name: Monitor.reservoir)
let preferences = self.loadFileFromStorage(name: Settings.preferences)
let preferencesData = Preferences(from: preferences)

// TDD
let tdd = self.tdd(preferencesData: preferencesData)
if let insulin = tdd, (insulin.basal + insulin.bolus) > 0 {
CoreDataStorage().saveTDD(insulin)
}

// To do: remove this struct.
let dynamicVariables = self.dynamicVariables(preferencesData)

// The Middleware layer. Has anything been updated?
let alteredProfile = self.middleware(
Expand Down Expand Up @@ -110,8 +99,7 @@ final class OpenAPS {
reason: suggestion.reason,
suggestion: suggestion,
preferences: preferencesData,
profile: alteredProfile,
tdd: tdd
profile: alteredProfile
)
// Update time
suggestion.timestamp = suggestion.deliverAt ?? clock
Expand Down Expand Up @@ -215,6 +203,12 @@ final class OpenAPS {
let model = self.loadFileFromStorage(name: Settings.model)
let autotune = useAutotune ? self.loadFileFromStorage(name: Settings.autotune) : .empty
let freeaps = self.loadFileFromStorage(name: FreeAPS.settings)
let preferencesData = Preferences(from: preferences)
let tdd = self.tdd(preferencesData: preferencesData)
if let insulin = tdd, (insulin.basal + insulin.bolus) > 0 {
CoreDataStorage().saveTDD(insulin)
}
let dynamicVariables = self.dynamicVariables(preferencesData)

let pumpProfile = self.makeProfile(
preferences: preferences,
Expand All @@ -226,7 +220,8 @@ final class OpenAPS {
tempTargets: tempTargets,
model: model,
autotune: RawJSON.null,
freeaps: freeaps
freeaps: freeaps,
dynamicVariables: dynamicVariables
)

let profile = self.makeProfile(
Expand All @@ -239,7 +234,8 @@ final class OpenAPS {
tempTargets: tempTargets,
model: model,
autotune: autotune.isEmpty ? .null : autotune,
freeaps: freeaps
freeaps: freeaps,
dynamicVariables: dynamicVariables
)

self.storage.save(pumpProfile, as: Settings.pumpProfile)
Expand All @@ -261,11 +257,11 @@ final class OpenAPS {
reason: String,
suggestion: Suggestion,
preferences: Preferences?,
profile: RawJSON,
tdd: (bolus: Decimal, basal: Decimal, hours: Double)?
profile: RawJSON
) -> String {
var reasonString = reason
let startIndex = reasonString.startIndex
let tdd = tdd(preferencesData: preferences)

// Autosens.ratio / Dynamic Ratios
if let isf = suggestion.sensitivityRatio {
Expand Down Expand Up @@ -570,14 +566,6 @@ final class OpenAPS {
}
}

private func tdd(preferences: Preferences?) -> Decimal {
let pumpData = pumpStorage.recent()
// let preferences = storage.retrieve(OpenAPS.Settings.preferences, as: Preferences.self)

let insulin = TotalDailyDose().totalDailyDose(pumpData, increment: Double(preferences?.bolusIncrement ?? 0.1))
return insulin.basal + insulin.bolus
}

private func meal(pumphistory: JSON, profile: JSON, basalProfile: JSON, clock: JSON, carbs: JSON, glucose: JSON) -> RawJSON {
dispatchPrecondition(condition: .onQueue(processQueue))
return jsWorker.inCommonContext { worker in
Expand Down Expand Up @@ -727,7 +715,8 @@ final class OpenAPS {
tempTargets: JSON,
model: JSON,
autotune: JSON,
freeaps: JSON
freeaps: JSON,
dynamicVariables: JSON
) -> RawJSON {
dispatchPrecondition(condition: .onQueue(processQueue))
return jsWorker.inCommonContext { worker in
Expand All @@ -746,7 +735,8 @@ final class OpenAPS {
tempTargets,
model,
autotune,
freeaps
freeaps,
dynamicVariables
]
)
}
Expand Down
4 changes: 2 additions & 2 deletions FreeAPS/Sources/Models/FreeAPSSettings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ struct FreeAPSSettings: JSON, Equatable {
var profilesOrTempTargets: Bool = false
var allowBolusShortcut: Bool = false
var allowedRemoteBolusAmount: Decimal = 0.0
var eventualBG: Bool = false
var minumimPrediction: Bool = false
var eventualBG: Bool = true
var minumimPrediction: Bool = true
var minimumSMB: Decimal = 0.3
var useInsulinBars: Bool = false
var disableCGMError: Bool = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ extension BolusCalculatorConfig {
@Published var displayPredictions: Bool = true
@Published var allowBolusShortcut: Bool = false
@Published var allowedRemoteBolusAmount: Decimal = 0
@Published var eventualBG: Bool = false
@Published var minumimPrediction: Bool = false
@Published var eventualBG: Bool = true
@Published var minumimPrediction: Bool = true

override func subscribe() {
subscribeSetting(\.overrideFactor, on: $overrideFactor, initial: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ extension NightscoutConfig {

let sensitivities = fetchedProfile.sens.map { sensitivity -> InsulinSensitivityEntry in
InsulinSensitivityEntry(
sensitivity: self.units == .mmolL ? sensitivity.value : sensitivity.value.asMgdL,
sensitivity: sensitivity.value,
offset: self.offset(sensitivity.time) / 60,
start: sensitivity.time
)
Expand All @@ -233,8 +233,8 @@ extension NightscoutConfig {
let targets = fetchedProfile.target_low
.map { target -> BGTargetEntry in
BGTargetEntry(
low: self.units == .mmolL ? target.value : target.value.asMgdL,
high: self.units == .mmolL ? target.value : target.value.asMgdL,
low: target.value,
high: target.value,
start: target.time,
offset: self.offset(target.time) / 60
) }
Expand Down
22 changes: 12 additions & 10 deletions FreeAPS/Sources/Modules/Sharing/View/SharingRootView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,18 @@ extension Sharing {
Form {
Section {
Toggle("Share all of your Statistics", isOn: $state.uploadStats)

Picker("Sex", selection: $state.sex) {
ForEach(Sex.allCases) { sex in
Text(NSLocalizedString(sex.rawValue, comment: "")).tag(Optional(sex.rawValue))
if state.uploadStats {
Picker("Sex", selection: $state.sex) {
ForEach(Sex.allCases) { sex in
Text(NSLocalizedString(sex.rawValue, comment: "")).tag(Optional(sex.rawValue))
}
}.onChange(of: state.sex) { _ in
state.saveSetting()
}
HStack {
DatePicker("Birth Date", selection: $state.birtDate, in: dateRange, displayedComponents: [.date])
.datePickerStyle(.compact)
}
}.onChange(of: state.sex) { _ in
state.saveSetting()
}
HStack {
DatePicker("Birth Date", selection: $state.birtDate, in: dateRange, displayedComponents: [.date])
.datePickerStyle(.compact)
}
} header: { Text("Statistics") }

Expand Down Expand Up @@ -82,6 +83,7 @@ extension Sharing {
header: { Text("Your identifier") }
footer: { Text((copied && display) ? "Copied" : "") }
}
.dynamicTypeSize(...DynamicTypeSize.xxLarge)
.onAppear {
configureView()
state.savedSettings()
Expand Down
Loading

0 comments on commit 53fa2d8

Please sign in to comment.