Integrate Reuters News Widget
You can integrate Waiker’s widget in two simple steps
Copy the widget link
Integrate widget
Step 01
Copy the widget link
Screen Types
Select the widget screen you want to integrate
News List
A screen displaying a real-time list of the latest news
News Details
A detailed screen including related stocks, tags, and AI-generated summaries
UI Settings
Show Header
Data Settings
Setting region(region-code)
Tag Exposure Intensity (Score)
Ticker
Step 02
Integrate widget
You can call JavaScript interfaces for specific actions within the widget to integrate with your app. The JavaScript interface name referenced by the widget is 'WaikerInterface'.
Interaction Options
1
Close
Close webview
Function Name | Parameters | callbackReturn | Action descriptions |
---|---|---|---|
close | - | - | Close webview |
JS Interface Integration Example
1
2 webView.addJavascriptInterface(WebAppInterface(this), "WaikerInterface")
3
4class WebAppInterface(private val context: Context) {
5 @JavascriptInterface
6 fun close() {
7 // Logic to close the in-app webview that called this method
8 }
9 fun newWindow(url: String) {
10 // Logic to open a new in-app webview with the provided URL
11 }
12 // Implement the necessary logic from the list below
13}
14
1
2 webView.configuration.userContentController.add(
3 self,
4 name: "WaikerInterface"
5 )
6
7extension ViewController: WKScriptMessageHandler {
8 func userContentController(
9 _ userContentController: WKScriptMessage,
10 didReceive message: WKScriptMessage
11 ) {
12 if message.name == "WaikerInterface" {
13 if let body = message.body as? [String: Any] {
14 if let method = body["method"] as? String {
15 switch method {
16 case "close":
17 // Logic to close the in-app webview that called this method
18 break
19 case "newWindow":
20 if let url = body["url"] as? String {
21 // Logic to open a new in-app webview with the provided URL
22 }
23 break
24 // Implement the necessary logic from the list below
25 default:
26 break
27 }
28 }
29 }
30 }
31 }
32}