Skip to content

Commit 8a22271

Browse files
authored
Learn app target and LoopCore framework (#900)
* Learn app target and LoopCore framework * Update carthage revs
1 parent 1e0e121 commit 8a22271

File tree

89 files changed

+2873
-553
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

89 files changed

+2873
-553
lines changed

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ before_script:
99
script:
1010
# Build the app target
1111
- set -o pipefail && xcodebuild -project Loop.xcodeproj -scheme Loop build CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO | xcpretty
12+
- set -o pipefail && xcodebuild -project Loop.xcodeproj -scheme Learn build CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO | xcpretty
1213
# Run the test target
1314
- set -o pipefail && xcodebuild -project Loop.xcodeproj -scheme LoopTests -destination 'name=iPhone SE' test | xcpretty
1415
- set -o pipefail && xcodebuild -project Loop.xcodeproj -scheme DoseMathTests -destination 'name=iPhone SE' test | xcpretty

Cartfile.resolved

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
github "LoopKit/Amplitude-iOS" "2137d5fd44bf630ed33e1e72d7af6d8f8612f270"
22
github "LoopKit/CGMBLEKit" "ea1267791c66e884f1013fffd36faf4555cc6eaf"
33
github "LoopKit/G4ShareSpy" "fed5a389e3e47e3a1953878dd21852aa5f44b360"
4-
github "LoopKit/LoopKit" "797a4fffeb0b56c8ce47543ea6516b3b8c8e0857"
4+
github "LoopKit/LoopKit" "c6e9f9200deec9a401ab1725e888451b17dee98a"
55
github "LoopKit/dexcom-share-client-swift" "b0419edf55c7f389b36cb47dd5c376bbd3d03d69"
66
github "i-schuetz/SwiftCharts" "0.6.2"
7-
github "ps2/rileylink_ios" "23af71639041ca3a2a1b4120d3cd0a06c5d3fa01"
7+
github "ps2/rileylink_ios" "8418b57c1983bdefaec7ccb456c86d5efacf40e7"

Common/Extensions/HKUnit.swift

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
//
88

99
import HealthKit
10+
import LoopCore
1011

1112
// Code in this extension is duplicated from:
1213
// https://github.com/LoopKit/LoopKit/blob/master/LoopKit/HKUnit.swift
@@ -21,14 +22,6 @@ extension HKUnit {
2122
}
2223
}
2324

24-
static let milligramsPerDeciliter: HKUnit = {
25-
return HKUnit.gramUnit(with: .milli).unitDivided(by: HKUnit.literUnit(with: .deci))
26-
}()
27-
28-
static let millimolesPerLiter: HKUnit = {
29-
return HKUnit.moleUnit(with: .milli, molarMass: HKUnitMolarMassBloodGlucose).unitDivided(by: HKUnit.liter())
30-
}()
31-
3225
var localizedShortUnitString: String {
3326
if self == HKUnit.millimolesPerLiter {
3427
return NSLocalizedString("mmol/L", comment: "The short unit display string for millimoles of glucose per liter")

Common/Extensions/NSTimeInterval.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ extension TimeInterval {
2222
return TimeInterval(hours: hours)
2323
}
2424

25+
static func days(_ days: Double) -> TimeInterval {
26+
return TimeInterval(days: days)
27+
}
28+
2529
init(minutes: Double) {
2630
self.init(minutes * 60)
2731
}
@@ -30,6 +34,10 @@ extension TimeInterval {
3034
self.init(minutes: hours * 60)
3135
}
3236

37+
init(days: Double) {
38+
self.init(hours: days * 24)
39+
}
40+
3341
var minutes: Double {
3442
return self / 60.0
3543
}

Common/Extensions/NewCarbEntryIntent+Loop.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
//
77

88
import Foundation
9+
import LoopCore
910

1011
@available(iOS 12.0, watchOSApplicationExtension 5.0, *)
1112
extension NewCarbEntryIntent: IdentifiableClass { }

Loop/Views/TextFieldTableViewCell.swift renamed to Common/Extensions/TextFieldTableViewCell.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
//
77

88
import LoopKitUI
9+
import LoopUI
910

1011

1112
extension TextFieldTableViewCell: NibLoadable { }

Common/Models/Insulin/ExponentialInsulinModelPreset.swift

Lines changed: 0 additions & 89 deletions
This file was deleted.

Common/Models/LoopSettingsUserInfo.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
// Copyright © 2018 LoopKit Authors. All rights reserved.
66
//
77

8+
import LoopCore
9+
810

911
struct LoopSettingsUserInfo {
1012
let settings: LoopSettings

DoseMathTests/DoseMathTests.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import XCTest
1010
import HealthKit
1111
import LoopKit
12+
import LoopCore
1213

1314

1415
extension XCTestCase {

Learn/AppDelegate.swift

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
//
2+
// AppDelegate.swift
3+
// Learn
4+
//
5+
// Copyright © 2019 LoopKit Authors. All rights reserved.
6+
//
7+
8+
import UIKit
9+
10+
@UIApplicationMain
11+
class AppDelegate: UIResponder, UIApplicationDelegate {
12+
13+
var window: UIWindow?
14+
15+
16+
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
17+
18+
guard
19+
let nav = window?.rootViewController as? UINavigationController,
20+
let lessonsVC = nav.topViewController as? LessonsViewController
21+
else {
22+
return false
23+
}
24+
25+
let dataManager = DataManager()
26+
dataManager.authorize({
27+
DispatchQueue.main.async {
28+
lessonsVC.lessons = [
29+
TimeInRangeLesson(dataManager: dataManager)
30+
]
31+
}
32+
})
33+
34+
return true
35+
}
36+
37+
func applicationWillResignActive(_ application: UIApplication) {
38+
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
39+
// Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
40+
}
41+
42+
func applicationDidEnterBackground(_ application: UIApplication) {
43+
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
44+
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
45+
}
46+
47+
func applicationWillEnterForeground(_ application: UIApplication) {
48+
// Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
49+
}
50+
51+
func applicationDidBecomeActive(_ application: UIApplication) {
52+
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
53+
}
54+
55+
func applicationWillTerminate(_ application: UIApplication) {
56+
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
57+
}
58+
59+
60+
}
61+

0 commit comments

Comments
 (0)