Skip to content

Commit

Permalink
Merge pull request #33 from frontegg/FR-FR-14855-support-consent
Browse files Browse the repository at this point in the history
FR-14855 - Support social login consent prompt
  • Loading branch information
frontegg-david authored Jan 22, 2024
2 parents 8b0aba8 + 41fc0a7 commit 6babc4d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Sources/FronteggSwift/FronteggApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ public class FronteggApp {
public var handleLoginWithSocialLogin:Bool = true
public var handleLoginWithSSO:Bool = false

/* force consent when authenticate with social login */
public var shouldPromptSocialLoginConsent:Bool = true


public var regionData: [RegionConfig] = []
let credentialManager: CredentialManager
let logger = getLogger("FronteggApp")
Expand Down
5 changes: 5 additions & 0 deletions Sources/FronteggSwift/FronteggAuth.swift
Original file line number Diff line number Diff line change
Expand Up @@ -358,10 +358,15 @@ public class FronteggAuth: ObservableObject {

internal func getRootVC() -> UIViewController? {


if let appDelegate = UIApplication.shared.delegate,
let window = appDelegate.window,
let rootVC = window?.rootViewController {
if let presented = rootVC.presentedViewController {
return presented
}else {
return rootVC
}
}

if let rootVC = UIWindow.key?.rootViewController {
Expand Down
1 change: 1 addition & 0 deletions Sources/FronteggSwift/embedded/FronteggWebView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ public struct FronteggWebView: UIViewRepresentable {
let jsObject = String(data: try! JSONSerialization.data(withJSONObject: [
"loginWithSocialLogin": fronteggApp.handleLoginWithSocialLogin,
"loginWithSSO": fronteggApp.handleLoginWithSSO,
"shouldPromptSocialLoginConsent": fronteggApp.shouldPromptSocialLoginConsent
]), encoding: .utf8)

let jsScript = WKUserScript(source: "window.FronteggNativeBridgeFunctions = \(jsObject ?? "{}");", injectionTime: .atDocumentEnd, forMainFrameOnly: false)
Expand Down

0 comments on commit 6babc4d

Please sign in to comment.