Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compile out broken references if PICKER_DOCUMENT is set to false #1494

Merged
merged 3 commits into from
Apr 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 8.0.1
### iOS
Fixes an issue preventing compilation on iOS when using Pod::PICKER_DOCUMENT = false.

## 8.0.0+1
Removes linter warnings and fixes CI/CD.

Expand Down
8 changes: 8 additions & 0 deletions ios/Classes/FilePickerPlugin.m
Original file line number Diff line number Diff line change
Expand Up @@ -149,11 +149,17 @@ - (void)handleMethodCall:(FlutterMethodCall*)call result:(FlutterResult)result {
details:nil]);
#endif
} else if([call.method isEqualToString:@"save"]) {
#ifdef PICKER_DOCUMENT
NSString *fileName = [arguments valueForKey:@"fileName"];
NSString *fileType = [arguments valueForKey:@"fileType"];
NSString *initialDirectory = [arguments valueForKey:@"initialDirectory"];
FlutterStandardTypedData *bytes = [arguments valueForKey:@"bytes"];
[self saveFileWithName:fileName fileType:fileType initialDirectory:initialDirectory bytes: bytes];
#else
_result([FlutterError errorWithCode:@"Unsupported function"
message:@"The save function requires the document picker to be compiled in. Remove the Pod::PICKER_DOCUMENT=false statement from your Podfile."
details:nil]);
#endif
} else {
result(FlutterMethodNotImplemented);
_result = nil;
Expand All @@ -167,6 +173,7 @@ - (NSString*)getDocumentDirectory {

#pragma mark - Resolvers

#ifdef PICKER_DOCUMENT
- (void)saveFileWithName:(NSString*)fileName fileType:(NSString *)fileType initialDirectory:(NSString*)initialDirectory bytes:(FlutterStandardTypedData*)bytes{
self.isSaveFile = YES;
NSFileManager* fm = [NSFileManager defaultManager];
Expand Down Expand Up @@ -197,6 +204,7 @@ - (void)saveFileWithName:(NSString*)fileName fileType:(NSString *)fileType initi
}
[[self viewControllerWithWindow:nil] presentViewController:self.documentPickerController animated:YES completion:nil];
}
#endif // PICKER_DOCUMENT

#ifdef PICKER_DOCUMENT
- (void)resolvePickDocumentWithMultiPick:(BOOL)allowsMultipleSelection pickDirectory:(BOOL)isDirectory {
Expand Down
2 changes: 1 addition & 1 deletion 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: 8.0.0+1
version: 8.0.1

dependencies:
flutter:
Expand Down
Loading