diff --git a/LoopKit/Pluggable.swift b/LoopKit/Pluggable.swift index 7ee8f29da..0eaa53f3e 100644 --- a/LoopKit/Pluggable.swift +++ b/LoopKit/Pluggable.swift @@ -13,8 +13,13 @@ public protocol Pluggable: AnyObject { /// A plugin may need a reference to another plugin. This callback allows for such a reference. /// It is called once during app initialization after plugins are initialized and again as new plugins are added and initialized. func initializationComplete(for pluggables: [Pluggable]) + + /// A plugin may require another plugin. This callback informs this dependency. + /// Often this is called as apart of `initializationComplete(for pluggables: [Pluggable])` + func markAsDepedency(_ isDependency: Bool) } public extension Pluggable { func initializationComplete(for pluggables: [Pluggable]) { } // optional + func markAsDepedency(_ isDependency: Bool) { } // optional } diff --git a/LoopKitUI/ServiceUI.swift b/LoopKitUI/ServiceUI.swift index 767104e9e..512d9ca6b 100644 --- a/LoopKitUI/ServiceUI.swift +++ b/LoopKitUI/ServiceUI.swift @@ -31,14 +31,14 @@ public protocol ServiceUI: Service { /// - colorPalette: Color palette to use for any UI. /// - pluginHost: Object that provides namd and version information about host to the service plugin. /// - Returns: Either a conforming view controller to create and onboard the service or a newly created and onboarded service. - static func setupViewController(colorPalette: LoopUIColorPalette, pluginHost: PluginHost) -> SetupUIResult + static func setupViewController(colorPalette: LoopUIColorPalette, pluginHost: PluginHost, allowDebugFeatures: Bool) -> SetupUIResult /// Configure settings for an existing service. /// /// - Parameters: /// - colorPalette: Color palette to use for any UI. /// - Returns: A view controller to configure an existing service. - func settingsViewController(colorPalette: LoopUIColorPalette) -> ServiceViewController + func settingsViewController(colorPalette: LoopUIColorPalette, allowDebugFeatures: Bool) -> ServiceViewController } public extension ServiceUI { diff --git a/MockKitUI/MockService+UI.swift b/MockKitUI/MockService+UI.swift index e3ff7495e..51463efcf 100644 --- a/MockKitUI/MockService+UI.swift +++ b/MockKitUI/MockService+UI.swift @@ -17,11 +17,11 @@ extension MockService: ServiceUI { return UIImage(systemName: "icloud.and.arrow.up") } - public static func setupViewController(colorPalette: LoopUIColorPalette, pluginHost: PluginHost) -> SetupUIResult { + public static func setupViewController(colorPalette: LoopUIColorPalette, pluginHost: PluginHost, allowDebugFeatures: Bool) -> SetupUIResult { return .userInteractionRequired(ServiceNavigationController(rootViewController: MockServiceTableViewController(service: MockService(), for: .create))) } - public func settingsViewController(colorPalette: LoopUIColorPalette) -> ServiceViewController { + public func settingsViewController(colorPalette: LoopUIColorPalette, allowDebugFeatures: Bool) -> ServiceViewController { return ServiceNavigationController(rootViewController: MockServiceTableViewController(service: self, for: .update)) }