Skip to content

Commit a03629d

Browse files
authored
Merge pull request #1223 from LoopKit/dev
Release 2.0
2 parents 5df0b4c + e623b4b commit a03629d

File tree

621 files changed

+21359
-6422
lines changed

Some content is hidden

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

621 files changed

+21359
-6422
lines changed

.gitignore

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ xcuserdata
2222
*.moved-aside
2323
*.xcuserstate
2424
*.xcscmblueprint
25-
project.xcworkspace
2625

2726
## Obj-C/Swift specific
2827
*.hmap
@@ -55,7 +54,7 @@ Carthage/
5554

5655
# fastlane
5756
#
58-
# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
57+
# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
5958
# screenshots whenever they are needed.
6059
# For more information about the recommended setup visit:
6160
# https://github.com/fastlane/fastlane/blob/master/docs/Gitignore.md
@@ -71,3 +70,7 @@ RemoteSettings.plist
7170

7271
# Framework development
7372
Loop.xcworkspace
73+
74+
# Avoid checking in built assets
75+
Loop/DerivedAssets.xcassets/
76+
WatchApp/DerivedAssets.xcassets/

.travis.yml

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,21 @@
11
language: objective-c
2-
osx_image: xcode10
2+
osx_image: xcode11
33
# xcode_sdk: iphonesimulator11
44
# xcode_project: Loop.xcodeproj
55
# xcode_scheme: Loop
6+
7+
addons:
8+
homebrew:
9+
packages:
10+
- carthage
11+
update: true
612
before_script:
13+
- git config --global protocol.version 1
714
- set -o pipefail && xcodebuild -project Loop.xcodeproj -target Cartfile
815
script:
916
# Build the app target
10-
- set -o pipefail && xcodebuild -project Loop.xcodeproj -scheme Loop build CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO | xcpretty
17+
- set -o pipefail && xcodebuild -project Loop.xcodeproj -scheme Loop build CODE_SIGN_IDENTITY="" CODE_SIGNING_ALLOWED=NO | xcpretty
18+
- set -o pipefail && xcodebuild -project Loop.xcodeproj -scheme Learn build CODE_SIGN_IDENTITY="" CODE_SIGNING_ALLOWED=NO | xcpretty
1119
# Run the test target
12-
- set -o pipefail && xcodebuild -project Loop.xcodeproj -scheme LoopTests -destination 'name=iPhone SE' test | xcpretty
13-
- set -o pipefail && xcodebuild -project Loop.xcodeproj -scheme DoseMathTests -destination 'name=iPhone SE' test | xcpretty
20+
- set -o pipefail && xcodebuild -project Loop.xcodeproj -scheme LoopTests -destination 'name=iPhone 8' test | xcpretty
21+
- set -o pipefail && xcodebuild -project Loop.xcodeproj -scheme DoseMathTests -destination 'name=iPhone 8' test | xcpretty

Cartfile

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
2-
github "LoopKit/LoopKit" ~> 2.2
3-
github "LoopKit/CGMBLEKit" ~> 3.1
4-
github "ps2/SwiftCharts" "hotfix-xcode10.2"
5-
github "LoopKit/dexcom-share-client-swift" == 1.0
6-
github "LoopKit/G4ShareSpy" == 1.0
7-
github "ps2/rileylink_ios" ~> 2.1
1+
github "LoopKit/LoopKit" ~> 3.0
2+
github "LoopKit/CGMBLEKit" ~> 3.2
3+
github "i-schuetz/SwiftCharts" == 0.6.5
4+
github "LoopKit/dexcom-share-client-swift" ~> 1.2
5+
github "LoopKit/G4ShareSpy" ~> 1.1
6+
github "ps2/rileylink_ios" ~> 3.0
87
github "LoopKit/Amplitude-iOS" "decreepify"

Cartfile.resolved

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
github "LoopKit/Amplitude-iOS" "2137d5fd44bf630ed33e1e72d7af6d8f8612f270"
2-
github "LoopKit/CGMBLEKit" "v3.1"
3-
github "LoopKit/G4ShareSpy" "v1.0"
4-
github "LoopKit/LoopKit" "v2.2.2"
5-
github "LoopKit/dexcom-share-client-swift" "v1.0"
6-
github "ps2/SwiftCharts" "cc8c401171d5ccb638ec6c87f6c410ee31fa774d"
7-
github "ps2/rileylink_ios" "v2.1.1"
2+
github "LoopKit/CGMBLEKit" "v3.2"
3+
github "LoopKit/G4ShareSpy" "v1.1"
4+
github "LoopKit/LoopKit" "v3.0"
5+
github "LoopKit/MKRingProgressView" "f548a5c64832be2d37d7c91b5800e284887a2a0a"
6+
github "LoopKit/dexcom-share-client-swift" "v1.2"
7+
github "i-schuetz/SwiftCharts" "0.6.5"
8+
github "ps2/rileylink_ios" "v3.0"

Common/Base.lproj/Intents.intentdefinition

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,18 @@
77
<key>INIntentDefinitionModelVersion</key>
88
<string>1.0</string>
99
<key>INIntentDefinitionSystemVersion</key>
10-
<string>17G65</string>
10+
<string>18G87</string>
1111
<key>INIntentDefinitionToolsBuildVersion</key>
12-
<string>10L232m</string>
12+
<string>10G8</string>
1313
<key>INIntentDefinitionToolsVersion</key>
14-
<string>10.0</string>
14+
<string>10.3</string>
1515
<key>INIntents</key>
1616
<array>
1717
<dict>
1818
<key>INIntentCategory</key>
1919
<string>create</string>
20+
<key>INIntentDescription</key>
21+
<string>Add a carb entry to Loop</string>
2022
<key>INIntentDescriptionID</key>
2123
<string>yc02Yq</string>
2224
<key>INIntentLastParameterTag</key>

Common/Extensions/GlucoseRangeSchedule.swift

Lines changed: 4 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -10,58 +10,16 @@ import HealthKit
1010

1111

1212
extension GlucoseRangeSchedule {
13-
func overrideEnabledForContext(_ context: Override.Context) -> Bool? {
14-
guard let override = override, override.context == context else {
15-
guard let value = overrideRanges[context], !value.isZero else {
16-
// Unavailable to set
17-
return nil
18-
}
19-
20-
return false
21-
}
22-
23-
return override.isActive()
24-
}
25-
26-
var activeOverride: GlucoseRangeSchedule.Override? {
27-
guard let override = override, override.isActive() else {
28-
return nil
29-
}
30-
31-
return override
32-
}
33-
34-
var activeOverrideContext: GlucoseRangeSchedule.Override.Context? {
35-
return activeOverride?.context
36-
}
37-
38-
var activeOverrideQuantityRange: Range<HKQuantity>? {
39-
guard let activeOverride = activeOverride else {
40-
return nil
41-
}
42-
43-
let lowerBound = HKQuantity(unit: unit, doubleValue: activeOverride.value.minValue)
44-
let upperBound = HKQuantity(unit: unit, doubleValue: activeOverride.value.maxValue)
45-
return lowerBound..<upperBound
46-
}
47-
48-
var configuredOverrideContexts: [GlucoseRangeSchedule.Override.Context] {
49-
var contexts: [GlucoseRangeSchedule.Override.Context] = []
50-
for (context, range) in overrideRanges where !range.isZero {
51-
contexts.append(context)
52-
}
53-
54-
return contexts
55-
}
56-
5713
func minQuantity(at date: Date) -> HKQuantity {
5814
return HKQuantity(unit: unit, doubleValue: value(at: date).minValue)
5915
}
6016
}
6117

6218

63-
extension DoubleRange {
64-
var averageValue: Double {
19+
extension ClosedRange where Bound == HKQuantity {
20+
func averageValue(for unit: HKUnit) -> Double {
21+
let minValue = lowerBound.doubleValue(for: unit)
22+
let maxValue = upperBound.doubleValue(for: unit)
6523
return (maxValue + minValue) / 2
6624
}
6725
}

Common/Extensions/HKUnit.swift

Lines changed: 1 addition & 17 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")
@@ -43,15 +36,6 @@ extension HKUnit {
4336
}
4437
}
4538

46-
/// An example value for the "ideal" target
47-
var glucoseExampleTargetValue: Double {
48-
if self == .milligramsPerDeciliter {
49-
return 100
50-
} else {
51-
return 5.5
52-
}
53-
}
54-
5539
/// The smallest value expected to be visible on a chart
5640
var chartableIncrement: Double {
5741
if self == .milligramsPerDeciliter {

Common/Extensions/NSBundle.swift

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,35 @@ extension Bundle {
3030
return object(forInfoDictionaryKey: "AppGroupIdentifier") as! String
3131
}
3232

33+
var isAppExtension: Bool {
34+
return bundleURL.pathExtension == "appex"
35+
}
36+
3337
var mainAppUrl: URL? {
3438
if let mainAppBundleIdentifier = mainAppBundleIdentifier {
3539
return URL(string: "\(mainAppBundleIdentifier)://")
3640
} else {
3741
return nil
3842
}
3943
}
44+
45+
var gitRevision: String? {
46+
return object(forInfoDictionaryKey: "com-loopkit-Loop-git-revision") as? String
47+
}
48+
49+
var gitBranch: String? {
50+
return object(forInfoDictionaryKey: "com-loopkit-Loop-git-branch") as? String
51+
}
52+
53+
var sourceRoot: String? {
54+
return object(forInfoDictionaryKey: "com-loopkit-Loop-srcroot") as? String
55+
}
56+
57+
var buildDateString: String? {
58+
return object(forInfoDictionaryKey: "com-loopkit-Loop-build-date") as? String
59+
}
60+
61+
var xcodeVersion: String? {
62+
return object(forInfoDictionaryKey: "com-loopkit-Loop-xcode-version") as? String
63+
}
4064
}

Common/Extensions/NSTimeInterval.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,5 @@ extension TimeInterval {
3737
var hours: Double {
3838
return minutes / 60.0
3939
}
40+
4041
}

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 { }

0 commit comments

Comments
 (0)