Skip to content

Commit b514603

Browse files
authored
Merge pull request #11 from LoopKit/dev
Release 1.2
2 parents 664a5f2 + 83b89d5 commit b514603

39 files changed

+309
-145
lines changed

.gitignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ profile
1818
DerivedData
1919
*.hmap
2020
*.ipa
21-
project.xcworkspace
2221

2322
# Bundler
2423
.bundle
@@ -27,7 +26,7 @@ Carthage
2726
# We recommend against adding the Pods directory to your .gitignore. However
2827
# you should judge for yourself, the pros and cons are mentioned at:
2928
# http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control
30-
#
29+
#
3130
# Note: if you ignore the Pods directory, make sure to uncomment
3231
# `pod install` in .travis.yml
3332
#

.travis.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
language: objective-c
2-
osx_image: xcode10
2+
osx_image: xcode11
33

4+
before_script:
5+
- carthage bootstrap
46

57
script:
6-
# Build Travis project and run tests
7-
- xcodebuild -project ShareClient.xcodeproj -scheme ShareClient build -destination name="iPhone SE" test
8+
# Build Travis project and run tests
9+
- xcodebuild -project ShareClient.xcodeproj -scheme Shared build -destination name="iPhone 8" test

Cartfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
github "LoopKit/LoopKit" ~> 2.0
1+
github "LoopKit/LoopKit" ~> 3.0

Cartfile.resolved

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
github "LoopKit/LoopKit" "v2.2.1"
1+
github "LoopKit/LoopKit" "v3.0"

ShareClient.xcodeproj/project.pbxproj

Lines changed: 204 additions & 111 deletions
Large diffs are not rendered by default.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>IDEDidComputeMac32BitWarning</key>
6+
<true/>
7+
</dict>
8+
</plist>
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>IDEWorkspaceSharedSettings_AutocreateContextsIfNeeded</key>
6+
<false/>
7+
</dict>
8+
</plist>

ShareClient.xcodeproj/xcshareddata/xcschemes/ShareClientUI.xcscheme renamed to ShareClient.xcodeproj/xcshareddata/xcschemes/Shared-watchOS.xcscheme

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "0940"
3+
LastUpgradeVersion = "1020"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"
7-
buildImplicitDependencies = "YES">
7+
buildImplicitDependencies = "NO">
88
<BuildActionEntries>
99
<BuildActionEntry
1010
buildForTesting = "YES"
@@ -14,9 +14,9 @@
1414
buildForAnalyzing = "YES">
1515
<BuildableReference
1616
BuildableIdentifier = "primary"
17-
BlueprintIdentifier = "43A8EC81210E664300A81379"
18-
BuildableName = "ShareClientUI.framework"
19-
BlueprintName = "ShareClientUI"
17+
BlueprintIdentifier = "A9ED4D91225EB4D30080DEBA"
18+
BuildableName = "ShareClient.framework"
19+
BlueprintName = "ShareClient-watchOS"
2020
ReferencedContainer = "container:ShareClient.xcodeproj">
2121
</BuildableReference>
2222
</BuildActionEntry>
@@ -45,9 +45,9 @@
4545
<MacroExpansion>
4646
<BuildableReference
4747
BuildableIdentifier = "primary"
48-
BlueprintIdentifier = "43A8EC81210E664300A81379"
49-
BuildableName = "ShareClientUI.framework"
50-
BlueprintName = "ShareClientUI"
48+
BlueprintIdentifier = "A9ED4D91225EB4D30080DEBA"
49+
BuildableName = "ShareClient.framework"
50+
BlueprintName = "ShareClient-watchOS"
5151
ReferencedContainer = "container:ShareClient.xcodeproj">
5252
</BuildableReference>
5353
</MacroExpansion>
@@ -63,9 +63,9 @@
6363
<MacroExpansion>
6464
<BuildableReference
6565
BuildableIdentifier = "primary"
66-
BlueprintIdentifier = "43A8EC81210E664300A81379"
67-
BuildableName = "ShareClientUI.framework"
68-
BlueprintName = "ShareClientUI"
66+
BlueprintIdentifier = "A9ED4D91225EB4D30080DEBA"
67+
BuildableName = "ShareClient.framework"
68+
BlueprintName = "ShareClient-watchOS"
6969
ReferencedContainer = "container:ShareClient.xcodeproj">
7070
</BuildableReference>
7171
</MacroExpansion>

ShareClient.xcodeproj/xcshareddata/xcschemes/ShareClient.xcscheme renamed to ShareClient.xcodeproj/xcshareddata/xcschemes/Shared.xcscheme

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "0940"
3+
LastUpgradeVersion = "1020"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"
7-
buildImplicitDependencies = "YES">
7+
buildImplicitDependencies = "NO">
88
<BuildActionEntries>
99
<BuildActionEntry
1010
buildForTesting = "YES"
@@ -20,6 +20,20 @@
2020
ReferencedContainer = "container:ShareClient.xcodeproj">
2121
</BuildableReference>
2222
</BuildActionEntry>
23+
<BuildActionEntry
24+
buildForTesting = "YES"
25+
buildForRunning = "YES"
26+
buildForProfiling = "YES"
27+
buildForArchiving = "YES"
28+
buildForAnalyzing = "YES">
29+
<BuildableReference
30+
BuildableIdentifier = "primary"
31+
BlueprintIdentifier = "43A8EC81210E664300A81379"
32+
BuildableName = "ShareClientUI.framework"
33+
BlueprintName = "ShareClientUI"
34+
ReferencedContainer = "container:ShareClient.xcodeproj">
35+
</BuildableReference>
36+
</BuildActionEntry>
2337
</BuildActionEntries>
2438
</BuildAction>
2539
<TestAction

ShareClient/Info.plist

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@
77
<key>CFBundleExecutable</key>
88
<string>$(EXECUTABLE_NAME)</string>
99
<key>CFBundleIdentifier</key>
10-
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
10+
<string>$(PRODUCT_BUNDLE_IDENTIFIER)-$(PLATFORM_NAME)</string>
1111
<key>CFBundleInfoDictionaryVersion</key>
1212
<string>6.0</string>
1313
<key>CFBundleName</key>
1414
<string>$(PRODUCT_NAME)</string>
1515
<key>CFBundlePackageType</key>
1616
<string>FMWK</string>
1717
<key>CFBundleShortVersionString</key>
18-
<string>1.1</string>
18+
<string>1.2</string>
1919
<key>CFBundleSignature</key>
2020
<string>????</string>
2121
<key>CFBundleVersion</key>

ShareClient/ShareClientManager.swift

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,25 @@ public class ShareClientManager: CGMManager {
3636

3737
public let appURL: URL? = nil
3838

39-
weak public var cgmManagerDelegate: CGMManagerDelegate?
39+
public var cgmManagerDelegate: CGMManagerDelegate? {
40+
get {
41+
return delegate.delegate
42+
}
43+
set {
44+
delegate.delegate = newValue
45+
}
46+
}
47+
48+
public var delegateQueue: DispatchQueue! {
49+
get {
50+
return delegate.queue
51+
}
52+
set {
53+
delegate.queue = newValue
54+
}
55+
}
56+
57+
public let delegate = WeakSynchronizedDelegate<CGMManagerDelegate>()
4058

4159
public let providesBLEHeartbeat = false
4260

@@ -73,7 +91,9 @@ public class ShareClientManager: CGMManager {
7391
}
7492

7593
// Ignore glucose values that are up to a minute newer than our previous value, to account for possible time shifting in Share data
76-
let startDate = self.cgmManagerDelegate?.startDateToFilterNewData(for: self)?.addingTimeInterval(TimeInterval(minutes: 1))
94+
let startDate = self.delegate.call { (delegate) -> Date? in
95+
return delegate?.startDateToFilterNewData(for: self)?.addingTimeInterval(TimeInterval(minutes: 1))
96+
}
7797
let newGlucose = glucose.filterDateRange(startDate, nil)
7898
let newSamples = newGlucose.filter({ $0.isStateValid }).map {
7999
return NewGlucoseSample(date: $0.startDate, quantity: $0.quantity, isDisplayOnly: false, syncIdentifier: "\(Int($0.startDate.timeIntervalSince1970))", device: self.device)
548 Bytes
Binary file not shown.
550 Bytes
Binary file not shown.
532 Bytes
Binary file not shown.
554 Bytes
Binary file not shown.
550 Bytes
Binary file not shown.
558 Bytes
Binary file not shown.
542 Bytes
Binary file not shown.

ShareClientTests/Info.plist

Lines changed: 1 addition & 1 deletion
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.1</string>
18+
<string>1.2</string>
1919
<key>CFBundleSignature</key>
2020
<string>????</string>
2121
<key>CFBundleVersion</key>

ShareClientUI/Info.plist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<key>CFBundlePackageType</key>
1616
<string>FMWK</string>
1717
<key>CFBundleShortVersionString</key>
18-
<string>1.1</string>
18+
<string>1.2</string>
1919
<key>CFBundleVersion</key>
2020
<string>$(CURRENT_PROJECT_VERSION)</string>
2121
<key>NSPrincipalClass</key>

ShareClientUI/ShareClientManager+UI.swift

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,14 @@ import ShareClient
1111

1212

1313
extension ShareClientManager: CGMManagerUI {
14-
public static func setupViewController() -> (UIViewController & CGMManagerSetupViewController)? {
14+
public static func setupViewController() -> (UIViewController & CGMManagerSetupViewController & CompletionNotifying)? {
1515
return ShareClientSetupViewController()
1616
}
1717

18-
public func settingsViewController(for glucoseUnit: HKUnit) -> UIViewController {
19-
return ShareClientSettingsViewController(cgmManager: self, glucoseUnit: glucoseUnit, allowsDeletion: true)
18+
public func settingsViewController(for glucoseUnit: HKUnit) -> (UIViewController & CompletionNotifying) {
19+
let settings = ShareClientSettingsViewController(cgmManager: self, glucoseUnit: glucoseUnit, allowsDeletion: true)
20+
let nav = SettingsNavigationViewController(rootViewController: settings)
21+
return nav
2022
}
2123

2224
public var smallImage: UIImage? {

ShareClientUI/ShareClientSettingsViewController.swift

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,19 @@ public class ShareClientSettingsViewController: UITableViewController {
4545

4646
tableView.register(SettingsTableViewCell.self, forCellReuseIdentifier: SettingsTableViewCell.className)
4747
tableView.register(TextButtonTableViewCell.self, forCellReuseIdentifier: TextButtonTableViewCell.className)
48+
49+
let button = UIBarButtonItem(barButtonSystemItem: .done, target: self, action: #selector(doneTapped(_:)))
50+
self.navigationItem.setRightBarButton(button, animated: false)
51+
}
52+
53+
@objc func doneTapped(_ sender: Any) {
54+
complete()
55+
}
56+
57+
private func complete() {
58+
if let nav = navigationController as? SettingsNavigationViewController {
59+
nav.notifyComplete()
60+
}
4861
}
4962

5063
// MARK: - UITableViewDataSource
@@ -167,8 +180,11 @@ public class ShareClientSettingsViewController: UITableViewController {
167180
tableView.deselectRow(at: indexPath, animated: true)
168181
case .delete:
169182
let confirmVC = UIAlertController(cgmDeletionHandler: {
170-
self.cgmManager.cgmManagerDelegate?.cgmManagerWantsDeletion(self.cgmManager)
171-
self.navigationController?.popViewController(animated: true)
183+
self.cgmManager.notifyDelegateOfDeletion {
184+
DispatchQueue.main.async {
185+
self.complete()
186+
}
187+
}
172188
})
173189

174190
present(confirmVC, animated: true) {

ShareClientUI/ShareClientSetupViewController.swift

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,11 @@ import LoopKitUI
1111
import ShareClient
1212

1313

14-
class ShareClientSetupViewController: UINavigationController, CGMManagerSetupViewController {
14+
class ShareClientSetupViewController: UINavigationController, CGMManagerSetupViewController, CompletionNotifying {
1515
var setupDelegate: CGMManagerSetupViewControllerDelegate?
1616

17+
weak var completionDelegate: CompletionDelegate?
18+
1719
let cgmManager = ShareClientManager()
1820

1921
init() {
@@ -37,11 +39,11 @@ class ShareClientSetupViewController: UINavigationController, CGMManagerSetupVie
3739
}
3840

3941
@objc private func cancel() {
40-
setupDelegate?.cgmManagerSetupViewControllerDidCancel(self)
42+
completionDelegate?.completionNotifyingDidComplete(self)
4143
}
4244

4345
@objc private func save() {
4446
setupDelegate?.cgmManagerSetupViewController(self, didSetUpCGMManager: cgmManager)
47+
completionDelegate?.completionNotifyingDidComplete(self)
4548
}
46-
4749
}
2.07 KB
Binary file not shown.
1.05 KB
Binary file not shown.
1.09 KB
Binary file not shown.
2.03 KB
Binary file not shown.
1.06 KB
Binary file not shown.
1.08 KB
Binary file not shown.
1.87 KB
Binary file not shown.
1.07 KB
Binary file not shown.
802 Bytes
Binary file not shown.
1.07 KB
Binary file not shown.
2.04 KB
Binary file not shown.
2.03 KB
Binary file not shown.
1.08 KB
Binary file not shown.
2.04 KB
Binary file not shown.
2.13 KB
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)