주요 내부자 거래 위젯 연동하기
두 단계를 거치면 웨이커의 위젯을 연동할 수 있습니다
위젯 링크 복사하기
상호 연동하기
Step 01
위젯 링크 복사하기
화면 종류
연동할 위젯 화면을 선택해 주세요
위젯 종합
실시간 거래, AI 분석 등을 종합한 화면
종목 상세
특정 종목의 거래 현황 화면
거래 상세
내부자의 모든 거래를 분석한 화면
Step 02
상호 연동하기
위젯 내에서 특정 액션에 JS 인터페이스를 호출하여 고객사 앱과 연동할 수 있습니다. 위젯에서 참조할 javascript interface 이름은 WaikerInterface 입니다.
상호 연동 항목
1
뒤로가기
처음 위젯이 열린 화면에서 다시 APP으로 돌아갈 수 있도록 상호 연동할 수 있어요.
2
공유하기
다른 사람에게 공유할 수 있도록 버튼을 제공해요.
3
매수 화면으로 이동하기
매수 화면으로 이동할 수 있는 버튼을 제공해요.
4
매도 화면으로 이동하기
매도 화면으로 이동할 수 있는 버튼을 제공해요.
Function Name | Parameters | callbackReturn | 액션 설명 |
---|---|---|---|
newWindow | url: string; | - | 새로운 웹뷰를 호출 |
share | title?: string; text?: string; url: string; | - | 공유하기 액션 |
moveToBuy | ticker: string; | - | 종목 매수페이지로 이동 |
moveToSell | ticker: string; | - | 종목 매도페이지로 이동 |
JS인터페이스 연동 예시
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}