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
40 changes: 40 additions & 0 deletions Loop.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@
4346D1F61C78501000ABAFE3 /* ChartPoint.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4346D1F51C78501000ABAFE3 /* ChartPoint.swift */; };
434F24C91CFCA8940004498F /* TransmitterGlucose.swift in Sources */ = {isa = PBXBuildFile; fileRef = 434F24C81CFCA8940004498F /* TransmitterGlucose.swift */; };
434F24CB1CFCB7AB0004498F /* GlucoseRxMessage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 434F24CA1CFCB7AB0004498F /* GlucoseRxMessage.swift */; };
434F54571D287FDB002A9274 /* NibLoadable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 434F54561D287FDB002A9274 /* NibLoadable.swift */; };
434F54591D28805E002A9274 /* ButtonTableViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 434F54581D28805E002A9274 /* ButtonTableViewCell.xib */; };
434F545B1D2880D4002A9274 /* AuthenticationTableViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 434F545A1D2880D4002A9274 /* AuthenticationTableViewCell.xib */; };
434F545F1D288345002A9274 /* ShareService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 434F545E1D288345002A9274 /* ShareService.swift */; };
434F54611D28859B002A9274 /* ServiceCredential.swift in Sources */ = {isa = PBXBuildFile; fileRef = 434F54601D28859B002A9274 /* ServiceCredential.swift */; };
434F54631D28DD80002A9274 /* ValidatingIndicatorView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 434F54621D28DD80002A9274 /* ValidatingIndicatorView.swift */; };
434FF1EA1CF26C29000DB779 /* IdentifiableClass.swift in Sources */ = {isa = PBXBuildFile; fileRef = 434FF1E91CF26C29000DB779 /* IdentifiableClass.swift */; };
434FF1EE1CF27EEF000DB779 /* UITableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 434FF1ED1CF27EEF000DB779 /* UITableViewCell.swift */; };
43523EDB1CC35083001850F1 /* RileyLinkKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 43523EDA1CC35083001850F1 /* RileyLinkKit.framework */; };
Expand All @@ -50,6 +56,10 @@
43776F971B8022E90074EA36 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 43776F951B8022E90074EA36 /* Main.storyboard */; };
43776F991B8022E90074EA36 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 43776F981B8022E90074EA36 /* Assets.xcassets */; };
43776F9C1B8022E90074EA36 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 43776F9A1B8022E90074EA36 /* LaunchScreen.storyboard */; };
437CCADA1D284ADF0075D2C3 /* AuthenticationTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 437CCAD91D284ADF0075D2C3 /* AuthenticationTableViewCell.swift */; };
437CCADC1D284B830075D2C3 /* ButtonTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 437CCADB1D284B830075D2C3 /* ButtonTableViewCell.swift */; };
437CCADE1D2858FD0075D2C3 /* AuthenticationViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 437CCADD1D2858FD0075D2C3 /* AuthenticationViewController.swift */; };
437CCAE01D285C7B0075D2C3 /* ServiceAuthentication.swift in Sources */ = {isa = PBXBuildFile; fileRef = 437CCADF1D285C7B0075D2C3 /* ServiceAuthentication.swift */; };
437CEEBC1CD6DE6A003C8C80 /* HUDView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 437CEEBB1CD6DE6A003C8C80 /* HUDView.swift */; };
437CEEBE1CD6E0CB003C8C80 /* LoopCompletionHUDView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 437CEEBD1CD6E0CB003C8C80 /* LoopCompletionHUDView.swift */; };
437CEEC01CD6FCD8003C8C80 /* BasalRateHUDView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 437CEEBF1CD6FCD8003C8C80 /* BasalRateHUDView.swift */; };
Expand Down Expand Up @@ -233,6 +243,12 @@
434AB0B11CBB4C3300422F4A /* RileyLinkBLEKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = RileyLinkBLEKit.framework; path = Carthage/Build/iOS/RileyLinkBLEKit.framework; sourceTree = "<group>"; };
434F24C81CFCA8940004498F /* TransmitterGlucose.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TransmitterGlucose.swift; sourceTree = "<group>"; };
434F24CA1CFCB7AB0004498F /* GlucoseRxMessage.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GlucoseRxMessage.swift; sourceTree = "<group>"; };
434F54561D287FDB002A9274 /* NibLoadable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NibLoadable.swift; sourceTree = "<group>"; };
434F54581D28805E002A9274 /* ButtonTableViewCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = ButtonTableViewCell.xib; sourceTree = "<group>"; };
434F545A1D2880D4002A9274 /* AuthenticationTableViewCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = AuthenticationTableViewCell.xib; sourceTree = "<group>"; };
434F545E1D288345002A9274 /* ShareService.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ShareService.swift; sourceTree = "<group>"; };
434F54601D28859B002A9274 /* ServiceCredential.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ServiceCredential.swift; sourceTree = "<group>"; };
434F54621D28DD80002A9274 /* ValidatingIndicatorView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ValidatingIndicatorView.swift; sourceTree = "<group>"; };
434FF1E91CF26C29000DB779 /* IdentifiableClass.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = IdentifiableClass.swift; sourceTree = "<group>"; };
434FF1ED1CF27EEF000DB779 /* UITableViewCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UITableViewCell.swift; sourceTree = "<group>"; };
43523EDA1CC35083001850F1 /* RileyLinkKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = RileyLinkKit.framework; path = Carthage/Build/iOS/RileyLinkKit.framework; sourceTree = "<group>"; };
Expand All @@ -247,6 +263,10 @@
43776F961B8022E90074EA36 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
43776F981B8022E90074EA36 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
43776F9B1B8022E90074EA36 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
437CCAD91D284ADF0075D2C3 /* AuthenticationTableViewCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AuthenticationTableViewCell.swift; sourceTree = "<group>"; };
437CCADB1D284B830075D2C3 /* ButtonTableViewCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ButtonTableViewCell.swift; sourceTree = "<group>"; };
437CCADD1D2858FD0075D2C3 /* AuthenticationViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AuthenticationViewController.swift; sourceTree = "<group>"; };
437CCADF1D285C7B0075D2C3 /* ServiceAuthentication.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ServiceAuthentication.swift; sourceTree = "<group>"; };
437CEEBB1CD6DE6A003C8C80 /* HUDView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HUDView.swift; sourceTree = "<group>"; };
437CEEBD1CD6E0CB003C8C80 /* LoopCompletionHUDView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LoopCompletionHUDView.swift; sourceTree = "<group>"; };
437CEEBF1CD6FCD8003C8C80 /* BasalRateHUDView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BasalRateHUDView.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -417,7 +437,10 @@
434F24CA1CFCB7AB0004498F /* GlucoseRxMessage.swift */,
436FACED1D0BA636004E2427 /* InsulinDataSource.swift */,
436A0DA41D236A2A00104B24 /* LoopError.swift */,
437CCADF1D285C7B0075D2C3 /* ServiceAuthentication.swift */,
434F54601D28859B002A9274 /* ServiceCredential.swift */,
43C418B41CE0575200405B6A /* ShareGlucose+GlucoseKit.swift */,
434F545E1D288345002A9274 /* ShareService.swift */,
434F24C81CFCA8940004498F /* TransmitterGlucose.swift */,
4328E0311CFC068900E199AA /* WatchContext+LoopKit.swift */,
);
Expand Down Expand Up @@ -549,6 +572,7 @@
4346D1F51C78501000ABAFE3 /* ChartPoint.swift */,
43649A621C7A347F00523D7F /* CollectionType.swift */,
434FF1E91CF26C29000DB779 /* IdentifiableClass.swift */,
434F54561D287FDB002A9274 /* NibLoadable.swift */,
43E344A51B9E1B3300C85C07 /* NSBundle.swift */,
43CE7CDD1CA8B63E003CC1B0 /* NSDate.swift */,
4398973A1CD2FC2000223065 /* NSDateFormatter.swift */,
Expand All @@ -564,6 +588,7 @@
43F5C2CE1B92A2A0003EB13D /* View Controllers */ = {
isa = PBXGroup;
children = (
437CCADD1D2858FD0075D2C3 /* AuthenticationViewController.swift */,
43DBF04B1C93B8D700B3C386 /* BolusViewController.swift */,
4315D2861CA5CC3B00589052 /* CarbEntryEditTableViewController.swift */,
43DBF0581C93F73800B3C386 /* CarbEntryTableViewController.swift */,
Expand All @@ -577,9 +602,13 @@
43F5C2CF1B92A2ED003EB13D /* Views */ = {
isa = PBXGroup;
children = (
437CCAD91D284ADF0075D2C3 /* AuthenticationTableViewCell.swift */,
434F545A1D2880D4002A9274 /* AuthenticationTableViewCell.xib */,
437CEEBF1CD6FCD8003C8C80 /* BasalRateHUDView.swift */,
43B371851CE583890013C5A6 /* BasalStateView.swift */,
437CEEC91CD84DB7003C8C80 /* BatteryLevelHUDView.swift */,
437CCADB1D284B830075D2C3 /* ButtonTableViewCell.swift */,
434F54581D28805E002A9274 /* ButtonTableViewCell.xib */,
4346D1E61C77F5FE00ABAFE3 /* ChartTableViewCell.swift */,
437CEEBB1CD6DE6A003C8C80 /* HUDView.swift */,
437CEEBD1CD6E0CB003C8C80 /* LoopCompletionHUDView.swift */,
Expand All @@ -588,6 +617,7 @@
436FACEB1D0BA246004E2427 /* SegmentedControlTableViewCell.swift */,
43EB40C11C83F84900472A8C /* StatusChartHighlightLayer.swift */,
43A5676A1C96155700334FAC /* SwitchTableViewCell.swift */,
434F54621D28DD80002A9274 /* ValidatingIndicatorView.swift */,
);
path = Views;
sourceTree = "<group>";
Expand Down Expand Up @@ -826,8 +856,10 @@
files = (
43776F9C1B8022E90074EA36 /* LaunchScreen.storyboard in Resources */,
43776F991B8022E90074EA36 /* Assets.xcassets in Resources */,
434F54591D28805E002A9274 /* ButtonTableViewCell.xib in Resources */,
43776F971B8022E90074EA36 /* Main.storyboard in Resources */,
43E344A81B9EAA8400C85C07 /* RemoteSettings.plist in Resources */,
434F545B1D2880D4002A9274 /* AuthenticationTableViewCell.xib in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -911,15 +943,18 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
434F54571D287FDB002A9274 /* NibLoadable.swift in Sources */,
4315D28A1CA5F45E00589052 /* DiagnosticLogger+LoopKit.swift in Sources */,
43C418B51CE0575200405B6A /* ShareGlucose+GlucoseKit.swift in Sources */,
434F24C91CFCA8940004498F /* TransmitterGlucose.swift in Sources */,
434F24CB1CFCB7AB0004498F /* GlucoseRxMessage.swift in Sources */,
43776F901B8022E90074EA36 /* AppDelegate.swift in Sources */,
437CCADA1D284ADF0075D2C3 /* AuthenticationTableViewCell.swift in Sources */,
43CE7CDE1CA8B63E003CC1B0 /* NSDate.swift in Sources */,
43F5C2DB1B92A5E1003EB13D /* SettingsTableViewController.swift in Sources */,
43B371861CE583890013C5A6 /* BasalStateView.swift in Sources */,
434FF1EA1CF26C29000DB779 /* IdentifiableClass.swift in Sources */,
437CCADE1D2858FD0075D2C3 /* AuthenticationViewController.swift in Sources */,
43A5676B1C96155700334FAC /* SwitchTableViewCell.swift in Sources */,
43A567691C94880B00334FAC /* LoopDataManager.swift in Sources */,
43E344A41B9E1B1C00C85C07 /* NSUserDefaults.swift in Sources */,
Expand All @@ -940,13 +975,16 @@
43C0944A1CACCC73001F6403 /* NotificationManager.swift in Sources */,
434FF1EE1CF27EEF000DB779 /* UITableViewCell.swift in Sources */,
43EB40C21C83F84900472A8C /* StatusChartHighlightLayer.swift in Sources */,
437CCADC1D284B830075D2C3 /* ButtonTableViewCell.swift in Sources */,
4315D2871CA5CC3B00589052 /* CarbEntryEditTableViewController.swift in Sources */,
4331E0781C85302200FBE832 /* CGPoint.swift in Sources */,
43DBF04C1C93B8D700B3C386 /* BolusViewController.swift in Sources */,
4328E0351CFC0AE100E199AA /* WatchDataManager.swift in Sources */,
437CCAE01D285C7B0075D2C3 /* ServiceAuthentication.swift in Sources */,
43DBF0571C93F6EB00B3C386 /* ReservoirTableViewController.swift in Sources */,
435400341C9F878D00D5819C /* SetBolusUserInfo.swift in Sources */,
437CEEBC1CD6DE6A003C8C80 /* HUDView.swift in Sources */,
434F545F1D288345002A9274 /* ShareService.swift in Sources */,
4354003A1C9FB81100D5819C /* UIColor.swift in Sources */,
4328E0331CFC091100E199AA /* WatchContext+LoopKit.swift in Sources */,
4398973B1CD2FC2000223065 /* NSDateFormatter.swift in Sources */,
Expand All @@ -956,13 +994,15 @@
437CEECA1CD84DB7003C8C80 /* BatteryLevelHUDView.swift in Sources */,
43F78D261C8FC000002152D1 /* DoseMath.swift in Sources */,
4331E07A1C85650D00FBE832 /* ChartAxisValueDoubleLog.swift in Sources */,
434F54611D28859B002A9274 /* ServiceCredential.swift in Sources */,
436FACEE1D0BA636004E2427 /* InsulinDataSource.swift in Sources */,
439897371CD2F80600223065 /* AnalyticsManager.swift in Sources */,
4346D1F61C78501000ABAFE3 /* ChartPoint.swift in Sources */,
43F4EF1D1BA2A57600526CE1 /* DiagnosticLogger.swift in Sources */,
432E73CB1D24B3D6009AD15D /* RemoteDataManager.swift in Sources */,
438DADC81CDE8F8B007697A5 /* LoopStateView.swift in Sources */,
43DE92591C5479E4001FFDE1 /* CarbEntryUserInfo.swift in Sources */,
434F54631D28DD80002A9274 /* ValidatingIndicatorView.swift in Sources */,
439897351CD2F7DE00223065 /* NSTimeInterval.swift in Sources */,
43DE92611C555C26001FFDE1 /* AbsorptionTimeType+CarbKit.swift in Sources */,
);
Expand Down
2 changes: 1 addition & 1 deletion Loop/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
Expand Up @@ -564,7 +564,7 @@
<placeholder placeholderIdentifier="IBFirstResponder" id="KEH-mi-7Jf" userLabel="First Responder" sceneMemberID="firstResponder"/>
<exit id="xgn-H5-ghO" userLabel="Exit" sceneMemberID="exit"/>
</objects>
<point key="canvasLocation" x="1641" y="-204"/>
<point key="canvasLocation" x="2453" y="-204"/>
</scene>
<!--Navigation Controller-->
<scene sceneID="1UI-1d-xLb">
Expand Down
21 changes: 21 additions & 0 deletions Loop/Extensions/NibLoadable.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
//
// NibLoadable.swift
// Loop
//
// Created by Nate Racklyeft on 7/2/16.
// Copyright © 2016 Nathan Racklyeft. All rights reserved.
//

import UIKit


protocol NibLoadable: IdentifiableClass {
static func nib() -> UINib
}


extension NibLoadable {
static func nib() -> UINib {
return UINib(nibName: className, bundle: NSBundle(forClass: self))
}
}
20 changes: 11 additions & 9 deletions Loop/Extensions/UIColor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,25 +12,27 @@ import UIKit
extension UIColor {
@nonobjc static var tintColor: UIColor? = nil

@nonobjc static let secondaryLabelColor: UIColor = UIColor(red: 142 / 255, green: 142 / 255, blue: 147 / 255, alpha: 1)
@nonobjc static let secondaryLabelColor = UIColor(red: 142 / 255, green: 142 / 255, blue: 147 / 255, alpha: 1)

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

@nonobjc static let glucoseTintColor: UIColor = UIColor.HIGLightBlueColor()
@nonobjc static let glucoseTintColor = UIColor.HIGLightBlueColor()

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

@nonobjc static let COBTintColor: UIColor = UIColor.HIGYellowColor()
@nonobjc static let COBTintColor = UIColor.HIGYellowColor()

@nonobjc static let doseTintColor: UIColor = UIColor.HIGGreenColor()
@nonobjc static let doseTintColor = UIColor.HIGGreenColor()

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

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

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

@nonobjc static let unknownColor: UIColor = UIColor.HIGGrayColor().colorWithAlphaComponent(0.5)
@nonobjc static let unknownColor = UIColor.HIGGrayColor().colorWithAlphaComponent(0.5)

@nonobjc static let deleteColor = UIColor.HIGRedColor()

// MARK: - HIG colors
// See: https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/MobileHIG/ColorImagesText.html
Expand Down
41 changes: 27 additions & 14 deletions Loop/Managers/RemoteDataManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,35 +13,48 @@ import ShareClient

class RemoteDataManager {

var shareClient: ShareClient?

func setShareClientUsername(username: String?, password: String?) {
var shareClient: ShareClient? {
return shareService.client
}

var shareService: ShareService {
didSet {
try! keychain.setDexcomShareUsername(shareService.username, password: shareService.password)
}
}

var nightscoutUploader: NightscoutUploader?

func setNightscoutURLString(URLString: String?, secret: String?) {

}
private var keychain = KeychainManager()

init() {
// Migrate RemoteSettings.plist to the Keychain
let settings = NSBundle.mainBundle().remoteSettings

if let username = settings?["ShareAccountName"],
if let (username, password) = keychain.getDexcomShareCredentials() {
shareService = ShareService(username: username, password: password)
} else if let username = settings?["ShareAccountName"],
password = settings?["ShareAccountPassword"]
where !username.isEmpty && !password.isEmpty
{
shareClient = ShareClient(username: username, password: password)
try! keychain.setDexcomShareUsername(username, password: password)
shareService = ShareService(username: username, password: password)
} else {
shareService = ShareService(username: nil, password: nil)
}

if let siteURL = settings?["NightscoutSiteURL"],
APISecret = settings?["NightscoutAPISecret"]
if let (siteURL, APISecret) = keychain.getNightscoutCredentials() {
nightscoutUploader = NightscoutUploader(siteURL: siteURL.absoluteString, APISecret: APISecret)
} else if let siteURLString = settings?["NightscoutSiteURL"],
APISecret = settings?["NightscoutAPISecret"],
siteURL = NSURL(string: siteURLString)
{
nightscoutUploader = NightscoutUploader(siteURL: siteURL, APISecret: APISecret)
nightscoutUploader!.errorHandler = { (error: ErrorType, context: String) -> Void in
print("Error \(error), while \(context)")
}
try! keychain.setNightscoutURL(siteURL, secret: APISecret)
nightscoutUploader = NightscoutUploader(siteURL: siteURLString, APISecret: APISecret)
}

nightscoutUploader?.errorHandler = { (error: ErrorType, context: String) -> Void in
print("Error \(error), while \(context)")
}
}

Expand Down
Loading