packages icon indicating copy to clipboard operation
packages copied to clipboard

[webview_flutter] Adds onHttpError callback to NavigationDelegate to catch HTTP error status codes

Open HugoOlthof opened this issue 2 years ago • 11 comments
trafficstars

This PR adds the onHttpError callback to NavigationDelegate to catch HTTP error status codes. In our app we need to catch the status codes to show native error pages/alerts or redirect users to the native login screen if the user is unauthenticated. The existing onWebResourceError is not sufficient.

The Android implementation uses the onReceiveHttpError callback from WebViewClient and the iOS implementation uses the decidePolicyForNavigationResponse delegate from WKWebView.

Fixes https://github.com/flutter/flutter/issues/39502.

Pre-launch Checklist

  • [x] I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • [x] I read the Tree Hygiene wiki page, which explains my responsibilities.
  • [x] I read and followed the relevant style guides and ran the auto-formatter. (Unlike the flutter/flutter repo, the flutter/packages repo does use dart format.)
  • [x] I signed the CLA.
  • [x] The title of the PR starts with the name of the package surrounded by square brackets, e.g. [shared_preferences]
  • [x] I listed at least one issue that this PR fixes in the description above.
  • [x] I updated pubspec.yaml with an appropriate new version according to the pub versioning philosophy, or this PR is exempt from version changes.
  • [x] I updated CHANGELOG.md to add a description of the change, following repository CHANGELOG style.
  • [x] I updated/added relevant documentation (doc comments with ///).
  • [x] I added new tests to check the change I am making, or this PR is test-exempt.
  • [x] All existing and new tests are passing.

HugoOlthof avatar Feb 23 '23 15:02 HugoOlthof

@HugoOlthof Are you planning on updating this based on the review feedback above?

stuartmorgan-g avatar Mar 28 '23 19:03 stuartmorgan-g

@stuartmorgan Yes, I will update the PR as soon as possible!

HugoOlthof avatar Mar 28 '23 20:03 HugoOlthof

This is the PR for webview_flutter_platform_interface: https://github.com/flutter/packages/pull/3645

HugoOlthof avatar Apr 05 '23 15:04 HugoOlthof

The PR for the platform implementations: https://github.com/flutter/packages/pull/3695

HugoOlthof avatar Apr 12 '23 16:04 HugoOlthof

Update from triage: this is waiting for the sub-PR to complete the review process.

stuartmorgan-g avatar May 16 '23 20:05 stuartmorgan-g

Update from triage: sub-PR is still in progress.

stuartmorgan-g avatar Jun 13 '23 19:06 stuartmorgan-g

Update from triage: Still waiting on https://github.com/flutter/packages/pull/3695

stuartmorgan-g avatar Jul 13 '23 19:07 stuartmorgan-g

This is blocked on https://github.com/flutter/packages/pull/3695 which is blocked on https://github.com/flutter/packages/pull/4025 which is currently in review.

Hixie avatar Oct 24 '23 22:10 Hixie

Update from triage: https://github.com/flutter/packages/pull/5790 has been created as a copy of the blocking PR, to try to start unwinding this stack.

stuartmorgan-g avatar Jan 09 '24 20:01 stuartmorgan-g

Update from triage: the last PR in the stack is resolved, and this is now blocked on getting the next PR over the line.

stuartmorgan-g avatar Jan 30 '24 20:01 stuartmorgan-g

Update from triage: implementation PR (referenced just above) is still in progress.

stuartmorgan-g avatar Mar 05 '24 20:03 stuartmorgan-g

closing in favor of https://github.com/flutter/packages/pull/6378

bparrishMines avatar Mar 23 '24 00:03 bparrishMines