Skip to content

Commit

Permalink
Updates iOS picker presentation (miguelpruivo#813) and fixes import r…
Browse files Browse the repository at this point in the history
…egression on web (miguelpruivo#746)
  • Loading branch information
Miguel Ruivo committed Aug 31, 2021
1 parent 2cd8dca commit 267cc12
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 14 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,4 @@ example/ios/Flutter/flutter_export_environment.sh
example/.flutter-plugins-dependencies
file_picker/example/.flutter-plugins-dependencies
file_picker/example/ios/Flutter/flutter_export_environment.sh
example/macos
11 changes: 9 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
## 4.0.0+1
Overrides equality and toString for `platform_file` and `file_picker_result` for better comparison different results.
## 4.0.1
##### General
Overrides equality and toString for `platform_file` and `file_picker_result` for better comparison different results. Thank you @Nolence.
##### iOS
- Changes the presentation type of the picker from `UIModalPresentationCurrentContext` to `UIModalPresentationAutomatic` ([#813](https://github.com/miguelpruivo/flutter_file_picker/issues/813)).

##### Web
- Fixes regression of [#746](https://github.com/miguelpruivo/flutter_file_picker/issues/746).
- Updates exception text when trying to access `path` on Web. Thank you @maxzod.

## 4.0.0
### Desktop support added for all platforms (MacOS, Linux & Windows) ([#271](https://github.com/miguelpruivo/flutter_file_picker/issues/271)) 🎉
Expand Down
3 changes: 1 addition & 2 deletions example/lib/generated_plugin_registrant.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@
// Generated file. Do not edit.
//

// ignore_for_file: directives_ordering
// ignore_for_file: lines_longer_than_80_chars

import 'package:file_picker/src/file_picker_web.dart';
import 'package:file_picker/_internal/file_picker_web.dart';

import 'package:flutter_web_plugins/flutter_web_plugins.dart';

Expand Down
6 changes: 1 addition & 5 deletions ios/Classes/FilePickerPlugin.m
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,6 @@ - (void)resolvePickDocumentWithMultiPick:(BOOL)allowsMultipleSelection pickDirec
}

self.documentPickerController.delegate = self;
self.documentPickerController.modalPresentationStyle = UIModalPresentationCurrentContext;
self.galleryPickerController.allowsEditing = NO;

[self.viewController presentViewController:self.documentPickerController animated:YES completion:nil];
Expand All @@ -157,7 +156,6 @@ - (void) resolvePickMedia:(MediaType)type withMultiPick:(BOOL)multiPick withComp

PHPickerViewController *pickerViewController = [[PHPickerViewController alloc] initWithConfiguration:config];
pickerViewController.delegate = self;
pickerViewController.modalPresentationStyle = UIModalPresentationCurrentContext;
[self.viewController presentViewController:pickerViewController animated:YES completion:nil];
return;
}
Expand All @@ -173,7 +171,6 @@ - (void) resolvePickMedia:(MediaType)type withMultiPick:(BOOL)multiPick withComp

self.galleryPickerController = [[UIImagePickerController alloc] init];
self.galleryPickerController.delegate = self;
self.galleryPickerController.modalPresentationStyle = UIModalPresentationCurrentContext;
self.galleryPickerController.videoQuality = UIImagePickerControllerQualityTypeHigh;

switch (type) {
Expand Down Expand Up @@ -222,7 +219,7 @@ - (void) resolveMultiPickFromGallery:(MediaType)type withCompressionAllowed:(BOO

if (@available(iOS 11.0, *)) {
DKImageAssetExporterConfiguration * exportConfiguration = [[DKImageAssetExporterConfiguration alloc] init];
exportConfiguration.imageExportPreset = allowCompression ? UIImagePickerControllerImageURLExportPresetCompatible : UIImagePickerControllerImageURLExportPresetCurrent;
exportConfiguration.imageExportPreset = allowCompression ? DKImageExportPresentCompatible : DKImageExportPresentCurrent;
exportConfiguration.videoExportPreset = allowCompression ? AVAssetExportPresetHighestQuality : AVAssetExportPresetPassthrough;
dkImagePickerController.exporter = [dkImagePickerController.exporter initWithConfiguration:exportConfiguration];
}
Expand Down Expand Up @@ -284,7 +281,6 @@ - (void) resolvePickAudioWithMultiPick:(BOOL)isMultiPick {
self.audioPickerController.delegate = self;
self.audioPickerController.showsCloudItems = YES;
self.audioPickerController.allowsPickingMultipleItems = isMultiPick;
self.audioPickerController.modalPresentationStyle = UIModalPresentationCurrentContext;

[self.viewController presentViewController:self.audioPickerController animated:YES completion:nil];
}
Expand Down
File renamed without changes.
4 changes: 3 additions & 1 deletion lib/src/file_picker_result.dart
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ class FilePickerResult {

@override
bool operator ==(Object other) {
if (identical(this, other)) return true;
if (identical(this, other)) {
return true;
}

return other is FilePickerResult && listEquals(other.files, files);
}
Expand Down
4 changes: 3 additions & 1 deletion lib/src/platform_file.dart
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,9 @@ class PlatformFile {

@override
bool operator ==(Object other) {
if (identical(this, other)) return true;
if (identical(this, other)) {
return true;
}

return other is PlatformFile &&
other.path == path &&
Expand Down
6 changes: 3 additions & 3 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ description: A package that allows you to use a native file explorer to pick sin
homepage: https://github.com/miguelpruivo/plugins_flutter_file_picker
repository: https://github.com/miguelpruivo/flutter_file_picker
issue_tracker: https://github.com/miguelpruivo/flutter_file_picker/issues
version: 4.0.0+1
version: 4.0.1

dependencies:
flutter:
Expand All @@ -30,10 +30,10 @@ flutter:
pluginClass: FilePickerPlugin
web:
pluginClass: FilePickerWeb
fileName: src/file_picker_web.dart
fileName: _internal/file_picker_web.dart
macos:
default_package: file_picker
windows:
default_package: file_picker
linux:
default_package: file_picker
default_package: file_picker

0 comments on commit 267cc12

Please sign in to comment.