Skip to content

Commit

Permalink
fix(ios): present the privacyViewController on the top ViewController (
Browse files Browse the repository at this point in the history
…#85)

* fix(ios): Present the privacyViewController on the top ViewController

* fix line leght lint error
  • Loading branch information
jcesarmobile authored Feb 17, 2024
1 parent c998c4f commit 0603063
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion ios/Plugin/PrivacyScreen.swift
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,17 @@ import UIKit
return
}
DispatchQueue.main.async {
self.plugin.bridge?.viewController?.present(self.privacyViewController, animated: false, completion: nil)
let window = UIApplication.shared.connectedScenes
.filter({$0.activationState == .foregroundActive || $0.activationState == .foregroundInactive})
.compactMap({$0 as? UIWindowScene}).first?.windows.filter({$0.isKeyWindow}).first
if var rootVC = window?.rootViewController {
while let topVC = rootVC.presentedViewController {
rootVC = topVC
}
rootVC.present(self.privacyViewController, animated: false, completion: nil)
} else {
self.plugin.bridge?.viewController?.present(self.privacyViewController, animated: false, completion: nil)
}
}
}

Expand Down

0 comments on commit 0603063

Please sign in to comment.