Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions Common/Models/StatusExtensionContext.swift
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,9 @@ struct StatusExtensionContext: RawRepresentable {
var lastLoopCompleted: Date?
var createdAt: Date?
var isClosedLoop: Bool?
var preMealPresetAllowed: Bool?
var preMealPresetActive: Bool?
var customPresetActive: Bool?
var netBasal: NetBasalContext?
var batteryPercentage: Double?
var reservoirCapacity: Double?
Expand Down Expand Up @@ -327,6 +330,9 @@ struct StatusExtensionContext: RawRepresentable {
lastLoopCompleted = rawValue["lastLoopCompleted"] as? Date
createdAt = rawValue["createdAt"] as? Date
isClosedLoop = rawValue["isClosedLoop"] as? Bool
preMealPresetAllowed = rawValue["preMealPresetAllowed"] as? Bool
preMealPresetActive = rawValue["preMealPresetActive"] as? Bool
customPresetActive = rawValue["customPresetActive"] as? Bool
batteryPercentage = rawValue["batteryPercentage"] as? Double
reservoirCapacity = rawValue["reservoirCapacity"] as? Double
carbsOnBoard = rawValue["carbsOnBoard"] as? Double
Expand Down Expand Up @@ -365,6 +371,9 @@ struct StatusExtensionContext: RawRepresentable {
raw["lastLoopCompleted"] = lastLoopCompleted
raw["createdAt"] = createdAt
raw["isClosedLoop"] = isClosedLoop
raw["preMealPresetAllowed"] = preMealPresetAllowed
raw["preMealPresetActive"] = preMealPresetActive
raw["customPresetActive"] = customPresetActive
raw["netBasal"] = netBasal?.rawValue
raw["batteryPercentage"] = batteryPercentage
raw["reservoirCapacity"] = reservoirCapacity
Expand Down
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 not shown.
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 not shown.
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 not shown.
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 not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>AppGroupIdentifier</key>
<string>$(APP_GROUP_IDENTIFIER)</string>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleDisplayName</key>
<string>SmallStatusWidget</string>
<string>Loop Widgets</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
Expand All @@ -27,7 +29,5 @@
</dict>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2022 LoopKit Authors. All rights reserved.</string>
<key>AppGroupIdentifier</key>
<string>$(APP_GROUP_IDENTIFIER)</string>
</dict>
</plist>
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/* Bundle display name */
"CFBundleDisplayName" = "SmallStatusWidget";
"CFBundleDisplayName" = "Loop Widgets";

/* Bundle name */
"CFBundleName" = "SmallStatusWidgetExtension";
"CFBundleName" = "LoopWidgetExtension";

/* Copyright (human-readable) */
"NSHumanReadableCopyright" = "Copyright © 2022 LoopKit Authors. All rights reserved.";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/* Bundle display name */
"CFBundleDisplayName" = "SmallStatusWidget";
"CFBundleDisplayName" = "Loop Widgets";

/* Bundle name */
"CFBundleName" = "SmallStatusWidgetExtension";
"CFBundleName" = "LoopWidgetExtension";

/* Copyright (human-readable) */
"NSHumanReadableCopyright" = "Copyright © 2022 LoopKit-Autoren. Alle Rechte vorbehalten.";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/* Bundle display name */
"CFBundleDisplayName" = "SmallStatusWidget";
"CFBundleDisplayName" = "Loop Widgets";

/* Bundle name */
"CFBundleName" = "SmallStatusWidgetExtension";
"CFBundleName" = "LoopWidgetExtension";

/* Copyright (human-readable) */
"NSHumanReadableCopyright" = "Copyright © 2022 Autores del LoopKit. Todos los derechos reservados.";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/* Bundle display name */
"CFBundleDisplayName" = "SmallStatusWidget";
"CFBundleDisplayName" = "Loop Widgets";

/* Bundle name */
"CFBundleName" = "SmallStatusWidgetExtension";
"CFBundleName" = "LoopWidgetExtension";

/* Copyright (human-readable) */
"NSHumanReadableCopyright" = "Copyright © 2022 LoopKit Authors. Tous droits réservés.";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/* Bundle display name */
"CFBundleDisplayName" = "SmallStatusWidget";
"CFBundleDisplayName" = "Loop Widgets";

/* Bundle name */
"CFBundleName" = "SmallStatusWidgetExtension";
"CFBundleName" = "LoopWidgetExtension";

/* Copyright (human-readable) */
"NSHumanReadableCopyright" = "Copyright © 2022 Autori di LoopKit. Tutti i diritti riservati.";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/* Bundle display name */
"CFBundleDisplayName" = "SmallStatusWidget";
"CFBundleDisplayName" = "Loop Widgets";

/* Bundle name */
"CFBundleName" = "SmallStatusWidgetExtension";
"CFBundleName" = "LoopWidgetExtension";

/* Copyright (human-readable) */
"NSHumanReadableCopyright" = "Copyright © 2022 LoopKit Authors. Alle rettigheter forbeholdt.";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/* Bundle display name */
"CFBundleDisplayName" = "SmallStatusWidget";
"CFBundleDisplayName" = "Loop Widgets";

/* Bundle name */
"CFBundleName" = "SmallStatusWidgetExtentension";
"CFBundleName" = "LoopWidgetExtension";

/* Copyright (human-readable) */
"NSHumanReadableCopyright" = "Copyright © 2022 LoopKit Auteurs. Alle rechten voorbehouden.";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/* Bundle display name */
"CFBundleDisplayName" = "SmallStatusWidget";
"CFBundleDisplayName" = "Loop Widgets";

/* Bundle name */
"CFBundleName" = "SmallStatusWidgetExtension";
"CFBundleName" = "LoopWidgetExtension";

/* Copyright (human-readable) */
"NSHumanReadableCopyright" = "Copyright © 2023 Autorzy LoopKit. Wszelkie prawa zastrzeżone.";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/* Bundle display name */
"CFBundleDisplayName" = "SmallStatusWidget";
"CFBundleDisplayName" = "Loop Widgets";

/* Bundle name */
"CFBundleName" = "SmallStatusWidgetExtension";
"CFBundleName" = "LoopWidgetExtension";

/* Copyright (human-readable) */
"NSHumanReadableCopyright" = "Copyright © 2022 Autori LoopKit. Toate drepturile rezervate.";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/* Bundle display name */
"CFBundleDisplayName" = "SmallStatusWidget";
"CFBundleDisplayName" = "Loop Widgets";

/* Bundle name */
"CFBundleName" = "SmallStatusWidgetExtension";
"CFBundleName" = "LoopWidgetExtension";

/* Copyright (human-readable) */
"NSHumanReadableCopyright" = "Copyright © 2022 LoopKit Authors. Все права защищены.";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/* Bundle display name */
"CFBundleDisplayName" = "SmallStatusWidget";
"CFBundleDisplayName" = "Loop Widgets";

/* Bundle name */
"CFBundleName" = "SmallStatusWidgetExtension";
"CFBundleName" = "LoopWidgetExtension";

/* Copyright (human-readable) */
"NSHumanReadableCopyright" = "Telif Hakkı © 2022 LoopKit Yazarları. Tüm hakları Saklıdır.";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import LoopCore

struct GlucoseView: View {

var entry: StatusWidgetEntry
var entry: StatusWidgetTimelimeEntry

var body: some View {
VStack(alignment: .center, spacing: 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import SwiftUI
import LoopCore

struct LoopCircleView: View {
var entry: StatusWidgetEntry
var entry: StatusWidgetTimelimeEntry

var body: some View {
let closeLoop = entry.closeLoop
Expand Down
50 changes: 50 additions & 0 deletions Loop Widget Extension/Components/PumpView.swift
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 Loop Widget Extension/Components/SystemActionLink.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
//
// SystemActionLink.swift
// Loop Widget Extension
//
// Created by Cameron Ingham on 6/26/23.
// Copyright © 2023 LoopKit Authors. All rights reserved.
//

import Foundation
import SwiftUI

struct SystemActionLink: View {
enum Destination: 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 destination: Destination
let active: Bool

init(to destination: Destination, active: Bool = false) {
self.destination = destination
self.active = active
}

private func foregroundColor(active: Bool) -> Color {
switch destination {
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 destination {
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 destination {
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: destination.deeplink) {
icon
.frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .center)
.foregroundColor(foregroundColor(active: active))
.background(
ContainerRelativeShape()
.fill(backgroundColor(active: active))
)
}
}
}
Loading