Просмотр исходного кода

Merge branch 'dev' into purge-stats

Mike Plante 2 лет назад
Родитель
Сommit
3b091d41d0
100 измененных файлов с 661 добавлено и 609 удалено
  1. 1 1
      .github/ISSUE_TEMPLATE/bug-report.md
  2. 3 3
      .github/ISSUE_TEMPLATE/config.yml
  3. 12 12
      .github/workflows/build_Open-iAPS.yml
  4. 0 2
      .gitignore
  5. 4 4
      Config.xcconfig
  6. 0 36
      FAQ.md
  7. 0 36
      FAQ_RU.md
  8. 20 17
      FreeAPS.xcodeproj/project.pbxproj
  9. 0 0
      FreeAPS.xcodeproj/xcshareddata/xcschemes/Trio.xcscheme
  10. 0 0
      FreeAPS.xcodeproj/xcshareddata/xcschemes/Trio_WatchApp.xcscheme
  11. 2 2
      FreeAPS/Resources/Assets.xcassets/oiaps3D.appiconset/Contents.json
  12. 0 0
      FreeAPS/Resources/Assets.xcassets/trio3D.appiconset/trio3d.png
  13. 0 0
      FreeAPS/Resources/Assets.xcassets/trio3D.appiconset/trio3dWatch.png
  14. 0 0
      FreeAPS/Resources/Assets.xcassets/trioBlack.appiconset/A 1.png
  15. 0 0
      FreeAPS/Resources/Assets.xcassets/trioBlack.appiconset/A.png
  16. 0 0
      FreeAPS/Resources/Assets.xcassets/trioBlack.appiconset/Contents.json
  17. 0 0
      FreeAPS/Resources/Assets.xcassets/trioColorBG.appiconset/C 1.png
  18. 0 0
      FreeAPS/Resources/Assets.xcassets/trioColorBG.appiconset/C.png
  19. 0 0
      FreeAPS/Resources/Assets.xcassets/trioColorBG.appiconset/Contents.json
  20. 0 0
      FreeAPS/Resources/Assets.xcassets/trioLoop.appiconset/Contents.json
  21. 0 0
      FreeAPS/Resources/Assets.xcassets/trioLoop.appiconset/imageLoop 1.png
  22. 0 0
      FreeAPS/Resources/Assets.xcassets/trioLoop.appiconset/imageLoop.png
  23. 0 0
      FreeAPS/Resources/Assets.xcassets/trioWhite.appiconset/8.png
  24. 0 0
      FreeAPS/Resources/Assets.xcassets/trioWhite.appiconset/9.png
  25. 0 0
      FreeAPS/Resources/Assets.xcassets/trioWhite.appiconset/Contents.json
  26. 0 0
      FreeAPS/Resources/Assets.xcassets/trioWhiteShadow.appiconset/Contents.json
  27. 0 0
      FreeAPS/Resources/Assets.xcassets/trioWhiteShadow.appiconset/D 1.png
  28. 0 0
      FreeAPS/Resources/Assets.xcassets/trioWhiteShadow.appiconset/D.png
  29. 2 2
      FreeAPS/Resources/Info.plist
  30. 1 1
      FreeAPS/Resources/javascript/bundle/determine-basal.js
  31. 1 1
      FreeAPS/Resources/javascript/bundle/profile.js
  32. 2 1
      FreeAPS/Resources/json/defaults/preferences.json
  33. 2 2
      FreeAPS/Sources/APS/FetchGlucoseManager.swift
  34. 1 1
      FreeAPS/Sources/Application/FreeAPSApp.swift
  35. 83 0
      FreeAPS/Sources/Helpers/BuildDetails.swift
  36. 19 31
      FreeAPS/Sources/Helpers/Bundle+Extensions.swift
  37. 12 12
      FreeAPS/Sources/Localizations/Main/ar.lproj/Localizable.strings
  38. 10 10
      FreeAPS/Sources/Localizations/Main/ca.lproj/Localizable.strings
  39. 13 13
      FreeAPS/Sources/Localizations/Main/da.lproj/Localizable.strings
  40. 12 12
      FreeAPS/Sources/Localizations/Main/de.lproj/Localizable.strings
  41. 12 12
      FreeAPS/Sources/Localizations/Main/en.lproj/Localizable.strings
  42. 12 12
      FreeAPS/Sources/Localizations/Main/es.lproj/Localizable.strings
  43. 12 12
      FreeAPS/Sources/Localizations/Main/fi.lproj/Localizable.strings
  44. 12 12
      FreeAPS/Sources/Localizations/Main/fr.lproj/Localizable.strings
  45. 12 12
      FreeAPS/Sources/Localizations/Main/he.lproj/Localizable.strings
  46. 12 12
      FreeAPS/Sources/Localizations/Main/hu.lproj/Localizable.strings
  47. 14 14
      FreeAPS/Sources/Localizations/Main/it.lproj/Localizable.strings
  48. 12 12
      FreeAPS/Sources/Localizations/Main/nb.lproj/Localizable.strings
  49. 19 19
      FreeAPS/Sources/Localizations/Main/nl.lproj/Localizable.strings
  50. 12 12
      FreeAPS/Sources/Localizations/Main/pl.lproj/Localizable.strings
  51. 12 12
      FreeAPS/Sources/Localizations/Main/pt-BR.lproj/Localizable.strings
  52. 12 12
      FreeAPS/Sources/Localizations/Main/pt-PT.lproj/Localizable.strings
  53. 12 12
      FreeAPS/Sources/Localizations/Main/ru.lproj/Localizable.strings
  54. 13 13
      FreeAPS/Sources/Localizations/Main/sk.lproj/Localizable.strings
  55. 20 20
      FreeAPS/Sources/Localizations/Main/sv.lproj/Localizable.strings
  56. 13 13
      FreeAPS/Sources/Localizations/Main/tr.lproj/Localizable.strings
  57. 12 12
      FreeAPS/Sources/Localizations/Main/uk.lproj/Localizable.strings
  58. 13 13
      FreeAPS/Sources/Localizations/Main/vi.lproj/Localizable.strings
  59. 12 12
      FreeAPS/Sources/Localizations/Main/zh-Hans.lproj/Localizable.strings
  60. 1 1
      FreeAPS/Sources/Models/AlertEntry.swift
  61. 1 1
      FreeAPS/Sources/Models/CarbsEntry.swift
  62. 6 6
      FreeAPS/Sources/Models/Icons.swift
  63. 1 1
      FreeAPS/Sources/Models/NightscoutTreatment.swift
  64. 3 1
      FreeAPS/Sources/Models/Preferences.swift
  65. 1 1
      FreeAPS/Sources/Models/TempTarget.swift
  66. 1 1
      FreeAPS/Sources/Modules/HealthKit/View/AppleHealthKitRootView.swift
  67. 1 1
      FreeAPS/Sources/Modules/IconConfig/View/IconSelection.swift
  68. 2 2
      FreeAPS/Sources/Modules/NightscoutConfig/View/NightscoutConfigRootView.swift
  69. 1 1
      FreeAPS/Sources/Modules/NotificationsConfig/View/NotificationsConfigRootView.swift
  70. 18 6
      FreeAPS/Sources/Modules/PreferencesEditor/PreferencesEditorStateModel.swift
  71. 1 1
      FreeAPS/Sources/Modules/PreferencesEditor/View/PreferencesEditorRootView.swift
  72. 1 20
      FreeAPS/Sources/Modules/Settings/SettingsStateModel.swift
  73. 2 10
      FreeAPS/Sources/Modules/Settings/View/SettingsRootView.swift
  74. 23 0
      FreeAPS/Sources/Modules/Settings/View/SettingsRootViewModel.swift
  75. 1 1
      FreeAPS/Sources/Services/Calendar/CalendarManager.swift
  76. 5 5
      FreeAPS/Sources/Services/HealthKit/HealthKitManager.swift
  77. 2 2
      FreeAPS/Sources/Services/Network/NightscoutAPI.swift
  78. 1 1
      FreeAPS/Sources/Services/UserNotifiactions/UserNotificationsManager.swift
  79. 2 2
      FreeAPS/Sources/Services/WatchManager/GarminManager.swift
  80. 5 5
      FreeAPS/Sources/Shortcuts/State/ListStateIntent.swift
  81. 1 1
      FreeAPS/Sources/Shortcuts/State/ListStateView.swift
  82. 4 4
      FreeAPS/Sources/Shortcuts/State/StateIntentRequest.swift
  83. 1 1
      FreeAPSTests/FileStorageTests.swift
  84. 4 4
      FreeAPSWatch WatchKit Extension/ComplicationController.swift
  85. 50 52
      README.md
  86. 0 0
      Trio.xcworkspace/contents.xcworkspacedata
  87. 0 0
      Trio.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
  88. 0 0
      Trio.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings
  89. 0 0
      Trio.xcworkspace/xcshareddata/swiftpm/Package.resolved
  90. 5 5
      fastlane/Fastfile
  91. 23 23
      fastlane/testflight.md
  92. 0 2
      open-iaps-oref/oref_source_file_info.txt
  93. 6 1
      oref0_source_version.txt
  94. 40 0
      scripts/capture-build-details.sh
  95. 0 0
      trio-oref/lib/autotune-prep/categorize.js
  96. 0 0
      trio-oref/lib/autotune-prep/dosed.js
  97. 0 0
      trio-oref/lib/autotune-prep/index.js
  98. 0 0
      trio-oref/lib/autotune/index.js
  99. 0 0
      trio-oref/lib/basal-set-temp.js
  100. 0 0
      open-iaps-oref/lib/bolus.js

+ 1 - 1
.github/ISSUE_TEMPLATE/bug-report.md

@@ -25,7 +25,7 @@ If applicable, add screenshots to help explain your problem.
 **Setup Information (please complete the following information):**
 * Pump type
 * CGM type and CGM app
-* Open-iAPS version, branch and git reference (see Open-iAPS Settings)
+* Trio version, branch and git reference (see Trio Settings)
 
 **Additional context**
 Add any other context about the problem here.

+ 3 - 3
.github/ISSUE_TEMPLATE/config.yml

@@ -1,5 +1,5 @@
 blank_issues_enabled: false
 contact_links:
-  - name: "🆘 Individual troubleshooting help: Please go to the Discord Open-iAPS Server"
-    url: https://discord.gg/dbe5Twav8D
-    about: Are you having an issue with your individual setup? Please first go to the Discord Open-iAPS Server and post there, with details of your setup (App version, pump, CGM, and CGM app) and the issue you are observing
+  - name: "🆘 Individual troubleshooting help: Please go to the Discord Trio Server"
+    url: https://discord.gg/fCY5svg4
+    about: Are you having an issue with your individual setup? Please first go to the Discord Trio Server and post there, with details of your setup (App version, pump, CGM, and CGM app) and the issue you are observing

+ 12 - 12
.github/workflows/build_Open-iAPS.yml

@@ -1,5 +1,5 @@
-name: 4. Build Open-iAPS
-run-name: Build Open-iAPS (${{ github.ref_name }})
+name: 4. Build Trio
+run-name: Build Trio (${{ github.ref_name }})
 on:
   workflow_dispatch:
   
@@ -12,7 +12,7 @@ on:
     - cron: '0 6 1 * *' # Builds the app on the 1st of every month at 06:00 UTC
 
 env:  
-  UPSTREAM_REPO: nightscout/Open-iAPS
+  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)
   ALIVE_BRANCH: alive
@@ -69,7 +69,7 @@ jobs:
       env:
         GITHUB_TOKEN: ${{ secrets.GH_PAT }}
       run: |
-        # get ref for nightscout/Open-iAPS:main
+        # get ref for nightscout/Trio:main
         response=$(curl --request GET \
                           --url "https://api.github.com/repos/${{ env.UPSTREAM_REPO }}/git/refs/heads/main" \
                           --header "Authorization: Bearer $GITHUB_TOKEN" \
@@ -82,7 +82,7 @@ jobs:
         fi
         echo "SHA of main branch: $SHA";
         
-        # Create alive branch based on nightscout/Open-iAPS:main
+        # Create alive branch based on nightscout/Trio:main
         gh api \
           --method POST \
           -H "Authorization: token $GITHUB_TOKEN" \
@@ -155,13 +155,13 @@ jobs:
       if: needs.check_alive_and_permissions.outputs.WORKFLOW_PERMISSION != 'true'
       run: |
         echo "### :calendar: Scheduled Sync and Build Disabled :mobile_phone_off:" >> $GITHUB_STEP_SUMMARY
-        echo "You have not yet configured the scheduled sync and build for Open-iAPS's browser build." >> $GITHUB_STEP_SUMMARY
-        echo "Synchronizing your fork of <code>Open-iAPS</code> with the upstream repository <code>nightscout/Open-iAPS</code> will be skipped." >> $GITHUB_STEP_SUMMARY
-        echo "If you want to enable automatic builds and updates for your Open-iAPS, please follow the instructions \
-              under the following path <code>Open-iAPS/fastlane/testflight.md</code>." >> $GITHUB_STEP_SUMMARY
+        echo "You have not yet configured the scheduled sync and build for Trio's browser build." >> $GITHUB_STEP_SUMMARY
+        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 Open-iAPS
+  # Builds Trio
   build:
     name: Build
     needs: [validate, check_alive_and_permissions, check_latest_from_upstream]
@@ -237,9 +237,9 @@ jobs:
       - name: Install project dependencies
         run: bundle install
       
-      # Build signed Open-iAPS IPA file
+      # Build signed Trio IPA file
       - name: Fastlane Build & Archive
-        run: bundle exec fastlane build_open_iaps
+        run: bundle exec fastlane build_trio
         env:
           TEAMID: ${{ secrets.TEAMID }}
           GH_PAT: ${{ secrets.GH_PAT }}

+ 0 - 2
.gitignore

@@ -80,5 +80,3 @@ fastlane/test_output
 fastlane/FastlaneRunner
 
 ConfigOverride.xcconfig
-
-branch.txt

+ 4 - 4
Config.xcconfig

@@ -1,12 +1,12 @@
-APP_DISPLAY_NAME = Open-iAPS
+APP_DISPLAY_NAME = Trio
 APP_VERSION = 0.1.0
 APP_BUILD_NUMBER = 1
 COPYRIGHT_NOTICE =
 DEVELOPER_TEAM = ##TEAM_ID##
-BUNDLE_IDENTIFIER = org.nightscout.$(DEVELOPMENT_TEAM).openiaps
+BUNDLE_IDENTIFIER = org.nightscout.$(DEVELOPMENT_TEAM).trio
 APP_GROUP_ID = group.com.$(DEVELOPMENT_TEAM).loopkit.LoopGroup
-APP_ICON = oiapsBlack
-APP_URL_SCHEME = Open-iAPS
+APP_ICON = trioBlack
+APP_URL_SCHEME = Trio
 
 #include? "../../ConfigOverride.xcconfig"
 #include? "ConfigOverride.xcconfig"

+ 0 - 36
FAQ.md

@@ -1,36 +0,0 @@
-# FAQ
-
-## How to get the Medtronic pump ready?
-
-- Set your temporary basal to units (not percents!).
-- Turn on the remote control with any ID (for example 00000).
-
-## Can I use Bolus assistant on a Medtronic pump?
-
-- You may, but you shouldn't to avoid control conflicts.
-- Carbs, entered through the bolus assistant on pump won't be counted in FreeAPS X.
-- Insulin, delivered through the bolus assistant on pump will be counted in FreeAPS X
-
-## Does the insulin model affect anything when connecting the pump?
-
-- No. This is a legacy screen of rileylink_ios library.
-- You can change an actual insulin type in Preferences -> Insulin Curve. Ultra-rapid for Fiast and Lyumjev, rapid-acting for others.
-
-## Can we manually set TBR?
-
-- Yes. For that you need to open the loop in settings and the button will appear on the main screen.
-
-## How to run the loop on demand manually?
-
-- There is no way of doing that. You can force the data update by long-tapping the loop icon. If this actions gets any new data, loop will be recalculated.
-
-## How to get BG values from Spike/Diabox?
-
-- Settings -> Nightscout -> Use Local Glucose Server, and set the port of a local server. Spike - 1979, Diabox - 17580
-
-## How to see raw data that is used inside the app?
-
-- Preferences -> Edit settings json. Set "debugOptions": true, and restart the app.
-- In Files application on iPhone.
-- You can also download all the data to your computer through iTunes or Finder.
-

+ 0 - 36
FAQ_RU.md

@@ -1,36 +0,0 @@
-# FAQ
-
-## Как подготовить помпу Medtronic?
-
-- Установить временный базал в единицах (не в процентах!).
-- Включить удаленный контроль с любым ID (например 00000).
-
-## Можно ли использовать Помощник болюса на помпе Medtronic?
-
-- Можно, но не рекомендуется, во избежание конфликтов управления помпой.
-- Углеводы, введенные через Помощник учтены не будут.
-- Инсулин, введенный через Помощник будет учтён.
-
-## Учитывается ли тип инсулина, выбранный при подключении помпы?
-
-- Нет. Этот экран - наследие библиотеки rileylink_ios.
-- Тип исулина выбирается настройкой Preferences -> Insulin Curve. ultra-rapid для Fiasp и Lyumjev, rapid-acting для остальных.
-
-## Можно ли установить ручной временный базал?
-
-- Да. Для этого надо открыть петлю в настройках. В главном меню появится кнопка.
-
-## Как запустить петлю прямо сейчас вручную?
-
-- Такой возможности нет. Можно принудительно обновить данные помпы долгим нажатием на круг. Если новые данные доступны, петля выполнится.
-
-## Как получать глюкозу из Spike/Diabox?
-
-- Settings -> Nightscout -> Use Local Glucose Server, затем укажите порт внутреннего сервера. Spike - 1979, Diabox - 17580
-
-## Как посмотреть сырые данные, с которыми работает приложение?
-
-- Preferences -> Edit settings json. Установите параметр "debugOprions": true, затем перезапустите приложение.
-- В приложении Файлы на iPhone.
-- Также возможно скачать все данные на компьютер через iTunes или Finder.
-

Разница между файлами не показана из-за своего большого размера
+ 20 - 17
FreeAPS.xcodeproj/project.pbxproj


FreeAPS.xcodeproj/xcshareddata/xcschemes/Open-iAPS.xcscheme → FreeAPS.xcodeproj/xcshareddata/xcschemes/Trio.xcscheme


FreeAPS.xcodeproj/xcshareddata/xcschemes/FreeAPSWatch.xcscheme → FreeAPS.xcodeproj/xcshareddata/xcschemes/Trio_WatchApp.xcscheme


+ 2 - 2
FreeAPS/Resources/Assets.xcassets/oiaps3D.appiconset/Contents.json

@@ -1,13 +1,13 @@
 {
   "images" : [
     {
-      "filename" : "OiAPS  3d.png",
+      "filename" : "trio3d.png",
       "idiom" : "universal",
       "platform" : "ios",
       "size" : "1024x1024"
     },
     {
-      "filename" : "3D Watch.png",
+      "filename" : "trio3dWatch.png",
       "idiom" : "universal",
       "platform" : "watchos",
       "size" : "1024x1024"

FreeAPS/Resources/Assets.xcassets/oiaps3D.appiconset/OiAPS 3d.png → FreeAPS/Resources/Assets.xcassets/trio3D.appiconset/trio3d.png


FreeAPS/Resources/Assets.xcassets/oiaps3D.appiconset/3D Watch.png → FreeAPS/Resources/Assets.xcassets/trio3D.appiconset/trio3dWatch.png


FreeAPS/Resources/Assets.xcassets/oiapsBlack.appiconset/A 1.png → FreeAPS/Resources/Assets.xcassets/trioBlack.appiconset/A 1.png


FreeAPS/Resources/Assets.xcassets/oiapsBlack.appiconset/A.png → FreeAPS/Resources/Assets.xcassets/trioBlack.appiconset/A.png


FreeAPS/Resources/Assets.xcassets/oiapsBlack.appiconset/Contents.json → FreeAPS/Resources/Assets.xcassets/trioBlack.appiconset/Contents.json


FreeAPS/Resources/Assets.xcassets/oiapsColorBG.appiconset/C 1.png → FreeAPS/Resources/Assets.xcassets/trioColorBG.appiconset/C 1.png


FreeAPS/Resources/Assets.xcassets/oiapsColorBG.appiconset/C.png → FreeAPS/Resources/Assets.xcassets/trioColorBG.appiconset/C.png


FreeAPS/Resources/Assets.xcassets/oiapsColorBG.appiconset/Contents.json → FreeAPS/Resources/Assets.xcassets/trioColorBG.appiconset/Contents.json


FreeAPS/Resources/Assets.xcassets/OiAPS_Loop.appiconset/Contents.json → FreeAPS/Resources/Assets.xcassets/trioLoop.appiconset/Contents.json


FreeAPS/Resources/Assets.xcassets/OiAPS_Loop.appiconset/imageLoop 1.png → FreeAPS/Resources/Assets.xcassets/trioLoop.appiconset/imageLoop 1.png


FreeAPS/Resources/Assets.xcassets/OiAPS_Loop.appiconset/imageLoop.png → FreeAPS/Resources/Assets.xcassets/trioLoop.appiconset/imageLoop.png


FreeAPS/Resources/Assets.xcassets/oiapsWhite.appiconset/8.png → FreeAPS/Resources/Assets.xcassets/trioWhite.appiconset/8.png


FreeAPS/Resources/Assets.xcassets/oiapsWhite.appiconset/9.png → FreeAPS/Resources/Assets.xcassets/trioWhite.appiconset/9.png


FreeAPS/Resources/Assets.xcassets/oiapsWhite.appiconset/Contents.json → FreeAPS/Resources/Assets.xcassets/trioWhite.appiconset/Contents.json


FreeAPS/Resources/Assets.xcassets/oiAPSWhiteShadow.appiconset/Contents.json → FreeAPS/Resources/Assets.xcassets/trioWhiteShadow.appiconset/Contents.json


FreeAPS/Resources/Assets.xcassets/oiAPSWhiteShadow.appiconset/D 1.png → FreeAPS/Resources/Assets.xcassets/trioWhiteShadow.appiconset/D 1.png


FreeAPS/Resources/Assets.xcassets/oiAPSWhiteShadow.appiconset/D.png → FreeAPS/Resources/Assets.xcassets/trioWhiteShadow.appiconset/D.png


+ 2 - 2
FreeAPS/Resources/Info.plist

@@ -6,7 +6,7 @@
 	<string>$(APP_GROUP_ID)</string>
 	<key>BGTaskSchedulerPermittedIdentifiers</key>
 	<array>
-		<string>com.freeapsx.background-task.critical-event-log</string>
+		<string>$(PRODUCT_BUNDLE_IDENTIFIER).background-task.critical-event-log</string>
 	</array>
 	<key>CBBundleDisplayName</key>
 	<string>$(APP_DISPLAY_NAME)</string>
@@ -32,7 +32,7 @@
 			<key>CFBundleTypeRole</key>
 			<string>None</string>
 			<key>CFBundleURLName</key>
-			<string>com.artificial-pancreas-iaps</string>
+			<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
 			<key>CFBundleURLSchemes</key>
 			<array>
 				<string>$(APP_URL_SCHEME)</string>

Разница между файлами не показана из-за своего большого размера
+ 1 - 1
FreeAPS/Resources/javascript/bundle/determine-basal.js


Разница между файлами не показана из-за своего большого размера
+ 1 - 1
FreeAPS/Resources/javascript/bundle/profile.js


+ 2 - 1
FreeAPS/Resources/json/defaults/preferences.json

@@ -39,7 +39,8 @@
   "noisyCGMTargetMultiplier" : 1.3,
   "suspend_zeros_iob" : false,
   "maxDelta_bg_threshold" : 0.2,
-  "adjustmentFactor" : 0.5,
+  "adjustmentFactor" : 0.8,
+  "adjustmentFactorSigmoid" : 0.5,
   "sigmoid" : false,
   "enableDynamicCR" : false,
   "useNewFormula" : false,

+ 2 - 2
FreeAPS/Sources/APS/FetchGlucoseManager.swift

@@ -297,11 +297,11 @@ final class BaseFetchGlucoseManager: FetchGlucoseManager, Injectable {
     private func overcalibrate(entries: [BloodGlucose]) -> [BloodGlucose] {
         // overcalibrate
         var overcalibration: ((Int) -> (Double))?
-       
+
         if let cal = calibrationService {
             overcalibration = cal.calibrate
         }
-       
+
         if let overcalibration = overcalibration {
             return entries.map { entry in
                 var entry = entry

+ 1 - 1
FreeAPS/Sources/Application/FreeAPSApp.swift

@@ -55,7 +55,7 @@ import Swinject
     init() {
         debug(
             .default,
-            "iAPS Started: v\(Bundle.main.releaseVersionNumber ?? "")(\(Bundle.main.buildVersionNumber ?? "")) [buildDate: \(Bundle.main.buildDate)] [buildExpires: \(Bundle.main.profileExpiration)]"
+            "Trio Started: v\(Bundle.main.releaseVersionNumber ?? "")(\(Bundle.main.buildVersionNumber ?? "")) [buildDate: \(BuildDetails.default.buildDate())] [buildExpires: \(BuildDetails.default.calculateExpirationDate())]"
         )
         loadServices()
     }

+ 83 - 0
FreeAPS/Sources/Helpers/BuildDetails.swift

@@ -0,0 +1,83 @@
+//
+//  BuildDetails.swift
+//  Trio
+//
+//  Created by Jonas Björkert on 2024-05-09.
+//
+import Foundation
+
+class BuildDetails {
+    static var `default` = BuildDetails()
+
+    let dict: [String: Any]
+
+    init() {
+        guard let url = Bundle.main.url(forResource: "BuildDetails", withExtension: "plist"),
+              let data = try? Data(contentsOf: url),
+              let parsed = try? PropertyListSerialization.propertyList(from: data, format: nil) as? [String: Any]
+        else {
+            dict = [:]
+            return
+        }
+        dict = parsed
+    }
+
+    var buildDateString: String? {
+        dict["com-trio-build-date"] as? String
+    }
+
+    var branchAndSha: String {
+        let branch = dict["com-trio-branch"] as? String ?? "Unknown"
+        let sha = dict["com-trio-commit-sha"] as? String ?? "Unknown"
+        return "\(branch) \(sha)"
+    }
+
+    // Determine if the build is from TestFlight
+    func isTestFlightBuild() -> Bool {
+        #if targetEnvironment(simulator)
+            return false
+        #else
+            if Bundle.main.url(forResource: "embedded", withExtension: "mobileprovision") != nil {
+                return false
+            }
+            guard let receiptName = Bundle.main.appStoreReceiptURL?.lastPathComponent else {
+                return false
+            }
+            return "sandboxReceipt".caseInsensitiveCompare(receiptName) == .orderedSame
+        #endif
+    }
+
+    // Parse the build date string into a Date object
+    func buildDate() -> Date? {
+        let dateFormatter = DateFormatter()
+        dateFormatter.dateFormat = "EEE MMM d HH:mm:ss 'UTC' yyyy"
+        dateFormatter.locale = Locale(identifier: "en_US_POSIX")
+        dateFormatter.timeZone = TimeZone(identifier: "UTC")
+
+        guard let dateString = buildDateString,
+              let date = dateFormatter.date(from: dateString)
+        else {
+            return nil
+        }
+        return date
+    }
+
+    // Calculate the expiration date based on the build type
+    func calculateExpirationDate() -> Date? {
+        if isTestFlightBuild(), let buildDate = buildDate() {
+            // For TestFlight, add 90 days to the build date
+            return Calendar.current.date(byAdding: .day, value: 90, to: buildDate)!
+        } else {
+            return Bundle.main.profileExpirationDate
+        }
+    }
+
+    // Expiration header based on build type
+    var expirationHeaderString: String {
+        if isTestFlightBuild() {
+            return "Beta (TestFlight) Expires"
+        } else {
+            return "App Expires"
+        }
+    }
+}

+ 19 - 31
FreeAPS/Sources/Helpers/Bundle+Extensions.swift

@@ -9,17 +9,7 @@ extension Bundle {
         infoDictionary?["CFBundleVersion"] as? String
     }
 
-    var buildDate: Date {
-        if let infoPath = Bundle.main.path(forResource: "Info", ofType: "plist"),
-           let infoAttr = try? FileManager.default.attributesOfItem(atPath: infoPath),
-           let infoDate = infoAttr[.modificationDate] as? Date
-        {
-            return infoDate
-        }
-        return Date()
-    }
-
-    var profileExpiration: String? {
+    var profileExpirationDateString: String? {
         guard
             let profilePath = Bundle.main.path(forResource: "embedded", ofType: "mobileprovision"),
             let profileData = try? Data(contentsOf: URL(fileURLWithPath: profilePath)),
@@ -32,30 +22,28 @@ extension Bundle {
             return nil
         }
 
-        // NOTE: We have the `[\\W]*?` check to make sure that variations in number of tabs or new lines in the future does not influence the result.
-        guard let regex = try? NSRegularExpression(pattern: "<key>ExpirationDate</key>[\\W]*?<date>(.*?)</date>", options: [])
+        let regexPattern = "<key>ExpirationDate</key>[\\W]*?<date>(.*?)</date>"
+        guard let regex = try? NSRegularExpression(pattern: regexPattern, options: []),
+              let match = regex.firstMatch(
+                  in: profileNSString as String,
+                  options: [],
+                  range: NSRange(location: 0, length: profileNSString.length)
+              ),
+              let range = Range(match.range(at: 1), in: profileNSString as String)
         else {
-            print("Warning: Could not create regex.")
-            return nil
-        }
-
-        let regExMatches = regex.matches(
-            in: profileNSString as String,
-            options: [],
-            range: NSRange(location: 0, length: profileNSString.length)
-        )
-
-        // NOTE: range `0` corresponds to the full regex match, so to get the first capture group, we use range `1`
-        guard let rangeOfCapturedGroupForDate = regExMatches.first?.range(at: 1) else {
-            print("Warning: Could not find regex match or capture group.")
+            print("Warning: Could not create regex or find match.")
             return nil
         }
 
-        let dateWithTimeAsString = profileNSString.substring(with: rangeOfCapturedGroupForDate)
+        return String(profileNSString.substring(with: NSRange(range, in: profileNSString as String)))
+    }
 
-        guard let dateAsStringIndex = dateWithTimeAsString.firstIndex(of: "T") else {
-            return nil
-        }
-        return String(dateWithTimeAsString[..<dateAsStringIndex])
+    var profileExpirationDate: Date? {
+        guard let dateString = profileExpirationDateString else { return nil }
+        let dateFormatter = DateFormatter()
+        dateFormatter.dateFormat = "yyyy-MM-dd'T'HH:mm:ss'Z'"
+        dateFormatter.locale = Locale(identifier: "en_US_POSIX")
+        dateFormatter.timeZone = TimeZone(secondsFromGMT: 0)
+        return dateFormatter.date(from: dateString)
     }
 }

Разница между файлами не показана из-за своего большого размера
+ 12 - 12
FreeAPS/Sources/Localizations/Main/ar.lproj/Localizable.strings


Разница между файлами не показана из-за своего большого размера
+ 10 - 10
FreeAPS/Sources/Localizations/Main/ca.lproj/Localizable.strings


Разница между файлами не показана из-за своего большого размера
+ 13 - 13
FreeAPS/Sources/Localizations/Main/da.lproj/Localizable.strings


Разница между файлами не показана из-за своего большого размера
+ 12 - 12
FreeAPS/Sources/Localizations/Main/de.lproj/Localizable.strings


Разница между файлами не показана из-за своего большого размера
+ 12 - 12
FreeAPS/Sources/Localizations/Main/en.lproj/Localizable.strings


Разница между файлами не показана из-за своего большого размера
+ 12 - 12
FreeAPS/Sources/Localizations/Main/es.lproj/Localizable.strings


Разница между файлами не показана из-за своего большого размера
+ 12 - 12
FreeAPS/Sources/Localizations/Main/fi.lproj/Localizable.strings


Разница между файлами не показана из-за своего большого размера
+ 12 - 12
FreeAPS/Sources/Localizations/Main/fr.lproj/Localizable.strings


Разница между файлами не показана из-за своего большого размера
+ 12 - 12
FreeAPS/Sources/Localizations/Main/he.lproj/Localizable.strings


Разница между файлами не показана из-за своего большого размера
+ 12 - 12
FreeAPS/Sources/Localizations/Main/hu.lproj/Localizable.strings


Разница между файлами не показана из-за своего большого размера
+ 14 - 14
FreeAPS/Sources/Localizations/Main/it.lproj/Localizable.strings


Разница между файлами не показана из-за своего большого размера
+ 12 - 12
FreeAPS/Sources/Localizations/Main/nb.lproj/Localizable.strings


Разница между файлами не показана из-за своего большого размера
+ 19 - 19
FreeAPS/Sources/Localizations/Main/nl.lproj/Localizable.strings


Разница между файлами не показана из-за своего большого размера
+ 12 - 12
FreeAPS/Sources/Localizations/Main/pl.lproj/Localizable.strings


Разница между файлами не показана из-за своего большого размера
+ 12 - 12
FreeAPS/Sources/Localizations/Main/pt-BR.lproj/Localizable.strings


Разница между файлами не показана из-за своего большого размера
+ 12 - 12
FreeAPS/Sources/Localizations/Main/pt-PT.lproj/Localizable.strings


Разница между файлами не показана из-за своего большого размера
+ 12 - 12
FreeAPS/Sources/Localizations/Main/ru.lproj/Localizable.strings


Разница между файлами не показана из-за своего большого размера
+ 13 - 13
FreeAPS/Sources/Localizations/Main/sk.lproj/Localizable.strings


Разница между файлами не показана из-за своего большого размера
+ 20 - 20
FreeAPS/Sources/Localizations/Main/sv.lproj/Localizable.strings


Разница между файлами не показана из-за своего большого размера
+ 13 - 13
FreeAPS/Sources/Localizations/Main/tr.lproj/Localizable.strings


Разница между файлами не показана из-за своего большого размера
+ 12 - 12
FreeAPS/Sources/Localizations/Main/uk.lproj/Localizable.strings


Разница между файлами не показана из-за своего большого размера
+ 13 - 13
FreeAPS/Sources/Localizations/Main/vi.lproj/Localizable.strings


Разница между файлами не показана из-за своего большого размера
+ 12 - 12
FreeAPS/Sources/Localizations/Main/zh-Hans.lproj/Localizable.strings


+ 1 - 1
FreeAPS/Sources/Models/AlertEntry.swift

@@ -15,7 +15,7 @@ struct AlertEntry: JSON, Codable, Hashable {
     let contentBody: String?
     var errorMessage: String?
 
-    static let manual = "Open-iAPS"
+    static let manual = "Trio"
 
     static func == (lhs: AlertEntry, rhs: AlertEntry) -> Bool {
         lhs.issuedDate == rhs.issuedDate

+ 1 - 1
FreeAPS/Sources/Models/CarbsEntry.swift

@@ -12,7 +12,7 @@ struct CarbsEntry: JSON, Equatable, Hashable {
     let isFPU: Bool?
     let fpuID: String?
 
-    static let manual = "Open-iAPS"
+    static let manual = "Trio"
     static let appleHealth = "applehealth"
 
     static func == (lhs: CarbsEntry, rhs: CarbsEntry) -> Bool {

+ 6 - 6
FreeAPS/Sources/Models/Icons.swift

@@ -3,15 +3,15 @@ import Foundation
 import UIKit
 
 enum Icon_: String, CaseIterable, Identifiable {
-    case primary = "oiapsBlack"
-    case oiAPSWhiteShadow
-    case oiapsColorBG
-    case oiapsWhite
-    case oiaps3D
+    case primary = "trioBlack"
+    case trioWhiteShadow
+    case trioColorBG
+    case trioWhite
+    case trio3D
     case wilford = "diabeetus"
     case catWithPod
     case catWithPodWhite = "catWithPodWhiteBG"
-    case loop = "OiAPS_Loop"
+    case loop = "trioLoop"
     var id: String { rawValue }
 }
 

+ 1 - 1
FreeAPS/Sources/Models/NightscoutTreatment.swift

@@ -26,7 +26,7 @@ struct NightscoutTreatment: JSON, Hashable, Equatable {
     let targetTop: Decimal?
     let targetBottom: Decimal?
 
-    static let local = "Open-iAPS"
+    static let local = "Trio"
 
     static let empty = NightscoutTreatment(from: "{}")!
 

+ 3 - 1
FreeAPS/Sources/Models/Preferences.swift

@@ -42,7 +42,8 @@ struct Preferences: JSON {
     var suspendZerosIOB: Bool = false
     var timestamp: Date?
     var maxDeltaBGthreshold: Decimal = 0.2
-    var adjustmentFactor: Decimal = 0.5
+    var adjustmentFactor: Decimal = 0.8
+    var adjustmentFactorSigmoid: Decimal = 0.5
     var sigmoid: Bool = false
     var enableDynamicCR: Bool = false
     var useNewFormula: Bool = false
@@ -98,6 +99,7 @@ extension Preferences {
         case suspendZerosIOB = "suspend_zeros_iob"
         case maxDeltaBGthreshold = "maxDelta_bg_threshold"
         case adjustmentFactor
+        case adjustmentFactorSigmoid
         case sigmoid
         case enableDynamicCR
         case useNewFormula

+ 1 - 1
FreeAPS/Sources/Models/TempTarget.swift

@@ -10,7 +10,7 @@ struct TempTarget: JSON, Identifiable, Equatable, Hashable {
     let enteredBy: String?
     let reason: String?
 
-    static let manual = "Open-iAPS"
+    static let manual = "Trio"
     static let custom = "Temp target"
     static let cancel = "Cancel"
 

+ 1 - 1
FreeAPS/Sources/Modules/HealthKit/View/AppleHealthKitRootView.swift

@@ -13,7 +13,7 @@ extension AppleHealthKit {
                     HStack {
                         Image(systemName: "pencil.circle.fill")
                         Text(
-                            "This allows iAPS to read from and write to Apple Heath. You must also give permissions in Settings > Health > Data Access. If you enter a glucose value into Apple Health, open iAPS to confirm it shows up."
+                            "This allows Trio to read from and write to Apple Heath. You must also give permissions in Settings > Health > Data Access. If you enter a glucose value into Apple Health, open Trio to confirm it shows up."
                         )
                         .font(.caption)
                     }

+ 1 - 1
FreeAPS/Sources/Modules/IconConfig/View/IconSelection.swift

@@ -9,7 +9,7 @@ struct IconSelection: View {
 
         VStack {
             HStack {
-                Text("Open-iAPS Icon")
+                Text("Trio Icon")
                     .font(.title)
                 IconImage(icon: model.appIcon)
                     .frame(maxHeight: 114)

+ 2 - 2
FreeAPS/Sources/Modules/NightscoutConfig/View/NightscoutConfigRootView.swift

@@ -103,7 +103,7 @@ extension NightscoutConfig {
                             message: Text(
                                 (fetchedErrors.first?.error ?? "").count < 4 ?
                                     NSLocalizedString(
-                                        "\nNow please verify all of your new settings thoroughly:\n\n* Basal Settings\n * Carb Ratios\n * Glucose Targets\n * Insulin Sensitivities\n * DIA\n\n in iAPS Settings > Configuration.\n\nBad or invalid profile settings could have disatrous effects.",
+                                        "\nNow please verify all of your new settings thoroughly:\n\n* Basal Settings\n * Carb Ratios\n * Glucose Targets\n * Insulin Sensitivities\n * DIA\n\n in Trio Settings > Configuration.\n\nBad or invalid profile settings could have disatrous effects.",
                                         comment: "Imported Profiles Alert"
                                     ) :
                                     NSLocalizedString(fetchedErrors.first?.error ?? "", comment: "Import Error")
@@ -129,7 +129,7 @@ extension NightscoutConfig {
 
                 Section {
                     Toggle("Remote control", isOn: $state.allowAnnouncements)
-                } header: { Text("Allow Remote control of iAPS") }
+                } header: { Text("Allow Remote control of Trio") }
             }
             .onAppear(perform: configureView)
             .navigationBarTitle("Nightscout Config")

+ 1 - 1
FreeAPS/Sources/Modules/NotificationsConfig/View/NotificationsConfigRootView.swift

@@ -92,7 +92,7 @@ extension NotificationsConfig {
 
             if !systemLiveActivitySetting {
                 footer =
-                    "Live activities are turned OFF in system settings. To enable live activities, go to Settings app -> iAPS -> Turn live Activities ON.\n\n" +
+                    "Live activities are turned OFF in system settings. To enable live activities, go to Settings app -> Trio -> Turn live Activities ON.\n\n" +
                     footer
             }
 

Разница между файлами не показана из-за своего большого размера
+ 18 - 6
FreeAPS/Sources/Modules/PreferencesEditor/PreferencesEditorStateModel.swift


+ 1 - 1
FreeAPS/Sources/Modules/PreferencesEditor/View/PreferencesEditorRootView.swift

@@ -22,7 +22,7 @@ extension PreferencesEditor {
 
         var body: some View {
             Form {
-                Section(header: Text("iAPS").textCase(nil)) {
+                Section(header: Text("Trio").textCase(nil)) {
                     Picker("Glucose units", selection: $state.unitsIndex) {
                         Text("mg/dL").tag(0)
                         Text("mmol/L").tag(1)

+ 1 - 20
FreeAPS/Sources/Modules/Settings/SettingsStateModel.swift

@@ -31,26 +31,7 @@ extension Settings {
 
             versionNumber = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String ?? "Unknown"
 
-            // Read branch information from the branch.txt instead of infoDictionary
-            if let branchFileURL = Bundle.main.url(forResource: "branch", withExtension: "txt"),
-               let branchFileContent = try? String(contentsOf: branchFileURL)
-            {
-                let lines = branchFileContent.components(separatedBy: .newlines)
-                for line in lines {
-                    let components = line.components(separatedBy: "=")
-                    if components.count == 2 {
-                        let key = components[0].trimmingCharacters(in: .whitespaces)
-                        let value = components[1].trimmingCharacters(in: .whitespaces)
-
-                        if key == "BRANCH" {
-                            branch = value
-                            break
-                        }
-                    }
-                }
-            } else {
-                branch = "Unknown"
-            }
+            branch = BuildDetails.default.branchAndSha
 
             copyrightNotice = Bundle.main.infoDictionary?["NSHumanReadableCopyright"] as? String ?? ""
 

+ 2 - 10
FreeAPS/Sources/Modules/Settings/View/SettingsRootView.swift

@@ -9,6 +9,7 @@ extension Settings {
         let resolver: Resolver
         @StateObject var state = StateModel()
         @State private var showShareSheet = false
+        @StateObject private var viewModel = SettingsRootViewModel()
 
         var body: some View {
             Form {
@@ -16,16 +17,7 @@ extension Settings {
                     Toggle("Closed loop", isOn: $state.closedLoop)
                 }
                 header: {
-                    if let expirationDate = Bundle.main.profileExpiration {
-                        Text(
-                            "Open-iAPS v\(state.versionNumber) (\(state.buildNumber))\nBranch: \(state.branch) \(state.copyrightNotice)" +
-                                "\nBuild Expires: " + expirationDate
-                        ).textCase(nil)
-                    } else {
-                        Text(
-                            "Open-iAPS v\(state.versionNumber) (\(state.buildNumber))\nBranch: \(state.branch) \(state.copyrightNotice)"
-                        )
-                    }
+                    Text(viewModel.headerText).textCase(nil)
                 }
 
                 Section {

+ 23 - 0
FreeAPS/Sources/Modules/Settings/View/SettingsRootViewModel.swift

@@ -0,0 +1,23 @@
+import Foundation
+import SwiftUI
+import Swinject
+
+class SettingsRootViewModel: ObservableObject {
+    @Published var headerText: String = ""
+
+    init() {
+        let buildDetails = BuildDetails.default
+        let versionNumber = Bundle.main.releaseVersionNumber ?? "Unknown"
+        let buildNumber = Bundle.main.buildVersionNumber ?? "Unknown"
+        let branch = buildDetails.branchAndSha
+
+        let headerBase = "Trio v\(versionNumber) (\(buildNumber))\nBranch: \(branch)"
+
+        if let expirationDate = buildDetails.calculateExpirationDate() {
+            let formattedDate = DateFormatter.localizedString(from: expirationDate, dateStyle: .medium, timeStyle: .none)
+            headerText = "\(headerBase)\n\(buildDetails.expirationHeaderString): \(formattedDate)"
+        } else {
+            headerText = headerBase
+        }
+    }
+}

+ 1 - 1
FreeAPS/Sources/Services/Calendar/CalendarManager.swift

@@ -93,7 +93,7 @@ final class BaseCalendarManager: CalendarManager, Injectable {
         let title = glucoseText + " " + directionText + " " + deltaText
 
         event.title = title
-        event.notes = "iAPS"
+        event.notes = "Trio"
         event.startDate = Date()
         event.endDate = Date(timeIntervalSinceNow: 60 * 10)
         event.calendar = calendar

+ 5 - 5
FreeAPS/Sources/Services/HealthKit/HealthKitManager.swift

@@ -19,9 +19,9 @@ protocol HealthKitManager: GlucoseSource {
     func saveIfNeeded(carbs: [CarbsEntry])
     /// Save Insulin to Health store
     func saveIfNeeded(pumpEvents events: [PumpHistoryEvent])
-    /// Create observer for data passing beetwen Health Store and Open-iAPS
+    /// Create observer for data passing beetwen Health Store and Trio
     func createBGObserver()
-    /// Enable background delivering objects from Apple Health to Open-iAPS
+    /// Enable background delivering objects from Apple Health to Trio
     func enableBackgroundDelivery()
     /// Delete glucose with syncID
     func deleteGlucose(syncID: String)
@@ -46,7 +46,7 @@ final class BaseHealthKitManager: HealthKitManager, Injectable, CarbsObserver, P
         static let healthInsulinObject = HKObjectType.quantityType(forIdentifier: .insulinDelivery)
 
         // Meta-data key of FreeASPX data in HealthStore
-        static let freeAPSMetaKey = "From Open-iAPS"
+        static let freeAPSMetaKey = "From Trio"
     }
 
     @Injected() private var glucoseStorage: GlucoseStorage!
@@ -495,8 +495,8 @@ final class BaseHealthKitManager: HealthKitManager, Injectable, CarbsObserver, P
 
         newGlucose += samples
             .compactMap { sample -> HealthKitSample? in
-                let fromFAX = sample.metadata?[Config.freeAPSMetaKey] as? Bool ?? false
-                guard !fromFAX else { return nil }
+                let fromTrio = sample.metadata?[Config.freeAPSMetaKey] as? Bool ?? false
+                guard !fromTrio else { return nil }
                 return HealthKitSample(
                     healthKitId: sample.uuid.uuidString,
                     date: sample.startDate,

+ 2 - 2
FreeAPS/Sources/Services/Network/NightscoutAPI.swift

@@ -37,8 +37,8 @@ extension NightscoutAPI {
     func checkConnection() -> AnyPublisher<Void, Swift.Error> {
         struct Check: Codable, Equatable {
             var eventType = "Note"
-            var enteredBy = "Open-iAPS"
-            var notes = "Open-iAPS connected"
+            var enteredBy = "Trio"
+            var notes = "Trio connected"
         }
         let check = Check()
         var request = URLRequest(url: url.appendingPathComponent(Config.treatmentsPath))

+ 1 - 1
FreeAPS/Sources/Services/UserNotifiactions/UserNotificationsManager.swift

@@ -126,7 +126,7 @@ final class BaseUserNotificationsManager: NSObject, UserNotificationsManager, In
 
     private func scheduleMissingLoopNotifiactions(date _: Date) {
         ensureCanSendNotification {
-            let title = NSLocalizedString("Open-iAPS Not Active", comment: "Open-iAPS Not Active")
+            let title = NSLocalizedString("Trio Not Active", comment: "Trio Not Active")
             let body = NSLocalizedString("Last loop was more than %d min ago", comment: "Last loop was more than %d min ago")
 
             let firstInterval = 20 // min

+ 2 - 2
FreeAPS/Sources/Services/WatchManager/GarminManager.swift

@@ -63,7 +63,7 @@ final class BaseGarminManager: NSObject, GarminManager, Injectable {
 
     init(resolver: Resolver) {
         super.init()
-        connectIQ?.initialize(withUrlScheme: "Open-iAPS", uiOverrideDelegate: self)
+        connectIQ?.initialize(withUrlScheme: "Trio", uiOverrideDelegate: self)
         injectServices(resolver)
         restoreDevices()
         subscribeToOpenFromGarminConnect()
@@ -157,7 +157,7 @@ extension BaseGarminManager: IQUIOverrideDelegate {
         debug(.apsManager, NSLocalizedString("Garmin is not available", comment: ""))
         let messageCont = MessageContent(
             content: NSLocalizedString(
-                "The app Garmin Connect must be installed to use for iAPS.\n Go to App Store to download it",
+                "The app Garmin Connect must be installed to use for Trio.\n Go to App Store to download it",
                 comment: ""
             ),
             type: .warning

+ 5 - 5
FreeAPS/Sources/Shortcuts/State/ListStateIntent.swift

@@ -3,26 +3,26 @@ import Foundation
 
 @available(iOS 16.0, *) struct ListStateIntent: AppIntent {
     // Title of the action in the Shortcuts app
-    static var title: LocalizedStringResource = "List last state available with iAPS"
+    static var title: LocalizedStringResource = "List last state available with Trio"
 
     var stateIntent = StateIntentRequest()
 
     // Description of the action in the Shortcuts app
     static var description = IntentDescription(
-        "Allow to list the last Blood Glucose, trends, IOB and COB available in iAPS"
+        "Allow to list the last Blood Glucose, trends, IOB and COB available in Trio"
     )
 
     static var parameterSummary: some ParameterSummary {
-        Summary("List all states of Open-iAPS")
+        Summary("List all states of Trio")
     }
 
-    @MainActor func perform() async throws -> some ReturnsValue<StateiAPSResults> & ShowsSnippetView {
+    @MainActor func perform() async throws -> some ReturnsValue<StateResults> & ShowsSnippetView {
         let glucoseValues = try? stateIntent.getLastBG()
         let iob_cob_value = try? stateIntent.getIOB_COB()
 
         guard let glucoseValue = glucoseValues else { throw StateIntentError.NoBG }
         guard let iob_cob = iob_cob_value else { throw StateIntentError.NoIOBCOB }
-        let BG = StateiAPSResults(
+        let BG = StateResults(
             glucose: glucoseValue.glucose,
             trend: glucoseValue.trend,
             delta: glucoseValue.delta,

+ 1 - 1
FreeAPS/Sources/Shortcuts/State/ListStateView.swift

@@ -3,7 +3,7 @@ import Foundation
 import SwiftUI
 
 struct ListStateView: View {
-    var state: StateiAPSResults
+    var state: StateResults
 
     private var numberFormatter: NumberFormatter {
         let formatter = NumberFormatter()

+ 4 - 4
FreeAPS/Sources/Shortcuts/State/StateIntentRequest.swift

@@ -7,10 +7,10 @@ enum StateIntentError: Error {
     case NoIOBCOB
 }
 
-@available(iOS 16, *) struct StateiAPSResults: AppEntity {
+@available(iOS 16, *) struct StateResults: AppEntity {
     static var defaultQuery = StateBGQuery()
 
-    static var typeDisplayRepresentation: TypeDisplayRepresentation = "iAPS State Result"
+    static var typeDisplayRepresentation: TypeDisplayRepresentation = "Trio State Result"
 
     var displayRepresentation: DisplayRepresentation {
         DisplayRepresentation(title: "\(glucose)")
@@ -44,11 +44,11 @@ enum StateIntentError: Error {
 }
 
 @available(iOS 16.0, *) struct StateBGQuery: EntityQuery {
-    func entities(for _: [StateiAPSResults.ID]) async throws -> [StateiAPSResults] {
+    func entities(for _: [StateResults.ID]) async throws -> [StateResults] {
         []
     }
 
-    func suggestedEntities() async throws -> [StateiAPSResults] {
+    func suggestedEntities() async throws -> [StateResults] {
         []
     }
 }

+ 1 - 1
FreeAPSTests/FileStorageTests.swift

@@ -9,7 +9,7 @@ class FileStorageTests: XCTestCase {
         let value: Decimal
     }
 
-    func testFileStorageOiAPS() {
+    func testFileStorageTrio() {
         let dummyObject = DummyObject(id: "21342Z", value: 78.2)
         fileStorage.save(dummyObject, as: "dummyObject")
         let dummyObjectRetrieve = fileStorage.retrieve("dummyObject", as: DummyObject.self)

+ 4 - 4
FreeAPSWatch WatchKit Extension/ComplicationController.swift

@@ -8,7 +8,7 @@ class ComplicationController: NSObject, CLKComplicationDataSource {
         let descriptors = [
             CLKComplicationDescriptor(
                 identifier: "complication",
-                displayName: "iAPS",
+                displayName: "Trio",
                 supportedFamilies: [
                     .graphicCorner,
                     .graphicCircular,
@@ -52,14 +52,14 @@ class ComplicationController: NSObject, CLKComplicationDataSource {
                 return
             }
             let template = CLKComplicationTemplateGraphicCornerTextImage(
-                textProvider: CLKTextProvider(format: "%@", "iAPS"),
+                textProvider: CLKTextProvider(format: "%@", "Trio"),
                 imageProvider: CLKFullColorImageProvider(fullColorImage: image)
             )
             let timelineEntry = CLKComplicationTimelineEntry(date: Date(), complicationTemplate: template)
             handler(timelineEntry)
         case .modularSmall:
             let template = CLKComplicationTemplateModularSmallRingText(
-                textProvider: CLKTextProvider(format: "%@", "FAX"),
+                textProvider: CLKTextProvider(format: "%@", "Trio"),
                 fillFraction: 1,
                 ringStyle: .closed
             )
@@ -78,7 +78,7 @@ class ComplicationController: NSObject, CLKComplicationDataSource {
             handler(timelineEntry)
         case .circularSmall:
             let template =
-                CLKComplicationTemplateCircularSmallSimpleText(textProvider: CLKTextProvider(format: "%@", "FAX"))
+                CLKComplicationTemplateCircularSmallSimpleText(textProvider: CLKTextProvider(format: "%@", "Trio"))
             let timelineEntry = CLKComplicationTimelineEntry(date: Date(), complicationTemplate: template)
             handler(timelineEntry)
         default:

Разница между файлами не показана из-за своего большого размера
+ 50 - 52
README.md


Open-iAPS.xcworkspace/contents.xcworkspacedata → Trio.xcworkspace/contents.xcworkspacedata


Open-iAPS.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist → Trio.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist


Open-iAPS.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings → Trio.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings


Open-iAPS.xcworkspace/xcshareddata/swiftpm/Package.resolved → Trio.xcworkspace/xcshareddata/swiftpm/Package.resolved


+ 5 - 5
fastlane/Fastfile

@@ -51,8 +51,8 @@ ENV["BUNDLE_ID"] = xcconfig["BUNDLE_IDENTIFIER"]
 
 # limit lane names to letters and underscores
 platform :ios do
-  desc "Build Open-iAPS"
-  lane :build_open_iaps do
+  desc "Build Trio"
+  lane :build_trio do
     setup_ci if ENV['CI']
     BUNDLE_ID = ENV["BUNDLE_ID"]
 
@@ -135,8 +135,8 @@ platform :ios do
 
     gym(
       export_method: "app-store",
-      scheme: "Open-iAPS",
-      output_name: "Open-iAPS.ipa",
+      scheme: "Trio",
+      output_name: "Trio.ipa",
       configuration: "Release",
       destination: 'generic/platform=iOS',
       buildlog_path: 'buildlog'
@@ -159,7 +159,7 @@ platform :ios do
     upload_to_testflight(
       api_key: api_key,
       skip_submission: false,
-      ipa: "Open-iAPS.ipa",
+      ipa: "Trio.ipa",
       skip_waiting_for_build_processing: true,
       changelog: git_branch+" "+last_git_commit[:abbreviated_commit_hash],
     )

+ 23 - 23
fastlane/testflight.md

@@ -1,18 +1,18 @@
 # Using Github Actions + FastLane to deploy to TestFlight: the "Browser Build" method
 
-These instructions allow you to build Open-iAPS without having access to a Mac.
+These instructions allow you to build Trio without having access to a Mac.
 
-* You can install Open-iAPS on phones via TestFlight that are not connected to your computer
+* You can install Trio on phones via TestFlight that are not connected to your computer
 * You can send builds and updates to those you care for
-* You can install Open-iAPS on your phone using only the TestFlight app if a phone was lost or the app is accidentally deleted
+* You can install Trio on your phone using only the TestFlight app if a phone was lost or the app is accidentally deleted
 * You do not need to worry about specific Xcode/Mac versions for a given iOS
 
 ## **Automatic Builds**
 > 
-> The browser build defaults to automatically updating and building a new version of Open-iAPS according to this schedule:
+> The browser build defaults to automatically updating and building a new version of Trio according to this schedule:
 > - automatically checks for updates weekly on Wednesdays and if updates are found, it will build a new version of the app
 > - automatically builds once a month regardless of whether there are updates on the first of the month
-> - with each scheduled run (weekly or monthly), a successful Build Open-iAPS log appears - if the time is very short, it did not need to build - only the long actions (>10 minutes) built a new Open-iAPS app
+> - with each scheduled run (weekly or monthly), a successful Build Trio log appears - if the time is very short, it did not need to build - only the long actions (>10 minutes) built a new Trio app
 > 
 > It also creates an alive branch, if you don't already have one. See [Why do I have an alive branch?](#why-do-i-have-an-alive-branch).
 >
@@ -29,7 +29,7 @@ There are more detailed instructions in LoopDocs for doing Browser Builds of Loo
 
 ## Prerequisites
 
-* A [github account](https://github.com/signup). The free level comes with plenty of storage and free compute time to build Open-iAPS, multiple times a day, if you wanted to.
+* A [github account](https://github.com/signup). The free level comes with plenty of storage and free compute time to build Trio, multiple times a day, if you wanted to.
 * A paid [Apple Developer account](https://developer.apple.com).
 * Some time. Set aside a couple of hours to perform the setup. 
 * Use the same GitHub account for all "Browser Builds" of the various DIY apps.
@@ -81,9 +81,9 @@ The creation of the Match-Secrets repository is a common step for all GitHub Bro
 
 Once created, you will not take any direct actions with this repository; it needs to be there for the GitHub to use as you progress through the steps.
 
-## Setup Github Open-iAPS repository
-1. Fork https://github.com/nightscout/Open-iAPS into your account. If you already have a fork of Open-iAPS in GitHub, you can't make another one. You can continue to work with your existing fork, or delete that from GitHub and then and fork https://github.com/nightscout/Open-iAPS.
-1. In the forked Open-iAPS repo, go to Settings -> Secrets and variables -> Actions.
+## Setup Github Trio repository
+1. Fork https://github.com/nightscout/Trio into your account. If you already have a fork of Trio in GitHub, you can't make another one. You can continue to work with your existing fork, or delete that from GitHub and then and fork https://github.com/nightscout/Trio.
+1. In the forked Trio repo, go to Settings -> Secrets and variables -> Actions.
 1. For each of the following secrets, tap on "New repository secret", then add the name of the secret, along with the value you recorded for it:
     * `TEAMID`
     * `FASTLANE_ISSUER_ID`
@@ -96,23 +96,23 @@ Once created, you will not take any direct actions with this repository; it need
 
 This step validates most of your six Secrets and provides error messages if it detects an issue with one or more.
 
-1. Click on the "Actions" tab of your Open-iAPS repository and enable workflows if needed
+1. Click on the "Actions" tab of your Trio repository and enable workflows if needed
 1. On the left side, select "1. Validate Secrets".
 1. On the right side, click "Run Workflow", and tap the green `Run workflow` button.
 1. Wait, and within a minute or two you should see a green checkmark indicating the workflow succeeded.
 1. The workflow will check if the required secrets are added and that they are correctly formatted. If errors are detected, please check the run log for details.
 
-## Add Identifiers for Open-iAPS App
+## Add Identifiers for Trio App
 
-1. Click on the "Actions" tab of your Open-iAPS repository.
+1. Click on the "Actions" tab of your Trio repository.
 1. On the left side, select "2. Add Identifiers".
 1. On the right side, click "Run Workflow", and tap the green `Run workflow` button.
 1. Wait, and within a minute or two you should see a green checkmark indicating the workflow succeeded.
 
 ## Create App Group
 
-If you have already built Open-iAPS via Xcode using this Apple ID, you can skip on to [Create Open-iAPS App in App Store Connect](#create-FreeAPS-X-app-in-app-store-connect).
-_Please note that in default builds of Open-iAPS, the app group is actually identical to the one used with Loop, so please enter these details exactly as described below. This is to ease the setup of apps such as Xdrip4iOS. It may require some caution if transfering between Open-iAPS and Loop._
+If you have already built Trio via Xcode using this Apple ID, you can skip on to [Create Trio App in App Store Connect](#create-trio-app-in-app-store-connect).
+_Please note that in default builds of Trio, the app group is actually identical to the one used with Loop, so please enter these details exactly as described below. This is to ease the setup of apps such as Xdrip4iOS. It may require some caution if transfering between Trio and Loop._
 
 1. Go to [Register an App Group](https://developer.apple.com/account/resources/identifiers/applicationGroup/add/) on the apple developer site.
 1. For Description, use "Loop App Group".
@@ -134,16 +134,16 @@ _Please note that in default builds of Open-iAPS, the app group is actually iden
 1. Click "Confirm".
 1. Remember to do this for each of the identifiers above.
 
-## Create Open-iAPS App in App Store Connect
+## Create Trio App in App Store Connect
 
-If you have created a Open-iAPS app in App Store Connect before, you can skip this section as well.
+If you have created a Trio app in App Store Connect before, you can skip this section as well.
 
 1. Go to the [apps list](https://appstoreconnect.apple.com/apps) on App Store Connect and click the blue "plus" icon to create a New App.
     * Select "iOS".
     * Select a name: this will have to be unique, so you may have to try a few different names here, but it will not be the name you see on your phone, so it's not that important.
     * Select your primary language.
     * Choose the bundle ID that matches the `BUNDLE_IDENTIFIER` in your `Config.xcconfig` file
-       * this is typically `org.nightscout.TEAMID.openiaps` with `TEAMID` matching your team id
+       * this is typically `org.nightscout.TEAMID.trio` with `TEAMID` matching your team id
     * SKU can be anything; e.g. "123".
     * Select "Full Access".
 1. Click Create
@@ -152,19 +152,19 @@ You do not need to fill out the next form. That is for submitting to the app sto
 
 ## Create Building Certficates
 
-1. Go back to the "Actions" tab of your Open-iAPS repository in github.
+1. Go back to the "Actions" tab of your Trio repository in github.
 1. Select "3. Create Certificates".
 1. Click "Run Workflow", and tap the green button.
 1. Wait, and within a minute or two you should see a green checkmark indicating the workflow succeeded.
 
-## Build Open-iAPS!
+## Build Trio!
 
-1. Click on the "Actions" tab of your Open-iAPS repository.
-1. On the left side, select "4. Build Open-iAPS".
+1. Click on the "Actions" tab of your Trio repository.
+1. On the left side, select "4. Build Trio".
 1. Click "Run Workflow", select your branch, and tap the green button.
 1. You have some time now. Go enjoy a coffee. The build should take about 15 minutes.
 1. Your app should eventually appear on [App Store Connect](https://appstoreconnect.apple.com/apps).
-1. For each phone/person you would like to support Open-iAPS on:
+1. For each phone/person you would like to support Trio on:
     * Add them in [Users and Access](https://appstoreconnect.apple.com/access/users) on App Store Connect.
     * Add them to your TestFlight Internal Testing group.
 
@@ -178,6 +178,6 @@ For more details, please refer to [LoopDocs: Set Up Users](https://loopkit.githu
 
 If a GitHub repository has no activity (no commits are made) in 60 days, then GitHub disables the ability to use automated actions for that repository. We need to take action more frequently than that or the automated build process won't work.
 
-The updated `build_Open-iAPS.yml` file uses a special branch called `alive` and adds a dummy commit to the `alive` branch at regular intervals. This "trick" keeps the Actions enabled so the automated build works.
+The `build_trio.yml` file uses a special branch called `alive` and adds a dummy commit to the `alive` branch at regular intervals. This "trick" keeps the Actions enabled so the automated build works.
 
 The branch `alive` is created automatically for you. Do not delete or rename it! Do not modify `alive` yourself; it is not used for building the app.

+ 0 - 2
open-iaps-oref/oref_source_file_info.txt

@@ -1,2 +0,0 @@
-These source files are copied from open-iaps-oref, and are for information purposes only.
-The algorithm is run based on minimised files in FreeAPS/Resources/javascript/bundle.

+ 6 - 1
oref0_source_version.txt

@@ -1,9 +1,14 @@
-oref0 branch: dev - git version: 5774155
+oref0 branch: dev - git version: e023125
 
 Last commits:
+e023125 Replace Open-iAPS with Trio (#23)
+fa373c9 Merge pull request #22 from nightscout/tmhastings-tddAdjBasal
+fc0ae69 tddAdjBasal pop-up correction
+487bcbb Merge pull request #21 from MikePlante1/separate_adjustment_factors
 5774155 Merge pull request #20 from MikePlante1/disable_smb_schedule
 e3a8d73 Merge pull request #17 from MikePlante1/console_error_refactor
 a29d9ce rename smbIsAlwaysOff to smbIsScheduledOff
+b777c77 Separate Adjustment Factors for Logarithmic and Sigmoid
 d898eb1 fix threshold console.error
 b89a39b Merge pull request #16 from bjornoleh/webpack-update
 b8aaf93 Merge pull request #15 from avouspierre/dev

+ 40 - 0
scripts/capture-build-details.sh

@@ -0,0 +1,40 @@
+#!/bin/sh -e
+
+#  capture-build-details.sh
+#  Trio
+#
+#  Created by Jonas Björkert on 2024-05-08.
+
+# Enable debugging if needed
+#set -x
+
+info_plist_path="${BUILT_PRODUCTS_DIR}/${CONTENTS_FOLDER_PATH}/BuildDetails.plist"
+
+# Ensure the path to BuildDetails.plist is valid.
+if [ "${info_plist_path}" == "/" -o ! -e "${info_plist_path}" ]; then
+    echo "BuildDetails.plist file does not exist at path: ${info_plist_path}" >&2
+    exit 1
+else
+    echo "Gathering build details..."
+
+    # Capture the current date and write it to BuildDetails.plist
+    plutil -replace com-trio-build-date -string "$(date)" "${info_plist_path}"
+
+    # Retrieve the current branch
+    git_branch=$(git symbolic-ref --short -q HEAD)
+
+    # Attempt to retrieve the current tag
+    git_tag=$(git describe --tags --exact-match 2>/dev/null || echo "")
+
+    # Retrieve the current SHA of the latest commit
+    git_commit_sha=$(git log -1 --format="%h" --abbrev=7)
+
+    # Determine the branch or tag information
+    git_branch_or_tag="${git_branch:-${git_tag}}"
+
+    # Update BuildDetails.plist with the branch or tag information
+    plutil -replace com-trio-branch -string "${git_branch_or_tag}" "${info_plist_path}"
+
+    # Update BuildDetails.plist with the SHA information
+    plutil -replace com-trio-commit-sha -string "${git_commit_sha}" "${info_plist_path}"
+fi

open-iaps-oref/lib/autotune-prep/categorize.js → trio-oref/lib/autotune-prep/categorize.js


open-iaps-oref/lib/autotune-prep/dosed.js → trio-oref/lib/autotune-prep/dosed.js


open-iaps-oref/lib/autotune-prep/index.js → trio-oref/lib/autotune-prep/index.js


open-iaps-oref/lib/autotune/index.js → trio-oref/lib/autotune/index.js


open-iaps-oref/lib/basal-set-temp.js → trio-oref/lib/basal-set-temp.js


+ 0 - 0
open-iaps-oref/lib/bolus.js


Некоторые файлы не были показаны из-за большого количества измененных файлов