From b9361941e15bc2c57f88f51d5701d20dc3e47946 Mon Sep 17 00:00:00 2001 From: Michael Cavallaro Date: Wed, 14 Aug 2024 23:03:26 -0600 Subject: [PATCH] chore: bump version to 1.1.8 --- CommandBarIOS.podspec | 2 +- Example/CommandBarIOS/Views/HomeView.swift | 6 ++--- Example/Podfile.lock | 4 +-- .../Local Podspecs/CommandBarIOS.podspec.json | 4 +-- Example/Pods/Manifest.lock | 4 +-- .../CommandBarIOS/CommandBarIOS-Info.plist | 2 +- .../CommandBarIOS/CommandBar/CommandBar.swift | 14 +++-------- .../CommandBar/InternalSDK.swift | 7 ------ Sources/CommandBarIOS/CommandBar/SDK.swift | 25 +++---------------- .../HelpHub/HelpHubViewController.swift | 12 ++++++--- 10 files changed, 26 insertions(+), 54 deletions(-) diff --git a/CommandBarIOS.podspec b/CommandBarIOS.podspec index 0041484..0746189 100644 --- a/CommandBarIOS.podspec +++ b/CommandBarIOS.podspec @@ -8,7 +8,7 @@ Pod::Spec.new do |s| s.name = 'CommandBarIOS' - s.version = '1.1.7' + s.version = '1.1.8' s.summary = 'HelpHub and Copilot Command Bar for iOS. ' # This description is used to generate tags and improve search results. diff --git a/Example/CommandBarIOS/Views/HomeView.swift b/Example/CommandBarIOS/Views/HomeView.swift index 64142b6..11cbc0e 100644 --- a/Example/CommandBarIOS/Views/HomeView.swift +++ b/Example/CommandBarIOS/Views/HomeView.swift @@ -13,9 +13,9 @@ import CommandBarIOS struct HomeView: View { @State private var showingAlert = false - var ORG_ID = "foocorp" + var ORG_ID = "" - func onCopilotFallback(withType type: String) { + func onFallbackAction(withType type: String) { CommandBarSDK.shared.closeHelpHub() self.showingAlert = true } @@ -37,7 +37,7 @@ struct HomeView: View { VStack() { CustomButton(title: "Open HelpHub") { // 4. Open HelpHub - CommandBarSDK.shared.openHelpHub(articleId: nil, withCopilotFallback: onCopilotFallback) + CommandBarSDK.shared.openHelpHub(articleId: nil, withFallbackAction: onFallbackAction) }.alert(isPresented: $showingAlert) { Alert(title: Text("Copilot Fallback Triggered"), message: Text("You can use this to trigger opening up a third party chat provider or handle custom behavior when copilot can't find an answer or when the user triggers a fallback action!"), dismissButton: .default(Text("Got it!"))) } diff --git a/Example/Podfile.lock b/Example/Podfile.lock index bf53d94..914ed22 100644 --- a/Example/Podfile.lock +++ b/Example/Podfile.lock @@ -1,5 +1,5 @@ PODS: - - CommandBarIOS (1.1.7) + - CommandBarIOS (1.1.8) DEPENDENCIES: - CommandBarIOS (from `../`) @@ -9,7 +9,7 @@ EXTERNAL SOURCES: :path: "../" SPEC CHECKSUMS: - CommandBarIOS: 705ef945e447d760e28471edce5060f4f8b3d7d0 + CommandBarIOS: bc7460b0feb981653c3333eaeecdc523efd85d21 PODFILE CHECKSUM: 6d9bb10e6d829f27934a51717623c1fd87cac734 diff --git a/Example/Pods/Local Podspecs/CommandBarIOS.podspec.json b/Example/Pods/Local Podspecs/CommandBarIOS.podspec.json index dda93c0..4c4b9ce 100644 --- a/Example/Pods/Local Podspecs/CommandBarIOS.podspec.json +++ b/Example/Pods/Local Podspecs/CommandBarIOS.podspec.json @@ -1,6 +1,6 @@ { "name": "CommandBarIOS", - "version": "1.1.7", + "version": "1.1.8", "summary": "HelpHub and Copilot Command Bar for iOS.", "description": "TODO: Add long description of the pod here.", "homepage": "https://github.com/tryfoobar/CommandBarIOS", @@ -13,7 +13,7 @@ }, "source": { "git": "https://github.com/tryfoobar/CommandBarIOS.git", - "tag": "1.1.7" + "tag": "1.1.8" }, "platforms": { "ios": "13.0" diff --git a/Example/Pods/Manifest.lock b/Example/Pods/Manifest.lock index bf53d94..914ed22 100644 --- a/Example/Pods/Manifest.lock +++ b/Example/Pods/Manifest.lock @@ -1,5 +1,5 @@ PODS: - - CommandBarIOS (1.1.7) + - CommandBarIOS (1.1.8) DEPENDENCIES: - CommandBarIOS (from `../`) @@ -9,7 +9,7 @@ EXTERNAL SOURCES: :path: "../" SPEC CHECKSUMS: - CommandBarIOS: 705ef945e447d760e28471edce5060f4f8b3d7d0 + CommandBarIOS: bc7460b0feb981653c3333eaeecdc523efd85d21 PODFILE CHECKSUM: 6d9bb10e6d829f27934a51717623c1fd87cac734 diff --git a/Example/Pods/Target Support Files/CommandBarIOS/CommandBarIOS-Info.plist b/Example/Pods/Target Support Files/CommandBarIOS/CommandBarIOS-Info.plist index 48d83c3..0fdae5f 100644 --- a/Example/Pods/Target Support Files/CommandBarIOS/CommandBarIOS-Info.plist +++ b/Example/Pods/Target Support Files/CommandBarIOS/CommandBarIOS-Info.plist @@ -15,7 +15,7 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 1.1.7 + 1.1.8 CFBundleSignature ???? CFBundleVersion diff --git a/Sources/CommandBarIOS/CommandBar/CommandBar.swift b/Sources/CommandBarIOS/CommandBar/CommandBar.swift index 13d1dd5..bbde4b6 100644 --- a/Sources/CommandBarIOS/CommandBar/CommandBar.swift +++ b/Sources/CommandBarIOS/CommandBar/CommandBar.swift @@ -4,17 +4,15 @@ import WebKit public class CommandBar_Deprecated { private var options: CommandBarOptions_Deprecated; - public weak var delegate: HelpHubWebViewDelegate? // Add this property - private weak var presentedNavigationController: UINavigationController? // Add this property + private weak var presentedNavigationController: UINavigationController? public init(options: CommandBarOptions_Deprecated) { self.options = options } - public func openHelpHub(articleId: Int? = nil) { + public func openHelpHub(articleId: Int? = nil, fallbackAction: ((String) -> Void)? = nil) { DispatchQueue.main.async { - let viewController = HelpHubViewController(options: self.options, articleId: articleId) - viewController.delegate = self + let viewController = HelpHubViewController(options: self.options, articleId: articleId, fallbackAction: fallbackAction) let navigationController = UINavigationController(rootViewController: viewController) navigationController.modalPresentationStyle = .pageSheet @@ -31,9 +29,3 @@ public class CommandBar_Deprecated { presentedNavigationController = nil } } - -extension CommandBar_Deprecated : HelpHubWebViewDelegate { - public func didTriggerCopilotFallback(_ action: [String : Any]) { - self.delegate?.didTriggerCopilotFallback(action) - } -} diff --git a/Sources/CommandBarIOS/CommandBar/InternalSDK.swift b/Sources/CommandBarIOS/CommandBar/InternalSDK.swift index 6048716..2bc4cd8 100644 --- a/Sources/CommandBarIOS/CommandBar/InternalSDK.swift +++ b/Sources/CommandBarIOS/CommandBar/InternalSDK.swift @@ -3,8 +3,6 @@ import Foundation protocol CommandBarInternalSDKDelegate: AnyObject { func didBootComplete(withConfig config: Config) func didBootFail(withError error: Error?) - - func didTriggerCopilotFallback(withType type: String) } // MARK: Internal SDK @@ -43,9 +41,4 @@ final class CommandBarInternalSDK : CommandBarInternalSDKDelegate { print("Failed to boot CommandBar: \(String(describing: error))") CommandBarInternalSDK.shared.delegate?.didBootFail(withError: error) } - - func didTriggerCopilotFallback(withType type: String) { - CommandBarInternalSDK.shared.delegate?.didTriggerCopilotFallback(withType: type) - } - } diff --git a/Sources/CommandBarIOS/CommandBar/SDK.swift b/Sources/CommandBarIOS/CommandBar/SDK.swift index f7c49bc..893f32d 100644 --- a/Sources/CommandBarIOS/CommandBar/SDK.swift +++ b/Sources/CommandBarIOS/CommandBar/SDK.swift @@ -22,8 +22,6 @@ public final class CommandBarSDK { public weak var delegate: CommandBarSDKDelegate? weak var privateDelagate: CommandBarInternalSDK? - private var copilotFallbackAction: ((String) -> Void)? = nil - public init() { self.orgId = nil self.options = nil @@ -32,16 +30,14 @@ public final class CommandBarSDK { public func boot(_ orgId: String, with options: CommandBarOptions? = nil) { self.orgId = orgId self.options = options - self.commandbar = CommandBar_Deprecated(options: CommandBarOptions_Deprecated(["orgId": orgId, "launchCode": "local" ])) - self.commandbar?.delegate = self + self.commandbar = CommandBar_Deprecated(options: CommandBarOptions_Deprecated(["orgId": orgId, "launchCode": "prod" ])) CommandBarSDK.sharedInternal.boot(orgId: orgId, with: options) } - public func openHelpHub(articleId: Int? = nil, withCopilotFallback copilotFallbackCallback: ((String) -> Void)? = nil) { + public func openHelpHub(articleId: Int? = nil, withFallbackAction fallbackAction: ((String) -> Void)? = nil) { guard let orgId = CommandBarSDK.shared.orgId else { return } - self.copilotFallbackAction = copilotFallbackCallback - commandbar?.openHelpHub(articleId: articleId) + commandbar?.openHelpHub(articleId: articleId, fallbackAction: fallbackAction) } public func closeHelpHub() { @@ -60,19 +56,4 @@ extension CommandBarSDK : CommandBarInternalSDKDelegate { func didBootFail(withError error: Error?) { CommandBarSDK.shared.delegate?.didFinishBooting(withError: error) } - - func didTriggerCopilotFallback(withType type: String) { - CommandBarSDK.shared.delegate?.didTriggerCopilotFallback(withType: type) - } -} - -extension CommandBarSDK : HelpHubWebViewDelegate { - public func didTriggerCopilotFallback(_ action: [String : Any]) { - let meta = action["meta"] as? [String: Any] ?? [:] - let type = meta["type"] as? String ?? "" - - if (self.copilotFallbackAction != nil) { - self.copilotFallbackAction!(type) - } - } } diff --git a/Sources/CommandBarIOS/HelpHub/HelpHubViewController.swift b/Sources/CommandBarIOS/HelpHub/HelpHubViewController.swift index 3c15f08..77c668f 100644 --- a/Sources/CommandBarIOS/HelpHub/HelpHubViewController.swift +++ b/Sources/CommandBarIOS/HelpHub/HelpHubViewController.swift @@ -5,12 +5,13 @@ public class HelpHubViewController: UIViewController { var helpHubView: HelpHubWebView! private var options: CommandBarOptions_Deprecated public var delegate: HelpHubWebViewDelegate? - + private var fallbackAction: ((String) -> Void)? private var articleId: Int? - public init(options: CommandBarOptions_Deprecated, articleId: Int? = nil) { + public init(options: CommandBarOptions_Deprecated, articleId: Int? = nil, fallbackAction: ((String) -> Void)? = nil) { self.options = options self.articleId = articleId + self.fallbackAction = fallbackAction super.init(nibName: nil, bundle: nil) } @@ -43,6 +44,11 @@ public class HelpHubViewController: UIViewController { extension HelpHubViewController : HelpHubWebViewDelegate { public func didTriggerCopilotFallback(_ action: [String : Any]) { - self.delegate?.didTriggerCopilotFallback(action) + let meta = action["meta"] as? [String: Any] ?? [:] + let type = meta["type"] as? String ?? "" + + if (self.fallbackAction != nil) { + self.fallbackAction!(type) + } } }