From e4a843f883e32322549c0197711387196601546a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Sn=C3=A4llfot?= Date: Fri, 20 Oct 2023 20:43:22 +0200 Subject: [PATCH] add 15min trend to calendar/apple watch --- LoopFollow.xcodeproj/project.pbxproj | 6 +++--- LoopFollow/ViewControllers/MainViewController.swift | 9 +++++++++ .../ViewControllers/WatchSettingsViewController.swift | 3 +++ 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/LoopFollow.xcodeproj/project.pbxproj b/LoopFollow.xcodeproj/project.pbxproj index f8a8fa75..545d329a 100644 --- a/LoopFollow.xcodeproj/project.pbxproj +++ b/LoopFollow.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 51; + objectVersion = 54; objects = { /* Begin PBXBuildFile section */ @@ -1054,7 +1054,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_ENTITLEMENTS = "LoopFollow/Loop Follow.entitlements"; CODE_SIGN_STYLE = Automatic; - DEVELOPMENT_TEAM = "$(LF_DEVELOPMENT_TEAM)"; + DEVELOPMENT_TEAM = RMSRR5SURS; INFOPLIST_FILE = LoopFollow/Info.plist; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", @@ -1076,7 +1076,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_ENTITLEMENTS = "LoopFollow/Loop Follow.entitlements"; CODE_SIGN_STYLE = Automatic; - DEVELOPMENT_TEAM = "$(LF_DEVELOPMENT_TEAM)"; + DEVELOPMENT_TEAM = RMSRR5SURS; INFOPLIST_FILE = LoopFollow/Info.plist; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", diff --git a/LoopFollow/ViewControllers/MainViewController.swift b/LoopFollow/ViewControllers/MainViewController.swift index 83f0ea7f..a1f2e5f5 100644 --- a/LoopFollow/ViewControllers/MainViewController.swift +++ b/LoopFollow/ViewControllers/MainViewController.swift @@ -711,6 +711,14 @@ class MainViewController: UIViewController, UITableViewDataSource, ChartViewDele minAgo = String(Int(deltaTime)) + " min" eventEndDate = eventStartDate.addingTimeInterval((60 * 10) + (deltaTime * 60)) } + let lastSGV = Double(self.bgData[self.bgData.count - 1].sgv) // Convert the last SGV to a Double + let deltaBGValue = Double(deltaBG) // Convert deltaBG to a Double + + let fifteenMin = (lastSGV + deltaBGValue * 3) * 0.0555 + let fifteenMinString = String(format: "%.1f", fifteenMin) // Convert to string with one decimal place + // Use the calculated 'fifteenMinString' as needed + + var cob = "0" if self.latestCOB != "" { cob = self.latestCOB @@ -724,6 +732,7 @@ class MainViewController: UIViewController, UITableViewDataSource, ChartViewDele iob = self.latestIOB } eventTitle = eventTitle.replacingOccurrences(of: "%MINAGO%", with: minAgo) + eventTitle = eventTitle.replacingOccurrences(of: "%15MIN%", with: " ➡️" + fifteenMinString) eventTitle = eventTitle.replacingOccurrences(of: "%IOB%", with: iob) eventTitle = eventTitle.replacingOccurrences(of: "%COB%", with: cob) eventTitle = eventTitle.replacingOccurrences(of: "%BASAL%", with: basal + "E/h") diff --git a/LoopFollow/ViewControllers/WatchSettingsViewController.swift b/LoopFollow/ViewControllers/WatchSettingsViewController.swift index 2c72e3f3..03779ead 100644 --- a/LoopFollow/ViewControllers/WatchSettingsViewController.swift +++ b/LoopFollow/ViewControllers/WatchSettingsViewController.swift @@ -157,6 +157,9 @@ class WatchSettingsViewController: FormViewController { <<< LabelRow("MINAGO"){ row in row.title = "%MINAGO% : Only displays for old readings" } + <<< LabelRow("15MIN"){ row in + row.title = "%15MIN% : Display 15min trend" + } +++ ButtonRow() {