Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
93111d5
Open the app when the user taps on the widget
Dec 23, 2016
bdb02ab
Use MAIN_APP_BUNDLE_IDENTIFIER instead of hardcoding "Loop" as the UR…
Dec 23, 2016
82dc3da
Improve string concatenation style
Dec 23, 2016
67f0c3d
Merge pull request #334 from bharat/tap-opens-app
ps2 Dec 25, 2016
21ace16
Fix widget battery level for x22 pumps
wkcwells Dec 27, 2016
378b525
Fix broken build.
Dec 29, 2016
51b09c1
Merge pull request #346 from bharat/fix-build
ps2 Dec 30, 2016
2058195
Merge pull request #342 from wkcwells/fix-battery-in-widget
ps2 Dec 30, 2016
0b7afad
Merge pull request #340 from LoopKit/update-rl-frameworks
ps2 Dec 30, 2016
a3558d4
Refactor HUD views into LoopUI framework (#284) (#330)
Jan 1, 2017
d540cce
Monitor changes and update the widget in real time. (#335)
Jan 2, 2017
311ba44
Use a clear fill color for the circle. (#355)
Jan 2, 2017
9566eac
Refactor files with membership in multiple targets into a Common hier…
Jan 2, 2017
9d3cfad
Disable animation on first render, since we'd be animating from a (#354)
Jan 2, 2017
9d9890b
Enforce a fixed number of fractional digits per unit type. (#356)
Jan 5, 2017
7e221ee
Add an info.plist entry to widget info.plist to make tapping on widge…
wkcwells Jan 5, 2017
aac86be
Only allow one active glucose data source (#364)
Feb 11, 2017
f1e4342
Upgrade project to 0820 (#376)
Feb 13, 2017
c262b64
Merge complications changes back into dev (they were accidentally mer…
ps2 Feb 16, 2017
a0b425b
Merge branch 'master' into dev
ps2 Feb 16, 2017
bb7cb32
Merge branch 'master' into dev
ps2 Feb 16, 2017
1775f42
Tmecklem x22 enlite cgm (#378)
ps2 Feb 19, 2017
3ba50da
remove +ve momentum from bolus calculation (#372)
thebookins Feb 19, 2017
08591de
Minimum bg guard (#365)
ps2 Feb 20, 2017
841a366
Update LoopKit and Rileylink frameworks
ps2 Feb 20, 2017
3ae1077
Merge pull request #380 from LoopKit/update-frameworks
ps2 Feb 20, 2017
93da3d4
Bump version
ps2 Feb 20, 2017
59ce749
Merge pull request #381 from LoopKit/bump-version
ps2 Feb 20, 2017
27017e6
Show bg values in warning messages in bolus ui
ps2 Feb 24, 2017
cb394ca
Do not show last loop errors in bolus view; only recommendation alerts
ps2 Feb 24, 2017
2b6e739
Show last loop error on clicking loop status
ps2 Feb 24, 2017
32764bc
Use tap gesture recognizer instead of delegate
ps2 Feb 25, 2017
6ccc578
remove extraneous line
ps2 Feb 25, 2017
ef9f943
Add recovery text for configuration alerts, and single out minimum bg…
ps2 Feb 25, 2017
1a47658
Merge pull request #384 from LoopKit/last-loop-error
ps2 Feb 25, 2017
c92e780
Merge pull request #382 from LoopKit/bolus-ui-updates
ps2 Feb 25, 2017
d3e2a6f
update to new rl framework
ps2 Mar 2, 2017
e8b207e
Add mmol watchapp units support. Add modularLarge complication. Chang…
walker0 Mar 2, 2017
630bb96
Complications update (#389)
ps2 Mar 2, 2017
5ea6f8d
Last loop completed and battery level restored from userDefaults on a…
ps2 Mar 6, 2017
6a993c6
Merge pull request #391 from LoopKit/status-extension-refactor
ps2 Mar 6, 2017
f82acbe
Fixing truncated utilitarian small complication
ps2 Mar 6, 2017
514ce93
Merge pull request #392 from LoopKit/complications
ps2 Mar 6, 2017
5bd4f11
Refactoring charting code to remove unnecessary work and unnecessary …
ps2 Mar 6, 2017
05560b0
Update to rileylink frameworks v1.0
ps2 Mar 9, 2017
8bde18c
Remove development team ids
ps2 Mar 9, 2017
884819a
Merge pull request #393 from LoopKit/charts-refactor
ps2 Mar 10, 2017
49bbd40
Merge pull request #394 from LoopKit/rl-update
ps2 Mar 10, 2017
2297c54
MySentry off should report as non valid sensor info
ps2 Mar 12, 2017
3873fdc
Merge pull request #401 from LoopKit/sensorinfo
ps2 Mar 12, 2017
8988d22
prep version for release
ps2 Mar 13, 2017
e3efa6d
Merge pull request #402 from LoopKit/version-bump
ps2 Mar 13, 2017
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
Prev Previous commit
Next Next commit
Refactor HUD views into LoopUI framework (#284) (#330)
* Rough cut at moving HUD views into their own framework.

* Move view code into the HUDViewKit framework directory

* Remove HUDViewKit

* Add GlucoseTrend and NSTimeInterval directly to WatchApp Extension so that it doesn't have to pull in HUDViewKit

* Get all targets to compile with HUDViewKit

1. Make HKUnit extension internal and included it directly into all
   necessary targets to avoid a conflict with the same extension in
   LoopKit

2. Publicize any necessary HUDViewKit vars, funcs

3. Store the Int raw value for GlucoseTrend in WatchContext and create
   a computed property that returns it as a GlucoseTrend object to avoid
   the conflict where both Loop and WatchApp Extension have their own
   separate concept of GlucoseTrend.

* Rename HUDViewKit to LoopUI

* partway through moving layout

* WIP

* Resize stack view to fill container view

* Embed LoopUI framework

* Use NibLoadable for HUDView
  • Loading branch information
Bharat Mediratta authored and ps2 committed Jan 1, 2017
commit a3558d4a384fd7a654c3dd571bfde9402536876c
278 changes: 4 additions & 274 deletions Loop Status Extension/Base.lproj/MainInterface.storyboard

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions Loop Status Extension/StatusExtensionContext.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

import Foundation
import HealthKit
import LoopUI

struct ReservoirContext {
let startDate: Date
Expand Down
47 changes: 37 additions & 10 deletions Loop Status Extension/StatusViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,47 @@
// Copyright © 2016 LoopKit Authors. All rights reserved.
//

import UIKit
import NotificationCenter
import HealthKit
import CoreData
import HealthKit
import LoopUI
import NotificationCenter
import UIKit

class StatusViewController: UIViewController, NCWidgetProviding {

@IBOutlet weak var loopCompletionHUD: LoopCompletionHUDView!
@IBOutlet weak var glucoseHUD: GlucoseHUDView!
@IBOutlet weak var basalRateHUD: BasalRateHUDView!
@IBOutlet weak var reservoirVolumeHUD: ReservoirVolumeHUDView!
@IBOutlet weak var batteryHUD: BatteryLevelHUDView!

@IBOutlet weak var hudView: HUDView!
@IBOutlet weak var subtitleLabel: UILabel!


var loopCompletionHUD: LoopCompletionHUDView! {
get {
return hudView.loopCompletionHUD
}
}

var glucoseHUD: GlucoseHUDView! {
get {
return hudView.glucoseHUD
}
}

var basalRateHUD: BasalRateHUDView! {
get {
return hudView.basalRateHUD
}
}

var reservoirVolumeHUD: ReservoirVolumeHUDView! {
get {
return hudView.reservoirVolumeHUD
}
}

var batteryHUD: BatteryLevelHUDView! {
get {
return hudView.batteryHUD
}
}

override func viewDidLoad() {
super.viewDidLoad()
subtitleLabel.alpha = 0
Expand Down
340 changes: 262 additions & 78 deletions Loop.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

345 changes: 67 additions & 278 deletions Loop/Base.lproj/Main.storyboard

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions Loop/Managers/DeviceDataManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import GlucoseKit
import HealthKit
import InsulinKit
import LoopKit
import LoopUI
import MinimedKit
import NightscoutUploadKit
import RileyLinkKit
Expand Down
2 changes: 1 addition & 1 deletion Loop/Managers/WatchDataManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ final class WatchDataManager: NSObject, WCSessionDelegate {
context.maxBolus = maxBolus

if let trend = self.deviceDataManager.sensorInfo?.trendType {
context.glucoseTrend = trend
context.glucoseTrendRawValue = trend.rawValue
}

completionHandler(context)
Expand Down
9 changes: 5 additions & 4 deletions Loop/Models/Glucose.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,16 @@
//

import Foundation
import LoopUI
import xDripG5


extension Glucose: SensorDisplayable {
var isStateValid: Bool {
public var isStateValid: Bool {
return state == .ok && status == .ok
}

var stateDescription: String {
public var stateDescription: String {
let status: String
switch self.status {
case .ok:
Expand All @@ -29,7 +30,7 @@ extension Glucose: SensorDisplayable {
return String(format: "%1$@ %2$@", String(describing: state), status)
}

var trendType: GlucoseTrend? {
public var trendType: GlucoseTrend? {
guard trend < Int(Int8.max) else {
return nil
}
Expand All @@ -52,7 +53,7 @@ extension Glucose: SensorDisplayable {
}
}

var isLocal: Bool {
public var isLocal: Bool {
return true
}
}
9 changes: 5 additions & 4 deletions Loop/Models/GlucoseG4.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import Foundation
import G4ShareSpy
import HealthKit
import LoopKit
import LoopUI


extension GlucoseG4: GlucoseValue {
Expand All @@ -24,23 +25,23 @@ extension GlucoseG4: GlucoseValue {


extension GlucoseG4: SensorDisplayable {
var isStateValid: Bool {
public var isStateValid: Bool {
return glucose >= 20
}

var stateDescription: String {
public var stateDescription: String {
if isStateValid {
return NSLocalizedString("OK", comment: "Sensor state description for the valid state")
} else {
return NSLocalizedString("Needs Attention", comment: "Sensor state description for the non-valid state")
}
}

var trendType: GlucoseTrend? {
public var trendType: GlucoseTrend? {
return GlucoseTrend(rawValue: Int(trend))
}

var isLocal: Bool {
public var isLocal: Bool {
return true
}
}
7 changes: 4 additions & 3 deletions Loop/Models/MySentryPumpStatusMessageBody.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@
//

import LoopKit
import LoopUI
import MinimedKit


extension MySentryPumpStatusMessageBody: SensorDisplayable {
var isStateValid: Bool {
public var isStateValid: Bool {
switch glucose {
case .active, .off:
return true
Expand All @@ -20,7 +21,7 @@ extension MySentryPumpStatusMessageBody: SensorDisplayable {
}
}

var trendType: GlucoseTrend? {
public var trendType: LoopUI.GlucoseTrend? {
guard case .active = glucose else {
return nil
}
Expand All @@ -39,7 +40,7 @@ extension MySentryPumpStatusMessageBody: SensorDisplayable {
}
}

var isLocal: Bool {
public var isLocal: Bool {
return true
}

Expand Down
17 changes: 14 additions & 3 deletions Loop/Models/ShareGlucose+GlucoseKit.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import Foundation
import HealthKit
import LoopKit
import LoopUI
import ShareClient


Expand All @@ -24,15 +25,25 @@ extension ShareGlucose: GlucoseValue {


extension ShareGlucose: SensorDisplayable {
var isStateValid: Bool {
public var isStateValid: Bool {
return glucose >= 20
}

var trendType: GlucoseTrend? {
public var trendType: GlucoseTrend? {
return GlucoseTrend(rawValue: Int(trend))
}

var isLocal: Bool {
public var isLocal: Bool {
return false
}
}

extension SensorDisplayable {
public var stateDescription: String {
if isStateValid {
return NSLocalizedString("OK", comment: "Sensor state description for the valid state")
} else {
return NSLocalizedString("Needs Attention", comment: "Sensor state description for the non-valid state")
}
}
}
41 changes: 32 additions & 9 deletions Loop/View Controllers/StatusTableViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import GlucoseKit
import HealthKit
import InsulinKit
import LoopKit
import LoopUI
import SwiftCharts


Expand Down Expand Up @@ -759,18 +760,28 @@ final class StatusTableViewController: UITableViewController, UIGestureRecognize

// MARK: - HUDs

@IBOutlet weak var loopCompletionHUD: LoopCompletionHUDView!

@IBOutlet weak var glucoseHUD: GlucoseHUDView! {
@IBOutlet weak var hudView: HUDView! {
didSet {
let tapGestureRecognizer = UITapGestureRecognizer(target: self, action: #selector(openCGMApp(_:)))
glucoseHUD.addGestureRecognizer(tapGestureRecognizer)

if cgmAppURL != nil {
glucoseHUD.accessibilityHint = NSLocalizedString("Launches CGM app", comment: "Glucose HUD accessibility hint")
}
}
}

var loopCompletionHUD: LoopCompletionHUDView! {
get {
return hudView.loopCompletionHUD
}
}

var glucoseHUD: GlucoseHUDView! {
get {
return hudView.glucoseHUD
}
}

private var cgmAppURL: URL? {
if let url = URL(string: "dexcomcgm://"), UIApplication.shared.canOpenURL(url) {
Expand All @@ -788,9 +799,21 @@ final class StatusTableViewController: UITableViewController, UIGestureRecognize
}
}

@IBOutlet weak var basalRateHUD: BasalRateHUDView!

@IBOutlet weak var reservoirVolumeHUD: ReservoirVolumeHUDView!

@IBOutlet weak var batteryLevelHUD: BatteryLevelHUDView!
var basalRateHUD: BasalRateHUDView! {
get {
return hudView.basalRateHUD
}
}

var reservoirVolumeHUD: ReservoirVolumeHUDView! {
get {
return hudView.reservoirVolumeHUD
}
}

var batteryLevelHUD: BatteryLevelHUDView! {
get {
return hudView.batteryHUD
}
}
}
14 changes: 9 additions & 5 deletions Loop/Views/ButtonTableViewCell.xib
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="10117" systemVersion="15F34" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES">
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="11542" systemVersion="16B2657" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="10085"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11524"/>
<capability name="Constraints to layout margins" minToolsVersion="6.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
Expand All @@ -12,11 +16,11 @@
<rect key="frame" x="0.0" y="0.0" width="427" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="QMd-B1-jne" id="T9r-tL-wAO">
<rect key="frame" x="0.0" y="0.0" width="427" height="43.5"/>
<rect key="frame" x="0.0" y="0.0" width="427" height="43"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="oI5-48-SHZ">
<rect key="frame" x="181.5" y="8" width="64" height="27"/>
<rect key="frame" x="182" y="8" width="64" height="27"/>
<constraints>
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="64" id="hrG-HQ-FHS"/>
</constraints>
Expand Down
6 changes: 6 additions & 0 deletions LoopUI/Assets.xcassets/reservoir/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import HealthKit
// Code in this extension is duplicated from:
// https://github.com/LoopKit/LoopKit/blob/master/LoopKit/HKUnit.swift
// to avoid pulling in the LoopKit extension since it's not extension-API safe.
public extension HKUnit {
extension HKUnit {
// A formatting helper for determining the preferred decimal style for a given unit
var preferredMinimumFractionDigits: Int {
if self.unitString == "mg/dL" {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import HealthKit


extension NumberFormatter {
static func glucoseFormatter(for unit: HKUnit) -> NumberFormatter {
public static func glucoseFormatter(for unit: HKUnit) -> NumberFormatter {
let numberFormatter = NumberFormatter()
numberFormatter.numberStyle = .decimal
numberFormatter.minimumFractionDigits = unit.preferredMinimumFractionDigits
Expand Down
26 changes: 13 additions & 13 deletions Loop/Extensions/UIColor.swift → LoopUI/Extensions/UIColor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,31 +10,31 @@ import UIKit


extension UIColor {
@nonobjc static var tintColor: UIColor? = nil
@nonobjc public static var tintColor: UIColor? = nil

@nonobjc static let secondaryLabelColor = UIColor.HIGGrayColor()
@nonobjc public static let secondaryLabelColor = UIColor.HIGGrayColor()

@nonobjc static let cellBackgroundColor = UIColor(white: 239 / 255, alpha: 1)
@nonobjc public static let cellBackgroundColor = UIColor(white: 239 / 255, alpha: 1)

@nonobjc static let gridColor = UIColor(white: 193 / 255, alpha: 1)
@nonobjc public static let gridColor = UIColor(white: 193 / 255, alpha: 1)

@nonobjc static let glucoseTintColor = UIColor(red: 0 / 255, green: 176 / 255, blue: 255 / 255, alpha: 1)
@nonobjc public static let glucoseTintColor = UIColor(red: 0 / 255, green: 176 / 255, blue: 255 / 255, alpha: 1)

@nonobjc static let IOBTintColor = UIColor.HIGOrangeColor()
@nonobjc public static let IOBTintColor = UIColor.HIGOrangeColor()

@nonobjc static let COBTintColor = UIColor(red: 99 / 255, green: 218 / 255, blue: 56 / 255, alpha: 1)
@nonobjc public static let COBTintColor = UIColor(red: 99 / 255, green: 218 / 255, blue: 56 / 255, alpha: 1)

@nonobjc static let doseTintColor = UIColor.HIGOrangeColor()
@nonobjc public static let doseTintColor = UIColor.HIGOrangeColor()

@nonobjc static let freshColor = UIColor.HIGGreenColor()
@nonobjc public static let freshColor = UIColor.HIGGreenColor()

@nonobjc static let agingColor = UIColor.HIGYellowColor()
@nonobjc public static let agingColor = UIColor.HIGYellowColor()

@nonobjc static let staleColor = UIColor.HIGRedColor()
@nonobjc public static let staleColor = UIColor.HIGRedColor()

@nonobjc static let unknownColor = UIColor(red: 198 / 255, green: 199 / 255, blue: 201 / 255, alpha: 1)
@nonobjc public static let unknownColor = UIColor(red: 198 / 255, green: 199 / 255, blue: 201 / 255, alpha: 1)

@nonobjc static let deleteColor = UIColor.HIGRedColor()
@nonobjc public static let deleteColor = UIColor.HIGRedColor()

// MARK: - HIG colors
// See: https://developer.apple.com/ios/human-interface-guidelines/visual-design/color/
Expand Down
Loading