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 url = navigationAction.request.url,
let urlString = url.absoluteString.removingPercentEncoding, let urlString = url.absoluteString.removingPercentEncoding,
!urlString.contains("#") { !urlString.contains("#") {
MVMCoreDispatchUtility.performBlock(onMainThread: { MVMCoreUIActionHandler.shared()?.openURL(inWebView: url)
// Presents standard webview.
let safariViewController = SFSafariViewController(url: url)
safariViewController.preferredBarTintColor = .white
safariViewController.preferredControlTintColor = .black
MVMCoreNavigationHandler.shared()?.present(safariViewController, animated: true)
})
decisionHandler(.cancel) decisionHandler(.cancel)
} else { } else {
decisionHandler(.allow) decisionHandler(.allow)

View File

@ -27,6 +27,9 @@ NS_ASSUME_NONNULL_BEGIN
// Shows a topnotification new molecular // Shows a topnotification new molecular
- (void)topNotificationAction:(nullable NSDictionary *)actionInformation additionalData:(nullable NSDictionary *)additionalData delegateObject:(nullable DelegateObject *)delegateObject; - (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 @end
NS_ASSUME_NONNULL_END NS_ASSUME_NONNULL_END

View File

@ -15,6 +15,7 @@
@import MVMCore.NSDictionary_MFConvenience; @import MVMCore.NSDictionary_MFConvenience;
@import MVMCore.MVMCoreJSONConstants; @import MVMCore.MVMCoreJSONConstants;
@import MVMCore.MVMCoreCache; @import MVMCore.MVMCoreCache;
@import SafariServices;
@implementation MVMCoreUIActionHandler @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 @end