forked from LoopKit/Loop
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
71 changed files
with
705 additions
and
245 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
16 changes: 16 additions & 0 deletions
16
Loop Widget Extension/Bootstrap/Assets.xcassets/bolus.imageset/Contents.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"filename" : "bolus.pdf", | ||
"idiom" : "universal" | ||
} | ||
], | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
}, | ||
"properties" : { | ||
"preserves-vector-representation" : true, | ||
"template-rendering-intent" : "template" | ||
} | ||
} |
Binary file added
BIN
+3.85 KB
Loop Widget Extension/Bootstrap/Assets.xcassets/bolus.imageset/bolus.pdf
Binary file not shown.
16 changes: 16 additions & 0 deletions
16
Loop Widget Extension/Bootstrap/Assets.xcassets/carbs.imageset/Contents.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"filename" : "Meal.pdf", | ||
"idiom" : "universal" | ||
} | ||
], | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
}, | ||
"properties" : { | ||
"preserves-vector-representation" : true, | ||
"template-rendering-intent" : "template" | ||
} | ||
} |
Binary file added
BIN
+4.42 KB
Loop Widget Extension/Bootstrap/Assets.xcassets/carbs.imageset/Meal.pdf
Binary file not shown.
File renamed without changes.
File renamed without changes.
File renamed without changes.
16 changes: 16 additions & 0 deletions
16
Loop Widget Extension/Bootstrap/Assets.xcassets/premeal.imageset/Contents.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"filename" : "Pre-Meal.pdf", | ||
"idiom" : "universal" | ||
} | ||
], | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
}, | ||
"properties" : { | ||
"preserves-vector-representation" : true, | ||
"template-rendering-intent" : "template" | ||
} | ||
} |
Binary file added
BIN
+4.4 KB
Loop Widget Extension/Bootstrap/Assets.xcassets/premeal.imageset/Pre-Meal.pdf
Binary file not shown.
File renamed without changes.
16 changes: 16 additions & 0 deletions
16
Loop Widget Extension/Bootstrap/Assets.xcassets/workout.imageset/Contents.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"filename" : "workout.pdf", | ||
"idiom" : "universal" | ||
} | ||
], | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
}, | ||
"properties" : { | ||
"preserves-vector-representation" : true, | ||
"template-rendering-intent" : "template" | ||
} | ||
} |
Binary file added
BIN
+4.87 KB
Loop Widget Extension/Bootstrap/Assets.xcassets/workout.imageset/workout.pdf
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions
4
StatusWidget/da.lproj/InfoPlist.strings → ...sion/Bootstrap/da.lproj/InfoPlist.strings
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
4 changes: 2 additions & 2 deletions
4
StatusWidget/de.lproj/InfoPlist.strings → ...sion/Bootstrap/de.lproj/InfoPlist.strings
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
4 changes: 2 additions & 2 deletions
4
StatusWidget/es.lproj/InfoPlist.strings → ...sion/Bootstrap/es.lproj/InfoPlist.strings
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions
4
StatusWidget/fr.lproj/InfoPlist.strings → ...sion/Bootstrap/fr.lproj/InfoPlist.strings
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions
4
StatusWidget/it.lproj/InfoPlist.strings → ...sion/Bootstrap/it.lproj/InfoPlist.strings
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions
4
StatusWidget/nb.lproj/InfoPlist.strings → ...sion/Bootstrap/nb.lproj/InfoPlist.strings
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
4 changes: 2 additions & 2 deletions
4
StatusWidget/nl.lproj/InfoPlist.strings → ...sion/Bootstrap/nl.lproj/InfoPlist.strings
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
4 changes: 2 additions & 2 deletions
4
StatusWidget/pl.lproj/InfoPlist.strings → ...sion/Bootstrap/pl.lproj/InfoPlist.strings
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions
4
StatusWidget/ro.lproj/InfoPlist.strings → ...sion/Bootstrap/ro.lproj/InfoPlist.strings
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
4 changes: 2 additions & 2 deletions
4
StatusWidget/ru.lproj/InfoPlist.strings → ...sion/Bootstrap/ru.lproj/InfoPlist.strings
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions
4
StatusWidget/tr.lproj/InfoPlist.strings → ...sion/Bootstrap/tr.lproj/InfoPlist.strings
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
// | ||
// PumpView.swift | ||
// Loop Widget Extension | ||
// | ||
// Created by Cameron Ingham on 6/26/23. | ||
// Copyright © 2023 LoopKit Authors. All rights reserved. | ||
// | ||
|
||
import SwiftUI | ||
|
||
struct PumpView: View { | ||
|
||
var entry: StatusWidgetTimelineProvider.Entry | ||
|
||
var body: some View { | ||
HStack(alignment: .center) { | ||
if let pumpHighlight = entry.pumpHighlight { | ||
HStack { | ||
Image(systemName: pumpHighlight.imageName) | ||
.foregroundColor(pumpHighlight.state == .critical ? .critical : .warning) | ||
Text(pumpHighlight.localizedMessage) | ||
.fontWeight(.heavy) | ||
} | ||
} | ||
else if let netBasal = entry.netBasal { | ||
BasalView(netBasal: netBasal, isOld: entry.contextIsStale) | ||
|
||
if let eventualGlucose = entry.eventualGlucose { | ||
let glucoseFormatter = NumberFormatter.glucoseFormatter(for: eventualGlucose.unit) | ||
if let glucoseString = glucoseFormatter.string(from: eventualGlucose.quantity.doubleValue(for: eventualGlucose.unit)) { | ||
VStack { | ||
Text("Eventual") | ||
.font(.footnote) | ||
.foregroundColor(entry.contextIsStale ? Color(UIColor.systemGray3) : Color(UIColor.secondaryLabel)) | ||
|
||
Text("\(glucoseString)") | ||
.font(.subheadline) | ||
.fontWeight(.heavy) | ||
|
||
Text(eventualGlucose.unit.shortLocalizedUnitString()) | ||
.font(.footnote) | ||
.foregroundColor(entry.contextIsStale ? Color(UIColor.systemGray3) : Color(UIColor.secondaryLabel)) | ||
} | ||
} | ||
} | ||
} | ||
|
||
} | ||
} | ||
} |
82 changes: 82 additions & 0 deletions
82
Loop Widget Extension/Components/SystemStatusActionView.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
// | ||
// SystemStatusActionView.swift | ||
// Loop Widget Extension | ||
// | ||
// Created by Cameron Ingham on 6/26/23. | ||
// Copyright © 2023 LoopKit Authors. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
import SwiftUI | ||
|
||
struct SystemStatusActionView: View { | ||
enum ActionType: String, CaseIterable { | ||
case carbEntry = "carb-entry" | ||
case bolus = "manual-bolus" | ||
case preMeal = "pre-meal-preset" | ||
case customPreset = "custom-presets" | ||
|
||
var deeplink: URL { | ||
URL(string: "loop://\(rawValue)")! | ||
} | ||
} | ||
|
||
let actionType: ActionType | ||
let active: Bool | ||
|
||
init(for actionType: ActionType, active: Bool = false) { | ||
self.actionType = actionType | ||
self.active = active | ||
} | ||
|
||
private func foregroundColor(active: Bool) -> Color { | ||
switch actionType { | ||
case .carbEntry: | ||
return Color("fresh") | ||
case .bolus: | ||
return Color("insulin") | ||
case .preMeal: | ||
return active ? .white : Color("fresh") | ||
case .customPreset: | ||
return active ? .white : Color("glucose") | ||
} | ||
} | ||
|
||
private func backgroundColor(active: Bool) -> Color { | ||
switch actionType { | ||
case .carbEntry: | ||
return active ? Color("fresh") : Color("WidgetSecondaryBackground") | ||
case .bolus: | ||
return active ? Color("insulin") : Color("WidgetSecondaryBackground") | ||
case .preMeal: | ||
return active ? Color("fresh") : Color("WidgetSecondaryBackground") | ||
case .customPreset: | ||
return active ? Color("glucose") : Color("WidgetSecondaryBackground") | ||
} | ||
} | ||
|
||
private var icon: Image { | ||
switch actionType { | ||
case .carbEntry: | ||
return Image("carbs") | ||
case .bolus: | ||
return Image("bolus") | ||
case .preMeal: | ||
return Image("premeal") | ||
case .customPreset: | ||
return Image("workout") | ||
} | ||
} | ||
|
||
var body: some View { | ||
Link(destination: actionType.deeplink) { | ||
icon | ||
.frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .center) | ||
.foregroundColor(foregroundColor(active: active)) | ||
.background( | ||
ContainerRelativeShape() | ||
.fill(backgroundColor(active: active)) | ||
) | ||
} | ||
} | ||
} |
Oops, something went wrong.