Skip to content

Commit

Permalink
Merge branch 'main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
jtanium authored Oct 3, 2024
2 parents 3ad1716 + 6058294 commit 98cf6de
Show file tree
Hide file tree
Showing 110 changed files with 2,315 additions and 1,056 deletions.
2 changes: 1 addition & 1 deletion packages/camera/camera/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ dependencies:
dev_dependencies:
flutter_test:
sdk: flutter
mockito: 5.4.4
mockito: ^5.4.4
plugin_platform_interface: ^2.1.7

topics:
Expand Down
4 changes: 4 additions & 0 deletions packages/camera/camera_android_camerax/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.6.9+1

* Bumps `com.google.guava:guava` from `33.3.0` to `33.3.1`.

## 0.6.9

* Corrects assumption about automatic preview correction happening on API >= 29 to API > 29,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ dependencies {
implementation "androidx.camera:camera-camera2:${camerax_version}"
implementation "androidx.camera:camera-lifecycle:${camerax_version}"
implementation "androidx.camera:camera-video:${camerax_version}"
implementation 'com.google.guava:guava:33.3.0-android'
implementation 'com.google.guava:guava:33.3.1-android'
testImplementation 'junit:junit:4.13.2'
testImplementation 'org.mockito:mockito-inline:5.0.0'
testImplementation 'androidx.test:core:1.4.0'
Expand Down
4 changes: 2 additions & 2 deletions packages/camera/camera_android_camerax/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: camera_android_camerax
description: Android implementation of the camera plugin using the CameraX library.
repository: https://github.com/flutter/packages/tree/main/packages/camera/camera_android_camerax
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+camera%22
version: 0.6.9
version: 0.6.9+1

environment:
sdk: ^3.5.0
Expand Down Expand Up @@ -31,7 +31,7 @@ dev_dependencies:
sdk: flutter
integration_test:
sdk: flutter
mockito: 5.4.4
mockito: ^5.4.4
pigeon: ^9.1.0

topics:
Expand Down
2 changes: 1 addition & 1 deletion packages/camera/camera_avfoundation/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ dev_dependencies:
build_runner: ^2.4.9
flutter_test:
sdk: flutter
mockito: 5.4.4
mockito: ^5.4.4
pigeon: ^18.0.0

topics:
Expand Down
2 changes: 1 addition & 1 deletion packages/camera/camera_windows/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ dev_dependencies:
build_runner: ^2.4.9
flutter_test:
sdk: flutter
mockito: 5.4.4
mockito: ^5.4.4
pigeon: ^21.0.0

topics:
Expand Down
4 changes: 4 additions & 0 deletions packages/espresso/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.4.0+2

* Bumps `com.google.guava:guava` from `31.1` to `33.3.1`.

## 0.4.0+1

* Updates lint checks to ignore NewerVersionAvailable.
Expand Down
2 changes: 1 addition & 1 deletion packages/espresso/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ android {
}

dependencies {
implementation 'com.google.guava:guava:31.1-android'
implementation 'com.google.guava:guava:33.3.1-android'
implementation 'com.squareup.okhttp3:okhttp:4.11.0'
implementation 'com.google.code.gson:gson:2.10.1'
androidTestImplementation 'org.hamcrest:hamcrest:2.2'
Expand Down
2 changes: 1 addition & 1 deletion packages/espresso/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ description: Java classes for testing Flutter apps using Espresso.
Allows driving Flutter widgets from a native Espresso test.
repository: https://github.com/flutter/packages/tree/main/packages/espresso
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+espresso%22
version: 0.4.0+1
version: 0.4.0+2

environment:
sdk: ^3.4.0
Expand Down
2 changes: 1 addition & 1 deletion packages/file_selector/file_selector_android/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ dev_dependencies:
build_runner: ^2.1.4
flutter_test:
sdk: flutter
mockito: 5.4.4
mockito: ^5.4.4
pigeon: ^9.2.4

topics:
Expand Down
2 changes: 1 addition & 1 deletion packages/file_selector/file_selector_ios/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ dev_dependencies:
build_runner: ^2.3.0
flutter_test:
sdk: flutter
mockito: 5.4.4
mockito: ^5.4.4
pigeon: ^19.0.0

topics:
Expand Down
3 changes: 2 additions & 1 deletion packages/file_selector/file_selector_linux/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
## NEXT
## 0.9.3

* Updates method channel implementation to use Pigeon.
* Updates minimum supported SDK version to Flutter 3.19/Dart 3.3.

## 0.9.2+1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,17 @@

import 'package:file_selector_platform_interface/file_selector_platform_interface.dart';
import 'package:flutter/foundation.dart' show visibleForTesting;
import 'package:flutter/services.dart';

const MethodChannel _channel =
MethodChannel('plugins.flutter.dev/file_selector_linux');

const String _typeGroupLabelKey = 'label';
const String _typeGroupExtensionsKey = 'extensions';
const String _typeGroupMimeTypesKey = 'mimeTypes';

const String _openFileMethod = 'openFile';
const String _getSavePathMethod = 'getSavePath';
const String _getDirectoryPathMethod = 'getDirectoryPath';

const String _acceptedTypeGroupsKey = 'acceptedTypeGroups';
const String _confirmButtonTextKey = 'confirmButtonText';
const String _initialDirectoryKey = 'initialDirectory';
const String _multipleKey = 'multiple';
const String _suggestedNameKey = 'suggestedName';
import 'src/messages.g.dart';

/// An implementation of [FileSelectorPlatform] for Linux.
class FileSelectorLinux extends FileSelectorPlatform {
/// The MethodChannel that is being used by this implementation of the plugin.
@visibleForTesting
MethodChannel get channel => _channel;
/// Creates a new plugin implementation instance.
FileSelectorLinux({
@visibleForTesting FileSelectorApi? api,
}) : _hostApi = api ?? FileSelectorApi();

final FileSelectorApi _hostApi;

/// Registers the Linux implementation.
static void registerWith() {
Expand All @@ -40,19 +27,16 @@ class FileSelectorLinux extends FileSelectorPlatform {
String? initialDirectory,
String? confirmButtonText,
}) async {
final List<Map<String, Object>> serializedTypeGroups =
_serializeTypeGroups(acceptedTypeGroups);
final List<String>? path = await _channel.invokeListMethod<String>(
_openFileMethod,
<String, dynamic>{
if (serializedTypeGroups.isNotEmpty)
_acceptedTypeGroupsKey: serializedTypeGroups,
'initialDirectory': initialDirectory,
_confirmButtonTextKey: confirmButtonText,
_multipleKey: false,
},
);
return path == null ? null : XFile(path.first);
final List<String> paths = await _hostApi.showFileChooser(
PlatformFileChooserActionType.open,
PlatformFileChooserOptions(
allowedFileTypes:
_platformTypeGroupsFromXTypeGroups(acceptedTypeGroups),
currentFolderPath: initialDirectory,
acceptButtonLabel: confirmButtonText,
selectMultiple: false,
));
return paths.isEmpty ? null : XFile(paths.first);
}

@override
Expand All @@ -61,19 +45,16 @@ class FileSelectorLinux extends FileSelectorPlatform {
String? initialDirectory,
String? confirmButtonText,
}) async {
final List<Map<String, Object>> serializedTypeGroups =
_serializeTypeGroups(acceptedTypeGroups);
final List<String>? pathList = await _channel.invokeListMethod<String>(
_openFileMethod,
<String, dynamic>{
if (serializedTypeGroups.isNotEmpty)
_acceptedTypeGroupsKey: serializedTypeGroups,
_initialDirectoryKey: initialDirectory,
_confirmButtonTextKey: confirmButtonText,
_multipleKey: true,
},
);
return pathList?.map((String path) => XFile(path)).toList() ?? <XFile>[];
final List<String> paths = await _hostApi.showFileChooser(
PlatformFileChooserActionType.open,
PlatformFileChooserOptions(
allowedFileTypes:
_platformTypeGroupsFromXTypeGroups(acceptedTypeGroups),
currentFolderPath: initialDirectory,
acceptButtonLabel: confirmButtonText,
selectMultiple: true,
));
return paths.map((String path) => XFile(path)).toList();
}

@override
Expand All @@ -98,78 +79,76 @@ class FileSelectorLinux extends FileSelectorPlatform {
List<XTypeGroup>? acceptedTypeGroups,
SaveDialogOptions options = const SaveDialogOptions(),
}) async {
final List<Map<String, Object>> serializedTypeGroups =
_serializeTypeGroups(acceptedTypeGroups);
// TODO(stuartmorgan): Add the selected type group here and return it. See
// https://github.com/flutter/flutter/issues/107093
final String? path = await _channel.invokeMethod<String>(
_getSavePathMethod,
<String, dynamic>{
if (serializedTypeGroups.isNotEmpty)
_acceptedTypeGroupsKey: serializedTypeGroups,
_initialDirectoryKey: options.initialDirectory,
_suggestedNameKey: options.suggestedName,
_confirmButtonTextKey: options.confirmButtonText,
},
);
return path == null ? null : FileSaveLocation(path);
final List<String> paths = await _hostApi.showFileChooser(
PlatformFileChooserActionType.save,
PlatformFileChooserOptions(
allowedFileTypes:
_platformTypeGroupsFromXTypeGroups(acceptedTypeGroups),
currentFolderPath: options.initialDirectory,
currentName: options.suggestedName,
acceptButtonLabel: options.confirmButtonText,
));
return paths.isEmpty ? null : FileSaveLocation(paths.first);
}

@override
Future<String?> getDirectoryPath({
String? initialDirectory,
String? confirmButtonText,
}) async {
final List<String>? path = await _channel
.invokeListMethod<String>(_getDirectoryPathMethod, <String, dynamic>{
_initialDirectoryKey: initialDirectory,
_confirmButtonTextKey: confirmButtonText,
});
return path?.first;
final List<String> paths = await _hostApi.showFileChooser(
PlatformFileChooserActionType.chooseDirectory,
PlatformFileChooserOptions(
currentFolderPath: initialDirectory,
acceptButtonLabel: confirmButtonText,
selectMultiple: false,
));
return paths.isEmpty ? null : paths.first;
}

@override
Future<List<String>> getDirectoryPaths({
String? initialDirectory,
String? confirmButtonText,
}) async {
final List<String>? pathList = await _channel
.invokeListMethod<String>(_getDirectoryPathMethod, <String, dynamic>{
_initialDirectoryKey: initialDirectory,
_confirmButtonTextKey: confirmButtonText,
_multipleKey: true,
});
return pathList ?? <String>[];
return _hostApi.showFileChooser(
PlatformFileChooserActionType.chooseDirectory,
PlatformFileChooserOptions(
currentFolderPath: initialDirectory,
acceptButtonLabel: confirmButtonText,
selectMultiple: true,
));
}
}

List<Map<String, Object>> _serializeTypeGroups(List<XTypeGroup>? groups) {
return (groups ?? <XTypeGroup>[]).map(_serializeTypeGroup).toList();
List<PlatformTypeGroup>? _platformTypeGroupsFromXTypeGroups(
List<XTypeGroup>? groups) {
return groups?.map(_platformTypeGroupFromXTypeGroup).toList();
}

Map<String, Object> _serializeTypeGroup(XTypeGroup group) {
final Map<String, Object> serialization = <String, Object>{
_typeGroupLabelKey: group.label ?? '',
};
PlatformTypeGroup _platformTypeGroupFromXTypeGroup(XTypeGroup group) {
final String label = group.label ?? '';
if (group.allowsAny) {
serialization[_typeGroupExtensionsKey] = <String>['*'];
} else {
if ((group.extensions?.isEmpty ?? true) &&
(group.mimeTypes?.isEmpty ?? true)) {
throw ArgumentError('Provided type group $group does not allow '
'all files, but does not set any of the Linux-supported filter '
'categories. "extensions" or "mimeTypes" must be non-empty for Linux '
'if anything is non-empty.');
}
if (group.extensions?.isNotEmpty ?? false) {
serialization[_typeGroupExtensionsKey] = group.extensions
return PlatformTypeGroup(
label: label,
extensions: <String>['*'],
);
}
if ((group.extensions?.isEmpty ?? true) &&
(group.mimeTypes?.isEmpty ?? true)) {
throw ArgumentError('Provided type group $group does not allow '
'all files, but does not set any of the Linux-supported filter '
'categories. "extensions" or "mimeTypes" must be non-empty for Linux '
'if anything is non-empty.');
}
return PlatformTypeGroup(
label: label,
// Covert to GtkFileFilter's *.<extension> format.
extensions: group.extensions
?.map((String extension) => '*.$extension')
.toList() ??
<String>[];
}
if (group.mimeTypes?.isNotEmpty ?? false) {
serialization[_typeGroupMimeTypesKey] = group.mimeTypes ?? <String>[];
}
}
return serialization;
<String>[],
mimeTypes: group.mimeTypes ?? <String>[]);
}
Loading

0 comments on commit 98cf6de

Please sign in to comment.