Skip to content

Commit

Permalink
downgrade permission_handler
Browse files Browse the repository at this point in the history
  • Loading branch information
sirily11 committed Apr 19, 2020
1 parent 8c56497 commit 1dae24e
Show file tree
Hide file tree
Showing 8 changed files with 82 additions and 56 deletions.
2 changes: 1 addition & 1 deletion example/.flutter-plugins-dependencies
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"barcode_scan","path":"/Users/liqiwei/Documents/flutter/.pub-cache/hosted/pub.dartlang.org/barcode_scan-3.0.0/","dependencies":[]},{"name":"image_picker","path":"/Users/liqiwei/Documents/flutter/.pub-cache/hosted/pub.dartlang.org/image_picker-0.6.5/","dependencies":[]},{"name":"permission_handler","path":"/Users/liqiwei/Documents/flutter/.pub-cache/hosted/pub.dartlang.org/permission_handler-5.0.0+hotfix.3/","dependencies":[]}],"android":[{"name":"barcode_scan","path":"/Users/liqiwei/Documents/flutter/.pub-cache/hosted/pub.dartlang.org/barcode_scan-3.0.0/","dependencies":[]},{"name":"flutter_plugin_android_lifecycle","path":"/Users/liqiwei/Documents/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_plugin_android_lifecycle-1.0.5/","dependencies":[]},{"name":"image_picker","path":"/Users/liqiwei/Documents/flutter/.pub-cache/hosted/pub.dartlang.org/image_picker-0.6.5/","dependencies":["flutter_plugin_android_lifecycle"]},{"name":"permission_handler","path":"/Users/liqiwei/Documents/flutter/.pub-cache/hosted/pub.dartlang.org/permission_handler-5.0.0+hotfix.3/","dependencies":[]}],"macos":[],"linux":[],"windows":[],"web":[]},"dependencyGraph":[{"name":"barcode_scan","dependencies":[]},{"name":"flutter_plugin_android_lifecycle","dependencies":[]},{"name":"image_picker","dependencies":["flutter_plugin_android_lifecycle"]},{"name":"permission_handler","dependencies":[]}],"date_created":"2020-04-18 22:22:43.973813","version":"1.15.17"}
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"barcode_scan","path":"/Users/liqiwei/Documents/flutter/.pub-cache/hosted/pub.dartlang.org/barcode_scan-3.0.0/","dependencies":[]},{"name":"image_picker","path":"/Users/liqiwei/Documents/flutter/.pub-cache/hosted/pub.dartlang.org/image_picker-0.6.5/","dependencies":[]},{"name":"permission_handler","path":"/Users/liqiwei/Documents/flutter/.pub-cache/hosted/pub.dartlang.org/permission_handler-4.4.0+hotfix.4/","dependencies":[]}],"android":[{"name":"barcode_scan","path":"/Users/liqiwei/Documents/flutter/.pub-cache/hosted/pub.dartlang.org/barcode_scan-3.0.0/","dependencies":[]},{"name":"flutter_plugin_android_lifecycle","path":"/Users/liqiwei/Documents/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_plugin_android_lifecycle-1.0.5/","dependencies":[]},{"name":"image_picker","path":"/Users/liqiwei/Documents/flutter/.pub-cache/hosted/pub.dartlang.org/image_picker-0.6.5/","dependencies":["flutter_plugin_android_lifecycle"]},{"name":"permission_handler","path":"/Users/liqiwei/Documents/flutter/.pub-cache/hosted/pub.dartlang.org/permission_handler-4.4.0+hotfix.4/","dependencies":[]}],"macos":[],"linux":[],"windows":[],"web":[]},"dependencyGraph":[{"name":"barcode_scan","dependencies":[]},{"name":"flutter_plugin_android_lifecycle","dependencies":[]},{"name":"image_picker","dependencies":["flutter_plugin_android_lifecycle"]},{"name":"permission_handler","dependencies":[]}],"date_created":"2020-04-18 22:34:16.335772","version":"1.15.17"}
90 changes: 50 additions & 40 deletions example/ios/Podfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# Using a CDN with CocoaPods 1.7.2 or later can save a lot of time on pod installation, but it's experimental rather than the default.
# source 'https://cdn.cocoapods.org/'

# Uncomment this line to define a global platform for your project
# platform :ios, '9.0'

Expand All @@ -18,56 +15,69 @@ def parse_KV_file(file, separator='=')
if !File.exists? file_abs_path
return [];
end
pods_ary = []
generated_key_values = {}
skip_line_start_symbols = ["#", "/"]
File.foreach(file_abs_path) { |line|
next if skip_line_start_symbols.any? { |symbol| line =~ /^\s*#{symbol}/ }
plugin = line.split(pattern=separator)
if plugin.length == 2
podname = plugin[0].strip()
path = plugin[1].strip()
podpath = File.expand_path("#{path}", file_abs_path)
pods_ary.push({:name => podname, :path => podpath});
else
puts "Invalid plugin specification: #{line}"
end
}
return pods_ary
File.foreach(file_abs_path) do |line|
next if skip_line_start_symbols.any? { |symbol| line =~ /^\s*#{symbol}/ }
plugin = line.split(pattern=separator)
if plugin.length == 2
podname = plugin[0].strip()
path = plugin[1].strip()
podpath = File.expand_path("#{path}", file_abs_path)
generated_key_values[podname] = podpath
else
puts "Invalid plugin specification: #{line}"
end
end
generated_key_values
end

target 'Runner' do
use_frameworks!
use_modular_headers!

# Prepare symlinks folder. We use symlinks to avoid having Podfile.lock
# referring to absolute paths on developers' machines.
system('rm -rf .symlinks')
system('mkdir -p .symlinks/plugins')
# Flutter Pod

# 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 pub 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]))
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
# referring to absolute paths on developers' machines.
system('rm -rf .symlinks')
system('mkdir -p .symlinks/plugins')
plugin_pods = parse_KV_file('../.flutter-plugins')
plugin_pods.map { |p|
symlink = File.join('.symlinks', 'plugins', p[:name])
File.symlink(p[:path], symlink)
pod p[:name], :path => File.join(symlink, 'ios')
}
plugin_pods.each do |name, path|
symlink = File.join('.symlinks', 'plugins', name)
File.symlink(path, symlink)
pod name, :path => File.join(symlink, 'ios')
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|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
Expand Down
17 changes: 11 additions & 6 deletions example/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,35 @@ PODS:
- barcode_scan (0.0.1):
- Flutter
- MTBBarcodeScanner
- SwiftProtobuf
- Flutter (1.0.0)
- flutter_plugin_android_lifecycle (0.0.1):
- Flutter
- image_picker (0.0.1):
- Flutter
- MTBBarcodeScanner (5.0.11)
- "permission_handler (4.4.0+hotfix.1)":
- "permission_handler (4.4.0+hotfix.4)":
- Flutter
- SwiftProtobuf (1.8.0)

DEPENDENCIES:
- barcode_scan (from `.symlinks/plugins/barcode_scan/ios`)
- Flutter (from `.symlinks/flutter/ios`)
- Flutter (from `Flutter`)
- flutter_plugin_android_lifecycle (from `.symlinks/plugins/flutter_plugin_android_lifecycle/ios`)
- image_picker (from `.symlinks/plugins/image_picker/ios`)
- permission_handler (from `.symlinks/plugins/permission_handler/ios`)

SPEC REPOS:
https://github.com/CocoaPods/Specs.git:
- MTBBarcodeScanner
trunk:
- SwiftProtobuf

EXTERNAL SOURCES:
barcode_scan:
:path: ".symlinks/plugins/barcode_scan/ios"
Flutter:
:path: ".symlinks/flutter/ios"
:path: Flutter
flutter_plugin_android_lifecycle:
:path: ".symlinks/plugins/flutter_plugin_android_lifecycle/ios"
image_picker:
Expand All @@ -35,13 +39,14 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/permission_handler/ios"

SPEC CHECKSUMS:
barcode_scan: 33f586d02270046fc6559135038b34b5754eaa4f
barcode_scan: a5c27959edfafaa0c771905bad0b29d6d39e4479
Flutter: 0e3d915762c693b495b44d77113d4970485de6ec
flutter_plugin_android_lifecycle: 47de533a02850f070f5696a623995e93eddcdb9b
image_picker: e3eacd46b94694dde7cf2705955cece853aa1a8f
MTBBarcodeScanner: f453b33c4b7dfe545d8c6484ed744d55671788cb
permission_handler: aea60e5015e1ef439463be8f3ed643763649d2ce
permission_handler: 8278954f2382902f63f00dd8828769c0bd6d511b
SwiftProtobuf: 2cbd9409689b7df170d82a92a33443c8e3e14a70

PODFILE CHECKSUM: 10ae9c18d12c9ffc2275c9a159a3b1e281990db0
PODFILE CHECKSUM: c34e2287a9ccaa606aeceab922830efb9a6ff69a

COCOAPODS: 1.8.3
13 changes: 13 additions & 0 deletions example/ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -264,9 +264,22 @@
files = (
);
inputPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh",
"${PODS_ROOT}/../Flutter/Flutter.framework",
"${BUILT_PRODUCTS_DIR}/MTBBarcodeScanner/MTBBarcodeScanner.framework",
"${BUILT_PRODUCTS_DIR}/SwiftProtobuf/SwiftProtobuf.framework",
"${BUILT_PRODUCTS_DIR}/barcode_scan/barcode_scan.framework",
"${BUILT_PRODUCTS_DIR}/flutter_plugin_android_lifecycle/flutter_plugin_android_lifecycle.framework",
"${BUILT_PRODUCTS_DIR}/image_picker/image_picker.framework",
);
name = "[CP] Embed Pods Frameworks";
outputPaths = (
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Flutter.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/MTBBarcodeScanner.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SwiftProtobuf.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/barcode_scan.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/flutter_plugin_android_lifecycle.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/image_picker.framework",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
Expand Down
4 changes: 2 additions & 2 deletions example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -164,14 +164,14 @@ packages:
name: permission_handler
url: "https://pub.dartlang.org"
source: hosted
version: "5.0.0+hotfix.3"
version: "4.4.0+hotfix.4"
permission_handler_platform_interface:
dependency: transitive
description:
name: permission_handler_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
version: "1.0.0"
petitparser:
dependency: transitive
description:
Expand Down
6 changes: 2 additions & 4 deletions lib/json_textform/JSONForm.dart
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,8 @@ class _JSONSchemaFormState extends State<JSONForm> {
/// Merge actions
if (widget.actions != null) {
if (Platform.isIOS || Platform.isAndroid) {
[
Permission.location,
Permission.storage,
].request().then((v) => print("requested permission"));
PermissionHandler()
.requestPermissions([PermissionGroup.camera]).then((m) => null);
}

schemaList =
Expand Down
4 changes: 2 additions & 2 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -157,14 +157,14 @@ packages:
name: permission_handler
url: "https://pub.dartlang.org"
source: hosted
version: "5.0.0+hotfix.3"
version: "4.4.0+hotfix.4"
permission_handler_platform_interface:
dependency: transitive
description:
name: permission_handler_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
version: "1.0.0"
petitparser:
dependency: transitive
description:
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ dependencies:
sdk: flutter
dio: ^3.0.9
barcode_scan: ^3.0.0
permission_handler: ^5.0.0+hotfix.3
permission_handler: ^4.2.0+hotfix.1
progress_indicators: ^0.1.4
image_picker: ^0.6.5
provider: ^4.0.1
Expand Down

0 comments on commit 1dae24e

Please sign in to comment.