apache / cordova-ios

Apache Cordova iOS
https://cordova.apache.org/
Apache License 2.0
2.15k stars 986 forks source link

CDVWebViewUIDelegate should take a CDVViewController #1429

Open dpogue opened 3 weeks ago

dpogue commented 3 weeks ago

Feature Request

Motivation Behind Feature

CDVWebViewUIDelegate handles a bunch of interactions with the UI and view controllers, and currently doesn't have a pointer to the CDVViewController that owns its associated WKWebView.

Feature Description

Provide an initializer for CDVWebViewUIDelegate that takes the CDVViewController and holds a weak reference to it.

Alternatives or Workarounds

We make some unsafe assumptions like the root view controller being safe to access, which has led to issues such as https://github.com/apache/cordova-ios/issues/1120. By having a reference to the CDVViewController we could ensure that any popups are correctly triggered by that view controller.