Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.

[webview_flutter] Send history events #2379

Closed
wants to merge 1 commit into from

Conversation

wwwdata
Copy link
Contributor

@wwwdata wwwdata commented Dec 9, 2019

Description

Send URL change events when the user navigates in the Browser. This also works for JavaScript Navigation that does not actually make any request and therefore would not trigger page load or finish events.

Checklist

Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes ([x]). This will ensure a smooth and quick review process.

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • My PR includes unit or integration tests for all changed/updated/fixed behaviors (See Contributor Guide).
  • All existing and new tests are passing.
  • I updated/added relevant documentation (doc comments with ///).
  • The analyzer (flutter analyze) does not report any problems on my PR.
  • I read and followed the Flutter Style Guide.
  • The title of the PR starts with the name of the plugin surrounded by square brackets, e.g. [shared_preferences]
  • I updated pubspec.yaml with an appropriate new version according to the pub versioning philosophy.
  • I updated CHANGELOG.md to add a description of the change.
  • I signed the CLA.
  • I am willing to follow-up on review comments in a timely manner.

Breaking Change

Does your PR require plugin users to manually update their apps to accommodate your change?

  • Yes, this is a breaking change (please indicate a breaking change in CHANGELOG.md and increment major revision).
  • No, this is not a breaking change.

@wwwdata wwwdata requested a review from amirh as a code owner December 9, 2019 11:45
@ened
Copy link
Contributor

ened commented Dec 10, 2019

hi @wwwdata could you please rebase (& start the next version number)

@wwwdata wwwdata force-pushed the webview-history-events branch from 6a640b0 to 02a610e Compare December 10, 2019 12:32
@wwwdata
Copy link
Contributor Author

wwwdata commented Dec 10, 2019

hi @wwwdata could you please rebase (& start the next version number)

Just rebased, increased version number and pushed. Thanks for the fast feedback

Copy link
Contributor

@ened ened left a comment

Choose a reason for hiding this comment

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

Just a few tiny bits, but besides that looks good.

@wwwdata wwwdata force-pushed the webview-history-events branch from 02a610e to 25fc5a2 Compare December 10, 2019 13:00
@wwwdata wwwdata requested a review from ened December 10, 2019 13:01
@wwwdata
Copy link
Contributor Author

wwwdata commented Dec 10, 2019

@ened Thanks a lot for the good review feedback. Implemented the requested changes.

Copy link
Contributor

@ened ened left a comment

Choose a reason for hiding this comment

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

LGTM as well

@wwwdata wwwdata force-pushed the webview-history-events branch 2 times, most recently from 7d98ee3 to fbbc931 Compare December 13, 2019 08:24
@MattisBrizard
Copy link

Hi @wwwdata, is this pull request still active ?
I also need this implementation, and see that's it is an old PR.
I see that it requires @amirh approval, any update on this feature ?
Thanks.

@wwwdata
Copy link
Contributor Author

wwwdata commented Oct 12, 2020

So far I didn't hear anything official... I would be happy to rebase and fix all conflicts here again if somebody then also does a review...

Send URL change events when the user navigates in the Browser. This also
works for JavaScript Navigation that does not actually make any request.
@wwwdata wwwdata force-pushed the webview-history-events branch from fbbc931 to 505f1a2 Compare October 13, 2020 13:16
@wwwdata
Copy link
Contributor Author

wwwdata commented Oct 13, 2020

Ok, it's rebased again. We're only in 10 months waiting for a review, so let's give it some time :)

@jcgoodru
Copy link

jcgoodru commented Jan 4, 2021

This would be a great feature to have :)

@stuartmorgan-g stuartmorgan-g added the p: webview_flutter Edits files for a webview_flutter plugin label Jan 29, 2021
Copy link
Contributor

@stuartmorgan-g stuartmorgan-g left a comment

Choose a reason for hiding this comment

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

Thanks for the contribution! Looks like this fell through the cracks somehow, as it seems to have been approved but then not followed up on.

I've left a few more review comments; if you want to follow up on those and update to the current master, I can make sure this moves forward.


// TODO(hterkelsen): Remove this when defaultBinaryMessages is in stable.
// https://github.com/flutter/flutter/issues/33446
// ignore: deprecated_member_use
Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like this is obsolete.


NS_ASSUME_NONNULL_BEGIN

@interface FLTWKHistoryDelegate : NSObject
Copy link
Contributor

Choose a reason for hiding this comment

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

This class and its methods need declaration comments, per Google style.

self = [super init];
if (self) {
_methodChannel = channel;
[webView addObserver:self
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is this feature based on KVO rather than WKNavigationDelegate?

@@ -31,6 +31,9 @@ abstract class WebViewPlatformCallbacksHandler {

/// Report web resource loading error to the host application.
void onWebResourceError(WebResourceError error);

/// Invoked by [WebViewPlatformController] when the URL has changed.
void onUpdateVisitedHistory(String url);
Copy link
Contributor

Choose a reason for hiding this comment

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

The naming here seems very Android-centric; is there a reason not to call it something more generic like onUrlChanged?


#import "FLTWKHistoryDelegate.h"

NSString *const keyPath = @"URL";
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: this should be static

@Hixie
Copy link
Contributor

Hixie commented Oct 26, 2021

@wwwdata Any chance you have the time to look at this again? It looks like it's so close to landing.

@godofredoc godofredoc changed the base branch from master to main January 6, 2022 22:13
@christopherfujino
Copy link

I am going to close this as stale. Feel free to re-open if you are going to rebase and apply requested changes.

@stuartmorgan-g
Copy link
Contributor

I am planning to look at adapting this to the current state of the plugins once the iOS conversion to Dart+Pigeon is complete.

@stuartmorgan-g stuartmorgan-g reopened this Mar 9, 2022
@stuartmorgan-g
Copy link
Contributor

The Dart conversion is complete, but in the meantime we found flutter/flutter#94051 which blocks this, since we currently implement WebViewPlatformCallbacksHandler in our implementations, making changes to it breaking changes. We're actively working on that issue, and hope to have it resolved soon.

@stuartmorgan-g
Copy link
Contributor

Status update from triage: this is still blocked, but we hope to have it unblocked soon.

@stuartmorgan-g
Copy link
Contributor

This is unblocked now that v4 has landed. @bparrishMines This is one we should look at updating.

@stuartmorgan-g
Copy link
Contributor

Closing as this was obsoleted by #7113; the implementation had changed enough that it was easiest to start a new PR rather than update this one. Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants