This PR creates a new method in MainActivity.kt called 'createJsObject'. If the version of WebView that the application is using can use WebMessageListener then it will be preferred for security reasons. Otherwise the application will defer to WebAppInterface. The method allows for the JavaScript side of the application to remain unaware of the version fo WebView that it is running on as it contains logic which manipulates the behavior of WebAppInterface to mirror the behavior of WebMessageListener. For example createJsObject makes it so that WebMessageListener contains a method postMessage() and runs on the UI thread.
This PR creates a new method in MainActivity.kt called 'createJsObject'. If the version of WebView that the application is using can use WebMessageListener then it will be preferred for security reasons. Otherwise the application will defer to WebAppInterface. The method allows for the JavaScript side of the application to remain unaware of the version fo WebView that it is running on as it contains logic which manipulates the behavior of WebAppInterface to mirror the behavior of WebMessageListener. For example createJsObject makes it so that WebMessageListener contains a method
postMessage()
and runs on the UI thread.