Skip to content

Commit

Permalink
[webview_flutter] update pigeon to 11 (#4821)
Browse files Browse the repository at this point in the history
updates pigeon version to 11 to remove need for primitive enum wrappers - removes unnused enum wrappers.

Some work toward flutter/flutter#133455
  • Loading branch information
tarrinneal authored Aug 31, 2023
1 parent 5f90356 commit bd4a8eb
Show file tree
Hide file tree
Showing 11 changed files with 663 additions and 609 deletions.
4 changes: 2 additions & 2 deletions packages/local_auth/local_auth_ios/pigeons/messages.dart
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ class AuthResultDetails {
/// Pigeon equivalent of the subset of BiometricType used by iOS.
enum AuthBiometric { face, fingerprint }

// TODO(stuartmorgan): Remove this when
// https://github.com/flutter/flutter/issues/87307 is implemented.
// TODO(stuartmorgan): Enums need be wrapped in a data class because thay can't
// be used as collection arguments. See https://github.com/flutter/flutter/issues/133728
class AuthBiometricWrapper {
AuthBiometricWrapper({required this.value});
final AuthBiometric value;
Expand Down
4 changes: 4 additions & 0 deletions packages/webview_flutter/webview_flutter_android/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 3.9.5

* Updates pigeon to 11 and removes unneeded enum wrappers.

## 3.9.4

* Adds pub topics to package metadata.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,25 +34,21 @@ public FileChooserParamsFlutterApiImpl(
this.instanceManager = instanceManager;
}

private static GeneratedAndroidWebView.FileChooserModeEnumData toFileChooserEnumData(int mode) {
final GeneratedAndroidWebView.FileChooserModeEnumData.Builder builder =
new GeneratedAndroidWebView.FileChooserModeEnumData.Builder();
private static GeneratedAndroidWebView.FileChooserMode toFileChooserEnumData(int mode) {

switch (mode) {
case WebChromeClient.FileChooserParams.MODE_OPEN:
builder.setValue(GeneratedAndroidWebView.FileChooserMode.OPEN);
break;
return GeneratedAndroidWebView.FileChooserMode.OPEN;

case WebChromeClient.FileChooserParams.MODE_OPEN_MULTIPLE:
builder.setValue(GeneratedAndroidWebView.FileChooserMode.OPEN_MULTIPLE);
break;
return GeneratedAndroidWebView.FileChooserMode.OPEN_MULTIPLE;

case WebChromeClient.FileChooserParams.MODE_SAVE:
builder.setValue(GeneratedAndroidWebView.FileChooserMode.SAVE);
break;
return GeneratedAndroidWebView.FileChooserMode.SAVE;

default:
throw new IllegalArgumentException(String.format("Unsupported FileChooserMode: %d", mode));
}

return builder.build();
}

/**
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ public void flutterApiCreate() {
final long identifier =
Objects.requireNonNull(
instanceManager.getIdentifierForStrongReference(mockFileChooserParams));
final ArgumentCaptor<GeneratedAndroidWebView.FileChooserModeEnumData> modeCaptor =
ArgumentCaptor.forClass(GeneratedAndroidWebView.FileChooserModeEnumData.class);
final ArgumentCaptor<GeneratedAndroidWebView.FileChooserMode> modeCaptor =
ArgumentCaptor.forClass(GeneratedAndroidWebView.FileChooserMode.class);

verify(spyFlutterApi)
.create(
Expand All @@ -68,7 +68,6 @@ public void flutterApiCreate() {
modeCaptor.capture(),
eq("filenameHint"),
any());
assertEquals(
modeCaptor.getValue().getValue(), GeneratedAndroidWebView.FileChooserMode.OPEN_MULTIPLE);
assertEquals(modeCaptor.getValue(), GeneratedAndroidWebView.FileChooserMode.OPEN_MULTIPLE);
}
}

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -1025,14 +1025,14 @@ class FileChooserParamsFlutterApiImpl extends FileChooserParamsFlutterApi {
int instanceId,
bool isCaptureEnabled,
List<String?> acceptTypes,
FileChooserModeEnumData mode,
FileChooserMode mode,
String? filenameHint,
) {
instanceManager.addHostCreatedInstance(
FileChooserParams.detached(
isCaptureEnabled: isCaptureEnabled,
acceptTypes: acceptTypes.cast(),
mode: mode.value,
mode: mode,
filenameHint: filenameHint,
binaryMessenger: binaryMessenger,
instanceManager: instanceManager,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,6 @@ enum FileChooserMode {
save,
}

// TODO(bparrishMines): Enums need be wrapped in a data class because thay can't
// be used as primitive arguments. See https://github.com/flutter/flutter/issues/87307
class FileChooserModeEnumData {
late FileChooserMode value;
}

class WebResourceRequestData {
WebResourceRequestData(
this.url,
Expand Down Expand Up @@ -393,7 +387,7 @@ abstract class FileChooserParamsFlutterApi {
int instanceId,
bool isCaptureEnabled,
List<String> acceptTypes,
FileChooserModeEnumData mode,
FileChooserMode mode,
String? filenameHint,
);
}
Expand Down
4 changes: 2 additions & 2 deletions packages/webview_flutter/webview_flutter_android/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: webview_flutter_android
description: A Flutter plugin that provides a WebView widget on Android.
repository: https://github.com/flutter/packages/tree/main/packages/webview_flutter/webview_flutter_android
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+webview%22
version: 3.9.4
version: 3.9.5

environment:
sdk: ">=2.19.0 <4.0.0"
Expand All @@ -27,7 +27,7 @@ dev_dependencies:
flutter_test:
sdk: flutter
mockito: 5.4.1
pigeon: ^9.2.4
pigeon: ^11.0.0

topics:
- html
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1085,7 +1085,7 @@ void main() {
0,
false,
const <String>['my', 'list'],
FileChooserModeEnumData(value: FileChooserMode.openMultiple),
FileChooserMode.openMultiple,
'filenameHint',
);

Expand Down
Loading

0 comments on commit bd4a8eb

Please sign in to comment.