I have a situation where I need to capture an event from a button click in a WebPage.
this code is on the webpage on a button click.
okCoolClick = () => {
/*eslint-disable* /
console.log("okay cool ", window.okCool);
if (window.okCool) {
okCool.performClick();
} else {
window.open("some-url");
}
};
Now the Android team is done with the problem, with below code.
commonWebView.addJavascriptInterface(object : Any() {
@JavascriptInterface
fun performClick() {
val ownerId = arguments?.getInt(OWNER_ID)
if (ownerId == -1) {
context?.startActivity<RightNavigationActivity>()
activity?.finishAffinity()
} else {
context?.startActivity<HomeItemListActivity>(
Pair(HomeItemListActivity.INTENT_EXTRA_COMPONENT,
AppConstants.HOME_SUB_LIST_CLUB_OUTLET_LIST),
Pair(HomeItemListActivity.INTENT_EXTRA_CLUB_ID, ownerId),
Pair(HomeItemListActivity.INDUSTRY_ID, -1)
)
activity?.finish()
}
}
}, "okCool")
So, Now I'm left with finding the solution in iOS,
How can I achieve this on my iOS project? Any help or node toward the correct direction would be great.