From 51245ece5a28f3d09f64aec1b85e8b05eacbab27 Mon Sep 17 00:00:00 2001
From: Victor Carreras <34163765+vicajilau@users.noreply.github.com>
Date: Thu, 18 Dec 2025 12:34:42 +0100
Subject: [PATCH] refactor(ios): Rename FileUtils to FilePickerUtils
Renames the `FileUtils` class and source files to `FilePickerUtils` in the iOS implementation. This includes updating the class definition, implementation, and the umbrella header import.
---
CHANGELOG.md | 4 ++
example/ios/Flutter/AppFrameworkInfo.plist | 2 +-
example/ios/Runner.xcodeproj/project.pbxproj | 10 ++--
.../xcshareddata/xcschemes/Runner.xcscheme | 2 +
.../xcshareddata/swiftpm/Package.resolved | 59 +++++++++++++++++++
.../Sources/file_picker/FilePickerPlugin.m | 12 ++--
.../{FileUtils.m => FilePickerUtils.m} | 6 +-
.../include/file_picker-umbrella.h | 2 +-
.../{FileUtils.h => FilePickerUtils.h} | 4 +-
pubspec.yaml | 2 +-
10 files changed, 85 insertions(+), 18 deletions(-)
create mode 100644 example/ios/Runner.xcworkspace/xcshareddata/swiftpm/Package.resolved
rename ios/file_picker/Sources/file_picker/{FileUtils.m => FilePickerUtils.m} (98%)
rename ios/file_picker/Sources/file_picker/include/file_picker/{FileUtils.h => FilePickerUtils.h} (92%)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 81a29cad..262bf834 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,7 @@
+## 10.3.9
+### iOS
+- Rename FileUtils to FilePickerUtils [#1921](https://github.com/miguelpruivo/flutter_file_picker/issues/1921)
+
## 10.3.8
### Android
- Restores the ms[df] URI handling logic in FileUtils.kt to fix file selection returning null on some devices.
diff --git a/example/ios/Flutter/AppFrameworkInfo.plist b/example/ios/Flutter/AppFrameworkInfo.plist
index 7c569640..1dc6cf76 100644
--- a/example/ios/Flutter/AppFrameworkInfo.plist
+++ b/example/ios/Flutter/AppFrameworkInfo.plist
@@ -21,6 +21,6 @@
CFBundleVersion
1.0
MinimumOSVersion
- 12.0
+ 13.0
diff --git a/example/ios/Runner.xcodeproj/project.pbxproj b/example/ios/Runner.xcodeproj/project.pbxproj
index 2c84137d..eab2cd12 100644
--- a/example/ios/Runner.xcodeproj/project.pbxproj
+++ b/example/ios/Runner.xcodeproj/project.pbxproj
@@ -48,6 +48,7 @@
97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; };
97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; };
97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
+ 78E0A7A72DC9AD7400C4905E /* FlutterGeneratedPluginSwiftPackage */ = {isa = PBXFileReference; lastKnownFileType = wrapper; name = FlutterGeneratedPluginSwiftPackage; path = Flutter/ephemeral/Packages/FlutterGeneratedPluginSwiftPackage; sourceTree = ""; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@@ -65,6 +66,7 @@
9740EEB11CF90186004384FC /* Flutter */ = {
isa = PBXGroup;
children = (
+ 78E0A7A72DC9AD7400C4905E /* FlutterGeneratedPluginSwiftPackage */,
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */,
9740EEB21CF90195004384FC /* Debug.xcconfig */,
7AFA3C8E1D35360C0083082E /* Release.xcconfig */,
@@ -309,7 +311,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
- IPHONEOS_DEPLOYMENT_TARGET = 12.0;
+ IPHONEOS_DEPLOYMENT_TARGET = 13.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
@@ -358,7 +360,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
- IPHONEOS_DEPLOYMENT_TARGET = 12.0;
+ IPHONEOS_DEPLOYMENT_TARGET = 13.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2";
@@ -383,7 +385,7 @@
"$(PROJECT_DIR)/Flutter",
);
INFOPLIST_FILE = Runner/Info.plist;
- IPHONEOS_DEPLOYMENT_TARGET = 12.0;
+ IPHONEOS_DEPLOYMENT_TARGET = 13.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
@@ -419,7 +421,7 @@
"$(PROJECT_DIR)/Flutter",
);
INFOPLIST_FILE = Runner/Info.plist;
- IPHONEOS_DEPLOYMENT_TARGET = 12.0;
+ IPHONEOS_DEPLOYMENT_TARGET = 13.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
diff --git a/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme
index dd5e6e00..851adedd 100644
--- a/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme
+++ b/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme
@@ -44,6 +44,7 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
+ customLLDBInitFile = "$(SRCROOT)/Flutter/ephemeral/flutter_lldbinit"
shouldUseLaunchSchemeArgsEnv = "YES">
@@ -91,7 +91,7 @@ - (void)handleMethodCall:(FlutterMethodCall*)call result:(FlutterResult)result {
_result = result;
if([call.method isEqualToString:@"clear"]) {
- _result([NSNumber numberWithBool: [FileUtils clearTemporaryFiles]]);
+ _result([NSNumber numberWithBool: [FilePickerUtils clearTemporaryFiles]]);
_result = nil;
return;
}
@@ -120,7 +120,7 @@ - (void)handleMethodCall:(FlutterMethodCall*)call result:(FlutterResult)result {
self.loadDataToMemory = ((NSNumber*)[arguments valueForKey:@"withData"]).boolValue;
if([call.method isEqualToString:@"any"] || [call.method containsString:@"custom"]) {
- self.allowedExtensions = [FileUtils resolveType:call.method withAllowedExtensions: [arguments valueForKey:@"allowedExtensions"]];
+ self.allowedExtensions = [FilePickerUtils resolveType:call.method withAllowedExtensions: [arguments valueForKey:@"allowedExtensions"]];
if(self.allowedExtensions == nil) {
_result([FlutterError errorWithCode:@"Unsupported file extension"
message:@"If you are providing extension filters make sure that you are only using FileType.custom and the extension are provided without the dot, (ie., jpg instead of .jpg). This could also have happened because you are using an unsupported file extension. If the problem persists, you may want to consider using FileType.any instead."
@@ -137,7 +137,7 @@ - (void)handleMethodCall:(FlutterMethodCall*)call result:(FlutterResult)result {
}
} else if([call.method isEqualToString:@"video"] || [call.method isEqualToString:@"image"] || [call.method isEqualToString:@"media"]) {
#ifdef PICKER_MEDIA
- [self resolvePickMedia:[FileUtils resolveMediaType:call.method] withMultiPick:isMultiplePick withCompressionAllowed:self.allowCompression];
+ [self resolvePickMedia:[FilePickerUtils resolveMediaType:call.method] withMultiPick:isMultiplePick withCompressionAllowed:self.allowCompression];
#else
_result([FlutterError errorWithCode:@"Unsupported picker type"
message:@"Support for the Media picker is not compiled in. Remove the Pod::PICKER_MEDIA=false statement from your Podfile."
@@ -386,7 +386,7 @@ - (void) resolvePickAudioWithMultiPick:(BOOL)isMultiPick {
- (void) handleResult:(id) files {
- _result([FileUtils resolveFileInfo: [files isKindOfClass: [NSArray class]] ? files : @[files] withData:self.loadDataToMemory]);
+ _result([FilePickerUtils resolveFileInfo: [files isKindOfClass: [NSArray class]] ? files : @[files] withData:self.loadDataToMemory]);
_result = nil;
}
@@ -661,7 +661,7 @@ - (void)mediaPicker: (MPMediaPickerController *)mediaPicker didPickMediaItems:(M
NSMutableArray * urls = [[NSMutableArray alloc] initWithCapacity:numberOfItems];
for(MPMediaItemCollection * item in [mediaItemCollection items]) {
- NSURL * cachedAsset = [FileUtils exportMusicAsset: [item valueForKey:MPMediaItemPropertyAssetURL] withName: [item valueForKey:MPMediaItemPropertyTitle]];
+ NSURL * cachedAsset = [FilePickerUtils exportMusicAsset: [item valueForKey:MPMediaItemPropertyAssetURL] withName: [item valueForKey:MPMediaItemPropertyTitle]];
[urls addObject: cachedAsset];
}
diff --git a/ios/file_picker/Sources/file_picker/FileUtils.m b/ios/file_picker/Sources/file_picker/FilePickerUtils.m
similarity index 98%
rename from ios/file_picker/Sources/file_picker/FileUtils.m
rename to ios/file_picker/Sources/file_picker/FilePickerUtils.m
index 82f2842e..ff06931b 100644
--- a/ios/file_picker/Sources/file_picker/FileUtils.m
+++ b/ios/file_picker/Sources/file_picker/FilePickerUtils.m
@@ -1,14 +1,14 @@
//
-// FileUtils.m
+// FilePickerUtils.m
// file_picker
//
// Created by Miguel Ruivo on 05/12/2018.
//
-#import "FileUtils.h"
+#import "FilePickerUtils.h"
#import "FileInfo.h"
-@implementation FileUtils
+@implementation FilePickerUtils
+ (BOOL) clearTemporaryFiles {
NSString *tmpDirectory = NSTemporaryDirectory();
diff --git a/ios/file_picker/Sources/file_picker/include/file_picker-umbrella.h b/ios/file_picker/Sources/file_picker/include/file_picker-umbrella.h
index 56ad254a..8a1801af 100644
--- a/ios/file_picker/Sources/file_picker/include/file_picker-umbrella.h
+++ b/ios/file_picker/Sources/file_picker/include/file_picker-umbrella.h
@@ -1,4 +1,4 @@
#import
#import
-#import
+#import
#import
diff --git a/ios/file_picker/Sources/file_picker/include/file_picker/FileUtils.h b/ios/file_picker/Sources/file_picker/include/file_picker/FilePickerUtils.h
similarity index 92%
rename from ios/file_picker/Sources/file_picker/include/file_picker/FileUtils.h
rename to ios/file_picker/Sources/file_picker/include/file_picker/FilePickerUtils.h
index 47c57c37..6378ac7d 100644
--- a/ios/file_picker/Sources/file_picker/include/file_picker/FileUtils.h
+++ b/ios/file_picker/Sources/file_picker/include/file_picker/FilePickerUtils.h
@@ -1,5 +1,5 @@
//
-// FileUtils.h
+// FilePickerUtils.h
// Pods
//
// Created by Miguel Ruivo on 05/12/2018.
@@ -19,7 +19,7 @@ typedef NS_ENUM(NSInteger, MediaType) {
MEDIA
};
-@interface FileUtils : NSObject
+@interface FilePickerUtils : NSObject
+ (BOOL) clearTemporaryFiles;
+ (NSArray*) resolveType:(NSString*)type withAllowedExtensions:(NSArray*)allowedExtensions;
+ (MediaType) resolveMediaType:(NSString*)type;
diff --git a/pubspec.yaml b/pubspec.yaml
index 264f35da..1b5d9806 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -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: 10.3.8
+version: 10.3.9
dependencies:
flutter: