Skip to content

Commit

Permalink
Swift package prep (LoopKit#459)
Browse files Browse the repository at this point in the history
* LoopKit and LoopKitTests compiling

* LoopKitUI compiling

* Adding missing files

* MockKit, MockKitUI, and LoopTestingKit building in package

* Building via project file after restructuring

* Revert fixture location change

* Fix failing tests after hk hang fix

* Update circleci config

* Update resource class

* Remove resource class

* Show full log

* Add additional expectation to ensure anchor is fetched before asserting

* Add more prints

* Avoid instantiating full DeviceDataManager for example app during test running

* Log query anchor storage

* more prints

* Do not create observer query during authorization if anchor has not been fetched

* Wait until cacheStore ready for several tests

* Prevent race conditions for starting observer query based on hk auth status, and anchor query availability

* Cleanup

* Test observer query is created when authorization is already specified on startup

* Fix race condition in test

* Add extensions to LoopKit-watchOS

* Move strings files to subdirectory

* Add swift package build to circleci

* Move resources into subdirectories

* Pipe swift build output to xcpretty
  • Loading branch information
ps2 authored Mar 10, 2023
1 parent 016f6d9 commit 4ca39ce
Show file tree
Hide file tree
Showing 265 changed files with 1,656 additions and 455 deletions.
8 changes: 6 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,17 @@ jobs:
test:
working_directory: *project_directory
macos:
xcode: 13.4.1
xcode: 14.2.0
steps:
- checkout
- run:
name: Test
command: |
set -o pipefail && xcodebuild -project LoopKit.xcodeproj -scheme Shared build -destination 'name=iPhone 8' test | xcpretty
set -o pipefail && xcodebuild -project LoopKit.xcodeproj -scheme Shared build -destination 'name=iPhone 14' test | xcpretty
- run:
name: Build Swift Package
command: |
swift build -v -Xswiftc "-sdk" -Xswiftc "`xcrun --sdk iphonesimulator --show-sdk-path`" -Xswiftc "-target" -Xswiftc "x86_64-apple-ios15.0-simulator" | xcpretty
- store_test_results:
path: test_output
#
Expand Down
7 changes: 7 additions & 0 deletions .swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 0 additions & 21 deletions Common/LocalizedString.swift

This file was deleted.

22 changes: 0 additions & 22 deletions Extensions/UIColor.swift

This file was deleted.

12 changes: 0 additions & 12 deletions LoopKit Example/Extensions/CarbEntryTableViewController.swift

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
44 changes: 23 additions & 21 deletions LoopKit Example/MasterViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,15 @@ import HealthKit

class MasterViewController: UITableViewController {

private var dataManager: DeviceDataManager? = DeviceDataManager()
private var dataManager: DeviceDataManager?

override func viewDidLoad() {
super.viewDidLoad()

if ProcessInfo.processInfo.environment["XCTestConfigurationFilePath"] == nil {
dataManager = DeviceDataManager()
}
}

override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
Expand Down Expand Up @@ -89,28 +97,28 @@ class MasterViewController: UITableViewController {
case .configuration:
switch ConfigurationRow(rawValue: indexPath.row)! {
case .basalRate:
cell.textLabel?.text = LocalizedString("Basal Rates", comment: "The title text for the basal rate schedule")
cell.textLabel?.text = NSLocalizedString("Basal Rates", comment: "The title text for the basal rate schedule")
case .carbRatio:
cell.textLabel?.text = LocalizedString("Carb Ratios", comment: "The title of the carb ratios schedule screen")
cell.textLabel?.text = NSLocalizedString("Carb Ratios", comment: "The title of the carb ratios schedule screen")
case .correctionRange:
cell.textLabel?.text = LocalizedString("Correction Range", comment: "The title text for the glucose correction range schedule")
cell.textLabel?.text = NSLocalizedString("Correction Range", comment: "The title text for the glucose correction range schedule")
case .insulinSensitivity:
cell.textLabel?.text = LocalizedString("Insulin Sensitivity", comment: "The title text for the insulin sensitivity schedule")
cell.textLabel?.text = NSLocalizedString("Insulin Sensitivity", comment: "The title text for the insulin sensitivity schedule")
case .pumpID:
cell.textLabel?.text = LocalizedString("Pump ID", comment: "The title text for the pump ID")
cell.textLabel?.text = NSLocalizedString("Pump ID", comment: "The title text for the pump ID")
}
case .data:
switch DataRow(rawValue: indexPath.row)! {
case .carbs:
cell.textLabel?.text = LocalizedString("Carbs", comment: "The title for the cell navigating to the carbs screen")
cell.textLabel?.text = NSLocalizedString("Carbs", comment: "The title for the cell navigating to the carbs screen")
case .reservoir:
cell.textLabel?.text = LocalizedString("Reservoir", comment: "The title for the cell navigating to the reservoir screen")
cell.textLabel?.text = NSLocalizedString("Reservoir", comment: "The title for the cell navigating to the reservoir screen")
case .diagnostic:
cell.textLabel?.text = LocalizedString("Diagnostic", comment: "The title for the cell displaying diagnostic data")
cell.textLabel?.text = NSLocalizedString("Diagnostic", comment: "The title for the cell displaying diagnostic data")
case .generate:
cell.textLabel?.text = LocalizedString("Generate Data", comment: "The title for the cell displaying data generation")
cell.textLabel?.text = NSLocalizedString("Generate Data", comment: "The title for the cell displaying data generation")
case .reset:
cell.textLabel?.text = LocalizedString("Reset", comment: "Title for the cell resetting the data manager")
cell.textLabel?.text = NSLocalizedString("Reset", comment: "Title for the cell resetting the data manager")
}
}

Expand Down Expand Up @@ -194,10 +202,10 @@ class MasterViewController: UITableViewController {

// textFieldVC.delegate = self
textFieldVC.title = sender?.textLabel?.text
textFieldVC.placeholder = LocalizedString("Enter the 6-digit pump ID", comment: "The placeholder text instructing users how to enter a pump ID")
textFieldVC.placeholder = NSLocalizedString("Enter the 6-digit pump ID", comment: "The placeholder text instructing users how to enter a pump ID")
textFieldVC.value = dataManager?.pumpID
textFieldVC.keyboardType = .numberPad
textFieldVC.contextHelp = LocalizedString("The pump ID can be found printed on the back, or near the bottom of the STATUS/Esc screen. It is the strictly numerical portion of the serial number (shown as SN or S/N).", comment: "Instructions on where to find the pump ID on a Minimed pump")
textFieldVC.contextHelp = NSLocalizedString("The pump ID can be found printed on the back, or near the bottom of the STATUS/Esc screen. It is the strictly numerical portion of the serial number (shown as SN or S/N).", comment: "Instructions on where to find the pump ID on a Minimed pump")

show(textFieldVC, sender: sender)
default:
Expand All @@ -206,7 +214,8 @@ class MasterViewController: UITableViewController {
case .data:
switch DataRow(rawValue: indexPath.row)! {
case .carbs:
performSegue(withIdentifier: CarbEntryTableViewController.className, sender: sender)
//performSegue(withIdentifier: CarbEntryTableViewController.className, sender: sender)
break
case .reservoir:
performSegue(withIdentifier: LegacyInsulinDeliveryTableViewController.className, sender: sender)
case .diagnostic:
Expand Down Expand Up @@ -311,13 +320,6 @@ class MasterViewController: UITableViewController {
}

switch targetViewController {
case let vc as CarbEntryTableViewController:
vc.carbStore = dataManager?.carbStore
case let vc as CarbEntryEditViewController:
if let carbStore = dataManager?.carbStore {
vc.defaultAbsorptionTimes = carbStore.defaultAbsorptionTimes
vc.preferredUnit = carbStore.preferredUnit
}
case let vc as LegacyInsulinDeliveryTableViewController:
vc.doseStore = dataManager?.doseStore
default:
Expand Down
Loading

0 comments on commit 4ca39ce

Please sign in to comment.