diff --git a/.template/ios/Podfile b/.template/ios/Podfile index 9411102b..b0f87ea9 100644 --- a/.template/ios/Podfile +++ b/.template/ios/Podfile @@ -15,7 +15,7 @@ def flutter_root unless File.exist?(generated_xcode_build_settings_path) raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first" end - + File.foreach(generated_xcode_build_settings_path) do |line| matches = line.match(/FLUTTER_ROOT\=(.*)/) return matches[1].strip if matches @@ -30,12 +30,66 @@ flutter_ios_podfile_setup target 'Runner' do use_frameworks! use_modular_headers! - + flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__)) end post_install do |installer| installer.pods_project.targets.each do |target| flutter_additional_ios_build_settings(target) + target.build_configurations.each do |config| + # TODO You can enable the permissions needed here. + # permission, just remove the `#` character in front so it looks like this: + # + # ## dart: PermissionGroup.camera + #'PERMISSION_CAMERA=1' + # + # Preprocessor definitions can be found in: https://github.com/Baseflow/flutter-permission-handler/blob/master/permission_handler/ios/Classes/PermissionHandlerEnums.h + config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= [ + '$(inherited)', + + ## dart: PermissionGroup.calendar + # 'PERMISSION_EVENTS=1', + + ## dart: PermissionGroup.reminders + # 'PERMISSION_REMINDERS=1', + + ## dart: PermissionGroup.contacts + # 'PERMISSION_CONTACTS=1', + + ## dart: PermissionGroup.camera + # 'PERMISSION_CAMERA=1', + + ## dart: PermissionGroup.microphone + # 'PERMISSION_MICROPHONE=1', + + ## dart: PermissionGroup.speech + # 'PERMISSION_SPEECH_RECOGNIZER=1', + + ## dart: PermissionGroup.photos + # 'PERMISSION_PHOTOS=1', + + ## dart: [PermissionGroup.location, PermissionGroup.locationAlways, PermissionGroup.locationWhenInUse] + # 'PERMISSION_LOCATION=1', + + ## dart: PermissionGroup.notification + # 'PERMISSION_NOTIFICATIONS=1', + + ## dart: PermissionGroup.mediaLibrary + # 'PERMISSION_MEDIA_LIBRARY=1', + + ## dart: PermissionGroup.sensors + # 'PERMISSION_SENSORS=1', + + ## dart: PermissionGroup.bluetooth + # 'PERMISSION_BLUETOOTH=1', + + ## dart: PermissionGroup.appTrackingTransparency + # 'PERMISSION_APP_TRACKING_TRANSPARENCY=1', + + ## dart: PermissionGroup.criticalAlerts + # 'PERMISSION_CRITICAL_ALERTS=1' + ] + end end end diff --git a/.template/ios/Podfile.lock b/.template/ios/Podfile.lock index 21cd2dc7..60a217a4 100644 --- a/.template/ios/Podfile.lock +++ b/.template/ios/Podfile.lock @@ -6,12 +6,15 @@ PODS: - Flutter - package_info_plus (0.4.5): - Flutter + - "permission_handler (5.1.0+2)": + - Flutter DEPENDENCIES: - Flutter (from `Flutter`) - flutter_config (from `.symlinks/plugins/flutter_config/ios`) - integration_test (from `.symlinks/plugins/integration_test/ios`) - package_info_plus (from `.symlinks/plugins/package_info_plus/ios`) + - permission_handler (from `.symlinks/plugins/permission_handler/ios`) EXTERNAL SOURCES: Flutter: @@ -22,13 +25,16 @@ EXTERNAL SOURCES: :path: ".symlinks/plugins/integration_test/ios" package_info_plus: :path: ".symlinks/plugins/package_info_plus/ios" + permission_handler: + :path: ".symlinks/plugins/permission_handler/ios" SPEC CHECKSUMS: - Flutter: 50d75fe2f02b26cc09d224853bb45737f8b3214a + Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854 flutter_config: 2226c1df19c78fe34a05eb7f1363445f18e76fc1 integration_test: a1e7d09bd98eca2fc37aefd79d4f41ad37bdbbe5 package_info_plus: 6c92f08e1f853dc01228d6f553146438dafcd14e + permission_handler: ccb20a9fad0ee9b1314a52b70b76b473c5f8dab0 -PODFILE CHECKSUM: a75497545d4391e2d394c3668e20cfb1c2bbd4aa +PODFILE CHECKSUM: de482529810d31c8802b6be0fd93c8c3e038be64 COCOAPODS: 1.11.3 diff --git a/.template/lib/utils/wrappers/permission_wrapper.dart b/.template/lib/utils/wrappers/permission_wrapper.dart new file mode 100644 index 00000000..e46a7515 --- /dev/null +++ b/.template/lib/utils/wrappers/permission_wrapper.dart @@ -0,0 +1,31 @@ +import 'package:injectable/injectable.dart'; +import 'package:permission_handler/permission_handler.dart' + as permission_handler; + +abstract class PermissionWrapper { + Future requestCameraPermission(); + + Future isCameraPermissionDenied(); + + Future isCameraPermissionPermanentlyDenied(); +} + +@Singleton(as: PermissionWrapper) +class PermissionWrapperImpl extends PermissionWrapper { + @override + Future requestCameraPermission() { + return permission_handler.Permission.camera + .request() + .then((value) => value == permission_handler.PermissionStatus.granted); + } + + @override + Future isCameraPermissionDenied() { + return permission_handler.Permission.camera.isDenied; + } + + @override + Future isCameraPermissionPermanentlyDenied() { + return permission_handler.Permission.camera.isPermanentlyDenied; + } +} diff --git a/.template/pubspec.lock b/.template/pubspec.lock index f3d3ff87..ee95efc1 100644 --- a/.template/pubspec.lock +++ b/.template/pubspec.lock @@ -21,7 +21,7 @@ packages: name: archive url: "https://pub.dartlang.org" source: hosted - version: "3.1.11" + version: "3.3.0" args: dependency: transitive description: @@ -35,7 +35,7 @@ packages: name: async url: "https://pub.dartlang.org" source: hosted - version: "2.8.2" + version: "2.9.0" boolean_selector: dependency: transitive description: @@ -105,7 +105,7 @@ packages: name: characters url: "https://pub.dartlang.org" source: hosted - version: "1.2.0" + version: "1.2.1" charcode: dependency: transitive description: @@ -126,7 +126,7 @@ packages: name: clock url: "https://pub.dartlang.org" source: hosted - version: "1.1.0" + version: "1.1.1" code_builder: dependency: transitive description: @@ -161,7 +161,7 @@ packages: name: crypto url: "https://pub.dartlang.org" source: hosted - version: "3.0.1" + version: "3.0.2" cupertino_icons: dependency: "direct main" description: @@ -196,7 +196,7 @@ packages: name: fake_async url: "https://pub.dartlang.org" source: hosted - version: "1.3.0" + version: "1.3.1" ffi: dependency: transitive description: @@ -399,21 +399,21 @@ packages: name: matcher url: "https://pub.dartlang.org" source: hosted - version: "0.12.11" + version: "0.12.12" material_color_utilities: dependency: transitive description: name: material_color_utilities url: "https://pub.dartlang.org" source: hosted - version: "0.1.4" + version: "0.1.5" meta: dependency: transitive description: name: meta url: "https://pub.dartlang.org" source: hosted - version: "1.7.0" + version: "1.8.0" mime: dependency: transitive description: @@ -483,7 +483,21 @@ packages: name: path url: "https://pub.dartlang.org" source: hosted - version: "1.8.1" + version: "1.8.2" + permission_handler: + dependency: "direct main" + description: + name: permission_handler + url: "https://pub.dartlang.org" + source: hosted + version: "8.3.0" + permission_handler_platform_interface: + dependency: transitive + description: + name: permission_handler_platform_interface + url: "https://pub.dartlang.org" + source: hosted + version: "3.9.0" petitparser: dependency: transitive description: @@ -593,7 +607,7 @@ packages: name: source_span url: "https://pub.dartlang.org" source: hosted - version: "1.8.2" + version: "1.9.0" stack_trace: dependency: transitive description: @@ -621,28 +635,28 @@ packages: name: string_scanner url: "https://pub.dartlang.org" source: hosted - version: "1.1.0" + version: "1.1.1" sync_http: dependency: transitive description: name: sync_http url: "https://pub.dartlang.org" source: hosted - version: "0.3.0" + version: "0.3.1" term_glyph: dependency: transitive description: name: term_glyph url: "https://pub.dartlang.org" source: hosted - version: "1.2.0" + version: "1.2.1" test_api: dependency: transitive description: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.4.9" + version: "0.4.12" time: dependency: transitive description: @@ -670,7 +684,7 @@ packages: name: typed_data url: "https://pub.dartlang.org" source: hosted - version: "1.3.0" + version: "1.3.1" vector_math: dependency: transitive description: @@ -684,7 +698,7 @@ packages: name: vm_service url: "https://pub.dartlang.org" source: hosted - version: "8.2.2" + version: "9.0.0" watcher: dependency: transitive description: diff --git a/.template/pubspec.yaml b/.template/pubspec.yaml index 8b06b401..35c20a9f 100644 --- a/.template/pubspec.yaml +++ b/.template/pubspec.yaml @@ -33,6 +33,7 @@ dependencies: intl: ^0.17.0 json_annotation: ^4.5.0 package_info_plus: ^1.4.2 + permission_handler: ^8.3.0 retrofit: ^3.0.1+1 dev_dependencies: