Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,13 @@ void configureWebview(){

binding.webview.setWebViewClient(cookieClient);

binding.webview.loadUrl(startURL);

if (savedInstanceState != null) {
// Issue #47: restore the saved WebView state on rotation
// instead of force-reloading the original URL.
binding.webview.restoreState(savedInstanceState);

Copilot AI Apr 25, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WebView.restoreState(...) can return null when it can’t restore the state. In that case, this code skips loadUrl(startURL) and can leave a blank WebView. Capture the return value and fall back to loadUrl(startURL) when restoration fails.

Suggested change
binding.webview.restoreState(savedInstanceState);
if (binding.webview.restoreState(savedInstanceState) == null) {
binding.webview.loadUrl(startURL);
}

Copilot uses AI. Check for mistakes.
} else {
Comment on lines +99 to +103

Copilot AI Apr 25, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

savedInstanceState is referenced inside configureWebview() but that method doesn’t have a Bundle parameter and there’s no field with that name, so this won’t compile. Pass the savedInstanceState from onCreate() into configureWebview(Bundle) (or store it in a field) and use that value here.

Copilot uses AI. Check for mistakes.
binding.webview.loadUrl(startURL);
}
Comment on lines +99 to +105

Copilot AI Apr 25, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code restores WebView state on rotation, but this class currently doesn’t override onSaveInstanceState() to call binding.webview.saveState(outState). Without saving the WebView snapshot, restoreState(savedInstanceState) will typically restore nothing. Add onSaveInstanceState() and save the WebView state into the bundle.

Copilot uses AI. Check for mistakes.


}
Expand Down
Loading