changes to legacy webview function

This commit is contained in:
Scott Pfeil 2022-02-11 14:42:04 -05:00
parent 54dd5351ed
commit 36367deff4
3 changed files with 12 additions and 7 deletions

View File

@ -175,13 +175,7 @@ extension WebView : WKNavigationDelegate {
let url = navigationAction.request.url,
let urlString = url.absoluteString.removingPercentEncoding,
!urlString.contains("#") {
MVMCoreDispatchUtility.performBlock(onMainThread: {
// Presents standard webview.
let safariViewController = SFSafariViewController(url: url)
safariViewController.preferredBarTintColor = .white
safariViewController.preferredControlTintColor = .black
MVMCoreNavigationHandler.shared()?.present(safariViewController, animated: true)
})
MVMCoreUIActionHandler.shared()?.openURL(inWebView: url)
decisionHandler(.cancel)
} else {
decisionHandler(.allow)

View File

@ -27,6 +27,9 @@ NS_ASSUME_NONNULL_BEGIN
// Shows a topnotification new molecular
- (void)topNotificationAction:(nullable NSDictionary *)actionInformation additionalData:(nullable NSDictionary *)additionalData delegateObject:(nullable DelegateObject *)delegateObject;
/// Legacy in app safari webview load
- (void)openURLInWebView:(nonnull NSURL *)url;
@end
NS_ASSUME_NONNULL_END

View File

@ -15,6 +15,7 @@
@import MVMCore.NSDictionary_MFConvenience;
@import MVMCore.MVMCoreJSONConstants;
@import MVMCore.MVMCoreCache;
@import SafariServices;
@implementation MVMCoreUIActionHandler
@ -122,4 +123,11 @@
}
}
- (void)openURLInWebView:(nonnull NSURL *)url {
SFSafariViewController *safariViewController = [[SFSafariViewController alloc] initWithURL:url];
safariViewController.preferredBarTintColor = [UIColor whiteColor];
safariViewController.preferredControlTintColor = [UIColor blackColor];
[[MVMCoreNavigationHandler sharedNavigationHandler] presentViewController:safariViewController animated:YES];
}
@end