Skip to content

Commit aadc3d9

Browse files
authored
Xcode11 (LoopKit#1081)
* Updates for Xcode 11 * Fix dark mode colors for status extension labels * Update status extension even if LoopDataManager has error * Turn off asset overrides to avoid error in Xcode 11 * Use xcode11 branches * Add comment, and remove unused code * Add NSBluetoothAlwaysUsageDescription key * Use LOOP_MARKETING_VERSION * Separate bundle ids by platform to fix App Store Connect error * Bump carthage revs
1 parent f531549 commit aadc3d9

Some content is hidden

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

41 files changed

+507
-371
lines changed

.travis.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
language: objective-c
2-
osx_image: xcode10.2
2+
osx_image: xcode11
33
# xcode_sdk: iphonesimulator11
44
# xcode_project: Loop.xcodeproj
55
# xcode_scheme: Loop
@@ -17,5 +17,5 @@ script:
1717
- set -o pipefail && xcodebuild -project Loop.xcodeproj -scheme Loop build CODE_SIGN_IDENTITY="" CODE_SIGNING_ALLOWED=NO | xcpretty
1818
- set -o pipefail && xcodebuild -project Loop.xcodeproj -scheme Learn build CODE_SIGN_IDENTITY="" CODE_SIGNING_ALLOWED=NO | xcpretty
1919
# Run the test target
20-
- set -o pipefail && xcodebuild -project Loop.xcodeproj -scheme LoopTests -destination 'name=iPhone SE' test | xcpretty
21-
- 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 6' test | xcpretty
21+
- set -o pipefail && xcodebuild -project Loop.xcodeproj -scheme DoseMathTests -destination 'name=iPhone 6' test | xcpretty

Cartfile.resolved

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
github "LoopKit/Amplitude-iOS" "2137d5fd44bf630ed33e1e72d7af6d8f8612f270"
2-
github "LoopKit/CGMBLEKit" "fe92d93c24d18ff9755ff027e9b036d3769a8a0a"
3-
github "LoopKit/G4ShareSpy" "f6ae0cf1753131135f26046ddf07e096da884b84"
4-
github "LoopKit/LoopKit" "b47d60e6ed202ca30e4adc63c6d237ac100e72b4"
2+
github "LoopKit/CGMBLEKit" "7417605dd898bf89378171941126c85d85dc642c"
3+
github "LoopKit/G4ShareSpy" "e62d296067180c6659166272ff9cc406f470ec9e"
4+
github "LoopKit/LoopKit" "18a5a04afd310e945ac54f8c43a44838a16503c2"
55
github "LoopKit/MKRingProgressView" "f548a5c64832be2d37d7c91b5800e284887a2a0a"
6-
github "LoopKit/dexcom-share-client-swift" "cdbb1cd19cf54b37add6d6c25300445a6abe24da"
6+
github "LoopKit/dexcom-share-client-swift" "c4f3d48e56e5b3ad786486ccd1bbc753034096d2"
77
github "i-schuetz/SwiftCharts" "0.6.5"
8-
github "ps2/rileylink_ios" "43789bd2d25e8ce32a0ccae31a4b85f419eb8aa9"
8+
github "ps2/rileylink_ios" "f171e97de62ed382180c2d82aa6d24607aec964d"

Common/Extensions/UIColor+HIG.swift

+1-33
Original file line numberDiff line numberDiff line change
@@ -13,40 +13,8 @@ extension UIColor {
1313
// MARK: - HIG colors
1414
// See: https://developer.apple.com/ios/human-interface-guidelines/visual-design/color/
1515

16-
static func HIGTealBlueColor() -> UIColor {
17-
return UIColor(red: 90 / 255, green: 200 / 255, blue: 250 / 255, alpha: 1)
18-
}
19-
20-
static func HIGYellowColor() -> UIColor {
21-
return UIColor(red: 1, green: 204 / 255, blue: 0, alpha: 1)
22-
}
23-
24-
static func HIGOrangeColor() -> UIColor {
25-
return UIColor(red: 1, green: 149 / 255, blue: 0 / 255, alpha: 1)
26-
}
27-
28-
static func HIGPinkColor() -> UIColor {
29-
return UIColor(red: 1, green: 45 / 255, blue: 85 / 255, alpha: 1)
30-
}
31-
32-
static func HIGBlueColor() -> UIColor {
33-
return UIColor(red: 0, green: 122 / 255, blue: 1, alpha: 1)
34-
}
35-
16+
// HIG Green has changed for iOS 13. This is the legacy color.
3617
static func HIGGreenColor() -> UIColor {
3718
return UIColor(red: 76 / 255, green: 217 / 255, blue: 100 / 255, alpha: 1)
3819
}
39-
40-
static func HIGRedColor() -> UIColor {
41-
return UIColor(red: 1, green: 59 / 255, blue: 48 / 255, alpha: 1)
42-
}
43-
44-
static func HIGPurpleColor() -> UIColor {
45-
return UIColor(red: 88 / 255, green: 86 / 255, blue: 214 / 255, alpha: 1)
46-
}
47-
48-
static func HIGGrayColor() -> UIColor {
49-
return UIColor(red: 142 / 255, green: 143 / 255, blue: 147 / 255, alpha: 1)
50-
}
51-
5220
}

Common/Extensions/UIColor.swift

+45-9
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,57 @@ import UIKit
1010

1111

1212
extension UIColor {
13-
@nonobjc static var tintColor: UIColor? = nil
13+
@nonobjc static let secondaryLabelColor: UIColor = {
14+
if #available(iOSApplicationExtension 13.0, iOS 13.0, *) {
15+
return UIColor.secondaryLabel
16+
} else {
17+
return UIColor.systemGray
18+
}
19+
}()
1420

15-
@nonobjc static let secondaryLabelColor = UIColor.HIGGrayColor()
21+
@nonobjc static let cellBackgroundColor: UIColor = {
22+
if #available(iOSApplicationExtension 13.0, iOS 13.0, *) {
23+
return .secondarySystemBackground
24+
} else {
25+
return UIColor(white: 239 / 255, alpha: 1)
26+
}
27+
}()
1628

17-
@nonobjc static let cellBackgroundColor = UIColor(white: 239 / 255, alpha: 1)
29+
@nonobjc static let IOBTintColor = UIColor.systemOrange
1830

19-
@nonobjc static let IOBTintColor = UIColor.HIGOrangeColor()
31+
@nonobjc static let COBTintColor: UIColor = {
32+
if #available(iOSApplicationExtension 13.0, iOS 13.0, *) {
33+
return UIColor(dynamicProvider: { (traitCollection) in
34+
// If we're in accessibility mode, return the system color
35+
guard case .normal = traitCollection.accessibilityContrast else {
36+
return .systemGreen
37+
}
2038

21-
@nonobjc static let COBTintColor = UIColor(red: 99 / 255, green: 218 / 255, blue: 56 / 255, alpha: 1)
39+
switch traitCollection.userInterfaceStyle {
40+
case .unspecified, .light:
41+
return UIColor(red: 99 / 255, green: 218 / 255, blue: 56 / 255, alpha: 1)
42+
case .dark:
43+
return UIColor(red: 89 / 255, green: 228 / 255, blue: 51 / 255, alpha: 1)
44+
@unknown default:
45+
return UIColor(red: 99 / 255, green: 218 / 255, blue: 56 / 255, alpha: 1)
46+
}
47+
})
48+
} else {
49+
return UIColor(red: 99 / 255, green: 218 / 255, blue: 56 / 255, alpha: 1)
50+
}
51+
}()
2252

23-
@nonobjc static let agingColor = UIColor.HIGYellowColor()
53+
@nonobjc static let agingColor = UIColor.systemYellow
2454

25-
@nonobjc static let staleColor = UIColor.HIGRedColor()
55+
@nonobjc static let staleColor = UIColor.systemRed
2656

27-
@nonobjc static let unknownColor = UIColor(red: 198 / 255, green: 199 / 255, blue: 201 / 255, alpha: 1)
57+
@nonobjc static let unknownColor: UIColor = {
58+
if #available(iOSApplicationExtension 13.0, iOS 13.0, *) {
59+
return .systemGray4
60+
} else {
61+
return UIColor(red: 198 / 255, green: 199 / 255, blue: 201 / 255, alpha: 1)
62+
}
63+
}()
2864

29-
static let delete = UIColor.HIGRedColor()
65+
static let delete = UIColor.systemRed
3066
}

DoseMathTests/Info.plist

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<key>CFBundlePackageType</key>
1616
<string>BNDL</string>
1717
<key>CFBundleShortVersionString</key>
18-
<string>1.10.1</string>
18+
<string>$(LOOP_MARKETING_VERSION)</string>
1919
<key>CFBundleSignature</key>
2020
<string>????</string>
2121
<key>CFBundleVersion</key>

Learn/Info.plist

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
<key>CFBundlePackageType</key>
2020
<string>APPL</string>
2121
<key>CFBundleShortVersionString</key>
22-
<string>1.10.1</string>
22+
<string>$(LOOP_MARKETING_VERSION)</string>
2323
<key>CFBundleVersion</key>
2424
<string>$(CURRENT_PROJECT_VERSION)</string>
2525
<key>LSRequiresIPhoneOS</key>

Loop Status Extension/Base.lproj/MainInterface.storyboard

+3-6
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14109" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="64E-I5-5c4">
3-
<device id="retina5_5" orientation="portrait">
4-
<adaptation id="fullscreen"/>
5-
</device>
2+
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14854.2" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="64E-I5-5c4">
3+
<device id="retina5_5" orientation="portrait" appearance="dark"/>
64
<dependencies>
75
<deployment identifier="iOS"/>
8-
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14088"/>
6+
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14806.4"/>
97
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
108
</dependencies>
119
<scenes>
@@ -65,7 +63,6 @@
6563
</view>
6664
<view contentMode="scaleToFill" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="GVu-hk-PBg" customClass="ChartContainerView" customModule="LoopUI">
6765
<rect key="frame" x="0.0" y="120" width="359" height="100"/>
68-
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
6966
<constraints>
7067
<constraint firstAttribute="height" relation="greaterThanOrEqual" priority="750" constant="100" id="rLK-f9-lLl"/>
7168
</constraints>

Loop Status Extension/StatusChartsManager.swift

+3-2
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,12 @@
88
import Foundation
99
import LoopUI
1010
import SwiftCharts
11+
import UIKit
1112

1213
class StatusChartsManager: ChartsManager {
1314
let predictedGlucose = PredictedGlucoseChart()
1415

15-
init(colors: ChartColorPalette, settings: ChartSettings) {
16-
super.init(colors: colors, settings: settings, charts: [predictedGlucose])
16+
init(colors: ChartColorPalette, settings: ChartSettings, traitCollection: UITraitCollection) {
17+
super.init(colors: colors, settings: settings, charts: [predictedGlucose], traitCollection: traitCollection)
1718
}
1819
}

Loop Status Extension/StatusViewController.swift

+14-3
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@ class StatusViewController: UIViewController, NCWidgetProviding {
4848
settings.labelsToAxisSpacingX = 6
4949
settings.clipInnerFrame = false
5050
return settings
51-
}()
51+
}(),
52+
traitCollection: traitCollection
5253
)
5354

5455
charts.predictedGlucose.glucoseDisplayRange = HKQuantity(unit: .milligramsPerDeciliter, doubleValue: 100)...HKQuantity(unit: .milligramsPerDeciliter, doubleValue: 175)
@@ -90,9 +91,15 @@ class StatusViewController: UIViewController, NCWidgetProviding {
9091
super.viewDidLoad()
9192

9293
subtitleLabel.isHidden = true
93-
subtitleLabel.textColor = .subtitleLabelColor
94+
if #available(iOSApplicationExtension 13.0, iOS 13.0, *) {
95+
subtitleLabel.textColor = .secondaryLabel
96+
insulinLabel.textColor = .secondaryLabel
97+
} else {
98+
subtitleLabel.textColor = .subtitleLabelColor
99+
insulinLabel.textColor = .subtitleLabelColor
100+
}
101+
94102
insulinLabel.isHidden = true
95-
insulinLabel.textColor = .subtitleLabelColor
96103

97104
let tapGestureRecognizer = UITapGestureRecognizer(target: self, action: #selector(openLoopApp(_:)))
98105
view.addGestureRecognizer(tapGestureRecognizer)
@@ -145,6 +152,10 @@ class StatusViewController: UIViewController, NCWidgetProviding {
145152
self.glucoseChartContentView.isHidden = self.extensionContext?.widgetActiveDisplayMode != .expanded
146153
})
147154
}
155+
156+
override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) {
157+
charts.traitCollection = traitCollection
158+
}
148159

149160
@objc private func openLoopApp(_: Any) {
150161
if let url = Bundle.main.mainAppUrl {

Loop.xcconfig

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
MAIN_APP_BUNDLE_IDENTIFIER = com.${DEVELOPMENT_TEAM}.loopkit
1212
MAIN_APP_DISPLAY_NAME = Loop
1313

14-
LOOP_MARKETING_VERSION = 1.10.0
14+
LOOP_MARKETING_VERSION = 1.10.1
1515

1616
APPICON_NAME = AppIcon
1717

0 commit comments

Comments
 (0)