├── .editorconfig ├── .gitattributes ├── .github ├── FUNDING.yml ├── ISSUE_TEMPLATE │ ├── a-regression.yml │ ├── b-bug-report.yml │ ├── c-feature-request.yml │ ├── d-enhancement-proposal.yml │ └── e-question.yml ├── PULL_REQUEST_TEMPLATE.md └── workflows │ ├── no-response.yaml │ ├── permission_handler.yaml │ ├── permission_handler_android.yaml │ ├── permission_handler_apple.yaml │ └── permission_handler_platform_interface.yaml ├── .gitignore ├── .metadata ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── analysis_options.yaml ├── permission_handler ├── AUTHORS ├── CHANGELOG.md ├── LICENSE ├── README.md ├── example │ ├── .gitignore │ ├── .metadata │ ├── README.md │ ├── android │ │ ├── .gitignore │ │ ├── app │ │ │ ├── build.gradle │ │ │ └── src │ │ │ │ ├── debug │ │ │ │ └── AndroidManifest.xml │ │ │ │ ├── main │ │ │ │ ├── AndroidManifest.xml │ │ │ │ ├── kotlin │ │ │ │ │ └── com │ │ │ │ │ │ └── example │ │ │ │ │ │ └── example │ │ │ │ │ │ └── MainActivity.kt │ │ │ │ └── res │ │ │ │ │ ├── drawable-v21 │ │ │ │ │ └── launch_background.xml │ │ │ │ │ ├── drawable │ │ │ │ │ └── launch_background.xml │ │ │ │ │ ├── mipmap-hdpi │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ ├── mipmap-mdpi │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ ├── mipmap-xhdpi │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ ├── mipmap-xxhdpi │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ ├── mipmap-xxxhdpi │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ ├── values-night │ │ │ │ │ └── styles.xml │ │ │ │ │ └── values │ │ │ │ │ └── styles.xml │ │ │ │ └── profile │ │ │ │ └── AndroidManifest.xml │ │ ├── build.gradle │ │ ├── gradle.properties │ │ ├── gradle │ │ │ └── wrapper │ │ │ │ └── gradle-wrapper.properties │ │ └── settings.gradle │ ├── ios │ │ ├── .gitignore │ │ ├── Flutter │ │ │ ├── AppFrameworkInfo.plist │ │ │ ├── Debug.xcconfig │ │ │ └── Release.xcconfig │ │ ├── Podfile │ │ ├── Runner.xcodeproj │ │ │ ├── project.pbxproj │ │ │ ├── project.xcworkspace │ │ │ │ ├── contents.xcworkspacedata │ │ │ │ └── xcshareddata │ │ │ │ │ ├── IDEWorkspaceChecks.plist │ │ │ │ │ └── WorkspaceSettings.xcsettings │ │ │ └── xcshareddata │ │ │ │ └── xcschemes │ │ │ │ └── Runner.xcscheme │ │ ├── Runner.xcworkspace │ │ │ ├── contents.xcworkspacedata │ │ │ └── xcshareddata │ │ │ │ ├── IDEWorkspaceChecks.plist │ │ │ │ └── WorkspaceSettings.xcsettings │ │ └── Runner │ │ │ ├── AppDelegate.swift │ │ │ ├── Assets.xcassets │ │ │ ├── AppIcon.appiconset │ │ │ │ ├── Contents.json │ │ │ │ ├── Icon-App-1024x1024@1x.png │ │ │ │ ├── Icon-App-20x20@1x.png │ │ │ │ ├── Icon-App-20x20@2x.png │ │ │ │ ├── Icon-App-20x20@3x.png │ │ │ │ ├── Icon-App-29x29@1x.png │ │ │ │ ├── Icon-App-29x29@2x.png │ │ │ │ ├── Icon-App-29x29@3x.png │ │ │ │ ├── Icon-App-40x40@1x.png │ │ │ │ ├── Icon-App-40x40@2x.png │ │ │ │ ├── Icon-App-40x40@3x.png │ │ │ │ ├── Icon-App-60x60@2x.png │ │ │ │ ├── Icon-App-60x60@3x.png │ │ │ │ ├── Icon-App-76x76@1x.png │ │ │ │ ├── Icon-App-76x76@2x.png │ │ │ │ └── Icon-App-83.5x83.5@2x.png │ │ │ └── LaunchImage.imageset │ │ │ │ ├── Contents.json │ │ │ │ ├── LaunchImage.png │ │ │ │ ├── LaunchImage@2x.png │ │ │ │ ├── LaunchImage@3x.png │ │ │ │ └── README.md │ │ │ ├── Base.lproj │ │ │ ├── LaunchScreen.storyboard │ │ │ └── Main.storyboard │ │ │ ├── Info.plist │ │ │ ├── Runner-Bridging-Header.h │ │ │ └── RunnerDebug.entitlements │ ├── lib │ │ └── main.dart │ ├── pubspec.yaml │ ├── res │ │ └── images │ │ │ ├── baseflow_logo_def_light-02.png │ │ │ ├── poweredByBaseflowLogoLight.png │ │ │ ├── poweredByBaseflowLogoLight@2x.png │ │ │ └── poweredByBaseflowLogoLight@3x.png │ └── windows │ │ ├── .gitignore │ │ ├── CMakeLists.txt │ │ ├── flutter │ │ ├── CMakeLists.txt │ │ ├── generated_plugin_registrant.cc │ │ ├── generated_plugin_registrant.h │ │ └── generated_plugins.cmake │ │ └── runner │ │ ├── CMakeLists.txt │ │ ├── Runner.rc │ │ ├── flutter_window.cpp │ │ ├── flutter_window.h │ │ ├── main.cpp │ │ ├── resource.h │ │ ├── resources │ │ └── app_icon.ico │ │ ├── runner.exe.manifest │ │ ├── utils.cpp │ │ ├── utils.h │ │ ├── win32_window.cpp │ │ └── win32_window.h ├── lib │ └── permission_handler.dart ├── pubspec.yaml ├── scripts │ ├── before_build_apks.sh │ └── before_build_ipas.sh └── test │ └── permission_handler_test.dart ├── permission_handler_android ├── AUTHORS ├── CHANGELOG.md ├── LICENSE ├── README.md ├── android │ ├── .classpath │ ├── .gitignore │ ├── .settings │ │ └── org.eclipse.buildship.core.prefs │ ├── build.gradle │ ├── gradle │ │ └── wrapper │ │ │ └── gradle-wrapper.properties │ ├── settings.gradle │ └── src │ │ └── main │ │ ├── AndroidManifest.xml │ │ └── java │ │ └── com │ │ └── baseflow │ │ └── permissionhandler │ │ ├── AppSettingsManager.java │ │ ├── ErrorCallback.java │ │ ├── MethodCallHandlerImpl.java │ │ ├── PermissionConstants.java │ │ ├── PermissionHandlerPlugin.java │ │ ├── PermissionManager.java │ │ ├── PermissionUtils.java │ │ └── ServiceManager.java ├── example │ ├── .gitignore │ ├── .metadata │ ├── README.md │ ├── android │ │ ├── .gitignore │ │ ├── .settings │ │ │ └── org.eclipse.buildship.core.prefs │ │ ├── app │ │ │ ├── build.gradle │ │ │ └── src │ │ │ │ ├── debug │ │ │ │ └── AndroidManifest.xml │ │ │ │ ├── main │ │ │ │ ├── AndroidManifest.xml │ │ │ │ ├── kotlin │ │ │ │ │ └── com │ │ │ │ │ │ └── example │ │ │ │ │ │ └── example │ │ │ │ │ │ └── MainActivity.kt │ │ │ │ └── res │ │ │ │ │ ├── drawable-v21 │ │ │ │ │ └── launch_background.xml │ │ │ │ │ ├── drawable │ │ │ │ │ └── launch_background.xml │ │ │ │ │ ├── mipmap-hdpi │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ ├── mipmap-mdpi │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ ├── mipmap-xhdpi │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ ├── mipmap-xxhdpi │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ ├── mipmap-xxxhdpi │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ ├── values-night │ │ │ │ │ └── styles.xml │ │ │ │ │ └── values │ │ │ │ │ └── styles.xml │ │ │ │ └── profile │ │ │ │ └── AndroidManifest.xml │ │ ├── build.gradle │ │ ├── gradle.properties │ │ ├── gradle │ │ │ └── wrapper │ │ │ │ └── gradle-wrapper.properties │ │ └── settings.gradle │ ├── lib │ │ └── main.dart │ ├── pubspec.yaml │ └── res │ │ └── images │ │ ├── baseflow_logo_def_light-02.png │ │ ├── poweredByBaseflowLogoLight.png │ │ ├── poweredByBaseflowLogoLight@2x.png │ │ └── poweredByBaseflowLogoLight@3x.png └── pubspec.yaml ├── permission_handler_apple ├── AUTHORS ├── CHANGELOG.md ├── LICENSE ├── README.md ├── example │ ├── .gitignore │ ├── .metadata │ ├── README.md │ ├── ios │ │ ├── .gitignore │ │ ├── Flutter │ │ │ ├── AppFrameworkInfo.plist │ │ │ ├── Debug.xcconfig │ │ │ └── Release.xcconfig │ │ ├── Podfile │ │ ├── Runner.xcodeproj │ │ │ ├── project.pbxproj │ │ │ ├── project.xcworkspace │ │ │ │ ├── contents.xcworkspacedata │ │ │ │ └── xcshareddata │ │ │ │ │ ├── IDEWorkspaceChecks.plist │ │ │ │ │ └── WorkspaceSettings.xcsettings │ │ │ └── xcshareddata │ │ │ │ └── xcschemes │ │ │ │ └── Runner.xcscheme │ │ ├── Runner.xcworkspace │ │ │ ├── contents.xcworkspacedata │ │ │ └── xcshareddata │ │ │ │ ├── IDEWorkspaceChecks.plist │ │ │ │ └── WorkspaceSettings.xcsettings │ │ └── Runner │ │ │ ├── AppDelegate.swift │ │ │ ├── Assets.xcassets │ │ │ ├── AppIcon.appiconset │ │ │ │ ├── Contents.json │ │ │ │ ├── Icon-App-1024x1024@1x.png │ │ │ │ ├── Icon-App-20x20@1x.png │ │ │ │ ├── Icon-App-20x20@2x.png │ │ │ │ ├── Icon-App-20x20@3x.png │ │ │ │ ├── Icon-App-29x29@1x.png │ │ │ │ ├── Icon-App-29x29@2x.png │ │ │ │ ├── Icon-App-29x29@3x.png │ │ │ │ ├── Icon-App-40x40@1x.png │ │ │ │ ├── Icon-App-40x40@2x.png │ │ │ │ ├── Icon-App-40x40@3x.png │ │ │ │ ├── Icon-App-60x60@2x.png │ │ │ │ ├── Icon-App-60x60@3x.png │ │ │ │ ├── Icon-App-76x76@1x.png │ │ │ │ ├── Icon-App-76x76@2x.png │ │ │ │ └── Icon-App-83.5x83.5@2x.png │ │ │ └── LaunchImage.imageset │ │ │ │ ├── Contents.json │ │ │ │ ├── LaunchImage.png │ │ │ │ ├── LaunchImage@2x.png │ │ │ │ ├── LaunchImage@3x.png │ │ │ │ └── README.md │ │ │ ├── Base.lproj │ │ │ ├── LaunchScreen.storyboard │ │ │ └── Main.storyboard │ │ │ ├── Info.plist │ │ │ ├── Runner-Bridging-Header.h │ │ │ └── RunnerDebug.entitlements │ ├── lib │ │ └── main.dart │ ├── pubspec.yaml │ └── res │ │ └── images │ │ ├── baseflow_logo_def_light-02.png │ │ ├── poweredByBaseflowLogoLight.png │ │ ├── poweredByBaseflowLogoLight@2x.png │ │ └── poweredByBaseflowLogoLight@3x.png ├── ios │ ├── .gitignore │ ├── Assets │ │ └── .gitkeep │ ├── Classes │ │ ├── PermissionHandlerEnums.h │ │ ├── PermissionHandlerPlugin.h │ │ ├── PermissionHandlerPlugin.m │ │ ├── PermissionManager.h │ │ ├── PermissionManager.m │ │ ├── strategies │ │ │ ├── AppTrackingTransparencyPermissionStrategy.h │ │ │ ├── AppTrackingTransparencyPermissionStrategy.m │ │ │ ├── AssistantPermissionStrategy.h │ │ │ ├── AssistantPermissionStrategy.m │ │ │ ├── AudioVideoPermissionStrategy.h │ │ │ ├── AudioVideoPermissionStrategy.m │ │ │ ├── BackgroundRefreshStrategy.h │ │ │ ├── BackgroundRefreshStrategy.m │ │ │ ├── BluetoothPermissionStrategy.h │ │ │ ├── BluetoothPermissionStrategy.m │ │ │ ├── ContactPermissionStrategy.h │ │ │ ├── ContactPermissionStrategy.m │ │ │ ├── CriticalAlertsPermissionStrategy.h │ │ │ ├── CriticalAlertsPermissionStrategy.m │ │ │ ├── EventPermissionStrategy.h │ │ │ ├── EventPermissionStrategy.m │ │ │ ├── LocationPermissionStrategy.h │ │ │ ├── LocationPermissionStrategy.m │ │ │ ├── MediaLibraryPermissionStrategy.h │ │ │ ├── MediaLibraryPermissionStrategy.m │ │ │ ├── NotificationPermissionStrategy.h │ │ │ ├── NotificationPermissionStrategy.m │ │ │ ├── PermissionStrategy.h │ │ │ ├── PhonePermissionStrategy.h │ │ │ ├── PhonePermissionStrategy.m │ │ │ ├── PhotoPermissionStrategy.h │ │ │ ├── PhotoPermissionStrategy.m │ │ │ ├── SensorPermissionStrategy.h │ │ │ ├── SensorPermissionStrategy.m │ │ │ ├── SpeechPermissionStrategy.h │ │ │ ├── SpeechPermissionStrategy.m │ │ │ ├── StoragePermissionStrategy.h │ │ │ ├── StoragePermissionStrategy.m │ │ │ ├── UnknownPermissionStrategy.h │ │ │ └── UnknownPermissionStrategy.m │ │ └── util │ │ │ ├── Codec.h │ │ │ └── Codec.m │ ├── Resources │ │ └── PrivacyInfo.xcprivacy │ └── permission_handler_apple.podspec └── pubspec.yaml ├── permission_handler_html ├── .metadata ├── CHANGELOG.md ├── LICENSE ├── README.md ├── example │ ├── .gitignore │ ├── .metadata │ ├── README.md │ ├── lib │ │ └── main.dart │ ├── pubspec.yaml │ └── web │ │ ├── favicon.png │ │ ├── icons │ │ ├── Icon-192.png │ │ ├── Icon-512.png │ │ ├── Icon-maskable-192.png │ │ └── Icon-maskable-512.png │ │ ├── index.html │ │ └── manifest.json ├── lib │ ├── permission_handler_html.dart │ └── web_delegate.dart ├── pubspec.yaml └── test │ └── tests_exist_elsewhere_test.dart ├── permission_handler_platform_interface ├── CHANGELOG.md ├── LICENSE ├── README.md ├── analysis_options.yaml ├── lib │ ├── permission_handler_platform_interface.dart │ └── src │ │ ├── method_channel │ │ ├── method_channel_permission_handler.dart │ │ └── utils │ │ │ └── codec.dart │ │ ├── permission_handler_platform_interface.dart │ │ ├── permission_status.dart │ │ ├── permissions.dart │ │ └── service_status.dart ├── pubspec.yaml └── test │ └── src │ ├── method_channel │ ├── method_channel_mock.dart │ ├── method_channel_permission_handler_test.dart │ └── utils │ │ └── coded_test.dart │ ├── permission_handler_platform_interface_test.dart │ ├── permission_status_test.dart │ ├── permissions_test.dart │ └── service_status_test.dart └── permission_handler_windows ├── AUTHORS ├── CHANGELOG.md ├── LICENSE ├── README.md ├── example ├── .gitignore ├── .metadata ├── README.md ├── lib │ └── main.dart ├── pubspec.yaml ├── res │ └── images │ │ ├── baseflow_logo_def_light-02.png │ │ ├── poweredByBaseflowLogoLight.png │ │ ├── poweredByBaseflowLogoLight@2x.png │ │ └── poweredByBaseflowLogoLight@3x.png └── windows │ ├── .gitignore │ ├── CMakeLists.txt │ ├── flutter │ ├── CMakeLists.txt │ ├── generated_plugin_registrant.cc │ ├── generated_plugin_registrant.h │ └── generated_plugins.cmake │ └── runner │ ├── CMakeLists.txt │ ├── Runner.rc │ ├── flutter_window.cpp │ ├── flutter_window.h │ ├── main.cpp │ ├── resource.h │ ├── resources │ └── app_icon.ico │ ├── runner.exe.manifest │ ├── utils.cpp │ ├── utils.h │ ├── win32_window.cpp │ └── win32_window.h ├── pubspec.yaml └── windows ├── .gitignore ├── CMakeLists.txt ├── include └── permission_handler_windows │ └── permission_handler_windows_plugin.h ├── permission_constants.h └── permission_handler_windows_plugin.cpp /.gitattributes: -------------------------------------------------------------------------------- 1 | # This file is understood by git 1.7.2+. 2 | 3 | # Windows specific files should always be crlf on checkout 4 | *.bat text eol=crlf 5 | *.cmd text eol=crlf 6 | *.ps1 text eol=crlf 7 | 8 | # Check out the following as ln always for osx/linux/cygwin 9 | *.sh text eol=lf 10 | 11 | # Opt in the following types to always normalize line endings 12 | # on checkin and always use native endings on checkout. 13 | *.config text 14 | *.cs text diff=csharp 15 | *.csproj text 16 | *.md text 17 | *.msbuild text 18 | *.nuspec text 19 | *.pp text 20 | *.ps1 text 21 | *.sln text 22 | *.tt text 23 | *.txt text 24 | *.xaml text 25 | *.xml text 26 | 27 | # Binary files 28 | *.bmp binary 29 | *.jpeg binary 30 | *.jpg binary 31 | *.nupkg binary 32 | *.png binary 33 | *.sdf binary 34 | 35 | *.java linguist-language=Dart 36 | *.kt linguist-language=Dart 37 | *.swift linguist-language=Dart 38 | *.m linguist-language=Dart 39 | *.h linguist-language=Dart 40 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | github: Baseflow 2 | custom: https://baseflow.com/contact 3 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/d-enhancement-proposal.yml: -------------------------------------------------------------------------------- 1 | name: Submit an enhancement proposal 2 | description: You have a proposal for code cleanup, a refactor, or other improvements. 3 | title: "[Enhancement proposal]: " 4 | labels: ["needs-triage"] 5 | body: 6 | - type: markdown 7 | attributes: 8 | value: | 9 | Thank you for taking the time to submit an enhancement proposal! 10 | Please take the time to fill out the information below so that we can better evaluate the need for the enhancement. 11 | - type: checkboxes 12 | attributes: 13 | label: Please check the following before submitting a new issue. 14 | options: 15 | - label: I have searched the [existing issues](https://github.com/baseflow/flutter-permission-handler/issues). 16 | required: true 17 | - label: I have carefully [read the documentation](https://github.com/baseflow/flutter-permission-handler/blob/main/permission_handler/README.md) and verified I have added the required platform specific configuration. 18 | required: true 19 | - type: checkboxes 20 | attributes: 21 | label: Please select affected platform(s) 22 | options: 23 | - label: Android 24 | - label: iOS 25 | - label: Windows 26 | - type: textarea 27 | attributes: 28 | label: Proposal 29 | description: | 30 | Please provide a clear and concise description of your proposed enhancement. 31 | 32 | Please attach something showcasing your idea: 33 | * code samples 34 | * images 35 | * videos 36 | validations: 37 | required: true 38 | - type: textarea 39 | attributes: 40 | label: Pitch 41 | description: | 42 | How will this refactor enhance the lives of contributors? 43 | We would greatly appreciate it if you could provide us with as many details as possible. 44 | Specifically, please describe the specific benefits, improvements, or advantages that contributors can expect to experience as a result of this refactor. 45 | Your comprehensive input will help us better understand the impact and value of implementing this change. 46 | validations: 47 | required: true 48 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/e-question.yml: -------------------------------------------------------------------------------- 1 | name: Ask for help 2 | description: You have a question about the permission handler plugin and are looking for help. 3 | title: "[Question]: " 4 | labels: ["needs-triage"] 5 | body: 6 | - type: markdown 7 | attributes: 8 | value: | 9 | We are happy to help you out! 10 | To help you effectively, we require some information. This will allow us to quickly understand your question. 11 | - type: checkboxes 12 | attributes: 13 | label: Please check the following before submitting a new issue. 14 | options: 15 | - label: I have searched the [existing issues](https://github.com/baseflow/flutter-permission-handler/issues). 16 | required: true 17 | - label: I have carefully [read the documentation](https://github.com/baseflow/flutter-permission-handler/blob/main/permission_handler/README.md). 18 | required: true 19 | - type: checkboxes 20 | attributes: 21 | label: Please select for which platform(s) you need help 22 | options: 23 | - label: Android 24 | - label: iOS 25 | - label: Windows 26 | - type: textarea 27 | attributes: 28 | label: Your question 29 | description: | 30 | Please describe your question as detailed as possible. 31 | 32 | Please attach something to help us understand your question: 33 | * code samples 34 | * images 35 | * videos 36 | validations: 37 | required: true 38 | - type: input 39 | id: version 40 | attributes: 41 | label: Version 42 | description: Please specify which version of the plugin are you currently using. 43 | placeholder: ex. 1.2.3 44 | validations: 45 | required: true 46 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | *Replace this paragraph with a short description of what issue this pull request (PR) solves and provide a description of the change. Consider including before/after screenshots.* 2 | 3 | *List at least one fixed issue.* 4 | 5 | ## Pre-launch Checklist 6 | 7 | - [ ] I made sure the project builds. 8 | - [ ] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. 9 | - [ ] I updated `pubspec.yaml` with an appropriate new version according to the [pub versioning philosophy], or this PR is does not need version changes. 10 | - [ ] I updated `CHANGELOG.md` to add a description of the change. 11 | - [ ] I updated/added relevant documentation (doc comments with `///`). 12 | - [ ] I rebased onto `main`. 13 | - [ ] I added new tests to check the change I am making, or this PR does not need tests. 14 | - [ ] I made sure all existing and new tests are passing. 15 | - [ ] I ran `dart format .` and committed any changes. 16 | - [ ] I ran `flutter analyze` and fixed any errors. 17 | 18 | 19 | [Contributor Guide]: https://github.com/Baseflow/flutter-permission-handler/blob/master/CONTRIBUTING.md 20 | [pub versioning philosophy]: https://dart.dev/tools/pub/versioning 21 | -------------------------------------------------------------------------------- /.github/workflows/permission_handler_android.yaml: -------------------------------------------------------------------------------- 1 | # This is a basic workflow to help you get started with Actions 2 | 3 | name: permission_handler_android 4 | 5 | # Controls when the action will run. Triggers the workflow on push or pull request 6 | # events but only for the main branch 7 | on: 8 | push: 9 | branches: [ main ] 10 | paths: 11 | - 'permission_handler_android/**' 12 | - '.github/workflows/permission_handler_android.yaml' 13 | pull_request: 14 | branches: [ main ] 15 | paths: 16 | - 'permission_handler_android/**' 17 | - '.github/workflows/permission_handler_android.yaml' 18 | 19 | # A workflow run is made up of one or more jobs that can run sequentially or in parallel 20 | jobs: 21 | build: 22 | name: Android platform package 23 | 24 | # The type of runner that the job will run on 25 | runs-on: ubuntu-latest 26 | 27 | env: 28 | source-directory: ./permission_handler_android 29 | example-directory: ./permission_handler_android/example 30 | 31 | # Steps represent a sequence of tasks that will be executed as part of the job 32 | steps: 33 | # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it 34 | - uses: actions/checkout@v3 35 | 36 | # Make sure JAVA version 17 is installed on build agent. 37 | - uses: actions/setup-java@v3 38 | with: 39 | distribution: 'temurin' # See 'Supported distributions' for available options 40 | java-version: '17' 41 | 42 | # Make sure the stable version of Flutter is available 43 | - uses: subosito/flutter-action@v2 44 | with: 45 | channel: 'stable' 46 | 47 | # Download all Flutter packages 48 | - name: Download dependencies 49 | run: flutter pub get 50 | working-directory: ${{env.source-directory}} 51 | 52 | # Run Dart Format to ensure formatting is valid 53 | - name: Run Dart Format 54 | run: dart format --set-exit-if-changed . 55 | working-directory: ${{env.source-directory}} 56 | 57 | # Run Flutter Analyzer 58 | - name: Run Flutter Analyzer 59 | run: flutter analyze 60 | working-directory: ${{env.source-directory}} 61 | 62 | # Build Android version of the example App 63 | - name: Run Android build 64 | run: flutter build apk --release 65 | working-directory: ${{env.example-directory}} 66 | -------------------------------------------------------------------------------- /.github/workflows/permission_handler_apple.yaml: -------------------------------------------------------------------------------- 1 | # This is a basic workflow to help you get started with Actions 2 | 3 | name: permission_handler_apple 4 | 5 | # Controls when the action will run. Triggers the workflow on push or pull request 6 | # events but only for the main branch 7 | on: 8 | push: 9 | branches: [main] 10 | paths: 11 | - "permission_handler_apple/**" 12 | - ".github/workflows/permission_handler_apple.yaml" 13 | pull_request: 14 | branches: [main] 15 | paths: 16 | - "permission_handler_apple/**" 17 | - ".github/workflows/permission_handler_apple.yaml" 18 | 19 | # A workflow run is made up of one or more jobs that can run sequentially or in parallel 20 | jobs: 21 | build: 22 | name: Apple platform package 23 | 24 | # The type of runner that the job will run on 25 | # 26 | # TODO(mvanbeusekom): Manually set to macOS 15 to support Xcode 16 and iOS 18 SDKs. 27 | # Currently `macos-latest` is based on macOS 14 and doesn't support iOS 18 SDK. This 28 | # should be moved back to `macos-latest` when GitHub Actions images are updated. 29 | runs-on: macos-15 30 | 31 | env: 32 | source-directory: ./permission_handler_apple 33 | example-directory: ./permission_handler_apple/example 34 | 35 | # Steps represent a sequence of tasks that will be executed as part of the job 36 | steps: 37 | # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it 38 | - uses: actions/checkout@v3 39 | 40 | # Make sure the stable version of Flutter is available 41 | - uses: subosito/flutter-action@v2 42 | with: 43 | channel: "stable" 44 | 45 | # Download all Flutter packages 46 | - name: Download dependencies 47 | run: flutter pub get 48 | working-directory: ${{env.source-directory}} 49 | 50 | # Run Dart Format to ensure formatting is valid 51 | - name: Run Dart Format 52 | run: dart format --set-exit-if-changed . 53 | working-directory: ${{env.source-directory}} 54 | 55 | # Run Flutter Analyzer 56 | - name: Run Flutter Analyzer 57 | run: flutter analyze 58 | working-directory: ${{env.source-directory}} 59 | 60 | # Build iOS version of the example App 61 | - name: Run iOS build 62 | run: flutter build ios --no-codesign --release 63 | working-directory: ${{env.example-directory}} 64 | -------------------------------------------------------------------------------- /.github/workflows/permission_handler_platform_interface.yaml: -------------------------------------------------------------------------------- 1 | # This is a basic workflow to help you get started with Actions 2 | 3 | name: permission_handler_platform_interface 4 | 5 | # Controls when the action will run. Triggers the workflow on push or pull request 6 | # events but only for the main branch 7 | on: 8 | push: 9 | branches: [ main ] 10 | paths: 11 | - 'permission_handler_platform_interface/**' 12 | - '.github/workflows/permission_handler_platform_interface.yaml' 13 | pull_request: 14 | branches: [ main ] 15 | paths: 16 | - 'permission_handler_platform_interface/**' 17 | - '.github/workflows/permission_handler_platform_interface.yaml' 18 | 19 | # A workflow run is made up of one or more jobs that can run sequentially or in parallel 20 | jobs: 21 | build: 22 | name: Platform interface package 23 | 24 | # The type of runner that the job will run on 25 | runs-on: ubuntu-latest 26 | 27 | env: 28 | source-directory: ./permission_handler_platform_interface 29 | 30 | # Steps represent a sequence of tasks that will be executed as part of the job 31 | steps: 32 | # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it 33 | - uses: actions/checkout@v3 34 | 35 | # Make sure the stable version of Flutter is available 36 | - uses: subosito/flutter-action@v2 37 | with: 38 | channel: 'stable' 39 | 40 | # Download all Flutter packages 41 | - name: Download dependencies 42 | run: flutter pub get 43 | working-directory: ${{env.source-directory}} 44 | 45 | # Run Dart Format to ensure formatting is valid 46 | - name: Run Dart Format 47 | run: dart format --set-exit-if-changed . 48 | working-directory: ${{env.source-directory}} 49 | 50 | # Run Flutter Analyzer 51 | - name: Run Flutter Analyzer 52 | run: flutter analyze 53 | working-directory: ${{env.source-directory}} 54 | 55 | # Run all unit-tests with code coverage 56 | - name: Run unit tests 57 | run: flutter test --coverage 58 | working-directory: ${{env.source-directory}} 59 | 60 | # Upload code coverage information 61 | - uses: codecov/codecov-action@v1 62 | with: 63 | file: ${{env.source-directory}}/coverage/lcov.info # optional 64 | name: permission_handler_platform_interface (Platform Interface Package) # optional 65 | fail_ci_if_error: true -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.lock 4 | *.log 5 | *.pyc 6 | *.swp 7 | .DS_Store 8 | .atom/ 9 | .buildlog/ 10 | .history 11 | .project 12 | .svn/ 13 | bin/ 14 | migrate_working_dir/ 15 | 16 | # IntelliJ related 17 | *.iml 18 | *.ipr 19 | *.iws 20 | .idea/ 21 | 22 | # Android Studio related 23 | android/.classpath 24 | android/.settings/ 25 | 26 | # Visual Studio Code related 27 | .vscode/ 28 | 29 | # Flutter repo-specific 30 | /bin/cache/ 31 | /bin/mingit/ 32 | /dev/benchmarks/mega_gallery/ 33 | /dev/bots/.recipe_deps 34 | /dev/bots/android_tools/ 35 | /dev/docs/doc/ 36 | /dev/docs/lib/ 37 | /dev/docs/pubspec.yaml 38 | /packages/flutter/coverage/ 39 | version 40 | 41 | # Flutter/Dart/Pub related 42 | /pubspec.lock 43 | **/doc/api/ 44 | .dart_tool/ 45 | .flutter-plugins 46 | .flutter-plugins-dependencies 47 | .packages 48 | .pub-cache/ 49 | .pub/ 50 | build/ 51 | flutter_*.png 52 | linked_*.ds 53 | unlinked.ds 54 | unlinked_spec.ds 55 | flutter_export_environment.sh 56 | 57 | # Android related 58 | **/android/**/gradle-wrapper.jar 59 | **/android/.gradle 60 | **/android/captures/ 61 | **/android/gradlew 62 | **/android/gradlew.bat 63 | **/android/local.properties 64 | **/android/**/GeneratedPluginRegistrant.java 65 | 66 | # iOS/XCode related 67 | **/ios/**/*.mode1v3 68 | **/ios/**/*.mode2v3 69 | **/ios/**/*.moved-aside 70 | **/ios/**/*.pbxuser 71 | **/ios/**/*.perspectivev3 72 | **/ios/**/*sync/ 73 | **/ios/**/.sconsign.dblite 74 | **/ios/**/.tags* 75 | **/ios/**/.vagrant/ 76 | **/ios/**/DerivedData/ 77 | **/ios/**/Icon? 78 | **/ios/**/Pods/ 79 | **/ios/**/.symlinks/ 80 | **/ios/**/profile 81 | **/ios/**/xcuserdata 82 | **/ios/.generated/ 83 | **/ios/Flutter/App.framework 84 | **/ios/Flutter/Flutter.framework 85 | **/ios/Flutter/Generated.xcconfig 86 | **/ios/Flutter/app.flx 87 | **/ios/Flutter/app.zip 88 | **/ios/Flutter/flutter_assets/ 89 | **/ios/ServiceDefinitions.json 90 | **/ios/Runner/GeneratedPluginRegistrant.* 91 | 92 | # Exceptions to above rules. 93 | !**/ios/**/default.mode1v3 94 | !**/ios/**/default.mode2v3 95 | !**/ios/**/default.pbxuser 96 | !**/ios/**/default.perspectivev3 97 | !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages 98 | -------------------------------------------------------------------------------- /.metadata: -------------------------------------------------------------------------------- 1 | # This file tracks properties of this Flutter project. 2 | # Used by Flutter tool to assess capabilities and perform upgrades etc. 3 | # 4 | # This file should be version controlled and should not be manually edited. 5 | 6 | version: 7 | revision: 06b979c4d5e1b499745422269f01a00341257058 8 | channel: master 9 | 10 | project_type: plugin 11 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Baseflow 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Flutter permission_handler plugin 2 | 3 | The Flutter permission_handler plugin is build following the federated plugin architecture. A detailed explanation of the federated plugin concept can be found in the [Flutter documentation](https://flutter.dev/docs/development/packages-and-plugins/developing-packages#federated-plugins). This means the permission_handler plugin is separated into the following packages: 4 | 5 | 1. [`permission_handler`][1]: the app facing package. This is the package users depend on to use the plugin in their project. For details on how to use the `permission_handler` plugin you can refer to its [README.md][2] file. At this moment the Android and iOS platform implementations are also part of this package. Additional platform support will be added in their own individual "platform package(s)". 6 | 2. [`permission_handler_platform_interface`][3]: this packages declares the interface which all platform packages must implement to support the app-facing package. Instructions on how to implement a platform packages can be found in the [README.md][4] of the `permission_handler_platform_interface` package. 7 | 8 | [1]: https://pub.dev/packages/permission_handler 9 | [2]: ./permission_handler/README.md 10 | [3]: https://pub.dev/packages/permission_handler_platform_interface 11 | [4]: ./permission_handler_platform_interface/README.md 12 | -------------------------------------------------------------------------------- /analysis_options.yaml: -------------------------------------------------------------------------------- 1 | include: package:flutter_lints/flutter.yaml 2 | 3 | linter: 4 | rules: 5 | - public_member_api_docs 6 | -------------------------------------------------------------------------------- /permission_handler/AUTHORS: -------------------------------------------------------------------------------- 1 | 2 | # Below is a list of people and organizations that have contributed 3 | # to the Flutter project. Names should be added to the list like so: 4 | # 5 | # Name/Organization 6 | 7 | Baseflow 8 | Maurits van Beusekom -------------------------------------------------------------------------------- /permission_handler/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Baseflow 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /permission_handler/example/.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .history 10 | .svn/ 11 | 12 | # IntelliJ related 13 | *.iml 14 | *.ipr 15 | *.iws 16 | .idea/ 17 | 18 | # Visual Studio Code related 19 | .vscode/ 20 | 21 | # Flutter/Dart/Pub related 22 | **/doc/api/ 23 | .dart_tool/ 24 | .flutter-plugins 25 | .flutter-plugins-dependencies 26 | .packages 27 | .pub-cache/ 28 | .pub/ 29 | build/ 30 | 31 | # Android related 32 | **/android/**/gradle-wrapper.jar 33 | **/android/.gradle 34 | **/android/captures/ 35 | **/android/gradlew 36 | **/android/gradlew.bat 37 | **/android/local.properties 38 | **/android/**/GeneratedPluginRegistrant.java 39 | 40 | # iOS/XCode related 41 | **/ios/**/*.mode1v3 42 | **/ios/**/*.mode2v3 43 | **/ios/**/*.moved-aside 44 | **/ios/**/*.pbxuser 45 | **/ios/**/*.perspectivev3 46 | **/ios/**/*sync/ 47 | **/ios/**/.sconsign.dblite 48 | **/ios/**/.tags* 49 | **/ios/**/.vagrant/ 50 | **/ios/**/DerivedData/ 51 | **/ios/**/Icon? 52 | **/ios/**/Pods/ 53 | **/ios/**/.symlinks/ 54 | **/ios/**/profile 55 | **/ios/**/xcuserdata 56 | **/ios/.generated/ 57 | **/ios/Flutter/App.framework 58 | **/ios/Flutter/Flutter.framework 59 | **/ios/Flutter/Generated.xcconfig 60 | **/ios/Flutter/app.flx 61 | **/ios/Flutter/app.zip 62 | **/ios/Flutter/flutter_assets/ 63 | **/ios/ServiceDefinitions.json 64 | **/ios/Runner/GeneratedPluginRegistrant.* 65 | 66 | # Exceptions to above rules. 67 | !**/ios/**/default.mode1v3 68 | !**/ios/**/default.mode2v3 69 | !**/ios/**/default.pbxuser 70 | !**/ios/**/default.perspectivev3 71 | !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages 72 | -------------------------------------------------------------------------------- /permission_handler/example/.metadata: -------------------------------------------------------------------------------- 1 | # This file tracks properties of this Flutter project. 2 | # Used by Flutter tool to assess capabilities and perform upgrades etc. 3 | # 4 | # This file should be version controlled and should not be manually edited. 5 | 6 | version: 7 | revision: 06b979c4d5e1b499745422269f01a00341257058 8 | channel: master 9 | 10 | project_type: app 11 | -------------------------------------------------------------------------------- /permission_handler/example/README.md: -------------------------------------------------------------------------------- 1 | # permission_handler_example 2 | 3 | Demonstrates how to use the permission_handler plugin. 4 | 5 | ## Getting Started 6 | 7 | This project is a starting point for a Flutter application. 8 | 9 | A few resources to get you started if this is your first Flutter project: 10 | 11 | - [Lab: Write your first Flutter app](https://flutter.io/docs/get-started/codelab) 12 | - [Cookbook: Useful Flutter samples](https://flutter.io/docs/cookbook) 13 | 14 | For help getting started with Flutter, view our 15 | [online documentation](https://flutter.io/docs), which offers tutorials, 16 | samples, guidance on mobile development, and a full API reference. 17 | -------------------------------------------------------------------------------- /permission_handler/example/android/.gitignore: -------------------------------------------------------------------------------- 1 | gradle-wrapper.jar 2 | /.gradle 3 | /captures/ 4 | /gradlew 5 | /gradlew.bat 6 | /local.properties 7 | GeneratedPluginRegistrant.java 8 | .cxx 9 | 10 | # Remember to never publicly share your keystore. 11 | # See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app 12 | key.properties 13 | -------------------------------------------------------------------------------- /permission_handler/example/android/app/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id "com.android.application" 3 | id "dev.flutter.flutter-gradle-plugin" 4 | } 5 | 6 | def localProperties = new Properties() 7 | def localPropertiesFile = rootProject.file('local.properties') 8 | if (localPropertiesFile.exists()) { 9 | localPropertiesFile.withReader('UTF-8') { reader -> 10 | localProperties.load(reader) 11 | } 12 | } 13 | 14 | def flutterVersionCode = localProperties.getProperty('flutter.versionCode') 15 | if (flutterVersionCode == null) { 16 | flutterVersionCode = '1' 17 | } 18 | 19 | def flutterVersionName = localProperties.getProperty('flutter.versionName') 20 | if (flutterVersionName == null) { 21 | flutterVersionName = '1.0' 22 | } 23 | 24 | android { 25 | if (project.android.hasProperty("namespace")) { 26 | namespace 'com.baseflow.permissionhandlerexample' 27 | } 28 | compileSdkVersion 35 29 | 30 | compileOptions { 31 | sourceCompatibility JavaVersion.VERSION_1_8 32 | targetCompatibility JavaVersion.VERSION_1_8 33 | } 34 | 35 | defaultConfig { 36 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). 37 | applicationId "com.baseflow.permissionhandler.example" 38 | minSdkVersion flutter.minSdkVersion 39 | targetSdkVersion 34 40 | versionCode flutterVersionCode.toInteger() 41 | versionName flutterVersionName 42 | } 43 | 44 | buildTypes { 45 | release { 46 | // TODO: Add your own signing config for the release build. 47 | // Signing with the debug keys for now, so `flutter run --release` works. 48 | signingConfig signingConfigs.debug 49 | } 50 | } 51 | } 52 | 53 | flutter { 54 | source '../..' 55 | } 56 | -------------------------------------------------------------------------------- /permission_handler/example/android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /permission_handler/example/android/app/src/main/kotlin/com/example/example/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.example.example 2 | 3 | import io.flutter.embedding.android.FlutterActivity 4 | 5 | class MainActivity: FlutterActivity() { 6 | } 7 | -------------------------------------------------------------------------------- /permission_handler/example/android/app/src/main/res/drawable-v21/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /permission_handler/example/android/app/src/main/res/drawable/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /permission_handler/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Baseflow/flutter-permission-handler/c438a1f29cdbe9b46b118ed58dc6e88b43524f74/permission_handler/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /permission_handler/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Baseflow/flutter-permission-handler/c438a1f29cdbe9b46b118ed58dc6e88b43524f74/permission_handler/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /permission_handler/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Baseflow/flutter-permission-handler/c438a1f29cdbe9b46b118ed58dc6e88b43524f74/permission_handler/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /permission_handler/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Baseflow/flutter-permission-handler/c438a1f29cdbe9b46b118ed58dc6e88b43524f74/permission_handler/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /permission_handler/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Baseflow/flutter-permission-handler/c438a1f29cdbe9b46b118ed58dc6e88b43524f74/permission_handler/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /permission_handler/example/android/app/src/main/res/values-night/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /permission_handler/example/android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | -------------------------------------------------------------------------------- /permission_handler/example/android/app/src/profile/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /permission_handler/example/android/build.gradle: -------------------------------------------------------------------------------- 1 | allprojects { 2 | repositories { 3 | google() 4 | mavenCentral() 5 | } 6 | } 7 | 8 | rootProject.buildDir = '../build' 9 | subprojects { 10 | project.buildDir = "${rootProject.buildDir}/${project.name}" 11 | } 12 | subprojects { 13 | project.evaluationDependsOn(':app') 14 | } 15 | 16 | tasks.register("clean", Delete) { 17 | delete rootProject.buildDir 18 | } -------------------------------------------------------------------------------- /permission_handler/example/android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536M 2 | android.useAndroidX=true 3 | android.enableJetifier=true 4 | -------------------------------------------------------------------------------- /permission_handler/example/android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Fri Jun 23 08:50:38 CEST 2017 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-all.zip 7 | -------------------------------------------------------------------------------- /permission_handler/example/android/settings.gradle: -------------------------------------------------------------------------------- 1 | pluginManagement { 2 | def flutterSdkPath = { 3 | def properties = new Properties() 4 | file("local.properties").withInputStream { properties.load(it) } 5 | def flutterSdkPath = properties.getProperty("flutter.sdk") 6 | assert flutterSdkPath != null, "flutter.sdk not set in local.properties" 7 | return flutterSdkPath 8 | }() 9 | 10 | includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") 11 | 12 | repositories { 13 | google() 14 | mavenCentral() 15 | gradlePluginPortal() 16 | } 17 | } 18 | 19 | plugins { 20 | id "dev.flutter.flutter-plugin-loader" version "1.0.0" 21 | id "com.android.application" version "8.7.0" apply false 22 | } 23 | 24 | include ":app" -------------------------------------------------------------------------------- /permission_handler/example/ios/.gitignore: -------------------------------------------------------------------------------- 1 | *.mode1v3 2 | *.mode2v3 3 | *.moved-aside 4 | *.pbxuser 5 | *.perspectivev3 6 | **/*sync/ 7 | .sconsign.dblite 8 | .tags* 9 | **/.vagrant/ 10 | **/DerivedData/ 11 | Icon? 12 | **/Pods/ 13 | **/.symlinks/ 14 | profile 15 | xcuserdata 16 | **/.generated/ 17 | Flutter/App.framework 18 | Flutter/Flutter.framework 19 | Flutter/Flutter.podspec 20 | Flutter/Generated.xcconfig 21 | Flutter/app.flx 22 | Flutter/app.zip 23 | Flutter/flutter_assets/ 24 | Flutter/flutter_export_environment.sh 25 | ServiceDefinitions.json 26 | Runner/GeneratedPluginRegistrant.* 27 | 28 | # Exceptions to above rules. 29 | !default.mode1v3 30 | !default.mode2v3 31 | !default.pbxuser 32 | !default.perspectivev3 33 | -------------------------------------------------------------------------------- /permission_handler/example/ios/Flutter/AppFrameworkInfo.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | App 9 | CFBundleIdentifier 10 | io.flutter.flutter.app 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | App 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1.0 23 | MinimumOSVersion 24 | 12.0 25 | 26 | 27 | -------------------------------------------------------------------------------- /permission_handler/example/ios/Flutter/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" 2 | #include "Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /permission_handler/example/ios/Flutter/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" 2 | #include "Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /permission_handler/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /permission_handler/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /permission_handler/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /permission_handler/example/ios/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /permission_handler/example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /permission_handler/example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /permission_handler/example/ios/Runner/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import UIKit 2 | import Flutter 3 | 4 | @main 5 | @objc class AppDelegate: FlutterAppDelegate { 6 | override func application( 7 | _ application: UIApplication, 8 | didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? 9 | ) -> Bool { 10 | GeneratedPluginRegistrant.register(with: self) 11 | return super.application(application, didFinishLaunchingWithOptions: launchOptions) 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /permission_handler/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Baseflow/flutter-permission-handler/c438a1f29cdbe9b46b118ed58dc6e88b43524f74/permission_handler/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png -------------------------------------------------------------------------------- /permission_handler/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Baseflow/flutter-permission-handler/c438a1f29cdbe9b46b118ed58dc6e88b43524f74/permission_handler/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png -------------------------------------------------------------------------------- /permission_handler/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Baseflow/flutter-permission-handler/c438a1f29cdbe9b46b118ed58dc6e88b43524f74/permission_handler/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png -------------------------------------------------------------------------------- /permission_handler/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Baseflow/flutter-permission-handler/c438a1f29cdbe9b46b118ed58dc6e88b43524f74/permission_handler/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png -------------------------------------------------------------------------------- /permission_handler/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Baseflow/flutter-permission-handler/c438a1f29cdbe9b46b118ed58dc6e88b43524f74/permission_handler/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png -------------------------------------------------------------------------------- /permission_handler/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Baseflow/flutter-permission-handler/c438a1f29cdbe9b46b118ed58dc6e88b43524f74/permission_handler/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png -------------------------------------------------------------------------------- /permission_handler/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Baseflow/flutter-permission-handler/c438a1f29cdbe9b46b118ed58dc6e88b43524f74/permission_handler/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png -------------------------------------------------------------------------------- /permission_handler/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Baseflow/flutter-permission-handler/c438a1f29cdbe9b46b118ed58dc6e88b43524f74/permission_handler/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png -------------------------------------------------------------------------------- /permission_handler/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Baseflow/flutter-permission-handler/c438a1f29cdbe9b46b118ed58dc6e88b43524f74/permission_handler/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png -------------------------------------------------------------------------------- /permission_handler/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Baseflow/flutter-permission-handler/c438a1f29cdbe9b46b118ed58dc6e88b43524f74/permission_handler/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png -------------------------------------------------------------------------------- /permission_handler/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Baseflow/flutter-permission-handler/c438a1f29cdbe9b46b118ed58dc6e88b43524f74/permission_handler/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png -------------------------------------------------------------------------------- /permission_handler/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Baseflow/flutter-permission-handler/c438a1f29cdbe9b46b118ed58dc6e88b43524f74/permission_handler/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png -------------------------------------------------------------------------------- /permission_handler/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Baseflow/flutter-permission-handler/c438a1f29cdbe9b46b118ed58dc6e88b43524f74/permission_handler/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png -------------------------------------------------------------------------------- /permission_handler/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Baseflow/flutter-permission-handler/c438a1f29cdbe9b46b118ed58dc6e88b43524f74/permission_handler/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png -------------------------------------------------------------------------------- /permission_handler/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Baseflow/flutter-permission-handler/c438a1f29cdbe9b46b118ed58dc6e88b43524f74/permission_handler/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png -------------------------------------------------------------------------------- /permission_handler/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "LaunchImage.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "LaunchImage@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "LaunchImage@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /permission_handler/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Baseflow/flutter-permission-handler/c438a1f29cdbe9b46b118ed58dc6e88b43524f74/permission_handler/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /permission_handler/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Baseflow/flutter-permission-handler/c438a1f29cdbe9b46b118ed58dc6e88b43524f74/permission_handler/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /permission_handler/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Baseflow/flutter-permission-handler/c438a1f29cdbe9b46b118ed58dc6e88b43524f74/permission_handler/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png -------------------------------------------------------------------------------- /permission_handler/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md: -------------------------------------------------------------------------------- 1 | # Launch Screen Assets 2 | 3 | You can customize the launch screen with your own desired assets by replacing the image files in this directory. 4 | 5 | You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images. -------------------------------------------------------------------------------- /permission_handler/example/ios/Runner/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /permission_handler/example/ios/Runner/Runner-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | #import "GeneratedPluginRegistrant.h" 2 | -------------------------------------------------------------------------------- /permission_handler/example/ios/Runner/RunnerDebug.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.developer.siri 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /permission_handler/example/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: permission_handler_example 2 | description: Demonstrates how to use the permission_handler plugin. 3 | 4 | environment: 5 | sdk: ^3.7.0 6 | 7 | dependencies: 8 | baseflow_plugin_template: ^2.1.1 9 | flutter: 10 | sdk: flutter 11 | permission_handler: 12 | # When depending on this package from a real application you should use: 13 | # permission_handler: ^x.y.z 14 | # See https://dart.dev/tools/pub/dependencies#version-constraints 15 | # The example app is bundled with the plugin so we use a path dependency on 16 | # the parent directory to use the current plugin's version. 17 | path: ../ 18 | 19 | dev_dependencies: 20 | flutter_test: 21 | sdk: flutter 22 | url_launcher: ^6.3.1 23 | 24 | flutter: 25 | uses-material-design: true 26 | 27 | assets: 28 | - res/images/baseflow_logo_def_light-02.png 29 | - res/images/poweredByBaseflowLogoLight@3x.png 30 | -------------------------------------------------------------------------------- /permission_handler/example/res/images/baseflow_logo_def_light-02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Baseflow/flutter-permission-handler/c438a1f29cdbe9b46b118ed58dc6e88b43524f74/permission_handler/example/res/images/baseflow_logo_def_light-02.png -------------------------------------------------------------------------------- /permission_handler/example/res/images/poweredByBaseflowLogoLight.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Baseflow/flutter-permission-handler/c438a1f29cdbe9b46b118ed58dc6e88b43524f74/permission_handler/example/res/images/poweredByBaseflowLogoLight.png -------------------------------------------------------------------------------- /permission_handler/example/res/images/poweredByBaseflowLogoLight@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Baseflow/flutter-permission-handler/c438a1f29cdbe9b46b118ed58dc6e88b43524f74/permission_handler/example/res/images/poweredByBaseflowLogoLight@2x.png -------------------------------------------------------------------------------- /permission_handler/example/res/images/poweredByBaseflowLogoLight@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Baseflow/flutter-permission-handler/c438a1f29cdbe9b46b118ed58dc6e88b43524f74/permission_handler/example/res/images/poweredByBaseflowLogoLight@3x.png -------------------------------------------------------------------------------- /permission_handler/example/windows/.gitignore: -------------------------------------------------------------------------------- 1 | flutter/ephemeral/ 2 | 3 | # Visual Studio user-specific files. 4 | *.suo 5 | *.user 6 | *.userosscache 7 | *.sln.docstates 8 | 9 | # Visual Studio build-related files. 10 | x64/ 11 | x86/ 12 | 13 | # Visual Studio cache files 14 | # files ending in .cache can be ignored 15 | *.[Cc]ache 16 | # but keep track of directories ending in .cache 17 | !*.[Cc]ache/ 18 | -------------------------------------------------------------------------------- /permission_handler/example/windows/flutter/generated_plugin_registrant.cc: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #include "generated_plugin_registrant.h" 8 | 9 | #include 10 | #include 11 | 12 | void RegisterPlugins(flutter::PluginRegistry* registry) { 13 | PermissionHandlerWindowsPluginRegisterWithRegistrar( 14 | registry->GetRegistrarForPlugin("PermissionHandlerWindowsPlugin")); 15 | UrlLauncherWindowsRegisterWithRegistrar( 16 | registry->GetRegistrarForPlugin("UrlLauncherWindows")); 17 | } 18 | -------------------------------------------------------------------------------- /permission_handler/example/windows/flutter/generated_plugin_registrant.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #ifndef GENERATED_PLUGIN_REGISTRANT_ 8 | #define GENERATED_PLUGIN_REGISTRANT_ 9 | 10 | #include 11 | 12 | // Registers Flutter plugins. 13 | void RegisterPlugins(flutter::PluginRegistry* registry); 14 | 15 | #endif // GENERATED_PLUGIN_REGISTRANT_ 16 | -------------------------------------------------------------------------------- /permission_handler/example/windows/flutter/generated_plugins.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Generated file, do not edit. 3 | # 4 | 5 | list(APPEND FLUTTER_PLUGIN_LIST 6 | permission_handler_windows 7 | url_launcher_windows 8 | ) 9 | 10 | list(APPEND FLUTTER_FFI_PLUGIN_LIST 11 | ) 12 | 13 | set(PLUGIN_BUNDLED_LIBRARIES) 14 | 15 | foreach(plugin ${FLUTTER_PLUGIN_LIST}) 16 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/windows plugins/${plugin}) 17 | target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) 18 | list(APPEND PLUGIN_BUNDLED_LIBRARIES $) 19 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) 20 | endforeach(plugin) 21 | 22 | foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) 23 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/windows plugins/${ffi_plugin}) 24 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) 25 | endforeach(ffi_plugin) 26 | -------------------------------------------------------------------------------- /permission_handler/example/windows/runner/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.14) 2 | project(runner LANGUAGES CXX) 3 | 4 | add_executable(${BINARY_NAME} WIN32 5 | "flutter_window.cpp" 6 | "main.cpp" 7 | "utils.cpp" 8 | "win32_window.cpp" 9 | "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc" 10 | "Runner.rc" 11 | "runner.exe.manifest" 12 | ) 13 | apply_standard_settings(${BINARY_NAME}) 14 | target_compile_definitions(${BINARY_NAME} PRIVATE "NOMINMAX") 15 | target_link_libraries(${BINARY_NAME} PRIVATE flutter flutter_wrapper_app) 16 | target_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}") 17 | add_dependencies(${BINARY_NAME} flutter_assemble) 18 | -------------------------------------------------------------------------------- /permission_handler/example/windows/runner/flutter_window.cpp: -------------------------------------------------------------------------------- 1 | #include "flutter_window.h" 2 | 3 | #include 4 | 5 | #include "flutter/generated_plugin_registrant.h" 6 | 7 | FlutterWindow::FlutterWindow(const flutter::DartProject& project) 8 | : project_(project) {} 9 | 10 | FlutterWindow::~FlutterWindow() {} 11 | 12 | bool FlutterWindow::OnCreate() { 13 | if (!Win32Window::OnCreate()) { 14 | return false; 15 | } 16 | 17 | RECT frame = GetClientArea(); 18 | 19 | // The size here must match the window dimensions to avoid unnecessary surface 20 | // creation / destruction in the startup path. 21 | flutter_controller_ = std::make_unique( 22 | frame.right - frame.left, frame.bottom - frame.top, project_); 23 | // Ensure that basic setup of the controller was successful. 24 | if (!flutter_controller_->engine() || !flutter_controller_->view()) { 25 | return false; 26 | } 27 | RegisterPlugins(flutter_controller_->engine()); 28 | SetChildContent(flutter_controller_->view()->GetNativeWindow()); 29 | return true; 30 | } 31 | 32 | void FlutterWindow::OnDestroy() { 33 | if (flutter_controller_) { 34 | flutter_controller_ = nullptr; 35 | } 36 | 37 | Win32Window::OnDestroy(); 38 | } 39 | 40 | LRESULT 41 | FlutterWindow::MessageHandler(HWND hwnd, UINT const message, 42 | WPARAM const wparam, 43 | LPARAM const lparam) noexcept { 44 | // Give Flutter, including plugins, an opportunity to handle window messages. 45 | if (flutter_controller_) { 46 | std::optional result = 47 | flutter_controller_->HandleTopLevelWindowProc(hwnd, message, wparam, 48 | lparam); 49 | if (result) { 50 | return *result; 51 | } 52 | } 53 | 54 | switch (message) { 55 | case WM_FONTCHANGE: 56 | flutter_controller_->engine()->ReloadSystemFonts(); 57 | break; 58 | } 59 | 60 | return Win32Window::MessageHandler(hwnd, message, wparam, lparam); 61 | } 62 | -------------------------------------------------------------------------------- /permission_handler/example/windows/runner/flutter_window.h: -------------------------------------------------------------------------------- 1 | #ifndef RUNNER_FLUTTER_WINDOW_H_ 2 | #define RUNNER_FLUTTER_WINDOW_H_ 3 | 4 | #include 5 | #include 6 | 7 | #include 8 | 9 | #include "win32_window.h" 10 | 11 | // A window that does nothing but host a Flutter view. 12 | class FlutterWindow : public Win32Window { 13 | public: 14 | // Creates a new FlutterWindow hosting a Flutter view running |project|. 15 | explicit FlutterWindow(const flutter::DartProject& project); 16 | virtual ~FlutterWindow(); 17 | 18 | protected: 19 | // Win32Window: 20 | bool OnCreate() override; 21 | void OnDestroy() override; 22 | LRESULT MessageHandler(HWND window, UINT const message, WPARAM const wparam, 23 | LPARAM const lparam) noexcept override; 24 | 25 | private: 26 | // The project to run. 27 | flutter::DartProject project_; 28 | 29 | // The Flutter instance hosted by this window. 30 | std::unique_ptr flutter_controller_; 31 | }; 32 | 33 | #endif // RUNNER_FLUTTER_WINDOW_H_ 34 | -------------------------------------------------------------------------------- /permission_handler/example/windows/runner/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #include "flutter_window.h" 6 | #include "utils.h" 7 | 8 | int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev, 9 | _In_ wchar_t *command_line, _In_ int show_command) { 10 | // Attach to console when present (e.g., 'flutter run') or create a 11 | // new console when running with a debugger. 12 | if (!::AttachConsole(ATTACH_PARENT_PROCESS) && ::IsDebuggerPresent()) { 13 | CreateAndAttachConsole(); 14 | } 15 | 16 | // Initialize COM, so that it is available for use in the library and/or 17 | // plugins. 18 | ::CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED); 19 | 20 | flutter::DartProject project(L"data"); 21 | 22 | std::vector command_line_arguments = 23 | GetCommandLineArguments(); 24 | 25 | project.set_dart_entrypoint_arguments(std::move(command_line_arguments)); 26 | 27 | FlutterWindow window(project); 28 | Win32Window::Point origin(10, 10); 29 | Win32Window::Size size(1280, 720); 30 | if (!window.CreateAndShow(L"example", origin, size)) { 31 | return EXIT_FAILURE; 32 | } 33 | window.SetQuitOnClose(true); 34 | 35 | ::MSG msg; 36 | while (::GetMessage(&msg, nullptr, 0, 0)) { 37 | ::TranslateMessage(&msg); 38 | ::DispatchMessage(&msg); 39 | } 40 | 41 | ::CoUninitialize(); 42 | return EXIT_SUCCESS; 43 | } 44 | -------------------------------------------------------------------------------- /permission_handler/example/windows/runner/resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Visual C++ generated include file. 3 | // Used by Runner.rc 4 | // 5 | #define IDI_APP_ICON 101 6 | 7 | // Next default values for new objects 8 | // 9 | #ifdef APSTUDIO_INVOKED 10 | #ifndef APSTUDIO_READONLY_SYMBOLS 11 | #define _APS_NEXT_RESOURCE_VALUE 102 12 | #define _APS_NEXT_COMMAND_VALUE 40001 13 | #define _APS_NEXT_CONTROL_VALUE 1001 14 | #define _APS_NEXT_SYMED_VALUE 101 15 | #endif 16 | #endif 17 | -------------------------------------------------------------------------------- /permission_handler/example/windows/runner/resources/app_icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Baseflow/flutter-permission-handler/c438a1f29cdbe9b46b118ed58dc6e88b43524f74/permission_handler/example/windows/runner/resources/app_icon.ico -------------------------------------------------------------------------------- /permission_handler/example/windows/runner/runner.exe.manifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PerMonitorV2 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /permission_handler/example/windows/runner/utils.cpp: -------------------------------------------------------------------------------- 1 | #include "utils.h" 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | #include 9 | 10 | void CreateAndAttachConsole() { 11 | if (::AllocConsole()) { 12 | FILE *unused; 13 | if (freopen_s(&unused, "CONOUT$", "w", stdout)) { 14 | _dup2(_fileno(stdout), 1); 15 | } 16 | if (freopen_s(&unused, "CONOUT$", "w", stderr)) { 17 | _dup2(_fileno(stdout), 2); 18 | } 19 | std::ios::sync_with_stdio(); 20 | FlutterDesktopResyncOutputStreams(); 21 | } 22 | } 23 | 24 | std::vector GetCommandLineArguments() { 25 | // Convert the UTF-16 command line arguments to UTF-8 for the Engine to use. 26 | int argc; 27 | wchar_t** argv = ::CommandLineToArgvW(::GetCommandLineW(), &argc); 28 | if (argv == nullptr) { 29 | return std::vector(); 30 | } 31 | 32 | std::vector command_line_arguments; 33 | 34 | // Skip the first argument as it's the binary name. 35 | for (int i = 1; i < argc; i++) { 36 | command_line_arguments.push_back(Utf8FromUtf16(argv[i])); 37 | } 38 | 39 | ::LocalFree(argv); 40 | 41 | return command_line_arguments; 42 | } 43 | 44 | std::string Utf8FromUtf16(const wchar_t* utf16_string) { 45 | if (utf16_string == nullptr) { 46 | return std::string(); 47 | } 48 | int target_length = ::WideCharToMultiByte( 49 | CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, 50 | -1, nullptr, 0, nullptr, nullptr); 51 | if (target_length == 0) { 52 | return std::string(); 53 | } 54 | std::string utf8_string; 55 | utf8_string.resize(target_length); 56 | int converted_length = ::WideCharToMultiByte( 57 | CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, 58 | -1, utf8_string.data(), 59 | target_length, nullptr, nullptr); 60 | if (converted_length == 0) { 61 | return std::string(); 62 | } 63 | return utf8_string; 64 | } 65 | -------------------------------------------------------------------------------- /permission_handler/example/windows/runner/utils.h: -------------------------------------------------------------------------------- 1 | #ifndef RUNNER_UTILS_H_ 2 | #define RUNNER_UTILS_H_ 3 | 4 | #include 5 | #include 6 | 7 | // Creates a console for the process, and redirects stdout and stderr to 8 | // it for both the runner and the Flutter library. 9 | void CreateAndAttachConsole(); 10 | 11 | // Takes a null-terminated wchar_t* encoded in UTF-16 and returns a std::string 12 | // encoded in UTF-8. Returns an empty std::string on failure. 13 | std::string Utf8FromUtf16(const wchar_t* utf16_string); 14 | 15 | // Gets the command line arguments passed in as a std::vector, 16 | // encoded in UTF-8. Returns an empty std::vector on failure. 17 | std::vector GetCommandLineArguments(); 18 | 19 | #endif // RUNNER_UTILS_H_ 20 | -------------------------------------------------------------------------------- /permission_handler/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: permission_handler 2 | description: Permission plugin for Flutter. This plugin provides a cross-platform (iOS, Android) API to request and check permissions. 3 | repository: https://github.com/baseflow/flutter-permission-handler 4 | issue_tracker: https://github.com/Baseflow/flutter-permission-handler/issues 5 | version: 12.0.0+1 6 | 7 | 8 | environment: 9 | sdk: ^3.5.0 10 | flutter: ">=3.24.0" 11 | 12 | flutter: 13 | plugin: 14 | platforms: 15 | android: 16 | default_package: permission_handler_android 17 | ios: 18 | default_package: permission_handler_apple 19 | web: 20 | default_package: permission_handler_html 21 | windows: 22 | default_package: permission_handler_windows 23 | 24 | dependencies: 25 | flutter: 26 | sdk: flutter 27 | meta: ^1.7.0 28 | permission_handler_android: ^13.0.0 29 | permission_handler_apple: ^9.4.6 30 | permission_handler_html: ^0.1.1 31 | permission_handler_windows: ^0.2.1 32 | permission_handler_platform_interface: ^4.3.0 33 | 34 | dev_dependencies: 35 | flutter_lints: ^5.0.0 36 | flutter_test: 37 | sdk: flutter 38 | mockito: ^5.4.5 39 | plugin_platform_interface: ^2.0.0 40 | -------------------------------------------------------------------------------- /permission_handler/scripts/before_build_apks.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | wget https://dl.google.com/android/repository/sdk-tools-linux-3859397.zip 3 | mkdir android-sdk 4 | unzip -qq sdk-tools-linux-3859397.zip -d $HOME/android-sdk 5 | export ANDROID_HOME=$HOME/android-sdk 6 | export PATH=$HOME/android-sdk/tools/bin:$PATH 7 | mkdir -p /home/travis/.android # silence sdkmanager warning 8 | echo 'count=0' > /home/travis/.android/repositories.cfg # silence sdkmanager warning 9 | # suppressing output of sdkmanager to keep log under 4MB (travis limit) 10 | echo y | sdkmanager "tools" >/dev/null 11 | echo y | sdkmanager "platform-tools" >/dev/null 12 | echo y | sdkmanager "build-tools;26.0.3" >/dev/null 13 | echo y | sdkmanager "platforms;android-26" >/dev/null 14 | echo y | sdkmanager "extras;android;m2repository" >/dev/null 15 | echo y | sdkmanager "extras;google;m2repository" >/dev/null 16 | echo y | sdkmanager "patcher;v4" >/dev/null 17 | sdkmanager --list 18 | wget http://services.gradle.org/distributions/gradle-4.1-bin.zip 19 | unzip -qq gradle-4.1-bin.zip -d $HOME/gradle-4.1 20 | export GRADLE_HOME=$HOME/gradle-4.1 21 | export PATH=$GRADLE_HOME/bin:$PATH 22 | gradle -v 23 | git clone --single-branch --branch stable https://github.com/flutter/flutter.git $HOME/flutter 24 | export PATH=$HOME/flutter/bin:$HOME/flutter/bin/cache/dart-sdk/bin:$PATH 25 | flutter doctor 26 | 27 | -------------------------------------------------------------------------------- /permission_handler/scripts/before_build_ipas.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | brew update 3 | brew install libimobiledevice 4 | brew install ideviceinstaller 5 | brew install ios-deploy 6 | pod repo update 7 | gem update cocoapods 8 | git clone --single-branch --branch stable https://github.com/flutter/flutter.git $HOME/flutter 9 | export PATH=$HOME/flutter/bin:$HOME/flutter/bin/cache/dart-sdk/bin:$PATH 10 | flutter doctor 11 | -------------------------------------------------------------------------------- /permission_handler_android/AUTHORS: -------------------------------------------------------------------------------- 1 | 2 | # Below is a list of people and organizations that have contributed 3 | # to the Flutter project. Names should be added to the list like so: 4 | # 5 | # Name/Organization 6 | 7 | Baseflow 8 | Maurits van Beusekom -------------------------------------------------------------------------------- /permission_handler_android/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Baseflow 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /permission_handler_android/README.md: -------------------------------------------------------------------------------- 1 | # permission_handler_android 2 | 3 | [![pub package](https://img.shields.io/pub/v/permission_handler_android.svg)](https://pub.dartlang.org/packages/permission_handler_android) ![Build status](https://github.com/Baseflow/flutter-permission-handler/workflows/permission_handler_android/badge.svg?branch=master) [![style: flutter lints](https://img.shields.io/badge/style-flutter_lints-40c4ff.svg)](https://pub.dev/packages/flutter_lints) 4 | 5 | The official Android implementation of the [permission_handler](https://pub.dev/packages/permission_handler) plugin by [Baseflow](https://baseflow.com). 6 | 7 | ## Usage 8 | 9 | Since version 9.1.0 of the [permission_handler](https://pub.dev/packages/permission_handler) plugin this is the endorsed Android implementation. This means it will automatically be added to your dependencies when you depend on `permission_handler: ^9.1.0` in your applications pubspec.yaml. 10 | 11 | More detailed instructions on using the API can be found in the [README.md](../permission_handler/README.md) of the [permission_handler](https://pub.dev/packages/permission_handler) package. 12 | 13 | ## Issues 14 | 15 | Please file any issues, bugs, or feature requests as an issue on our [GitHub](https://github.com/Baseflow/flutter-permission-handler/issues) page. Commercial support is available, you can contact us at . 16 | 17 | ## Want to contribute 18 | 19 | If you would like to contribute to the plugin (e.g. by improving the documentation, solving a bug, or adding a cool new feature), please carefully review our [contribution guide](../CONTRIBUTING.md) and send us your [pull request](https://github.com/Baseflow/flutter-permission-handler/pulls). 20 | 21 | ## Author 22 | 23 | This permission_handler plugin for Flutter is developed by [Baseflow](https://baseflow.com). 24 | -------------------------------------------------------------------------------- /permission_handler_android/android/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /permission_handler_android/android/.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/workspace.xml 5 | /.idea/libraries 6 | .DS_Store 7 | /build 8 | /captures 9 | -------------------------------------------------------------------------------- /permission_handler_android/android/.settings/org.eclipse.buildship.core.prefs: -------------------------------------------------------------------------------- 1 | arguments= 2 | auto.sync=false 3 | build.scans.enabled=false 4 | connection.gradle.distribution=GRADLE_DISTRIBUTION(VERSION(7.1.1)) 5 | connection.project.dir= 6 | eclipse.preferences.version=1 7 | gradle.user.home= 8 | java.home=/Library/Java/JavaVirtualMachines/adoptopenjdk-11.jdk/Contents/Home 9 | jvm.arguments= 10 | offline.mode=false 11 | override.workspace.settings=true 12 | show.console.view=true 13 | show.executions.view=true 14 | -------------------------------------------------------------------------------- /permission_handler_android/android/build.gradle: -------------------------------------------------------------------------------- 1 | group 'com.baseflow.permissionhandler' 2 | version '1.0' 3 | 4 | buildscript { 5 | repositories { 6 | google() 7 | mavenCentral() 8 | } 9 | 10 | dependencies { 11 | classpath 'com.android.tools.build:gradle:8.0.2' 12 | } 13 | } 14 | 15 | rootProject.allprojects { 16 | repositories { 17 | google() 18 | mavenCentral() 19 | } 20 | } 21 | 22 | apply plugin: 'com.android.library' 23 | 24 | android { 25 | // Conditional for compatibility with AGP <4.2. 26 | if (project.android.hasProperty("namespace")) { 27 | namespace 'com.baseflow.permissionhandler' 28 | } 29 | compileSdkVersion 35 30 | 31 | compileOptions { 32 | sourceCompatibility JavaVersion.VERSION_17 33 | targetCompatibility JavaVersion.VERSION_17 34 | } 35 | 36 | defaultConfig { 37 | minSdkVersion 19 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /permission_handler_android/android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.8-bin.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /permission_handler_android/android/settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'permission_handler' 2 | -------------------------------------------------------------------------------- /permission_handler_android/android/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | -------------------------------------------------------------------------------- /permission_handler_android/android/src/main/java/com/baseflow/permissionhandler/AppSettingsManager.java: -------------------------------------------------------------------------------- 1 | package com.baseflow.permissionhandler; 2 | 3 | import android.content.Context; 4 | import android.content.Intent; 5 | import android.util.Log; 6 | 7 | final class AppSettingsManager { 8 | @FunctionalInterface 9 | interface OpenAppSettingsSuccessCallback { 10 | void onSuccess(boolean appSettingsOpenedSuccessfully); 11 | } 12 | 13 | void openAppSettings( 14 | Context context, 15 | OpenAppSettingsSuccessCallback successCallback, 16 | ErrorCallback errorCallback) { 17 | if(context == null) { 18 | Log.d(PermissionConstants.LOG_TAG, "Context cannot be null."); 19 | errorCallback.onError("PermissionHandler.AppSettingsManager", "Android context cannot be null."); 20 | return; 21 | } 22 | 23 | try { 24 | Intent settingsIntent = new Intent(); 25 | settingsIntent.setAction(android.provider.Settings.ACTION_APPLICATION_DETAILS_SETTINGS); 26 | settingsIntent.addCategory(Intent.CATEGORY_DEFAULT); 27 | settingsIntent.setData(android.net.Uri.parse("package:" + context.getPackageName())); 28 | settingsIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); 29 | settingsIntent.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY); 30 | settingsIntent.addFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS); 31 | 32 | context.startActivity(settingsIntent); 33 | 34 | successCallback.onSuccess(true); 35 | } catch (Exception ex) { 36 | successCallback.onSuccess(false); 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /permission_handler_android/android/src/main/java/com/baseflow/permissionhandler/ErrorCallback.java: -------------------------------------------------------------------------------- 1 | package com.baseflow.permissionhandler; 2 | 3 | @FunctionalInterface 4 | interface ErrorCallback { 5 | void onError(String errorCode, String errorDescription); 6 | } 7 | -------------------------------------------------------------------------------- /permission_handler_android/example/.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .history 10 | .svn/ 11 | 12 | # IntelliJ related 13 | *.iml 14 | *.ipr 15 | *.iws 16 | .idea/ 17 | 18 | # Visual Studio Code related 19 | .vscode/ 20 | 21 | # Flutter/Dart/Pub related 22 | **/doc/api/ 23 | .dart_tool/ 24 | .flutter-plugins 25 | .flutter-plugins-dependencies 26 | .packages 27 | .pub-cache/ 28 | .pub/ 29 | build/ 30 | 31 | # Android related 32 | **/android/**/gradle-wrapper.jar 33 | **/android/.gradle 34 | **/android/captures/ 35 | **/android/gradlew 36 | **/android/gradlew.bat 37 | **/android/local.properties 38 | **/android/**/GeneratedPluginRegistrant.java 39 | 40 | # iOS/XCode related 41 | **/ios/**/*.mode1v3 42 | **/ios/**/*.mode2v3 43 | **/ios/**/*.moved-aside 44 | **/ios/**/*.pbxuser 45 | **/ios/**/*.perspectivev3 46 | **/ios/**/*sync/ 47 | **/ios/**/.sconsign.dblite 48 | **/ios/**/.tags* 49 | **/ios/**/.vagrant/ 50 | **/ios/**/DerivedData/ 51 | **/ios/**/Icon? 52 | **/ios/**/Pods/ 53 | **/ios/**/.symlinks/ 54 | **/ios/**/profile 55 | **/ios/**/xcuserdata 56 | **/ios/.generated/ 57 | **/ios/Flutter/App.framework 58 | **/ios/Flutter/Flutter.framework 59 | **/ios/Flutter/Generated.xcconfig 60 | **/ios/Flutter/app.flx 61 | **/ios/Flutter/app.zip 62 | **/ios/Flutter/flutter_assets/ 63 | **/ios/ServiceDefinitions.json 64 | **/ios/Runner/GeneratedPluginRegistrant.* 65 | 66 | # Exceptions to above rules. 67 | !**/ios/**/default.mode1v3 68 | !**/ios/**/default.mode2v3 69 | !**/ios/**/default.pbxuser 70 | !**/ios/**/default.perspectivev3 71 | !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages 72 | -------------------------------------------------------------------------------- /permission_handler_android/example/.metadata: -------------------------------------------------------------------------------- 1 | # This file tracks properties of this Flutter project. 2 | # Used by Flutter tool to assess capabilities and perform upgrades etc. 3 | # 4 | # This file should be version controlled and should not be manually edited. 5 | 6 | version: 7 | revision: 06b979c4d5e1b499745422269f01a00341257058 8 | channel: master 9 | 10 | project_type: app 11 | -------------------------------------------------------------------------------- /permission_handler_android/example/README.md: -------------------------------------------------------------------------------- 1 | # permission_handler_example 2 | 3 | Demonstrates how to use the permission_handler plugin. 4 | 5 | ## Getting Started 6 | 7 | This project is a starting point for a Flutter application. 8 | 9 | A few resources to get you started if this is your first Flutter project: 10 | 11 | - [Lab: Write your first Flutter app](https://flutter.io/docs/get-started/codelab) 12 | - [Cookbook: Useful Flutter samples](https://flutter.io/docs/cookbook) 13 | 14 | For help getting started with Flutter, view our 15 | [online documentation](https://flutter.io/docs), which offers tutorials, 16 | samples, guidance on mobile development, and a full API reference. 17 | -------------------------------------------------------------------------------- /permission_handler_android/example/android/.gitignore: -------------------------------------------------------------------------------- 1 | gradle-wrapper.jar 2 | /.gradle 3 | /captures/ 4 | /gradlew 5 | /gradlew.bat 6 | /local.properties 7 | GeneratedPluginRegistrant.java 8 | .cxx/ 9 | 10 | # Remember to never publicly share your keystore. 11 | # See https://flutter.dev/to/reference-keystore 12 | key.properties 13 | **/*.keystore 14 | **/*.jks 15 | -------------------------------------------------------------------------------- /permission_handler_android/example/android/.settings/org.eclipse.buildship.core.prefs: -------------------------------------------------------------------------------- 1 | arguments= 2 | auto.sync=false 3 | build.scans.enabled=false 4 | connection.gradle.distribution=GRADLE_DISTRIBUTION(WRAPPER) 5 | connection.project.dir= 6 | eclipse.preferences.version=1 7 | gradle.user.home= 8 | java.home=/Library/Java/JavaVirtualMachines/adoptopenjdk-11.jdk/Contents/Home 9 | jvm.arguments= 10 | offline.mode=false 11 | override.workspace.settings=true 12 | show.console.view=true 13 | show.executions.view=true 14 | -------------------------------------------------------------------------------- /permission_handler_android/example/android/app/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id "com.android.application" 3 | id "dev.flutter.flutter-gradle-plugin" 4 | } 5 | 6 | def localProperties = new Properties() 7 | def localPropertiesFile = rootProject.file('local.properties') 8 | if (localPropertiesFile.exists()) { 9 | localPropertiesFile.withReader('UTF-8') { reader -> 10 | localProperties.load(reader) 11 | } 12 | } 13 | 14 | def flutterRoot = localProperties.getProperty('flutter.sdk') 15 | if (flutterRoot == null) { 16 | throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") 17 | } 18 | 19 | def flutterVersionCode = localProperties.getProperty('flutter.versionCode') 20 | if (flutterVersionCode == null) { 21 | flutterVersionCode = '1' 22 | } 23 | 24 | def flutterVersionName = localProperties.getProperty('flutter.versionName') 25 | if (flutterVersionName == null) { 26 | flutterVersionName = '1.0' 27 | } 28 | 29 | android { 30 | namespace 'com.baseflow.permissionhandler.example' 31 | compileSdkVersion 35 32 | 33 | defaultConfig { 34 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). 35 | applicationId "com.baseflow.permissionhandler.example" 36 | minSdkVersion flutter.minSdkVersion 37 | targetSdkVersion 35 38 | versionCode flutterVersionCode.toInteger() 39 | versionName flutterVersionName 40 | } 41 | 42 | buildTypes { 43 | release { 44 | // TODO: Add your own signing config for the release build. 45 | // Signing with the debug keys for now, so `flutter run --release` works. 46 | signingConfig signingConfigs.debug 47 | } 48 | } 49 | } 50 | 51 | flutter { 52 | source '../..' 53 | } 54 | -------------------------------------------------------------------------------- /permission_handler_android/example/android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /permission_handler_android/example/android/app/src/main/kotlin/com/example/example/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.example.example 2 | 3 | import io.flutter.embedding.android.FlutterActivity 4 | 5 | class MainActivity: FlutterActivity() { 6 | } 7 | -------------------------------------------------------------------------------- /permission_handler_android/example/android/app/src/main/res/drawable-v21/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /permission_handler_android/example/android/app/src/main/res/drawable/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /permission_handler_android/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Baseflow/flutter-permission-handler/c438a1f29cdbe9b46b118ed58dc6e88b43524f74/permission_handler_android/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /permission_handler_android/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Baseflow/flutter-permission-handler/c438a1f29cdbe9b46b118ed58dc6e88b43524f74/permission_handler_android/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /permission_handler_android/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Baseflow/flutter-permission-handler/c438a1f29cdbe9b46b118ed58dc6e88b43524f74/permission_handler_android/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /permission_handler_android/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Baseflow/flutter-permission-handler/c438a1f29cdbe9b46b118ed58dc6e88b43524f74/permission_handler_android/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /permission_handler_android/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Baseflow/flutter-permission-handler/c438a1f29cdbe9b46b118ed58dc6e88b43524f74/permission_handler_android/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /permission_handler_android/example/android/app/src/main/res/values-night/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /permission_handler_android/example/android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | -------------------------------------------------------------------------------- /permission_handler_android/example/android/build.gradle: -------------------------------------------------------------------------------- 1 | allprojects { 2 | repositories { 3 | google() 4 | mavenCentral() 5 | } 6 | } 7 | 8 | rootProject.buildDir = '../build' 9 | subprojects { 10 | project.buildDir = "${rootProject.buildDir}/${project.name}" 11 | } 12 | subprojects { 13 | project.evaluationDependsOn(':app') 14 | } 15 | 16 | tasks.register("clean", Delete) { 17 | delete rootProject.buildDir 18 | } 19 | 20 | // Build the plugin project with warnings enabled. This is here rather than 21 | // in the plugin itself to avoid breaking clients that have different 22 | // warnings (e.g., deprecation warnings from a newer SDK than this project 23 | // builds with). 24 | gradle.projectsEvaluated { 25 | project(":permission_handler_android") { 26 | tasks.withType(JavaCompile) { 27 | options.compilerArgs << "-Xlint:all" << "-Werror" 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /permission_handler_android/example/android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx4G 2 | android.useAndroidX=true 3 | android.enableJetifier=true 4 | -------------------------------------------------------------------------------- /permission_handler_android/example/android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Fri Jun 23 08:50:38 CEST 2017 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-all.zip 7 | -------------------------------------------------------------------------------- /permission_handler_android/example/android/settings.gradle: -------------------------------------------------------------------------------- 1 | pluginManagement { 2 | def flutterSdkPath = { 3 | def properties = new Properties() 4 | file("local.properties").withInputStream { properties.load(it) } 5 | def flutterSdkPath = properties.getProperty("flutter.sdk") 6 | assert flutterSdkPath != null, "flutter.sdk not set in local.properties" 7 | return flutterSdkPath 8 | }() 9 | 10 | includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") 11 | 12 | repositories { 13 | google() 14 | mavenCentral() 15 | gradlePluginPortal() 16 | } 17 | } 18 | 19 | plugins { 20 | id "dev.flutter.flutter-plugin-loader" version "1.0.0" 21 | id "com.android.application" version "8.7.0" apply false 22 | } 23 | 24 | include ":app" -------------------------------------------------------------------------------- /permission_handler_android/example/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: permission_handler_android_example 2 | description: Demonstrates how to use the permission_handler_android plugin. 3 | 4 | environment: 5 | sdk: ^3.7.0 6 | 7 | dependencies: 8 | baseflow_plugin_template: ^2.1.2 9 | flutter: 10 | sdk: flutter 11 | permission_handler_platform_interface: ^4.2.0 12 | 13 | dev_dependencies: 14 | flutter_test: 15 | sdk: flutter 16 | 17 | permission_handler_android: 18 | # When depending on this package from a real application you should use: 19 | # permission_handler_android: ^x.y.z 20 | # See https://dart.dev/tools/pub/dependencies#version-constraints 21 | # The example app is bundled with the plugin so we use a path dependency on 22 | # the parent directory to use the current plugin's version. 23 | path: ../ 24 | 25 | url_launcher: ^6.0.12 26 | 27 | flutter: 28 | uses-material-design: true 29 | 30 | assets: 31 | - res/images/baseflow_logo_def_light-02.png 32 | - res/images/poweredByBaseflowLogoLight@3x.png 33 | -------------------------------------------------------------------------------- /permission_handler_android/example/res/images/baseflow_logo_def_light-02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Baseflow/flutter-permission-handler/c438a1f29cdbe9b46b118ed58dc6e88b43524f74/permission_handler_android/example/res/images/baseflow_logo_def_light-02.png -------------------------------------------------------------------------------- /permission_handler_android/example/res/images/poweredByBaseflowLogoLight.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Baseflow/flutter-permission-handler/c438a1f29cdbe9b46b118ed58dc6e88b43524f74/permission_handler_android/example/res/images/poweredByBaseflowLogoLight.png -------------------------------------------------------------------------------- /permission_handler_android/example/res/images/poweredByBaseflowLogoLight@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Baseflow/flutter-permission-handler/c438a1f29cdbe9b46b118ed58dc6e88b43524f74/permission_handler_android/example/res/images/poweredByBaseflowLogoLight@2x.png -------------------------------------------------------------------------------- /permission_handler_android/example/res/images/poweredByBaseflowLogoLight@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Baseflow/flutter-permission-handler/c438a1f29cdbe9b46b118ed58dc6e88b43524f74/permission_handler_android/example/res/images/poweredByBaseflowLogoLight@3x.png -------------------------------------------------------------------------------- /permission_handler_android/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: permission_handler_android 2 | description: Permission plugin for Flutter. This plugin provides the Android API to request and check permissions. 3 | homepage: https://github.com/baseflow/flutter-permission-handler 4 | version: 13.0.1 5 | 6 | environment: 7 | sdk: ^3.5.0 8 | flutter: ">=3.24.0" 9 | 10 | flutter: 11 | plugin: 12 | implements: permission_handler 13 | platforms: 14 | android: 15 | package: com.baseflow.permissionhandler 16 | pluginClass: PermissionHandlerPlugin 17 | 18 | dependencies: 19 | flutter: 20 | sdk: flutter 21 | permission_handler_platform_interface: ^4.2.0 22 | 23 | dev_dependencies: 24 | flutter_lints: ^5.0.0 25 | plugin_platform_interface: ^2.0.0 26 | -------------------------------------------------------------------------------- /permission_handler_apple/AUTHORS: -------------------------------------------------------------------------------- 1 | 2 | # Below is a list of people and organizations that have contributed 3 | # to the Flutter project. Names should be added to the list like so: 4 | # 5 | # Name/Organization 6 | 7 | Baseflow 8 | Maurits van Beusekom 9 | Lukas Kurz 10 | -------------------------------------------------------------------------------- /permission_handler_apple/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Baseflow 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /permission_handler_apple/README.md: -------------------------------------------------------------------------------- 1 | # permission_handler_apple 2 | 3 | [![pub package](https://img.shields.io/pub/v/permission_handler_apple.svg)](https://pub.dartlang.org/packages/permission_handler_apple) ![Build status](https://github.com/Baseflow/flutter-permission-handler/workflows/permission_handler_apple/badge.svg?branch=master) [![style: flutter lints](https://img.shields.io/badge/style-flutter_lints-40c4ff.svg)](https://pub.dev/packages/flutter_lints) 4 | 5 | The official iOS implementation of the [permission_handler](https://pub.dev/packages/permission_handler) plugin by [Baseflow](https://baseflow.com). 6 | 7 | ## Usage 8 | 9 | Since version 9.1.0 of the [permission_handler](https://pub.dev/packages/permission_handler) plugin this is the endorsed iOS implementation. This means it will automatically be added to your dependencies when you depend on `permission_handler: ^9.1.0` in your applications pubspec.yaml. 10 | 11 | More detailed instructions on using the API can be found in the [README.md](../permission_handler/README.md) of the [permission_handler](https://pub.dev/packages/permission_handler) package. 12 | 13 | ## Issues 14 | 15 | Please file any issues, bugs, or feature requests as an issue on our [GitHub](https://github.com/Baseflow/flutter-permission-handler/issues) page. Commercial support is available, you can contact us at . 16 | 17 | ## Want to contribute 18 | 19 | If you would like to contribute to the plugin (e.g. by improving the documentation, solving a bug, or adding a cool new feature), please carefully review our [contribution guide](../CONTRIBUTING.md) and send us your [pull request](https://github.com/Baseflow/flutter-permission-handler/pulls). 20 | 21 | ## Author 22 | 23 | This permission_handler plugin for Flutter is developed by [Baseflow](https://baseflow.com). 24 | -------------------------------------------------------------------------------- /permission_handler_apple/example/.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .history 10 | .svn/ 11 | 12 | # IntelliJ related 13 | *.iml 14 | *.ipr 15 | *.iws 16 | .idea/ 17 | 18 | # Visual Studio Code related 19 | .vscode/ 20 | 21 | # Flutter/Dart/Pub related 22 | **/doc/api/ 23 | .dart_tool/ 24 | .flutter-plugins 25 | .flutter-plugins-dependencies 26 | .packages 27 | .pub-cache/ 28 | .pub/ 29 | build/ 30 | 31 | # Android related 32 | **/android/**/gradle-wrapper.jar 33 | **/android/.gradle 34 | **/android/captures/ 35 | **/android/gradlew 36 | **/android/gradlew.bat 37 | **/android/local.properties 38 | **/android/**/GeneratedPluginRegistrant.java 39 | 40 | # iOS/XCode related 41 | **/ios/**/*.mode1v3 42 | **/ios/**/*.mode2v3 43 | **/ios/**/*.moved-aside 44 | **/ios/**/*.pbxuser 45 | **/ios/**/*.perspectivev3 46 | **/ios/**/*sync/ 47 | **/ios/**/.sconsign.dblite 48 | **/ios/**/.tags* 49 | **/ios/**/.vagrant/ 50 | **/ios/**/DerivedData/ 51 | **/ios/**/Icon? 52 | **/ios/**/Pods/ 53 | **/ios/**/.symlinks/ 54 | **/ios/**/profile 55 | **/ios/**/xcuserdata 56 | **/ios/.generated/ 57 | **/ios/Flutter/App.framework 58 | **/ios/Flutter/Flutter.framework 59 | **/ios/Flutter/Generated.xcconfig 60 | **/ios/Flutter/app.flx 61 | **/ios/Flutter/app.zip 62 | **/ios/Flutter/flutter_assets/ 63 | **/ios/ServiceDefinitions.json 64 | **/ios/Runner/GeneratedPluginRegistrant.* 65 | 66 | # Exceptions to above rules. 67 | !**/ios/**/default.mode1v3 68 | !**/ios/**/default.mode2v3 69 | !**/ios/**/default.pbxuser 70 | !**/ios/**/default.perspectivev3 71 | !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages 72 | -------------------------------------------------------------------------------- /permission_handler_apple/example/.metadata: -------------------------------------------------------------------------------- 1 | # This file tracks properties of this Flutter project. 2 | # Used by Flutter tool to assess capabilities and perform upgrades etc. 3 | # 4 | # This file should be version controlled and should not be manually edited. 5 | 6 | version: 7 | revision: 06b979c4d5e1b499745422269f01a00341257058 8 | channel: master 9 | 10 | project_type: app 11 | -------------------------------------------------------------------------------- /permission_handler_apple/example/README.md: -------------------------------------------------------------------------------- 1 | # permission_handler_example 2 | 3 | Demonstrates how to use the permission_handler plugin. 4 | 5 | ## Getting Started 6 | 7 | This project is a starting point for a Flutter application. 8 | 9 | A few resources to get you started if this is your first Flutter project: 10 | 11 | - [Lab: Write your first Flutter app](https://flutter.io/docs/get-started/codelab) 12 | - [Cookbook: Useful Flutter samples](https://flutter.io/docs/cookbook) 13 | 14 | For help getting started with Flutter, view our 15 | [online documentation](https://flutter.io/docs), which offers tutorials, 16 | samples, guidance on mobile development, and a full API reference. 17 | -------------------------------------------------------------------------------- /permission_handler_apple/example/ios/.gitignore: -------------------------------------------------------------------------------- 1 | *.mode1v3 2 | *.mode2v3 3 | *.moved-aside 4 | *.pbxuser 5 | *.perspectivev3 6 | **/*sync/ 7 | .sconsign.dblite 8 | .tags* 9 | **/.vagrant/ 10 | **/DerivedData/ 11 | Icon? 12 | **/Pods/ 13 | **/.symlinks/ 14 | profile 15 | xcuserdata 16 | **/.generated/ 17 | Flutter/App.framework 18 | Flutter/Flutter.framework 19 | Flutter/Flutter.podspec 20 | Flutter/Generated.xcconfig 21 | Flutter/app.flx 22 | Flutter/app.zip 23 | Flutter/flutter_assets/ 24 | Flutter/flutter_export_environment.sh 25 | ServiceDefinitions.json 26 | Runner/GeneratedPluginRegistrant.* 27 | 28 | # Exceptions to above rules. 29 | !default.mode1v3 30 | !default.mode2v3 31 | !default.pbxuser 32 | !default.perspectivev3 33 | -------------------------------------------------------------------------------- /permission_handler_apple/example/ios/Flutter/AppFrameworkInfo.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | App 9 | CFBundleIdentifier 10 | io.flutter.flutter.app 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | App 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1.0 23 | MinimumOSVersion 24 | 12.0 25 | 26 | 27 | -------------------------------------------------------------------------------- /permission_handler_apple/example/ios/Flutter/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" 2 | #include "Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /permission_handler_apple/example/ios/Flutter/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" 2 | #include "Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /permission_handler_apple/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /permission_handler_apple/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /permission_handler_apple/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /permission_handler_apple/example/ios/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /permission_handler_apple/example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /permission_handler_apple/example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /permission_handler_apple/example/ios/Runner/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import UIKit 2 | import Flutter 3 | 4 | @UIApplicationMain 5 | @objc class AppDelegate: FlutterAppDelegate { 6 | override func application( 7 | _ application: UIApplication, 8 | didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? 9 | ) -> Bool { 10 | GeneratedPluginRegistrant.register(with: self) 11 | return super.application(application, didFinishLaunchingWithOptions: launchOptions) 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /permission_handler_apple/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Baseflow/flutter-permission-handler/c438a1f29cdbe9b46b118ed58dc6e88b43524f74/permission_handler_apple/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png -------------------------------------------------------------------------------- /permission_handler_apple/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Baseflow/flutter-permission-handler/c438a1f29cdbe9b46b118ed58dc6e88b43524f74/permission_handler_apple/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png -------------------------------------------------------------------------------- /permission_handler_apple/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Baseflow/flutter-permission-handler/c438a1f29cdbe9b46b118ed58dc6e88b43524f74/permission_handler_apple/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png -------------------------------------------------------------------------------- /permission_handler_apple/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Baseflow/flutter-permission-handler/c438a1f29cdbe9b46b118ed58dc6e88b43524f74/permission_handler_apple/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png -------------------------------------------------------------------------------- /permission_handler_apple/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Baseflow/flutter-permission-handler/c438a1f29cdbe9b46b118ed58dc6e88b43524f74/permission_handler_apple/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png -------------------------------------------------------------------------------- /permission_handler_apple/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Baseflow/flutter-permission-handler/c438a1f29cdbe9b46b118ed58dc6e88b43524f74/permission_handler_apple/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png -------------------------------------------------------------------------------- /permission_handler_apple/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Baseflow/flutter-permission-handler/c438a1f29cdbe9b46b118ed58dc6e88b43524f74/permission_handler_apple/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png -------------------------------------------------------------------------------- /permission_handler_apple/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Baseflow/flutter-permission-handler/c438a1f29cdbe9b46b118ed58dc6e88b43524f74/permission_handler_apple/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png -------------------------------------------------------------------------------- /permission_handler_apple/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Baseflow/flutter-permission-handler/c438a1f29cdbe9b46b118ed58dc6e88b43524f74/permission_handler_apple/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png -------------------------------------------------------------------------------- /permission_handler_apple/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Baseflow/flutter-permission-handler/c438a1f29cdbe9b46b118ed58dc6e88b43524f74/permission_handler_apple/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png -------------------------------------------------------------------------------- /permission_handler_apple/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Baseflow/flutter-permission-handler/c438a1f29cdbe9b46b118ed58dc6e88b43524f74/permission_handler_apple/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png -------------------------------------------------------------------------------- /permission_handler_apple/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Baseflow/flutter-permission-handler/c438a1f29cdbe9b46b118ed58dc6e88b43524f74/permission_handler_apple/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png -------------------------------------------------------------------------------- /permission_handler_apple/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Baseflow/flutter-permission-handler/c438a1f29cdbe9b46b118ed58dc6e88b43524f74/permission_handler_apple/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png -------------------------------------------------------------------------------- /permission_handler_apple/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Baseflow/flutter-permission-handler/c438a1f29cdbe9b46b118ed58dc6e88b43524f74/permission_handler_apple/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png -------------------------------------------------------------------------------- /permission_handler_apple/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Baseflow/flutter-permission-handler/c438a1f29cdbe9b46b118ed58dc6e88b43524f74/permission_handler_apple/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png -------------------------------------------------------------------------------- /permission_handler_apple/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "LaunchImage.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "LaunchImage@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "LaunchImage@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /permission_handler_apple/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Baseflow/flutter-permission-handler/c438a1f29cdbe9b46b118ed58dc6e88b43524f74/permission_handler_apple/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /permission_handler_apple/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Baseflow/flutter-permission-handler/c438a1f29cdbe9b46b118ed58dc6e88b43524f74/permission_handler_apple/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /permission_handler_apple/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Baseflow/flutter-permission-handler/c438a1f29cdbe9b46b118ed58dc6e88b43524f74/permission_handler_apple/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png -------------------------------------------------------------------------------- /permission_handler_apple/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md: -------------------------------------------------------------------------------- 1 | # Launch Screen Assets 2 | 3 | You can customize the launch screen with your own desired assets by replacing the image files in this directory. 4 | 5 | You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images. -------------------------------------------------------------------------------- /permission_handler_apple/example/ios/Runner/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /permission_handler_apple/example/ios/Runner/Runner-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | #import "GeneratedPluginRegistrant.h" 2 | -------------------------------------------------------------------------------- /permission_handler_apple/example/ios/Runner/RunnerDebug.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.developer.siri 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /permission_handler_apple/example/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: permission_handler_apple_example 2 | description: Demonstrates how to use the permission_handler_apple plugin. 3 | 4 | environment: 5 | sdk: ^3.7.0 6 | 7 | dependencies: 8 | baseflow_plugin_template: ^2.1.1 9 | flutter: 10 | sdk: flutter 11 | 12 | dev_dependencies: 13 | flutter_test: 14 | sdk: flutter 15 | 16 | permission_handler_apple: 17 | # When depending on this package from a real application you should use: 18 | # permission_handler: ^x.y.z 19 | # See https://dart.dev/tools/pub/dependencies#version-constraints 20 | # The example app is bundled with the plugin so we use a path dependency on 21 | # the parent directory to use the current plugin's version. 22 | path: ../ 23 | 24 | url_launcher: ^6.0.12 25 | 26 | flutter: 27 | uses-material-design: true 28 | 29 | assets: 30 | - res/images/baseflow_logo_def_light-02.png 31 | - res/images/poweredByBaseflowLogoLight@3x.png 32 | -------------------------------------------------------------------------------- /permission_handler_apple/example/res/images/baseflow_logo_def_light-02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Baseflow/flutter-permission-handler/c438a1f29cdbe9b46b118ed58dc6e88b43524f74/permission_handler_apple/example/res/images/baseflow_logo_def_light-02.png -------------------------------------------------------------------------------- /permission_handler_apple/example/res/images/poweredByBaseflowLogoLight.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Baseflow/flutter-permission-handler/c438a1f29cdbe9b46b118ed58dc6e88b43524f74/permission_handler_apple/example/res/images/poweredByBaseflowLogoLight.png -------------------------------------------------------------------------------- /permission_handler_apple/example/res/images/poweredByBaseflowLogoLight@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Baseflow/flutter-permission-handler/c438a1f29cdbe9b46b118ed58dc6e88b43524f74/permission_handler_apple/example/res/images/poweredByBaseflowLogoLight@2x.png -------------------------------------------------------------------------------- /permission_handler_apple/example/res/images/poweredByBaseflowLogoLight@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Baseflow/flutter-permission-handler/c438a1f29cdbe9b46b118ed58dc6e88b43524f74/permission_handler_apple/example/res/images/poweredByBaseflowLogoLight@3x.png -------------------------------------------------------------------------------- /permission_handler_apple/ios/.gitignore: -------------------------------------------------------------------------------- 1 | .idea/ 2 | .vagrant/ 3 | .sconsign.dblite 4 | .svn/ 5 | 6 | .DS_Store 7 | *.swp 8 | profile 9 | 10 | DerivedData/ 11 | build/ 12 | GeneratedPluginRegistrant.h 13 | GeneratedPluginRegistrant.m 14 | 15 | .generated/ 16 | 17 | *.pbxuser 18 | *.mode1v3 19 | *.mode2v3 20 | *.perspectivev3 21 | 22 | !default.pbxuser 23 | !default.mode1v3 24 | !default.mode2v3 25 | !default.perspectivev3 26 | 27 | xcuserdata 28 | 29 | *.moved-aside 30 | 31 | *.pyc 32 | *sync/ 33 | Icon? 34 | .tags* 35 | 36 | /Flutter/Generated.xcconfig 37 | -------------------------------------------------------------------------------- /permission_handler_apple/ios/Assets/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Baseflow/flutter-permission-handler/c438a1f29cdbe9b46b118ed58dc6e88b43524f74/permission_handler_apple/ios/Assets/.gitkeep -------------------------------------------------------------------------------- /permission_handler_apple/ios/Classes/PermissionHandlerPlugin.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import "PermissionManager.h" 3 | 4 | @interface PermissionHandlerPlugin : NSObject 5 | - (instancetype)initWithPermissionManager:(PermissionManager *)permissionManager; 6 | @end 7 | -------------------------------------------------------------------------------- /permission_handler_apple/ios/Classes/PermissionManager.h: -------------------------------------------------------------------------------- 1 | // 2 | // PermissionManager.h 3 | // permission_handler 4 | // 5 | // Created by Razvan Lung on 15/02/2019. 6 | // 7 | 8 | #import 9 | #import 10 | #import 11 | 12 | #import "AudioVideoPermissionStrategy.h" 13 | #import "AppTrackingTransparencyPermissionStrategy.h" 14 | #import "BackgroundRefreshStrategy.h" 15 | #import "BluetoothPermissionStrategy.h" 16 | #import "ContactPermissionStrategy.h" 17 | #import "EventPermissionStrategy.h" 18 | #import "LocationPermissionStrategy.h" 19 | #import "MediaLibraryPermissionStrategy.h" 20 | #import "PermissionStrategy.h" 21 | #import "PhonePermissionStrategy.h" 22 | #import "PhotoPermissionStrategy.h" 23 | #import "SensorPermissionStrategy.h" 24 | #import "SpeechPermissionStrategy.h" 25 | #import "StoragePermissionStrategy.h" 26 | #import "UnknownPermissionStrategy.h" 27 | #import "NotificationPermissionStrategy.h" 28 | #import "CriticalAlertsPermissionStrategy.h" 29 | #import "AssistantPermissionStrategy.h" 30 | #import "PermissionHandlerEnums.h" 31 | #import "Codec.h" 32 | 33 | typedef void (^PermissionRequestCompletion)(NSDictionary *permissionRequestResults); 34 | 35 | @interface PermissionManager : NSObject 36 | 37 | - (instancetype)initWithStrategyInstances; 38 | - (void)requestPermissions:(NSArray *)permissions completion:(PermissionRequestCompletion)completion errorHandler:(PermissionErrorHandler)errorHandler; 39 | 40 | + (void)checkPermissionStatus:(enum PermissionGroup)permission result:(FlutterResult)result; 41 | + (void)checkServiceStatus:(enum PermissionGroup)permission result:(FlutterResult)result; 42 | + (void)openAppSettings:(FlutterResult)result; 43 | 44 | @end 45 | -------------------------------------------------------------------------------- /permission_handler_apple/ios/Classes/strategies/AppTrackingTransparencyPermissionStrategy.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppTrackingTransparency.h 3 | // permission_handler 4 | // 5 | // Created by Jan-Derk on 21/05/2021. 6 | // 7 | 8 | #import 9 | #import "PermissionStrategy.h" 10 | 11 | #if PERMISSION_APP_TRACKING_TRANSPARENCY 12 | 13 | #import 14 | 15 | @interface AppTrackingTransparencyPermissionStrategy : NSObject 16 | @end 17 | 18 | #else 19 | 20 | #import "UnknownPermissionStrategy.h" 21 | 22 | @interface AppTrackingTransparencyPermissionStrategy : UnknownPermissionStrategy 23 | @end 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /permission_handler_apple/ios/Classes/strategies/AppTrackingTransparencyPermissionStrategy.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppTrackingTransparency.m 3 | // permission_handler 4 | // 5 | // Created by Jan-Derk on 21/05/2021. 6 | // 7 | 8 | #import "AppTrackingTransparencyPermissionStrategy.h" 9 | 10 | #if PERMISSION_APP_TRACKING_TRANSPARENCY 11 | 12 | @implementation AppTrackingTransparencyPermissionStrategy 13 | 14 | - (PermissionStatus)checkPermissionStatus:(PermissionGroup)permission { 15 | if (@available(iOS 14, *)) { 16 | ATTrackingManagerAuthorizationStatus attPermission = [ATTrackingManager trackingAuthorizationStatus]; 17 | return [AppTrackingTransparencyPermissionStrategy parsePermission:attPermission]; 18 | } 19 | 20 | return PermissionStatusGranted; 21 | } 22 | 23 | - (void)checkServiceStatus:(PermissionGroup)permission completionHandler:(ServiceStatusHandler)completionHandler { 24 | completionHandler(ServiceStatusNotApplicable); 25 | } 26 | 27 | - (void)requestPermission:(PermissionGroup)permission completionHandler:(PermissionStatusHandler)completionHandler errorHandler:(PermissionErrorHandler)errorHandler{ 28 | PermissionStatus status = [self checkPermissionStatus:permission]; 29 | if (status != PermissionStatusDenied) { 30 | completionHandler(status); 31 | return; 32 | } 33 | 34 | if (@available(iOS 14, *)){ 35 | [ATTrackingManager requestTrackingAuthorizationWithCompletionHandler:^(ATTrackingManagerAuthorizationStatus status) { 36 | PermissionStatus permissionStatus = [AppTrackingTransparencyPermissionStrategy parsePermission:status]; 37 | completionHandler(permissionStatus); 38 | }]; 39 | } else { 40 | completionHandler(PermissionStatusGranted); 41 | } 42 | } 43 | 44 | + (PermissionStatus)parsePermission:(ATTrackingManagerAuthorizationStatus)attPermission API_AVAILABLE(ios(14)){ 45 | switch(attPermission){ 46 | case ATTrackingManagerAuthorizationStatusAuthorized: 47 | return PermissionStatusGranted; 48 | case ATTrackingManagerAuthorizationStatusRestricted: 49 | return PermissionStatusRestricted; 50 | case ATTrackingManagerAuthorizationStatusDenied: 51 | return PermissionStatusPermanentlyDenied; 52 | case ATTrackingManagerAuthorizationStatusNotDetermined: 53 | return PermissionStatusDenied; 54 | } 55 | } 56 | @end 57 | 58 | #else 59 | 60 | @implementation AppTrackingTransparencyPermissionStrategy 61 | @end 62 | 63 | #endif 64 | 65 | -------------------------------------------------------------------------------- /permission_handler_apple/ios/Classes/strategies/AssistantPermissionStrategy.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Baptiste Dupuch(dupuchba) on 2023-09-04. 3 | // Copyright (c) 2019 The Chromium Authors. All rights reserved. 4 | // 5 | 6 | #import 7 | #import "PermissionStrategy.h" 8 | 9 | #if PERMISSION_ASSISTANT 10 | 11 | #import 12 | 13 | @interface AssistantPermissionStrategy : NSObject 14 | @end 15 | 16 | #else 17 | 18 | #import "UnknownPermissionStrategy.h" 19 | @interface AssistantPermissionStrategy : UnknownPermissionStrategy 20 | @end 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /permission_handler_apple/ios/Classes/strategies/AssistantPermissionStrategy.m: -------------------------------------------------------------------------------- 1 | // 2 | // Assistant.m 3 | // permission_handler 4 | // 5 | // Created by Baptiste Dupuch (dupuchba) on Tue Sep 5 08:50:04 2023 6 | // 7 | 8 | #import "AssistantPermissionStrategy.h" 9 | 10 | #if PERMISSION_ASSISTANT 11 | 12 | @implementation AssistantPermissionStrategy 13 | 14 | - (PermissionStatus)checkPermissionStatus:(PermissionGroup)permission { 15 | INSiriAuthorizationStatus assistantPermission = [INPreferences siriAuthorizationStatus]; 16 | return [AssistantPermissionStrategy parsePermission:assistantPermission]; 17 | } 18 | 19 | - (void)checkServiceStatus:(PermissionGroup)permission completionHandler:(ServiceStatusHandler)completionHandler { 20 | completionHandler(ServiceStatusNotApplicable); 21 | } 22 | 23 | - (void)requestPermission:(PermissionGroup)permission completionHandler:(PermissionStatusHandler)completionHandler errorHandler:(PermissionErrorHandler)errorHandler { 24 | PermissionStatus status = [self checkPermissionStatus:permission]; 25 | if (status != PermissionStatusDenied) { 26 | completionHandler(status); 27 | return; 28 | } 29 | 30 | [INPreferences requestSiriAuthorization:^(INSiriAuthorizationStatus status) { 31 | PermissionStatus permissionStatus = [AssistantPermissionStrategy parsePermission:status]; 32 | completionHandler(permissionStatus); 33 | }]; 34 | } 35 | 36 | + (PermissionStatus)parsePermission:(INSiriAuthorizationStatus)assistantPermission API_AVAILABLE(ios(10)){ 37 | switch(assistantPermission){ 38 | case INSiriAuthorizationStatusAuthorized: 39 | return PermissionStatusGranted; 40 | case INSiriAuthorizationStatusRestricted: 41 | return PermissionStatusRestricted; 42 | case INSiriAuthorizationStatusDenied: 43 | return PermissionStatusPermanentlyDenied; 44 | case INSiriAuthorizationStatusNotDetermined: 45 | return PermissionStatusDenied; 46 | } 47 | } 48 | @end 49 | 50 | #else 51 | 52 | @implementation AssistantPermissionStrategy 53 | @end 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /permission_handler_apple/ios/Classes/strategies/AudioVideoPermissionStrategy.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Razvan Lung(long1eu) on 2019-02-15. 3 | // Copyright (c) 2019 The Chromium Authors. All rights reserved. 4 | // 5 | 6 | #import 7 | #import "PermissionStrategy.h" 8 | 9 | #if PERMISSION_CAMERA | PERMISSION_MICROPHONE 10 | #import 11 | 12 | @interface AudioVideoPermissionStrategy : NSObject 13 | @end 14 | 15 | #else 16 | 17 | #import "UnknownPermissionStrategy.h" 18 | @interface AudioVideoPermissionStrategy : UnknownPermissionStrategy 19 | @end 20 | 21 | #endif 22 | -------------------------------------------------------------------------------- /permission_handler_apple/ios/Classes/strategies/BackgroundRefreshStrategy.h: -------------------------------------------------------------------------------- 1 | // 2 | // BackgroundRefreshStrategy.h 3 | // permission_handler_apple 4 | // 5 | // Created by Sebastian Roth on 28/09/2023. 6 | // 7 | 8 | #import 9 | #import "PermissionStrategy.h" 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface BackgroundRefreshStrategy : NSObject 14 | 15 | @end 16 | 17 | NS_ASSUME_NONNULL_END 18 | -------------------------------------------------------------------------------- /permission_handler_apple/ios/Classes/strategies/BackgroundRefreshStrategy.m: -------------------------------------------------------------------------------- 1 | // 2 | // BackgroundRefreshStrategy.m 3 | // permission_handler_apple 4 | // 5 | // Created by Sebastian Roth on 28/09/2023. 6 | // 7 | 8 | #import "BackgroundRefreshStrategy.h" 9 | 10 | @implementation BackgroundRefreshStrategy 11 | 12 | - (PermissionStatus)checkPermissionStatus:(PermissionGroup)permission { 13 | return [BackgroundRefreshStrategy permissionStatus]; 14 | } 15 | 16 | - (void)checkServiceStatus:(PermissionGroup)permission completionHandler:(ServiceStatusHandler)completionHandler { 17 | completionHandler(ServiceStatusNotApplicable); 18 | } 19 | 20 | - (void)requestPermission:(PermissionGroup)permission completionHandler:(PermissionStatusHandler)completionHandler errorHandler:(PermissionErrorHandler)errorHandler { 21 | completionHandler([BackgroundRefreshStrategy permissionStatus]); 22 | } 23 | 24 | + (PermissionStatus) permissionStatus { 25 | UIBackgroundRefreshStatus status = UIApplication.sharedApplication.backgroundRefreshStatus; 26 | switch (status) { 27 | case UIBackgroundRefreshStatusDenied: 28 | return PermissionStatusDenied; 29 | case UIBackgroundRefreshStatusRestricted: 30 | return PermissionStatusRestricted; 31 | case UIBackgroundRefreshStatusAvailable: 32 | return PermissionStatusGranted; 33 | default: 34 | return PermissionStatusDenied; 35 | } 36 | } 37 | 38 | @end 39 | -------------------------------------------------------------------------------- /permission_handler_apple/ios/Classes/strategies/BluetoothPermissionStrategy.h: -------------------------------------------------------------------------------- 1 | // 2 | // BluetoothPermissionStrategy.h 3 | // permission_handler 4 | // 5 | // Created by Rene Floor on 12/03/2021. 6 | // 7 | 8 | #import 9 | #import "PermissionStrategy.h" 10 | 11 | #if PERMISSION_BLUETOOTH 12 | 13 | #import 14 | 15 | @interface BluetoothPermissionStrategy : NSObject 16 | - (void)initManagerIfNeeded; 17 | @end 18 | 19 | #else 20 | 21 | #import "UnknownPermissionStrategy.h" 22 | 23 | @interface BluetoothPermissionStrategy : UnknownPermissionStrategy 24 | @end 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /permission_handler_apple/ios/Classes/strategies/ContactPermissionStrategy.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Razvan Lung(long1eu) on 2019-02-15. 3 | // Copyright (c) 2019 The Chromium Authors. All rights reserved. 4 | // 5 | 6 | #import 7 | #import "PermissionStrategy.h" 8 | 9 | #if PERMISSION_CONTACTS 10 | 11 | #import 12 | #import 13 | 14 | @interface ContactPermissionStrategy : NSObject 15 | @end 16 | 17 | #else 18 | 19 | #import "UnknownPermissionStrategy.h" 20 | @interface ContactPermissionStrategy : UnknownPermissionStrategy 21 | @end 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /permission_handler_apple/ios/Classes/strategies/CriticalAlertsPermissionStrategy.h: -------------------------------------------------------------------------------- 1 | // 2 | // CriticalAlertsPermissionStrategy.h 3 | // permission_handler 4 | // 5 | // Created by Neal Soni on 2021/6/8. 6 | // 7 | 8 | #import 9 | #import "PermissionStrategy.h" 10 | 11 | #if PERMISSION_CRITICAL_ALERTS 12 | 13 | #import 14 | 15 | @interface CriticalAlertsPermissionStrategy : NSObject 16 | 17 | @end 18 | 19 | #else 20 | 21 | #import "UnknownPermissionStrategy.h" 22 | @interface CriticalAlertsPermissionStrategy : UnknownPermissionStrategy 23 | @end 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /permission_handler_apple/ios/Classes/strategies/EventPermissionStrategy.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Razvan Lung(long1eu) on 2019-02-15. 3 | // Copyright (c) 2019 The Chromium Authors. All rights reserved. 4 | // 5 | 6 | #import 7 | #import "PermissionStrategy.h" 8 | 9 | #if PERMISSION_EVENTS | PERMISSION_EVENTS_FULL_ACCESS | PERMISSION_REMINDERS 10 | 11 | #import 12 | 13 | @interface EventPermissionStrategy : NSObject 14 | @end 15 | 16 | #else 17 | 18 | #import "UnknownPermissionStrategy.h" 19 | @interface EventPermissionStrategy : UnknownPermissionStrategy 20 | @end 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /permission_handler_apple/ios/Classes/strategies/LocationPermissionStrategy.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Razvan Lung(long1eu) on 2019-02-15. 3 | // Copyright (c) 2019 The Chromium Authors. All rights reserved. 4 | // 5 | 6 | #import 7 | #import "PermissionStrategy.h" 8 | 9 | #if PERMISSION_LOCATION || PERMISSION_LOCATION_WHENINUSE || PERMISSION_LOCATION_ALWAYS 10 | 11 | #import 12 | 13 | @interface LocationPermissionStrategy : NSObject 14 | - (instancetype)initWithLocationManager; 15 | @end 16 | 17 | #else 18 | 19 | #import "UnknownPermissionStrategy.h" 20 | @interface LocationPermissionStrategy : UnknownPermissionStrategy 21 | @end 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /permission_handler_apple/ios/Classes/strategies/MediaLibraryPermissionStrategy.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Razvan Lung(long1eu) on 2019-02-15. 3 | // Copyright (c) 2019 The Chromium Authors. All rights reserved. 4 | // 5 | 6 | #import 7 | #include "PermissionStrategy.h" 8 | 9 | #if PERMISSION_MEDIA_LIBRARY 10 | 11 | #import 12 | 13 | @interface MediaLibraryPermissionStrategy : NSObject 14 | @end 15 | 16 | #else 17 | 18 | #import "UnknownPermissionStrategy.h" 19 | @interface MediaLibraryPermissionStrategy : UnknownPermissionStrategy 20 | @end 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /permission_handler_apple/ios/Classes/strategies/MediaLibraryPermissionStrategy.m: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Razvan Lung(long1eu) on 2019-02-15. 3 | // Copyright (c) 2019 The Chromium Authors. All rights reserved. 4 | // 5 | 6 | #import "MediaLibraryPermissionStrategy.h" 7 | 8 | #if PERMISSION_MEDIA_LIBRARY 9 | 10 | @implementation MediaLibraryPermissionStrategy 11 | 12 | - (PermissionStatus)checkPermissionStatus:(PermissionGroup)permission { 13 | return [MediaLibraryPermissionStrategy permissionStatus]; 14 | } 15 | 16 | - (void)checkServiceStatus:(PermissionGroup)permission completionHandler:(ServiceStatusHandler)completionHandler { 17 | completionHandler(ServiceStatusNotApplicable); 18 | } 19 | 20 | - (void)requestPermission:(PermissionGroup)permission completionHandler:(PermissionStatusHandler)completionHandler errorHandler:(PermissionErrorHandler)errorHandler { 21 | PermissionStatus status = [self checkPermissionStatus:permission]; 22 | if (status != PermissionStatusDenied) { 23 | completionHandler(status); 24 | return; 25 | } 26 | 27 | [MPMediaLibrary requestAuthorization:^(MPMediaLibraryAuthorizationStatus status) { 28 | completionHandler([MediaLibraryPermissionStrategy determinePermissionStatus:status]); 29 | }]; 30 | } 31 | 32 | + (PermissionStatus)permissionStatus { 33 | MPMediaLibraryAuthorizationStatus status = [MPMediaLibrary authorizationStatus]; 34 | 35 | return [MediaLibraryPermissionStrategy determinePermissionStatus:status]; 36 | } 37 | 38 | + (PermissionStatus)determinePermissionStatus:(MPMediaLibraryAuthorizationStatus)authorizationStatus API_AVAILABLE(ios(9.3)){ 39 | switch (authorizationStatus) { 40 | case MPMediaLibraryAuthorizationStatusNotDetermined: 41 | return PermissionStatusDenied; 42 | case MPMediaLibraryAuthorizationStatusDenied: 43 | return PermissionStatusPermanentlyDenied; 44 | case MPMediaLibraryAuthorizationStatusRestricted: 45 | return PermissionStatusRestricted; 46 | case MPMediaLibraryAuthorizationStatusAuthorized: 47 | return PermissionStatusGranted; 48 | } 49 | 50 | return PermissionStatusDenied; 51 | } 52 | 53 | @end 54 | 55 | #else 56 | 57 | @implementation MediaLibraryPermissionStrategy 58 | @end 59 | 60 | #endif 61 | -------------------------------------------------------------------------------- /permission_handler_apple/ios/Classes/strategies/NotificationPermissionStrategy.h: -------------------------------------------------------------------------------- 1 | // 2 | // NotificationPermissionStrategy.h 3 | // permission_handler 4 | // 5 | // Created by Tong on 2019/10/21. 6 | // 7 | 8 | #import 9 | #import "PermissionStrategy.h" 10 | 11 | #if PERMISSION_NOTIFICATIONS 12 | 13 | #import 14 | 15 | @interface NotificationPermissionStrategy : NSObject 16 | 17 | @end 18 | 19 | #else 20 | 21 | #import "UnknownPermissionStrategy.h" 22 | @interface NotificationPermissionStrategy : UnknownPermissionStrategy 23 | @end 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /permission_handler_apple/ios/Classes/strategies/PermissionStrategy.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Razvan Lung(long1eu) on 2019-02-15. 3 | // Copyright (c) 2019 The Chromium Authors. All rights reserved. 4 | // 5 | 6 | #import 7 | #import "PermissionHandlerEnums.h" 8 | 9 | typedef void (^ServiceStatusHandler)(ServiceStatus serviceStatus); 10 | typedef void (^PermissionStatusHandler)(PermissionStatus permissionStatus); 11 | typedef void (^PermissionErrorHandler)(NSString* errorCode, NSString* errorDescription); 12 | 13 | @protocol PermissionStrategy 14 | - (PermissionStatus)checkPermissionStatus:(PermissionGroup)permission; 15 | 16 | - (void)checkServiceStatus:(PermissionGroup)permission completionHandler:(ServiceStatusHandler)completionHandler; 17 | 18 | - (void)requestPermission:(PermissionGroup)permission completionHandler:(PermissionStatusHandler)completionHandler errorHandler:(PermissionErrorHandler)errorHandler; 19 | @end 20 | -------------------------------------------------------------------------------- /permission_handler_apple/ios/Classes/strategies/PhonePermissionStrategy.h: -------------------------------------------------------------------------------- 1 | // 2 | // PhonePermissionStrategy.h 3 | // permission_handler 4 | // 5 | // Created by Sebastian Roth on 5/20/19. 6 | // 7 | 8 | #import 9 | #import "PermissionStrategy.h" 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface PhonePermissionStrategy : NSObject 14 | 15 | @end 16 | 17 | NS_ASSUME_NONNULL_END 18 | -------------------------------------------------------------------------------- /permission_handler_apple/ios/Classes/strategies/PhonePermissionStrategy.m: -------------------------------------------------------------------------------- 1 | // 2 | // PhonePermissionStrategy.m 3 | // permission_handler 4 | // 5 | // Created by Sebastian Roth on 5/20/19. 6 | // 7 | 8 | #import 9 | #import 10 | 11 | #import "PhonePermissionStrategy.h" 12 | 13 | @implementation PhonePermissionStrategy 14 | 15 | - (PermissionStatus)checkPermissionStatus:(PermissionGroup)permission { 16 | return PermissionStatusDenied; 17 | } 18 | 19 | - (void)checkServiceStatus:(PermissionGroup)permission completionHandler:(ServiceStatusHandler)completionHandler { 20 | // https://stackoverflow.com/a/5095058 21 | if (![[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"tel://"]]) { 22 | completionHandler(ServiceStatusNotApplicable); 23 | } 24 | completionHandler([self canDevicePlaceAPhoneCall] ? ServiceStatusEnabled : ServiceStatusDisabled); 25 | } 26 | 27 | - (void)requestPermission:(PermissionGroup)permission completionHandler:(PermissionStatusHandler)completionHandler errorHandler:(PermissionErrorHandler)errorHandler { 28 | completionHandler(PermissionStatusPermanentlyDenied); 29 | } 30 | 31 | 32 | /** 33 | * Returns YES if the device can place a phone call. 34 | */ 35 | -(bool) canDevicePlaceAPhoneCall { 36 | CTTelephonyNetworkInfo *netInfo = [[CTTelephonyNetworkInfo alloc] init]; 37 | 38 | if(@available(iOS 12.0, *)) { 39 | NSDictionary *providers = [netInfo serviceSubscriberCellularProviders]; 40 | for (NSString *key in providers) { 41 | CTCarrier *carrier = [providers objectForKey:key]; 42 | if ([self canPlacePhoneCallWithCarrier:carrier]) { 43 | return YES; 44 | } 45 | } 46 | 47 | return NO; 48 | } else { 49 | CTCarrier *carrier = [netInfo subscriberCellularProvider]; 50 | return [self canPlacePhoneCallWithCarrier:carrier]; 51 | } 52 | } 53 | 54 | -(bool)canPlacePhoneCallWithCarrier:(CTCarrier *)carrier { 55 | // https://stackoverflow.com/a/11595365 56 | NSString *mnc = [carrier mobileNetworkCode]; 57 | if (([mnc length] == 0) || ([mnc isEqualToString:@"65535"])) { 58 | // Device cannot place a call at this time. SIM might be removed. 59 | return NO; 60 | } else { 61 | // Device can place a phone call 62 | return YES; 63 | } 64 | } 65 | 66 | @end 67 | -------------------------------------------------------------------------------- /permission_handler_apple/ios/Classes/strategies/PhotoPermissionStrategy.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Razvan Lung(long1eu) on 2019-02-15. 3 | // Copyright (c) 2019 The Chromium Authors. All rights reserved. 4 | // 5 | 6 | #import 7 | #import "PermissionStrategy.h" 8 | 9 | #if PERMISSION_PHOTOS 10 | 11 | #import 12 | 13 | @interface PhotoPermissionStrategy : NSObject 14 | -(instancetype)initWithAccessAddOnly:(BOOL) addOnly; 15 | @end 16 | 17 | #else 18 | 19 | #import "UnknownPermissionStrategy.h" 20 | @interface PhotoPermissionStrategy : UnknownPermissionStrategy 21 | @end 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /permission_handler_apple/ios/Classes/strategies/SensorPermissionStrategy.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Razvan Lung(long1eu) on 2019-02-15. 3 | // Copyright (c) 2019 The Chromium Authors. All rights reserved. 4 | // 5 | 6 | #import 7 | #import "PermissionStrategy.h" 8 | 9 | #if PERMISSION_SENSORS 10 | 11 | #import 12 | 13 | @interface SensorPermissionStrategy : NSObject 14 | @end 15 | 16 | #else 17 | 18 | #import "UnknownPermissionStrategy.h" 19 | @interface SensorPermissionStrategy : UnknownPermissionStrategy 20 | @end 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /permission_handler_apple/ios/Classes/strategies/SpeechPermissionStrategy.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Razvan Lung(long1eu) on 2019-02-15. 3 | // Copyright (c) 2019 The Chromium Authors. All rights reserved. 4 | // 5 | 6 | #import 7 | #import "PermissionStrategy.h" 8 | 9 | #if PERMISSION_SPEECH_RECOGNIZER 10 | 11 | #import 12 | 13 | @interface SpeechPermissionStrategy : NSObject 14 | @end 15 | 16 | #else 17 | 18 | #import "UnknownPermissionStrategy.h" 19 | @interface SpeechPermissionStrategy : UnknownPermissionStrategy 20 | @end 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /permission_handler_apple/ios/Classes/strategies/SpeechPermissionStrategy.m: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Razvan Lung(long1eu) on 2019-02-15. 3 | // Copyright (c) 2019 The Chromium Authors. All rights reserved. 4 | // 5 | 6 | #import "SpeechPermissionStrategy.h" 7 | 8 | #if PERMISSION_SPEECH_RECOGNIZER 9 | 10 | @implementation SpeechPermissionStrategy 11 | - (PermissionStatus)checkPermissionStatus:(PermissionGroup)permission { 12 | return [SpeechPermissionStrategy permissionStatus]; 13 | } 14 | 15 | - (void)checkServiceStatus:(PermissionGroup)permission completionHandler:(ServiceStatusHandler)completionHandler { 16 | completionHandler(ServiceStatusNotApplicable); 17 | } 18 | 19 | - (void)requestPermission:(PermissionGroup)permission completionHandler:(PermissionStatusHandler)completionHandler errorHandler:(PermissionErrorHandler)errorHandler { 20 | PermissionStatus status = [self checkPermissionStatus:permission]; 21 | 22 | if (status != PermissionStatusDenied) { 23 | completionHandler(status); 24 | return; 25 | } 26 | 27 | [SFSpeechRecognizer requestAuthorization:^(SFSpeechRecognizerAuthorizationStatus authorizationStatus) { 28 | completionHandler([SpeechPermissionStrategy determinePermissionStatus:authorizationStatus]); 29 | }]; 30 | } 31 | 32 | + (PermissionStatus)permissionStatus { 33 | SFSpeechRecognizerAuthorizationStatus status = [SFSpeechRecognizer authorizationStatus]; 34 | 35 | return [SpeechPermissionStrategy determinePermissionStatus:status]; 36 | } 37 | 38 | + (PermissionStatus)determinePermissionStatus:(SFSpeechRecognizerAuthorizationStatus)authorizationStatus API_AVAILABLE(ios(10.0)){ 39 | switch (authorizationStatus) { 40 | case SFSpeechRecognizerAuthorizationStatusNotDetermined: 41 | return PermissionStatusDenied; 42 | case SFSpeechRecognizerAuthorizationStatusDenied: 43 | return PermissionStatusPermanentlyDenied; 44 | case SFSpeechRecognizerAuthorizationStatusRestricted: 45 | return PermissionStatusRestricted; 46 | case SFSpeechRecognizerAuthorizationStatusAuthorized: 47 | return PermissionStatusGranted; 48 | } 49 | 50 | return PermissionStatusDenied; 51 | } 52 | 53 | @end 54 | 55 | #else 56 | 57 | @implementation SpeechPermissionStrategy 58 | @end 59 | 60 | #endif 61 | -------------------------------------------------------------------------------- /permission_handler_apple/ios/Classes/strategies/StoragePermissionStrategy.h: -------------------------------------------------------------------------------- 1 | // 2 | // StoragePermissionStrategy.h 3 | // permission_handler 4 | // 5 | // Created by Frank Gregor on 06.11.19. 6 | // 7 | 8 | #import 9 | #import "PermissionStrategy.h" 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @interface StoragePermissionStrategy : NSObject 14 | 15 | @end 16 | 17 | NS_ASSUME_NONNULL_END 18 | -------------------------------------------------------------------------------- /permission_handler_apple/ios/Classes/strategies/StoragePermissionStrategy.m: -------------------------------------------------------------------------------- 1 | // 2 | // StoragePermissionStrategy.m 3 | // permission_handler 4 | // 5 | // Created by Frank Gregor on 06.11.19. 6 | // 7 | 8 | #import "StoragePermissionStrategy.h" 9 | 10 | @implementation StoragePermissionStrategy 11 | 12 | - (PermissionStatus)checkPermissionStatus:(PermissionGroup)permission { 13 | return [StoragePermissionStrategy permissionStatus]; 14 | } 15 | 16 | - (void)checkServiceStatus:(PermissionGroup)permission completionHandler:(ServiceStatusHandler)completionHandler { 17 | completionHandler(ServiceStatusNotApplicable); 18 | } 19 | 20 | - (void)requestPermission:(PermissionGroup)permission completionHandler:(PermissionStatusHandler)completionHandler errorHandler:(PermissionErrorHandler)errorHandler { 21 | completionHandler([StoragePermissionStrategy permissionStatus]); 22 | } 23 | 24 | + (PermissionStatus)permissionStatus { 25 | return PermissionStatusGranted; 26 | } 27 | 28 | @end 29 | -------------------------------------------------------------------------------- /permission_handler_apple/ios/Classes/strategies/UnknownPermissionStrategy.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Razvan Lung(long1eu) on 2019-02-15. 3 | // Copyright (c) 2019 The Chromium Authors. All rights reserved. 4 | // 5 | 6 | #import 7 | #import "PermissionStrategy.h" 8 | 9 | 10 | @interface UnknownPermissionStrategy : NSObject 11 | @end -------------------------------------------------------------------------------- /permission_handler_apple/ios/Classes/strategies/UnknownPermissionStrategy.m: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Razvan Lung(long1eu) on 2019-02-15. 3 | // Copyright (c) 2019 The Chromium Authors. All rights reserved. 4 | // 5 | 6 | #import "UnknownPermissionStrategy.h" 7 | 8 | 9 | @implementation UnknownPermissionStrategy 10 | 11 | - (PermissionStatus)checkPermissionStatus:(PermissionGroup)permission { 12 | return PermissionStatusDenied; 13 | } 14 | 15 | - (void)checkServiceStatus:(PermissionGroup)permission completionHandler:(ServiceStatusHandler)completionHandler { 16 | completionHandler(ServiceStatusDisabled); 17 | } 18 | 19 | - (void)requestPermission:(PermissionGroup)permission completionHandler:(PermissionStatusHandler)completionHandler errorHandler:(PermissionErrorHandler)errorHandler { 20 | completionHandler(PermissionStatusPermanentlyDenied); 21 | } 22 | @end 23 | -------------------------------------------------------------------------------- /permission_handler_apple/ios/Classes/util/Codec.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Razvan Lung on 2019-02-15. 3 | // Copyright (c) 2019 The Chromium Authors. All rights reserved. 4 | // 5 | 6 | #import 7 | #import "PermissionHandlerEnums.h" 8 | 9 | @interface Codec : NSObject 10 | + (PermissionGroup)decodePermissionGroupFrom:(NSNumber *_Nonnull)event; 11 | 12 | + (NSArray*_Nullable)decodePermissionGroupsFrom:(NSArray *_Nullable)event; 13 | 14 | + (NSNumber *_Nullable)encodePermissionStatus:(enum PermissionStatus)permissionStatus; 15 | 16 | + (NSNumber *_Nullable)encodeServiceStatus:(enum ServiceStatus)serviceStatus; 17 | @end 18 | -------------------------------------------------------------------------------- /permission_handler_apple/ios/Classes/util/Codec.m: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Razvan Lung on 2019-02-15. 3 | // Copyright (c) 2019 The Chromium Authors. All rights reserved. 4 | // 5 | 6 | #import "Codec.h" 7 | 8 | @implementation Codec 9 | + (PermissionGroup)decodePermissionGroupFrom:(NSNumber *)event { 10 | return (PermissionGroup) event.intValue; 11 | } 12 | 13 | + (NSArray *_Nullable)decodePermissionGroupsFrom:(NSArray *)event { 14 | NSMutableArray *result = [[NSMutableArray alloc] init]; 15 | for (NSNumber *number in event) { 16 | [result addObject:@([self decodePermissionGroupFrom:number])]; 17 | } 18 | return [[NSArray alloc] initWithArray:result]; 19 | } 20 | 21 | + (NSNumber *_Nullable)encodePermissionStatus:(enum PermissionStatus)permissionStatus { 22 | return [[NSNumber alloc] initWithInt:permissionStatus]; 23 | } 24 | 25 | + (NSNumber *_Nullable)encodeServiceStatus:(enum ServiceStatus)serviceStatus { 26 | return [[NSNumber alloc] initWithInt:serviceStatus]; 27 | } 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /permission_handler_apple/ios/Resources/PrivacyInfo.xcprivacy: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | NSPrivacyTrackingDomains 6 | 7 | NSPrivacyAccessedAPITypes 8 | 9 | 10 | NSPrivacyAccessedAPIType 11 | NSPrivacyAccessedAPICategoryUserDefaults 12 | NSPrivacyAccessedAPITypeReasons 13 | 14 | 1C8F.1 15 | 16 | 17 | 18 | NSPrivacyCollectedDataTypes 19 | 20 | NSPrivacyTracking 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /permission_handler_apple/ios/permission_handler_apple.podspec: -------------------------------------------------------------------------------- 1 | # 2 | # To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html 3 | # 4 | Pod::Spec.new do |s| 5 | s.name = 'permission_handler_apple' 6 | s.version = '9.3.0' 7 | s.summary = 'Permission plugin for Flutter.' 8 | s.description = <<-DESC 9 | Permission plugin for Flutter. This plugin provides a cross-platform (iOS, Android) API to request and check permissions. 10 | DESC 11 | s.homepage = 'https://github.com/baseflowit/flutter-permission-handler' 12 | s.license = { :file => '../LICENSE' } 13 | s.author = { 'Baseflow' => 'hello@baseflow.com' } 14 | s.source = { :path => '.' } 15 | s.source_files = 'Classes/**/*' 16 | s.public_header_files = 'Classes/**/*.h' 17 | s.dependency 'Flutter' 18 | 19 | s.ios.deployment_target = '8.0' 20 | s.static_framework = true 21 | s.resource_bundles = {'permission_handler_apple_privacy' => ['Resources/PrivacyInfo.xcprivacy']} 22 | end 23 | 24 | -------------------------------------------------------------------------------- /permission_handler_apple/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: permission_handler_apple 2 | description: Permission plugin for Flutter. This plugin provides the iOS API to request and check permissions. 3 | repository: https://github.com/baseflow/flutter-permission-handler 4 | issue_tracker: https://github.com/Baseflow/flutter-permission-handler/issues 5 | version: 9.4.7 6 | 7 | environment: 8 | sdk: ">=2.18.0 <4.0.0" 9 | flutter: ">=3.3.0" 10 | 11 | flutter: 12 | plugin: 13 | implements: permission_handler 14 | platforms: 15 | ios: 16 | pluginClass: PermissionHandlerPlugin 17 | 18 | dependencies: 19 | flutter: 20 | sdk: flutter 21 | permission_handler_platform_interface: ^4.2.0 22 | 23 | dev_dependencies: 24 | flutter_lints: ^1.0.4 25 | plugin_platform_interface: ^2.0.0 26 | -------------------------------------------------------------------------------- /permission_handler_html/.metadata: -------------------------------------------------------------------------------- 1 | # This file tracks properties of this Flutter project. 2 | # Used by Flutter tool to assess capabilities and perform upgrades etc. 3 | # 4 | # This file should be version controlled and should not be manually edited. 5 | 6 | version: 7 | revision: 796c8ef79279f9c774545b3771238c3098dbefab 8 | channel: stable 9 | 10 | project_type: package 11 | -------------------------------------------------------------------------------- /permission_handler_html/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## 0.1.3+5 2 | 3 | - Updates the way how `window.navigator.mediaDevices` is accessed to keep supporting WASM. 4 | 5 | ## 0.1.3+4 6 | 7 | - Fixes a bug causing the application to crash when running on HTTP protocol (not HTTPS or localhost) and the `window.navigator.mediaDevices` property is `null`. 8 | 9 | ## 0.1.3+3 10 | 11 | - Safari < 16 compatibility: Don't crash on missing `window.navigator.permissions` property 12 | 13 | ## 0.1.3+2 14 | 15 | - `web: 1.0.0` compatibility: `PermissionDescriptor` was removed in web package. 16 | 17 | ## 0.1.3+1 18 | 19 | - Fixes the PermissionDescriptor Error when getting the permission status. 20 | 21 | ## 0.1.3 22 | 23 | * Adds support for `web: ^1.0.0` 24 | 25 | ## 0.1.2 26 | 27 | - Migrate to package:web and adding wasm support. 28 | 29 | ## 0.1.1 30 | 31 | - Updates the dependency on `permission_handler_platform_interface` to version 4.1.0 (SiriKit support is only available for iOS and macOS). 32 | 33 | ## 0.1.0+2 34 | 35 | - Fixes plugin initialization for non-https web app. 36 | - Fixes location permission name. 37 | - Improves error handling in the example app. 38 | 39 | ## 0.1.0+1 40 | 41 | - Updates `permission_handler_platform_interface` dependency to version `^4.0.2`. 42 | 43 | ## 0.1.0 44 | 45 | - Adds an initial implementation of Web support for the permission_handler plugin with camera, notifications, and microphone permissions available. 46 | -------------------------------------------------------------------------------- /permission_handler_html/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Baseflow 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /permission_handler_html/README.md: -------------------------------------------------------------------------------- 1 | # permission_handler_html 2 | 3 | [![pub package](https://img.shields.io/pub/v/permission_handler_html.svg)](https://pub.dartlang.org/packages/permission_handler_html) ![Build status](https://github.com/Baseflow/flutter-permission-handler/workflows/permission_handler_html/badge.svg?branch=master) [![style: flutter lints](https://img.shields.io/badge/style-flutter_lints-40c4ff.svg)](https://pub.dev/packages/flutter_lints) 4 | 5 | The official web implementation of the [permission_handler](https://pub.dev/packages/permission_handler) plugin by [Baseflow](https://baseflow.com). 6 | 7 | ## Usage 8 | 9 | This is the officially endorsed web implementation of the permission_handler plugin. This means it will automatically be added to your dependencies when you depend on `permission_handler` in your applications pubspec.yaml. 10 | 11 | More detailed instructions on using the API can be found in the [README.md](../permission_handler/README.md) of the [permission_handler](https://pub.dev/packages/permission_handler) package. 12 | 13 | ## Issues 14 | 15 | Please file any issues, bugs, or feature requests as an issue on our [GitHub](https://github.com/Baseflow/flutter-permission-handler/issues) page. Commercial support is available, you can contact us at . 16 | 17 | ## Want to contribute 18 | 19 | If you would like to contribute to the plugin (e.g. by improving the documentation, solving a bug, or adding a cool new feature), please carefully review our [contribution guide](../CONTRIBUTING.md) and send us your [pull request](https://github.com/Baseflow/flutter-permission-handler/pulls). 20 | 21 | ## Author 22 | 23 | This permission_handler plugin for Flutter is developed by [Baseflow](https://baseflow.com). 24 | -------------------------------------------------------------------------------- /permission_handler_html/example/.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .history 10 | .svn/ 11 | migrate_working_dir/ 12 | 13 | # IntelliJ related 14 | *.iml 15 | *.ipr 16 | *.iws 17 | .idea/ 18 | 19 | # The .vscode folder contains launch configuration and tasks you configure in 20 | # VS Code which you may wish to be included in version control, so this line 21 | # is commented out by default. 22 | #.vscode/ 23 | 24 | # Flutter/Dart/Pub related 25 | **/doc/api/ 26 | **/ios/Flutter/.last_build_id 27 | .dart_tool/ 28 | .flutter-plugins 29 | .flutter-plugins-dependencies 30 | .packages 31 | .pub-cache/ 32 | .pub/ 33 | /build/ 34 | 35 | # Symbolication related 36 | app.*.symbols 37 | 38 | # Obfuscation related 39 | app.*.map.json 40 | 41 | # Android Studio will place build artifacts here 42 | /android/app/debug 43 | /android/app/profile 44 | /android/app/release 45 | -------------------------------------------------------------------------------- /permission_handler_html/example/.metadata: -------------------------------------------------------------------------------- 1 | # This file tracks properties of this Flutter project. 2 | # Used by Flutter tool to assess capabilities and perform upgrades etc. 3 | # 4 | # This file should be version controlled. 5 | 6 | version: 7 | revision: 796c8ef79279f9c774545b3771238c3098dbefab 8 | channel: stable 9 | 10 | project_type: app 11 | 12 | # Tracks metadata for the flutter migrate command 13 | migration: 14 | platforms: 15 | - platform: root 16 | create_revision: 796c8ef79279f9c774545b3771238c3098dbefab 17 | base_revision: 796c8ef79279f9c774545b3771238c3098dbefab 18 | - platform: android 19 | create_revision: 796c8ef79279f9c774545b3771238c3098dbefab 20 | base_revision: 796c8ef79279f9c774545b3771238c3098dbefab 21 | - platform: ios 22 | create_revision: 796c8ef79279f9c774545b3771238c3098dbefab 23 | base_revision: 796c8ef79279f9c774545b3771238c3098dbefab 24 | - platform: linux 25 | create_revision: 796c8ef79279f9c774545b3771238c3098dbefab 26 | base_revision: 796c8ef79279f9c774545b3771238c3098dbefab 27 | - platform: macos 28 | create_revision: 796c8ef79279f9c774545b3771238c3098dbefab 29 | base_revision: 796c8ef79279f9c774545b3771238c3098dbefab 30 | - platform: web 31 | create_revision: 796c8ef79279f9c774545b3771238c3098dbefab 32 | base_revision: 796c8ef79279f9c774545b3771238c3098dbefab 33 | - platform: windows 34 | create_revision: 796c8ef79279f9c774545b3771238c3098dbefab 35 | base_revision: 796c8ef79279f9c774545b3771238c3098dbefab 36 | 37 | # User provided section 38 | 39 | # List of Local paths (relative to this file) that should be 40 | # ignored by the migrate tool. 41 | # 42 | # Files that are not part of the templates will be ignored by default. 43 | unmanaged_files: 44 | - 'lib/main.dart' 45 | - 'ios/Runner.xcodeproj/project.pbxproj' 46 | -------------------------------------------------------------------------------- /permission_handler_html/example/README.md: -------------------------------------------------------------------------------- 1 | # example 2 | 3 | A new Flutter project. 4 | 5 | ## Getting Started 6 | 7 | This project is a starting point for a Flutter application. 8 | 9 | A few resources to get you started if this is your first Flutter project: 10 | 11 | - [Lab: Write your first Flutter app](https://docs.flutter.dev/get-started/codelab) 12 | - [Cookbook: Useful Flutter samples](https://docs.flutter.dev/cookbook) 13 | 14 | For help getting started with Flutter development, view the 15 | [online documentation](https://docs.flutter.dev/), which offers tutorials, 16 | samples, guidance on mobile development, and a full API reference. 17 | -------------------------------------------------------------------------------- /permission_handler_html/example/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: permission_handler_html_example 2 | description: Demonstrates how to use the permission_handler_html plugin. 3 | 4 | environment: 5 | sdk: ">=3.0.5 <4.0.0" 6 | 7 | dependencies: 8 | permission_handler_platform_interface: ^4.2.0 9 | baseflow_plugin_template: ^2.1.2 10 | flutter: 11 | sdk: flutter 12 | 13 | dev_dependencies: 14 | integration_test: 15 | sdk: flutter 16 | flutter_test: 17 | sdk: flutter 18 | 19 | permission_handler_html: 20 | # When depending on this package from a real application you should use: 21 | # permission_handler_web: ^x.y.z 22 | # See https://dart.dev/tools/pub/dependencies#version-constraints 23 | # The example app is bundled with the plugin so we use a path dependency on 24 | # the parent directory to use the current plugin's version. 25 | path: ../ 26 | 27 | url_launcher: ^6.0.12 28 | 29 | flutter: 30 | uses-material-design: true 31 | -------------------------------------------------------------------------------- /permission_handler_html/example/web/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Baseflow/flutter-permission-handler/c438a1f29cdbe9b46b118ed58dc6e88b43524f74/permission_handler_html/example/web/favicon.png -------------------------------------------------------------------------------- /permission_handler_html/example/web/icons/Icon-192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Baseflow/flutter-permission-handler/c438a1f29cdbe9b46b118ed58dc6e88b43524f74/permission_handler_html/example/web/icons/Icon-192.png -------------------------------------------------------------------------------- /permission_handler_html/example/web/icons/Icon-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Baseflow/flutter-permission-handler/c438a1f29cdbe9b46b118ed58dc6e88b43524f74/permission_handler_html/example/web/icons/Icon-512.png -------------------------------------------------------------------------------- /permission_handler_html/example/web/icons/Icon-maskable-192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Baseflow/flutter-permission-handler/c438a1f29cdbe9b46b118ed58dc6e88b43524f74/permission_handler_html/example/web/icons/Icon-maskable-192.png -------------------------------------------------------------------------------- /permission_handler_html/example/web/icons/Icon-maskable-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Baseflow/flutter-permission-handler/c438a1f29cdbe9b46b118ed58dc6e88b43524f74/permission_handler_html/example/web/icons/Icon-maskable-512.png -------------------------------------------------------------------------------- /permission_handler_html/example/web/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | example 34 | 35 | 36 | 39 | 40 | 41 | 42 | 43 | 44 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /permission_handler_html/example/web/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "example", 3 | "short_name": "example", 4 | "start_url": ".", 5 | "display": "standalone", 6 | "background_color": "#0175C2", 7 | "theme_color": "#0175C2", 8 | "description": "A new Flutter project.", 9 | "orientation": "portrait-primary", 10 | "prefer_related_applications": false, 11 | "icons": [ 12 | { 13 | "src": "icons/Icon-192.png", 14 | "sizes": "192x192", 15 | "type": "image/png" 16 | }, 17 | { 18 | "src": "icons/Icon-512.png", 19 | "sizes": "512x512", 20 | "type": "image/png" 21 | }, 22 | { 23 | "src": "icons/Icon-maskable-192.png", 24 | "sizes": "192x192", 25 | "type": "image/png", 26 | "purpose": "maskable" 27 | }, 28 | { 29 | "src": "icons/Icon-maskable-512.png", 30 | "sizes": "512x512", 31 | "type": "image/png", 32 | "purpose": "maskable" 33 | } 34 | ] 35 | } 36 | -------------------------------------------------------------------------------- /permission_handler_html/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: permission_handler_html 2 | description: Permission plugin for Flutter. This plugin provides the web API to request and check permissions. 3 | version: 0.1.3+5 4 | 5 | homepage: https://github.com/baseflow/flutter-permission-handler 6 | 7 | environment: 8 | sdk: ">=3.3.0 <4.0.0" 9 | flutter: ">=3.16.0" 10 | 11 | dependencies: 12 | flutter: 13 | sdk: flutter 14 | flutter_web_plugins: 15 | sdk: flutter 16 | permission_handler_platform_interface: ^4.1.0 17 | web: ">=0.5.1 <2.0.0" 18 | 19 | dev_dependencies: 20 | flutter_test: 21 | sdk: flutter 22 | flutter_lints: ^2.0.0 23 | mockito: ^5.4.2 24 | build_runner: ^2.1.2 25 | test: ^1.24.4 26 | 27 | flutter: 28 | plugin: 29 | implements: permission_handler 30 | platforms: 31 | web: 32 | pluginClass: WebPermissionHandler 33 | fileName: permission_handler_html.dart 34 | -------------------------------------------------------------------------------- /permission_handler_html/test/tests_exist_elsewhere_test.dart: -------------------------------------------------------------------------------- 1 | // ignore_for_file: avoid_print 2 | 3 | import 'package:flutter_test/flutter_test.dart'; 4 | 5 | void main() { 6 | test('Tell the user where to find the real tests', () { 7 | print('---'); 8 | print('This package uses integration_test for its tests.'); 9 | print('See `README.md` for more info.'); 10 | print('---'); 11 | }); 12 | } 13 | -------------------------------------------------------------------------------- /permission_handler_platform_interface/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Baseflow 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /permission_handler_platform_interface/README.md: -------------------------------------------------------------------------------- 1 | # permission_handler_platform_interface 2 | 3 | [![pub package](https://img.shields.io/pub/v/permission_handler_platform_interface.svg)](https://pub.dartlang.org/packages/permission_handler_platform_interface) ![Build status](https://github.com/Baseflow/flutter-permission-handler/workflows/permission_handler_platform_interface/badge.svg?branch=master) [![style: effective dart](https://img.shields.io/badge/style-effective_dart-40c4ff.svg)](https://github.com/tenhobi/effective_dart)[![codecov](https://codecov.io/gh/Baseflow/flutter-permission-handler/branch/master/graph/badge.svg)](https://codecov.io/gh/Baseflow/flutter-permission-handler) 4 | 5 | A common platform interface for the [`permission_handler`][1] plugin. 6 | 7 | This interface allows platform-specific implementations of the 8 | `permission_handler` plugin, as well as the plugin itself, to ensure they are 9 | supporting the same interface. 10 | 11 | # Usage 12 | 13 | To implement a new platform-specific implementation of `permission_handler`, 14 | extend [`PermissionHandlerPlatform`][2] with an implementation that performs 15 | the platform-specific behavior, and when you register your plugin, set the 16 | default `PermissionHandlerPlatform` by calling 17 | `PermissionHandlerPlatform.instance = MyPlatformPermissionHandler()`. 18 | 19 | # Issues 20 | 21 | Please file any issues, bugs, or feature requests as an issue on our [GitHub](https://github.com/Baseflow/flutter-permission-handler/issues) page. 22 | 23 | # Want to contribute 24 | 25 | If you would like to contribute to the plugin (e.g. by improving the documentation, solving a bug, or adding a cool new feature), please carefully review our [contribution guide](../CONTRIBUTING.md) and send us your [pull request](https://github.com/Baseflow/flutter-permission-handler/pulls). 26 | 27 | ## Note on breaking changes 28 | 29 | Strongly prefer non-breaking changes (such as adding a method to the interface) 30 | over breaking changes for this package. 31 | 32 | See https://flutter.dev/go/platform-interface-breaking-changes for a discussion 33 | on why a less clean interface is preferable to a breaking change. 34 | 35 | # Author 36 | 37 | This Permission handler plugin for Flutter is developed by [Baseflow](https://baseflow.com). You can contact us at 38 | 39 | [1]: ../permission_handler 40 | [2]: lib/permission_handler_platform_interface.dart 41 | -------------------------------------------------------------------------------- /permission_handler_platform_interface/analysis_options.yaml: -------------------------------------------------------------------------------- 1 | include: package:flutter_lints/flutter.yaml 2 | 3 | analyzer: 4 | exclude: 5 | # Ignore generated files 6 | - "**/*.g.dart" 7 | - "lib/src/generated/*.dart" 8 | linter: 9 | rules: 10 | - public_member_api_docs 11 | -------------------------------------------------------------------------------- /permission_handler_platform_interface/lib/permission_handler_platform_interface.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | import 'package:meta/meta.dart'; 3 | import 'package:plugin_platform_interface/plugin_platform_interface.dart'; 4 | import 'src/method_channel/method_channel_permission_handler.dart'; 5 | 6 | part 'src/permission_handler_platform_interface.dart'; 7 | part 'src/permission_status.dart'; 8 | part 'src/permissions.dart'; 9 | part 'src/service_status.dart'; 10 | -------------------------------------------------------------------------------- /permission_handler_platform_interface/lib/src/method_channel/utils/codec.dart: -------------------------------------------------------------------------------- 1 | import '../../../permission_handler_platform_interface.dart'; 2 | 3 | /// Converts the given [value] into a [PermissionStatus] instance. 4 | PermissionStatus decodePermissionStatus(int value) { 5 | return PermissionStatusValue.statusByValue(value); 6 | } 7 | 8 | /// Converts the given [value] into a [ServiceStatus] instance. 9 | ServiceStatus decodeServiceStatus(int value) { 10 | return ServiceStatusValue.statusByValue(value); 11 | } 12 | 13 | /// Converts the given [Map] of [int]s into a [Map] with [Permission]s as 14 | /// keys and their respective [PermissionStatus] as value. 15 | Map decodePermissionRequestResult( 16 | Map value) { 17 | return value.map((key, value) => MapEntry( 18 | Permission.byValue(key), PermissionStatusValue.statusByValue(value))); 19 | } 20 | 21 | /// Converts the given [List] of [Permission]s into a [List] of [int]s which 22 | /// can be sent on the Flutter method channel. 23 | List encodePermissions(List permissions) { 24 | return permissions.map((it) => it.value).toList(); 25 | } 26 | -------------------------------------------------------------------------------- /permission_handler_platform_interface/lib/src/service_status.dart: -------------------------------------------------------------------------------- 1 | part of '../permission_handler_platform_interface.dart'; 2 | 3 | /// Defines the different states a service can be in. 4 | enum ServiceStatus { 5 | /// The service for the permission is disabled. 6 | disabled, 7 | 8 | /// The service for the permission is enabled. 9 | enabled, 10 | 11 | /// The permission does not have an associated service on the current 12 | /// platform. 13 | notApplicable, 14 | } 15 | 16 | /// Conversion extension methods for the [ServiceStatus] type. 17 | extension ServiceStatusValue on ServiceStatus { 18 | /// Converts the [ServiceStatus] value into an integer. 19 | int get value { 20 | switch (this) { 21 | case ServiceStatus.disabled: 22 | return 0; 23 | case ServiceStatus.enabled: 24 | return 1; 25 | case ServiceStatus.notApplicable: 26 | return 2; 27 | } 28 | } 29 | 30 | /// Converts the supplied integer value into a [ServiceStatus] enum. 31 | static ServiceStatus statusByValue(int value) { 32 | return [ 33 | ServiceStatus.disabled, 34 | ServiceStatus.enabled, 35 | ServiceStatus.notApplicable, 36 | ][value]; 37 | } 38 | } 39 | 40 | /// Utility getter extensions for the [ServiceStatus] type. 41 | extension ServiceStatusGetters on ServiceStatus { 42 | /// If the service for the permission is disabled. 43 | bool get isDisabled => this == ServiceStatus.disabled; 44 | 45 | /// If the service for the permission is enabled. 46 | bool get isEnabled => this == ServiceStatus.enabled; 47 | 48 | /// If the permission does not have an associated service on the current 49 | /// platform. 50 | bool get isNotApplicable => this == ServiceStatus.notApplicable; 51 | } 52 | 53 | /// Utility getter extensions for the `Future` type. 54 | extension FutureServiceStatusGetters on Future { 55 | /// If the service for the permission is disabled. 56 | Future get isDisabled async => (await this).isDisabled; 57 | 58 | /// If the service for the permission is enabled. 59 | Future get isEnabled async => (await this).isEnabled; 60 | 61 | /// If the permission does not have an associated service on the current 62 | /// platform. 63 | Future get isNotApplicable async => (await this).isNotApplicable; 64 | } 65 | -------------------------------------------------------------------------------- /permission_handler_platform_interface/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: permission_handler_platform_interface 2 | description: A common platform interface for the permission_handler plugin. 3 | homepage: https://github.com/baseflow/flutter-permission-handler/tree/master/permission_handler_platform_interface 4 | # NOTE: We strongly prefer non-breaking changes, even at the expense of a 5 | # less-clean API. See https://flutter.dev/go/platform-interface-breaking-changes 6 | version: 4.3.0 7 | 8 | environment: 9 | sdk: ^3.5.0 10 | flutter: ">=3.24.0" 11 | 12 | dependencies: 13 | flutter: 14 | sdk: flutter 15 | meta: ^1.3.0 16 | plugin_platform_interface: ^2.0.0 17 | 18 | dev_dependencies: 19 | flutter_test: 20 | sdk: flutter 21 | mockito: ^5.4.5 22 | flutter_lints: ^5.0.0 23 | -------------------------------------------------------------------------------- /permission_handler_platform_interface/test/src/method_channel/method_channel_mock.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/services.dart'; 2 | import 'package:flutter_test/flutter_test.dart'; 3 | 4 | class MethodChannelMock { 5 | final MethodChannel methodChannel; 6 | final String method; 7 | final dynamic result; 8 | final Duration delay; 9 | 10 | MethodChannelMock({ 11 | required String channelName, 12 | required this.method, 13 | this.result, 14 | this.delay = Duration.zero, 15 | }) : methodChannel = MethodChannel(channelName) { 16 | TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger 17 | .setMockMethodCallHandler(methodChannel, _handler); 18 | } 19 | 20 | Future _handler(MethodCall methodCall) async { 21 | if (methodCall.method != method) { 22 | throw MissingPluginException('No implementation found for method ' 23 | '$method on channel ${methodChannel.name}'); 24 | } 25 | 26 | return Future.delayed(delay, () { 27 | if (result is Exception) { 28 | throw result; 29 | } 30 | 31 | return Future.value(result); 32 | }); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /permission_handler_platform_interface/test/src/method_channel/utils/coded_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter_test/flutter_test.dart'; 2 | import 'package:permission_handler_platform_interface/permission_handler_platform_interface.dart'; 3 | import 'package:permission_handler_platform_interface/src/method_channel/utils/codec.dart'; 4 | 5 | void main() { 6 | group('Codec', () { 7 | test('decodePermissionStatus should return a PermissionStatus', () { 8 | expect(decodePermissionStatus(0), PermissionStatus.denied); 9 | }); 10 | 11 | test('decodeServiceStatus should a corresponding ServiceStatus', () { 12 | expect(decodeServiceStatus(0), ServiceStatus.disabled); 13 | }); 14 | 15 | test( 16 | 'decodePermissionRequestResult should convert a map' 17 | 'to map', () { 18 | var value = { 19 | 1: 1, 20 | }; 21 | 22 | var permissionMap = decodePermissionRequestResult(value); 23 | 24 | expect(permissionMap.keys.first, isA()); 25 | expect(permissionMap.values.first, isA()); 26 | }); 27 | 28 | test('encodePermissions should return a list of integers', () { 29 | var permissions = [Permission.accessMediaLocation]; 30 | 31 | var integers = encodePermissions(permissions); 32 | 33 | expect(integers.first, isA()); 34 | }); 35 | }); 36 | } 37 | -------------------------------------------------------------------------------- /permission_handler_platform_interface/test/src/service_status_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter_test/flutter_test.dart'; 2 | import 'package:permission_handler_platform_interface/permission_handler_platform_interface.dart'; 3 | 4 | void main() { 5 | group('ServiceStatus', () { 6 | test('ServiceStatus should contain 3 options', () { 7 | const values = ServiceStatus.values; 8 | 9 | expect(values.length, 3); 10 | }); 11 | 12 | test('ServiceStatus enum should have items in correct index', () { 13 | const values = ServiceStatus.values; 14 | 15 | expect(values[0], ServiceStatus.disabled); 16 | expect(values[1], ServiceStatus.enabled); 17 | expect(values[2], ServiceStatus.notApplicable); 18 | }); 19 | }); 20 | 21 | group('ServiceStatusValue', () { 22 | test('ServiceStatusValue returns right integer', () { 23 | expect(ServiceStatus.disabled.value, 0); 24 | expect(ServiceStatus.enabled.value, 1); 25 | expect(ServiceStatus.notApplicable.value, 2); 26 | }); 27 | 28 | test( 29 | // ignore: lines_longer_than_80_chars 30 | 'statusByValue should return right index int that corresponds with the right PermissionStatus', 31 | () { 32 | expect(ServiceStatusValue.statusByValue(0), ServiceStatus.disabled); 33 | expect(ServiceStatusValue.statusByValue(1), ServiceStatus.enabled); 34 | expect(ServiceStatusValue.statusByValue(2), ServiceStatus.notApplicable); 35 | }); 36 | }); 37 | 38 | group('ServiceStatusGetters', () { 39 | test('Getters should return true if statement is met', () { 40 | expect(ServiceStatus.disabled.isDisabled, true); 41 | expect(ServiceStatus.enabled.isEnabled, true); 42 | expect(ServiceStatus.notApplicable.isNotApplicable, true); 43 | }); 44 | 45 | test('Getters should return false if statement is not met', () { 46 | expect(ServiceStatus.disabled.isEnabled, false); 47 | expect(ServiceStatus.enabled.isDisabled, false); 48 | expect(ServiceStatus.notApplicable.isDisabled, false); 49 | }); 50 | }); 51 | } 52 | -------------------------------------------------------------------------------- /permission_handler_windows/AUTHORS: -------------------------------------------------------------------------------- 1 | 2 | # Below is a list of people and organizations that have contributed 3 | # to the Flutter project. Names should be added to the list like so: 4 | # 5 | # Name/Organization 6 | 7 | Baseflow 8 | Alexandre Zollinger Chohfi 9 | Maurits van Beusekom 10 | -------------------------------------------------------------------------------- /permission_handler_windows/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## 0.2.1 2 | 3 | * Updates the dependency on `permission_handler_platform_interface` to version 4.1.0 (SiriKit support is only available for iOS and macOS). 4 | 5 | ## 0.2.0 6 | 7 | * Implements the `Permission.calendarWriteOnly` and `Permission.calendarFullAccess` permissions. 8 | * Bumps `permission_handler_platform_interface` to version `4.0.0`. 9 | 10 | ## 0.1.3 11 | 12 | * Adds the new Android 13 permission "BODY_SENSORS_BACKGROUND" to PermissionHandlerEnums.h. 13 | 14 | ## 0.1.2 15 | 16 | * Adds the new Android 13 permissions "SCHEDULE_EXACT_ALARM, READ_MEDIA_IMAGES, READ_MEDIA_VIDEO and READ_MEDIA_AUDIO" to permission_constants.h. 17 | 18 | ## 0.1.1 19 | 20 | * Adds the new Android 13 NEARBY_WIFI_DEVICES permission to permission_constants.h. 21 | 22 | ## 0.1.0 23 | 24 | * Adds an initial implementation of Windows support for the permission_handler plugin. 25 | -------------------------------------------------------------------------------- /permission_handler_windows/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Baseflow 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /permission_handler_windows/README.md: -------------------------------------------------------------------------------- 1 | # permission_handler_windows 2 | 3 | [![pub package](https://img.shields.io/pub/v/permission_handler_windows.svg)](https://pub.dartlang.org/packages/permission_handler_windows) ![Build status](https://github.com/Baseflow/flutter-permission-handler/workflows/permission_handler_android/badge.svg?branch=master) [![style: flutter lints](https://img.shields.io/badge/style-flutter_lints-40c4ff.svg)](https://pub.dev/packages/flutter_lints) 4 | 5 | The official Windows implementation of the [permission_handler](https://pub.dev/packages/permission_handler) plugin by [Baseflow](https://baseflow.com). 6 | 7 | ## Usage 8 | 9 | Starting from version 9.2.0 of the [permission_handler](https://pub.dev/packages/permission_handler) plugin this is the endorsed Windows implementation. This means it will automatically be added to your dependencies when you depend on `permission_handler: ^9.2.0` in your applications pubspec.yaml. 10 | 11 | More detailed instructions on using the API can be found in the [README.md](../permission_handler/README.md) of the [permission_handler](https://pub.dev/packages/permission_handler) package. 12 | 13 | ## Issues 14 | 15 | Please file any issues, bugs or feature requests as an issue on our [GitHub](https://github.com/Baseflow/flutter-permission-handler/issues) page. Commercial support is available, you can contact us at . 16 | 17 | ## Want to contribute 18 | 19 | If you would like to contribute to the plugin (e.g. by improving the documentation, solving a bug or adding a cool new feature), please carefully review our [contribution guide](../CONTRIBUTING.md) and send us your [pull request](https://github.com/Baseflow/flutter-permission-handler/pulls). 20 | 21 | ## Author 22 | 23 | This permission_handler plugin for Flutter is developed by [Baseflow](https://baseflow.com). 24 | -------------------------------------------------------------------------------- /permission_handler_windows/example/.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .history 10 | .svn/ 11 | 12 | # IntelliJ related 13 | *.iml 14 | *.ipr 15 | *.iws 16 | .idea/ 17 | 18 | # The .vscode folder contains launch configuration and tasks you configure in 19 | # VS Code which you may wish to be included in version control, so this line 20 | # is commented out by default. 21 | #.vscode/ 22 | 23 | # Flutter/Dart/Pub related 24 | **/doc/api/ 25 | **/ios/Flutter/.last_build_id 26 | .dart_tool/ 27 | .flutter-plugins 28 | .flutter-plugins-dependencies 29 | .packages 30 | .pub-cache/ 31 | .pub/ 32 | /build/ 33 | 34 | # Web related 35 | lib/generated_plugin_registrant.dart 36 | 37 | # Symbolication related 38 | app.*.symbols 39 | 40 | # Obfuscation related 41 | app.*.map.json 42 | 43 | # Android Studio will place build artifacts here 44 | /android/app/debug 45 | /android/app/profile 46 | /android/app/release 47 | -------------------------------------------------------------------------------- /permission_handler_windows/example/.metadata: -------------------------------------------------------------------------------- 1 | # This file tracks properties of this Flutter project. 2 | # Used by Flutter tool to assess capabilities and perform upgrades etc. 3 | # 4 | # This file should be version controlled and should not be manually edited. 5 | 6 | version: 7 | revision: db747aa1331bd95bc9b3874c842261ca2d302cd5 8 | channel: stable 9 | 10 | project_type: app 11 | -------------------------------------------------------------------------------- /permission_handler_windows/example/README.md: -------------------------------------------------------------------------------- 1 | # permission_handler_example 2 | 3 | Demonstrates how to use the permission_handler plugin. 4 | 5 | ## Getting Started 6 | 7 | This project is a starting point for a Flutter application. 8 | 9 | A few resources to get you started if this is your first Flutter project: 10 | 11 | - [Lab: Write your first Flutter app](https://flutter.io/docs/get-started/codelab) 12 | - [Cookbook: Useful Flutter samples](https://flutter.io/docs/cookbook) 13 | 14 | For help getting started with Flutter, view our 15 | [online documentation](https://flutter.io/docs), which offers tutorials, 16 | samples, guidance on mobile development, and a full API reference. 17 | -------------------------------------------------------------------------------- /permission_handler_windows/example/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: permission_handler_windows_example 2 | description: Demonstrates how to use the permission_handler_windows plugin. 3 | 4 | environment: 5 | sdk: ">=2.15.0 <3.0.0" 6 | 7 | dependencies: 8 | baseflow_plugin_template: ^2.1.1 9 | flutter: 10 | sdk: flutter 11 | 12 | dev_dependencies: 13 | flutter_test: 14 | sdk: flutter 15 | 16 | permission_handler_windows: 17 | # When depending on this package from a real application you should use: 18 | # permission_handler_windows: ^x.y.z 19 | # See https://dart.dev/tools/pub/dependencies#version-constraints 20 | # The example app is bundled with the plugin so we use a path dependency on 21 | # the parent directory to use the current plugin's version. 22 | path: ../ 23 | 24 | url_launcher: ^6.0.12 25 | 26 | flutter: 27 | uses-material-design: true 28 | 29 | assets: 30 | - res/images/baseflow_logo_def_light-02.png 31 | - res/images/poweredByBaseflowLogoLight@3x.png 32 | - packages/baseflow_plugin_template/logo.png 33 | - packages/baseflow_plugin_template/poweredByBaseflow.png 34 | -------------------------------------------------------------------------------- /permission_handler_windows/example/res/images/baseflow_logo_def_light-02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Baseflow/flutter-permission-handler/c438a1f29cdbe9b46b118ed58dc6e88b43524f74/permission_handler_windows/example/res/images/baseflow_logo_def_light-02.png -------------------------------------------------------------------------------- /permission_handler_windows/example/res/images/poweredByBaseflowLogoLight.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Baseflow/flutter-permission-handler/c438a1f29cdbe9b46b118ed58dc6e88b43524f74/permission_handler_windows/example/res/images/poweredByBaseflowLogoLight.png -------------------------------------------------------------------------------- /permission_handler_windows/example/res/images/poweredByBaseflowLogoLight@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Baseflow/flutter-permission-handler/c438a1f29cdbe9b46b118ed58dc6e88b43524f74/permission_handler_windows/example/res/images/poweredByBaseflowLogoLight@2x.png -------------------------------------------------------------------------------- /permission_handler_windows/example/res/images/poweredByBaseflowLogoLight@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Baseflow/flutter-permission-handler/c438a1f29cdbe9b46b118ed58dc6e88b43524f74/permission_handler_windows/example/res/images/poweredByBaseflowLogoLight@3x.png -------------------------------------------------------------------------------- /permission_handler_windows/example/windows/.gitignore: -------------------------------------------------------------------------------- 1 | flutter/ephemeral/ 2 | 3 | # Visual Studio user-specific files. 4 | *.suo 5 | *.user 6 | *.userosscache 7 | *.sln.docstates 8 | 9 | # Visual Studio build-related files. 10 | x64/ 11 | x86/ 12 | 13 | # Visual Studio cache files 14 | # files ending in .cache can be ignored 15 | *.[Cc]ache 16 | # but keep track of directories ending in .cache 17 | !*.[Cc]ache/ 18 | -------------------------------------------------------------------------------- /permission_handler_windows/example/windows/flutter/generated_plugin_registrant.cc: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #include "generated_plugin_registrant.h" 8 | 9 | #include 10 | #include 11 | 12 | void RegisterPlugins(flutter::PluginRegistry* registry) { 13 | PermissionHandlerWindowsPluginRegisterWithRegistrar( 14 | registry->GetRegistrarForPlugin("PermissionHandlerWindowsPlugin")); 15 | UrlLauncherWindowsRegisterWithRegistrar( 16 | registry->GetRegistrarForPlugin("UrlLauncherWindows")); 17 | } 18 | -------------------------------------------------------------------------------- /permission_handler_windows/example/windows/flutter/generated_plugin_registrant.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #ifndef GENERATED_PLUGIN_REGISTRANT_ 8 | #define GENERATED_PLUGIN_REGISTRANT_ 9 | 10 | #include 11 | 12 | // Registers Flutter plugins. 13 | void RegisterPlugins(flutter::PluginRegistry* registry); 14 | 15 | #endif // GENERATED_PLUGIN_REGISTRANT_ 16 | -------------------------------------------------------------------------------- /permission_handler_windows/example/windows/flutter/generated_plugins.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Generated file, do not edit. 3 | # 4 | 5 | list(APPEND FLUTTER_PLUGIN_LIST 6 | permission_handler_windows 7 | url_launcher_windows 8 | ) 9 | 10 | list(APPEND FLUTTER_FFI_PLUGIN_LIST 11 | ) 12 | 13 | set(PLUGIN_BUNDLED_LIBRARIES) 14 | 15 | foreach(plugin ${FLUTTER_PLUGIN_LIST}) 16 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/windows plugins/${plugin}) 17 | target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) 18 | list(APPEND PLUGIN_BUNDLED_LIBRARIES $) 19 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) 20 | endforeach(plugin) 21 | 22 | foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) 23 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/windows plugins/${ffi_plugin}) 24 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) 25 | endforeach(ffi_plugin) 26 | -------------------------------------------------------------------------------- /permission_handler_windows/example/windows/runner/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.14) 2 | project(runner LANGUAGES CXX) 3 | 4 | add_executable(${BINARY_NAME} WIN32 5 | "flutter_window.cpp" 6 | "main.cpp" 7 | "utils.cpp" 8 | "win32_window.cpp" 9 | "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc" 10 | "Runner.rc" 11 | "runner.exe.manifest" 12 | ) 13 | apply_standard_settings(${BINARY_NAME}) 14 | target_compile_definitions(${BINARY_NAME} PRIVATE "NOMINMAX") 15 | target_link_libraries(${BINARY_NAME} PRIVATE flutter flutter_wrapper_app) 16 | target_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}") 17 | add_dependencies(${BINARY_NAME} flutter_assemble) 18 | -------------------------------------------------------------------------------- /permission_handler_windows/example/windows/runner/flutter_window.cpp: -------------------------------------------------------------------------------- 1 | #include "flutter_window.h" 2 | 3 | #include 4 | 5 | #include "flutter/generated_plugin_registrant.h" 6 | 7 | FlutterWindow::FlutterWindow(const flutter::DartProject& project) 8 | : project_(project) {} 9 | 10 | FlutterWindow::~FlutterWindow() {} 11 | 12 | bool FlutterWindow::OnCreate() { 13 | if (!Win32Window::OnCreate()) { 14 | return false; 15 | } 16 | 17 | RECT frame = GetClientArea(); 18 | 19 | // The size here must match the window dimensions to avoid unnecessary surface 20 | // creation / destruction in the startup path. 21 | flutter_controller_ = std::make_unique( 22 | frame.right - frame.left, frame.bottom - frame.top, project_); 23 | // Ensure that basic setup of the controller was successful. 24 | if (!flutter_controller_->engine() || !flutter_controller_->view()) { 25 | return false; 26 | } 27 | RegisterPlugins(flutter_controller_->engine()); 28 | SetChildContent(flutter_controller_->view()->GetNativeWindow()); 29 | return true; 30 | } 31 | 32 | void FlutterWindow::OnDestroy() { 33 | if (flutter_controller_) { 34 | flutter_controller_ = nullptr; 35 | } 36 | 37 | Win32Window::OnDestroy(); 38 | } 39 | 40 | LRESULT 41 | FlutterWindow::MessageHandler(HWND hwnd, UINT const message, 42 | WPARAM const wparam, 43 | LPARAM const lparam) noexcept { 44 | // Give Flutter, including plugins, an opportunity to handle window messages. 45 | if (flutter_controller_) { 46 | std::optional result = 47 | flutter_controller_->HandleTopLevelWindowProc(hwnd, message, wparam, 48 | lparam); 49 | if (result) { 50 | return *result; 51 | } 52 | } 53 | 54 | switch (message) { 55 | case WM_FONTCHANGE: 56 | flutter_controller_->engine()->ReloadSystemFonts(); 57 | break; 58 | } 59 | 60 | return Win32Window::MessageHandler(hwnd, message, wparam, lparam); 61 | } 62 | -------------------------------------------------------------------------------- /permission_handler_windows/example/windows/runner/flutter_window.h: -------------------------------------------------------------------------------- 1 | #ifndef RUNNER_FLUTTER_WINDOW_H_ 2 | #define RUNNER_FLUTTER_WINDOW_H_ 3 | 4 | #include 5 | #include 6 | 7 | #include 8 | 9 | #include "win32_window.h" 10 | 11 | // A window that does nothing but host a Flutter view. 12 | class FlutterWindow : public Win32Window { 13 | public: 14 | // Creates a new FlutterWindow hosting a Flutter view running |project|. 15 | explicit FlutterWindow(const flutter::DartProject& project); 16 | virtual ~FlutterWindow(); 17 | 18 | protected: 19 | // Win32Window: 20 | bool OnCreate() override; 21 | void OnDestroy() override; 22 | LRESULT MessageHandler(HWND window, UINT const message, WPARAM const wparam, 23 | LPARAM const lparam) noexcept override; 24 | 25 | private: 26 | // The project to run. 27 | flutter::DartProject project_; 28 | 29 | // The Flutter instance hosted by this window. 30 | std::unique_ptr flutter_controller_; 31 | }; 32 | 33 | #endif // RUNNER_FLUTTER_WINDOW_H_ 34 | -------------------------------------------------------------------------------- /permission_handler_windows/example/windows/runner/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #include "flutter_window.h" 6 | #include "utils.h" 7 | 8 | int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev, 9 | _In_ wchar_t *command_line, _In_ int show_command) { 10 | // Attach to console when present (e.g., 'flutter run') or create a 11 | // new console when running with a debugger. 12 | if (!::AttachConsole(ATTACH_PARENT_PROCESS) && ::IsDebuggerPresent()) { 13 | CreateAndAttachConsole(); 14 | } 15 | 16 | // Initialize COM, so that it is available for use in the library and/or 17 | // plugins. 18 | ::CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED); 19 | 20 | flutter::DartProject project(L"data"); 21 | 22 | std::vector command_line_arguments = 23 | GetCommandLineArguments(); 24 | 25 | project.set_dart_entrypoint_arguments(std::move(command_line_arguments)); 26 | 27 | FlutterWindow window(project); 28 | Win32Window::Point origin(10, 10); 29 | Win32Window::Size size(1280, 720); 30 | if (!window.CreateAndShow(L"example", origin, size)) { 31 | return EXIT_FAILURE; 32 | } 33 | window.SetQuitOnClose(true); 34 | 35 | ::MSG msg; 36 | while (::GetMessage(&msg, nullptr, 0, 0)) { 37 | ::TranslateMessage(&msg); 38 | ::DispatchMessage(&msg); 39 | } 40 | 41 | ::CoUninitialize(); 42 | return EXIT_SUCCESS; 43 | } 44 | -------------------------------------------------------------------------------- /permission_handler_windows/example/windows/runner/resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Visual C++ generated include file. 3 | // Used by Runner.rc 4 | // 5 | #define IDI_APP_ICON 101 6 | 7 | // Next default values for new objects 8 | // 9 | #ifdef APSTUDIO_INVOKED 10 | #ifndef APSTUDIO_READONLY_SYMBOLS 11 | #define _APS_NEXT_RESOURCE_VALUE 102 12 | #define _APS_NEXT_COMMAND_VALUE 40001 13 | #define _APS_NEXT_CONTROL_VALUE 1001 14 | #define _APS_NEXT_SYMED_VALUE 101 15 | #endif 16 | #endif 17 | -------------------------------------------------------------------------------- /permission_handler_windows/example/windows/runner/resources/app_icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Baseflow/flutter-permission-handler/c438a1f29cdbe9b46b118ed58dc6e88b43524f74/permission_handler_windows/example/windows/runner/resources/app_icon.ico -------------------------------------------------------------------------------- /permission_handler_windows/example/windows/runner/runner.exe.manifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PerMonitorV2 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /permission_handler_windows/example/windows/runner/utils.cpp: -------------------------------------------------------------------------------- 1 | #include "utils.h" 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | #include 9 | 10 | void CreateAndAttachConsole() { 11 | if (::AllocConsole()) { 12 | FILE *unused; 13 | if (freopen_s(&unused, "CONOUT$", "w", stdout)) { 14 | _dup2(_fileno(stdout), 1); 15 | } 16 | if (freopen_s(&unused, "CONOUT$", "w", stderr)) { 17 | _dup2(_fileno(stdout), 2); 18 | } 19 | std::ios::sync_with_stdio(); 20 | FlutterDesktopResyncOutputStreams(); 21 | } 22 | } 23 | 24 | std::vector GetCommandLineArguments() { 25 | // Convert the UTF-16 command line arguments to UTF-8 for the Engine to use. 26 | int argc; 27 | wchar_t** argv = ::CommandLineToArgvW(::GetCommandLineW(), &argc); 28 | if (argv == nullptr) { 29 | return std::vector(); 30 | } 31 | 32 | std::vector command_line_arguments; 33 | 34 | // Skip the first argument as it's the binary name. 35 | for (int i = 1; i < argc; i++) { 36 | command_line_arguments.push_back(Utf8FromUtf16(argv[i])); 37 | } 38 | 39 | ::LocalFree(argv); 40 | 41 | return command_line_arguments; 42 | } 43 | 44 | std::string Utf8FromUtf16(const wchar_t* utf16_string) { 45 | if (utf16_string == nullptr) { 46 | return std::string(); 47 | } 48 | int target_length = ::WideCharToMultiByte( 49 | CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, 50 | -1, nullptr, 0, nullptr, nullptr); 51 | if (target_length == 0) { 52 | return std::string(); 53 | } 54 | std::string utf8_string; 55 | utf8_string.resize(target_length); 56 | int converted_length = ::WideCharToMultiByte( 57 | CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, 58 | -1, utf8_string.data(), 59 | target_length, nullptr, nullptr); 60 | if (converted_length == 0) { 61 | return std::string(); 62 | } 63 | return utf8_string; 64 | } 65 | -------------------------------------------------------------------------------- /permission_handler_windows/example/windows/runner/utils.h: -------------------------------------------------------------------------------- 1 | #ifndef RUNNER_UTILS_H_ 2 | #define RUNNER_UTILS_H_ 3 | 4 | #include 5 | #include 6 | 7 | // Creates a console for the process, and redirects stdout and stderr to 8 | // it for both the runner and the Flutter library. 9 | void CreateAndAttachConsole(); 10 | 11 | // Takes a null-terminated wchar_t* encoded in UTF-16 and returns a std::string 12 | // encoded in UTF-8. Returns an empty std::string on failure. 13 | std::string Utf8FromUtf16(const wchar_t* utf16_string); 14 | 15 | // Gets the command line arguments passed in as a std::vector, 16 | // encoded in UTF-8. Returns an empty std::vector on failure. 17 | std::vector GetCommandLineArguments(); 18 | 19 | #endif // RUNNER_UTILS_H_ 20 | -------------------------------------------------------------------------------- /permission_handler_windows/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: permission_handler_windows 2 | description: Permission plugin for Flutter. This plugin provides the Windows API to request and check permissions. 3 | version: 0.2.1 4 | homepage: https://github.com/baseflow/flutter-permission-handler 5 | 6 | flutter: 7 | plugin: 8 | implements: permission_handler 9 | platforms: 10 | windows: 11 | pluginClass: PermissionHandlerWindowsPlugin 12 | 13 | dependencies: 14 | flutter: 15 | sdk: flutter 16 | permission_handler_platform_interface: ^4.1.0 17 | 18 | dev_dependencies: 19 | flutter_test: 20 | sdk: flutter 21 | plugin_platform_interface: ^2.0.0 22 | 23 | environment: 24 | sdk: ">=2.12.0 <4.0.0" 25 | flutter: ">=2.0.0" 26 | -------------------------------------------------------------------------------- /permission_handler_windows/windows/.gitignore: -------------------------------------------------------------------------------- 1 | flutter/ 2 | 3 | # Visual Studio user-specific files. 4 | *.suo 5 | *.user 6 | *.userosscache 7 | *.sln.docstates 8 | 9 | # Visual Studio build-related files. 10 | x64/ 11 | x86/ 12 | 13 | # Visual Studio cache files 14 | # files ending in .cache can be ignored 15 | *.[Cc]ache 16 | # but keep track of directories ending in .cache 17 | !*.[Cc]ache/ 18 | -------------------------------------------------------------------------------- /permission_handler_windows/windows/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.15) 2 | set(PROJECT_NAME "permission_handler_windows") 3 | set(CPPWINRT_VERSION "2.0.210806.1") 4 | project(${PROJECT_NAME} LANGUAGES CXX) 5 | include(FetchContent) 6 | 7 | # This value is used when generating builds using this plugin, so it must 8 | # not be changed 9 | set(PLUGIN_NAME "${PROJECT_NAME}_plugin") 10 | 11 | FetchContent_Declare(nuget 12 | URL "https://dist.nuget.org/win-x86-commandline/v6.0.0/nuget.exe" 13 | URL_HASH SHA256=04eb6c4fe4213907e2773e1be1bbbd730e9a655a3c9c58387ce8d4a714a5b9e1 14 | DOWNLOAD_NO_EXTRACT true 15 | ) 16 | 17 | find_program(NUGET nuget) 18 | if (NOT NUGET) 19 | message("Nuget.exe not found, trying to download or use cached version.") 20 | FetchContent_MakeAvailable(nuget) 21 | set(NUGET ${nuget_SOURCE_DIR}/nuget.exe) 22 | endif() 23 | 24 | execute_process(COMMAND 25 | ${NUGET} install Microsoft.Windows.CppWinRT -Version ${CPPWINRT_VERSION} -OutputDirectory packages 26 | WORKING_DIRECTORY ${CMAKE_BINARY_DIR} 27 | RESULT_VARIABLE ret) 28 | if (NOT ret EQUAL 0) 29 | message(FATAL_ERROR "Failed to install nuget package Microsoft.Windows.CppWinRT.${CPPWINRT_VERSION}") 30 | endif() 31 | 32 | set(CPPWINRT ${CMAKE_BINARY_DIR}/packages/Microsoft.Windows.CppWinRT.${CPPWINRT_VERSION}/bin/cppwinrt.exe) 33 | execute_process(COMMAND 34 | ${CPPWINRT} -input sdk -output include 35 | WORKING_DIRECTORY ${CMAKE_BINARY_DIR} 36 | RESULT_VARIABLE ret) 37 | if (NOT ret EQUAL 0) 38 | message(FATAL_ERROR "Failed to run cppwinrt.exe") 39 | endif() 40 | 41 | include_directories(BEFORE SYSTEM ${CMAKE_BINARY_DIR}/include) 42 | 43 | add_library(${PLUGIN_NAME} SHARED 44 | "include/permission_handler_windows/permission_handler_windows_plugin.h" 45 | "permission_handler_windows_plugin.cpp" 46 | ) 47 | apply_standard_settings(${PLUGIN_NAME}) 48 | set_target_properties(${PLUGIN_NAME} PROPERTIES CXX_VISIBILITY_PRESET hidden) 49 | target_compile_features(${PLUGIN_NAME} PRIVATE cxx_std_20) 50 | target_compile_options(${PLUGIN_NAME} PRIVATE /await) 51 | target_compile_definitions(${PLUGIN_NAME} PRIVATE FLUTTER_PLUGIN_IMPL) 52 | target_include_directories(${PLUGIN_NAME} INTERFACE 53 | "${CMAKE_CURRENT_SOURCE_DIR}/include") 54 | target_link_libraries(${PLUGIN_NAME} PRIVATE flutter flutter_wrapper_plugin) 55 | 56 | # List of absolute paths to libraries that should be bundled with the plugin 57 | set(permission_handler_windows_bundled_libraries 58 | "" 59 | PARENT_SCOPE 60 | ) 61 | -------------------------------------------------------------------------------- /permission_handler_windows/windows/include/permission_handler_windows/permission_handler_windows_plugin.h: -------------------------------------------------------------------------------- 1 | #ifndef PACKAGES_PERMISSION_HANDLER_PERMISSION_HANDLER_WINDOWS_WINDOWS_INCLUDE_PERMISSION_HANDLER_WINDOWS_PERMISSION_HANDLER_PLUGIN_H_ 2 | #define PACKAGES_PERMISSION_HANDLER_PERMISSION_HANDLER_WINDOWS_WINDOWS_INCLUDE_PERMISSION_HANDLER_WINDOWS_PERMISSION_HANDLER_PLUGIN_H_ 3 | 4 | #include 5 | 6 | #ifdef FLUTTER_PLUGIN_IMPL 7 | #define FLUTTER_PLUGIN_EXPORT __declspec(dllexport) 8 | #else 9 | #define FLUTTER_PLUGIN_EXPORT __declspec(dllimport) 10 | #endif 11 | 12 | #if defined(__cplusplus) 13 | extern "C" { 14 | #endif 15 | 16 | FLUTTER_PLUGIN_EXPORT void PermissionHandlerWindowsPluginRegisterWithRegistrar( 17 | FlutterDesktopPluginRegistrarRef registrar); 18 | 19 | #if defined(__cplusplus) 20 | } // extern "C" 21 | #endif 22 | 23 | #endif // PACKAGES_PERMISSION_HANDLER_PERMISSION_HANDLER_WINDOWS_WINDOWS_INCLUDE_PERMISSION_HANDLER_WINDOWS_PERMISSION_HANDLER_PLUGIN_H_ 24 | -------------------------------------------------------------------------------- /permission_handler_windows/windows/permission_constants.h: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | class PermissionConstants { 4 | public: 5 | inline static int PERMISSION_CODE = 24; 6 | inline static int PERMISSION_CODE_IGNORE_BATTERY_OPTIMIZATIONS = 209; 7 | inline static int PERMISSION_CODE_MANAGE_EXTERNAL_STORAGE = 210; 8 | inline static int PERMISSION_CODE_SYSTEM_ALERT_WINDOW = 211; 9 | inline static int PERMISSION_CODE_REQUEST_INSTALL_PACKAGES = 212; 10 | inline static int PERMISSION_CODE_ACCESS_NOTIFICATION_POLICY = 213; 11 | 12 | //PERMISSION_GROUP 13 | enum class PermissionGroup { 14 | CALENDAR = 0, 15 | CAMERA = 1, 16 | CONTACTS = 2, 17 | LOCATION = 3, 18 | LOCATION_ALWAYS = 4, 19 | LOCATION_WHEN_IN_USE = 5, 20 | MEDIA_LIBRARY = 6, 21 | MICROPHONE = 7, 22 | PHONE = 8, 23 | PHOTOS = 9, 24 | PHOTOS_ADD_ONLY = 10, 25 | REMINDERS = 11, 26 | SENSORS = 12, 27 | SMS = 13, 28 | SPEECH = 14, 29 | STORAGE = 15, 30 | IGNORE_BATTERY_OPTIMIZATIONS = 16, 31 | NOTIFICATION = 17, 32 | ACCESS_MEDIA_LOCATION = 18, 33 | ACTIVITY_RECOGNITION = 19, 34 | UNKNOWN = 20, 35 | BLUETOOTH = 21, 36 | MANAGE_EXTERNAL_STORAGE = 22, 37 | SYSTEM_ALERT_WINDOW = 23, 38 | REQUEST_INSTALL_PACKAGES = 24, 39 | APP_TRACK_TRANSPARENCY = 25, 40 | CRITICAL_ALERTS = 26, 41 | ACCESS_NOTIFICATION_POLICY = 27, 42 | BLUETOOTH_SCAN = 28, 43 | BLUETOOTH_ADVERTISE = 29, 44 | BLUETOOTH_CONNECT = 30, 45 | NEARBY_WIFI_DEVICES = 31, 46 | VIDEOS = 32, 47 | AUDIO = 33, 48 | SCHEDULE_EXACT_ALARM = 34, 49 | SENSORS_ALWAYS = 35, 50 | CALENDAR_WRITE_ONLY = 36, 51 | CALENDAR_FULL_ACCESS = 37, 52 | ASSISTANT = 38, 53 | BACKGROUND_REFRESH = 39 54 | }; 55 | 56 | //PERMISSION_STATUS 57 | enum class PermissionStatus { 58 | DENIED = 0, 59 | GRANTED = 1, 60 | RESTRICTED = 2, 61 | LIMITED = 3, 62 | NEVER_ASK_AGAIN = 4 63 | }; 64 | 65 | //SERVICE_STATUS 66 | enum class ServiceStatus { 67 | DISABLED = 0, 68 | ENABLED = 1, 69 | NOT_APPLICABLE = 2 70 | }; 71 | }; 72 | --------------------------------------------------------------------------------