I have a problem that the "hooked" or "cb" callbacks defined in the Init method of the WebViewObject never seem to be called. ld and start seem to work fine and are printed in the logs. I require some code to execute when a redirect happens though (change destination url). Below is my code for displaying the WebView. I compile for android currently. I hope somebody can give me a pointer how to solve this.
void OpenWebView(string url)
{
webView = new GameObject("WebViewObject").AddComponent<WebViewObject>();
webView.Init(
cb: (msg) => {
Debug.Log("WebView callback: " + msg);
if (msg.StartsWith(redirectUri))
{
msg = msg.Replace("http://localhost:8080", proxyUrl);
HandleRedirect(msg);
}
},
err: (msg) => Debug.LogError("WebView error: " + msg),
httpErr: (msg) => Debug.Log("WebView HTTP Error" + msg),
started: (msg) => Debug.Log("WebView started: " + msg),
ld: (msg) => Debug.Log("WebView loaded: " + msg),
hooked: (msg) => Debug.Log("WebView hooked: " + msg),
enableWKWebView: true
);
webView.SetMargins(0, 0, 0, 0);
webView.SetVisibility(true);
string hookPattern = "^" + Regex.Escape("http://localhost:8080");
webView.SetURLPattern(".*", "", hookPattern);
webView.LoadURL(url);
}
Hi,
I have a problem that the "hooked" or "cb" callbacks defined in the Init method of the WebViewObject never seem to be called. ld and start seem to work fine and are printed in the logs. I require some code to execute when a redirect happens though (change destination url). Below is my code for displaying the WebView. I compile for android currently. I hope somebody can give me a pointer how to solve this.