London Escorts sunderland escorts 1v1.lol unblocked yohoho 76 https://www.symbaloo.com/mix/yohoho?lang=EN yohoho https://www.symbaloo.com/mix/agariounblockedpvp https://yohoho-io.app/ https://www.symbaloo.com/mix/agariounblockedschool1?lang=EN
2.2 C
New York
Saturday, February 1, 2025

swift – UPI intent from iOS WKWebView


I’m attempting to open UPI apps from swift WKWebView.

I’ve tried it utilizing including openURL into different utility if its not http or https.

Right here is the technique I’m following.
AppDelegate class

import Basis
import UIKit
class AppDelegate: NSObject, UIApplicationDelegate {
    func utility(_ app: UIApplication, open url: URL, choices: [UIApplication.OpenURLOptionsKey: Any] = [:]) -> Bool {
        return true
    }
}

Right here is the Webview navigation delegate perform

func webView(_ webView: WKWebView, decidePolicyFor navigationAction: WKNavigationAction, decisionHandler: @escaping (WKNavigationActionPolicy) -> Void) {
        currentWebView = webView
        
        guard let url = navigationAction.request.url else {
            decisionHandler(.enable)
            return
        }
        
        print("NavAction URL: (url)")
        
        if navigationAction.targetFrame == nil {
            // Open in the identical tab if the goal body is nil (new tab)
            print("NavAction 1")
            currentWebView?.load(navigationAction.request)
            decisionHandler(.cancel)
            return
        }
        
        else if let url = navigationAction.request.url,
           !url.absoluteString.hasPrefix("http://"),
           !url.absoluteString.hasPrefix("https://"),
           UIApplication.shared.canOpenURL(url) {
            
            // Have UIApplication deal with the url (sms:, tel:, mailto:, ...)
            UIApplication.shared.open(url, choices: [:], completionHandler: nil)
            
            // Cancel the request (dealt with by UIApplication).
            decisionHandler(.cancel)
        }
        
        decisionHandler(.enable)
    }

How can I open the UPI apps the way in which safari opens them with a dialog saying Open in “GPay”.

Related Articles

Social Media Auto Publish Powered By : XYZScripts.com