Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
add navigation type to navigation action
  • Loading branch information
bparrishMines committed Dec 19, 2022
commit 18eddedfe3d7390036864f7dfd6ebd70f88f4dcd
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## Next



## 3.0.0

* **BREAKING CHANGE** Updates platform implementation to `2.0.0` release of
Expand Down
18 changes: 18 additions & 0 deletions packages/webview_flutter/webview_flutter_wkwebview/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,23 @@ The Apple WKWebView implementation of [`webview_flutter`][1].
This package is [endorsed][2], which means you can simply use `webview_flutter`
normally. This package will be automatically included in your app when you do.

## Contributing

This package uses [pigeon][3] to generate the communication layer between Flutter and the host
platform (iOS). The communication interface is defined in the `pigeons/web_kit.dart`
file. After editing the communication interface regenerate the communication layer by running
`flutter pub run pigeon --input pigeons/web_kit.dart`.

Besides [pigeon][3] this package also uses [mockito][4] to generate mock objects for testing
purposes. To generate the mock objects run the following command:
```bash
flutter pub run build_runner build --delete-conflicting-outputs
```

If you would like to contribute to the plugin, check out our [contribution guide][5].

[1]: https://pub.dev/packages/webview_flutter
[2]: https://flutter.dev/docs/development/packages-and-plugins/developing-packages#endorsed-federated-plugin
[3]: https://pub.dev/packages/pigeon
[4]: https://pub.dev/packages/mockito
[5]: https://github.com/flutter/plugins/blob/main/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,4 +151,13 @@ extern FWFNSKeyValueChangeKeyEnumData *FWFNSKeyValueChangeKeyEnumDataFromNSKeyVa
*/
extern FWFWKScriptMessageData *FWFWKScriptMessageDataFromWKScriptMessage(WKScriptMessage *message);

/**
* Converts a WKNavigationType to an FWFWKNavigationType.
*
* @param type The object containing information to create a FWFWKNavigationType
*
* @return A FWFWKNavigationType.
*/
extern FWFWKNavigationType FWFWKNavigationTypeFromWKNavigationType(WKNavigationType type);

NS_ASSUME_NONNULL_END
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,8 @@ WKAudiovisualMediaTypes FWFWKAudiovisualMediaTypeFromEnumData(
WKNavigationAction *action) {
return [FWFWKNavigationActionData
makeWithRequest:FWFNSUrlRequestDataFromNSURLRequest(action.request)
targetFrame:FWFWKFrameInfoDataFromWKFrameInfo(action.targetFrame)];
targetFrame:FWFWKFrameInfoDataFromWKFrameInfo(action.targetFrame)
navigationType:FWFWKNavigationTypeFromWKNavigationType(action.navigationType)];
}

FWFNSUrlRequestData *FWFNSUrlRequestDataFromNSURLRequest(NSURLRequest *request) {
Expand Down Expand Up @@ -218,3 +219,20 @@ WKNavigationActionPolicy FWFWKNavigationActionPolicyFromEnumData(
FWFWKScriptMessageData *FWFWKScriptMessageDataFromWKScriptMessage(WKScriptMessage *message) {
return [FWFWKScriptMessageData makeWithName:message.name body:message.body];
}

FWFWKNavigationType FWFWKNavigationTypeFromWKNavigationType(WKNavigationType type) {
switch (type) {
case WKNavigationTypeLinkActivated:
return FWFWKNavigationTypeLinkActivated;
case WKNavigationTypeFormSubmitted:
return FWFWKNavigationTypeFormResubmitted;
case WKNavigationTypeBackForward:
return FWFWKNavigationTypeBackForward;
case WKNavigationTypeReload:
return FWFWKNavigationTypeReload;
case WKNavigationTypeFormResubmitted:
return FWFWKNavigationTypeFormResubmitted;
case WKNavigationTypeOther:
return FWFWKNavigationTypeOther;
}
}
Loading