Skip to content
Merged
Show file tree
Hide file tree
Changes from 77 commits
Commits
Show all changes
78 commits
Select commit Hold shift + click to select a range
e02991b
Allow setting of PumpManagerSetupViewController pump settings
ps2 Sep 26, 2018
a2bb268
Add suspend/resume
ps2 Sep 28, 2018
f2c0646
Add pump manager delegate callback for suspend/resume updates
ps2 Sep 28, 2018
a56b274
Bundle battery, suspend, and bolusing status into PumpManagerStatus o…
ps2 Oct 11, 2018
d362c1e
Custom HUD views from PumpManager
ps2 Oct 18, 2018
58ac68f
Naming updates
ps2 Oct 22, 2018
b0da51e
Allow LevelHUDView to be subclassed
ps2 Oct 22, 2018
247d7e5
Move state colors to BaseHUDView
ps2 Oct 23, 2018
ae2ddd8
LoadingTableViewCell
ps2 Oct 24, 2018
ea6b354
HUDProvider protocol
ps2 Oct 26, 2018
0d0d1e1
Merge in swift 4.2 updates from dev
ps2 Oct 29, 2018
8fe99cc
Return DoseEntry for requested bolus, including duration
ps2 Nov 4, 2018
ba503b1
Add method to round delivery units to nearest supported volume
ps2 Nov 11, 2018
200b1d8
Multiple observers of status, and suspend-resume cell
ps2 Nov 19, 2018
baa1cd6
Fix inadvertent edit
ps2 Nov 19, 2018
7d77370
Extend UIAlertController instead of defining new class for error alerts
ps2 Nov 19, 2018
5a02a7e
Expose LoopKit error UI for reuse
ps2 Nov 26, 2018
9b94e15
Method for removing hud views, and fix return type of suspend/resume
ps2 Dec 2, 2018
1908cdc
Fix fast transitions leaving checkbox visible when it shouldn't be
ps2 Dec 4, 2018
3fe4366
Decrease section header size when setup screens don't fit vertically
ps2 Dec 4, 2018
b478ff4
Remove debug print
ps2 Dec 4, 2018
0eb9a89
Expose setupNavigationController
ps2 Dec 5, 2018
0f96af0
Pairing progress updates
ps2 Dec 9, 2018
46976f2
WIP mock managers
mpangburn Nov 21, 2018
c5da300
Mock manager cleanup
mpangburn Dec 17, 2018
65654f4
Mock managers
mpangburn Nov 21, 2018
1f3e754
Merge branch 'mock-managers' of https://github.com/tidepool-org/LoopK…
mpangburn Dec 18, 2018
a9afa27
Refactor mock managers into separate frameworks
mpangburn Dec 21, 2018
e79f081
Mark MockKit and MockKitUI as shared
mpangburn Dec 27, 2018
9d243e9
Dynamic plugin support
mpangburn Jan 2, 2019
c22bc4e
Naming updates, move WeakObserverSetIterator into LoopKit, support pu…
ps2 Jan 11, 2019
706bbd6
Merge branch 'pumpmanager-updates' into dynamic-plugins
mpangburn Jan 14, 2019
20eb964
Pump manager updates
mpangburn Jan 14, 2019
84f5f1f
Remove store access from manager protocols
mpangburn Jan 15, 2019
21ddf88
Removal of dynamic plugins keys for separate PR
mpangburn Jan 15, 2019
1b5e17f
Dynamic plugins support for MockKit
mpangburn Jan 15, 2019
396cee9
Merge branch 'dev' into pumpmanager-updates
ps2 Jan 18, 2019
6b252c0
Revert compactMode for SetupTableViewController
ps2 Jan 18, 2019
fb3e4b6
Merge branch 'pumpmanager-updates' of github.com:LoopKit/LoopKit into…
ps2 Jan 18, 2019
571a170
Update naming, unify UIAlertController helpers
ps2 Jan 22, 2019
69a6c41
Merge branch 'dev' into pumpmanager-updates
ps2 Jan 28, 2019
c4fbbc8
loading -> indeterminantProgress, transition fixes
ps2 Jan 28, 2019
e0c7a36
Present all third party view controllers modally
ps2 Jan 29, 2019
77774ca
Add protocols for handling CGMManager and PumpManager settings comple…
ps2 Jan 29, 2019
b09e74b
Update CompletionDelegate method signature
ps2 Jan 29, 2019
cc38f54
remove SuspendResumeTableViewCellDelegate
ps2 Jan 29, 2019
faf381f
Include dose in enactBolus completion
ps2 Feb 5, 2019
59e1db1
Show setup view controller modally, and make HUD view set static
ps2 Feb 7, 2019
a1e8a88
Update documentation
ps2 Feb 11, 2019
902190d
Remove unnecessary get
ps2 Feb 13, 2019
006336a
Move WeakObserverSetIterator declaration inside WeakObserverSet
ps2 Feb 14, 2019
c000f83
Make shownAction a computed property
ps2 Feb 14, 2019
7265607
Use existing level var instead of introducing new reservoirLevel var
ps2 Feb 14, 2019
d3c2ac9
Add debug bounds checking to value, and clear references to views whe…
ps2 Feb 14, 2019
4aeea11
Small cleanups
ps2 Feb 14, 2019
0b1e509
Inherit generic parameter from WeakObserverSet
ps2 Feb 14, 2019
8a729ae
WeakObserverSet -> WeakSet
ps2 Feb 14, 2019
d1ceb09
Add hudWillDisappear method to HUDProvider
ps2 Feb 15, 2019
4136d52
Use active flag instead of appear/disapper methods
ps2 Feb 15, 2019
4126ab9
Merge in pumpmanager-changes
ps2 Feb 15, 2019
69b9b61
Merge in pumpmanager-updates
ps2 Feb 15, 2019
f0c7f78
Allow out of bounds values for level, but bound internally
ps2 Feb 16, 2019
572269a
HUDProvider active -> visible
ps2 Feb 16, 2019
989795c
Merge branch 'pumpmanager-updates' of github.com:LoopKit/LoopKit into…
ps2 Feb 16, 2019
ccba623
Merge remote-tracking branch 'origin/pumpmanager-updates' into mock-m…
ps2 Feb 16, 2019
c73cd5a
HUDProvider active -> visible
ps2 Feb 16, 2019
67bd1d7
Merge pull request #2 from tidepool-org/mock-managers-pm-merge
mpangburn Feb 16, 2019
2d9de36
Merge in dev
ps2 Feb 21, 2019
65bc26a
Mock managers
mpangburn Mar 5, 2019
11f7f1b
Merge branch 'mock-managers' of https://github.com/tidepool-org/LoopK…
mpangburn Mar 5, 2019
5563a56
Move MockHUDProvider to separate file
mpangburn Mar 5, 2019
bc4873f
Unique data identifiers for mock pump events
mpangburn Mar 5, 2019
20e37a4
Remove MockKitUITests target
mpangburn Mar 5, 2019
85e6e80
Introduce LoopTestingKit
mpangburn Mar 5, 2019
7d4cfc3
Enforce data point frequency
mpangburn Mar 5, 2019
0eef72a
Merge branch 'tidepool-dev' into mock-managers
mpangburn Mar 6, 2019
98b7ca5
Basal picker support
mpangburn Mar 6, 2019
0565e7d
Updates from Pete's review
mpangburn Mar 12, 2019
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
File renamed without changes.
12 changes: 7 additions & 5 deletions Extensions/Comparable.swift
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
//
// Comparable.swift
// LoopKit Example
// LoopKit
//
// Created by Pete Schwamb on 2/17/19.
// Copyright © 2019 LoopKit Authors. All rights reserved.
// Created by Michael Pangburn on 11/20/18.
// Copyright © 2018 LoopKit Authors. All rights reserved.
//

import Foundation

extension Comparable {
func clamped(to range: ClosedRange<Self>) -> Self {
if self < range.lowerBound {
Expand All @@ -18,4 +16,8 @@ extension Comparable {
return self
}
}

mutating func clamp(to range: ClosedRange<Self>) {
self = clamped(to: range)
}
}
22 changes: 22 additions & 0 deletions Extensions/UIColor.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
//
// UIColor.swift
// LoopKitUI
//
// Copyright © 2018 LoopKit Authors. All rights reserved.
//

import UIKit


extension UIColor {
static let delete = UIColor.higRed()
}


// MARK: - HIG colors
// See: https://developer.apple.com/ios/human-interface-guidelines/visual-design/color/
extension UIColor {
private static func higRed() -> UIColor {
return UIColor(red: 1, green: 59 / 255, blue: 48 / 255, alpha: 1)
}
}
931 changes: 904 additions & 27 deletions LoopKit.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

10 changes: 10 additions & 0 deletions LoopKit.xcodeproj/xcshareddata/xcschemes/LoopKit Example.xcscheme
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,16 @@
ReferencedContainer = "container:LoopKit.xcodeproj">
</BuildableReference>
</TestableReference>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "892A5D3B222F03CB008961AB"
BuildableName = "LoopTestingKitTests.xctest"
BlueprintName = "LoopTestingKitTests"
ReferencedContainer = "container:LoopKit.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
<MacroExpansion>
<BuildableReference
Expand Down
99 changes: 99 additions & 0 deletions LoopKit.xcodeproj/xcshareddata/xcschemes/MockKit.xcscheme
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1000"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "89D2047121CC7BD7001238CC"
BuildableName = "MockKit.framework"
BlueprintName = "MockKit"
ReferencedContainer = "container:LoopKit.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "89D2047921CC7BD8001238CC"
BuildableName = "MockKitTests.xctest"
BlueprintName = "MockKitTests"
ReferencedContainer = "container:LoopKit.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "89D2047121CC7BD7001238CC"
BuildableName = "MockKit.framework"
BlueprintName = "MockKit"
ReferencedContainer = "container:LoopKit.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "89D2047121CC7BD7001238CC"
BuildableName = "MockKit.framework"
BlueprintName = "MockKit"
ReferencedContainer = "container:LoopKit.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "89D2047121CC7BD7001238CC"
BuildableName = "MockKit.framework"
BlueprintName = "MockKit"
ReferencedContainer = "container:LoopKit.xcodeproj">
</BuildableReference>
</MacroExpansion>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
99 changes: 99 additions & 0 deletions LoopKit.xcodeproj/xcshareddata/xcschemes/MockKitUI.xcscheme
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1000"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "89D2048E21CC7C12001238CC"
BuildableName = "MockKitUI.framework"
BlueprintName = "MockKitUI"
ReferencedContainer = "container:LoopKit.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "89D2049621CC7C13001238CC"
BuildableName = "MockKitUITests.xctest"
BlueprintName = "MockKitUITests"
ReferencedContainer = "container:LoopKit.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "89D2048E21CC7C12001238CC"
BuildableName = "MockKitUI.framework"
BlueprintName = "MockKitUI"
ReferencedContainer = "container:LoopKit.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "89D2048E21CC7C12001238CC"
BuildableName = "MockKitUI.framework"
BlueprintName = "MockKitUI"
ReferencedContainer = "container:LoopKit.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "89D2048E21CC7C12001238CC"
BuildableName = "MockKitUI.framework"
BlueprintName = "MockKitUI"
ReferencedContainer = "container:LoopKit.xcodeproj">
</BuildableReference>
</MacroExpansion>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
6 changes: 6 additions & 0 deletions LoopKit/CGMManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ public protocol CGMManagerDelegate: class {
///
/// - Parameter manager: The manager instance
func cgmManagerWantsDeletion(_ manager: CGMManager)


/// Informs the delegate that the manager has updated its state and should be persisted.
///
/// - Parameter manager: The manager instance
func cgmManagerDidUpdateState(_ manager: CGMManager)
}


Expand Down
16 changes: 15 additions & 1 deletion LoopKit/GlucoseKit/GlucoseStore.swift
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,20 @@ extension GlucoseStore {
}
}


/// Deletes glucose samples from both the CoreData cache and from HealthKit.
///
/// - Parameters:
/// - cachePredicate: The predicate to use in matching CoreData glucose objects, or `nil` to match all.
/// - healthKitPredicate: The predicate to use in matching HealthKit glucose objects.
/// - completion: The completion handler for the result of the HealthKit object deletion.
public func purgeGlucoseSamples(matchingCachePredicate cachePredicate: NSPredicate?, healthKitPredicate: NSPredicate, completion: @escaping (_ success: Bool, _ count: Int, _ error: Error?) -> Void) {
dataAccessQueue.async {
self.purgeCachedGlucoseObjects(matching: cachePredicate)
self.healthStore.deleteObjects(of: self.glucoseType, predicate: healthKitPredicate, withCompletion: completion)
}
}

/**
Cleans the in-memory and managed HealthKit caches.

Expand Down Expand Up @@ -422,7 +436,7 @@ extension GlucoseStore {
return Date(timeIntervalSinceNow: -cacheLength)
}

private func purgeCachedGlucoseObjects(matching predicate: NSPredicate) {
private func purgeCachedGlucoseObjects(matching predicate: NSPredicate?) {
dispatchPrecondition(condition: .onQueue(dataAccessQueue))

cacheStore.managedObjectContext.performAndWait {
Expand Down
2 changes: 1 addition & 1 deletion LoopKit/GlucoseKit/GlucoseTrend.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import Foundation


public enum GlucoseTrend: Int {
public enum GlucoseTrend: Int, CaseIterable {
case upUpUp = 1
case upUp = 2
case up = 3
Expand Down
2 changes: 1 addition & 1 deletion LoopKit/Persistence/NSManagedObjectContext.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ extension NSManagedObjectContext {
/// - predicate: The predicate to match
/// - Returns: The number of deleted objects
/// - Throws: NSBatchDeleteRequest exeuction errors
internal func purgeObjects<T: NSManagedObject>(of type: T.Type, matching predicate: NSPredicate) throws -> Int {
internal func purgeObjects<T: NSManagedObject>(of type: T.Type, matching predicate: NSPredicate? = nil) throws -> Int {
let fetchRequest: NSFetchRequest<NSFetchRequestResult> = T.fetchRequest()
fetchRequest.predicate = predicate

Expand Down
13 changes: 13 additions & 0 deletions LoopKit/PumpManagerStatus.swift
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,16 @@ public struct PumpManagerStatus: Equatable {
self.bolusState = bolusState
}
}

extension PumpManagerStatus: CustomDebugStringConvertible {
public var debugDescription: String {
return """
## PumpManagerStatus
* timeZone: \(timeZone)
* device: \(device)
* pumpBatteryChargeRemaining: \(pumpBatteryChargeRemaining as Any)
* suspendState: \(basalDeliveryState)
* bolusState: \(bolusState)
"""
}
}
1 change: 0 additions & 1 deletion LoopKitUI/UIColor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
//
// Copyright © 2018 LoopKit Authors. All rights reserved.
//

import UIKit

private class FrameworkBundle {
Expand Down
Loading