diff --git a/permission_handler/example/.metadata b/permission_handler/example/.metadata index 828ed53da..ab527d34f 100644 --- a/permission_handler/example/.metadata +++ b/permission_handler/example/.metadata @@ -4,7 +4,27 @@ # This file should be version controlled and should not be manually edited. version: - revision: 06b979c4d5e1b499745422269f01a00341257058 - channel: master + revision: "67457e669f79e9f8d13d7a68fe09775fefbb79f4" + channel: "stable" project_type: app + +# Tracks metadata for the flutter migrate command +migration: + platforms: + - platform: root + create_revision: 67457e669f79e9f8d13d7a68fe09775fefbb79f4 + base_revision: 67457e669f79e9f8d13d7a68fe09775fefbb79f4 + - platform: macos + create_revision: 67457e669f79e9f8d13d7a68fe09775fefbb79f4 + base_revision: 67457e669f79e9f8d13d7a68fe09775fefbb79f4 + + # User provided section + + # List of Local paths (relative to this file) that should be + # ignored by the migrate tool. + # + # Files that are not part of the templates will be ignored by default. + unmanaged_files: + - 'lib/main.dart' + - 'ios/Runner.xcodeproj/project.pbxproj' diff --git a/permission_handler/example/lib/main.dart b/permission_handler/example/lib/main.dart index b1615f332..bd0b085dc 100644 --- a/permission_handler/example/lib/main.dart +++ b/permission_handler/example/lib/main.dart @@ -37,7 +37,7 @@ class _PermissionHandlerWidgetState extends State { child: ListView( children: Permission.values .where((permission) { - if (Platform.isIOS) { + if (Platform.isIOS || Platform.isMacOS) { return permission != Permission.unknown && permission != Permission.phone && permission != Permission.sms && diff --git a/permission_handler/example/macos/.gitignore b/permission_handler/example/macos/.gitignore new file mode 100644 index 000000000..746adbb6b --- /dev/null +++ b/permission_handler/example/macos/.gitignore @@ -0,0 +1,7 @@ +# Flutter-related +**/Flutter/ephemeral/ +**/Pods/ + +# Xcode-related +**/dgph +**/xcuserdata/ diff --git a/permission_handler/example/macos/Flutter/Flutter-Debug.xcconfig b/permission_handler/example/macos/Flutter/Flutter-Debug.xcconfig new file mode 100644 index 000000000..4b81f9b2d --- /dev/null +++ b/permission_handler/example/macos/Flutter/Flutter-Debug.xcconfig @@ -0,0 +1,2 @@ +#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" +#include "ephemeral/Flutter-Generated.xcconfig" diff --git a/permission_handler/example/macos/Flutter/Flutter-Release.xcconfig b/permission_handler/example/macos/Flutter/Flutter-Release.xcconfig new file mode 100644 index 000000000..5caa9d157 --- /dev/null +++ b/permission_handler/example/macos/Flutter/Flutter-Release.xcconfig @@ -0,0 +1,2 @@ +#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" +#include "ephemeral/Flutter-Generated.xcconfig" diff --git a/permission_handler/example/macos/Flutter/GeneratedPluginRegistrant.swift b/permission_handler/example/macos/Flutter/GeneratedPluginRegistrant.swift new file mode 100644 index 000000000..368077d41 --- /dev/null +++ b/permission_handler/example/macos/Flutter/GeneratedPluginRegistrant.swift @@ -0,0 +1,14 @@ +// +// Generated file. Do not edit. +// + +import FlutterMacOS +import Foundation + +import permission_handler_apple +import url_launcher_macos + +func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { + PermissionHandlerPlugin.register(with: registry.registrar(forPlugin: "PermissionHandlerPlugin")) + UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin")) +} diff --git a/permission_handler/example/macos/Podfile b/permission_handler/example/macos/Podfile new file mode 100644 index 000000000..7c34bd943 --- /dev/null +++ b/permission_handler/example/macos/Podfile @@ -0,0 +1,100 @@ +platform :osx, '10.14' + +# CocoaPods analytics sends network stats synchronously affecting flutter build latency. +ENV['COCOAPODS_DISABLE_STATS'] = 'true' + +project 'Runner', { + 'Debug' => :debug, + 'Profile' => :release, + 'Release' => :release, +} + +def flutter_root + generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'ephemeral', 'Flutter-Generated.xcconfig'), __FILE__) + 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 + end + raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Flutter-Generated.xcconfig, then run \"flutter pub get\"" +end + +require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) + +flutter_macos_podfile_setup + +target 'Runner' do + use_frameworks! + use_modular_headers! + + flutter_install_all_macos_pods File.dirname(File.realpath(__FILE__)) + target 'RunnerTests' do + inherit! :search_paths + end +end + +post_install do |installer| + installer.pods_project.targets.each do |target| + flutter_additional_macos_build_settings(target) + + target.build_configurations.each do |config| + # You can remove unused permissions here + # for more infomation: https://github.com/BaseflowIT/flutter-permission-handler/blob/master/permission_handler/ios/Classes/PermissionHandlerEnums.h + # e.g. when you don't need camera permission, just add 'PERMISSION_CAMERA=0' + config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= [ + '$(inherited)', + + ## dart: [PermissionGroup.calendarWriteOnly, PermissionGroup.calendar (until iOS 16)] + 'PERMISSION_EVENTS=1', + + ## dart: [PermissionGroup.calendarFullAccess, PermissionGroup.calendar (from iOS 17)] + 'PERMISSION_EVENTS_FULL_ACCESS=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', + + ## dart: PermissionGroup.assistant + 'PERMISSION_ASSISTANT=1', + ] + end + end +end diff --git a/permission_handler/example/macos/Runner.xcodeproj/project.pbxproj b/permission_handler/example/macos/Runner.xcodeproj/project.pbxproj new file mode 100644 index 000000000..0aaddfce2 --- /dev/null +++ b/permission_handler/example/macos/Runner.xcodeproj/project.pbxproj @@ -0,0 +1,791 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 54; + objects = { + +/* Begin PBXAggregateTarget section */ + 33CC111A2044C6BA0003C045 /* Flutter Assemble */ = { + isa = PBXAggregateTarget; + buildConfigurationList = 33CC111B2044C6BA0003C045 /* Build configuration list for PBXAggregateTarget "Flutter Assemble" */; + buildPhases = ( + 33CC111E2044C6BF0003C045 /* ShellScript */, + ); + dependencies = ( + ); + name = "Flutter Assemble"; + productName = FLX; + }; +/* End PBXAggregateTarget section */ + +/* Begin PBXBuildFile section */ + 1F626AEBB2DB81018F8B753B /* Pods_RunnerTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 29EBD19EDFAD7BA765A6BFC1 /* Pods_RunnerTests.framework */; }; + 331C80D8294CF71000263BE5 /* RunnerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 331C80D7294CF71000263BE5 /* RunnerTests.swift */; }; + 335BBD1B22A9A15E00E9071D /* GeneratedPluginRegistrant.swift in Sources */ = {isa = PBXBuildFile; fileRef = 335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */; }; + 33CC10F12044A3C60003C045 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33CC10F02044A3C60003C045 /* AppDelegate.swift */; }; + 33CC10F32044A3C60003C045 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F22044A3C60003C045 /* Assets.xcassets */; }; + 33CC10F62044A3C60003C045 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F42044A3C60003C045 /* MainMenu.xib */; }; + 33CC11132044BFA00003C045 /* MainFlutterWindow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */; }; + 4AFBEDCAA7B50505B835D558 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B2AA6629268646F3F80BC6E4 /* Pods_Runner.framework */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + 331C80D9294CF71000263BE5 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 33CC10E52044A3C60003C045 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 33CC10EC2044A3C60003C045; + remoteInfo = Runner; + }; + 33CC111F2044C79F0003C045 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 33CC10E52044A3C60003C045 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 33CC111A2044C6BA0003C045; + remoteInfo = FLX; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXCopyFilesBuildPhase section */ + 33CC110E2044A8840003C045 /* Bundle Framework */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + ); + name = "Bundle Framework"; + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + 02748FC01A556C1DA50EF11E /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; + 29EBD19EDFAD7BA765A6BFC1 /* Pods_RunnerTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_RunnerTests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 2AD044CA4C1E993D2915A432 /* Pods-RunnerTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.release.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.release.xcconfig"; sourceTree = ""; }; + 331C80D5294CF71000263BE5 /* RunnerTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RunnerTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + 331C80D7294CF71000263BE5 /* RunnerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RunnerTests.swift; sourceTree = ""; }; + 333000ED22D3DE5D00554162 /* Warnings.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Warnings.xcconfig; sourceTree = ""; }; + 335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GeneratedPluginRegistrant.swift; sourceTree = ""; }; + 33CC10ED2044A3C60003C045 /* example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = example.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 33CC10F02044A3C60003C045 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; + 33CC10F22044A3C60003C045 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Assets.xcassets; path = Runner/Assets.xcassets; sourceTree = ""; }; + 33CC10F52044A3C60003C045 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainMenu.xib; sourceTree = ""; }; + 33CC10F72044A3C60003C045 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = Info.plist; path = Runner/Info.plist; sourceTree = ""; }; + 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainFlutterWindow.swift; sourceTree = ""; }; + 33CEB47222A05771004F2AC0 /* Flutter-Debug.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Flutter-Debug.xcconfig"; sourceTree = ""; }; + 33CEB47422A05771004F2AC0 /* Flutter-Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Flutter-Release.xcconfig"; sourceTree = ""; }; + 33CEB47722A0578A004F2AC0 /* Flutter-Generated.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = "Flutter-Generated.xcconfig"; path = "ephemeral/Flutter-Generated.xcconfig"; sourceTree = ""; }; + 33E51913231747F40026EE4D /* DebugProfile.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = DebugProfile.entitlements; sourceTree = ""; }; + 33E51914231749380026EE4D /* Release.entitlements */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.entitlements; path = Release.entitlements; sourceTree = ""; }; + 33E5194F232828860026EE4D /* AppInfo.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = AppInfo.xcconfig; sourceTree = ""; }; + 3B1E12C4C2A128F25B6F0325 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; }; + 56510573DF760DEB193F58A6 /* Pods-RunnerTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.debug.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.debug.xcconfig"; sourceTree = ""; }; + 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Release.xcconfig; sourceTree = ""; }; + 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Debug.xcconfig; sourceTree = ""; }; + B2AA6629268646F3F80BC6E4 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + C0B8142075EB894619BD7D38 /* Pods-RunnerTests.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.profile.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.profile.xcconfig"; sourceTree = ""; }; + F3CFBDD601279CC2575DE205 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 331C80D2294CF70F00263BE5 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 1F626AEBB2DB81018F8B753B /* Pods_RunnerTests.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 33CC10EA2044A3C60003C045 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 4AFBEDCAA7B50505B835D558 /* Pods_Runner.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 008BF54CD5221C21F0EF969F /* Pods */ = { + isa = PBXGroup; + children = ( + F3CFBDD601279CC2575DE205 /* Pods-Runner.debug.xcconfig */, + 02748FC01A556C1DA50EF11E /* Pods-Runner.release.xcconfig */, + 3B1E12C4C2A128F25B6F0325 /* Pods-Runner.profile.xcconfig */, + 56510573DF760DEB193F58A6 /* Pods-RunnerTests.debug.xcconfig */, + 2AD044CA4C1E993D2915A432 /* Pods-RunnerTests.release.xcconfig */, + C0B8142075EB894619BD7D38 /* Pods-RunnerTests.profile.xcconfig */, + ); + name = Pods; + path = Pods; + sourceTree = ""; + }; + 331C80D6294CF71000263BE5 /* RunnerTests */ = { + isa = PBXGroup; + children = ( + 331C80D7294CF71000263BE5 /* RunnerTests.swift */, + ); + path = RunnerTests; + sourceTree = ""; + }; + 33BA886A226E78AF003329D5 /* Configs */ = { + isa = PBXGroup; + children = ( + 33E5194F232828860026EE4D /* AppInfo.xcconfig */, + 9740EEB21CF90195004384FC /* Debug.xcconfig */, + 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, + 333000ED22D3DE5D00554162 /* Warnings.xcconfig */, + ); + path = Configs; + sourceTree = ""; + }; + 33CC10E42044A3C60003C045 = { + isa = PBXGroup; + children = ( + 33FAB671232836740065AC1E /* Runner */, + 33CEB47122A05771004F2AC0 /* Flutter */, + 331C80D6294CF71000263BE5 /* RunnerTests */, + 33CC10EE2044A3C60003C045 /* Products */, + D73912EC22F37F3D000D13A0 /* Frameworks */, + 008BF54CD5221C21F0EF969F /* Pods */, + ); + sourceTree = ""; + }; + 33CC10EE2044A3C60003C045 /* Products */ = { + isa = PBXGroup; + children = ( + 33CC10ED2044A3C60003C045 /* example.app */, + 331C80D5294CF71000263BE5 /* RunnerTests.xctest */, + ); + name = Products; + sourceTree = ""; + }; + 33CC11242044D66E0003C045 /* Resources */ = { + isa = PBXGroup; + children = ( + 33CC10F22044A3C60003C045 /* Assets.xcassets */, + 33CC10F42044A3C60003C045 /* MainMenu.xib */, + 33CC10F72044A3C60003C045 /* Info.plist */, + ); + name = Resources; + path = ..; + sourceTree = ""; + }; + 33CEB47122A05771004F2AC0 /* Flutter */ = { + isa = PBXGroup; + children = ( + 335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */, + 33CEB47222A05771004F2AC0 /* Flutter-Debug.xcconfig */, + 33CEB47422A05771004F2AC0 /* Flutter-Release.xcconfig */, + 33CEB47722A0578A004F2AC0 /* Flutter-Generated.xcconfig */, + ); + path = Flutter; + sourceTree = ""; + }; + 33FAB671232836740065AC1E /* Runner */ = { + isa = PBXGroup; + children = ( + 33CC10F02044A3C60003C045 /* AppDelegate.swift */, + 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */, + 33E51913231747F40026EE4D /* DebugProfile.entitlements */, + 33E51914231749380026EE4D /* Release.entitlements */, + 33CC11242044D66E0003C045 /* Resources */, + 33BA886A226E78AF003329D5 /* Configs */, + ); + path = Runner; + sourceTree = ""; + }; + D73912EC22F37F3D000D13A0 /* Frameworks */ = { + isa = PBXGroup; + children = ( + B2AA6629268646F3F80BC6E4 /* Pods_Runner.framework */, + 29EBD19EDFAD7BA765A6BFC1 /* Pods_RunnerTests.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 331C80D4294CF70F00263BE5 /* RunnerTests */ = { + isa = PBXNativeTarget; + buildConfigurationList = 331C80DE294CF71000263BE5 /* Build configuration list for PBXNativeTarget "RunnerTests" */; + buildPhases = ( + A48E3926DA83CA817DD53640 /* [CP] Check Pods Manifest.lock */, + 331C80D1294CF70F00263BE5 /* Sources */, + 331C80D2294CF70F00263BE5 /* Frameworks */, + 331C80D3294CF70F00263BE5 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + 331C80DA294CF71000263BE5 /* PBXTargetDependency */, + ); + name = RunnerTests; + productName = RunnerTests; + productReference = 331C80D5294CF71000263BE5 /* RunnerTests.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; + 33CC10EC2044A3C60003C045 /* Runner */ = { + isa = PBXNativeTarget; + buildConfigurationList = 33CC10FB2044A3C60003C045 /* Build configuration list for PBXNativeTarget "Runner" */; + buildPhases = ( + 3F0535D78670F0D07C7B3049 /* [CP] Check Pods Manifest.lock */, + 33CC10E92044A3C60003C045 /* Sources */, + 33CC10EA2044A3C60003C045 /* Frameworks */, + 33CC10EB2044A3C60003C045 /* Resources */, + 33CC110E2044A8840003C045 /* Bundle Framework */, + 3399D490228B24CF009A79C7 /* ShellScript */, + CBEB2CED178334BB2DD18A87 /* [CP] Embed Pods Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + 33CC11202044C79F0003C045 /* PBXTargetDependency */, + ); + name = Runner; + productName = Runner; + productReference = 33CC10ED2044A3C60003C045 /* example.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 33CC10E52044A3C60003C045 /* Project object */ = { + isa = PBXProject; + attributes = { + LastSwiftUpdateCheck = 0920; + LastUpgradeCheck = 1430; + ORGANIZATIONNAME = ""; + TargetAttributes = { + 331C80D4294CF70F00263BE5 = { + CreatedOnToolsVersion = 14.0; + TestTargetID = 33CC10EC2044A3C60003C045; + }; + 33CC10EC2044A3C60003C045 = { + CreatedOnToolsVersion = 9.2; + LastSwiftMigration = 1100; + ProvisioningStyle = Automatic; + SystemCapabilities = { + com.apple.Sandbox = { + enabled = 1; + }; + }; + }; + 33CC111A2044C6BA0003C045 = { + CreatedOnToolsVersion = 9.2; + ProvisioningStyle = Manual; + }; + }; + }; + buildConfigurationList = 33CC10E82044A3C60003C045 /* Build configuration list for PBXProject "Runner" */; + compatibilityVersion = "Xcode 9.3"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 33CC10E42044A3C60003C045; + productRefGroup = 33CC10EE2044A3C60003C045 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 33CC10EC2044A3C60003C045 /* Runner */, + 331C80D4294CF70F00263BE5 /* RunnerTests */, + 33CC111A2044C6BA0003C045 /* Flutter Assemble */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 331C80D3294CF70F00263BE5 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 33CC10EB2044A3C60003C045 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 33CC10F32044A3C60003C045 /* Assets.xcassets in Resources */, + 33CC10F62044A3C60003C045 /* MainMenu.xib in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + 3399D490228B24CF009A79C7 /* ShellScript */ = { + isa = PBXShellScriptBuildPhase; + alwaysOutOfDate = 1; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + ); + outputFileListPaths = ( + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "echo \"$PRODUCT_NAME.app\" > \"$PROJECT_DIR\"/Flutter/ephemeral/.app_filename && \"$FLUTTER_ROOT\"/packages/flutter_tools/bin/macos_assemble.sh embed\n"; + }; + 33CC111E2044C6BF0003C045 /* ShellScript */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + Flutter/ephemeral/FlutterInputs.xcfilelist, + ); + inputPaths = ( + Flutter/ephemeral/tripwire, + ); + outputFileListPaths = ( + Flutter/ephemeral/FlutterOutputs.xcfilelist, + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"$FLUTTER_ROOT\"/packages/flutter_tools/bin/macos_assemble.sh && touch Flutter/ephemeral/tripwire"; + }; + 3F0535D78670F0D07C7B3049 /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputFileListPaths = ( + ); + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; + A48E3926DA83CA817DD53640 /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputFileListPaths = ( + ); + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-RunnerTests-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; + CBEB2CED178334BB2DD18A87 /* [CP] Embed Pods Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist", + ); + name = "[CP] Embed Pods Frameworks"; + outputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; + showEnvVarsInLog = 0; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 331C80D1294CF70F00263BE5 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 331C80D8294CF71000263BE5 /* RunnerTests.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 33CC10E92044A3C60003C045 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 33CC11132044BFA00003C045 /* MainFlutterWindow.swift in Sources */, + 33CC10F12044A3C60003C045 /* AppDelegate.swift in Sources */, + 335BBD1B22A9A15E00E9071D /* GeneratedPluginRegistrant.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + 331C80DA294CF71000263BE5 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 33CC10EC2044A3C60003C045 /* Runner */; + targetProxy = 331C80D9294CF71000263BE5 /* PBXContainerItemProxy */; + }; + 33CC11202044C79F0003C045 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 33CC111A2044C6BA0003C045 /* Flutter Assemble */; + targetProxy = 33CC111F2044C79F0003C045 /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin PBXVariantGroup section */ + 33CC10F42044A3C60003C045 /* MainMenu.xib */ = { + isa = PBXVariantGroup; + children = ( + 33CC10F52044A3C60003C045 /* Base */, + ); + name = MainMenu.xib; + path = Runner; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 331C80DB294CF71000263BE5 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 56510573DF760DEB193F58A6 /* Pods-RunnerTests.debug.xcconfig */; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + CURRENT_PROJECT_VERSION = 1; + GENERATE_INFOPLIST_FILE = YES; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.example.example.RunnerTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/example.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/example"; + }; + name = Debug; + }; + 331C80DC294CF71000263BE5 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 2AD044CA4C1E993D2915A432 /* Pods-RunnerTests.release.xcconfig */; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + CURRENT_PROJECT_VERSION = 1; + GENERATE_INFOPLIST_FILE = YES; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.example.example.RunnerTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/example.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/example"; + }; + name = Release; + }; + 331C80DD294CF71000263BE5 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = C0B8142075EB894619BD7D38 /* Pods-RunnerTests.profile.xcconfig */; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + CURRENT_PROJECT_VERSION = 1; + GENERATE_INFOPLIST_FILE = YES; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.example.example.RunnerTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/example.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/example"; + }; + name = Profile; + }; + 338D0CE9231458BD00FA5F75 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CODE_SIGN_IDENTITY = "-"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.14; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = macosx; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + }; + name = Profile; + }; + 338D0CEA231458BD00FA5F75 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 33E5194F232828860026EE4D /* AppInfo.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_ENTITLEMENTS = Runner/DebugProfile.entitlements; + CODE_SIGN_STYLE = Automatic; + COMBINE_HIDPI_IMAGES = YES; + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + ); + PROVISIONING_PROFILE_SPECIFIER = ""; + SWIFT_VERSION = 5.0; + }; + name = Profile; + }; + 338D0CEB231458BD00FA5F75 /* Profile */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_STYLE = Manual; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Profile; + }; + 33CC10F92044A3C60003C045 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CODE_SIGN_IDENTITY = "-"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.14; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = macosx; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + }; + name = Debug; + }; + 33CC10FA2044A3C60003C045 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CODE_SIGN_IDENTITY = "-"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.14; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = macosx; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + }; + name = Release; + }; + 33CC10FC2044A3C60003C045 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 33E5194F232828860026EE4D /* AppInfo.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_ENTITLEMENTS = Runner/DebugProfile.entitlements; + CODE_SIGN_STYLE = Automatic; + COMBINE_HIDPI_IMAGES = YES; + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + ); + PROVISIONING_PROFILE_SPECIFIER = ""; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; + }; + name = Debug; + }; + 33CC10FD2044A3C60003C045 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 33E5194F232828860026EE4D /* AppInfo.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_ENTITLEMENTS = Runner/Release.entitlements; + CODE_SIGN_STYLE = Automatic; + COMBINE_HIDPI_IMAGES = YES; + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + ); + PROVISIONING_PROFILE_SPECIFIER = ""; + SWIFT_VERSION = 5.0; + }; + name = Release; + }; + 33CC111C2044C6BA0003C045 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_STYLE = Manual; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Debug; + }; + 33CC111D2044C6BA0003C045 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_STYLE = Automatic; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 331C80DE294CF71000263BE5 /* Build configuration list for PBXNativeTarget "RunnerTests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 331C80DB294CF71000263BE5 /* Debug */, + 331C80DC294CF71000263BE5 /* Release */, + 331C80DD294CF71000263BE5 /* Profile */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 33CC10E82044A3C60003C045 /* Build configuration list for PBXProject "Runner" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 33CC10F92044A3C60003C045 /* Debug */, + 33CC10FA2044A3C60003C045 /* Release */, + 338D0CE9231458BD00FA5F75 /* Profile */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 33CC10FB2044A3C60003C045 /* Build configuration list for PBXNativeTarget "Runner" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 33CC10FC2044A3C60003C045 /* Debug */, + 33CC10FD2044A3C60003C045 /* Release */, + 338D0CEA231458BD00FA5F75 /* Profile */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 33CC111B2044C6BA0003C045 /* Build configuration list for PBXAggregateTarget "Flutter Assemble" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 33CC111C2044C6BA0003C045 /* Debug */, + 33CC111D2044C6BA0003C045 /* Release */, + 338D0CEB231458BD00FA5F75 /* Profile */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 33CC10E52044A3C60003C045 /* Project object */; +} diff --git a/permission_handler/example/macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/permission_handler/example/macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 000000000..18d981003 --- /dev/null +++ b/permission_handler/example/macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/permission_handler/example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/permission_handler/example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme new file mode 100644 index 000000000..397f3d339 --- /dev/null +++ b/permission_handler/example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -0,0 +1,98 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/permission_handler/example/macos/Runner.xcworkspace/contents.xcworkspacedata b/permission_handler/example/macos/Runner.xcworkspace/contents.xcworkspacedata new file mode 100644 index 000000000..21a3cc14c --- /dev/null +++ b/permission_handler/example/macos/Runner.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,10 @@ + + + + + + + diff --git a/permission_handler/example/macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/permission_handler/example/macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 000000000..18d981003 --- /dev/null +++ b/permission_handler/example/macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/permission_handler/example/macos/Runner/AppDelegate.swift b/permission_handler/example/macos/Runner/AppDelegate.swift new file mode 100644 index 000000000..d53ef6437 --- /dev/null +++ b/permission_handler/example/macos/Runner/AppDelegate.swift @@ -0,0 +1,9 @@ +import Cocoa +import FlutterMacOS + +@NSApplicationMain +class AppDelegate: FlutterAppDelegate { + override func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool { + return true + } +} diff --git a/permission_handler/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json b/permission_handler/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 000000000..a2ec33f19 --- /dev/null +++ b/permission_handler/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,68 @@ +{ + "images" : [ + { + "size" : "16x16", + "idiom" : "mac", + "filename" : "app_icon_16.png", + "scale" : "1x" + }, + { + "size" : "16x16", + "idiom" : "mac", + "filename" : "app_icon_32.png", + "scale" : "2x" + }, + { + "size" : "32x32", + "idiom" : "mac", + "filename" : "app_icon_32.png", + "scale" : "1x" + }, + { + "size" : "32x32", + "idiom" : "mac", + "filename" : "app_icon_64.png", + "scale" : "2x" + }, + { + "size" : "128x128", + "idiom" : "mac", + "filename" : "app_icon_128.png", + "scale" : "1x" + }, + { + "size" : "128x128", + "idiom" : "mac", + "filename" : "app_icon_256.png", + "scale" : "2x" + }, + { + "size" : "256x256", + "idiom" : "mac", + "filename" : "app_icon_256.png", + "scale" : "1x" + }, + { + "size" : "256x256", + "idiom" : "mac", + "filename" : "app_icon_512.png", + "scale" : "2x" + }, + { + "size" : "512x512", + "idiom" : "mac", + "filename" : "app_icon_512.png", + "scale" : "1x" + }, + { + "size" : "512x512", + "idiom" : "mac", + "filename" : "app_icon_1024.png", + "scale" : "2x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} diff --git a/permission_handler/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png b/permission_handler/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png new file mode 100644 index 000000000..82b6f9d9a Binary files /dev/null and b/permission_handler/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png differ diff --git a/permission_handler/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png b/permission_handler/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png new file mode 100644 index 000000000..13b35eba5 Binary files /dev/null and b/permission_handler/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png differ diff --git a/permission_handler/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png b/permission_handler/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png new file mode 100644 index 000000000..0a3f5fa40 Binary files /dev/null and b/permission_handler/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png differ diff --git a/permission_handler/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png b/permission_handler/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png new file mode 100644 index 000000000..bdb57226d Binary files /dev/null and b/permission_handler/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png differ diff --git a/permission_handler/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png b/permission_handler/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png new file mode 100644 index 000000000..f083318e0 Binary files /dev/null and b/permission_handler/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png differ diff --git a/permission_handler/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png b/permission_handler/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png new file mode 100644 index 000000000..326c0e72c Binary files /dev/null and b/permission_handler/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png differ diff --git a/permission_handler/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png b/permission_handler/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png new file mode 100644 index 000000000..2f1632cfd Binary files /dev/null and b/permission_handler/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png differ diff --git a/permission_handler/example/macos/Runner/Base.lproj/MainMenu.xib b/permission_handler/example/macos/Runner/Base.lproj/MainMenu.xib new file mode 100644 index 000000000..80e867a4e --- /dev/null +++ b/permission_handler/example/macos/Runner/Base.lproj/MainMenu.xib @@ -0,0 +1,343 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/permission_handler/example/macos/Runner/Configs/AppInfo.xcconfig b/permission_handler/example/macos/Runner/Configs/AppInfo.xcconfig new file mode 100644 index 000000000..92fb3cd54 --- /dev/null +++ b/permission_handler/example/macos/Runner/Configs/AppInfo.xcconfig @@ -0,0 +1,14 @@ +// Application-level settings for the Runner target. +// +// This may be replaced with something auto-generated from metadata (e.g., pubspec.yaml) in the +// future. If not, the values below would default to using the project name when this becomes a +// 'flutter create' template. + +// The application's name. By default this is also the title of the Flutter window. +PRODUCT_NAME = example + +// The application's bundle identifier +PRODUCT_BUNDLE_IDENTIFIER = com.example.example + +// The copyright displayed in application information +PRODUCT_COPYRIGHT = Copyright © 2024 com.example. All rights reserved. diff --git a/permission_handler/example/macos/Runner/Configs/Debug.xcconfig b/permission_handler/example/macos/Runner/Configs/Debug.xcconfig new file mode 100644 index 000000000..36b0fd946 --- /dev/null +++ b/permission_handler/example/macos/Runner/Configs/Debug.xcconfig @@ -0,0 +1,2 @@ +#include "../../Flutter/Flutter-Debug.xcconfig" +#include "Warnings.xcconfig" diff --git a/permission_handler/example/macos/Runner/Configs/Release.xcconfig b/permission_handler/example/macos/Runner/Configs/Release.xcconfig new file mode 100644 index 000000000..dff4f4956 --- /dev/null +++ b/permission_handler/example/macos/Runner/Configs/Release.xcconfig @@ -0,0 +1,2 @@ +#include "../../Flutter/Flutter-Release.xcconfig" +#include "Warnings.xcconfig" diff --git a/permission_handler/example/macos/Runner/Configs/Warnings.xcconfig b/permission_handler/example/macos/Runner/Configs/Warnings.xcconfig new file mode 100644 index 000000000..42bcbf478 --- /dev/null +++ b/permission_handler/example/macos/Runner/Configs/Warnings.xcconfig @@ -0,0 +1,13 @@ +WARNING_CFLAGS = -Wall -Wconditional-uninitialized -Wnullable-to-nonnull-conversion -Wmissing-method-return-type -Woverlength-strings +GCC_WARN_UNDECLARED_SELECTOR = YES +CLANG_UNDEFINED_BEHAVIOR_SANITIZER_NULLABILITY = YES +CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE +CLANG_WARN__DUPLICATE_METHOD_MATCH = YES +CLANG_WARN_PRAGMA_PACK = YES +CLANG_WARN_STRICT_PROTOTYPES = YES +CLANG_WARN_COMMA = YES +GCC_WARN_STRICT_SELECTOR_MATCH = YES +CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = YES +CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES +GCC_WARN_SHADOW = YES +CLANG_WARN_UNREACHABLE_CODE = YES diff --git a/permission_handler/example/macos/Runner/DebugProfile.entitlements b/permission_handler/example/macos/Runner/DebugProfile.entitlements new file mode 100644 index 000000000..0e412f9b5 --- /dev/null +++ b/permission_handler/example/macos/Runner/DebugProfile.entitlements @@ -0,0 +1,36 @@ + + + + + com.apple.security.app-sandbox + + com.apple.security.assets.movies.read-write + + com.apple.security.assets.music.read-write + + com.apple.security.assets.pictures.read-write + + com.apple.security.cs.allow-jit + + com.apple.security.device.audio-input + + com.apple.security.device.bluetooth + + com.apple.security.device.camera + + com.apple.security.files.downloads.read-write + + com.apple.security.files.user-selected.read-write + + com.apple.security.network.client + + com.apple.security.network.server + + com.apple.security.personal-information.addressbook + + com.apple.security.personal-information.calendars + + com.apple.security.personal-information.location + + + diff --git a/permission_handler/example/macos/Runner/Info.plist b/permission_handler/example/macos/Runner/Info.plist new file mode 100644 index 000000000..4789daa6a --- /dev/null +++ b/permission_handler/example/macos/Runner/Info.plist @@ -0,0 +1,32 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIconFile + + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + APPL + CFBundleShortVersionString + $(FLUTTER_BUILD_NAME) + CFBundleVersion + $(FLUTTER_BUILD_NUMBER) + LSMinimumSystemVersion + $(MACOSX_DEPLOYMENT_TARGET) + NSHumanReadableCopyright + $(PRODUCT_COPYRIGHT) + NSMainNibFile + MainMenu + NSPrincipalClass + NSApplication + + diff --git a/permission_handler/example/macos/Runner/MainFlutterWindow.swift b/permission_handler/example/macos/Runner/MainFlutterWindow.swift new file mode 100644 index 000000000..3cc05eb23 --- /dev/null +++ b/permission_handler/example/macos/Runner/MainFlutterWindow.swift @@ -0,0 +1,15 @@ +import Cocoa +import FlutterMacOS + +class MainFlutterWindow: NSWindow { + override func awakeFromNib() { + let flutterViewController = FlutterViewController() + let windowFrame = self.frame + self.contentViewController = flutterViewController + self.setFrame(windowFrame, display: true) + + RegisterGeneratedPlugins(registry: flutterViewController) + + super.awakeFromNib() + } +} diff --git a/permission_handler/example/macos/Runner/Release.entitlements b/permission_handler/example/macos/Runner/Release.entitlements new file mode 100644 index 000000000..a4a6b761f --- /dev/null +++ b/permission_handler/example/macos/Runner/Release.entitlements @@ -0,0 +1,34 @@ + + + + + com.apple.security.app-sandbox + + com.apple.security.assets.movies.read-write + + com.apple.security.assets.music.read-write + + com.apple.security.assets.pictures.read-write + + com.apple.security.device.audio-input + + com.apple.security.device.bluetooth + + com.apple.security.device.camera + + com.apple.security.files.downloads.read-write + + com.apple.security.files.user-selected.read-write + + com.apple.security.network.client + + com.apple.security.network.server + + com.apple.security.personal-information.addressbook + + com.apple.security.personal-information.calendars + + com.apple.security.personal-information.location + + + diff --git a/permission_handler/example/macos/RunnerTests/RunnerTests.swift b/permission_handler/example/macos/RunnerTests/RunnerTests.swift new file mode 100644 index 000000000..5418c9f53 --- /dev/null +++ b/permission_handler/example/macos/RunnerTests/RunnerTests.swift @@ -0,0 +1,12 @@ +import FlutterMacOS +import Cocoa +import XCTest + +class RunnerTests: XCTestCase { + + func testExample() { + // If you add code to the Runner application, consider adding tests here. + // See https://developer.apple.com/documentation/xctest for more information about using XCTest. + } + +} diff --git a/permission_handler/pubspec.yaml b/permission_handler/pubspec.yaml index 5da5b7691..14ec947c3 100644 --- a/permission_handler/pubspec.yaml +++ b/permission_handler/pubspec.yaml @@ -19,6 +19,8 @@ flutter: default_package: permission_handler_html windows: default_package: permission_handler_windows + macos: + default_package: permission_handler_apple dependencies: flutter: diff --git a/permission_handler_apple/.metadata b/permission_handler_apple/.metadata new file mode 100644 index 000000000..834c66c14 --- /dev/null +++ b/permission_handler_apple/.metadata @@ -0,0 +1,33 @@ +# This file tracks properties of this Flutter project. +# Used by Flutter tool to assess capabilities and perform upgrades etc. +# +# This file should be version controlled. + +version: + revision: eb6d86ee27deecba4a83536aa20f366a6044895c + channel: stable + +project_type: plugin + +# Tracks metadata for the flutter migrate command +migration: + platforms: + - platform: root + create_revision: eb6d86ee27deecba4a83536aa20f366a6044895c + base_revision: eb6d86ee27deecba4a83536aa20f366a6044895c + - platform: ios + create_revision: eb6d86ee27deecba4a83536aa20f366a6044895c + base_revision: eb6d86ee27deecba4a83536aa20f366a6044895c + - platform: macos + create_revision: eb6d86ee27deecba4a83536aa20f366a6044895c + base_revision: eb6d86ee27deecba4a83536aa20f366a6044895c + + # User provided section + + # List of Local paths (relative to this file) that should be + # ignored by the migrate tool. + # + # Files that are not part of the templates will be ignored by default. + unmanaged_files: + - 'lib/main.dart' + - 'ios/Runner.xcodeproj/project.pbxproj' diff --git a/permission_handler_apple/example/.gitignore b/permission_handler_apple/example/.gitignore index 2156e772e..9c464b5c9 100644 --- a/permission_handler_apple/example/.gitignore +++ b/permission_handler_apple/example/.gitignore @@ -69,3 +69,5 @@ build/ !**/ios/**/default.pbxuser !**/ios/**/default.perspectivev3 !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages +/macos/Pods/ +/macos/Flutter/ephemeral/ diff --git a/permission_handler_apple/example/analysis_options.yaml b/permission_handler_apple/example/analysis_options.yaml new file mode 100644 index 000000000..61b6c4de1 --- /dev/null +++ b/permission_handler_apple/example/analysis_options.yaml @@ -0,0 +1,29 @@ +# This file configures the analyzer, which statically analyzes Dart code to +# check for errors, warnings, and lints. +# +# The issues identified by the analyzer are surfaced in the UI of Dart-enabled +# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be +# invoked from the command line by running `flutter analyze`. + +# The following line activates a set of recommended lints for Flutter apps, +# packages, and plugins designed to encourage good coding practices. +include: package:flutter_lints/flutter.yaml + +linter: + # The lint rules applied to this project can be customized in the + # section below to disable rules from the `package:flutter_lints/flutter.yaml` + # included above or to enable additional rules. A list of all available lints + # and their documentation is published at + # https://dart-lang.github.io/linter/lints/index.html. + # + # Instead of disabling a lint rule for the entire project in the + # section below, it can also be suppressed for a single line of code + # or a specific dart file by using the `// ignore: name_of_lint` and + # `// ignore_for_file: name_of_lint` syntax on the line or in the file + # producing the lint. + rules: + # avoid_print: false # Uncomment to disable the `avoid_print` rule + # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule + +# Additional information about this file can be found at +# https://dart.dev/guides/language/analysis-options diff --git a/permission_handler_apple/example/ios/Runner.xcodeproj/project.pbxproj b/permission_handler_apple/example/ios/Runner.xcodeproj/project.pbxproj index 1f057e1e9..9f1337363 100644 --- a/permission_handler_apple/example/ios/Runner.xcodeproj/project.pbxproj +++ b/permission_handler_apple/example/ios/Runner.xcodeproj/project.pbxproj @@ -360,7 +360,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; - DEVELOPMENT_TEAM = 7624MWN53C; + DEVELOPMENT_TEAM = 2777LV8P44; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -375,7 +375,7 @@ "$(inherited)", "$(PROJECT_DIR)/Flutter", ); - PRODUCT_BUNDLE_IDENTIFIER = com.example.example; + PRODUCT_BUNDLE_IDENTIFIER = com.prova.flutterpermhandler2; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; SWIFT_VERSION = 5.0; @@ -430,7 +430,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 = 12.0; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; @@ -498,7 +498,7 @@ CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = Runner/RunnerDebug.entitlements; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; - DEVELOPMENT_TEAM = 7624MWN53C; + DEVELOPMENT_TEAM = 2777LV8P44; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -513,7 +513,7 @@ "$(inherited)", "$(PROJECT_DIR)/Flutter", ); - PRODUCT_BUNDLE_IDENTIFIER = com.example.example; + PRODUCT_BUNDLE_IDENTIFIER = com.prova.flutterpermhandler2; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; @@ -529,7 +529,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; - DEVELOPMENT_TEAM = 7624MWN53C; + DEVELOPMENT_TEAM = 2777LV8P44; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -544,7 +544,7 @@ "$(inherited)", "$(PROJECT_DIR)/Flutter", ); - PRODUCT_BUNDLE_IDENTIFIER = com.example.example; + PRODUCT_BUNDLE_IDENTIFIER = com.prova.flutterpermhandler2; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; SWIFT_VERSION = 5.0; diff --git a/permission_handler_apple/example/lib/main.dart b/permission_handler_apple/example/lib/main.dart index f35cf7592..771f53639 100644 --- a/permission_handler_apple/example/lib/main.dart +++ b/permission_handler_apple/example/lib/main.dart @@ -1,3 +1,5 @@ +// ignore_for_file: avoid_print, depend_on_referenced_packages + import 'package:baseflow_plugin_template/baseflow_plugin_template.dart'; import 'package:flutter/material.dart'; import 'package:permission_handler_platform_interface/permission_handler_platform_interface.dart'; @@ -17,14 +19,16 @@ final MaterialColor themeMaterialColor = /// A Flutter application demonstrating the functionality of this plugin class PermissionHandlerWidget extends StatefulWidget { + const PermissionHandlerWidget({Key? key}) : super(key: key); + /// Create a page containing the functionality of this plugin static ExamplePage createPage() { return ExamplePage( - Icons.location_on, (context) => PermissionHandlerWidget()); + Icons.location_on, (context) => const PermissionHandlerWidget()); } @override - _PermissionHandlerWidgetState createState() => + State createState() => _PermissionHandlerWidgetState(); } @@ -63,18 +67,19 @@ class _PermissionHandlerWidgetState extends State { /// Permission widget containing information about the passed [Permission] class PermissionWidget extends StatefulWidget { /// Constructs a [PermissionWidget] for the supplied [Permission] - const PermissionWidget(this._permission); + const PermissionWidget(this._permission, {Key? key}) : super(key: key); final Permission _permission; @override - State createState() => _PermissionState(_permission); + State createState() => _PermissionState(); } class _PermissionState extends State { - _PermissionState(this._permission); + _PermissionState(); + + Permission get _permission => widget._permission; - final Permission _permission; final PermissionHandlerPlatform _permissionHandler = PermissionHandlerPlatform.instance; PermissionStatus _permissionStatus = PermissionStatus.denied; diff --git a/permission_handler_apple/example/macos/Flutter/Flutter-Debug.xcconfig b/permission_handler_apple/example/macos/Flutter/Flutter-Debug.xcconfig new file mode 100644 index 000000000..4b81f9b2d --- /dev/null +++ b/permission_handler_apple/example/macos/Flutter/Flutter-Debug.xcconfig @@ -0,0 +1,2 @@ +#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" +#include "ephemeral/Flutter-Generated.xcconfig" diff --git a/permission_handler_apple/example/macos/Flutter/Flutter-Release.xcconfig b/permission_handler_apple/example/macos/Flutter/Flutter-Release.xcconfig new file mode 100644 index 000000000..5caa9d157 --- /dev/null +++ b/permission_handler_apple/example/macos/Flutter/Flutter-Release.xcconfig @@ -0,0 +1,2 @@ +#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" +#include "ephemeral/Flutter-Generated.xcconfig" diff --git a/permission_handler_apple/example/macos/Flutter/GeneratedPluginRegistrant.swift b/permission_handler_apple/example/macos/Flutter/GeneratedPluginRegistrant.swift new file mode 100644 index 000000000..368077d41 --- /dev/null +++ b/permission_handler_apple/example/macos/Flutter/GeneratedPluginRegistrant.swift @@ -0,0 +1,14 @@ +// +// Generated file. Do not edit. +// + +import FlutterMacOS +import Foundation + +import permission_handler_apple +import url_launcher_macos + +func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { + PermissionHandlerPlugin.register(with: registry.registrar(forPlugin: "PermissionHandlerPlugin")) + UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin")) +} diff --git a/permission_handler_apple/example/macos/Podfile b/permission_handler_apple/example/macos/Podfile new file mode 100644 index 000000000..1d6d71762 --- /dev/null +++ b/permission_handler_apple/example/macos/Podfile @@ -0,0 +1,91 @@ +platform :osx, '10.14' + +# CocoaPods analytics sends network stats synchronously affecting flutter build latency. +ENV['COCOAPODS_DISABLE_STATS'] = 'true' + +project 'Runner', { + 'Debug' => :debug, + 'Profile' => :release, + 'Release' => :release, +} + +def flutter_root + generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'ephemeral', 'Flutter-Generated.xcconfig'), __FILE__) + 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 + end + raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Flutter-Generated.xcconfig, then run \"flutter pub get\"" +end + +require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) + +flutter_macos_podfile_setup + +target 'Runner' do + use_frameworks! + use_modular_headers! + + flutter_install_all_macos_pods File.dirname(File.realpath(__FILE__)) +end + +post_install do |installer| + installer.pods_project.targets.each do |target| + flutter_additional_macos_build_settings(target) + + target.build_configurations.each do |config| + # You can remove unused permissions here + # for more infomation: https://github.com/BaseflowIT/flutter-permission-handler/blob/master/permission_handler/ios/Classes/PermissionHandlerEnums.h + # e.g. when you don't need camera permission, just add 'PERMISSION_CAMERA=0' + 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/permission_handler_apple/example/macos/Runner.xcodeproj/project.pbxproj b/permission_handler_apple/example/macos/Runner.xcodeproj/project.pbxproj new file mode 100644 index 000000000..006d6aeec --- /dev/null +++ b/permission_handler_apple/example/macos/Runner.xcodeproj/project.pbxproj @@ -0,0 +1,633 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 54; + objects = { + +/* Begin PBXAggregateTarget section */ + 33CC111A2044C6BA0003C045 /* Flutter Assemble */ = { + isa = PBXAggregateTarget; + buildConfigurationList = 33CC111B2044C6BA0003C045 /* Build configuration list for PBXAggregateTarget "Flutter Assemble" */; + buildPhases = ( + 33CC111E2044C6BF0003C045 /* ShellScript */, + ); + dependencies = ( + ); + name = "Flutter Assemble"; + productName = FLX; + }; +/* End PBXAggregateTarget section */ + +/* Begin PBXBuildFile section */ + 335BBD1B22A9A15E00E9071D /* GeneratedPluginRegistrant.swift in Sources */ = {isa = PBXBuildFile; fileRef = 335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */; }; + 33CC10F12044A3C60003C045 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33CC10F02044A3C60003C045 /* AppDelegate.swift */; }; + 33CC10F32044A3C60003C045 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F22044A3C60003C045 /* Assets.xcassets */; }; + 33CC10F62044A3C60003C045 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F42044A3C60003C045 /* MainMenu.xib */; }; + 33CC11132044BFA00003C045 /* MainFlutterWindow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */; }; + E4F9B4365D12975038071094 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 535BD62BB41A582E96810800 /* Pods_Runner.framework */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + 33CC111F2044C79F0003C045 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 33CC10E52044A3C60003C045 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 33CC111A2044C6BA0003C045; + remoteInfo = FLX; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXCopyFilesBuildPhase section */ + 33CC110E2044A8840003C045 /* Bundle Framework */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + ); + name = "Bundle Framework"; + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + 2E4A4BEA30510B02FBD426F5 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; + 333000ED22D3DE5D00554162 /* Warnings.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Warnings.xcconfig; sourceTree = ""; }; + 335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GeneratedPluginRegistrant.swift; sourceTree = ""; }; + 33CC10ED2044A3C60003C045 /* permission_handler_apple_example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = permission_handler_apple_example.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 33CC10F02044A3C60003C045 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; + 33CC10F22044A3C60003C045 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Assets.xcassets; path = Runner/Assets.xcassets; sourceTree = ""; }; + 33CC10F52044A3C60003C045 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainMenu.xib; sourceTree = ""; }; + 33CC10F72044A3C60003C045 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = Info.plist; path = Runner/Info.plist; sourceTree = ""; }; + 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainFlutterWindow.swift; sourceTree = ""; }; + 33CEB47222A05771004F2AC0 /* Flutter-Debug.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Flutter-Debug.xcconfig"; sourceTree = ""; }; + 33CEB47422A05771004F2AC0 /* Flutter-Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Flutter-Release.xcconfig"; sourceTree = ""; }; + 33CEB47722A0578A004F2AC0 /* Flutter-Generated.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = "Flutter-Generated.xcconfig"; path = "ephemeral/Flutter-Generated.xcconfig"; sourceTree = ""; }; + 33E51913231747F40026EE4D /* DebugProfile.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = DebugProfile.entitlements; sourceTree = ""; }; + 33E51914231749380026EE4D /* Release.entitlements */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.entitlements; path = Release.entitlements; sourceTree = ""; }; + 33E5194F232828860026EE4D /* AppInfo.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = AppInfo.xcconfig; sourceTree = ""; }; + 3CB360F305CA62130229983B /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; + 535BD62BB41A582E96810800 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Release.xcconfig; sourceTree = ""; }; + 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Debug.xcconfig; sourceTree = ""; }; + A592E4A260FAA339F90D8CED /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 33CC10EA2044A3C60003C045 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + E4F9B4365D12975038071094 /* Pods_Runner.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 33BA886A226E78AF003329D5 /* Configs */ = { + isa = PBXGroup; + children = ( + 33E5194F232828860026EE4D /* AppInfo.xcconfig */, + 9740EEB21CF90195004384FC /* Debug.xcconfig */, + 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, + 333000ED22D3DE5D00554162 /* Warnings.xcconfig */, + ); + path = Configs; + sourceTree = ""; + }; + 33CC10E42044A3C60003C045 = { + isa = PBXGroup; + children = ( + 33FAB671232836740065AC1E /* Runner */, + 33CEB47122A05771004F2AC0 /* Flutter */, + 33CC10EE2044A3C60003C045 /* Products */, + D73912EC22F37F3D000D13A0 /* Frameworks */, + 819AED743162914182C60A48 /* Pods */, + ); + sourceTree = ""; + }; + 33CC10EE2044A3C60003C045 /* Products */ = { + isa = PBXGroup; + children = ( + 33CC10ED2044A3C60003C045 /* permission_handler_apple_example.app */, + ); + name = Products; + sourceTree = ""; + }; + 33CC11242044D66E0003C045 /* Resources */ = { + isa = PBXGroup; + children = ( + 33CC10F22044A3C60003C045 /* Assets.xcassets */, + 33CC10F42044A3C60003C045 /* MainMenu.xib */, + 33CC10F72044A3C60003C045 /* Info.plist */, + ); + name = Resources; + path = ..; + sourceTree = ""; + }; + 33CEB47122A05771004F2AC0 /* Flutter */ = { + isa = PBXGroup; + children = ( + 335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */, + 33CEB47222A05771004F2AC0 /* Flutter-Debug.xcconfig */, + 33CEB47422A05771004F2AC0 /* Flutter-Release.xcconfig */, + 33CEB47722A0578A004F2AC0 /* Flutter-Generated.xcconfig */, + ); + path = Flutter; + sourceTree = ""; + }; + 33FAB671232836740065AC1E /* Runner */ = { + isa = PBXGroup; + children = ( + 33CC10F02044A3C60003C045 /* AppDelegate.swift */, + 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */, + 33E51913231747F40026EE4D /* DebugProfile.entitlements */, + 33E51914231749380026EE4D /* Release.entitlements */, + 33CC11242044D66E0003C045 /* Resources */, + 33BA886A226E78AF003329D5 /* Configs */, + ); + path = Runner; + sourceTree = ""; + }; + 819AED743162914182C60A48 /* Pods */ = { + isa = PBXGroup; + children = ( + 3CB360F305CA62130229983B /* Pods-Runner.debug.xcconfig */, + 2E4A4BEA30510B02FBD426F5 /* Pods-Runner.release.xcconfig */, + A592E4A260FAA339F90D8CED /* Pods-Runner.profile.xcconfig */, + ); + name = Pods; + path = Pods; + sourceTree = ""; + }; + D73912EC22F37F3D000D13A0 /* Frameworks */ = { + isa = PBXGroup; + children = ( + 535BD62BB41A582E96810800 /* Pods_Runner.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 33CC10EC2044A3C60003C045 /* Runner */ = { + isa = PBXNativeTarget; + buildConfigurationList = 33CC10FB2044A3C60003C045 /* Build configuration list for PBXNativeTarget "Runner" */; + buildPhases = ( + 48303CAF74EC5A59CD260460 /* [CP] Check Pods Manifest.lock */, + 33CC10E92044A3C60003C045 /* Sources */, + 33CC10EA2044A3C60003C045 /* Frameworks */, + 33CC10EB2044A3C60003C045 /* Resources */, + 33CC110E2044A8840003C045 /* Bundle Framework */, + 3399D490228B24CF009A79C7 /* ShellScript */, + B1B4450492D6EC58E5505E5C /* [CP] Embed Pods Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + 33CC11202044C79F0003C045 /* PBXTargetDependency */, + ); + name = Runner; + productName = Runner; + productReference = 33CC10ED2044A3C60003C045 /* permission_handler_apple_example.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 33CC10E52044A3C60003C045 /* Project object */ = { + isa = PBXProject; + attributes = { + LastSwiftUpdateCheck = 0920; + LastUpgradeCheck = 1430; + ORGANIZATIONNAME = ""; + TargetAttributes = { + 33CC10EC2044A3C60003C045 = { + CreatedOnToolsVersion = 9.2; + LastSwiftMigration = 1100; + ProvisioningStyle = Automatic; + SystemCapabilities = { + com.apple.Sandbox = { + enabled = 1; + }; + }; + }; + 33CC111A2044C6BA0003C045 = { + CreatedOnToolsVersion = 9.2; + ProvisioningStyle = Manual; + }; + }; + }; + buildConfigurationList = 33CC10E82044A3C60003C045 /* Build configuration list for PBXProject "Runner" */; + compatibilityVersion = "Xcode 9.3"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 33CC10E42044A3C60003C045; + productRefGroup = 33CC10EE2044A3C60003C045 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 33CC10EC2044A3C60003C045 /* Runner */, + 33CC111A2044C6BA0003C045 /* Flutter Assemble */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 33CC10EB2044A3C60003C045 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 33CC10F32044A3C60003C045 /* Assets.xcassets in Resources */, + 33CC10F62044A3C60003C045 /* MainMenu.xib in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + 3399D490228B24CF009A79C7 /* ShellScript */ = { + isa = PBXShellScriptBuildPhase; + alwaysOutOfDate = 1; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + ); + outputFileListPaths = ( + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "echo \"$PRODUCT_NAME.app\" > \"$PROJECT_DIR\"/Flutter/ephemeral/.app_filename && \"$FLUTTER_ROOT\"/packages/flutter_tools/bin/macos_assemble.sh embed\n"; + }; + 33CC111E2044C6BF0003C045 /* ShellScript */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + Flutter/ephemeral/FlutterInputs.xcfilelist, + ); + inputPaths = ( + Flutter/ephemeral/tripwire, + ); + outputFileListPaths = ( + Flutter/ephemeral/FlutterOutputs.xcfilelist, + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"$FLUTTER_ROOT\"/packages/flutter_tools/bin/macos_assemble.sh && touch Flutter/ephemeral/tripwire"; + }; + 48303CAF74EC5A59CD260460 /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputFileListPaths = ( + ); + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; + B1B4450492D6EC58E5505E5C /* [CP] Embed Pods Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist", + ); + name = "[CP] Embed Pods Frameworks"; + outputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; + showEnvVarsInLog = 0; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 33CC10E92044A3C60003C045 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 33CC11132044BFA00003C045 /* MainFlutterWindow.swift in Sources */, + 33CC10F12044A3C60003C045 /* AppDelegate.swift in Sources */, + 335BBD1B22A9A15E00E9071D /* GeneratedPluginRegistrant.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + 33CC11202044C79F0003C045 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 33CC111A2044C6BA0003C045 /* Flutter Assemble */; + targetProxy = 33CC111F2044C79F0003C045 /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin PBXVariantGroup section */ + 33CC10F42044A3C60003C045 /* MainMenu.xib */ = { + isa = PBXVariantGroup; + children = ( + 33CC10F52044A3C60003C045 /* Base */, + ); + name = MainMenu.xib; + path = Runner; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 338D0CE9231458BD00FA5F75 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CODE_SIGN_IDENTITY = "-"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.14; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = macosx; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + }; + name = Profile; + }; + 338D0CEA231458BD00FA5F75 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 33E5194F232828860026EE4D /* AppInfo.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_ENTITLEMENTS = Runner/DebugProfile.entitlements; + CODE_SIGN_STYLE = Automatic; + COMBINE_HIDPI_IMAGES = YES; + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + ); + PROVISIONING_PROFILE_SPECIFIER = ""; + SWIFT_VERSION = 5.0; + }; + name = Profile; + }; + 338D0CEB231458BD00FA5F75 /* Profile */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_STYLE = Manual; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Profile; + }; + 33CC10F92044A3C60003C045 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CODE_SIGN_IDENTITY = "-"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.14; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = macosx; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + }; + name = Debug; + }; + 33CC10FA2044A3C60003C045 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CODE_SIGN_IDENTITY = "-"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.14; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = macosx; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + }; + name = Release; + }; + 33CC10FC2044A3C60003C045 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 33E5194F232828860026EE4D /* AppInfo.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_ENTITLEMENTS = Runner/DebugProfile.entitlements; + CODE_SIGN_STYLE = Automatic; + COMBINE_HIDPI_IMAGES = YES; + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + ); + PROVISIONING_PROFILE_SPECIFIER = ""; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; + }; + name = Debug; + }; + 33CC10FD2044A3C60003C045 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 33E5194F232828860026EE4D /* AppInfo.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_ENTITLEMENTS = Runner/Release.entitlements; + CODE_SIGN_STYLE = Automatic; + COMBINE_HIDPI_IMAGES = YES; + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + ); + PROVISIONING_PROFILE_SPECIFIER = ""; + SWIFT_VERSION = 5.0; + }; + name = Release; + }; + 33CC111C2044C6BA0003C045 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_STYLE = Manual; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Debug; + }; + 33CC111D2044C6BA0003C045 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_STYLE = Automatic; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 33CC10E82044A3C60003C045 /* Build configuration list for PBXProject "Runner" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 33CC10F92044A3C60003C045 /* Debug */, + 33CC10FA2044A3C60003C045 /* Release */, + 338D0CE9231458BD00FA5F75 /* Profile */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 33CC10FB2044A3C60003C045 /* Build configuration list for PBXNativeTarget "Runner" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 33CC10FC2044A3C60003C045 /* Debug */, + 33CC10FD2044A3C60003C045 /* Release */, + 338D0CEA231458BD00FA5F75 /* Profile */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 33CC111B2044C6BA0003C045 /* Build configuration list for PBXAggregateTarget "Flutter Assemble" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 33CC111C2044C6BA0003C045 /* Debug */, + 33CC111D2044C6BA0003C045 /* Release */, + 338D0CEB231458BD00FA5F75 /* Profile */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 33CC10E52044A3C60003C045 /* Project object */; +} diff --git a/permission_handler_apple/example/macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/permission_handler_apple/example/macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 000000000..18d981003 --- /dev/null +++ b/permission_handler_apple/example/macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/permission_handler_apple/example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/permission_handler_apple/example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme new file mode 100644 index 000000000..726abc219 --- /dev/null +++ b/permission_handler_apple/example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -0,0 +1,87 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/permission_handler_apple/example/macos/Runner.xcodeproj/xcuserdata/melnyk.xcuserdatad/xcschemes/xcschememanagement.plist b/permission_handler_apple/example/macos/Runner.xcodeproj/xcuserdata/melnyk.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 000000000..b76e22b52 --- /dev/null +++ b/permission_handler_apple/example/macos/Runner.xcodeproj/xcuserdata/melnyk.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,19 @@ + + + + + SchemeUserState + + Flutter Assemble.xcscheme_^#shared#^_ + + orderHint + 5 + + Runner.xcscheme_^#shared#^_ + + orderHint + 0 + + + + diff --git a/permission_handler_apple/example/macos/Runner.xcworkspace/contents.xcworkspacedata b/permission_handler_apple/example/macos/Runner.xcworkspace/contents.xcworkspacedata new file mode 100644 index 000000000..21a3cc14c --- /dev/null +++ b/permission_handler_apple/example/macos/Runner.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,10 @@ + + + + + + + diff --git a/permission_handler_apple/example/macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/permission_handler_apple/example/macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 000000000..18d981003 --- /dev/null +++ b/permission_handler_apple/example/macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/permission_handler_apple/example/macos/Runner.xcworkspace/xcuserdata/melnyk.xcuserdatad/UserInterfaceState.xcuserstate b/permission_handler_apple/example/macos/Runner.xcworkspace/xcuserdata/melnyk.xcuserdatad/UserInterfaceState.xcuserstate new file mode 100644 index 000000000..59c414fd2 Binary files /dev/null and b/permission_handler_apple/example/macos/Runner.xcworkspace/xcuserdata/melnyk.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/permission_handler_apple/example/macos/Runner/AppDelegate.swift b/permission_handler_apple/example/macos/Runner/AppDelegate.swift new file mode 100644 index 000000000..d53ef6437 --- /dev/null +++ b/permission_handler_apple/example/macos/Runner/AppDelegate.swift @@ -0,0 +1,9 @@ +import Cocoa +import FlutterMacOS + +@NSApplicationMain +class AppDelegate: FlutterAppDelegate { + override func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool { + return true + } +} diff --git a/permission_handler_apple/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json b/permission_handler_apple/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 000000000..a2ec33f19 --- /dev/null +++ b/permission_handler_apple/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,68 @@ +{ + "images" : [ + { + "size" : "16x16", + "idiom" : "mac", + "filename" : "app_icon_16.png", + "scale" : "1x" + }, + { + "size" : "16x16", + "idiom" : "mac", + "filename" : "app_icon_32.png", + "scale" : "2x" + }, + { + "size" : "32x32", + "idiom" : "mac", + "filename" : "app_icon_32.png", + "scale" : "1x" + }, + { + "size" : "32x32", + "idiom" : "mac", + "filename" : "app_icon_64.png", + "scale" : "2x" + }, + { + "size" : "128x128", + "idiom" : "mac", + "filename" : "app_icon_128.png", + "scale" : "1x" + }, + { + "size" : "128x128", + "idiom" : "mac", + "filename" : "app_icon_256.png", + "scale" : "2x" + }, + { + "size" : "256x256", + "idiom" : "mac", + "filename" : "app_icon_256.png", + "scale" : "1x" + }, + { + "size" : "256x256", + "idiom" : "mac", + "filename" : "app_icon_512.png", + "scale" : "2x" + }, + { + "size" : "512x512", + "idiom" : "mac", + "filename" : "app_icon_512.png", + "scale" : "1x" + }, + { + "size" : "512x512", + "idiom" : "mac", + "filename" : "app_icon_1024.png", + "scale" : "2x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} diff --git a/permission_handler_apple/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png b/permission_handler_apple/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png new file mode 100644 index 000000000..82b6f9d9a Binary files /dev/null and b/permission_handler_apple/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png differ diff --git a/permission_handler_apple/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png b/permission_handler_apple/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png new file mode 100644 index 000000000..13b35eba5 Binary files /dev/null and b/permission_handler_apple/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png differ diff --git a/permission_handler_apple/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png b/permission_handler_apple/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png new file mode 100644 index 000000000..0a3f5fa40 Binary files /dev/null and b/permission_handler_apple/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png differ diff --git a/permission_handler_apple/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png b/permission_handler_apple/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png new file mode 100644 index 000000000..bdb57226d Binary files /dev/null and b/permission_handler_apple/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png differ diff --git a/permission_handler_apple/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png b/permission_handler_apple/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png new file mode 100644 index 000000000..f083318e0 Binary files /dev/null and b/permission_handler_apple/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png differ diff --git a/permission_handler_apple/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png b/permission_handler_apple/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png new file mode 100644 index 000000000..326c0e72c Binary files /dev/null and b/permission_handler_apple/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png differ diff --git a/permission_handler_apple/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png b/permission_handler_apple/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png new file mode 100644 index 000000000..2f1632cfd Binary files /dev/null and b/permission_handler_apple/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png differ diff --git a/permission_handler_apple/example/macos/Runner/Base.lproj/MainMenu.xib b/permission_handler_apple/example/macos/Runner/Base.lproj/MainMenu.xib new file mode 100644 index 000000000..80e867a4e --- /dev/null +++ b/permission_handler_apple/example/macos/Runner/Base.lproj/MainMenu.xib @@ -0,0 +1,343 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/permission_handler_apple/example/macos/Runner/Configs/AppInfo.xcconfig b/permission_handler_apple/example/macos/Runner/Configs/AppInfo.xcconfig new file mode 100644 index 000000000..35f7993ec --- /dev/null +++ b/permission_handler_apple/example/macos/Runner/Configs/AppInfo.xcconfig @@ -0,0 +1,14 @@ +// Application-level settings for the Runner target. +// +// This may be replaced with something auto-generated from metadata (e.g., pubspec.yaml) in the +// future. If not, the values below would default to using the project name when this becomes a +// 'flutter create' template. + +// The application's name. By default this is also the title of the Flutter window. +PRODUCT_NAME = permission_handler_apple_example + +// The application's bundle identifier +PRODUCT_BUNDLE_IDENTIFIER = com.example.permissionHandlerAppleExample + +// The copyright displayed in application information +PRODUCT_COPYRIGHT = Copyright © 2022 com.example. All rights reserved. diff --git a/permission_handler_apple/example/macos/Runner/Configs/Debug.xcconfig b/permission_handler_apple/example/macos/Runner/Configs/Debug.xcconfig new file mode 100644 index 000000000..36b0fd946 --- /dev/null +++ b/permission_handler_apple/example/macos/Runner/Configs/Debug.xcconfig @@ -0,0 +1,2 @@ +#include "../../Flutter/Flutter-Debug.xcconfig" +#include "Warnings.xcconfig" diff --git a/permission_handler_apple/example/macos/Runner/Configs/Release.xcconfig b/permission_handler_apple/example/macos/Runner/Configs/Release.xcconfig new file mode 100644 index 000000000..dff4f4956 --- /dev/null +++ b/permission_handler_apple/example/macos/Runner/Configs/Release.xcconfig @@ -0,0 +1,2 @@ +#include "../../Flutter/Flutter-Release.xcconfig" +#include "Warnings.xcconfig" diff --git a/permission_handler_apple/example/macos/Runner/Configs/Warnings.xcconfig b/permission_handler_apple/example/macos/Runner/Configs/Warnings.xcconfig new file mode 100644 index 000000000..42bcbf478 --- /dev/null +++ b/permission_handler_apple/example/macos/Runner/Configs/Warnings.xcconfig @@ -0,0 +1,13 @@ +WARNING_CFLAGS = -Wall -Wconditional-uninitialized -Wnullable-to-nonnull-conversion -Wmissing-method-return-type -Woverlength-strings +GCC_WARN_UNDECLARED_SELECTOR = YES +CLANG_UNDEFINED_BEHAVIOR_SANITIZER_NULLABILITY = YES +CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE +CLANG_WARN__DUPLICATE_METHOD_MATCH = YES +CLANG_WARN_PRAGMA_PACK = YES +CLANG_WARN_STRICT_PROTOTYPES = YES +CLANG_WARN_COMMA = YES +GCC_WARN_STRICT_SELECTOR_MATCH = YES +CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = YES +CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES +GCC_WARN_SHADOW = YES +CLANG_WARN_UNREACHABLE_CODE = YES diff --git a/permission_handler_apple/example/macos/Runner/DebugProfile.entitlements b/permission_handler_apple/example/macos/Runner/DebugProfile.entitlements new file mode 100644 index 000000000..0e412f9b5 --- /dev/null +++ b/permission_handler_apple/example/macos/Runner/DebugProfile.entitlements @@ -0,0 +1,36 @@ + + + + + com.apple.security.app-sandbox + + com.apple.security.assets.movies.read-write + + com.apple.security.assets.music.read-write + + com.apple.security.assets.pictures.read-write + + com.apple.security.cs.allow-jit + + com.apple.security.device.audio-input + + com.apple.security.device.bluetooth + + com.apple.security.device.camera + + com.apple.security.files.downloads.read-write + + com.apple.security.files.user-selected.read-write + + com.apple.security.network.client + + com.apple.security.network.server + + com.apple.security.personal-information.addressbook + + com.apple.security.personal-information.calendars + + com.apple.security.personal-information.location + + + diff --git a/permission_handler_apple/example/macos/Runner/Info.plist b/permission_handler_apple/example/macos/Runner/Info.plist new file mode 100644 index 000000000..a3204b119 --- /dev/null +++ b/permission_handler_apple/example/macos/Runner/Info.plist @@ -0,0 +1,54 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIconFile + + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + APPL + CFBundleShortVersionString + $(FLUTTER_BUILD_NAME) + CFBundleVersion + $(FLUTTER_BUILD_NUMBER) + LSMinimumSystemVersion + $(MACOSX_DEPLOYMENT_TARGET) + NSHumanReadableCopyright + $(PRODUCT_COPYRIGHT) + NSMainNibFile + MainMenu + NSPrincipalClass + NSApplication + NSCalendarsUsageDescription + Calendar example + NSContactsUsageDescription + Contacts example + NSPhotoLibraryAddUsageDescription + Photo Library Additions example + NSPhotoLibraryUsageDescription + Photo Library Usage example + NSLocationUsageDescription + Location example + NSLocationAlwaysUsageDescription + Location Always example + NSLocationWhenInUseUsageDescription + Location When In Use example + NSRemindersUsageDescription + Reminders example + NSSpeechRecognitionUsageDescription + Speech example + NSBluetoothAlwaysUsageDescription + Bluetooth example + NSMicrophoneUsageDescription + Microphone example + + diff --git a/permission_handler_apple/example/macos/Runner/MainFlutterWindow.swift b/permission_handler_apple/example/macos/Runner/MainFlutterWindow.swift new file mode 100644 index 000000000..2722837ec --- /dev/null +++ b/permission_handler_apple/example/macos/Runner/MainFlutterWindow.swift @@ -0,0 +1,15 @@ +import Cocoa +import FlutterMacOS + +class MainFlutterWindow: NSWindow { + override func awakeFromNib() { + let flutterViewController = FlutterViewController.init() + let windowFrame = self.frame + self.contentViewController = flutterViewController + self.setFrame(windowFrame, display: true) + + RegisterGeneratedPlugins(registry: flutterViewController) + + super.awakeFromNib() + } +} diff --git a/permission_handler_apple/example/macos/Runner/Release.entitlements b/permission_handler_apple/example/macos/Runner/Release.entitlements new file mode 100644 index 000000000..a4a6b761f --- /dev/null +++ b/permission_handler_apple/example/macos/Runner/Release.entitlements @@ -0,0 +1,34 @@ + + + + + com.apple.security.app-sandbox + + com.apple.security.assets.movies.read-write + + com.apple.security.assets.music.read-write + + com.apple.security.assets.pictures.read-write + + com.apple.security.device.audio-input + + com.apple.security.device.bluetooth + + com.apple.security.device.camera + + com.apple.security.files.downloads.read-write + + com.apple.security.files.user-selected.read-write + + com.apple.security.network.client + + com.apple.security.network.server + + com.apple.security.personal-information.addressbook + + com.apple.security.personal-information.calendars + + com.apple.security.personal-information.location + + + diff --git a/permission_handler_apple/example/pubspec.yaml b/permission_handler_apple/example/pubspec.yaml index 1a9636230..53fe8e4cf 100644 --- a/permission_handler_apple/example/pubspec.yaml +++ b/permission_handler_apple/example/pubspec.yaml @@ -5,11 +5,12 @@ environment: sdk: ">=2.15.0 <3.0.0" dependencies: - baseflow_plugin_template: ^2.1.1 + baseflow_plugin_template: ^2.1.2 flutter: sdk: flutter dev_dependencies: + flutter_lints: ^3.0.1 flutter_test: sdk: flutter diff --git a/permission_handler_apple/example/test/widget_test.dart b/permission_handler_apple/example/test/widget_test.dart new file mode 100644 index 000000000..d1b39f339 --- /dev/null +++ b/permission_handler_apple/example/test/widget_test.dart @@ -0,0 +1,32 @@ +// This is a basic Flutter widget test. +// +// To perform an interaction with a widget in your test, use the WidgetTester +// utility in the flutter_test package. For example, you can send tap and scroll +// gestures. You can also use WidgetTester to find child widgets in the widget +// tree, read text, and verify that the values of widget properties are correct. + +import 'package:baseflow_plugin_template/baseflow_plugin_template.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_test/flutter_test.dart'; + +void main() { + testWidgets('Verify Platform version', (WidgetTester tester) async { + // Build our app and trigger a frame. + await tester.pumpWidget(BaseflowPluginExample( + pluginName: "", + githubURL: "", + pubDevURL: "", + // ignore: prefer_const_literals_to_create_immutables + pages: [], + )); + + // Verify that platform version is retrieved. + expect( + find.byWidgetPredicate( + (Widget widget) => + widget is Text && widget.data!.startsWith('Running on:'), + ), + findsOneWidget, + ); + }); +} diff --git a/permission_handler_apple/macos/Classes/PermissionHandlerEnums.h b/permission_handler_apple/macos/Classes/PermissionHandlerEnums.h new file mode 100644 index 000000000..4a6365f8b --- /dev/null +++ b/permission_handler_apple/macos/Classes/PermissionHandlerEnums.h @@ -0,0 +1,163 @@ +// +// PermissionHandlerEnums.h +// permission_handler +// +// Created by Razvan Lung on 15/02/2019. +// + +// ios: PermissionGroupCalendar +// Info.plist: NSCalendarsUsageDescription +// dart: PermissionGroup.calendar +#ifndef PERMISSION_EVENTS + #define PERMISSION_EVENTS 0 +#endif + +// ios: PermissionGroupReminders +// Info.plist: NSRemindersUsageDescription +// dart: PermissionGroup.reminders +#ifndef PERMISSION_REMINDERS + #define PERMISSION_REMINDERS 0 +#endif + +// ios: PermissionGroupContacts +// Info.plist: NSContactsUsageDescription +// dart: PermissionGroup.contacts +#ifndef PERMISSION_CONTACTS + #define PERMISSION_CONTACTS 0 +#endif + +// ios: PermissionGroupCamera +// Info.plist: NSCameraUsageDescription +// dart: PermissionGroup.camera +#ifndef PERMISSION_CAMERA + #define PERMISSION_CAMERA 0 +#endif + +// ios: PermissionGroupMicrophone +// Info.plist: NSMicrophoneUsageDescription +// dart: PermissionGroup.microphone +#ifndef PERMISSION_MICROPHONE + #define PERMISSION_MICROPHONE 0 +#endif + +// ios: PermissionGroupSpeech +// Info.plist: NSSpeechRecognitionUsageDescription +// dart: PermissionGroup.speech +#ifndef PERMISSION_SPEECH_RECOGNIZER + #define PERMISSION_SPEECH_RECOGNIZER 0 +#endif + +// ios: PermissionGroupPhotos +// Info.plist: NSPhotoLibraryUsageDescription +// dart: PermissionGroup.photos +#ifndef PERMISSION_PHOTOS + #define PERMISSION_PHOTOS 0 +#endif + +// ios: PermissionGroupPhotosAddOnly +// Info.plist: NSPhotoLibraryUsageDescription +// dart: PermissionGroup.photosAddOnly +#ifndef PERMISSION_PHOTOS_ADD_ONLY + #define PERMISSION_PHOTOS_ADD_ONLY 0 +#endif + +// ios: [PermissionGroupLocation, PermissionGroupLocationAlways, PermissionGroupLocationWhenInUse] +// Info.plist: [NSLocationUsageDescription, NSLocationAlwaysAndWhenInUseUsageDescription, NSLocationWhenInUseUsageDescription] +// dart: [PermissionGroup.location, PermissionGroup.locationAlways, PermissionGroup.locationWhenInUse] +#ifndef PERMISSION_LOCATION + #define PERMISSION_LOCATION 0 +#endif + +// ios: PermissionGroupNotification +// dart: PermissionGroup.notification +#ifndef PERMISSION_NOTIFICATIONS + #define PERMISSION_NOTIFICATIONS 0 +#endif + +// ios: PermissionGroupMediaLibrary +// Info.plist: [NSAppleMusicUsageDescription, kTCCServiceMediaLibrary] +// dart: PermissionGroup.mediaLibrary +#ifndef PERMISSION_MEDIA_LIBRARY + #define PERMISSION_MEDIA_LIBRARY 0 +#endif + +// ios: PermissionGroupSensors +// Info.plist: NSMotionUsageDescription +// dart: PermissionGroup.sensors +#ifndef PERMISSION_SENSORS + #define PERMISSION_SENSORS 0 +#endif + +// ios: PermissionGroupBluetooth +// Info.plist: [NSBluetoothAlwaysUsageDescription, NSBluetoothPeripheralUsageDescription] +// dart: PermissionGroup.bluetooth +#ifndef PERMISSION_BLUETOOTH + #define PERMISSION_BLUETOOTH 0 +#endif + +// ios: PermissionGroupAppTrackingTransparency +// Info.plist: [NSUserTrackingUsageDescription] +// dart: PermissionGroup.appTrackingTransparency +#ifndef PERMISSION_APP_TRACKING_TRANSPARENCY + #define PERMISSION_APP_TRACKING_TRANSPARENCY 0 +#endif + + +// ios: PermissionGroupCriticalAlerts +// Info.plist: UNAuthorizationOptionCriticalAlert +// dart: PermissionGroup.criticalAlerts +#ifndef PERMISSION_CRITICAL_ALERTS + #define PERMISSION_CRITICAL_ALERTS 0 +#endif + +typedef NS_ENUM(int, PermissionGroup) { + PermissionGroupCalendar = 0, + PermissionGroupCamera, + PermissionGroupContacts, + PermissionGroupLocation, + PermissionGroupLocationAlways, + PermissionGroupLocationWhenInUse, + PermissionGroupMediaLibrary, + PermissionGroupMicrophone, + PermissionGroupPhone, + PermissionGroupPhotos, + PermissionGroupPhotosAddOnly, + PermissionGroupReminders, + PermissionGroupSensors, + PermissionGroupSms, + PermissionGroupSpeech, + PermissionGroupStorage, + PermissionGroupIgnoreBatteryOptimizations, + PermissionGroupNotification, + PermissionGroupAccessMediaLocation, + PermissionGroupActivityRecognition, + PermissionGroupUnknown, + PermissionGroupBluetooth, + PermissionGroupManageExternalStorage, + PermissionGroupSystemAlertWindow, + PermissionGroupRequestInstallPackages, + PermissionGroupAppTrackingTransparency, + PermissionGroupCriticalAlerts, + PermissionGroupAccessNotificationPolicy, + PermissionGroupBluetoothScan, + PermissionGroupBluetoothAdvertise, + PermissionGroupBluetoothConnect, + PermissionGroupNearbyWifiDevices, + PermissiongroupVideos, + PermissionGroupAudio, + PermissionGroupScheduleExactAlarm +}; + +typedef NS_ENUM(int, PermissionStatus) { + PermissionStatusDenied = 0, + PermissionStatusGranted = 1, + PermissionStatusRestricted = 2, + PermissionStatusLimited = 3, + PermissionStatusPermanentlyDenied = 4 +}; + +typedef NS_ENUM(int, ServiceStatus) { + ServiceStatusDisabled = 0, + ServiceStatusEnabled, + ServiceStatusNotApplicable, +}; diff --git a/permission_handler_apple/macos/Classes/PermissionHandlerPlugin.swift b/permission_handler_apple/macos/Classes/PermissionHandlerPlugin.swift new file mode 100644 index 000000000..be6f4dfcb --- /dev/null +++ b/permission_handler_apple/macos/Classes/PermissionHandlerPlugin.swift @@ -0,0 +1,69 @@ +import Cocoa +import FlutterMacOS + +public class PermissionHandlerPlugin: NSObject, FlutterPlugin { + + var _permissionManager = PermissionManager() + var methodResult: FlutterResult? = nil + + init(withPermissionManager permissionManager: PermissionManager) { + super.init() + _permissionManager = permissionManager + } + + public static func register(with registrar: FlutterPluginRegistrar) { + let channel = FlutterMethodChannel(name: "flutter.baseflow.com/permissions/methods", binaryMessenger: registrar.messenger) + let permissionManager: PermissionManager = PermissionManager.init(strategyInstances: ()) + let instance = PermissionHandlerPlugin(withPermissionManager: permissionManager) + registrar.addMethodCallDelegate(instance, channel: channel) + } + + public func handle(_ call: FlutterMethodCall, result: @escaping FlutterResult) { + switch call.method { + case "checkPermissionStatus": + guard let args = call.arguments as? Int else { + result(FlutterError(code: "INVALID_ARGUMENT", message: "Should be a number", details: nil)) + return + } + let number = NSNumber(value: args) + let permission: PermissionGroup = Codec.decodePermissionGroup(from: number) + PermissionManager.checkPermissionStatus(permission, result: result) + case "checkServiceStatus": + guard let args = call.arguments as? Int else { + result(FlutterError(code: "INVALID_ARGUMENT", message: "Should be a number", details: nil)) + return + } + let number = NSNumber(value: args) + let permission: PermissionGroup = Codec.decodePermissionGroup(from: number) + PermissionManager.checkServiceStatus(permission, result: result) + case "requestPermissions": + guard methodResult == nil else { + result(FlutterError(code: "ERROR_ALREADY_REQUESTING_PERMISSIONS", message: "A request for permissions is already running, please wait for it to finish before doing another request (note that you can request multiple permissions at the same time).", details: nil)) + return + } + methodResult = result + guard let args = call.arguments as? [Int] else { + result(FlutterError(code: "INVALID_ARGUMENT", message: "Should be an array of numbers", details: nil)) + return + } + let argsNumbers = args.map { NSNumber(value: $0) } + guard let permissions = Codec.decodePermissionGroups(from: argsNumbers) as? [NSNumber] else { + result(FlutterError(code: "DECODE_ERROR", message: "Should be an array of numbers", details: nil)) + return + } + _permissionManager.requestPermissions(permissions) { permissionRequestResults in + if let methodResult = self.methodResult { + methodResult(permissionRequestResults) + } + + self.methodResult = nil + } + case "shouldShowRequestPermissionRationale": + result(false) + case "openAppSettings": + PermissionManager.openAppSettings(result) + default: + result(FlutterMethodNotImplemented) + } + } +} diff --git a/permission_handler_apple/macos/Classes/PermissionManager.h b/permission_handler_apple/macos/Classes/PermissionManager.h new file mode 100644 index 000000000..9363b3419 --- /dev/null +++ b/permission_handler_apple/macos/Classes/PermissionManager.h @@ -0,0 +1,41 @@ +// +// PermissionManager.h +// permission_handler +// +// Created by Razvan Lung on 15/02/2019. +// + +#import +#import + +#import "AudioVideoPermissionStrategy.h" +#import "AppTrackingTransparencyPermissionStrategy.h" +#import "BluetoothPermissionStrategy.h" +#import "ContactPermissionStrategy.h" +#import "EventPermissionStrategy.h" +#import "LocationPermissionStrategy.h" +#import "MediaLibraryPermissionStrategy.h" +#import "PermissionStrategy.h" +#import "PhonePermissionStrategy.h" +#import "PhotoPermissionStrategy.h" +#import "SensorPermissionStrategy.h" +#import "SpeechPermissionStrategy.h" +#import "StoragePermissionStrategy.h" +#import "UnknownPermissionStrategy.h" +#import "NotificationPermissionStrategy.h" +#import "CriticalAlertsPermissionStrategy.h" +#import "PermissionHandlerEnums.h" +#import "Codec.h" + +typedef void (^PermissionRequestCompletion)(NSDictionary *permissionRequestResults); + +@interface PermissionManager : NSObject + +- (instancetype)initWithStrategyInstances; +- (void)requestPermissions:(NSArray *)permissions completion:(PermissionRequestCompletion)completion; + ++ (void)checkPermissionStatus:(enum PermissionGroup)permission result:(FlutterResult)result; ++ (void)checkServiceStatus:(enum PermissionGroup)permission result:(FlutterResult)result; ++ (void)openAppSettings:(FlutterResult)result; + +@end diff --git a/permission_handler_apple/macos/Classes/PermissionManager.m b/permission_handler_apple/macos/Classes/PermissionManager.m new file mode 100644 index 000000000..dad8b4194 --- /dev/null +++ b/permission_handler_apple/macos/Classes/PermissionManager.m @@ -0,0 +1,132 @@ +// +// Created by Razvan Lung(long1eu) on 2019-02-15. +// Copyright (c) 2019 The Chromium Authors. All rights reserved. +// + +#import "PermissionManager.h" + +@implementation PermissionManager { + NSMutableArray > *_strategyInstances; +} + +- (instancetype)initWithStrategyInstances { + self = [super init]; + if (self) { + _strategyInstances = _strategyInstances = [[NSMutableArray alloc] init]; + } + + return self; +} + ++ (void)checkPermissionStatus:(enum PermissionGroup)permission result:(FlutterResult)result { + id permissionStrategy = [PermissionManager createPermissionStrategy:permission]; + PermissionStatus status = [permissionStrategy checkPermissionStatus:permission]; + + result([Codec encodePermissionStatus:status]); +} + ++ (void)checkServiceStatus:(enum PermissionGroup)permission result:(FlutterResult)result { + id permissionStrategy = [PermissionManager createPermissionStrategy:permission]; + ServiceStatus status = [permissionStrategy checkServiceStatus:permission]; + result([Codec encodeServiceStatus:status]); +} + +- (void)requestPermissions:(NSArray *)permissions completion:(PermissionRequestCompletion)completion { + NSMutableDictionary *permissionStatusResult = [[NSMutableDictionary alloc] init]; + + if (permissions.count == 0) { + completion(permissionStatusResult); + return; + } + + NSMutableSet *requestQueue = [[NSMutableSet alloc] initWithArray:permissions]; + + for (int i = 0; i < permissions.count; ++i) { + NSNumber *rawNumberValue = permissions[i]; + int rawValue = rawNumberValue.intValue; + PermissionGroup permission = (PermissionGroup) rawValue; + + __block id permissionStrategy = [PermissionManager createPermissionStrategy:permission]; + [_strategyInstances addObject:permissionStrategy]; + + + [permissionStrategy requestPermission:permission completionHandler:^(PermissionStatus permissionStatus) { + permissionStatusResult[@(permission)] = @(permissionStatus); + [requestQueue removeObject:@(permission)]; + + [self->_strategyInstances removeObject:permissionStrategy]; + + if (requestQueue.count == 0) { + completion(permissionStatusResult); + } + + permissionStrategy = nil; + }]; + } +} + ++ (void)openAppSettings:(FlutterResult)result { + if (@available(macOS 10.10, *)) { + BOOL res = [[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:@"x-apple.systempreferences:com.apple.preference.security?Privacy_LocationServices"]]; + result([[NSNumber alloc] initWithBool:res]); + } else { + result(@false); + } +} + ++ (id)createPermissionStrategy:(PermissionGroup)permission { + switch (permission) { + case PermissionGroupCalendar: + return [EventPermissionStrategy new]; + case PermissionGroupCamera: + return [AudioVideoPermissionStrategy new]; + case PermissionGroupContacts: + return [ContactPermissionStrategy new]; + case PermissionGroupLocation: + case PermissionGroupLocationAlways: + case PermissionGroupLocationWhenInUse: + #if PERMISSION_LOCATION + return [[LocationPermissionStrategy alloc] initWithLocationManager]; + #else + return [LocationPermissionStrategy new]; + #endif + case PermissionGroupMediaLibrary: + return [MediaLibraryPermissionStrategy new]; + case PermissionGroupMicrophone: + return [AudioVideoPermissionStrategy new]; + case PermissionGroupPhone: + return [PhonePermissionStrategy new]; + case PermissionGroupPhotos: + #if PERMISSION_PHOTOS + return [[PhotoPermissionStrategy alloc] initWithAccessAddOnly:false]; + #else + return [PhotoPermissionStrategy new]; + #endif + case PermissionGroupPhotosAddOnly: + #if PERMISSION_PHOTOS + return [[PhotoPermissionStrategy alloc] initWithAccessAddOnly:true]; + #else + return [PhotoPermissionStrategy new]; + #endif + case PermissionGroupReminders: + return [EventPermissionStrategy new]; + case PermissionGroupSensors: + return [SensorPermissionStrategy new]; + case PermissionGroupSpeech: + return [SpeechPermissionStrategy new]; + case PermissionGroupNotification: + return [NotificationPermissionStrategy new]; + case PermissionGroupStorage: + return [StoragePermissionStrategy new]; + case PermissionGroupBluetooth: + return [BluetoothPermissionStrategy new]; + case PermissionGroupAppTrackingTransparency: + return [AppTrackingTransparencyPermissionStrategy new]; + case PermissionGroupCriticalAlerts: + return [CriticalAlertsPermissionStrategy new]; + default: + return [UnknownPermissionStrategy new]; + } +} + +@end diff --git a/permission_handler_apple/macos/Classes/strategies/AppTrackingTransparencyPermissionStrategy.h b/permission_handler_apple/macos/Classes/strategies/AppTrackingTransparencyPermissionStrategy.h new file mode 100644 index 000000000..c0d2c3a6a --- /dev/null +++ b/permission_handler_apple/macos/Classes/strategies/AppTrackingTransparencyPermissionStrategy.h @@ -0,0 +1,25 @@ +// +// AppTrackingTransparency.h +// permission_handler +// +// Created by Jan-Derk on 21/05/2021. +// + +#import +#import "PermissionStrategy.h" + +#if PERMISSION_APP_TRACKING_TRANSPARENCY + +#import + +@interface AppTrackingTransparencyPermissionStrategy : NSObject +@end + +#else + +#import "UnknownPermissionStrategy.h" + +@interface AppTrackingTransparencyPermissionStrategy : UnknownPermissionStrategy +@end + +#endif diff --git a/permission_handler_apple/macos/Classes/strategies/AppTrackingTransparencyPermissionStrategy.m b/permission_handler_apple/macos/Classes/strategies/AppTrackingTransparencyPermissionStrategy.m new file mode 100644 index 000000000..1a74a1a8f --- /dev/null +++ b/permission_handler_apple/macos/Classes/strategies/AppTrackingTransparencyPermissionStrategy.m @@ -0,0 +1,64 @@ +// +// AppTrackingTransparency.m +// permission_handler +// +// Created by Jan-Derk on 21/05/2021. +// + +#import "AppTrackingTransparencyPermissionStrategy.h" + +#if PERMISSION_APP_TRACKING_TRANSPARENCY + +@implementation AppTrackingTransparencyPermissionStrategy + +- (PermissionStatus)checkPermissionStatus:(PermissionGroup)permission { + if (@available(macOS 11.0, *)) { + ATTrackingManagerAuthorizationStatus attPermission = [ATTrackingManager trackingAuthorizationStatus]; + return [AppTrackingTransparencyPermissionStrategy parsePermission:attPermission]; + } + + return PermissionStatusGranted; +} + +- (ServiceStatus)checkServiceStatus:(PermissionGroup)permission { + return ServiceStatusNotApplicable; +} + +- (void)requestPermission:(PermissionGroup)permission completionHandler:(PermissionStatusHandler)completionHandler { + PermissionStatus status = [self checkPermissionStatus:permission]; + if (status != PermissionStatusDenied) { + completionHandler(status); + return; + } + + if (@available(macOS 11.0, *)){ + [ATTrackingManager requestTrackingAuthorizationWithCompletionHandler:^(ATTrackingManagerAuthorizationStatus status) { + PermissionStatus permissionStatus = [AppTrackingTransparencyPermissionStrategy parsePermission:status]; + completionHandler(permissionStatus); + }]; + } else { + completionHandler(PermissionStatusGranted); + } +} + ++ (PermissionStatus)parsePermission:(ATTrackingManagerAuthorizationStatus)attPermission API_AVAILABLE(macosx(11.0)){ + switch(attPermission){ + case ATTrackingManagerAuthorizationStatusAuthorized: + return PermissionStatusGranted; + case ATTrackingManagerAuthorizationStatusRestricted: + return PermissionStatusRestricted; + case ATTrackingManagerAuthorizationStatusDenied: + return PermissionStatusPermanentlyDenied; + case ATTrackingManagerAuthorizationStatusNotDetermined: + return PermissionStatusDenied; + } +} +@end + +#else + +@implementation AppTrackingTransparencyPermissionStrategy +@end + +#endif + diff --git a/permission_handler_apple/macos/Classes/strategies/AudioVideoPermissionStrategy.h b/permission_handler_apple/macos/Classes/strategies/AudioVideoPermissionStrategy.h new file mode 100644 index 000000000..8db77d030 --- /dev/null +++ b/permission_handler_apple/macos/Classes/strategies/AudioVideoPermissionStrategy.h @@ -0,0 +1,21 @@ +// +// Created by Razvan Lung(long1eu) on 2019-02-15. +// Copyright (c) 2019 The Chromium Authors. All rights reserved. +// + +#import +#import "PermissionStrategy.h" + +#if PERMISSION_CAMERA | PERMISSION_MICROPHONE +#import + +@interface AudioVideoPermissionStrategy : NSObject +@end + +#else + +#import "UnknownPermissionStrategy.h" +@interface AudioVideoPermissionStrategy : UnknownPermissionStrategy +@end + +#endif diff --git a/permission_handler_apple/macos/Classes/strategies/AudioVideoPermissionStrategy.m b/permission_handler_apple/macos/Classes/strategies/AudioVideoPermissionStrategy.m new file mode 100644 index 000000000..8cc68737b --- /dev/null +++ b/permission_handler_apple/macos/Classes/strategies/AudioVideoPermissionStrategy.m @@ -0,0 +1,97 @@ +// +// Created by Razvan Lung(long1eu) on 2019-02-15. +// Copyright (c) 2019 The Chromium Authors. All rights reserved. +// + +#import "AudioVideoPermissionStrategy.h" + +#if PERMISSION_CAMERA | PERMISSION_MICROPHONE + +@implementation AudioVideoPermissionStrategy + +- (PermissionStatus)checkPermissionStatus:(PermissionGroup)permission { + if (permission == PermissionGroupCamera) { + #if PERMISSION_CAMERA + return [AudioVideoPermissionStrategy permissionStatus:AVMediaTypeVideo]; + #endif + } else if (permission == PermissionGroupMicrophone) { + #if PERMISSION_MICROPHONE + return [AudioVideoPermissionStrategy permissionStatus:AVMediaTypeAudio]; + #endif + } + return PermissionStatusDenied; +} + +- (ServiceStatus)checkServiceStatus:(PermissionGroup)permission { + return ServiceStatusNotApplicable; +} + +- (void)requestPermission:(PermissionGroup)permission completionHandler:(PermissionStatusHandler)completionHandler { + PermissionStatus status = [self checkPermissionStatus:permission]; + + if (status != PermissionStatusDenied) { + completionHandler(status); + return; + } + + AVMediaType mediaType; + + if (permission == PermissionGroupCamera) { + #if PERMISSION_CAMERA + mediaType = AVMediaTypeVideo; + #else + completionHandler(PermissionStatusDenied); + return; + #endif + } else if (permission == PermissionGroupMicrophone) { + #if PERMISSION_MICROPHONE + mediaType = AVMediaTypeAudio; + #else + completionHandler(PermissionStatusDenied); + return; + #endif + } else { + completionHandler(PermissionStatusDenied); + return; + } + + if (@available(macOS 10.14, *)) { + [AVCaptureDevice requestAccessForMediaType:mediaType completionHandler:^(BOOL granted) { + if (granted) { + completionHandler(PermissionStatusGranted); + } else { + completionHandler(PermissionStatusPermanentlyDenied); + } + }]; + } else { + // Fallback on earlier versions + completionHandler(PermissionStatusPermanentlyDenied); + } +} + ++ (PermissionStatus)permissionStatus:(AVMediaType const)mediaType { + if (@available(macOS 10.14, *)) { + AVAuthorizationStatus status = [AVCaptureDevice authorizationStatusForMediaType:mediaType]; + switch (status) { + case AVAuthorizationStatusNotDetermined: + return PermissionStatusDenied; + case AVAuthorizationStatusRestricted: + return PermissionStatusRestricted; + case AVAuthorizationStatusDenied: + return PermissionStatusPermanentlyDenied; + case AVAuthorizationStatusAuthorized: + return PermissionStatusGranted; + } + } + + return PermissionStatusDenied; +} + +@end + +#else + +@implementation AudioVideoPermissionStrategy +@end + +#endif diff --git a/permission_handler_apple/macos/Classes/strategies/BluetoothPermissionStrategy.h b/permission_handler_apple/macos/Classes/strategies/BluetoothPermissionStrategy.h new file mode 100644 index 000000000..2e59b162e --- /dev/null +++ b/permission_handler_apple/macos/Classes/strategies/BluetoothPermissionStrategy.h @@ -0,0 +1,26 @@ +// +// BluetoothPermissionStrategy.h +// permission_handler +// +// Created by Rene Floor on 12/03/2021. +// + +#import +#import "PermissionStrategy.h" + +#if PERMISSION_BLUETOOTH + +#import + +@interface BluetoothPermissionStrategy : NSObject +- (void)initManagerIfNeeded; +@end + +#else + +#import "UnknownPermissionStrategy.h" + +@interface BluetoothPermissionStrategy : UnknownPermissionStrategy +@end + +#endif diff --git a/permission_handler_apple/macos/Classes/strategies/BluetoothPermissionStrategy.m b/permission_handler_apple/macos/Classes/strategies/BluetoothPermissionStrategy.m new file mode 100644 index 000000000..1c8f41560 --- /dev/null +++ b/permission_handler_apple/macos/Classes/strategies/BluetoothPermissionStrategy.m @@ -0,0 +1,80 @@ +// +// BluetoothPermissionStrategy.m +// permission_handler +// +// Created by Rene Floor on 12/03/2021. +// + +#import "BluetoothPermissionStrategy.h" + +#if PERMISSION_BLUETOOTH + +@implementation BluetoothPermissionStrategy { + CBCentralManager *_centralManager; + PermissionStatusHandler _permissionStatusHandler; + PermissionGroup _requestedPermission; +} + +- (void)initManagerIfNeeded { + if (_centralManager == nil) { + NSDictionary *options = @{CBCentralManagerOptionShowPowerAlertKey: @NO}; + _centralManager = [[CBCentralManager alloc] initWithDelegate:self queue:nil options:options]; + } +} + +- (PermissionStatus)checkPermissionStatus:(PermissionGroup)permission { + [self initManagerIfNeeded]; + if (@available(macOS 10.15, *)) { + CBManagerAuthorization blePermission = [_centralManager authorization]; + return [BluetoothPermissionStrategy parsePermission:blePermission]; + } + return PermissionStatusGranted; +} + +- (ServiceStatus)checkServiceStatus:(PermissionGroup)permission { + [self initManagerIfNeeded]; + if (@available(macOS 10.14, *)) { + return [_centralManager state] == CBManagerStatePoweredOn ? ServiceStatusEnabled : ServiceStatusDisabled; + } + return [_centralManager state] == CBCentralManagerStatePoweredOn ? ServiceStatusEnabled : ServiceStatusDisabled; +} + +- (void)requestPermission:(PermissionGroup)permission completionHandler:(PermissionStatusHandler)completionHandler { + [self initManagerIfNeeded]; + PermissionStatus status = [self checkPermissionStatus:permission]; + + if (status != PermissionStatusDenied) { + completionHandler(status); + return; + } + + _permissionStatusHandler = completionHandler; + _requestedPermission = permission; +} + ++ (PermissionStatus)parsePermission:(CBManagerAuthorization)bluetoothPermission API_AVAILABLE(macosx(10.15)){ + switch(bluetoothPermission){ + case CBManagerAuthorizationNotDetermined: + return PermissionStatusDenied; + case CBManagerAuthorizationRestricted: + return PermissionStatusRestricted; + case CBManagerAuthorizationDenied: + return PermissionStatusPermanentlyDenied; + case CBManagerAuthorizationAllowedAlways: + return PermissionStatusGranted; + } +} + +- (void)centralManagerDidUpdateState:(nonnull CBCentralManager *)centralManager { + PermissionStatus permissionStatus = [self checkPermissionStatus:_requestedPermission]; + _permissionStatusHandler(permissionStatus); +} + +@end + +#else + +@implementation BluetoothPermissionStrategy +@end + +#endif diff --git a/permission_handler_apple/macos/Classes/strategies/ContactPermissionStrategy.h b/permission_handler_apple/macos/Classes/strategies/ContactPermissionStrategy.h new file mode 100644 index 000000000..1565d3232 --- /dev/null +++ b/permission_handler_apple/macos/Classes/strategies/ContactPermissionStrategy.h @@ -0,0 +1,23 @@ +// +// Created by Razvan Lung(long1eu) on 2019-02-15. +// Copyright (c) 2019 The Chromium Authors. All rights reserved. +// + +#import +#import "PermissionStrategy.h" + +#if PERMISSION_CONTACTS + +#import +#import + +@interface ContactPermissionStrategy : NSObject +@end + +#else + +#import "UnknownPermissionStrategy.h" +@interface ContactPermissionStrategy : UnknownPermissionStrategy +@end + +#endif diff --git a/permission_handler_apple/macos/Classes/strategies/ContactPermissionStrategy.m b/permission_handler_apple/macos/Classes/strategies/ContactPermissionStrategy.m new file mode 100644 index 000000000..cc850249f --- /dev/null +++ b/permission_handler_apple/macos/Classes/strategies/ContactPermissionStrategy.m @@ -0,0 +1,80 @@ +// +// Created by Razvan Lung(long1eu) on 2019-02-15. +// Copyright (c) 2019 The Chromium Authors. All rights reserved. +// + +#import "ContactPermissionStrategy.h" + +#if PERMISSION_CONTACTS + +@implementation ContactPermissionStrategy + +- (PermissionStatus)checkPermissionStatus:(PermissionGroup)permission { + return [ContactPermissionStrategy permissionStatus]; +} + +- (ServiceStatus)checkServiceStatus:(PermissionGroup)permission { + return ServiceStatusNotApplicable; +} + +- (void)requestPermission:(PermissionGroup)permission completionHandler:(PermissionStatusHandler)completionHandler { + PermissionStatus status = [self checkPermissionStatus:permission]; + + if (status != PermissionStatusDenied) { + completionHandler(status); + return; + } + + if (@available(macOS 10.13, *)) { + [ContactPermissionStrategy requestPermissionsFromContactStore:completionHandler]; + } else { + completionHandler(PermissionStatusPermanentlyDenied); + return; + } +} + ++ (PermissionStatus)permissionStatus { + if (@available(macOS 10.11, *)) { + CNAuthorizationStatus status = [CNContactStore authorizationStatusForEntityType:CNEntityTypeContacts]; + + switch (status) { + case CNAuthorizationStatusNotDetermined: + return PermissionStatusDenied; + case CNAuthorizationStatusRestricted: + return PermissionStatusRestricted; + case CNAuthorizationStatusDenied: + return PermissionStatusPermanentlyDenied; + case CNAuthorizationStatusAuthorized: + return PermissionStatusGranted; + } + + } else { + return PermissionStatusPermanentlyDenied; + } + + return PermissionStatusDenied; +} + ++ (void)requestPermissionsFromContactStore:(PermissionStatusHandler)completionHandler API_AVAILABLE(macosx(10.13)) { + CNContactStore *contactStore = [CNContactStore new]; + + [contactStore requestAccessForEntityType:CNEntityTypeContacts completionHandler:^(BOOL granted, NSError *__nullable error) { + if (granted) { + completionHandler(PermissionStatusGranted); + } else { + completionHandler(PermissionStatusPermanentlyDenied); + } + }]; +} + ++ (void)requestPermissionsFromAddressBook:(PermissionStatusHandler)completionHandler { + completionHandler(PermissionStatusPermanentlyDenied); +} +@end + +#else + +@implementation ContactPermissionStrategy +@end + +#endif diff --git a/permission_handler_apple/macos/Classes/strategies/CriticalAlertsPermissionStrategy.h b/permission_handler_apple/macos/Classes/strategies/CriticalAlertsPermissionStrategy.h new file mode 100644 index 000000000..44b857f48 --- /dev/null +++ b/permission_handler_apple/macos/Classes/strategies/CriticalAlertsPermissionStrategy.h @@ -0,0 +1,25 @@ +// +// CriticalAlertsPermissionStrategy.h +// permission_handler +// +// Created by Neal Soni on 2021/6/8. +// + +#import +#import "PermissionStrategy.h" + +#if PERMISSION_CRITICAL_ALERTS + +#import + +@interface CriticalAlertsPermissionStrategy : NSObject + +@end + +#else + +#import "UnknownPermissionStrategy.h" +@interface CriticalAlertsPermissionStrategy : UnknownPermissionStrategy +@end + +#endif diff --git a/permission_handler_apple/macos/Classes/strategies/CriticalAlertsPermissionStrategy.m b/permission_handler_apple/macos/Classes/strategies/CriticalAlertsPermissionStrategy.m new file mode 100644 index 000000000..c1f08e839 --- /dev/null +++ b/permission_handler_apple/macos/Classes/strategies/CriticalAlertsPermissionStrategy.m @@ -0,0 +1,77 @@ +// +// CriticalAlertsPermissionStrategy.m +// permission_handler +// +// Created by Neal Soni on 2021/6/8. +// + +#import "CriticalAlertsPermissionStrategy.h" + +#if PERMISSION_CRITICAL_ALERTS + +@implementation CriticalAlertsPermissionStrategy + +- (PermissionStatus)checkPermissionStatus:(PermissionGroup)permission { + return [CriticalAlertsPermissionStrategy permissionStatus]; +} + +- (ServiceStatus)checkServiceStatus:(PermissionGroup)permission { + return ServiceStatusNotApplicable; +} + +- (void)requestPermission:(PermissionGroup)permission completionHandler:(PermissionStatusHandler)completionHandler { + PermissionStatus status = [self checkPermissionStatus:permission]; + if (status != PermissionStatusDenied && status != PermissionStatusPermanentlyDenied) { + completionHandler(status); + return; + } + dispatch_async(dispatch_get_main_queue(), ^{ + if(@available(macOS 10.14, *)) { + UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter]; + UNAuthorizationOptions authorizationOptions = 0; + authorizationOptions += UNAuthorizationOptionCriticalAlert; + [center requestAuthorizationWithOptions:(authorizationOptions) completionHandler:^(BOOL granted, NSError * _Nullable error) { + if (error != nil || !granted) { + completionHandler(PermissionStatusPermanentlyDenied); + return; + } + + dispatch_async(dispatch_get_main_queue(), ^{ + [[NSApplication sharedApplication] registerForRemoteNotifications]; + completionHandler(PermissionStatusGranted); + }); + }]; + } else { + completionHandler(PermissionStatusPermanentlyDenied); + } + }); +} + ++ (PermissionStatus)permissionStatus { + __block PermissionStatus permissionStatus = PermissionStatusGranted; + if (@available(macOS 10.14 , *)) { + dispatch_semaphore_t sem = dispatch_semaphore_create(0); + [[UNUserNotificationCenter currentNotificationCenter] getNotificationSettingsWithCompletionHandler:^(UNNotificationSettings * _Nonnull settings) { + if (settings.criticalAlertSetting == UNAuthorizationStatusDenied) { + permissionStatus = PermissionStatusPermanentlyDenied; + } else if (settings.criticalAlertSetting == UNAuthorizationStatusNotDetermined) { + permissionStatus = PermissionStatusDenied; + } + dispatch_semaphore_signal(sem); + }]; + dispatch_semaphore_wait(sem, DISPATCH_TIME_FOREVER); + } else { + permissionStatus = PermissionStatusPermanentlyDenied; + } + + return permissionStatus; +} + +@end + +#else + +@implementation CriticalAlertsPermissionStrategy +@end + +#endif diff --git a/permission_handler_apple/macos/Classes/strategies/EventPermissionStrategy.h b/permission_handler_apple/macos/Classes/strategies/EventPermissionStrategy.h new file mode 100644 index 000000000..b5bddc8b9 --- /dev/null +++ b/permission_handler_apple/macos/Classes/strategies/EventPermissionStrategy.h @@ -0,0 +1,22 @@ +// +// Created by Razvan Lung(long1eu) on 2019-02-15. +// Copyright (c) 2019 The Chromium Authors. All rights reserved. +// + +#import +#import "PermissionStrategy.h" + +#if PERMISSION_EVENTS | PERMISSION_REMINDERS + +#import + +@interface EventPermissionStrategy : NSObject +@end + +#else + +#import "UnknownPermissionStrategy.h" +@interface EventPermissionStrategy : UnknownPermissionStrategy +@end + +#endif diff --git a/permission_handler_apple/macos/Classes/strategies/EventPermissionStrategy.m b/permission_handler_apple/macos/Classes/strategies/EventPermissionStrategy.m new file mode 100644 index 000000000..587db31b7 --- /dev/null +++ b/permission_handler_apple/macos/Classes/strategies/EventPermissionStrategy.m @@ -0,0 +1,93 @@ +// +// Created by Razvan Lung(long1eu) on 2019-02-15. +// Copyright (c) 2019 The Chromium Authors. All rights reserved. +// + +#import "EventPermissionStrategy.h" + +#if PERMISSION_EVENTS | PERMISSION_REMINDERS + +@implementation EventPermissionStrategy + +- (PermissionStatus)checkPermissionStatus:(PermissionGroup)permission { + if (permission == PermissionGroupCalendar) { + #if PERMISSION_EVENTS + return [EventPermissionStrategy permissionStatus:EKEntityTypeEvent]; + #endif + } else if (permission == PermissionGroupReminders) { + #if PERMISSION_REMINDERS + return [EventPermissionStrategy permissionStatus:EKEntityTypeReminder]; + #endif + } + + return PermissionStatusDenied; +} + +- (ServiceStatus)checkServiceStatus:(PermissionGroup)permission { + return ServiceStatusNotApplicable; +} + +- (void)requestPermission:(PermissionGroup)permission completionHandler:(PermissionStatusHandler)completionHandler { + PermissionStatus permissionStatus = [self checkPermissionStatus:permission]; + + if (permissionStatus != PermissionStatusDenied) { + completionHandler(permissionStatus); + return; + } + + EKEntityType entityType; + + if (permission == PermissionGroupCalendar) { + #if PERMISSION_EVENTS + entityType = EKEntityTypeEvent; + #else + completionHandler(PermissionStatusDenied); + return; + #endif + } else if (permission == PermissionGroupReminders) { + #if PERMISSION_REMINDERS + entityType = EKEntityTypeReminder; + #else + completionHandler(PermissionStatusDenied); + return; + #endif + } else { + completionHandler(PermissionStatusPermanentlyDenied); + return; + } + + EKEventStore *eventStore = [[EKEventStore alloc] init]; + [eventStore requestAccessToEntityType:entityType completion:^(BOOL granted, NSError *error) { + if (granted) { + completionHandler(PermissionStatusGranted); + } else { + completionHandler(PermissionStatusPermanentlyDenied); + } + }]; +} + ++ (PermissionStatus)permissionStatus:(EKEntityType)entityType { + EKAuthorizationStatus status = [EKEventStore authorizationStatusForEntityType:entityType]; + + switch (status) { + case EKAuthorizationStatusNotDetermined: + return PermissionStatusDenied; + case EKAuthorizationStatusRestricted: + return PermissionStatusRestricted; + case EKAuthorizationStatusDenied: + return PermissionStatusPermanentlyDenied; + case EKAuthorizationStatusAuthorized: + return PermissionStatusGranted; + } + + return PermissionStatusDenied; +} + +@end + +#else + +@implementation EventPermissionStrategy +@end + +#endif diff --git a/permission_handler_apple/macos/Classes/strategies/LocationPermissionStrategy.h b/permission_handler_apple/macos/Classes/strategies/LocationPermissionStrategy.h new file mode 100644 index 000000000..9ca88c012 --- /dev/null +++ b/permission_handler_apple/macos/Classes/strategies/LocationPermissionStrategy.h @@ -0,0 +1,23 @@ +// +// Created by Razvan Lung(long1eu) on 2019-02-15. +// Copyright (c) 2019 The Chromium Authors. All rights reserved. +// + +#import +#import "PermissionStrategy.h" + +#if PERMISSION_LOCATION + +#import + +@interface LocationPermissionStrategy : NSObject +- (instancetype)initWithLocationManager; +@end + +#else + +#import "UnknownPermissionStrategy.h" +@interface LocationPermissionStrategy : UnknownPermissionStrategy +@end + +#endif diff --git a/permission_handler_apple/macos/Classes/strategies/LocationPermissionStrategy.m b/permission_handler_apple/macos/Classes/strategies/LocationPermissionStrategy.m new file mode 100644 index 000000000..b31e870ee --- /dev/null +++ b/permission_handler_apple/macos/Classes/strategies/LocationPermissionStrategy.m @@ -0,0 +1,174 @@ +// +// Created by Razvan Lung(long1eu) on 2019-02-15. +// Copyright (c) 2019 The Chromium Authors. All rights reserved. +// + +#import "LocationPermissionStrategy.h" + +#if PERMISSION_LOCATION + +NSString *const UserDefaultPermissionRequestedKey = @"org.baseflow.permission_handler_apple.permission_requested"; + +@interface LocationPermissionStrategy () +- (void) receiveActivityNotification:(NSNotification *)notification; +@end + +@implementation LocationPermissionStrategy { + CLLocationManager *_locationManager; + PermissionStatusHandler _permissionStatusHandler; + PermissionGroup _requestedPermission; +} + +- (instancetype)initWithLocationManager { + self = [super init]; + if (self) { + _locationManager = [CLLocationManager new]; + _locationManager.delegate = self; + } + + return self; +} + +- (PermissionStatus)checkPermissionStatus:(PermissionGroup)permission { + return [LocationPermissionStrategy permissionStatus:permission]; +} + +- (ServiceStatus)checkServiceStatus:(PermissionGroup)permission { + return [CLLocationManager locationServicesEnabled] ? ServiceStatusEnabled : ServiceStatusDisabled; +} + +- (void)requestPermission:(PermissionGroup)permission completionHandler:(PermissionStatusHandler)completionHandler { + PermissionStatus status = [self checkPermissionStatus:permission]; + if ([CLLocationManager authorizationStatus] == kCLAuthorizationStatusAuthorized && permission == PermissionGroupLocationAlways) { + BOOL alreadyRequested = [[NSUserDefaults standardUserDefaults] boolForKey:UserDefaultPermissionRequestedKey]; // check if already requested the permanent permission + if(alreadyRequested) { + completionHandler(status); + return; + } + } else if (status != PermissionStatusDenied) { // handles undetermined always permission and denied whenInUse permission + completionHandler(status); + return; + } + + _permissionStatusHandler = completionHandler; + _requestedPermission = permission; + + if (@available(macOS 10.15, *)) { + if (permission == PermissionGroupLocation) { + if ([[NSBundle mainBundle] objectForInfoDictionaryKey:@"NSLocationAlwaysUsageDescription"] != nil) { + [_locationManager requestAlwaysAuthorization]; + } else if ([[NSBundle mainBundle] objectForInfoDictionaryKey:@"NSLocationWhenInUseUsageDescription"] != nil) { + [_locationManager requestWhenInUseAuthorization]; + } else { + [[NSException exceptionWithName:NSInternalInconsistencyException reason:@"To use location in macOS 10.15 you need to define either NSLocationWhenInUseUsageDescription or NSLocationAlwaysUsageDescription in the app bundle's Info.plist file" userInfo:nil] raise]; + } + } else if (permission == PermissionGroupLocationAlways) { + if ([[NSBundle mainBundle] objectForInfoDictionaryKey:@"NSLocationAlwaysUsageDescription"] != nil) { + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(receiveActivityNotification:) name:NSApplicationDidBecomeActiveNotification object:nil]; + [_locationManager requestAlwaysAuthorization]; + [[NSUserDefaults standardUserDefaults] setBool:TRUE forKey:UserDefaultPermissionRequestedKey]; + } else { + [[NSException exceptionWithName:NSInternalInconsistencyException reason:@"To use location in macOS 10.15 you need to define NSLocationAlwaysUsageDescription in the app bundle's Info.plist file" userInfo:nil] raise]; + } + } else if (permission == PermissionGroupLocationWhenInUse) { + if ([[NSBundle mainBundle] objectForInfoDictionaryKey:@"NSLocationWhenInUseUsageDescription"] != nil) { + [_locationManager requestWhenInUseAuthorization]; + } else { + [[NSException exceptionWithName:NSInternalInconsistencyException reason:@"To use location in macOS 10.15 you need to define NSLocationWhenInUseUsageDescription in the app bundle's Info.plist file" userInfo:nil] raise]; + } + } + } else { + // on macOS 10.14 and previous version, requesting a location update will trigger the system alert for the location + completionHandler(PermissionStatusGranted); + } + +} + +- (void) receiveActivityNotification:(NSNotification *) notification { + CLAuthorizationStatus status; + if(@available(macOS 11.0, *)){ + status = _locationManager.authorizationStatus; + } else { + status = [CLLocationManager authorizationStatus]; + } + + if (@available(macOS 10.12, *)) { + if (_requestedPermission == PermissionGroupLocationAlways && status != kCLAuthorizationStatusAuthorizedAlways) { + PermissionStatus permissionStatus = [LocationPermissionStrategy determinePermissionStatus:_requestedPermission authorizationStatus:status]; + + _permissionStatusHandler(permissionStatus); + } else { + _permissionStatusHandler(PermissionStatusGranted); + } + } else { + _permissionStatusHandler(PermissionStatusGranted); + } + [[NSNotificationCenter defaultCenter] removeObserver:self name:NSApplicationDidBecomeActiveNotification object:nil]; +} + +// {WARNING} +// This is called when the location manager is first initialized and raises the following situations: +// 1. When we first request [PermissionGroupLocationWhenInUse] and then [PermissionGroupLocationAlways] +// this will be called when the [CLLocationManager] is first initialized with +// [kCLAuthorizationStatusAuthorizedWhenInUse]. As a consequence we send back the result to early. +// 2. When we first request [PermissionGroupLocationWhenInUse] and then [PermissionGroupLocationAlways] +// and the user doesn't allow for [kCLAuthorizationStatusAuthorizedAlways] this method is not called +// at all. +- (void)locationManager:(CLLocationManager *)manager didChangeAuthorizationStatus:(CLAuthorizationStatus)status { + if (status == kCLAuthorizationStatusNotDetermined) { + return; + } + + if (_permissionStatusHandler == nil || @(_requestedPermission) == nil) { + return; + } + + if ((_requestedPermission == PermissionGroupLocationAlways && status == kCLAuthorizationStatusAuthorized)) { + _permissionStatusHandler(PermissionStatusGranted); + return; + } + + PermissionStatus permissionStatus = [LocationPermissionStrategy + determinePermissionStatus:_requestedPermission authorizationStatus:status]; + + _permissionStatusHandler(permissionStatus); +} + + ++ (PermissionStatus)permissionStatus:(PermissionGroup)permission { + CLAuthorizationStatus authorizationStatus = [CLLocationManager authorizationStatus]; + + + PermissionStatus status = [LocationPermissionStrategy + determinePermissionStatus:permission authorizationStatus:authorizationStatus]; + + return status; +} + + ++ (PermissionStatus)determinePermissionStatus:(PermissionGroup)permission authorizationStatus:(CLAuthorizationStatus)authorizationStatus { + if (@available(macOS 10.12, *)) { + if(authorizationStatus == kCLAuthorizationStatusAuthorizedAlways) { + return PermissionStatusGranted; + } + } + switch (authorizationStatus) { + case kCLAuthorizationStatusNotDetermined: + return PermissionStatusDenied; + case kCLAuthorizationStatusRestricted: + return PermissionStatusRestricted; + case kCLAuthorizationStatusDenied: + return PermissionStatusPermanentlyDenied; + case kCLAuthorizationStatusAuthorized: + return PermissionStatusGranted; + } +} + +@end + +#else + +@implementation LocationPermissionStrategy +@end + +#endif diff --git a/permission_handler_apple/macos/Classes/strategies/MediaLibraryPermissionStrategy.h b/permission_handler_apple/macos/Classes/strategies/MediaLibraryPermissionStrategy.h new file mode 100644 index 000000000..5bab13c5b --- /dev/null +++ b/permission_handler_apple/macos/Classes/strategies/MediaLibraryPermissionStrategy.h @@ -0,0 +1,22 @@ +// +// Created by Razvan Lung(long1eu) on 2019-02-15. +// Copyright (c) 2019 The Chromium Authors. All rights reserved. +// + +#import +#include "PermissionStrategy.h" + +#if PERMISSION_MEDIA_LIBRARY + +#import + +@interface MediaLibraryPermissionStrategy : NSObject +@end + +#else + +#import "UnknownPermissionStrategy.h" +@interface MediaLibraryPermissionStrategy : UnknownPermissionStrategy +@end + +#endif diff --git a/permission_handler_apple/macos/Classes/strategies/MediaLibraryPermissionStrategy.m b/permission_handler_apple/macos/Classes/strategies/MediaLibraryPermissionStrategy.m new file mode 100644 index 000000000..09a8a52b6 --- /dev/null +++ b/permission_handler_apple/macos/Classes/strategies/MediaLibraryPermissionStrategy.m @@ -0,0 +1,36 @@ +// +// Created by Razvan Lung(long1eu) on 2019-02-15. +// Copyright (c) 2019 The Chromium Authors. All rights reserved. +// + +#import "MediaLibraryPermissionStrategy.h" + +#if PERMISSION_MEDIA_LIBRARY + +@implementation MediaLibraryPermissionStrategy + +- (PermissionStatus)checkPermissionStatus:(PermissionGroup)permission { + return [MediaLibraryPermissionStrategy permissionStatus]; +} + +- (ServiceStatus)checkServiceStatus:(PermissionGroup)permission { + return ServiceStatusNotApplicable; +} + +- (void)requestPermission:(PermissionGroup)permission completionHandler:(PermissionStatusHandler)completionHandler { + completionHandler(PermissionStatusDenied); +} + ++ (PermissionStatus)permissionStatus { + return PermissionStatusDenied; +} + + +@end + +#else + +@implementation MediaLibraryPermissionStrategy +@end + +#endif diff --git a/permission_handler_apple/macos/Classes/strategies/NotificationPermissionStrategy.h b/permission_handler_apple/macos/Classes/strategies/NotificationPermissionStrategy.h new file mode 100644 index 000000000..df5a795d6 --- /dev/null +++ b/permission_handler_apple/macos/Classes/strategies/NotificationPermissionStrategy.h @@ -0,0 +1,25 @@ +// +// NotificationPermissionStrategy.h +// permission_handler +// +// Created by Tong on 2019/10/21. +// + +#import +#import "PermissionStrategy.h" + +#if PERMISSION_NOTIFICATIONS + +#import + +@interface NotificationPermissionStrategy : NSObject + +@end + +#else + +#import "UnknownPermissionStrategy.h" +@interface NotificationPermissionStrategy : UnknownPermissionStrategy +@end + +#endif diff --git a/permission_handler_apple/macos/Classes/strategies/NotificationPermissionStrategy.m b/permission_handler_apple/macos/Classes/strategies/NotificationPermissionStrategy.m new file mode 100644 index 000000000..267ba40b3 --- /dev/null +++ b/permission_handler_apple/macos/Classes/strategies/NotificationPermissionStrategy.m @@ -0,0 +1,79 @@ +// +// NotificationPermissionStrategy.m +// permission_handler +// +// Created by Tong on 2019/10/21. +// + +#import "NotificationPermissionStrategy.h" + +#if PERMISSION_NOTIFICATIONS + +@implementation NotificationPermissionStrategy + +- (PermissionStatus)checkPermissionStatus:(PermissionGroup)permission { + return [NotificationPermissionStrategy permissionStatus]; +} + +- (ServiceStatus)checkServiceStatus:(PermissionGroup)permission { + return ServiceStatusNotApplicable; +} + +- (void)requestPermission:(PermissionGroup)permission completionHandler:(PermissionStatusHandler)completionHandler { + PermissionStatus status = [self checkPermissionStatus:permission]; + if (status != PermissionStatusDenied) { + completionHandler(status); + return; + } + dispatch_async(dispatch_get_main_queue(), ^{ + if(@available(macOS 10.14, *)) { + UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter]; + UNAuthorizationOptions authorizationOptions = 0; + authorizationOptions += UNAuthorizationOptionSound; + authorizationOptions += UNAuthorizationOptionAlert; + authorizationOptions += UNAuthorizationOptionBadge; + [center requestAuthorizationWithOptions:(authorizationOptions) completionHandler:^(BOOL granted, NSError * _Nullable error) { + if (error != nil || !granted) { + completionHandler(PermissionStatusPermanentlyDenied); + return; + } + + dispatch_async(dispatch_get_main_queue(), ^{ + [[NSApplication sharedApplication] registerForRemoteNotifications]; + completionHandler(PermissionStatusGranted); + }); + }]; + + } else { + completionHandler(PermissionStatusDenied); + } + }); +} + ++ (PermissionStatus)permissionStatus { + __block PermissionStatus permissionStatus = PermissionStatusGranted; + if (@available(macOS 10.14, *)) { + dispatch_semaphore_t sem = dispatch_semaphore_create(0); + [[UNUserNotificationCenter currentNotificationCenter] getNotificationSettingsWithCompletionHandler:^(UNNotificationSettings * _Nonnull settings) { + if (settings.authorizationStatus == UNAuthorizationStatusDenied) { + permissionStatus = PermissionStatusPermanentlyDenied; + } else if (settings.authorizationStatus == UNAuthorizationStatusNotDetermined) { + permissionStatus = PermissionStatusDenied; + } + dispatch_semaphore_signal(sem); + }]; + dispatch_semaphore_wait(sem, DISPATCH_TIME_FOREVER); + } else { + permissionStatus = PermissionStatusPermanentlyDenied; + } + return permissionStatus; +} + +@end + +#else + +@implementation NotificationPermissionStrategy +@end + +#endif diff --git a/permission_handler_apple/macos/Classes/strategies/PermissionStrategy.h b/permission_handler_apple/macos/Classes/strategies/PermissionStrategy.h new file mode 100644 index 000000000..3e50df119 --- /dev/null +++ b/permission_handler_apple/macos/Classes/strategies/PermissionStrategy.h @@ -0,0 +1,17 @@ +// +// Created by Razvan Lung(long1eu) on 2019-02-15. +// Copyright (c) 2019 The Chromium Authors. All rights reserved. +// + +#import +#import "PermissionHandlerEnums.h" + +typedef void (^PermissionStatusHandler)(PermissionStatus permissionStatus); + +@protocol PermissionStrategy +- (PermissionStatus)checkPermissionStatus:(PermissionGroup)permission; + +- (ServiceStatus)checkServiceStatus:(PermissionGroup)permission; + +- (void)requestPermission:(PermissionGroup)permission completionHandler:(PermissionStatusHandler)completionHandler; +@end diff --git a/permission_handler_apple/macos/Classes/strategies/PhonePermissionStrategy.h b/permission_handler_apple/macos/Classes/strategies/PhonePermissionStrategy.h new file mode 100644 index 000000000..a90cfc81f --- /dev/null +++ b/permission_handler_apple/macos/Classes/strategies/PhonePermissionStrategy.h @@ -0,0 +1,17 @@ +// +// PhonePermissionStrategy.h +// permission_handler +// +// Created by Sebastian Roth on 5/20/19. +// + +#import +#import "PermissionStrategy.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface PhonePermissionStrategy : NSObject + +@end + +NS_ASSUME_NONNULL_END diff --git a/permission_handler_apple/macos/Classes/strategies/PhonePermissionStrategy.m b/permission_handler_apple/macos/Classes/strategies/PhonePermissionStrategy.m new file mode 100644 index 000000000..c976c6571 --- /dev/null +++ b/permission_handler_apple/macos/Classes/strategies/PhonePermissionStrategy.m @@ -0,0 +1,40 @@ +// +// PhonePermissionStrategy.m +// permission_handler +// +// Created by Sebastian Roth on 5/20/19. +// + +#import +#import + +#import "PhonePermissionStrategy.h" + +@implementation PhonePermissionStrategy + +- (PermissionStatus)checkPermissionStatus:(PermissionGroup)permission { + return PermissionStatusDenied; +} + +- (ServiceStatus)checkServiceStatus:(PermissionGroup)permission { + // https://stackoverflow.com/a/5095058 + BOOL result = [[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:@"tel://"]]; + if(!result) { + return ServiceStatusNotApplicable; + } + return [self canDevicePlaceAPhoneCall] ? ServiceStatusEnabled : ServiceStatusDisabled; +} + +- (void)requestPermission:(PermissionGroup)permission completionHandler:(PermissionStatusHandler)completionHandler { + completionHandler(PermissionStatusPermanentlyDenied); +} + + +/** + * Returns YES if the device can place a phone call. + */ +-(bool) canDevicePlaceAPhoneCall { + return NO; +} + +@end diff --git a/permission_handler_apple/macos/Classes/strategies/PhotoPermissionStrategy.h b/permission_handler_apple/macos/Classes/strategies/PhotoPermissionStrategy.h new file mode 100644 index 000000000..ef635097e --- /dev/null +++ b/permission_handler_apple/macos/Classes/strategies/PhotoPermissionStrategy.h @@ -0,0 +1,23 @@ +// +// Created by Razvan Lung(long1eu) on 2019-02-15. +// Copyright (c) 2019 The Chromium Authors. All rights reserved. +// + +#import +#import "PermissionStrategy.h" + +#if PERMISSION_PHOTOS + +#import + +@interface PhotoPermissionStrategy : NSObject +-(instancetype)initWithAccessAddOnly:(BOOL) addOnly; +@end + +#else + +#import "UnknownPermissionStrategy.h" +@interface PhotoPermissionStrategy : UnknownPermissionStrategy +@end + +#endif diff --git a/permission_handler_apple/macos/Classes/strategies/PhotoPermissionStrategy.m b/permission_handler_apple/macos/Classes/strategies/PhotoPermissionStrategy.m new file mode 100644 index 000000000..b78208bed --- /dev/null +++ b/permission_handler_apple/macos/Classes/strategies/PhotoPermissionStrategy.m @@ -0,0 +1,84 @@ +// +// Created by Razvan Lung(long1eu) on 2019-02-15. +// Copyright (c) 2019 The Chromium Authors. All rights reserved. +// + +#import "PhotoPermissionStrategy.h" + +#if PERMISSION_PHOTOS + +@implementation PhotoPermissionStrategy{ + bool addOnlyAccessLevel; +} + +- (instancetype)initWithAccessAddOnly:(BOOL)addOnly { + self = [super init]; + if(self) { + addOnlyAccessLevel = addOnly; + } + + return self; +} + +- (PermissionStatus)checkPermissionStatus:(PermissionGroup)permission { + return [PhotoPermissionStrategy permissionStatus:addOnlyAccessLevel]; +} + +- (ServiceStatus)checkServiceStatus:(PermissionGroup)permission { + return ServiceStatusNotApplicable; +} + +- (void)requestPermission:(PermissionGroup)permission completionHandler:(PermissionStatusHandler)completionHandler { + PermissionStatus status = [self checkPermissionStatus:permission]; + + if (status != PermissionStatusDenied) { + completionHandler(status); + return; + } + + if(@available(macOS 11.0, *)) { + [PHPhotoLibrary requestAuthorizationForAccessLevel:(addOnlyAccessLevel)?PHAccessLevelAddOnly:PHAccessLevelReadWrite handler:^(PHAuthorizationStatus authorizationStatus) { + completionHandler([PhotoPermissionStrategy determinePermissionStatus:authorizationStatus]); + }]; + }else { + completionHandler(PermissionStatusPermanentlyDenied); + } +} + ++ (PermissionStatus)permissionStatus:(BOOL) addOnlyAccessLevel { + + if(@available(macOS 11.0, *)){ + PHAuthorizationStatus status; + status = [PHPhotoLibrary authorizationStatusForAccessLevel:(addOnlyAccessLevel)?PHAccessLevelAddOnly:PHAccessLevelReadWrite]; + return [PhotoPermissionStrategy determinePermissionStatus:status]; + } else { + return PermissionStatusDenied; + } + +} + ++ (PermissionStatus)determinePermissionStatus:(PHAuthorizationStatus)authorizationStatus API_AVAILABLE(macos(10.13)){ + switch (authorizationStatus) { + case PHAuthorizationStatusNotDetermined: + return PermissionStatusDenied; + case PHAuthorizationStatusRestricted: + return PermissionStatusRestricted; + case PHAuthorizationStatusDenied: + return PermissionStatusPermanentlyDenied; + case PHAuthorizationStatusAuthorized: + return PermissionStatusGranted; + case PHAuthorizationStatusLimited: + return PermissionStatusLimited; + } + + return PermissionStatusDenied; +} + +@end + +#else + +@implementation PhotoPermissionStrategy +@end + +#endif diff --git a/permission_handler_apple/macos/Classes/strategies/SensorPermissionStrategy.h b/permission_handler_apple/macos/Classes/strategies/SensorPermissionStrategy.h new file mode 100644 index 000000000..22f8dcadd --- /dev/null +++ b/permission_handler_apple/macos/Classes/strategies/SensorPermissionStrategy.h @@ -0,0 +1,22 @@ +// +// Created by Razvan Lung(long1eu) on 2019-02-15. +// Copyright (c) 2019 The Chromium Authors. All rights reserved. +// + +#import +#import "PermissionStrategy.h" + +#if PERMISSION_SENSORS + +#import + +@interface SensorPermissionStrategy : NSObject +@end + +#else + +#import "UnknownPermissionStrategy.h" +@interface SensorPermissionStrategy : UnknownPermissionStrategy +@end + +#endif diff --git a/permission_handler_apple/macos/Classes/strategies/SensorPermissionStrategy.m b/permission_handler_apple/macos/Classes/strategies/SensorPermissionStrategy.m new file mode 100644 index 000000000..31d06a071 --- /dev/null +++ b/permission_handler_apple/macos/Classes/strategies/SensorPermissionStrategy.m @@ -0,0 +1,34 @@ +// +// Created by Razvan Lung(long1eu) on 2019-02-15. +// Copyright (c) 2019 The Chromium Authors. All rights reserved. +// + +#import "SensorPermissionStrategy.h" + +#if PERMISSION_SENSORS + +@implementation SensorPermissionStrategy +- (PermissionStatus)checkPermissionStatus:(PermissionGroup)permission { + return [SensorPermissionStrategy permissionStatus]; +} + +- (ServiceStatus)checkServiceStatus:(PermissionGroup)permission { + return ServiceStatusDisabled; +} + +- (void)requestPermission:(PermissionGroup)permission completionHandler:(PermissionStatusHandler)completionHandler { + completionHandler(PermissionStatusDenied); +} + ++ (PermissionStatus)permissionStatus { + return PermissionStatusDenied; +} + +@end + +#else + +@implementation SensorPermissionStrategy +@end + +#endif diff --git a/permission_handler_apple/macos/Classes/strategies/SpeechPermissionStrategy.h b/permission_handler_apple/macos/Classes/strategies/SpeechPermissionStrategy.h new file mode 100644 index 000000000..0e00ecc32 --- /dev/null +++ b/permission_handler_apple/macos/Classes/strategies/SpeechPermissionStrategy.h @@ -0,0 +1,22 @@ +// +// Created by Razvan Lung(long1eu) on 2019-02-15. +// Copyright (c) 2019 The Chromium Authors. All rights reserved. +// + +#import +#import "PermissionStrategy.h" + +#if PERMISSION_SPEECH_RECOGNIZER + +#import + +@interface SpeechPermissionStrategy : NSObject +@end + +#else + +#import "UnknownPermissionStrategy.h" +@interface SpeechPermissionStrategy : UnknownPermissionStrategy +@end + +#endif diff --git a/permission_handler_apple/macos/Classes/strategies/SpeechPermissionStrategy.m b/permission_handler_apple/macos/Classes/strategies/SpeechPermissionStrategy.m new file mode 100644 index 000000000..eba227640 --- /dev/null +++ b/permission_handler_apple/macos/Classes/strategies/SpeechPermissionStrategy.m @@ -0,0 +1,68 @@ +// +// Created by Razvan Lung(long1eu) on 2019-02-15. +// Copyright (c) 2019 The Chromium Authors. All rights reserved. +// + +#import "SpeechPermissionStrategy.h" + +#if PERMISSION_SPEECH_RECOGNIZER + +@implementation SpeechPermissionStrategy +- (PermissionStatus)checkPermissionStatus:(PermissionGroup)permission { + return [SpeechPermissionStrategy permissionStatus]; +} + +- (ServiceStatus)checkServiceStatus:(PermissionGroup)permission { + return ServiceStatusNotApplicable; +} + +- (void)requestPermission:(PermissionGroup)permission completionHandler:(PermissionStatusHandler)completionHandler { + PermissionStatus status = [self checkPermissionStatus:permission]; + + if (status != PermissionStatusDenied) { + completionHandler(status); + return; + } + + if (@available(macOS 10.15, *)) { + [SFSpeechRecognizer requestAuthorization:^(SFSpeechRecognizerAuthorizationStatus authorizationStatus) { + completionHandler([SpeechPermissionStrategy determinePermissionStatus:authorizationStatus]); + }]; + } else { + completionHandler(PermissionStatusDenied); + } +} + ++ (PermissionStatus)permissionStatus { + if (@available(macOS 10.15, *)) { + SFSpeechRecognizerAuthorizationStatus status = [SFSpeechRecognizer authorizationStatus]; + + return [SpeechPermissionStrategy determinePermissionStatus:status]; + } + + return PermissionStatusDenied; +} + ++ (PermissionStatus)determinePermissionStatus:(SFSpeechRecognizerAuthorizationStatus)authorizationStatus API_AVAILABLE(macosx(10.15)){ + switch (authorizationStatus) { + case SFSpeechRecognizerAuthorizationStatusNotDetermined: + return PermissionStatusDenied; + case SFSpeechRecognizerAuthorizationStatusDenied: + return PermissionStatusPermanentlyDenied; + case SFSpeechRecognizerAuthorizationStatusRestricted: + return PermissionStatusRestricted; + case SFSpeechRecognizerAuthorizationStatusAuthorized: + return PermissionStatusGranted; + } + + return PermissionStatusDenied; +} + +@end + +#else + +@implementation SpeechPermissionStrategy +@end + +#endif diff --git a/permission_handler_apple/macos/Classes/strategies/StoragePermissionStrategy.h b/permission_handler_apple/macos/Classes/strategies/StoragePermissionStrategy.h new file mode 100644 index 000000000..51e9d07f2 --- /dev/null +++ b/permission_handler_apple/macos/Classes/strategies/StoragePermissionStrategy.h @@ -0,0 +1,17 @@ +// +// StoragePermissionStrategy.h +// permission_handler +// +// Created by Frank Gregor on 06.11.19. +// + +#import +#import "PermissionStrategy.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface StoragePermissionStrategy : NSObject + +@end + +NS_ASSUME_NONNULL_END diff --git a/permission_handler_apple/macos/Classes/strategies/StoragePermissionStrategy.m b/permission_handler_apple/macos/Classes/strategies/StoragePermissionStrategy.m new file mode 100644 index 000000000..46930b149 --- /dev/null +++ b/permission_handler_apple/macos/Classes/strategies/StoragePermissionStrategy.m @@ -0,0 +1,28 @@ +// +// StoragePermissionStrategy.m +// permission_handler +// +// Created by Frank Gregor on 06.11.19. +// + +#import "StoragePermissionStrategy.h" + +@implementation StoragePermissionStrategy + +- (PermissionStatus)checkPermissionStatus:(PermissionGroup)permission { + return [StoragePermissionStrategy permissionStatus]; +} + +- (ServiceStatus)checkServiceStatus:(PermissionGroup)permission { + return ServiceStatusNotApplicable; +} + +- (void)requestPermission:(PermissionGroup)permission completionHandler:(PermissionStatusHandler)completionHandler { + completionHandler([StoragePermissionStrategy permissionStatus]); +} + ++ (PermissionStatus)permissionStatus { + return PermissionStatusGranted; +} + +@end diff --git a/permission_handler_apple/macos/Classes/strategies/UnknownPermissionStrategy.h b/permission_handler_apple/macos/Classes/strategies/UnknownPermissionStrategy.h new file mode 100644 index 000000000..8b633d967 --- /dev/null +++ b/permission_handler_apple/macos/Classes/strategies/UnknownPermissionStrategy.h @@ -0,0 +1,11 @@ +// +// Created by Razvan Lung(long1eu) on 2019-02-15. +// Copyright (c) 2019 The Chromium Authors. All rights reserved. +// + +#import +#import "PermissionStrategy.h" + + +@interface UnknownPermissionStrategy : NSObject +@end \ No newline at end of file diff --git a/permission_handler_apple/macos/Classes/strategies/UnknownPermissionStrategy.m b/permission_handler_apple/macos/Classes/strategies/UnknownPermissionStrategy.m new file mode 100644 index 000000000..deea7eb80 --- /dev/null +++ b/permission_handler_apple/macos/Classes/strategies/UnknownPermissionStrategy.m @@ -0,0 +1,22 @@ +// +// Created by Razvan Lung(long1eu) on 2019-02-15. +// Copyright (c) 2019 The Chromium Authors. All rights reserved. +// + +#import "UnknownPermissionStrategy.h" + + +@implementation UnknownPermissionStrategy + +- (PermissionStatus)checkPermissionStatus:(PermissionGroup)permission { + return PermissionStatusDenied; +} + +- (ServiceStatus)checkServiceStatus:(PermissionGroup)permission { + return ServiceStatusDisabled; +} + +- (void)requestPermission:(PermissionGroup)permission completionHandler:(PermissionStatusHandler)completionHandler { + completionHandler(PermissionStatusPermanentlyDenied); +} +@end diff --git a/permission_handler_apple/macos/Classes/util/Codec.h b/permission_handler_apple/macos/Classes/util/Codec.h new file mode 100644 index 000000000..ad930a490 --- /dev/null +++ b/permission_handler_apple/macos/Classes/util/Codec.h @@ -0,0 +1,17 @@ +// +// Created by Razvan Lung on 2019-02-15. +// Copyright (c) 2019 The Chromium Authors. All rights reserved. +// + +#import +#import "PermissionHandlerEnums.h" + +@interface Codec : NSObject ++ (PermissionGroup)decodePermissionGroupFrom:(NSNumber *_Nonnull)event; + ++ (NSArray*_Nullable)decodePermissionGroupsFrom:(NSArray *_Nullable)event; + ++ (NSNumber *_Nullable)encodePermissionStatus:(enum PermissionStatus)permissionStatus; + ++ (NSNumber *_Nullable)encodeServiceStatus:(enum ServiceStatus)serviceStatus; +@end diff --git a/permission_handler_apple/macos/Classes/util/Codec.m b/permission_handler_apple/macos/Classes/util/Codec.m new file mode 100644 index 000000000..a7447fe01 --- /dev/null +++ b/permission_handler_apple/macos/Classes/util/Codec.m @@ -0,0 +1,29 @@ +// +// Created by Razvan Lung on 2019-02-15. +// Copyright (c) 2019 The Chromium Authors. All rights reserved. +// + +#import "Codec.h" + +@implementation Codec ++ (PermissionGroup)decodePermissionGroupFrom:(NSNumber *)event { + return (PermissionGroup) event.intValue; +} + ++ (NSArray *_Nullable)decodePermissionGroupsFrom:(NSArray *)event { + NSMutableArray *result = [[NSMutableArray alloc] init]; + for (NSNumber *number in event) { + [result addObject:@([self decodePermissionGroupFrom:number])]; + } + return [[NSArray alloc] initWithArray:result]; +} + ++ (NSNumber *_Nullable)encodePermissionStatus:(enum PermissionStatus)permissionStatus { + return [[NSNumber alloc] initWithInt:permissionStatus]; +} + ++ (NSNumber *_Nullable)encodeServiceStatus:(enum ServiceStatus)serviceStatus { + return [[NSNumber alloc] initWithInt:serviceStatus]; +} + +@end diff --git a/permission_handler_apple/macos/permission_handler_apple.podspec b/permission_handler_apple/macos/permission_handler_apple.podspec new file mode 100644 index 000000000..1d8519011 --- /dev/null +++ b/permission_handler_apple/macos/permission_handler_apple.podspec @@ -0,0 +1,23 @@ +# +# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html. +# Run `pod lib lint permission_handler_apple.podspec` to validate before publishing. +# +Pod::Spec.new do |s| + s.name = 'permission_handler_apple' + s.version = '0.0.1' + s.summary = 'A new Flutter plugin project.' + s.description = <<-DESC +A new Flutter plugin project. + DESC + s.homepage = 'http://example.com' + s.license = { :file => '../LICENSE' } + s.author = { 'Your Company' => 'email@example.com' } + + s.source = { :path => '.' } + s.source_files = 'Classes/**/*' + s.dependency 'FlutterMacOS' + + s.platform = :osx, '10.11' + s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES' } + s.swift_version = '5.0' +end diff --git a/permission_handler_apple/pubspec.yaml b/permission_handler_apple/pubspec.yaml index a353c06e5..c7889e5b2 100644 --- a/permission_handler_apple/pubspec.yaml +++ b/permission_handler_apple/pubspec.yaml @@ -14,6 +14,8 @@ flutter: platforms: ios: pluginClass: PermissionHandlerPlugin + macos: + pluginClass: PermissionHandlerPlugin dependencies: flutter: