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
2 changes: 1 addition & 1 deletion Cartfile.resolved
Original file line number Diff line number Diff line change
@@ -1 +1 @@
github "LoopKit/LoopKit" "fff218d34b0d6818a70541c6df5b584968897e53"
github "LoopKit/LoopKit" "7333408f054e269669c91146b0f29bffbdcc150a"
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0940"
LastUpgradeVersion = "1020"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0940"
LastUpgradeVersion = "1020"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
24 changes: 22 additions & 2 deletions ShareClient/ShareClientManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,25 @@ public class ShareClientManager: CGMManager {

public let appURL: URL? = nil

weak public var cgmManagerDelegate: CGMManagerDelegate?
public var cgmManagerDelegate: CGMManagerDelegate? {
get {
return delegate.delegate
}
set {
delegate.delegate = newValue
}
}

public var delegateQueue: DispatchQueue! {
get {
return delegate.queue
}
set {
delegate.queue = newValue
}
}

public let delegate = WeakSynchronizedDelegate<CGMManagerDelegate>()

public let providesBLEHeartbeat = false

Expand Down Expand Up @@ -73,7 +91,9 @@ public class ShareClientManager: CGMManager {
}

// Ignore glucose values that are up to a minute newer than our previous value, to account for possible time shifting in Share data
let startDate = self.cgmManagerDelegate?.startDateToFilterNewData(for: self)?.addingTimeInterval(TimeInterval(minutes: 1))
let startDate = self.delegate.call { (delegate) -> Date? in
return delegate?.startDateToFilterNewData(for: self)?.addingTimeInterval(TimeInterval(minutes: 1))
}
let newGlucose = glucose.filterDateRange(startDate, nil)
let newSamples = newGlucose.filter({ $0.isStateValid }).map {
return NewGlucoseSample(date: $0.startDate, quantity: $0.quantity, isDisplayOnly: false, syncIdentifier: "\(Int($0.startDate.timeIntervalSince1970))", device: self.device)
Expand Down
7 changes: 5 additions & 2 deletions ShareClientUI/ShareClientSettingsViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,11 @@ public class ShareClientSettingsViewController: UITableViewController {
tableView.deselectRow(at: indexPath, animated: true)
case .delete:
let confirmVC = UIAlertController(cgmDeletionHandler: {
self.cgmManager.cgmManagerDelegate?.cgmManagerWantsDeletion(self.cgmManager)
self.complete()
self.cgmManager.notifyDelegateOfDeletion {
DispatchQueue.main.async {
self.complete()
}
}
})

present(confirmVC, animated: true) {
Expand Down