Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LOOP-5122 Onboard nightscout service directly #34

Merged
merged 1 commit into from
Oct 25, 2024
Merged
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
25 changes: 11 additions & 14 deletions LoopOnboardingKitUI/View Controllers/OnboardingUICoordinator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import SwiftUI
import LoopKit
import LoopKitUI
import NightscoutServiceKit
import NightscoutServiceKitUI
import LoopSupportKitUI
import LoopAlgorithm

Expand Down Expand Up @@ -272,20 +273,16 @@ class OnboardingUICoordinator: UINavigationController, CGMManagerOnboarding, Pum

private func setupWithNightscout() {
LoopKitAnalytics.shared.recordAnalyticsEvent("Onboarding With Nightscout", withProperties: nil, outOfSession: false)
switch onboardingProvider.onboardService(withIdentifier: OnboardingUICoordinator.serviceIdentifier) {
case .failure(let error):
log.debug("Failure to create and setup service with identifier '%{public}@': %{public}@", OnboardingUICoordinator.serviceIdentifier, String(describing: error))
case .success(let success):
switch success {
case .userInteractionRequired(var setupViewController):
nightscoutOnboardingViewController = setupViewController
setupViewController.serviceOnboardingDelegate = self
setupViewController.completionDelegate = self
show(setupViewController, sender: self)
case .createdAndOnboarded(let service):
self.service = service
checkForAvailableSettingsImport()
}
let result = NightscoutService.setupViewController(colorPalette: colorPalette, pluginHost: onboardingProvider)
switch result {
case .userInteractionRequired(var setupViewController):
nightscoutOnboardingViewController = setupViewController
setupViewController.serviceOnboardingDelegate = self
setupViewController.completionDelegate = self
show(setupViewController, sender: self)
case .createdAndOnboarded(let service):
self.service = service
checkForAvailableSettingsImport()
}
}

Expand Down