Skip to content

Commit

Permalink
Merge pull request #11 from LoopKit/dev
Browse files Browse the repository at this point in the history
Release 1.2
  • Loading branch information
ps2 authored Dec 31, 2019
2 parents 664a5f2 + 83b89d5 commit b514603
Show file tree
Hide file tree
Showing 39 changed files with 309 additions and 145 deletions.
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ profile
DerivedData
*.hmap
*.ipa
project.xcworkspace

# Bundler
.bundle
Expand All @@ -27,7 +26,7 @@ Carthage
# We recommend against adding the Pods directory to your .gitignore. However
# you should judge for yourself, the pros and cons are mentioned at:
# http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control
#
#
# Note: if you ignore the Pods directory, make sure to uncomment
# `pod install` in .travis.yml
#
Expand Down
8 changes: 5 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
language: objective-c
osx_image: xcode10
osx_image: xcode11

before_script:
- carthage bootstrap

script:
# Build Travis project and run tests
- xcodebuild -project ShareClient.xcodeproj -scheme ShareClient build -destination name="iPhone SE" test
# Build Travis project and run tests
- xcodebuild -project ShareClient.xcodeproj -scheme Shared build -destination name="iPhone 8" test
2 changes: 1 addition & 1 deletion Cartfile
Original file line number Diff line number Diff line change
@@ -1 +1 @@
github "LoopKit/LoopKit" ~> 2.0
github "LoopKit/LoopKit" ~> 3.0
2 changes: 1 addition & 1 deletion Cartfile.resolved
Original file line number Diff line number Diff line change
@@ -1 +1 @@
github "LoopKit/LoopKit" "v2.2.1"
github "LoopKit/LoopKit" "v3.0"
315 changes: 204 additions & 111 deletions ShareClient.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEWorkspaceSharedSettings_AutocreateContextsIfNeeded</key>
<false/>
</dict>
</plist>
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0940"
LastUpgradeVersion = "1020"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
buildImplicitDependencies = "NO">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
Expand All @@ -14,9 +14,9 @@
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "43A8EC81210E664300A81379"
BuildableName = "ShareClientUI.framework"
BlueprintName = "ShareClientUI"
BlueprintIdentifier = "A9ED4D91225EB4D30080DEBA"
BuildableName = "ShareClient.framework"
BlueprintName = "ShareClient-watchOS"
ReferencedContainer = "container:ShareClient.xcodeproj">
</BuildableReference>
</BuildActionEntry>
Expand Down Expand Up @@ -45,9 +45,9 @@
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "43A8EC81210E664300A81379"
BuildableName = "ShareClientUI.framework"
BlueprintName = "ShareClientUI"
BlueprintIdentifier = "A9ED4D91225EB4D30080DEBA"
BuildableName = "ShareClient.framework"
BlueprintName = "ShareClient-watchOS"
ReferencedContainer = "container:ShareClient.xcodeproj">
</BuildableReference>
</MacroExpansion>
Expand All @@ -63,9 +63,9 @@
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "43A8EC81210E664300A81379"
BuildableName = "ShareClientUI.framework"
BlueprintName = "ShareClientUI"
BlueprintIdentifier = "A9ED4D91225EB4D30080DEBA"
BuildableName = "ShareClient.framework"
BlueprintName = "ShareClient-watchOS"
ReferencedContainer = "container:ShareClient.xcodeproj">
</BuildableReference>
</MacroExpansion>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0940"
LastUpgradeVersion = "1020"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
buildImplicitDependencies = "NO">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
Expand All @@ -20,6 +20,20 @@
ReferencedContainer = "container:ShareClient.xcodeproj">
</BuildableReference>
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "43A8EC81210E664300A81379"
BuildableName = "ShareClientUI.framework"
BlueprintName = "ShareClientUI"
ReferencedContainer = "container:ShareClient.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
Expand Down
4 changes: 2 additions & 2 deletions ShareClient/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)-$(PLATFORM_NAME)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.1</string>
<string>1.2</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
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
Binary file added ShareClient/da.lproj/Localizable.strings
Binary file not shown.
Binary file added ShareClient/fi.lproj/Localizable.strings
Binary file not shown.
Binary file added ShareClient/ja.lproj/Localizable.strings
Binary file not shown.
Binary file added ShareClient/pt-BR.lproj/Localizable.strings
Binary file not shown.
Binary file added ShareClient/ro.lproj/Localizable.strings
Binary file not shown.
Binary file added ShareClient/sv.lproj/Localizable.strings
Binary file not shown.
Binary file added ShareClient/vi.lproj/Localizable.strings
Binary file not shown.
2 changes: 1 addition & 1 deletion ShareClientTests/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>1.1</string>
<string>1.2</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
Expand Down
2 changes: 1 addition & 1 deletion ShareClientUI/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.1</string>
<string>1.2</string>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>NSPrincipalClass</key>
Expand Down
8 changes: 5 additions & 3 deletions ShareClientUI/ShareClientManager+UI.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,14 @@ import ShareClient


extension ShareClientManager: CGMManagerUI {
public static func setupViewController() -> (UIViewController & CGMManagerSetupViewController)? {
public static func setupViewController() -> (UIViewController & CGMManagerSetupViewController & CompletionNotifying)? {
return ShareClientSetupViewController()
}

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

public var smallImage: UIImage? {
Expand Down
20 changes: 18 additions & 2 deletions ShareClientUI/ShareClientSettingsViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,19 @@ public class ShareClientSettingsViewController: UITableViewController {

tableView.register(SettingsTableViewCell.self, forCellReuseIdentifier: SettingsTableViewCell.className)
tableView.register(TextButtonTableViewCell.self, forCellReuseIdentifier: TextButtonTableViewCell.className)

let button = UIBarButtonItem(barButtonSystemItem: .done, target: self, action: #selector(doneTapped(_:)))
self.navigationItem.setRightBarButton(button, animated: false)
}

@objc func doneTapped(_ sender: Any) {
complete()
}

private func complete() {
if let nav = navigationController as? SettingsNavigationViewController {
nav.notifyComplete()
}
}

// MARK: - UITableViewDataSource
Expand Down Expand Up @@ -167,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.navigationController?.popViewController(animated: true)
self.cgmManager.notifyDelegateOfDeletion {
DispatchQueue.main.async {
self.complete()
}
}
})

present(confirmVC, animated: true) {
Expand Down
8 changes: 5 additions & 3 deletions ShareClientUI/ShareClientSetupViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@ import LoopKitUI
import ShareClient


class ShareClientSetupViewController: UINavigationController, CGMManagerSetupViewController {
class ShareClientSetupViewController: UINavigationController, CGMManagerSetupViewController, CompletionNotifying {
var setupDelegate: CGMManagerSetupViewControllerDelegate?

weak var completionDelegate: CompletionDelegate?

let cgmManager = ShareClientManager()

init() {
Expand All @@ -37,11 +39,11 @@ class ShareClientSetupViewController: UINavigationController, CGMManagerSetupVie
}

@objc private func cancel() {
setupDelegate?.cgmManagerSetupViewControllerDidCancel(self)
completionDelegate?.completionNotifyingDidComplete(self)
}

@objc private func save() {
setupDelegate?.cgmManagerSetupViewController(self, didSetUpCGMManager: cgmManager)
completionDelegate?.completionNotifyingDidComplete(self)
}

}
Binary file added ShareClientUI/da.lproj/Localizable.strings
Binary file not shown.
Binary file modified ShareClientUI/de.lproj/Localizable.strings
Binary file not shown.
Binary file modified ShareClientUI/es.lproj/Localizable.strings
Binary file not shown.
Binary file added ShareClientUI/fi.lproj/Localizable.strings
Binary file not shown.
Binary file modified ShareClientUI/fr.lproj/Localizable.strings
Binary file not shown.
Binary file modified ShareClientUI/it.lproj/Localizable.strings
Binary file not shown.
Binary file added ShareClientUI/ja.lproj/Localizable.strings
Binary file not shown.
Binary file modified ShareClientUI/nb.lproj/Localizable.strings
Binary file not shown.
Binary file modified ShareClientUI/nl.lproj/Localizable.strings
Binary file not shown.
Binary file modified ShareClientUI/pl.lproj/Localizable.strings
Binary file not shown.
Binary file added ShareClientUI/pt-BR.lproj/Localizable.strings
Binary file not shown.
Binary file added ShareClientUI/ro.lproj/Localizable.strings
Binary file not shown.
Binary file modified ShareClientUI/ru.lproj/Localizable.strings
Binary file not shown.
Binary file added ShareClientUI/sv.lproj/Localizable.strings
Binary file not shown.
Binary file added ShareClientUI/vi.lproj/Localizable.strings
Binary file not shown.
Binary file modified ShareClientUI/zh-Hans.lproj/Localizable.strings
Binary file not shown.

0 comments on commit b514603

Please sign in to comment.