forem / ForemWebView-ios

Forem core interface SDK
GNU General Public License v3.0
22 stars 7 forks source link

Implements WKUIDelegate #34

Closed fdocr closed 3 years ago

fdocr commented 3 years ago

After a more thorough look into forem/forem codebase I found the following places where we use window.confirm or window.alert (we don't use window.prompt):

Screen Shot 2021-05-21 at 08 17 51

Screen Shot 2021-05-21 at 08 27 39

Screen Shot 2021-05-21 at 08 21 24

This PR makes the ForemWebView self sufficient in this regard, meaning that consumers of the Framework don't need to worry about implementing the delegate.

fdocr commented 3 years ago

(Unrelated question: is this expected behavior with WKWebView? Does it not support Javascript generated UI interfaces like alert and confirm out of the box?

Yes, this is the expected behavior from WKWebView. They're part of the architecture decisions from Apple. The docs provide a bit of context, but in general these are features heavily used when developing a full fledged browser (think of the Chrome or Firefox teams developing their iOS browser app).

In the future we could even think of relying on custom UI (native or also web based) for these so they can have a more branded look (instead of the generic UIAlertController).