![]() Let webConfiguration = WKWebViewConfiguration() (userScript) (self, name: “notify”) ![]() atDocumentStart, forMainFrameOnly: false) Let userScript = WKUserScript(source: userScriptCode, injectionTime. Let userScriptCode = try! String(contentsOf: userScriptURL) Let userScriptURL = (forResource: “UserScript”, withExtension: “js”)! Next we need to inject javascript (UserScript.js) to our WKWebView in order to listen to any Web Push Notification. Ok, after setting the above, WhatsApp will return the desktop view of WhatsApp Web. To do this, you just need to set the custom user agent in WKWebView as below WhatsApp Web support Web Push notification for desktop browser, so we need amend the User-Agent in header in order to pretend as desktop browser. and doesn’t get reload everytime user open the app from background. Actually there is third issue where we need to prevent the WebView to go into inactive mode so that it able to received the Web Push notification. Second issue is how to prevent the app from been killed by iPadOS when it go to background. In other words, put a WKWebView in your app and load WhatsApp Web () on this WKWebView.įirst since it’s a webview, there is no Push Notification feature. The basic idea is to wrap WhatsApp Web as webview in the app. So I decided to put it up to GitHub as open source with short explanation on the code here.įirst, download the full code from GitHub as reference. End up, their “robot” come back with the exact same answer. Tried to explain to them that it is not to copy WhatsApp but as a plugin to enable Apple users to use WhatsApp on iPad. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |