From 5f927fb53581d93e31760bcca1a793db9489eb95 Mon Sep 17 00:00:00 2001 From: rsarika <95286093+rsarika@users.noreply.github.com> Date: Tue, 7 May 2024 21:37:42 +0530 Subject: [PATCH] Release/3.11.2 (#75) * 3.11.2 release * added example secretsplist --- KitchenSink.xcodeproj/project.pbxproj | 8 ++--- KitchenSink/AppDelegate.swift | 29 ++++++++++++--- .../Controllers/HomeViewController.swift | 36 ++++++++++++------- KitchenSink/Secrets.plist.example | 10 ++++++ Podfile | 8 ++--- 5 files changed, 66 insertions(+), 25 deletions(-) create mode 100644 KitchenSink/Secrets.plist.example diff --git a/KitchenSink.xcodeproj/project.pbxproj b/KitchenSink.xcodeproj/project.pbxproj index aa92a29..6389481 100644 --- a/KitchenSink.xcodeproj/project.pbxproj +++ b/KitchenSink.xcodeproj/project.pbxproj @@ -1706,7 +1706,7 @@ CODE_SIGN_ENTITLEMENTS = KitchenSink/KitchenSink.entitlements; CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 31100; + CURRENT_PROJECT_VERSION = 31120; DEVELOPMENT_TEAM = 9X38D433RE; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( @@ -1729,7 +1729,7 @@ "@executable_path/Frameworks", executable_path/Frameworks, ); - MARKETING_VERSION = 3.11.0; + MARKETING_VERSION = 3.11.2; MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; MTL_FAST_MATH = YES; PRODUCT_BUNDLE_IDENTIFIER = com.webex.sdk.KitchenSinkv3.0; @@ -1766,7 +1766,7 @@ CODE_SIGN_ENTITLEMENTS = KitchenSink/KitchenSink.entitlements; CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 31100; + CURRENT_PROJECT_VERSION = 31120; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEVELOPMENT_TEAM = 9X38D433RE; ENABLE_BITCODE = NO; @@ -1785,7 +1785,7 @@ "@executable_path/Frameworks", executable_path/Frameworks, ); - MARKETING_VERSION = 3.11.0; + MARKETING_VERSION = 3.11.2; MTL_FAST_MATH = YES; PRODUCT_BUNDLE_IDENTIFIER = com.webex.sdk.KitchenSinkv3.0; PRODUCT_NAME = "$(TARGET_NAME)"; diff --git a/KitchenSink/AppDelegate.swift b/KitchenSink/AppDelegate.swift index 416e581..2bdbb69 100644 --- a/KitchenSink/AppDelegate.swift +++ b/KitchenSink/AppDelegate.swift @@ -237,7 +237,7 @@ extension AppDelegate: PKPushRegistryDelegate { processVoipPush(payload: payload) return } - + guard let authType = UserDefaults.standard.string(forKey: Constants.loginTypeKey) else { return } if authType == Constants.loginTypeValue.jwt.rawValue { initWebexUsingJWT() @@ -260,7 +260,7 @@ extension AppDelegate: PKPushRegistryDelegate { } } } - + func initWebexUsingOauth() { guard let path = Bundle.main.path(forResource: "Secrets", ofType: "plist") else { return } guard let keys = NSDictionary(contentsOfFile: path) else { return } @@ -268,7 +268,7 @@ extension AppDelegate: PKPushRegistryDelegate { let clientSecret = keys["clientSecret"] as? String ?? "" let redirectUri = keys["redirectUri"] as? String ?? "" let scopes = "spark:all" // spark:all is always mandatory - + // See if we already have an email stored in UserDefaults else get it from user and do new Login if let email = EmailAddress.fromString(UserDefaults.standard.value(forKey: Constants.emailKey) as? String) { // The scope parameter can be a space separated list of scopes that you want your access token to possess @@ -277,13 +277,32 @@ extension AppDelegate: PKPushRegistryDelegate { return } } - + func initWebexUsingJWT() { webex = Webex(authenticator: JWTAuthenticator()) } - + func initWebexUsingToken() { webex = Webex(authenticator: TokenAuthenticator()) } } +extension AppDelegate: WebexAuthDelegate { + func onReLoginRequired() { + print("onReLoginRequired called") + cleanupOnLogout() + } + + func cleanupOnLogout() { + DispatchQueue.main.async { + UIApplication.shared.topViewController()?.dismiss(animated: true) { [weak self] in + DispatchQueue.main.async { + self?.navigateToLoginViewController() + } + } + UserDefaults.standard.removeObject(forKey: Constants.loginTypeKey) + UserDefaults.standard.removeObject(forKey: Constants.emailKey) + UserDefaults.standard.removeObject(forKey: Constants.fedRampKey) + } + } +} diff --git a/KitchenSink/Controllers/HomeViewController.swift b/KitchenSink/Controllers/HomeViewController.swift index bcd949f..991371d 100644 --- a/KitchenSink/Controllers/HomeViewController.swift +++ b/KitchenSink/Controllers/HomeViewController.swift @@ -41,20 +41,24 @@ class HomeViewController: UIViewController, UICollectionViewDataSource, UICollec Feature(title: "Extras", icon: "webhook", tileColor: .momentumGold50, action: { [weak self] in self?.navigationController?.pushViewController(ExtrasViewController(), animated: true) }), - Feature(title: "Logout", icon: "sign-out", tileColor: .momentumRed50, action: { - webex.authenticator?.deauthorize(completionHandler: { - DispatchQueue.main.async { [weak self] in - guard let appDelegate = (UIApplication.shared.delegate as? AppDelegate) else { fatalError() } - self?.navigationController?.dismiss(animated: true) - UserDefaults.standard.removeObject(forKey: Constants.loginTypeKey) - UserDefaults.standard.removeObject(forKey: Constants.emailKey) - UserDefaults.standard.removeObject(forKey: Constants.fedRampKey) - appDelegate.navigateToLoginViewController() - } - }) - }) + Feature(title: "Logout", icon: "sign-out", tileColor: .momentumRed50, action: logout) ] + func logout() { + webex.authenticator?.deauthorize(completionHandler: cleanupOnLogout) + } + + func cleanupOnLogout() { + DispatchQueue.main.async { [weak self] in + guard let appDelegate = (UIApplication.shared.delegate as? AppDelegate) else { fatalError() } + self?.navigationController?.dismiss(animated: true) + UserDefaults.standard.removeObject(forKey: Constants.loginTypeKey) + UserDefaults.standard.removeObject(forKey: Constants.emailKey) + UserDefaults.standard.removeObject(forKey: Constants.fedRampKey) + appDelegate.navigateToLoginViewController() + } + } + private let versionLabel: UILabel = { let label = UILabel() label.translatesAutoresizingMaskIntoConstraints = false @@ -101,6 +105,7 @@ class HomeViewController: UIViewController, UICollectionViewDataSource, UICollec override func viewDidAppear(_ animated: Bool) { super.viewDidAppear(animated) webex.ucLoginDelegate = self + webex.authDelegate = AppDelegate.shared webex.startUCServices() isUCServicesStarted = true webex.messages.onEvent = { messageEvent in @@ -371,6 +376,13 @@ extension HomeViewController { } } +extension HomeViewController: WebexAuthDelegate { + func onReLoginRequired() { + print("onReLoginRequired called") + cleanupOnLogout() + } +} + // MARK: Webex Delegate extension HomeViewController: WebexUCLoginDelegate { func onUCSSOLoginFailed(failureReason: UCSSOFailureReason) { diff --git a/KitchenSink/Secrets.plist.example b/KitchenSink/Secrets.plist.example new file mode 100644 index 0000000..1adf5de --- /dev/null +++ b/KitchenSink/Secrets.plist.example @@ -0,0 +1,10 @@ + + + + + clientId + enter clientId here + clientSecret + enter clientSecret here + + diff --git a/Podfile b/Podfile index 211fab7..33a3bf5 100644 --- a/Podfile +++ b/Podfile @@ -7,9 +7,9 @@ target 'KitchenSink' do use_frameworks! # Pods for KitchenSink - pod 'WebexSDK','~> 3.11.1' - # pod 'WebexSDK/Meeting','~> 3.11.1' # Uncomment this line and comment the above line for Meeting-only SDK - # pod 'WebexSDK/Wxc','~> 3.11.1' # Uncomment this line and comment the above line for Calling-only SDK + pod 'WebexSDK','~> 3.11.2' + # pod 'WebexSDK/Meeting','~> 3.11.2' # Uncomment this line and comment the above line for Meeting-only SDK + # pod 'WebexSDK/Wxc','~> 3.11.2' # Uncomment this line and comment the above line for Calling-only SDK target 'KitchenSinkUITests' do @@ -23,7 +23,7 @@ target 'KitchenSinkBroadcastExtension' do use_frameworks! # Pods for KitchenSinkBroadcastExtension - pod 'WebexBroadcastExtensionKit','~> 3.11.1' + pod 'WebexBroadcastExtensionKit','~> 3.11.2' end