Skip to content

Commit

Permalink
@W-16362973: [iOS] Add QR Code Login Support in MSDK (Introduce `isQr…
Browse files Browse the repository at this point in the history
…CodeLoginEnabled`. Functional P.O.C.)
  • Loading branch information
JohnsonEricAtSalesforce committed Sep 20, 2024
1 parent c220cd6 commit 38ba3b0
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,9 @@ NS_SWIFT_NAME(SalesforceManager)
*/
@property (nonatomic, assign) BOOL isLoginWebviewInspectable;

/*** Indicates if login via QR Code and UI bridge API is enabled */
@property (nonatomic, assign) BOOL isQrCodeLoginEnabled;

/** The type of cache used for the shared URL cache, defaults to kSFURLCacheTypeEncrypted.
*/
@property (nonatomic, assign) SFURLCacheType URLCacheType;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,12 @@ public extension SalesforceLoginViewController {
) {
print("Login With Frontdoor Bridge URL: '\(frontdoorBridgeUrlString)'/'\(String(describing: pkceCodeVerifier))'.")

// TODO: W-16171402: Integrate With Existing Login Logic And Resolve Use Of PKCE Code Verifier. ECJ20240912

guard let frontdoorBridgeUrl = URL(string: frontdoorBridgeUrlString) else { return }
guard let webView = oauthView as? WKWebView else { return }
webView.load(URLRequest(url: frontdoorBridgeUrl))

DispatchQueue.main.async {
webView.load(URLRequest(url: frontdoorBridgeUrl))
}
}

// MARK: QR Code Login Via UI Bridge API Private Implementation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -791,7 +791,7 @@ - (void)webView:(WKWebView *)webView decidePolicyForNavigationAction:(WKNavigati
NSURL *url = navigationAction.request.URL;
NSString *requestUrl = [url absoluteString];
if ([self isRedirectURL:requestUrl]) {
if ([[SalesforceSDKManager sharedManager] useWebServerAuthentication]) {
if ([[SalesforceSDKManager sharedManager] useWebServerAuthentication] && ![[SalesforceSDKManager sharedManager] isQrCodeLoginEnabled]) {
[self handleWebServerResponse:url];
} else {
[self handleUserAgentResponse:url];
Expand Down

0 comments on commit 38ba3b0

Please sign in to comment.