Merge branch 'feature/open_url_options' into 'develop'
Feature/open url options See merge request BPHV_MIPS/mvm_core_ui!793
This commit is contained in:
commit
61345b9bc1
@ -170,8 +170,11 @@ extension WebView : WKNavigationDelegate {
|
||||
public func webView(_ webView: WKWebView, decidePolicyFor navigationAction: WKNavigationAction, decisionHandler: @escaping (WKNavigationActionPolicy) -> Void) {
|
||||
//validate request url
|
||||
//all validated link should be open in safari
|
||||
if (navigationAction.navigationType == .linkActivated), let urlString = navigationAction.request.url?.absoluteString.removingPercentEncoding, !urlString.contains("#") {
|
||||
MVMCoreActionHandler.shared()?.openURL(inWebView: navigationAction.request.url, actionInformation: nil, additionalData: nil, delegateObject: nil)
|
||||
if (navigationAction.navigationType == .linkActivated),
|
||||
let url = navigationAction.request.url,
|
||||
let urlString = url.absoluteString.removingPercentEncoding,
|
||||
!urlString.contains("#") {
|
||||
MVMCoreUIActionHandler.shared()?.openURL(inSafariWebView: url)
|
||||
decisionHandler(.cancel)
|
||||
} else {
|
||||
decisionHandler(.allow)
|
||||
|
||||
@ -58,10 +58,16 @@ import Foundation
|
||||
//--------------------------------------------------
|
||||
// MARK: - Codec
|
||||
//--------------------------------------------------
|
||||
|
||||
open class func defaultPageType() -> String? { return nil }
|
||||
|
||||
required public init(from decoder: Decoder) throws {
|
||||
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
||||
pageType = try typeContainer.decode(String.self, forKey: .pageType)
|
||||
if let defaultPageType = Self.defaultPageType() {
|
||||
pageType = try typeContainer.decodeIfPresent(String.self, forKey: .pageType) ?? defaultPageType
|
||||
} else {
|
||||
pageType = try typeContainer.decode(String.self, forKey: .pageType)
|
||||
}
|
||||
screenHeading = try typeContainer.decodeIfPresent(String.self, forKey: .screenHeading)
|
||||
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
|
||||
formRules = try typeContainer.decodeIfPresent([FormGroupRule].self, forKey: .formRules)
|
||||
|
||||
@ -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)openURLInSafariWebView:(nonnull NSURL *)url;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
||||
@ -15,6 +15,7 @@
|
||||
@import MVMCore.NSDictionary_MFConvenience;
|
||||
@import MVMCore.MVMCoreJSONConstants;
|
||||
@import MVMCore.MVMCoreCache;
|
||||
@import SafariServices;
|
||||
|
||||
@implementation MVMCoreUIActionHandler
|
||||
|
||||
@ -122,4 +123,11 @@
|
||||
}
|
||||
}
|
||||
|
||||
- (void)openURLInSafariWebView:(nonnull NSURL *)url {
|
||||
SFSafariViewController *safariViewController = [[SFSafariViewController alloc] initWithURL:url];
|
||||
safariViewController.preferredBarTintColor = [UIColor whiteColor];
|
||||
safariViewController.preferredControlTintColor = [UIColor blackColor];
|
||||
[[MVMCoreNavigationHandler sharedNavigationHandler] presentViewController:safariViewController animated:YES];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
Loading…
Reference in New Issue
Block a user