Skip to content

Commit

Permalink
Release/3.11.2 (#75)
Browse files Browse the repository at this point in the history
* 3.11.2 release

* added example secretsplist
  • Loading branch information
rsarika authored May 7, 2024
1 parent 7b31579 commit 5f927fb
Show file tree
Hide file tree
Showing 5 changed files with 66 additions and 25 deletions.
8 changes: 4 additions & 4 deletions KitchenSink.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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 = (
Expand All @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -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)";
Expand Down
29 changes: 24 additions & 5 deletions KitchenSink/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -260,15 +260,15 @@ 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 }
let clientId = keys["clientId"] as? String ?? ""
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
Expand All @@ -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)
}
}
}
36 changes: 24 additions & 12 deletions KitchenSink/Controllers/HomeViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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) {
Expand Down
10 changes: 10 additions & 0 deletions KitchenSink/Secrets.plist.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>clientId</key>
<string>enter clientId here</string>
<key>clientSecret</key>
<string>enter clientSecret here</string>
</dict>
</plist>
8 changes: 4 additions & 4 deletions Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -23,7 +23,7 @@ target 'KitchenSinkBroadcastExtension' do
use_frameworks!

# Pods for KitchenSinkBroadcastExtension
pod 'WebexBroadcastExtensionKit','~> 3.11.1'
pod 'WebexBroadcastExtensionKit','~> 3.11.2'

end

0 comments on commit 5f927fb

Please sign in to comment.