Skip to content

Commit

Permalink
fix: use UIViewController as overlay (#12)
Browse files Browse the repository at this point in the history
  • Loading branch information
robingenz authored Jan 21, 2021
1 parent 6f9343f commit a2bf3f8
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions ios/Plugin/Plugin.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,18 @@ public class PrivacyScreen: CAPPlugin {
NotificationCenter.default.removeObserver(self)
}

@objc func onAppDidBecomeActive() {
self.webView.window?.isHidden = false
@objc func onAppWillResignActive() {
let privacyViewController = UIViewController()
privacyViewController.view.backgroundColor = UIColor.gray;
privacyViewController.modalPresentationStyle = UIModalPresentationStyle.overFullScreen
DispatchQueue.main.async {
self.bridge.viewController.present(privacyViewController, animated: false, completion: nil)
}
}

@objc func onAppWillResignActive() {
self.webView.window?.isHidden = true
@objc func onAppDidBecomeActive() {
DispatchQueue.main.async {
self.bridge.viewController.dismiss(animated: false, completion: nil)
}
}
}

0 comments on commit a2bf3f8

Please sign in to comment.