Skip to content

Commit

Permalink
fix(DanaKit): Add fix for double insulin entries
Browse files Browse the repository at this point in the history
  • Loading branch information
bastiaanv committed Sep 11, 2024
1 parent ba01461 commit 4936421
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 3 deletions.
9 changes: 6 additions & 3 deletions .github/workflows/build_trio.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:
- cron: "0 8 * * 3" # Checks for updates at 08:00 UTC every Wednesday
- cron: "0 6 1 * *" # Builds the app on the 1st of every month at 06:00 UTC

env:
env:
UPSTREAM_REPO: nightscout/Trio
UPSTREAM_BRANCH: ${{ github.ref_name }} # branch on upstream repository to sync from (replace with specific branch name if needed)
TARGET_BRANCH: ${{ github.ref_name }} # target branch on fork to be kept in sync, and target branch on upstream to be kept alive (replace with specific branch name if needed)
Expand Down Expand Up @@ -181,7 +181,7 @@ jobs:
echo "Synchronizing your fork of <code>Trio</code> with the upstream repository <code>nightscout/Trio</code> will be skipped." >> $GITHUB_STEP_SUMMARY
echo "If you want to enable automatic builds and updates for your Trio, please follow the instructions \
under the following path <code>Trio/fastlane/testflight.md</code>." >> $GITHUB_STEP_SUMMARY
# Builds Trio
build:
name: Build
Expand All @@ -199,7 +199,7 @@ jobs:
steps:
- name: Select Xcode version
run: "sudo xcode-select --switch /Applications/Xcode_15.4.app/Contents/Developer"

- name: Checkout Repo for syncing
if: |
needs.check_alive_and_permissions.outputs.WORKFLOW_PERMISSION == 'true' &&
Expand Down Expand Up @@ -265,6 +265,9 @@ jobs:
- name: Install Project Dependencies
run: bundle install

- name: Fix DanaKit double insulin entries
run: git apply danakit.patch

# Sync the GitHub runner clock with the Windows time server (workaround as suggested in https://github.com/actions/runner/issues/2996)
- name: Sync clock
run: sudo sntp -sS time.windows.com
Expand Down
24 changes: 24 additions & 0 deletions danakit.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
Submodule DanaKit contains modified content
diff --git a/DanaKit/DanaKit/PumpManager/DanaKitPumpManager.swift b/DanaKit/DanaKit/PumpManager/DanaKitPumpManager.swift
index d795d59..88ca56b 100644
--- a/DanaKit/DanaKit/PumpManager/DanaKitPumpManager.swift
+++ b/DanaKit/DanaKit/PumpManager/DanaKitPumpManager.swift
@@ -556,18 +556,6 @@ extension DanaKitPumpManager: PumpManager {
self.state.bolusState = .inProgress
self.notifyStateDidChange()

- DispatchQueue.main.async {
- let dose = self.doseEntry?.toDoseEntry(isMutable: true)
-
- if let dose = dose {
- self.pumpDelegate.notify { (delegate) in
- delegate?.pumpManager(self, hasNewPumpEvents: [NewPumpEvent.bolus(dose: dose, units: dose.programmedUnits)], lastReconciliation: Date.now, replacePendingEvents: false, completion: { _ in })
- }
-
- self.notifyStateDidChange()
- }
- }
-
completion(nil)
} catch {
self.state.bolusState = .noBolus

2 comments on commit 4936421

@mountrcg
Copy link

@mountrcg mountrcg commented on 4936421 Sep 21, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@m1key83
Hi, is adding a patchfile to the submodule actually patching the code that is used?

Unfortunatly I cannot test with no Dana, but I have 3 users that use autoISF with Dana and one complained about the double entries.

@bastiaanv
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @mountrcg ,

This patch fixed the issue. You can check if your users have the same issue if both entries do not have an extra text like external or manual. The issue is related to unimplemented feature introduced in the new LoopKit: nightscout#405

I updated the DanaKit submodule to include this patch:
https://github.com/loopandlearn/DanaKit/tree/trio

Please sign in to comment.