-
Notifications
You must be signed in to change notification settings - Fork 9.7k
Allow specifying a navigation delegate (iOS implementation). #1323
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Just some Nit changes, some questions and some suggestions.
} | ||
NSDictionary* arguments = @{ | ||
@"url" : navigationAction.request.URL.absoluteString, | ||
@"isMainFrame" : [NSNumber numberWithBool:navigationAction.targetFrame.isMainFrame] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a suggestion, but the code looks fine. Feel free to not update this for this PR if you don't feel like to.
The [NSNumber numberWithBool..] can be short written as @(foo).
@"isMainFrame" : [NSNumber numberWithBool:navigationAction.targetFrame.isMainFrame] | |
@"isMainFrame" : @(navigationAction.targetFrame.isMainFrame) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sweet!
arguments:arguments | ||
result:^(id _Nullable result) { | ||
NSNumber* typedResult = result; | ||
decisionHandler([typedResult boolValue] ? WKNavigationActionPolicyAllow |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a possibility for the dart side code to fail and the result block not getting triggered?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good catch, it shouldn't ever happen, but added some better logging in case it does.
…art). (#1236) This allows the app to prevent specific navigations(e.g prevent navigating to specific URLs). flutter/flutter#25329 iOS implementation in #1323
* 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
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