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

Tidepool Merge #26

Open
wants to merge 17 commits into
base: dev
Choose a base branch
from
Open
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
5 changes: 3 additions & 2 deletions LoopOnboardingKitUI/LoopOnboardingUI.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,14 @@ import LoopKitUI
import LoopOnboardingKit

public final class LoopOnboardingUI: OnboardingUI {

public static func createOnboarding() -> OnboardingUI {
return Self()
}

public weak var onboardingDelegate: OnboardingDelegate?

public static let pluginIdentifier = "LoopOnboarding"
public let pluginIdentifier = "LoopOnboarding"

public var isOnboarded: Bool {
didSet {
Expand Down Expand Up @@ -53,7 +54,7 @@ public final class LoopOnboardingUI: OnboardingUI {
]
}

public func onboardingViewController(onboardingProvider: OnboardingProvider, displayGlucosePreference: DisplayGlucosePreference, colorPalette: LoopUIColorPalette) -> (UIViewController & OnboardingViewController) {
public func onboardingViewController(onboardingProvider: OnboardingProvider, displayGlucosePreference: DisplayGlucosePreference, colorPalette: LoopUIColorPalette, adultChildInsulinModelSelectionEnabled: Bool) -> (UIViewController & OnboardingViewController) {
return OnboardingUICoordinator(onboarding: self, onboardingProvider: onboardingProvider, initialTherapySettings: onboardingProvider.onboardingTherapySettings, displayGlucosePreference: displayGlucosePreference, colorPalette: colorPalette)
}

Expand Down
32 changes: 16 additions & 16 deletions LoopOnboardingKitUI/View Controllers/OnboardingUICoordinator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ import SwiftUI
import LoopKit
import LoopKitUI
import NightscoutServiceKit
import NightscoutServiceKitUI
import LoopSupportKitUI
import LoopAlgorithm

enum OnboardingScreen: CaseIterable {
case welcome
Expand Down Expand Up @@ -271,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, allowDebugFeatures: onboardingProvider.allowDebugFeatures)
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 Expand Up @@ -349,16 +347,18 @@ class OnboardingUICoordinator: UINavigationController, CGMManagerOnboarding, Pum
}

extension OnboardingUICoordinator: TherapySettingsViewModelDelegate {

func syncBasalRateSchedule(items: [RepeatingScheduleValue<Double>], completion: @escaping (Result<BasalRateSchedule, Error>) -> Void) {
// Since pump isn't set up, this syncing shouldn't do anything
assertionFailure()
}

func syncDeliveryLimits(deliveryLimits: DeliveryLimits, completion: @escaping (Result<DeliveryLimits, Error>) -> Void) {
func syncDeliveryLimits(deliveryLimits: LoopKit.DeliveryLimits) async throws -> LoopKit.DeliveryLimits {
// Since pump isn't set up, this syncing shouldn't do anything
assertionFailure()
return deliveryLimits
}

func saveCompletion(therapySettings: TherapySettings) {
stepFinished()
}
Expand Down
3 changes: 3 additions & 0 deletions LoopOnboardingKitUI/Views/WelcomeView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,13 @@ struct WelcomeView: View {
Text(LocalizedString("Welcome to Loop", comment: "Title on WelcomeView"))
.font(.largeTitle)
.fontWeight(.semibold)

Image(frameworkImage: "Loop", decorative: true)
.onLongPressGesture(minimumDuration: 2) {
didLongPressOnLogo?()
}
.accessibilityHidden(false)
.accessibilityIdentifier("loopLogo")

Text(LocalizedString("Before using Loop you need to configure a few settings. These settings should be entered with precision and care; they are a critical part of how Loop determines the right amount of insulin to deliver.\n\nIf you are new to Loop, work with your diabetes support team to determine the settings that work best for you.", comment: "Descriptive text on WelcomeView"))
.foregroundColor(.secondary)
Expand Down