Skip to content

Commit

Permalink
add 15min trend to calendar/apple watch
Browse files Browse the repository at this point in the history
  • Loading branch information
dsnallfot committed Oct 20, 2023
1 parent f44f102 commit e4a843f
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
6 changes: 3 additions & 3 deletions LoopFollow.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
archiveVersion = 1;
classes = {
};
objectVersion = 51;
objectVersion = 54;
objects = {

/* Begin PBXBuildFile section */
Expand Down Expand Up @@ -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)",
Expand All @@ -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)",
Expand Down
9 changes: 9 additions & 0 deletions LoopFollow/ViewControllers/MainViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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")
Expand Down
3 changes: 3 additions & 0 deletions LoopFollow/ViewControllers/WatchSettingsViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down

0 comments on commit e4a843f

Please sign in to comment.