5/25/2023 0 Comments Whatsapp ipadIn our NotificationOverride class, we need to override the constructor method in order to push the notification to our swift code. Window.Notification = NotificationOverride Better than any WhatsApp client for the iPad because I didn’t like any of those. The UserScript.js contain a class (NotificationOverride) that we will set it to override the window.notification class. Adding the icon to your home screen is as easy as going to on your iPad, tapping the Share-Icon at the top of Safari and selecting 'Add to Home Screen'. 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. How to set up and use WhatsApp on iPad 1) Open Safari on your iPad and visit.
0 Comments
Leave a Reply. |