Refactors CUSTOM to custom on getFile()
This commit is contained in:
parent
4b1c047581
commit
43a27cd117
|
@ -1,3 +1,6 @@
|
||||||
|
## 1.8.0+1
|
||||||
|
Minor fix on `getFile()` method — should affect only those on 1.8.0.
|
||||||
|
|
||||||
## 1.8.0
|
## 1.8.0
|
||||||
Adds `FileType.media` that will allow you to pick video and images at the same time. On iOS, this will let you pick directly from Photos app (gallery), if you want to use Files app, you _must_ use `FileType.custom` with desired extensions.
|
Adds `FileType.media` that will allow you to pick video and images at the same time. On iOS, this will let you pick directly from Photos app (gallery), if you want to use Files app, you _must_ use `FileType.custom` with desired extensions.
|
||||||
|
|
||||||
|
|
|
@ -1,59 +1,82 @@
|
||||||
# Uncomment this line to define a global platform for your project
|
# Uncomment this line to define a global platform for your project
|
||||||
platform :ios, '8.0'
|
# platform :ios, '9.0'
|
||||||
|
|
||||||
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
|
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
|
||||||
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
|
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
|
||||||
|
|
||||||
|
project 'Runner', {
|
||||||
|
'Debug' => :debug,
|
||||||
|
'Profile' => :release,
|
||||||
|
'Release' => :release,
|
||||||
|
}
|
||||||
|
|
||||||
def parse_KV_file(file, separator='=')
|
def parse_KV_file(file, separator='=')
|
||||||
file_abs_path = File.expand_path(file)
|
file_abs_path = File.expand_path(file)
|
||||||
if !File.exists? file_abs_path
|
if !File.exists? file_abs_path
|
||||||
return [];
|
return [];
|
||||||
end
|
end
|
||||||
pods_ary = []
|
generated_key_values = {}
|
||||||
skip_line_start_symbols = ["#", "/"]
|
skip_line_start_symbols = ["#", "/"]
|
||||||
File.foreach(file_abs_path) { |line|
|
File.foreach(file_abs_path) do |line|
|
||||||
next if skip_line_start_symbols.any? { |symbol| line =~ /^\s*#{symbol}/ }
|
next if skip_line_start_symbols.any? { |symbol| line =~ /^\s*#{symbol}/ }
|
||||||
plugin = line.split(pattern=separator)
|
plugin = line.split(pattern=separator)
|
||||||
if plugin.length == 2
|
if plugin.length == 2
|
||||||
podname = plugin[0].strip()
|
podname = plugin[0].strip()
|
||||||
path = plugin[1].strip()
|
path = plugin[1].strip()
|
||||||
podpath = File.expand_path("#{path}", file_abs_path)
|
podpath = File.expand_path("#{path}", file_abs_path)
|
||||||
pods_ary.push({:name => podname, :path => podpath});
|
generated_key_values[podname] = podpath
|
||||||
else
|
else
|
||||||
puts "Invalid plugin specification: #{line}"
|
puts "Invalid plugin specification: #{line}"
|
||||||
end
|
end
|
||||||
}
|
end
|
||||||
return pods_ary
|
generated_key_values
|
||||||
end
|
end
|
||||||
|
|
||||||
target 'Runner' do
|
target 'Runner' do
|
||||||
|
# Flutter Pod
|
||||||
use_frameworks!
|
use_frameworks!
|
||||||
|
copied_flutter_dir = File.join(__dir__, 'Flutter')
|
||||||
|
copied_framework_path = File.join(copied_flutter_dir, 'Flutter.framework')
|
||||||
|
copied_podspec_path = File.join(copied_flutter_dir, 'Flutter.podspec')
|
||||||
|
unless File.exist?(copied_framework_path) && File.exist?(copied_podspec_path)
|
||||||
|
# Copy Flutter.framework and Flutter.podspec to Flutter/ to have something to link against if the xcode backend script has not run yet.
|
||||||
|
# That script will copy the correct debug/profile/release version of the framework based on the currently selected Xcode configuration.
|
||||||
|
# CocoaPods will not embed the framework on pod install (before any build phases can generate) if the dylib does not exist.
|
||||||
|
|
||||||
|
generated_xcode_build_settings_path = File.join(copied_flutter_dir, 'Generated.xcconfig')
|
||||||
|
unless File.exist?(generated_xcode_build_settings_path)
|
||||||
|
raise "Generated.xcconfig must exist. If you're running pod install manually, make sure flutter pub get is executed first"
|
||||||
|
end
|
||||||
|
generated_xcode_build_settings = parse_KV_file(generated_xcode_build_settings_path)
|
||||||
|
cached_framework_dir = generated_xcode_build_settings['FLUTTER_FRAMEWORK_DIR'];
|
||||||
|
|
||||||
|
unless File.exist?(copied_framework_path)
|
||||||
|
FileUtils.cp_r(File.join(cached_framework_dir, 'Flutter.framework'), copied_flutter_dir)
|
||||||
|
end
|
||||||
|
unless File.exist?(copied_podspec_path)
|
||||||
|
FileUtils.cp(File.join(cached_framework_dir, 'Flutter.podspec'), copied_flutter_dir)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# Keep pod path relative so it can be checked into Podfile.lock.
|
||||||
|
pod 'Flutter', :path => 'Flutter'
|
||||||
|
|
||||||
|
# Plugin Pods
|
||||||
|
|
||||||
# Prepare symlinks folder. We use symlinks to avoid having Podfile.lock
|
# Prepare symlinks folder. We use symlinks to avoid having Podfile.lock
|
||||||
# referring to absolute paths on developers' machines.
|
# referring to absolute paths on developers' machines.
|
||||||
system('rm -rf .symlinks')
|
system('rm -rf .symlinks')
|
||||||
system('mkdir -p .symlinks/plugins')
|
system('mkdir -p .symlinks/plugins')
|
||||||
|
|
||||||
# Flutter Pods
|
|
||||||
generated_xcode_build_settings = parse_KV_file('./Flutter/Generated.xcconfig')
|
|
||||||
if generated_xcode_build_settings.empty?
|
|
||||||
puts "Generated.xcconfig must exist. If you're running pod install manually, make sure flutter packages get is executed first."
|
|
||||||
end
|
|
||||||
generated_xcode_build_settings.map { |p|
|
|
||||||
if p[:name] == 'FLUTTER_FRAMEWORK_DIR'
|
|
||||||
symlink = File.join('.symlinks', 'flutter')
|
|
||||||
File.symlink(File.dirname(p[:path]), symlink)
|
|
||||||
pod 'Flutter', :path => File.join(symlink, File.basename(p[:path]))
|
|
||||||
end
|
|
||||||
}
|
|
||||||
|
|
||||||
# Plugin Pods
|
|
||||||
plugin_pods = parse_KV_file('../.flutter-plugins')
|
plugin_pods = parse_KV_file('../.flutter-plugins')
|
||||||
plugin_pods.map { |p|
|
plugin_pods.each do |name, path|
|
||||||
symlink = File.join('.symlinks', 'plugins', p[:name])
|
symlink = File.join('.symlinks', 'plugins', name)
|
||||||
File.symlink(p[:path], symlink)
|
File.symlink(path, symlink)
|
||||||
pod p[:name], :path => File.join(symlink, 'ios')
|
pod name, :path => File.join(symlink, 'ios')
|
||||||
}
|
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# Prevent Cocoapods from embedding a second Flutter framework and causing an error with the new Xcode build system.
|
||||||
|
install! 'cocoapods', :disable_input_output_paths => true
|
||||||
|
|
||||||
post_install do |installer|
|
post_install do |installer|
|
||||||
installer.pods_project.targets.each do |target|
|
installer.pods_project.targets.each do |target|
|
||||||
|
|
|
@ -65,7 +65,7 @@ PODS:
|
||||||
|
|
||||||
DEPENDENCIES:
|
DEPENDENCIES:
|
||||||
- file_picker (from `.symlinks/plugins/file_picker/ios`)
|
- file_picker (from `.symlinks/plugins/file_picker/ios`)
|
||||||
- Flutter (from `.symlinks/flutter/ios`)
|
- Flutter (from `Flutter`)
|
||||||
- flutter_plugin_android_lifecycle (from `.symlinks/plugins/flutter_plugin_android_lifecycle/ios`)
|
- flutter_plugin_android_lifecycle (from `.symlinks/plugins/flutter_plugin_android_lifecycle/ios`)
|
||||||
|
|
||||||
SPEC REPOS:
|
SPEC REPOS:
|
||||||
|
@ -82,7 +82,7 @@ EXTERNAL SOURCES:
|
||||||
file_picker:
|
file_picker:
|
||||||
:path: ".symlinks/plugins/file_picker/ios"
|
:path: ".symlinks/plugins/file_picker/ios"
|
||||||
Flutter:
|
Flutter:
|
||||||
:path: ".symlinks/flutter/ios"
|
:path: Flutter
|
||||||
flutter_plugin_android_lifecycle:
|
flutter_plugin_android_lifecycle:
|
||||||
:path: ".symlinks/plugins/flutter_plugin_android_lifecycle/ios"
|
:path: ".symlinks/plugins/flutter_plugin_android_lifecycle/ios"
|
||||||
|
|
||||||
|
@ -98,6 +98,6 @@ SPEC CHECKSUMS:
|
||||||
SDWebImage: 97351f6582ceca541ea294ba66a1fcb342a331c2
|
SDWebImage: 97351f6582ceca541ea294ba66a1fcb342a331c2
|
||||||
SDWebImageFLPlugin: 6c2295fb1242d44467c6c87dc5db6b0a13228fd8
|
SDWebImageFLPlugin: 6c2295fb1242d44467c6c87dc5db6b0a13228fd8
|
||||||
|
|
||||||
PODFILE CHECKSUM: 27341c1ab2a92ab24c1e60a397ab924b94c94ff5
|
PODFILE CHECKSUM: d5067366bad8216f789a99f6384e7bef21d4a19b
|
||||||
|
|
||||||
COCOAPODS: 1.8.4
|
COCOAPODS: 1.9.1
|
||||||
|
|
|
@ -66,7 +66,7 @@ class FilePicker {
|
||||||
|
|
||||||
static Future<dynamic> _getPath(String type, bool allowMultipleSelection,
|
static Future<dynamic> _getPath(String type, bool allowMultipleSelection,
|
||||||
List<String> allowedExtensions) async {
|
List<String> allowedExtensions) async {
|
||||||
if (type != 'CUSTOM' && (allowedExtensions?.isNotEmpty ?? false)) {
|
if (type != 'custom' && (allowedExtensions?.isNotEmpty ?? false)) {
|
||||||
throw Exception(
|
throw Exception(
|
||||||
'If you are using a custom extension filter, please use the FileType.custom instead.');
|
'If you are using a custom extension filter, please use the FileType.custom instead.');
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
name: file_picker
|
name: file_picker
|
||||||
description: A package that allows you to use a native file explorer to pick single or multiple absolute file paths, with extension filtering support.
|
description: A package that allows you to use a native file explorer to pick single or multiple absolute file paths, with extension filtering support.
|
||||||
homepage: https://github.com/miguelpruivo/plugins_flutter_file_picker
|
homepage: https://github.com/miguelpruivo/plugins_flutter_file_picker
|
||||||
version: 1.8.0
|
version: 1.8.0+1
|
||||||
|
|
||||||
dependencies:
|
dependencies:
|
||||||
flutter:
|
flutter:
|
||||||
|
|
Loading…
Reference in New Issue