You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Exposing the HTTP Status code of the last request to compose would be helpful for scenarios, where you want to respond to errors coming from requests made by the webview.
Some examples are: Showing Compose Snackbars or Dialogs when a 404 occurs; Setting an authentication cookie when the webview 401s, etc.
The text was updated successfully, but these errors were encountered:
I have looked further at this issue and have built a small PoC.
For this I have added a SnapshotStateList of Integers to the WebViewState and in the AccompanistWebViewClient I have overridden the onReceivedHttpError Method, so that when an HttpError is occured the status code is taken from the WebResourceResponse and published to the new SnapshotStateList in the WebViewState. Similarly on iOS, I have overridden fun webView(webView: WKWebView, decidePolicyForNavigationResponse: WKNavigationResponse, decisionHandler: (WKNavigationResponsePolicy) -> Unit) in the WKNavigationDelegate to also publish the response HTTP Status code.
Since I do not need the Desktop target currently, I have not implemented it for Desktop.
Unfortunately, there is an inconsistency between iOS and Android, in that the onReceivedHttpError Method on Android only is called when an error occurs and I have not yet found a way to get all Http Status Codes that the Webview receives. On iOS however, the webview(...) function receives all Http Status codes the Webview receives
I have already commented here.
Exposing the HTTP Status code of the last request to compose would be helpful for scenarios, where you want to respond to errors coming from requests made by the webview.
Some examples are: Showing Compose Snackbars or Dialogs when a 404 occurs; Setting an authentication cookie when the webview 401s, etc.
The text was updated successfully, but these errors were encountered: