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

Conversation

@amirh
Copy link
Contributor

@amirh amirh commented Feb 19, 2019

This allows the app to prevent specific navigations(e.g prevent
navigating to specific URLs).

flutter/flutter#25329

iOS implementation in #1323

_toasterJavascriptChannel(context),
].toSet(),
navigationDelegate: (NavigationRequest request) {
if (request.url == 'https://www.youtube.com/') {
Copy link
Contributor

Choose a reason for hiding this comment

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

startsWith?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done


/// Information about a navigation action that is about to be executed.
class NavigationRequest {
NavigationRequest({this.url, this.isMainFrame});
Copy link
Contributor

Choose a reason for hiding this comment

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

constructor is missing docs

Copy link
Contributor

Choose a reason for hiding this comment

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

consider adding some sort of benchmark to check how many public members are missing docs in the repo

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Made the constructor private, filed: flutter/flutter#28599

class NavigationRequest {
NavigationRequest({this.url, this.isMainFrame});

/// The URL a navigation is requested to.
Copy link
Contributor

Choose a reason for hiding this comment

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

this doc doesn't pass our style guide ("url" and "navigation" and "request" are in the member and class name, so that leaves just "the a is ed to" which isn't meaningful).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Gave it another shot.


@override
String toString() {
return 'NavigationRequest(url: $url, isMainFrame: $isMainFrame)';
Copy link
Contributor

Choose a reason for hiding this comment

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

we usually use $runtimeType instead of hardcoding the type in the toString, it makes it work better when you subclass or rename the class or copy-paste the code

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@Hixie
Copy link
Contributor

Hixie commented Feb 20, 2019

general design SGTM.

@cyanglaz cyanglaz changed the title [WIP] [WebView] Allow specifying a navigation delegate. [webview_flutter][WIP] Allow specifying a navigation delegate. Feb 23, 2019
@amirh amirh force-pushed the navigation_delegate branch from 38f735a to e6df240 Compare February 27, 2019 19:45

const String kNavigationExamplePage = '''
<!DOCTYPE html><html>
<head><title>Navigation Delegate Example</title></head>thanks
Copy link
Contributor

Choose a reason for hiding this comment

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

stray "thanks"

@amirh amirh changed the title [webview_flutter][WIP] Allow specifying a navigation delegate. [webview_flutter]Allow specifying a navigation delegate(Android and Dart). Mar 7, 2019
@amirh amirh force-pushed the navigation_delegate branch from d878bfa to a743f8d Compare March 7, 2019 22:09
@amirh amirh requested review from bparrishMines and mklim March 7, 2019 22:10
@amirh
Copy link
Contributor Author

amirh commented Mar 7, 2019

@mklim / @bparrishMines can you take a look (Ian reviewed mainly the public API).

Copy link
Contributor

@bparrishMines bparrishMines left a comment

Choose a reason for hiding this comment

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

LGTM


@Override
public void error(String errorCode, String s1, Object o) {
throw new IllegalStateException("navigation ");
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: extra space after navigation

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

Copy link
Contributor

@mklim mklim left a comment

Choose a reason for hiding this comment

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

LGTM pending one nit.

@@ -1 +1,2 @@
org.gradle.jvmargs=-Xmx1536M
android.useAndroixX=true
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
android.useAndroixX=true
android.useAndroidX=true

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oops, thanks fixed.

amirh added a commit that referenced this pull request Mar 9, 2019
This is the iOS implementation of the navigation delegate method channel.

The Dart and Android implementations are in #1236

Splitting off the iOS to keep a reasonable change size.
This PR will be merged first.

flutter/flutter#25329
@amirh amirh merged commit 9017d6e into flutter:master Mar 9, 2019
@amirh amirh deleted the navigation_delegate branch March 9, 2019 04:06
jonasbark pushed a commit to jonasbark/plugins that referenced this pull request Mar 11, 2019
* commit '9017d6e7f867af278edd7e8e584d52524f37443f': (408 commits)
  [webview_flutter]Allow specifying a navigation delegate(Android and Dart). (flutter#1236)
  Allow specifying a navigation delegate (iOS implementation). (flutter#1323)
  Change build link in contributors site to cirrus (flutter#1327)
  [image_picker] Update versioning for flutter#1268 (flutter#1326)
  [image_picker] remove unnecessary camera permmision (flutter#1268)
  Exclude longPress from semantics (flutter#1324)
  [in_app_purchase] refactoring and tests (flutter#1322)
  [in_app_purchase] Adds Dart BillingClient APIs for loading purchases (flutter#1286)
  [connectivity] Update README.md (flutter#1201)
  [camera] Fixes #28350 (flutter#1261)
  [cloud_functions] Specify version for CocoaPod and handle null regions gracefully (flutter#1316)
  [in_app_purchase]retrieve receipt (flutter#1303)
  [firebase_analytics] Add resetAnalyticsData method (flutter#1311)
  trackCameraPosition is inferred from GoogleMap.onCameraMove (flutter#1314)
  [google_maps_flutter]ChangeNotifier is replaced with granular callbacks (flutter#1302)
  [video_player]Do not divide by zero (flutter#793)
  [firebase_dynamic_links] Version bump for firebase_dynamic_links PR flutter#1142 (flutter#1309)
  [firebase_dynamic_links] fix dynamic link crash when creating shortlink if warnings are null (flutter#1142)
  Fix typo in RewardedVideoAdd sample (flutter#927)
  Add my name to firebase_performance and firebase_dynamic_links owners (flutter#1300)
  ...

# Conflicts:
#	packages/camera/android/src/main/java/io/flutter/plugins/camera/CameraPlugin.java
#	packages/camera/ios/Classes/CameraPlugin.m
#	packages/firebase_auth/ios/Classes/FirebaseAuthPlugin.m
#	packages/image_picker/android/build.gradle
#	packages/video_player/android/src/main/java/io/flutter/plugins/videoplayer/VideoPlayerPlugin.java
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.

5 participants