├── .gitattributes ├── .github ├── FUNDING.yml ├── ISSUE_TEMPLATE │ ├── a-regression.md │ ├── b-bug-report.md │ ├── c-feature-request.md │ ├── d-enhancement-proposal.md │ └── e-question.md └── PULL_REQUEST_TEMPLATE.md ├── .gitignore ├── .travis.yml ├── AUTHORS ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── analysis_options.yaml ├── packages └── location_permissions │ ├── .gitignore │ ├── .metadata │ ├── CHANGELOG.md │ ├── CODE_OF_CONDUCT.md │ ├── LICENSE │ ├── README.md │ ├── analysis_options.yaml │ ├── android │ ├── .gitignore │ ├── build.gradle │ ├── gradle.properties │ ├── settings.gradle │ └── src │ │ └── main │ │ ├── AndroidManifest.xml │ │ └── java │ │ └── com │ │ └── baseflow │ │ └── location_permissions │ │ └── LocationPermissionsPlugin.java │ ├── example │ ├── .gitignore │ ├── .metadata │ ├── README.md │ ├── android │ │ ├── app │ │ │ ├── build.gradle │ │ │ └── src │ │ │ │ ├── debug │ │ │ │ └── AndroidManifest.xml │ │ │ │ ├── main │ │ │ │ ├── AndroidManifest.xml │ │ │ │ ├── java │ │ │ │ │ └── com │ │ │ │ │ │ └── baseflow │ │ │ │ │ │ └── location_permissions_example │ │ │ │ │ │ └── MainActivity.java │ │ │ │ └── res │ │ │ │ │ ├── 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 │ │ │ │ │ └── styles.xml │ │ │ │ └── profile │ │ │ │ └── AndroidManifest.xml │ │ ├── build.gradle │ │ ├── gradle.properties │ │ ├── gradle │ │ │ └── wrapper │ │ │ │ └── gradle-wrapper.properties │ │ └── settings.gradle │ ├── ios │ │ ├── Flutter │ │ │ ├── AppFrameworkInfo.plist │ │ │ ├── Debug.xcconfig │ │ │ └── Release.xcconfig │ │ ├── Podfile │ │ ├── Podfile.lock │ │ ├── Runner.xcodeproj │ │ │ ├── project.pbxproj │ │ │ ├── project.xcworkspace │ │ │ │ └── contents.xcworkspacedata │ │ │ └── xcshareddata │ │ │ │ └── xcschemes │ │ │ │ └── Runner.xcscheme │ │ ├── Runner.xcworkspace │ │ │ ├── contents.xcworkspacedata │ │ │ └── xcshareddata │ │ │ │ └── IDEWorkspaceChecks.plist │ │ └── Runner │ │ │ ├── AppDelegate.h │ │ │ ├── AppDelegate.m │ │ │ ├── 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 │ │ │ └── main.m │ ├── lib │ │ └── main.dart │ └── pubspec.yaml │ ├── ios │ ├── .gitignore │ ├── Assets │ │ └── .gitkeep │ ├── Classes │ │ ├── Enums.h │ │ ├── LocationPermissionsPlugin.h │ │ └── LocationPermissionsPlugin.m │ └── location_permissions.podspec │ ├── lib │ ├── location_permissions.dart │ └── src │ │ ├── location_permissions.dart │ │ └── permission_enums.dart │ ├── location_permissions.iml │ ├── pubspec.lock │ └── pubspec.yaml └── script ├── before_build_apks.sh ├── before_build_ipas.sh ├── check_publish.sh ├── common.sh └── incremental_build.sh /.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/a-regression.md: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | name: 🔙 Regression 4 | about: Report unexpected behavior that worked previously 5 | --- 6 | 7 | ## 🔙 Regression 8 | 9 | 10 | 11 | ### Old (and correct) behavior 12 | 13 | ### Current behavior 14 | 15 | ### Reproduction steps 16 | 17 | ### Configuration 18 | 19 | **Version:** 1.x 20 | 21 | **Platform:** 22 | - [ ] :iphone: iOS 23 | - [ ] :robot: Android -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/b-bug-report.md: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | name: 🐛 Bug Report 4 | about: Create a report to help us fix bugs and make improvements 5 | --- 6 | 7 | ## 🐛 Bug Report 8 | 9 | 10 | 11 | ### Expected behavior 12 | 13 | ### Reproduction steps 14 | 15 | ### Configuration 16 | 17 | **Version:** 1.x 18 | 19 | **Platform:** 20 | - [ ] :iphone: iOS 21 | - [ ] :robot: Android -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/c-feature-request.md: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | name: 🚀 Feature Request 4 | about: Want to see something new included in the Framework? Submit it! 5 | --- 6 | 7 | ## 🚀 Feature Requests 8 | 9 | 10 | 11 | ### Contextualize the feature 12 | 13 | 14 | ### Describe the feature 15 | 16 | 17 | ### Platforms affected (mark all that apply) 18 | - [ ] :iphone: iOS 19 | - [ ] :robot: Android -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/d-enhancement-proposal.md: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | name: 🏗 Enhancement Proposal 4 | about: Proposals for code cleanup, refactor and improvements in general 5 | --- 6 | 7 | ## 🏗 Enhancement Proposal 8 | 9 | 10 | 11 | ### Pitch 12 | 13 | 14 | 15 | ### Platforms affected (mark all that apply) 16 | - [ ] :iphone: iOS 17 | - [ ] :robot: Android -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/e-question.md: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | name: 💬 Questions and Help 4 | about: If you have questions, please use this for support 5 | --- 6 | 7 | ## 💬 Questions and Help 8 | 9 | For questions or help we recommend checking: 10 | 11 | - The [Flutter tag in Stack Overflow](https://stackoverflow.com/questions/tagged/flutter) -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | ### :sparkles: What kind of change does this PR introduce? (Bug fix, feature, docs update...) 2 | 3 | 4 | ### :arrow_heading_down: What is the current behavior? 5 | 6 | 7 | ### :new: What is the new behavior (if this is a feature change)? 8 | 9 | 10 | ### :boom: Does this PR introduce a breaking change? 11 | 12 | 13 | ### :bug: Recommendations for testing 14 | 15 | 16 | ### :memo: Links to relevant issues/docs 17 | 18 | 19 | ### :thinking: Checklist before submitting 20 | 21 | - [ ] All projects build 22 | - [ ] Follows style guide lines ([code style guide](https://github.com/BaseflowIT/flutter-permission-handlers/blob/develop/CONTRIBUTING.md)) 23 | - [ ] Relevant documentation was updated 24 | - [ ] Rebased onto current develop -------------------------------------------------------------------------------- /.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 | 15 | # IntelliJ related 16 | *.iml 17 | *.ipr 18 | *.iws 19 | .idea/ 20 | 21 | # Android Studio related 22 | android/.classpath 23 | android/.settings/ 24 | 25 | # Visual Studio Code related 26 | .vscode/ 27 | 28 | # Flutter repo-specific 29 | /bin/cache/ 30 | /bin/mingit/ 31 | /dev/benchmarks/mega_gallery/ 32 | /dev/bots/.recipe_deps 33 | /dev/bots/android_tools/ 34 | /dev/docs/doc/ 35 | /dev/docs/lib/ 36 | /dev/docs/pubspec.yaml 37 | /packages/flutter/coverage/ 38 | version 39 | 40 | # Flutter/Dart/Pub related 41 | **/doc/api/ 42 | .dart_tool/ 43 | .flutter-plugins 44 | .packages 45 | .pub-cache/ 46 | .pub/ 47 | build/ 48 | flutter_*.png 49 | linked_*.ds 50 | unlinked.ds 51 | unlinked_spec.ds 52 | **/example/.flutter-plugins-dependencies 53 | 54 | # Android related 55 | **/android/**/gradle-wrapper.jar 56 | **/android/.gradle 57 | **/android/captures/ 58 | **/android/gradlew 59 | **/android/gradlew.bat 60 | **/android/local.properties 61 | **/android/**/GeneratedPluginRegistrant.java 62 | **/android/.classpath 63 | **/android/.settings 64 | 65 | # iOS/XCode related 66 | **/ios/**/*.mode1v3 67 | **/ios/**/*.mode2v3 68 | **/ios/**/*.moved-aside 69 | **/ios/**/*.pbxuser 70 | **/ios/**/*.perspectivev3 71 | **/ios/**/*sync/ 72 | **/ios/**/.sconsign.dblite 73 | **/ios/**/.tags* 74 | **/ios/**/.vagrant/ 75 | **/ios/**/DerivedData/ 76 | **/ios/**/Icon? 77 | **/ios/**/Pods/ 78 | **/ios/**/.symlinks/ 79 | **/ios/**/profile 80 | **/ios/**/xcuserdata 81 | **/ios/.generated/ 82 | **/ios/Flutter/App.framework 83 | **/ios/Flutter/Flutter.framework 84 | **/ios/Flutter/Generated.xcconfig 85 | **/ios/Flutter/app.flx 86 | **/ios/Flutter/app.zip 87 | **/ios/Flutter/flutter_assets/ 88 | **/ios/Flutter/flutter_export_environment.sh 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 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | matrix: 2 | include: 3 | # Job 1) Run analyzer 4 | - os: linux 5 | env: 6 | - SHARD=Analyze 7 | sudo: false 8 | addons: 9 | apt: 10 | # Flutter depends on /usr/lib/x86_64-linux-gnu/libstdc++.so.6 version GLIBCXX_3.4.18 11 | sources: 12 | - ubuntu-toolchain-r-test # if we don't specify this, the libstdc++6 we get is the wrong version 13 | packages: 14 | - libstdc++6 15 | - fonts-droid 16 | before_script: 17 | - git clone https://github.com/flutter/flutter.git 18 | - export PATH=`pwd`/flutter/bin:`pwd`/flutter/bin/cache/dart-sdk/bin:$PATH 19 | - flutter doctor 20 | - pub global activate flutter_plugin_tools 21 | script: 22 | - ./script/incremental_build.sh analyze 23 | # Job 2) Check format and run tests 24 | - os: linux 25 | env: 26 | - SHARD=Format+Test 27 | jdk: oraclejdk8 28 | sudo: false 29 | addons: 30 | apt: 31 | # Flutter depends on /usr/lib/x86_64-linux-gnu/libstdc++.so.6 version GLIBCXX_3.4.18 32 | sources: 33 | - ubuntu-toolchain-r-test # if we don't specify this, the libstdc++6 we get is the wrong version 34 | - llvm-toolchain-precise # for clang-format-5.0 35 | packages: 36 | - libstdc++6 37 | - fonts-droid 38 | - clang-format-5.0 39 | before_script: 40 | - git clone https://github.com/flutter/flutter.git 41 | - export PATH=`pwd`/flutter/bin:`pwd`/flutter/bin/cache/dart-sdk/bin:$PATH 42 | - flutter doctor 43 | - pub global activate flutter_plugin_tools 44 | script: 45 | - ./script/incremental_build.sh format --travis --clang-format=clang-format-5.0 46 | - ./script/incremental_build.sh test 47 | # Job 3) Build example APKs and run Java tests, shard 1/1 48 | - os: linux 49 | env: 50 | - SHARD="Build example apks 1/1" 51 | - PLUGIN_SHARDING="--shardIndex 0 --shardCount 1" 52 | jdk: oraclejdk8 53 | sudo: false 54 | addons: 55 | apt: 56 | # Flutter depends on /usr/lib/x86_64-linux-gnu/libstdc++.so.6 version GLIBCXX_3.4.18 57 | sources: 58 | - ubuntu-toolchain-r-test # if we don't specify this, the libstdc++6 we get is the wrong version 59 | packages: 60 | - lib32stdc++6 # https://github.com/flutter/flutter/issues/6207 61 | - libstdc++6 62 | - fonts-droid 63 | before_script: 64 | - ./script/before_build_apks.sh 65 | - export ANDROID_HOME=`pwd`/android-sdk 66 | - export PATH=`pwd`/flutter/bin:`pwd`/flutter/bin/cache/dart-sdk/bin:$PATH 67 | script: 68 | - ./script/incremental_build.sh build-examples --apk 69 | - ./script/incremental_build.sh java-test # must come after apk build 70 | # Job 4) Build example IPAs, shard 1/1 71 | - os: osx 72 | env: 73 | - SHARD="Build example ipas 1/1" 74 | - PLUGIN_SHARDING="--shardIndex 0 --shardCount 1" 75 | language: generic 76 | osx_image: xcode10.2 77 | before_script: 78 | - ./script/before_build_ipas.sh 79 | - export PATH=`pwd`/flutter/bin:`pwd`/flutter/bin/cache/dart-sdk/bin:$PATH 80 | script: 81 | - ./script/incremental_build.sh build-examples --ipa 82 | 83 | cache: 84 | directories: 85 | - $HOME/.pub-cache 86 | -------------------------------------------------------------------------------- /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 | David Schneider 10 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | Contributing to the Flutter Permission handlers plugins 2 | ============================================= 3 | 4 | What you will need 5 | ------------------ 6 | 7 | * A Linux, Mac OS X, or Windows machine (note: to run and compile iOS specific parts you'll need access to a Mac OS X machine); 8 | * git (used for source version control, installation instruction can be found [here](https://git-scm.com/)); 9 | * The Flutter SDK (installation instructions can be found [here](https://flutter.io/get-started/install/)); 10 | * A personal GitHub account (if you don't have one, you can sign-up for free [here](https://github.com/)) 11 | 12 | Setting up your development environment 13 | --------------------------------------- 14 | 15 | * Fork `https://github.com/BaseflowIT/flutter-permission-handlers` into your own GitHub account. If you already have a fork and moving to a new computer, make sure you update you fork. 16 | * If you haven't configured your machine with an SSH key that's known to github, then 17 | follow [GitHub's directions](https://help.github.com/articles/generating-ssh-keys/) 18 | to generate an SSH key. 19 | * Clone your forked repo on your local development machine: `git clone git@github.com:/flutter-permission-handlers.git` 20 | * Change into the `flutter-permission-handlers` directory: `cd flutter-permission-handlers` 21 | * Add an upstream to the original repo, so that fetch from the master repository and not your clone: `git remote add upstream git@github.com:BaseflowIT/flutter-permission-handlers.git` 22 | 23 | Running the example project 24 | --------------------------- 25 | 26 | * Change into the example directory: `cd example` 27 | * Run the App: `flutter run` 28 | 29 | Contribute 30 | ---------- 31 | 32 | We really appreciate contributions via GitHub pull requests. To contribute take the following steps: 33 | 34 | * Make sure you are up to date with the latest code on the master: 35 | * `git fetch upstream` 36 | * `git checkout upstream/develop -b ` 37 | * Apply your changes 38 | * Verify your changes and fix potential warnings/ errors: 39 | * Check formatting: `flutter format .` 40 | * Run static analyses: `flutter analyzes` 41 | * Commit your changes: `git commit -am ""` 42 | * Push changes to your fork: `git push origin ` 43 | 44 | Send us your pull request: 45 | 46 | * Go to `https://github.com/BaseflowIT/flutter-permission-handlers` and click the "Compare & pull request" button. 47 | 48 | Please make sure you solved all warnings and errors reported by the static code analyses and that you fill in the full pull request template. Failing to do so will result in us asking you to fix it. 49 | -------------------------------------------------------------------------------- /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 Plugins 2 | 3 | --- 4 | 5 | ## Deprecation Notice 6 | This repository has been replaced by the Flutter [permission_handler](https://pub.dev/packages/permission_handler) plugin and will not longer be maintained. Starting from 10/05/2021 this repository will be marked read-only. 7 | 8 | --- 9 | 10 | This repo contains a collection of permission related Flutter plugins which can be used to request permissions to access device resources in a cross-platform way. 11 | 12 | ## Plugins 13 | 14 | Currently we support the following plugins: 15 | 16 | | Plugin | Pub | 17 | |--------|-----| 18 | | [location_permissions](./packages/location_permissions/) | [![pub package](https://img.shields.io/pub/v/location_permissions.svg)](https://pub.dartlang.org/packages/location_permissions) | 19 | -------------------------------------------------------------------------------- /analysis_options.yaml: -------------------------------------------------------------------------------- 1 | analyzer: 2 | strong-mode: 3 | implicit-dynamic: false 4 | errors: 5 | missing_required_param: warning 6 | missing_return: warning 7 | todo: ignore 8 | 9 | linter: 10 | rules: 11 | - always_declare_return_types 12 | - always_put_control_body_on_new_line 13 | - always_require_non_null_named_parameters 14 | - always_specify_types 15 | - annotate_overrides 16 | - avoid_as 17 | - avoid_classes_with_only_static_members 18 | - avoid_empty_else 19 | - avoid_field_initializers_in_const_classes 20 | - avoid_function_literals_in_foreach_calls 21 | - avoid_init_to_null 22 | - avoid_null_checks_in_equality_operators 23 | - avoid_relative_lib_imports 24 | - avoid_renaming_method_parameters 25 | - avoid_return_types_on_setters 26 | - avoid_returning_null_for_void 27 | - avoid_slow_async_io 28 | - avoid_types_as_parameter_names 29 | - avoid_unused_constructor_parameters 30 | - avoid_void_async 31 | - await_only_futures 32 | - camel_case_types 33 | - cancel_subscriptions 34 | - control_flow_in_finally 35 | - directives_ordering 36 | - empty_catches 37 | - empty_constructor_bodies 38 | - empty_statements 39 | - flutter_style_todos 40 | - hash_and_equals 41 | - implementation_imports 42 | - iterable_contains_unrelated_type 43 | - library_names 44 | - library_prefixes 45 | - list_remove_unrelated_type 46 | - no_adjacent_strings_in_list 47 | - no_duplicate_case_values 48 | - non_constant_identifier_names 49 | - overridden_fields 50 | - package_api_docs 51 | - package_names 52 | - package_prefixed_library_names 53 | - prefer_adjacent_string_concatenation 54 | - prefer_asserts_in_initializer_lists 55 | - prefer_conditional_assignment 56 | - prefer_const_constructors 57 | - prefer_const_constructors_in_immutables 58 | - prefer_const_declarations 59 | - prefer_const_literals_to_create_immutables 60 | - prefer_contains 61 | - prefer_equal_for_default_values 62 | - prefer_final_fields 63 | - prefer_final_locals 64 | - prefer_foreach 65 | - prefer_generic_function_type_aliases 66 | - prefer_initializing_formals 67 | - prefer_is_empty 68 | - prefer_is_not_empty 69 | - prefer_iterable_whereType 70 | - prefer_single_quotes 71 | - prefer_typing_uninitialized_variables 72 | - prefer_void_to_null 73 | - recursive_getters 74 | - slash_for_doc_comments 75 | - sort_constructors_first 76 | - sort_pub_dependencies 77 | - sort_unnamed_constructors_first 78 | - test_types_in_equals 79 | - throw_in_finally 80 | - type_init_formals 81 | - unnecessary_brace_in_string_interps 82 | - unnecessary_const 83 | - unnecessary_getters_setters 84 | - unnecessary_new 85 | - unnecessary_null_aware_assignments 86 | - unnecessary_null_in_if_null_operators 87 | - unnecessary_overrides 88 | - unnecessary_parenthesis 89 | - unnecessary_statements 90 | - unnecessary_this 91 | - unrelated_type_equality_checks 92 | - use_rethrow_when_possible 93 | - valid_regexps -------------------------------------------------------------------------------- /packages/location_permissions/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | .dart_tool/ 3 | 4 | .packages 5 | .pub/ 6 | 7 | build/ 8 | -------------------------------------------------------------------------------- /packages/location_permissions/.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: 8661d8aecd626f7f57ccbcb735553edc05a2e713 8 | channel: stable 9 | 10 | project_type: plugin 11 | -------------------------------------------------------------------------------- /packages/location_permissions/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## 4.0.1 2 | 3 | * Added deprecation notice and point to the [permission_handler](https://pub.dev/packages/permission_handler) plugin as replacement. 4 | 5 | ## 4.0.0 6 | 7 | * Migrated to null safety. 8 | 9 | ## 3.0.0+1 10 | 11 | * Android: fix bug where the plugin didn't differentiate between `locationWhenInUse` and `locationAlways` (see issue [#41](https://github.com/Baseflow/flutter-permission-plugins/issues/41) ) 12 | * iOS: fix bug where the plugin reports `granted` for `locationAlways` permission when user only allowed `locationWhenInUse`. 13 | 14 | ## 3.0.0 15 | 16 | * Android: migrate to the version 2 of the Android Plugin API (for details see: https://flutter.dev/docs/development/packages-and-plugins/plugin-api-migration) 17 | 18 | ## 2.0.5 19 | 20 | * iOS: fixed bug where permssions for locationWhenInUse are reported as denied incorrectly. 21 | 22 | ## 2.0.4+1 23 | 24 | * Fixed merge conflict 25 | 26 | ## 2.0.4 27 | 28 | * Synchronized Gradle and Gradle Wrapper with Flutter stable (1.12.13+hotfix.5) 29 | * Added support for Flutter analysis 30 | 31 | ## 2.0.3 32 | 33 | * Added support for Android 10 background permissions; 34 | * Ensure `shouldShowRequestPermissionRationale` is executed on the Android Activity. 35 | 36 | ## 2.0.2 37 | 38 | * Fixed bug where method `shouldShowRequestPermissionRationale` always returns `false`. 39 | 40 | ## 2.0.1 41 | 42 | * Fixed a bug where permissions on iOS are not requested in some cases; 43 | * Updated examples in the README to match the instance methods introduced in version 2.0.0. 44 | 45 | ## 2.0.0 46 | 47 | * **breaking** Changed from static to instance methods to improve testability; 48 | * Added support for CocoaPods `staticframework`; 49 | * Cleaned up some duplicated code to make code-base easier to maintain. 50 | 51 | ## 1.1.0 52 | 53 | * Adds support to listen for location service availability using a stream on Android (on iOS this is ignored, since it isn't supported by Apple); 54 | * Fixed multi-dex and AndroidX support. 55 | 56 | ## 1.0.2 57 | 58 | * Use the correct homepage in the pubspec.yaml 59 | 60 | ## 1.0.1 61 | 62 | * Ignore warnings on iOS for calling deprecated methods (these are only called on older iOS platforms). 63 | 64 | ## 1.0.0 65 | 66 | * Initial release 67 | -------------------------------------------------------------------------------- /packages/location_permissions/CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | In the interest of fostering an open and welcoming environment, we as 6 | contributors and maintainers pledge to making participation in our project and 7 | our community a harassment-free experience for everyone, regardless of age, body 8 | size, disability, ethnicity, gender identity and expression, level of experience, 9 | nationality, personal appearance, race, religion, or sexual identity and 10 | orientation. 11 | 12 | ## Our Standards 13 | 14 | Examples of behavior that contributes to creating a positive environment 15 | include: 16 | 17 | * Using welcoming and inclusive language 18 | * Being respectful of differing viewpoints and experiences 19 | * Gracefully accepting constructive criticism 20 | * Focusing on what is best for the community 21 | * Showing empathy towards other community members 22 | 23 | Examples of unacceptable behavior by participants include: 24 | 25 | * The use of sexualized language or imagery and unwelcome sexual attention or 26 | advances 27 | * Trolling, insulting/derogatory comments, and personal or political attacks 28 | * Public or private harassment 29 | * Publishing others' private information, such as a physical or electronic 30 | address, without explicit permission 31 | * Other conduct which could reasonably be considered inappropriate in a 32 | professional setting 33 | 34 | ## Our Responsibilities 35 | 36 | Project maintainers are responsible for clarifying the standards of acceptable 37 | behavior and are expected to take appropriate and fair corrective action in 38 | response to any instances of unacceptable behavior. 39 | 40 | Project maintainers have the right and responsibility to remove, edit, or 41 | reject comments, commits, code, wiki edits, issues, and other contributions 42 | that are not aligned to this Code of Conduct, or to ban temporarily or 43 | permanently any contributor for other behaviors that they deem inappropriate, 44 | threatening, offensive, or harmful. 45 | 46 | ## Scope 47 | 48 | This Code of Conduct applies both within project spaces and in public spaces 49 | when an individual is representing the project or its community. Examples of 50 | representing a project or community include using an official project e-mail 51 | address, posting via an official social media account, or acting as an appointed 52 | representative at an online or offline event. Representation of a project may be 53 | further defined and clarified by project maintainers. 54 | 55 | ## Enforcement 56 | 57 | Instances of abusive, harassing, or otherwise unacceptable behavior may be 58 | reported by contacting the project team at [hello@baseflow.com](mailto:hello@baseflow.com). All 59 | complaints will be reviewed and investigated and will result in a response that 60 | is deemed necessary and appropriate to the circumstances. The project team is 61 | obligated to maintain confidentiality with regard to the reporter of an incident. 62 | Further details of specific enforcement policies may be posted separately. 63 | 64 | Project maintainers who do not follow or enforce the Code of Conduct in good 65 | faith may face temporary or permanent repercussions as determined by other 66 | members of the project's leadership. 67 | 68 | ## Attribution 69 | 70 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, 71 | available at [http://contributor-covenant.org/version/1/4][version] 72 | 73 | [homepage]: http://contributor-covenant.org 74 | [version]: http://contributor-covenant.org/version/1/4/ -------------------------------------------------------------------------------- /packages/location_permissions/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. -------------------------------------------------------------------------------- /packages/location_permissions/README.md: -------------------------------------------------------------------------------- 1 | # Flutter Location Permissions Plugin 2 | 3 | --- 4 | 5 | ## Deprecation Notice 6 | This plugin has been replaced by the [permission_handler](https://pub.dev/packages/permission_handler). No further updates are planned to this plugin, and we encourage all users to migrate to the [permission_handler](https://pub.dev/packages/permission_handler). 7 | 8 | This plugin was initially created to support the [geolocator](https://pub.dev/packages/geolocator) plugin and as a workaround for the [issue #26]() of the permission_handler plugin. However since version 5.0.0 of the permission_handler issue #26 has been resolved and the need for this plugin ceased to exist. The permission_handler is a full featured plugin for managing permissions and is actively maintained. 9 | 10 | --- 11 | 12 | [![pub package](https://img.shields.io/pub/v/location_permissions.svg)](https://pub.dartlang.org/packages/location_permissions) 13 | 14 | The Location Permissions plugin for Flutter. This plugin provides a cross-platform (iOS, Android) API to check and request permissions to access location services. 15 | 16 | Branch | Build Status 17 | ------- | ------------ 18 | develop | [![Build Status](https://travis-ci.com/BaseflowIT/flutter-permission-plugins.svg?branch=develop)](https://travis-ci.com/BaseflowIT/flutter-permission-plugins) 19 | master | [![Build Status](https://travis-ci.com/BaseflowIT/flutter-permission-plugins.svg?branch=master)](https://travis-ci.com/BaseflowIT/flutter-permission-plugins) 20 | 21 | ## Features 22 | 23 | * Check if permission to access location services is granted. 24 | * Request permission to access location services. 25 | * Open app settings so the user can allow permission to the location services. 26 | * Show a rationale for requesting permission to access location services (Android). 27 | 28 | ## Usage 29 | 30 | To use this plugin, add `location_permissions` as a [dependency in your pubspec.yaml file](https://flutter.io/platform-plugins/). For example: 31 | 32 | ```yaml 33 | dependencies: 34 | location_permissions: ^3.0.0 35 | ``` 36 | 37 | > **NOTE:** The location_permissions plugin uses the AndroidX version of the Android Support Libraries. This means you need to make sure your Android project is also upgraded to support AndroidX. Detailed instructions can be found [here](https://flutter.dev/docs/development/packages-and-plugins/androidx-compatibility). 38 | > 39 | >The TL;DR version is: 40 | > 41 | >1. Add the following to your "gradle.properties" file: 42 | > 43 | >``` 44 | >android.useAndroidX=true 45 | >android.enableJetifier=true 46 | >``` 47 | >2. Make sure you set the `compileSdkVersion` in your "android/app/build.gradle" file to 28 or higher: 48 | > 49 | >``` 50 | >android { 51 | > compileSdkVersion 28 52 | > 53 | > ... 54 | >} 55 | >``` 56 | >3. Make sure you replace all the `android.` dependencies to their AndroidX counterparts (a full list can be found here: https://developer.android.com/jetpack/androidx/migrate). 57 | 58 | ## API 59 | 60 | ### Requesting permission 61 | 62 | ```dart 63 | import 'package:location_permissions/location_permissions.dart'; 64 | 65 | PermissionStatus permission = await LocationPermissions().requestPermissions(); 66 | ``` 67 | 68 | ### Checking permission 69 | 70 | ```dart 71 | import 'package:location_permissions/location_permissions.dart'; 72 | 73 | PermissionStatus permission = await LocationPermissions().checkPermissionStatus(); 74 | ``` 75 | 76 | ### Checking service status 77 | 78 | ```dart 79 | import 'package:location_permissions/location_permissions.dart'; 80 | 81 | ServiceStatus serviceStatus = await LocationPermissions().checkServiceStatus(); 82 | ``` 83 | 84 | ### Open app settings 85 | 86 | ```dart 87 | import 'package:location_permissions/location_permissions.dart'; 88 | 89 | bool isOpened = await LocationPermissions().openAppSettings(); 90 | ``` 91 | 92 | ### Show a rationale for requesting permission (Android only) 93 | 94 | ```dart 95 | import 'package:location_permissions/location_permissions.dart'; 96 | 97 | bool isShown = await LocationPermissions().shouldShowRequestPermissionRationale(); 98 | ``` 99 | 100 | This will always return `false` on iOS. 101 | 102 | ### List of available permissions levels (only applicable for iOS) 103 | 104 | Defines the location permission levels for which can be used on iOS to distinguish between permission to access location services when the app is in use or always. 105 | 106 | ```dart 107 | enum LocationPermissionLevel { 108 | /// Android: Fine and Coarse Location 109 | /// iOS: CoreLocation (Always and WhenInUse) 110 | location, 111 | 112 | /// Android: Fine and Coarse Location 113 | /// iOS: CoreLocation - Always 114 | locationAlways, 115 | 116 | /// Android: Fine and Coarse Location 117 | /// iOS: CoreLocation - WhenInUse 118 | locationWhenInUse, 119 | } 120 | ``` 121 | 122 | ### Status of the permission 123 | 124 | Defines the state of a location permissions 125 | 126 | ```dart 127 | enum PermissionStatus { 128 | /// Permission to access the location services is denied by the user. 129 | denied, 130 | 131 | /// Permission to access the location services is granted by the user. 132 | granted, 133 | 134 | /// The user granted restricted access to the location services (only on iOS). 135 | restricted, 136 | 137 | /// Permission is in an unknown state 138 | unknown 139 | } 140 | ``` 141 | 142 | ### Overview of possible service statuses 143 | 144 | Defines the state of the location services on the platform 145 | 146 | ```dart 147 | /// Defines the state of the location services 148 | enum ServiceStatus { 149 | /// The unknown service status indicates the state of the location services could not be determined. 150 | unknown, 151 | 152 | /// Location services are not available on the device. 153 | notApplicable, 154 | 155 | /// The location services are disabled. 156 | disabled, 157 | 158 | /// The location services are enabled. 159 | enabled 160 | } 161 | ``` 162 | 163 | ## Issues 164 | 165 | Please file any issues, bugs or feature request as an issue on our [GitHub](https://github.com/BaseflowIT/flutter-permission-handlers/issues) page. 166 | 167 | ## Want to contribute 168 | 169 | 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](https://github.com/Baseflow/flutter-permission-plugins/blob/develop/CONTRIBUTING.md) and send us your [pull request](https://github.com/BaseflowIT/flutter-permission-handlers/pulls). 170 | 171 | ## Author 172 | 173 | This Permission handler plugin for Flutter is developed by [Baseflow](https://baseflow.com). You can contact us at 174 | -------------------------------------------------------------------------------- /packages/location_permissions/analysis_options.yaml: -------------------------------------------------------------------------------- 1 | include: package:pedantic/analysis_options.1.8.0.yaml 2 | analyzer: 3 | exclude: 4 | # Ignore generated files 5 | - '**/*.g.dart' 6 | - 'lib/src/generated/*.dart' 7 | linter: 8 | rules: 9 | - public_member_api_docs -------------------------------------------------------------------------------- /packages/location_permissions/android/.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/workspace.xml 5 | /.idea/libraries 6 | .DS_Store 7 | /build 8 | /captures 9 | -------------------------------------------------------------------------------- /packages/location_permissions/android/build.gradle: -------------------------------------------------------------------------------- 1 | group 'com.baseflow.location_permissions' 2 | version '1.0-SNAPSHOT' 3 | 4 | buildscript { 5 | repositories { 6 | google() 7 | jcenter() 8 | } 9 | 10 | dependencies { 11 | classpath 'com.android.tools.build:gradle:3.5.0' 12 | } 13 | } 14 | 15 | rootProject.allprojects { 16 | repositories { 17 | google() 18 | jcenter() 19 | } 20 | } 21 | 22 | apply plugin: 'com.android.library' 23 | 24 | android { 25 | compileSdkVersion 29 26 | 27 | defaultConfig { 28 | minSdkVersion 16 29 | multiDexEnabled true 30 | } 31 | lintOptions { 32 | disable 'InvalidPackage' 33 | } 34 | } 35 | 36 | dependencies { 37 | implementation 'androidx.annotation:annotation:1.1.0' 38 | implementation 'androidx.core:core:1.1.0' 39 | } 40 | -------------------------------------------------------------------------------- /packages/location_permissions/android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536M 2 | android.useAndroidX=true 3 | android.enableJetifier=true -------------------------------------------------------------------------------- /packages/location_permissions/android/settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'location_permissions' 2 | -------------------------------------------------------------------------------- /packages/location_permissions/android/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | -------------------------------------------------------------------------------- /packages/location_permissions/android/src/main/java/com/baseflow/location_permissions/LocationPermissionsPlugin.java: -------------------------------------------------------------------------------- 1 | package com.baseflow.location_permissions; 2 | 3 | import static io.flutter.plugin.common.EventChannel.EventSink; 4 | import static io.flutter.plugin.common.EventChannel.StreamHandler; 5 | 6 | import android.Manifest; 7 | import android.app.Activity; 8 | import android.content.BroadcastReceiver; 9 | import android.content.Context; 10 | import android.content.Intent; 11 | import android.content.IntentFilter; 12 | import android.content.pm.PackageInfo; 13 | import android.content.pm.PackageManager; 14 | import android.location.LocationManager; 15 | import android.os.Build; 16 | import android.provider.Settings; 17 | import android.text.TextUtils; 18 | import android.util.Log; 19 | import androidx.annotation.IntDef; 20 | import androidx.annotation.NonNull; 21 | import androidx.core.app.ActivityCompat; 22 | import androidx.core.content.ContextCompat; 23 | 24 | import io.flutter.embedding.engine.plugins.FlutterPlugin; 25 | import io.flutter.embedding.engine.plugins.activity.ActivityAware; 26 | import io.flutter.embedding.engine.plugins.activity.ActivityPluginBinding; 27 | import io.flutter.plugin.common.BinaryMessenger; 28 | import io.flutter.plugin.common.EventChannel; 29 | import io.flutter.plugin.common.MethodCall; 30 | import io.flutter.plugin.common.MethodChannel; 31 | import io.flutter.plugin.common.MethodChannel.MethodCallHandler; 32 | import io.flutter.plugin.common.MethodChannel.Result; 33 | import io.flutter.plugin.common.PluginRegistry; 34 | import io.flutter.plugin.common.PluginRegistry.Registrar; 35 | import java.lang.annotation.Retention; 36 | import java.lang.annotation.RetentionPolicy; 37 | import java.util.ArrayList; 38 | import java.util.Arrays; 39 | import java.util.List; 40 | 41 | /** LocationPermissionsPlugin */ 42 | public class LocationPermissionsPlugin implements MethodCallHandler, StreamHandler, FlutterPlugin, ActivityAware { 43 | private static final String LOG_TAG = "location_permissions"; 44 | private static final int PERMISSION_CODE = 25; 45 | 46 | //PERMISSION_STATUS 47 | private static final int PERMISSION_STATUS_UNKNOWN = 0; 48 | private static final int PERMISSION_STATUS_DENIED = 1; 49 | private static final int PERMISSION_STATUS_GRANTED = 2; 50 | private static final int PERMISSION_STATUS_RESTRICTED = 3; 51 | 52 | @Retention(RetentionPolicy.SOURCE) 53 | @IntDef({ 54 | PERMISSION_STATUS_UNKNOWN, 55 | PERMISSION_STATUS_DENIED, 56 | PERMISSION_STATUS_GRANTED, 57 | PERMISSION_STATUS_RESTRICTED, 58 | }) 59 | private @interface PermissionStatus {} 60 | 61 | //SERVICE_STATUS 62 | private static final int SERVICE_STATUS_UNKNOWN = 0; 63 | private static final int SERVICE_STATUS_DISABLED = 1; 64 | private static final int SERVICE_STATUS_ENABLED = 2; 65 | private static final int SERVICE_STATUS_NOT_APPLICABLE = 3; 66 | 67 | @Retention(RetentionPolicy.SOURCE) 68 | @IntDef({ 69 | SERVICE_STATUS_DISABLED, 70 | SERVICE_STATUS_ENABLED, 71 | SERVICE_STATUS_NOT_APPLICABLE, 72 | SERVICE_STATUS_UNKNOWN, 73 | }) 74 | private @interface ServiceStatus {} 75 | 76 | //PERMISSION_LEVEL 77 | private static final int PERMISSION_LEVEL_AUTO = 0; 78 | private static final int PERMISSION_LEVEL_WHEN_IN_USE = 1; 79 | private static final int PERMISSION_LEVEL_ALWAYS = 2; 80 | 81 | @Retention(RetentionPolicy.SOURCE) 82 | @IntDef({ 83 | PERMISSION_LEVEL_AUTO, 84 | PERMISSION_LEVEL_WHEN_IN_USE, 85 | PERMISSION_LEVEL_ALWAYS, 86 | }) 87 | private @interface PermissionLevel {} 88 | 89 | private Context applicationContext; 90 | private Activity activity; 91 | private Result mResult; 92 | private EventSink mEventSink; 93 | private final IntentFilter mIntentFilter; 94 | private final LocationServiceBroadcastReceiver mReceiver; 95 | 96 | public LocationPermissionsPlugin() { 97 | mReceiver = new LocationServiceBroadcastReceiver(this); 98 | mIntentFilter = 99 | Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT 100 | ? new IntentFilter(LocationManager.MODE_CHANGED_ACTION) 101 | : null; 102 | } 103 | 104 | private static void register(final LocationPermissionsPlugin plugin, BinaryMessenger messenger) { 105 | final MethodChannel channel = 106 | new MethodChannel(messenger, "com.baseflow.flutter/location_permissions"); 107 | final EventChannel eventChannel = 108 | new EventChannel(messenger, "com.baseflow.flutter/location_permissions_events"); 109 | channel.setMethodCallHandler(plugin); 110 | eventChannel.setStreamHandler(plugin); 111 | } 112 | 113 | /** Plugin registration. */ 114 | public static void registerWith(final Registrar registrar) { 115 | final LocationPermissionsPlugin plugin = new LocationPermissionsPlugin(); 116 | register(plugin, registrar.messenger()); 117 | plugin.applicationContext = registrar.context(); 118 | plugin.activity = registrar.activity(); 119 | 120 | registrar.addRequestPermissionsResultListener(createAddRequestPermissionsResultListener(plugin)); 121 | } 122 | 123 | private void emitLocationServiceStatus(boolean enabled) { 124 | if (mEventSink != null) { 125 | mEventSink.success(enabled); 126 | } 127 | } 128 | 129 | @Override 130 | public void onMethodCall(MethodCall call, Result result) { 131 | if (applicationContext == null) { 132 | Log.d(LOG_TAG, "Unable to detect current Activity or App Context."); 133 | result.error( 134 | "ERROR_MISSING_CONTEXT", "Unable to detect current Activity or Active Context.", null); 135 | return; 136 | } 137 | 138 | switch (call.method) { 139 | case "checkPermissionStatus": 140 | @PermissionStatus 141 | final int permissionStatus = LocationPermissionsPlugin.checkPermissionStatus(applicationContext, (int) call.arguments); 142 | result.success(permissionStatus); 143 | break; 144 | case "checkServiceStatus": 145 | @ServiceStatus 146 | final int serviceStatus = LocationPermissionsPlugin.checkServiceStatus(applicationContext); 147 | result.success(serviceStatus); 148 | break; 149 | case "requestPermission": 150 | if (mResult != null) { 151 | result.error( 152 | "ERROR_ALREADY_REQUESTING_PERMISSIONS", 153 | "A request for permissions is already running, please wait for it to finish before doing another request (note that you can request multiple permissions at the same time).", 154 | null); 155 | return; 156 | } 157 | 158 | mResult = result; 159 | requestPermissions((int) call.arguments); 160 | break; 161 | case "shouldShowRequestPermissionRationale": 162 | final boolean shouldShow = 163 | LocationPermissionsPlugin.shouldShowRequestPermissionRationale(activity); 164 | 165 | result.success(shouldShow); 166 | break; 167 | case "openAppSettings": 168 | boolean isOpen = LocationPermissionsPlugin.openAppSettings(applicationContext); 169 | result.success(isOpen); 170 | break; 171 | default: 172 | result.notImplemented(); 173 | break; 174 | } 175 | } 176 | 177 | @Override 178 | public void onListen(Object arguments, EventSink events) { 179 | events.success(isLocationServiceEnabled(applicationContext)); 180 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { 181 | applicationContext.registerReceiver(mReceiver, mIntentFilter); 182 | mEventSink = events; 183 | } else { 184 | throw new UnsupportedOperationException( 185 | "Location service availability stream requires at least Android K."); 186 | } 187 | } 188 | 189 | @Override 190 | public void onCancel(Object arguments) { 191 | if (mEventSink != null) { 192 | applicationContext.unregisterReceiver(mReceiver); 193 | mEventSink = null; 194 | } 195 | } 196 | 197 | @PermissionStatus 198 | private static int checkPermissionStatus(Context context, @PermissionLevel int permissionLevel) { 199 | final List names = LocationPermissionsPlugin.getNamesForLevel(context, permissionLevel); 200 | 201 | if (names == null) { 202 | Log.d(LOG_TAG, "No android specific permissions needed for: $permission"); 203 | 204 | return PERMISSION_STATUS_GRANTED; 205 | } 206 | 207 | //if no permissions were found then there is an issue and permission is not set in Android manifest 208 | if (names.size() == 0) { 209 | Log.d(LOG_TAG, "No permissions requested for: $permission"); 210 | return PERMISSION_STATUS_UNKNOWN; 211 | } 212 | 213 | if (context == null) { 214 | return PERMISSION_STATUS_UNKNOWN; 215 | } 216 | 217 | final boolean targetsMOrHigher = 218 | context.getApplicationInfo().targetSdkVersion >= android.os.Build.VERSION_CODES.M; 219 | 220 | for (String name : names) { 221 | if (targetsMOrHigher) { 222 | final int permissionStatus = ContextCompat.checkSelfPermission(context, name); 223 | if (permissionStatus == PackageManager.PERMISSION_DENIED) { 224 | return PERMISSION_STATUS_DENIED; 225 | } else if (permissionStatus != PackageManager.PERMISSION_GRANTED) { 226 | return PERMISSION_STATUS_UNKNOWN; 227 | } 228 | } 229 | } 230 | 231 | return PERMISSION_STATUS_GRANTED; 232 | } 233 | 234 | @ServiceStatus 235 | private static int checkServiceStatus(Context context) { 236 | 237 | if (context == null) { 238 | return SERVICE_STATUS_UNKNOWN; 239 | } 240 | 241 | return isLocationServiceEnabled(context) ? SERVICE_STATUS_ENABLED : SERVICE_STATUS_DISABLED; 242 | } 243 | 244 | private void requestPermissions(@PermissionLevel int permissionLevel) { 245 | if (activity == null) { 246 | Log.d(LOG_TAG, "Unable to detect current Activity."); 247 | 248 | processResult(PERMISSION_STATUS_UNKNOWN); 249 | return; 250 | } 251 | 252 | @PermissionStatus final int permissionStatus = checkPermissionStatus(activity, permissionLevel); 253 | if (permissionStatus != PERMISSION_STATUS_GRANTED) { 254 | final List names = getNamesForLevel(activity, permissionLevel); 255 | 256 | ActivityCompat.requestPermissions( 257 | activity, names.toArray(new String[0]), PERMISSION_CODE); 258 | } else { 259 | processResult(PERMISSION_STATUS_GRANTED); 260 | } 261 | } 262 | 263 | private void handlePermissionsRequest(String[] permissions, int[] grantResults) { 264 | if (mResult == null) { 265 | Log.e(LOG_TAG, "Flutter result object is null."); 266 | return; 267 | } 268 | 269 | for (int i = 0; i < permissions.length; i++) { 270 | if (LocationPermissionsPlugin.isLocationPermission(permissions[i])) { 271 | @PermissionStatus int permissionStatus = toPermissionStatus(grantResults[i]); 272 | 273 | processResult(permissionStatus); 274 | return; 275 | } 276 | } 277 | 278 | processResult(PERMISSION_STATUS_UNKNOWN); 279 | } 280 | 281 | private static Boolean isLocationPermission(String permission) { 282 | return permission.equals(Manifest.permission.ACCESS_COARSE_LOCATION) 283 | || permission.equals(Manifest.permission.ACCESS_FINE_LOCATION) 284 | || (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q && permission.equals(Manifest.permission.ACCESS_BACKGROUND_LOCATION)); 285 | } 286 | 287 | @PermissionStatus 288 | private int toPermissionStatus(int grantResult) { 289 | return grantResult == PackageManager.PERMISSION_GRANTED 290 | ? PERMISSION_STATUS_GRANTED 291 | : PERMISSION_STATUS_DENIED; 292 | } 293 | 294 | private void processResult(@PermissionStatus int status) { 295 | mResult.success(status); 296 | mResult = null; 297 | } 298 | 299 | private static List getNamesForLevel(Context context, @PermissionLevel int permissionLevel) { 300 | final ArrayList names = new ArrayList<>(); 301 | 302 | if (permissionLevel == PERMISSION_LEVEL_AUTO) { 303 | names.addAll(getManifestNames(context)); 304 | } else if (permissionLevel == PERMISSION_LEVEL_WHEN_IN_USE) { 305 | names.add(Manifest.permission.ACCESS_COARSE_LOCATION); 306 | names.add(Manifest.permission.ACCESS_FINE_LOCATION); 307 | } else if (permissionLevel == PERMISSION_LEVEL_ALWAYS) { 308 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { 309 | names.add(Manifest.permission.ACCESS_BACKGROUND_LOCATION); 310 | } 311 | 312 | names.add(Manifest.permission.ACCESS_COARSE_LOCATION); 313 | names.add(Manifest.permission.ACCESS_FINE_LOCATION); 314 | } 315 | 316 | return names; 317 | } 318 | 319 | private static List getManifestNames(Context context) { 320 | final ArrayList permissionNames = new ArrayList<>(); 321 | 322 | if (hasPermissionInManifest(Manifest.permission.ACCESS_COARSE_LOCATION, context)) { 323 | permissionNames.add(Manifest.permission.ACCESS_COARSE_LOCATION); 324 | } 325 | 326 | if (hasPermissionInManifest(Manifest.permission.ACCESS_FINE_LOCATION, context)) { 327 | permissionNames.add(Manifest.permission.ACCESS_FINE_LOCATION); 328 | } 329 | 330 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q && hasPermissionInManifest(Manifest.permission.ACCESS_BACKGROUND_LOCATION, context)) { 331 | permissionNames.add(Manifest.permission.ACCESS_BACKGROUND_LOCATION); 332 | } 333 | 334 | return permissionNames; 335 | } 336 | 337 | private static boolean hasPermissionInManifest(String permission, Context context) { 338 | try { 339 | PackageInfo info = 340 | context 341 | .getPackageManager() 342 | .getPackageInfo(context.getPackageName(), PackageManager.GET_PERMISSIONS); 343 | 344 | if (info == null) { 345 | Log.d( 346 | LOG_TAG, 347 | "Unable to get Package info, will not be able to determine permissions to request."); 348 | return false; 349 | } 350 | 351 | final List manifestPermissions = 352 | new ArrayList<>(Arrays.asList(info.requestedPermissions)); 353 | for (String r : manifestPermissions) { 354 | if (r.equals(permission)) { 355 | return true; 356 | } 357 | } 358 | } catch (Exception ex) { 359 | Log.d(LOG_TAG, "Unable to check manifest for permission: ", ex); 360 | } 361 | return false; 362 | } 363 | 364 | @SuppressWarnings("deprecation") 365 | private static boolean isLocationServiceEnabled(Context context) { 366 | if (Build.VERSION.SDK_INT >= 28) { 367 | final LocationManager locationManager = context.getSystemService(LocationManager.class); 368 | if (locationManager == null) { 369 | return false; 370 | } 371 | 372 | return locationManager.isLocationEnabled(); 373 | } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { 374 | final int locationMode; 375 | 376 | try { 377 | locationMode = 378 | Settings.Secure.getInt(context.getContentResolver(), Settings.Secure.LOCATION_MODE); 379 | } catch (Settings.SettingNotFoundException e) { 380 | e.printStackTrace(); 381 | return false; 382 | } 383 | 384 | return locationMode != Settings.Secure.LOCATION_MODE_OFF; 385 | } else { 386 | final String locationProviders = 387 | Settings.Secure.getString( 388 | context.getContentResolver(), Settings.Secure.LOCATION_PROVIDERS_ALLOWED); 389 | return !TextUtils.isEmpty(locationProviders); 390 | } 391 | } 392 | 393 | private static boolean shouldShowRequestPermissionRationale(Activity activity) { 394 | if (activity == null) { 395 | Log.e(LOG_TAG, "Unable to detect current Activity."); 396 | return false; 397 | } 398 | 399 | List names = getManifestNames(activity); 400 | 401 | // if isn't an android specific group then go ahead and return false; 402 | if (names == null) { 403 | Log.d(LOG_TAG, "No android specific permissions needed for: $permission"); 404 | return false; 405 | } 406 | 407 | if (names.isEmpty()) { 408 | Log.d( 409 | LOG_TAG, 410 | "No permissions found in manifest for: $permission no need to show request rationale"); 411 | return false; 412 | } 413 | 414 | //noinspection LoopStatementThatDoesntLoop 415 | for (String name : names) { 416 | return ActivityCompat.shouldShowRequestPermissionRationale(activity, name); 417 | } 418 | 419 | return false; 420 | } 421 | 422 | private static boolean openAppSettings(Context context) { 423 | try { 424 | Intent settingsIntent = new Intent(); 425 | settingsIntent.setAction(android.provider.Settings.ACTION_APPLICATION_DETAILS_SETTINGS); 426 | settingsIntent.addCategory(Intent.CATEGORY_DEFAULT); 427 | settingsIntent.setData(android.net.Uri.parse("package:" + context.getPackageName())); 428 | settingsIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); 429 | settingsIntent.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY); 430 | settingsIntent.addFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS); 431 | 432 | context.startActivity(settingsIntent); 433 | 434 | return true; 435 | } catch (Exception ex) { 436 | return false; 437 | } 438 | } 439 | 440 | private static class LocationServiceBroadcastReceiver extends BroadcastReceiver { 441 | private final LocationPermissionsPlugin locationPermissionsPlugin; 442 | 443 | private LocationServiceBroadcastReceiver(LocationPermissionsPlugin locationPermissionsPlugin) { 444 | this.locationPermissionsPlugin = locationPermissionsPlugin; 445 | } 446 | 447 | @Override 448 | public void onReceive(Context context, Intent intent) { 449 | locationPermissionsPlugin.emitLocationServiceStatus(isLocationServiceEnabled(context)); 450 | } 451 | } 452 | 453 | private static PluginRegistry.RequestPermissionsResultListener createAddRequestPermissionsResultListener(final LocationPermissionsPlugin plugin) { 454 | return new PluginRegistry.RequestPermissionsResultListener() { 455 | @Override 456 | public boolean onRequestPermissionsResult( 457 | int id, String[] permissions, int[] grantResults) { 458 | if (id == PERMISSION_CODE) { 459 | plugin.handlePermissionsRequest(permissions, grantResults); 460 | return true; 461 | } else { 462 | return false; 463 | } 464 | } 465 | }; 466 | } 467 | 468 | @Override 469 | public void onAttachedToEngine(@NonNull FlutterPluginBinding binding) { 470 | register(this, binding.getBinaryMessenger()); 471 | applicationContext = binding.getApplicationContext(); 472 | } 473 | 474 | @Override 475 | public void onDetachedFromEngine(@NonNull FlutterPluginBinding binding) { 476 | 477 | } 478 | 479 | @Override 480 | public void onAttachedToActivity(@NonNull ActivityPluginBinding binding) { 481 | activity = binding.getActivity(); 482 | binding.addRequestPermissionsResultListener(createAddRequestPermissionsResultListener(this)); 483 | } 484 | 485 | @Override 486 | public void onDetachedFromActivityForConfigChanges() { 487 | 488 | } 489 | 490 | @Override 491 | public void onReattachedToActivityForConfigChanges(@NonNull ActivityPluginBinding binding) { 492 | 493 | } 494 | 495 | @Override 496 | public void onDetachedFromActivity() { 497 | 498 | } 499 | } 500 | -------------------------------------------------------------------------------- /packages/location_permissions/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 | .packages 26 | .pub-cache/ 27 | .pub/ 28 | /build/ 29 | 30 | # Android related 31 | **/android/**/gradle-wrapper.jar 32 | **/android/.gradle 33 | **/android/captures/ 34 | **/android/gradlew 35 | **/android/gradlew.bat 36 | **/android/local.properties 37 | **/android/**/GeneratedPluginRegistrant.java 38 | 39 | # iOS/XCode related 40 | **/ios/**/*.mode1v3 41 | **/ios/**/*.mode2v3 42 | **/ios/**/*.moved-aside 43 | **/ios/**/*.pbxuser 44 | **/ios/**/*.perspectivev3 45 | **/ios/**/*sync/ 46 | **/ios/**/.sconsign.dblite 47 | **/ios/**/.tags* 48 | **/ios/**/.vagrant/ 49 | **/ios/**/DerivedData/ 50 | **/ios/**/Icon? 51 | **/ios/**/Pods/ 52 | **/ios/**/.symlinks/ 53 | **/ios/**/profile 54 | **/ios/**/xcuserdata 55 | **/ios/.generated/ 56 | **/ios/Flutter/App.framework 57 | **/ios/Flutter/Flutter.framework 58 | **/ios/Flutter/Generated.xcconfig 59 | **/ios/Flutter/app.flx 60 | **/ios/Flutter/app.zip 61 | **/ios/Flutter/flutter_assets/ 62 | **/ios/ServiceDefinitions.json 63 | **/ios/Runner/GeneratedPluginRegistrant.* 64 | 65 | # Exceptions to above rules. 66 | !**/ios/**/default.mode1v3 67 | !**/ios/**/default.mode2v3 68 | !**/ios/**/default.pbxuser 69 | !**/ios/**/default.perspectivev3 70 | !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages 71 | -------------------------------------------------------------------------------- /packages/location_permissions/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: 8661d8aecd626f7f57ccbcb735553edc05a2e713 8 | channel: stable 9 | 10 | project_type: app 11 | -------------------------------------------------------------------------------- /packages/location_permissions/example/README.md: -------------------------------------------------------------------------------- 1 | # location_permissions_example 2 | 3 | Demonstrates how to use the location_permissions 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 | -------------------------------------------------------------------------------- /packages/location_permissions/example/android/app/build.gradle: -------------------------------------------------------------------------------- 1 | def localProperties = new Properties() 2 | def localPropertiesFile = rootProject.file('local.properties') 3 | if (localPropertiesFile.exists()) { 4 | localPropertiesFile.withReader('UTF-8') { reader -> 5 | localProperties.load(reader) 6 | } 7 | } 8 | 9 | def flutterRoot = localProperties.getProperty('flutter.sdk') 10 | if (flutterRoot == null) { 11 | throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") 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 | apply plugin: 'com.android.application' 25 | apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" 26 | 27 | android { 28 | compileSdkVersion 29 29 | 30 | lintOptions { 31 | disable 'InvalidPackage' 32 | } 33 | 34 | defaultConfig { 35 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). 36 | applicationId "com.baseflow.location_permissions_example" 37 | minSdkVersion 16 38 | targetSdkVersion 29 39 | versionCode flutterVersionCode.toInteger() 40 | versionName flutterVersionName 41 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 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 | 57 | dependencies { 58 | testImplementation 'junit:junit:4.12' 59 | androidTestImplementation 'com.android.support.test:runner:1.0.2' 60 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' 61 | } 62 | -------------------------------------------------------------------------------- /packages/location_permissions/example/android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /packages/location_permissions/example/android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 12 | 16 | 23 | 27 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /packages/location_permissions/example/android/app/src/main/java/com/baseflow/location_permissions_example/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.baseflow.location_permissions_example; 2 | 3 | import android.os.Bundle; 4 | import io.flutter.app.FlutterActivity; 5 | import io.flutter.plugins.GeneratedPluginRegistrant; 6 | 7 | public class MainActivity extends FlutterActivity { 8 | @Override 9 | protected void onCreate(Bundle savedInstanceState) { 10 | super.onCreate(savedInstanceState); 11 | GeneratedPluginRegistrant.registerWith(this); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /packages/location_permissions/example/android/app/src/main/res/drawable/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /packages/location_permissions/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Baseflow/flutter-permission-plugins/5c5d40204fa449aa97ebc1e2c598528ba6ac0e30/packages/location_permissions/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /packages/location_permissions/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Baseflow/flutter-permission-plugins/5c5d40204fa449aa97ebc1e2c598528ba6ac0e30/packages/location_permissions/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /packages/location_permissions/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Baseflow/flutter-permission-plugins/5c5d40204fa449aa97ebc1e2c598528ba6ac0e30/packages/location_permissions/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /packages/location_permissions/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Baseflow/flutter-permission-plugins/5c5d40204fa449aa97ebc1e2c598528ba6ac0e30/packages/location_permissions/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /packages/location_permissions/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Baseflow/flutter-permission-plugins/5c5d40204fa449aa97ebc1e2c598528ba6ac0e30/packages/location_permissions/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /packages/location_permissions/example/android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | -------------------------------------------------------------------------------- /packages/location_permissions/example/android/app/src/profile/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /packages/location_permissions/example/android/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | repositories { 3 | google() 4 | jcenter() 5 | } 6 | 7 | dependencies { 8 | classpath 'com.android.tools.build:gradle:3.5.0' 9 | } 10 | } 11 | 12 | allprojects { 13 | repositories { 14 | google() 15 | jcenter() 16 | } 17 | } 18 | 19 | rootProject.buildDir = '../build' 20 | subprojects { 21 | project.buildDir = "${rootProject.buildDir}/${project.name}" 22 | } 23 | subprojects { 24 | project.evaluationDependsOn(':app') 25 | } 26 | 27 | task clean(type: Delete) { 28 | delete rootProject.buildDir 29 | } 30 | -------------------------------------------------------------------------------- /packages/location_permissions/example/android/gradle.properties: -------------------------------------------------------------------------------- 1 | android.enableJetifier=true 2 | android.useAndroidX=true 3 | android.enableR8=true 4 | org.gradle.jvmargs=-Xmx1536M 5 | -------------------------------------------------------------------------------- /packages/location_permissions/example/android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Thu Jun 06 10:14:03 CEST 2019 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-5.6.2-all.zip 7 | -------------------------------------------------------------------------------- /packages/location_permissions/example/android/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | 3 | def flutterProjectRoot = rootProject.projectDir.parentFile.toPath() 4 | 5 | def plugins = new Properties() 6 | def pluginsFile = new File(flutterProjectRoot.toFile(), '.flutter-plugins') 7 | if (pluginsFile.exists()) { 8 | pluginsFile.withReader('UTF-8') { reader -> plugins.load(reader) } 9 | } 10 | 11 | plugins.each { name, path -> 12 | def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile() 13 | include ":$name" 14 | project(":$name").projectDir = pluginDirectory 15 | } 16 | -------------------------------------------------------------------------------- /packages/location_permissions/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 | 8.0 25 | 26 | 27 | -------------------------------------------------------------------------------- /packages/location_permissions/example/ios/Flutter/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" 2 | #include "Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /packages/location_permissions/example/ios/Flutter/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" 2 | #include "Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /packages/location_permissions/example/ios/Podfile: -------------------------------------------------------------------------------- 1 | # Uncomment this line to define a global platform for your project 2 | # platform :ios, '9.0' 3 | 4 | # CocoaPods analytics sends network stats synchronously affecting flutter build latency. 5 | ENV['COCOAPODS_DISABLE_STATS'] = 'true' 6 | 7 | project 'Runner', { 8 | 'Debug' => :debug, 9 | 'Profile' => :release, 10 | 'Release' => :release, 11 | } 12 | 13 | def flutter_root 14 | generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__) 15 | unless File.exist?(generated_xcode_build_settings_path) 16 | raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first" 17 | end 18 | 19 | File.foreach(generated_xcode_build_settings_path) do |line| 20 | matches = line.match(/FLUTTER_ROOT\=(.*)/) 21 | return matches[1].strip if matches 22 | end 23 | raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get" 24 | end 25 | 26 | require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) 27 | 28 | flutter_ios_podfile_setup 29 | 30 | target 'Runner' do 31 | flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__)) 32 | end 33 | 34 | post_install do |installer| 35 | installer.pods_project.targets.each do |target| 36 | flutter_additional_ios_build_settings(target) 37 | end 38 | end 39 | -------------------------------------------------------------------------------- /packages/location_permissions/example/ios/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - Flutter (1.0.0) 3 | - "location_permissions (3.0.0+1)": 4 | - Flutter 5 | 6 | DEPENDENCIES: 7 | - Flutter (from `Flutter`) 8 | - location_permissions (from `.symlinks/plugins/location_permissions/ios`) 9 | 10 | EXTERNAL SOURCES: 11 | Flutter: 12 | :path: Flutter 13 | location_permissions: 14 | :path: ".symlinks/plugins/location_permissions/ios" 15 | 16 | SPEC CHECKSUMS: 17 | Flutter: 434fef37c0980e73bb6479ef766c45957d4b510c 18 | location_permissions: 7e0f9aa0f60deb8ff93ddf0e2a164c7e8197bc94 19 | 20 | PODFILE CHECKSUM: 8e679eca47255a8ca8067c4c67aab20e64cb974d 21 | 22 | COCOAPODS: 1.10.1 23 | -------------------------------------------------------------------------------- /packages/location_permissions/example/ios/Runner.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; 11 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; 12 | 978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */; }; 13 | 97C146F31CF9000F007C117D /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 97C146F21CF9000F007C117D /* main.m */; }; 14 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; 15 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; 16 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; 17 | C2CD69936970072E322693B9 /* libPods-Runner.a in Frameworks */ = {isa = PBXBuildFile; fileRef = FBF1FFFBF6C9BCF9FDD9B74C /* libPods-Runner.a */; }; 18 | /* End PBXBuildFile section */ 19 | 20 | /* Begin PBXCopyFilesBuildPhase section */ 21 | 9705A1C41CF9048500538489 /* Embed Frameworks */ = { 22 | isa = PBXCopyFilesBuildPhase; 23 | buildActionMask = 2147483647; 24 | dstPath = ""; 25 | dstSubfolderSpec = 10; 26 | files = ( 27 | ); 28 | name = "Embed Frameworks"; 29 | runOnlyForDeploymentPostprocessing = 0; 30 | }; 31 | /* End PBXCopyFilesBuildPhase section */ 32 | 33 | /* Begin PBXFileReference section */ 34 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; 35 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; 36 | 2B6518BB87371F0DFBFE1F44 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; 37 | 3B0D5790EA1F841E7281580F /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Pods/Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; }; 38 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; 39 | 67911518417363E8F26FD7BB /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; 40 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; 41 | 7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 42 | 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 43 | 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; 44 | 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; 45 | 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; 46 | 97C146F21CF9000F007C117D /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 47 | 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 48 | 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 49 | 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 50 | 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 51 | FBF1FFFBF6C9BCF9FDD9B74C /* libPods-Runner.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-Runner.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 52 | /* End PBXFileReference section */ 53 | 54 | /* Begin PBXFrameworksBuildPhase section */ 55 | 97C146EB1CF9000F007C117D /* Frameworks */ = { 56 | isa = PBXFrameworksBuildPhase; 57 | buildActionMask = 2147483647; 58 | files = ( 59 | C2CD69936970072E322693B9 /* libPods-Runner.a in Frameworks */, 60 | ); 61 | runOnlyForDeploymentPostprocessing = 0; 62 | }; 63 | /* End PBXFrameworksBuildPhase section */ 64 | 65 | /* Begin PBXGroup section */ 66 | 0D9F419CD47F2F859D1F4B43 /* Frameworks */ = { 67 | isa = PBXGroup; 68 | children = ( 69 | FBF1FFFBF6C9BCF9FDD9B74C /* libPods-Runner.a */, 70 | ); 71 | name = Frameworks; 72 | sourceTree = ""; 73 | }; 74 | 9740EEB11CF90186004384FC /* Flutter */ = { 75 | isa = PBXGroup; 76 | children = ( 77 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */, 78 | 9740EEB21CF90195004384FC /* Debug.xcconfig */, 79 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, 80 | 9740EEB31CF90195004384FC /* Generated.xcconfig */, 81 | ); 82 | name = Flutter; 83 | sourceTree = ""; 84 | }; 85 | 97C146E51CF9000F007C117D = { 86 | isa = PBXGroup; 87 | children = ( 88 | 9740EEB11CF90186004384FC /* Flutter */, 89 | 97C146F01CF9000F007C117D /* Runner */, 90 | 97C146EF1CF9000F007C117D /* Products */, 91 | A0E955B4A56DF5E882ECBBDB /* Pods */, 92 | 0D9F419CD47F2F859D1F4B43 /* Frameworks */, 93 | ); 94 | sourceTree = ""; 95 | }; 96 | 97C146EF1CF9000F007C117D /* Products */ = { 97 | isa = PBXGroup; 98 | children = ( 99 | 97C146EE1CF9000F007C117D /* Runner.app */, 100 | ); 101 | name = Products; 102 | sourceTree = ""; 103 | }; 104 | 97C146F01CF9000F007C117D /* Runner */ = { 105 | isa = PBXGroup; 106 | children = ( 107 | 7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */, 108 | 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */, 109 | 97C146FA1CF9000F007C117D /* Main.storyboard */, 110 | 97C146FD1CF9000F007C117D /* Assets.xcassets */, 111 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */, 112 | 97C147021CF9000F007C117D /* Info.plist */, 113 | 97C146F11CF9000F007C117D /* Supporting Files */, 114 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */, 115 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */, 116 | ); 117 | path = Runner; 118 | sourceTree = ""; 119 | }; 120 | 97C146F11CF9000F007C117D /* Supporting Files */ = { 121 | isa = PBXGroup; 122 | children = ( 123 | 97C146F21CF9000F007C117D /* main.m */, 124 | ); 125 | name = "Supporting Files"; 126 | sourceTree = ""; 127 | }; 128 | A0E955B4A56DF5E882ECBBDB /* Pods */ = { 129 | isa = PBXGroup; 130 | children = ( 131 | 2B6518BB87371F0DFBFE1F44 /* Pods-Runner.debug.xcconfig */, 132 | 67911518417363E8F26FD7BB /* Pods-Runner.release.xcconfig */, 133 | 3B0D5790EA1F841E7281580F /* Pods-Runner.profile.xcconfig */, 134 | ); 135 | name = Pods; 136 | sourceTree = ""; 137 | }; 138 | /* End PBXGroup section */ 139 | 140 | /* Begin PBXNativeTarget section */ 141 | 97C146ED1CF9000F007C117D /* Runner */ = { 142 | isa = PBXNativeTarget; 143 | buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; 144 | buildPhases = ( 145 | 941F839203287FF7FD7C3C2E /* [CP] Check Pods Manifest.lock */, 146 | 9740EEB61CF901F6004384FC /* Run Script */, 147 | 97C146EA1CF9000F007C117D /* Sources */, 148 | 97C146EB1CF9000F007C117D /* Frameworks */, 149 | 97C146EC1CF9000F007C117D /* Resources */, 150 | 9705A1C41CF9048500538489 /* Embed Frameworks */, 151 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */, 152 | ); 153 | buildRules = ( 154 | ); 155 | dependencies = ( 156 | ); 157 | name = Runner; 158 | productName = Runner; 159 | productReference = 97C146EE1CF9000F007C117D /* Runner.app */; 160 | productType = "com.apple.product-type.application"; 161 | }; 162 | /* End PBXNativeTarget section */ 163 | 164 | /* Begin PBXProject section */ 165 | 97C146E61CF9000F007C117D /* Project object */ = { 166 | isa = PBXProject; 167 | attributes = { 168 | LastUpgradeCheck = 1020; 169 | ORGANIZATIONNAME = "The Chromium Authors"; 170 | TargetAttributes = { 171 | 97C146ED1CF9000F007C117D = { 172 | CreatedOnToolsVersion = 7.3.1; 173 | DevelopmentTeam = 7624MWN53C; 174 | }; 175 | }; 176 | }; 177 | buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */; 178 | compatibilityVersion = "Xcode 3.2"; 179 | developmentRegion = en; 180 | hasScannedForEncodings = 0; 181 | knownRegions = ( 182 | en, 183 | Base, 184 | ); 185 | mainGroup = 97C146E51CF9000F007C117D; 186 | productRefGroup = 97C146EF1CF9000F007C117D /* Products */; 187 | projectDirPath = ""; 188 | projectRoot = ""; 189 | targets = ( 190 | 97C146ED1CF9000F007C117D /* Runner */, 191 | ); 192 | }; 193 | /* End PBXProject section */ 194 | 195 | /* Begin PBXResourcesBuildPhase section */ 196 | 97C146EC1CF9000F007C117D /* Resources */ = { 197 | isa = PBXResourcesBuildPhase; 198 | buildActionMask = 2147483647; 199 | files = ( 200 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */, 201 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, 202 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, 203 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, 204 | ); 205 | runOnlyForDeploymentPostprocessing = 0; 206 | }; 207 | /* End PBXResourcesBuildPhase section */ 208 | 209 | /* Begin PBXShellScriptBuildPhase section */ 210 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { 211 | isa = PBXShellScriptBuildPhase; 212 | buildActionMask = 2147483647; 213 | files = ( 214 | ); 215 | inputPaths = ( 216 | ); 217 | name = "Thin Binary"; 218 | outputPaths = ( 219 | ); 220 | runOnlyForDeploymentPostprocessing = 0; 221 | shellPath = /bin/sh; 222 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin"; 223 | }; 224 | 941F839203287FF7FD7C3C2E /* [CP] Check Pods Manifest.lock */ = { 225 | isa = PBXShellScriptBuildPhase; 226 | buildActionMask = 2147483647; 227 | files = ( 228 | ); 229 | inputFileListPaths = ( 230 | ); 231 | inputPaths = ( 232 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock", 233 | "${PODS_ROOT}/Manifest.lock", 234 | ); 235 | name = "[CP] Check Pods Manifest.lock"; 236 | outputFileListPaths = ( 237 | ); 238 | outputPaths = ( 239 | "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt", 240 | ); 241 | runOnlyForDeploymentPostprocessing = 0; 242 | shellPath = /bin/sh; 243 | shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; 244 | showEnvVarsInLog = 0; 245 | }; 246 | 9740EEB61CF901F6004384FC /* Run Script */ = { 247 | isa = PBXShellScriptBuildPhase; 248 | buildActionMask = 2147483647; 249 | files = ( 250 | ); 251 | inputPaths = ( 252 | ); 253 | name = "Run Script"; 254 | outputPaths = ( 255 | ); 256 | runOnlyForDeploymentPostprocessing = 0; 257 | shellPath = /bin/sh; 258 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; 259 | }; 260 | /* End PBXShellScriptBuildPhase section */ 261 | 262 | /* Begin PBXSourcesBuildPhase section */ 263 | 97C146EA1CF9000F007C117D /* Sources */ = { 264 | isa = PBXSourcesBuildPhase; 265 | buildActionMask = 2147483647; 266 | files = ( 267 | 978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */, 268 | 97C146F31CF9000F007C117D /* main.m in Sources */, 269 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */, 270 | ); 271 | runOnlyForDeploymentPostprocessing = 0; 272 | }; 273 | /* End PBXSourcesBuildPhase section */ 274 | 275 | /* Begin PBXVariantGroup section */ 276 | 97C146FA1CF9000F007C117D /* Main.storyboard */ = { 277 | isa = PBXVariantGroup; 278 | children = ( 279 | 97C146FB1CF9000F007C117D /* Base */, 280 | ); 281 | name = Main.storyboard; 282 | sourceTree = ""; 283 | }; 284 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = { 285 | isa = PBXVariantGroup; 286 | children = ( 287 | 97C147001CF9000F007C117D /* Base */, 288 | ); 289 | name = LaunchScreen.storyboard; 290 | sourceTree = ""; 291 | }; 292 | /* End PBXVariantGroup section */ 293 | 294 | /* Begin XCBuildConfiguration section */ 295 | 249021D3217E4FDB00AE95B9 /* Profile */ = { 296 | isa = XCBuildConfiguration; 297 | buildSettings = { 298 | ALWAYS_SEARCH_USER_PATHS = NO; 299 | CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; 300 | CLANG_ANALYZER_NONNULL = YES; 301 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 302 | CLANG_CXX_LIBRARY = "libc++"; 303 | CLANG_ENABLE_MODULES = YES; 304 | CLANG_ENABLE_OBJC_ARC = YES; 305 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 306 | CLANG_WARN_BOOL_CONVERSION = YES; 307 | CLANG_WARN_COMMA = YES; 308 | CLANG_WARN_CONSTANT_CONVERSION = YES; 309 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 310 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 311 | CLANG_WARN_EMPTY_BODY = YES; 312 | CLANG_WARN_ENUM_CONVERSION = YES; 313 | CLANG_WARN_INFINITE_RECURSION = YES; 314 | CLANG_WARN_INT_CONVERSION = YES; 315 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 316 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 317 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 318 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 319 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 320 | CLANG_WARN_STRICT_PROTOTYPES = YES; 321 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 322 | CLANG_WARN_UNREACHABLE_CODE = YES; 323 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 324 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 325 | COPY_PHASE_STRIP = NO; 326 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 327 | ENABLE_NS_ASSERTIONS = NO; 328 | ENABLE_STRICT_OBJC_MSGSEND = YES; 329 | GCC_C_LANGUAGE_STANDARD = gnu99; 330 | GCC_NO_COMMON_BLOCKS = YES; 331 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 332 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 333 | GCC_WARN_UNDECLARED_SELECTOR = YES; 334 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 335 | GCC_WARN_UNUSED_FUNCTION = YES; 336 | GCC_WARN_UNUSED_VARIABLE = YES; 337 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 338 | MTL_ENABLE_DEBUG_INFO = NO; 339 | SDKROOT = iphoneos; 340 | TARGETED_DEVICE_FAMILY = "1,2"; 341 | VALIDATE_PRODUCT = YES; 342 | }; 343 | name = Profile; 344 | }; 345 | 249021D4217E4FDB00AE95B9 /* Profile */ = { 346 | isa = XCBuildConfiguration; 347 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 348 | buildSettings = { 349 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 350 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 351 | DEVELOPMENT_TEAM = S8QB4VV633; 352 | ENABLE_BITCODE = NO; 353 | FRAMEWORK_SEARCH_PATHS = ( 354 | "$(inherited)", 355 | "$(PROJECT_DIR)/Flutter", 356 | ); 357 | INFOPLIST_FILE = Runner/Info.plist; 358 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 359 | LIBRARY_SEARCH_PATHS = ( 360 | "$(inherited)", 361 | "$(PROJECT_DIR)/Flutter", 362 | ); 363 | PRODUCT_BUNDLE_IDENTIFIER = com.baseflow.locationPermissionsExample; 364 | PRODUCT_NAME = "$(TARGET_NAME)"; 365 | VERSIONING_SYSTEM = "apple-generic"; 366 | }; 367 | name = Profile; 368 | }; 369 | 97C147031CF9000F007C117D /* Debug */ = { 370 | isa = XCBuildConfiguration; 371 | buildSettings = { 372 | ALWAYS_SEARCH_USER_PATHS = NO; 373 | CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; 374 | CLANG_ANALYZER_NONNULL = YES; 375 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 376 | CLANG_CXX_LIBRARY = "libc++"; 377 | CLANG_ENABLE_MODULES = YES; 378 | CLANG_ENABLE_OBJC_ARC = YES; 379 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 380 | CLANG_WARN_BOOL_CONVERSION = YES; 381 | CLANG_WARN_COMMA = YES; 382 | CLANG_WARN_CONSTANT_CONVERSION = YES; 383 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 384 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 385 | CLANG_WARN_EMPTY_BODY = YES; 386 | CLANG_WARN_ENUM_CONVERSION = YES; 387 | CLANG_WARN_INFINITE_RECURSION = YES; 388 | CLANG_WARN_INT_CONVERSION = YES; 389 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 390 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 391 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 392 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 393 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 394 | CLANG_WARN_STRICT_PROTOTYPES = YES; 395 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 396 | CLANG_WARN_UNREACHABLE_CODE = YES; 397 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 398 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 399 | COPY_PHASE_STRIP = NO; 400 | DEBUG_INFORMATION_FORMAT = dwarf; 401 | ENABLE_STRICT_OBJC_MSGSEND = YES; 402 | ENABLE_TESTABILITY = YES; 403 | GCC_C_LANGUAGE_STANDARD = gnu99; 404 | GCC_DYNAMIC_NO_PIC = NO; 405 | GCC_NO_COMMON_BLOCKS = YES; 406 | GCC_OPTIMIZATION_LEVEL = 0; 407 | GCC_PREPROCESSOR_DEFINITIONS = ( 408 | "DEBUG=1", 409 | "$(inherited)", 410 | ); 411 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 412 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 413 | GCC_WARN_UNDECLARED_SELECTOR = YES; 414 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 415 | GCC_WARN_UNUSED_FUNCTION = YES; 416 | GCC_WARN_UNUSED_VARIABLE = YES; 417 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 418 | MTL_ENABLE_DEBUG_INFO = YES; 419 | ONLY_ACTIVE_ARCH = YES; 420 | SDKROOT = iphoneos; 421 | TARGETED_DEVICE_FAMILY = "1,2"; 422 | }; 423 | name = Debug; 424 | }; 425 | 97C147041CF9000F007C117D /* Release */ = { 426 | isa = XCBuildConfiguration; 427 | buildSettings = { 428 | ALWAYS_SEARCH_USER_PATHS = NO; 429 | CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; 430 | CLANG_ANALYZER_NONNULL = YES; 431 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 432 | CLANG_CXX_LIBRARY = "libc++"; 433 | CLANG_ENABLE_MODULES = YES; 434 | CLANG_ENABLE_OBJC_ARC = YES; 435 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 436 | CLANG_WARN_BOOL_CONVERSION = YES; 437 | CLANG_WARN_COMMA = YES; 438 | CLANG_WARN_CONSTANT_CONVERSION = YES; 439 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 440 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 441 | CLANG_WARN_EMPTY_BODY = YES; 442 | CLANG_WARN_ENUM_CONVERSION = YES; 443 | CLANG_WARN_INFINITE_RECURSION = YES; 444 | CLANG_WARN_INT_CONVERSION = YES; 445 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 446 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 447 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 448 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 449 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 450 | CLANG_WARN_STRICT_PROTOTYPES = YES; 451 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 452 | CLANG_WARN_UNREACHABLE_CODE = YES; 453 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 454 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 455 | COPY_PHASE_STRIP = NO; 456 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 457 | ENABLE_NS_ASSERTIONS = NO; 458 | ENABLE_STRICT_OBJC_MSGSEND = YES; 459 | GCC_C_LANGUAGE_STANDARD = gnu99; 460 | GCC_NO_COMMON_BLOCKS = YES; 461 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 462 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 463 | GCC_WARN_UNDECLARED_SELECTOR = YES; 464 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 465 | GCC_WARN_UNUSED_FUNCTION = YES; 466 | GCC_WARN_UNUSED_VARIABLE = YES; 467 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 468 | MTL_ENABLE_DEBUG_INFO = NO; 469 | SDKROOT = iphoneos; 470 | TARGETED_DEVICE_FAMILY = "1,2"; 471 | VALIDATE_PRODUCT = YES; 472 | }; 473 | name = Release; 474 | }; 475 | 97C147061CF9000F007C117D /* Debug */ = { 476 | isa = XCBuildConfiguration; 477 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; 478 | buildSettings = { 479 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 480 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 481 | DEVELOPMENT_TEAM = 7624MWN53C; 482 | ENABLE_BITCODE = NO; 483 | FRAMEWORK_SEARCH_PATHS = ( 484 | "$(inherited)", 485 | "$(PROJECT_DIR)/Flutter", 486 | ); 487 | INFOPLIST_FILE = Runner/Info.plist; 488 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 489 | LIBRARY_SEARCH_PATHS = ( 490 | "$(inherited)", 491 | "$(PROJECT_DIR)/Flutter", 492 | ); 493 | PRODUCT_BUNDLE_IDENTIFIER = com.baseflow.locationPermissionsExample; 494 | PRODUCT_NAME = "$(TARGET_NAME)"; 495 | VERSIONING_SYSTEM = "apple-generic"; 496 | }; 497 | name = Debug; 498 | }; 499 | 97C147071CF9000F007C117D /* Release */ = { 500 | isa = XCBuildConfiguration; 501 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 502 | buildSettings = { 503 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 504 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 505 | ENABLE_BITCODE = NO; 506 | FRAMEWORK_SEARCH_PATHS = ( 507 | "$(inherited)", 508 | "$(PROJECT_DIR)/Flutter", 509 | ); 510 | INFOPLIST_FILE = Runner/Info.plist; 511 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 512 | LIBRARY_SEARCH_PATHS = ( 513 | "$(inherited)", 514 | "$(PROJECT_DIR)/Flutter", 515 | ); 516 | PRODUCT_BUNDLE_IDENTIFIER = com.baseflow.locationPermissionsExample; 517 | PRODUCT_NAME = "$(TARGET_NAME)"; 518 | VERSIONING_SYSTEM = "apple-generic"; 519 | }; 520 | name = Release; 521 | }; 522 | /* End XCBuildConfiguration section */ 523 | 524 | /* Begin XCConfigurationList section */ 525 | 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = { 526 | isa = XCConfigurationList; 527 | buildConfigurations = ( 528 | 97C147031CF9000F007C117D /* Debug */, 529 | 97C147041CF9000F007C117D /* Release */, 530 | 249021D3217E4FDB00AE95B9 /* Profile */, 531 | ); 532 | defaultConfigurationIsVisible = 0; 533 | defaultConfigurationName = Release; 534 | }; 535 | 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = { 536 | isa = XCConfigurationList; 537 | buildConfigurations = ( 538 | 97C147061CF9000F007C117D /* Debug */, 539 | 97C147071CF9000F007C117D /* Release */, 540 | 249021D4217E4FDB00AE95B9 /* Profile */, 541 | ); 542 | defaultConfigurationIsVisible = 0; 543 | defaultConfigurationName = Release; 544 | }; 545 | /* End XCConfigurationList section */ 546 | }; 547 | rootObject = 97C146E61CF9000F007C117D /* Project object */; 548 | } 549 | -------------------------------------------------------------------------------- /packages/location_permissions/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /packages/location_permissions/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 39 | 40 | 41 | 42 | 43 | 44 | 54 | 56 | 62 | 63 | 64 | 65 | 66 | 67 | 73 | 75 | 81 | 82 | 83 | 84 | 86 | 87 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /packages/location_permissions/example/ios/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /packages/location_permissions/example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /packages/location_permissions/example/ios/Runner/AppDelegate.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | 4 | @interface AppDelegate : FlutterAppDelegate 5 | 6 | @end 7 | -------------------------------------------------------------------------------- /packages/location_permissions/example/ios/Runner/AppDelegate.m: -------------------------------------------------------------------------------- 1 | #include "AppDelegate.h" 2 | #include "GeneratedPluginRegistrant.h" 3 | 4 | @implementation AppDelegate 5 | 6 | - (BOOL)application:(UIApplication *)application 7 | didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 8 | [GeneratedPluginRegistrant registerWithRegistry:self]; 9 | // Override point for customization after application launch. 10 | return [super application:application didFinishLaunchingWithOptions:launchOptions]; 11 | } 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /packages/location_permissions/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "20x20", 5 | "idiom" : "iphone", 6 | "filename" : "Icon-App-20x20@2x.png", 7 | "scale" : "2x" 8 | }, 9 | { 10 | "size" : "20x20", 11 | "idiom" : "iphone", 12 | "filename" : "Icon-App-20x20@3x.png", 13 | "scale" : "3x" 14 | }, 15 | { 16 | "size" : "29x29", 17 | "idiom" : "iphone", 18 | "filename" : "Icon-App-29x29@1x.png", 19 | "scale" : "1x" 20 | }, 21 | { 22 | "size" : "29x29", 23 | "idiom" : "iphone", 24 | "filename" : "Icon-App-29x29@2x.png", 25 | "scale" : "2x" 26 | }, 27 | { 28 | "size" : "29x29", 29 | "idiom" : "iphone", 30 | "filename" : "Icon-App-29x29@3x.png", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "size" : "40x40", 35 | "idiom" : "iphone", 36 | "filename" : "Icon-App-40x40@2x.png", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "size" : "40x40", 41 | "idiom" : "iphone", 42 | "filename" : "Icon-App-40x40@3x.png", 43 | "scale" : "3x" 44 | }, 45 | { 46 | "size" : "60x60", 47 | "idiom" : "iphone", 48 | "filename" : "Icon-App-60x60@2x.png", 49 | "scale" : "2x" 50 | }, 51 | { 52 | "size" : "60x60", 53 | "idiom" : "iphone", 54 | "filename" : "Icon-App-60x60@3x.png", 55 | "scale" : "3x" 56 | }, 57 | { 58 | "size" : "20x20", 59 | "idiom" : "ipad", 60 | "filename" : "Icon-App-20x20@1x.png", 61 | "scale" : "1x" 62 | }, 63 | { 64 | "size" : "20x20", 65 | "idiom" : "ipad", 66 | "filename" : "Icon-App-20x20@2x.png", 67 | "scale" : "2x" 68 | }, 69 | { 70 | "size" : "29x29", 71 | "idiom" : "ipad", 72 | "filename" : "Icon-App-29x29@1x.png", 73 | "scale" : "1x" 74 | }, 75 | { 76 | "size" : "29x29", 77 | "idiom" : "ipad", 78 | "filename" : "Icon-App-29x29@2x.png", 79 | "scale" : "2x" 80 | }, 81 | { 82 | "size" : "40x40", 83 | "idiom" : "ipad", 84 | "filename" : "Icon-App-40x40@1x.png", 85 | "scale" : "1x" 86 | }, 87 | { 88 | "size" : "40x40", 89 | "idiom" : "ipad", 90 | "filename" : "Icon-App-40x40@2x.png", 91 | "scale" : "2x" 92 | }, 93 | { 94 | "size" : "76x76", 95 | "idiom" : "ipad", 96 | "filename" : "Icon-App-76x76@1x.png", 97 | "scale" : "1x" 98 | }, 99 | { 100 | "size" : "76x76", 101 | "idiom" : "ipad", 102 | "filename" : "Icon-App-76x76@2x.png", 103 | "scale" : "2x" 104 | }, 105 | { 106 | "size" : "83.5x83.5", 107 | "idiom" : "ipad", 108 | "filename" : "Icon-App-83.5x83.5@2x.png", 109 | "scale" : "2x" 110 | }, 111 | { 112 | "size" : "1024x1024", 113 | "idiom" : "ios-marketing", 114 | "filename" : "Icon-App-1024x1024@1x.png", 115 | "scale" : "1x" 116 | } 117 | ], 118 | "info" : { 119 | "version" : 1, 120 | "author" : "xcode" 121 | } 122 | } 123 | -------------------------------------------------------------------------------- /packages/location_permissions/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Baseflow/flutter-permission-plugins/5c5d40204fa449aa97ebc1e2c598528ba6ac0e30/packages/location_permissions/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png -------------------------------------------------------------------------------- /packages/location_permissions/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Baseflow/flutter-permission-plugins/5c5d40204fa449aa97ebc1e2c598528ba6ac0e30/packages/location_permissions/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png -------------------------------------------------------------------------------- /packages/location_permissions/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Baseflow/flutter-permission-plugins/5c5d40204fa449aa97ebc1e2c598528ba6ac0e30/packages/location_permissions/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png -------------------------------------------------------------------------------- /packages/location_permissions/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Baseflow/flutter-permission-plugins/5c5d40204fa449aa97ebc1e2c598528ba6ac0e30/packages/location_permissions/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png -------------------------------------------------------------------------------- /packages/location_permissions/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Baseflow/flutter-permission-plugins/5c5d40204fa449aa97ebc1e2c598528ba6ac0e30/packages/location_permissions/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png -------------------------------------------------------------------------------- /packages/location_permissions/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Baseflow/flutter-permission-plugins/5c5d40204fa449aa97ebc1e2c598528ba6ac0e30/packages/location_permissions/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png -------------------------------------------------------------------------------- /packages/location_permissions/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Baseflow/flutter-permission-plugins/5c5d40204fa449aa97ebc1e2c598528ba6ac0e30/packages/location_permissions/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png -------------------------------------------------------------------------------- /packages/location_permissions/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Baseflow/flutter-permission-plugins/5c5d40204fa449aa97ebc1e2c598528ba6ac0e30/packages/location_permissions/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png -------------------------------------------------------------------------------- /packages/location_permissions/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Baseflow/flutter-permission-plugins/5c5d40204fa449aa97ebc1e2c598528ba6ac0e30/packages/location_permissions/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png -------------------------------------------------------------------------------- /packages/location_permissions/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Baseflow/flutter-permission-plugins/5c5d40204fa449aa97ebc1e2c598528ba6ac0e30/packages/location_permissions/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png -------------------------------------------------------------------------------- /packages/location_permissions/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Baseflow/flutter-permission-plugins/5c5d40204fa449aa97ebc1e2c598528ba6ac0e30/packages/location_permissions/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png -------------------------------------------------------------------------------- /packages/location_permissions/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Baseflow/flutter-permission-plugins/5c5d40204fa449aa97ebc1e2c598528ba6ac0e30/packages/location_permissions/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png -------------------------------------------------------------------------------- /packages/location_permissions/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Baseflow/flutter-permission-plugins/5c5d40204fa449aa97ebc1e2c598528ba6ac0e30/packages/location_permissions/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png -------------------------------------------------------------------------------- /packages/location_permissions/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Baseflow/flutter-permission-plugins/5c5d40204fa449aa97ebc1e2c598528ba6ac0e30/packages/location_permissions/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png -------------------------------------------------------------------------------- /packages/location_permissions/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Baseflow/flutter-permission-plugins/5c5d40204fa449aa97ebc1e2c598528ba6ac0e30/packages/location_permissions/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png -------------------------------------------------------------------------------- /packages/location_permissions/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 | -------------------------------------------------------------------------------- /packages/location_permissions/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Baseflow/flutter-permission-plugins/5c5d40204fa449aa97ebc1e2c598528ba6ac0e30/packages/location_permissions/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /packages/location_permissions/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Baseflow/flutter-permission-plugins/5c5d40204fa449aa97ebc1e2c598528ba6ac0e30/packages/location_permissions/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /packages/location_permissions/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Baseflow/flutter-permission-plugins/5c5d40204fa449aa97ebc1e2c598528ba6ac0e30/packages/location_permissions/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png -------------------------------------------------------------------------------- /packages/location_permissions/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. -------------------------------------------------------------------------------- /packages/location_permissions/example/ios/Runner/Base.lproj/LaunchScreen.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 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /packages/location_permissions/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 | -------------------------------------------------------------------------------- /packages/location_permissions/example/ios/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | location_permissions_example 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | $(FLUTTER_BUILD_NAME) 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | $(FLUTTER_BUILD_NUMBER) 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UISupportedInterfaceOrientations 30 | 31 | UIInterfaceOrientationPortrait 32 | UIInterfaceOrientationLandscapeLeft 33 | UIInterfaceOrientationLandscapeRight 34 | 35 | UISupportedInterfaceOrientations~ipad 36 | 37 | UIInterfaceOrientationPortrait 38 | UIInterfaceOrientationPortraitUpsideDown 39 | UIInterfaceOrientationLandscapeLeft 40 | UIInterfaceOrientationLandscapeRight 41 | 42 | UIViewControllerBasedStatusBarAppearance 43 | 44 | NSLocationWhenInUseUsageDescription 45 | Need location when in use 46 | NSLocationAlwaysAndWhenInUseUsageDescription 47 | Always and when in use! 48 | NSLocationUsageDescription 49 | Older devices need location. 50 | NSLocationAlwaysUsageDescription 51 | Can I haz location always? 52 | 53 | 54 | -------------------------------------------------------------------------------- /packages/location_permissions/example/ios/Runner/main.m: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | #import "AppDelegate.h" 4 | 5 | int main(int argc, char* argv[]) { 6 | @autoreleasepool { 7 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /packages/location_permissions/example/lib/main.dart: -------------------------------------------------------------------------------- 1 | import 'dart:io'; 2 | 3 | import 'package:flutter/material.dart'; 4 | import 'package:location_permissions/location_permissions.dart'; 5 | 6 | void main() => runApp(MyApp()); 7 | 8 | class MyApp extends StatelessWidget { 9 | @override 10 | Widget build(BuildContext context) { 11 | return MaterialApp( 12 | home: Scaffold( 13 | appBar: AppBar( 14 | title: const Text('Plugin example app'), 15 | actions: [ 16 | IconButton( 17 | icon: const Icon(Icons.settings), 18 | onPressed: () { 19 | LocationPermissions().openAppSettings().then((bool hasOpened) => 20 | debugPrint('App Settings opened: ' + hasOpened.toString())); 21 | }, 22 | ) 23 | ], 24 | ), 25 | body: Center( 26 | child: ListView( 27 | children: createWidgetList(), 28 | ), 29 | ), 30 | ), 31 | ); 32 | } 33 | 34 | List createWidgetList() { 35 | final List widgets = LocationPermissionLevel.values 36 | .map((LocationPermissionLevel level) => PermissionWidget(level)) 37 | .toList(); 38 | 39 | if (Platform.isAndroid) { 40 | widgets.add(StreamingStatusWidget()); 41 | } 42 | 43 | return widgets; 44 | } 45 | } 46 | 47 | class StreamingStatusWidget extends StatelessWidget { 48 | final Stream statusStream = 49 | LocationPermissions().serviceStatus; 50 | 51 | @override 52 | Widget build(BuildContext context) => ListTile( 53 | title: const Text('ServiceStatus'), 54 | subtitle: StreamBuilder( 55 | stream: statusStream, 56 | initialData: ServiceStatus.unknown, 57 | builder: (_, AsyncSnapshot snapshot) => 58 | Text('${snapshot.data}'), 59 | ), 60 | ); 61 | } 62 | 63 | class PermissionWidget extends StatefulWidget { 64 | const PermissionWidget(this._permissionLevel); 65 | 66 | final LocationPermissionLevel _permissionLevel; 67 | 68 | @override 69 | _PermissionState createState() => _PermissionState(_permissionLevel); 70 | } 71 | 72 | class _PermissionState extends State { 73 | _PermissionState(this._permissionLevel); 74 | 75 | final LocationPermissionLevel _permissionLevel; 76 | PermissionStatus _permissionStatus = PermissionStatus.unknown; 77 | 78 | @override 79 | void initState() { 80 | super.initState(); 81 | 82 | _listenForPermissionStatus(); 83 | } 84 | 85 | void _listenForPermissionStatus() { 86 | final Future statusFuture = 87 | LocationPermissions().checkPermissionStatus(); 88 | 89 | statusFuture.then((PermissionStatus status) { 90 | setState(() { 91 | _permissionStatus = status; 92 | }); 93 | }); 94 | } 95 | 96 | Color getPermissionColor() { 97 | switch (_permissionStatus) { 98 | case PermissionStatus.denied: 99 | return Colors.red; 100 | case PermissionStatus.granted: 101 | return Colors.green; 102 | default: 103 | return Colors.grey; 104 | } 105 | } 106 | 107 | @override 108 | Widget build(BuildContext context) { 109 | return ListTile( 110 | title: Text(_permissionLevel.toString()), 111 | subtitle: Text( 112 | _permissionStatus.toString(), 113 | style: TextStyle(color: getPermissionColor()), 114 | ), 115 | trailing: IconButton( 116 | icon: const Icon(Icons.info), 117 | onPressed: () { 118 | checkServiceStatus(context, _permissionLevel); 119 | }), 120 | onTap: () { 121 | requestPermission(_permissionLevel); 122 | }, 123 | ); 124 | } 125 | 126 | void checkServiceStatus( 127 | BuildContext context, LocationPermissionLevel permissionLevel) { 128 | LocationPermissions() 129 | .checkServiceStatus() 130 | .then((ServiceStatus serviceStatus) { 131 | final SnackBar snackBar = 132 | SnackBar(content: Text(serviceStatus.toString())); 133 | 134 | ScaffoldMessenger.of(context).showSnackBar(snackBar); 135 | }); 136 | } 137 | 138 | Future requestPermission( 139 | LocationPermissionLevel permissionLevel) async { 140 | final PermissionStatus permissionRequestResult = await LocationPermissions() 141 | .requestPermissions(permissionLevel: permissionLevel); 142 | 143 | setState(() { 144 | print(permissionRequestResult); 145 | _permissionStatus = permissionRequestResult; 146 | print(_permissionStatus); 147 | }); 148 | } 149 | } 150 | -------------------------------------------------------------------------------- /packages/location_permissions/example/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: location_permissions_example 2 | description: Demonstrates how to use the location_permissions plugin. 3 | publish_to: 'none' 4 | 5 | environment: 6 | sdk: '>=2.12.0 <3.0.0' 7 | 8 | dependencies: 9 | flutter: 10 | sdk: flutter 11 | 12 | # The following adds the Cupertino Icons font to your application. 13 | # Use with the CupertinoIcons class for iOS style icons. 14 | cupertino_icons: ^1.0.2 15 | 16 | dev_dependencies: 17 | flutter_test: 18 | sdk: flutter 19 | 20 | location_permissions: 21 | path: ../ 22 | 23 | # For information on the generic Dart part of this file, see the 24 | # following page: https://www.dartlang.org/tools/pub/pubspec 25 | 26 | # The following section is specific to Flutter. 27 | flutter: 28 | 29 | # The following line ensures that the Material Icons font is 30 | # included with your application, so that you can use the icons in 31 | # the material Icons class. 32 | uses-material-design: true 33 | 34 | # To add assets to your application, add an assets section, like this: 35 | # assets: 36 | # - images/a_dot_burr.jpeg 37 | # - images/a_dot_ham.jpeg 38 | 39 | # An image asset can refer to one or more resolution-specific "variants", see 40 | # https://flutter.io/assets-and-images/#resolution-aware. 41 | 42 | # For details regarding adding assets from package dependencies, see 43 | # https://flutter.io/assets-and-images/#from-packages 44 | 45 | # To add custom fonts to your application, add a fonts section here, 46 | # in this "flutter" section. Each entry in this list should have a 47 | # "family" key with the font family name, and a "fonts" key with a 48 | # list giving the asset and other descriptors for the font. For 49 | # example: 50 | # fonts: 51 | # - family: Schyler 52 | # fonts: 53 | # - asset: fonts/Schyler-Regular.ttf 54 | # - asset: fonts/Schyler-Italic.ttf 55 | # style: italic 56 | # - family: Trajan Pro 57 | # fonts: 58 | # - asset: fonts/TrajanPro.ttf 59 | # - asset: fonts/TrajanPro_Bold.ttf 60 | # weight: 700 61 | # 62 | # For details regarding fonts from package dependencies, 63 | # see https://flutter.io/custom-fonts/#from-packages 64 | -------------------------------------------------------------------------------- /packages/location_permissions/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 | -------------------------------------------------------------------------------- /packages/location_permissions/ios/Assets/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Baseflow/flutter-permission-plugins/5c5d40204fa449aa97ebc1e2c598528ba6ac0e30/packages/location_permissions/ios/Assets/.gitkeep -------------------------------------------------------------------------------- /packages/location_permissions/ios/Classes/Enums.h: -------------------------------------------------------------------------------- 1 | // 2 | // Enums.h 3 | // Pods 4 | // 5 | // Created by Maurits van Beusekom on 15/04/2019. 6 | // 7 | 8 | typedef NS_ENUM(int, PermissionLevel) { 9 | PermissionLevelLocation = 0, 10 | PermissionLevelLocationWhenInUse, 11 | PermissionLevelLocationAlways, 12 | }; 13 | 14 | typedef NS_ENUM(int, PermissionStatus) { 15 | PermissionStatusUnknown = 0, 16 | PermissionStatusDenied, 17 | PermissionStatusGranted, 18 | PermissionStatusRestricted, 19 | }; 20 | 21 | typedef NS_ENUM(int, ServiceStatus) { 22 | ServiceStatusUnknown = 0, 23 | ServiceStatusDisabled, 24 | ServiceStatusEnabled, 25 | ServiceStatusNotApplicable, 26 | }; 27 | -------------------------------------------------------------------------------- /packages/location_permissions/ios/Classes/LocationPermissionsPlugin.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | #import 4 | 5 | @interface LocationPermissionsPlugin 6 | : NSObject 7 | @end 8 | -------------------------------------------------------------------------------- /packages/location_permissions/ios/Classes/LocationPermissionsPlugin.m: -------------------------------------------------------------------------------- 1 | #import "LocationPermissionsPlugin.h" 2 | #import "Enums.h" 3 | 4 | @implementation LocationPermissionsPlugin { 5 | CLLocationManager *_locationManager; 6 | FlutterResult _result; 7 | PermissionLevel _permissionLevel; 8 | } 9 | 10 | + (void)registerWithRegistrar:(NSObject *)registrar { 11 | FlutterMethodChannel *channel = 12 | [FlutterMethodChannel methodChannelWithName:@"com.baseflow.flutter/location_permissions" 13 | binaryMessenger:[registrar messenger]]; 14 | LocationPermissionsPlugin *instance = [[LocationPermissionsPlugin alloc] initWithLocationManager]; 15 | [registrar addMethodCallDelegate:instance channel:channel]; 16 | } 17 | 18 | - (instancetype)initWithLocationManager { 19 | self = [super init]; 20 | if (self) { 21 | _locationManager = [CLLocationManager new]; 22 | _locationManager.delegate = self; 23 | _result = nil; 24 | } 25 | 26 | return self; 27 | } 28 | 29 | - (void)handleMethodCall:(FlutterMethodCall *)call result:(FlutterResult)result { 30 | if ([@"checkPermissionStatus" isEqualToString:call.method]) { 31 | [LocationPermissionsPlugin checkPermissionStatus:call result:result]; 32 | } else if ([@"checkServiceStatus" isEqualToString:call.method]) { 33 | [LocationPermissionsPlugin checkServiceStatus:result]; 34 | } else if ([@"openAppSettings" isEqualToString:call.method]) { 35 | [LocationPermissionsPlugin openAppSettings:result]; 36 | } else if ([@"requestPermission" isEqualToString:call.method]) { 37 | if (_result != nil) { 38 | result([FlutterError errorWithCode:@"ERROR_ALREADY_REQUESTING_PERMISSION" 39 | message:@"A request for permissions is already running, please " 40 | @"wait for it to finish before doing another request." 41 | details:nil]); 42 | return; 43 | } 44 | 45 | _result = result; 46 | [self requestPermission:call]; 47 | } else { 48 | result(FlutterMethodNotImplemented); 49 | } 50 | } 51 | 52 | + (void)checkPermissionStatus:(FlutterMethodCall *)call result:(FlutterResult)result { 53 | PermissionLevel level = [LocationPermissionsPlugin decodePermissionLevel:call]; 54 | PermissionStatus permissionStatus = [LocationPermissionsPlugin getPermissionStatus:level]; 55 | 56 | result([[NSNumber alloc] initWithInt:permissionStatus]); 57 | } 58 | 59 | + (void)checkServiceStatus:(FlutterResult)result { 60 | ServiceStatus serviceStatus = 61 | [CLLocationManager locationServicesEnabled] ? ServiceStatusEnabled : ServiceStatusDisabled; 62 | result([[NSNumber alloc] initWithInt:serviceStatus]); 63 | } 64 | 65 | + (PermissionStatus)getPermissionStatus:(PermissionLevel)permissionLevel { 66 | CLAuthorizationStatus authorizationStatus = [CLLocationManager authorizationStatus]; 67 | PermissionStatus status = 68 | [LocationPermissionsPlugin determinePermissionStatus:permissionLevel 69 | authorizationStatus:authorizationStatus]; 70 | 71 | return status; 72 | } 73 | 74 | + (void)openAppSettings:(FlutterResult)result { 75 | if (@available(iOS 10, *)) { 76 | [[UIApplication sharedApplication] 77 | openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString] 78 | options:[[NSDictionary alloc] init] 79 | completionHandler:^(BOOL success) { 80 | result([[NSNumber alloc] initWithBool:success]); 81 | }]; 82 | } else if (@available(iOS 8.0, *)) { 83 | BOOL success = [[UIApplication sharedApplication] 84 | openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]]; 85 | result([[NSNumber alloc] initWithBool:success]); 86 | } else { 87 | result(@false); 88 | } 89 | } 90 | 91 | + (PermissionLevel)decodePermissionLevel:(FlutterMethodCall *)call { 92 | NSNumber *rawData = call.arguments; 93 | 94 | if (rawData != nil) { 95 | return [rawData intValue]; 96 | } 97 | 98 | return PermissionLevelLocation; 99 | } 100 | 101 | - (void)requestPermission:(FlutterMethodCall *)call { 102 | PermissionLevel level = [LocationPermissionsPlugin decodePermissionLevel:call]; 103 | 104 | PermissionStatus status = [LocationPermissionsPlugin getPermissionStatus:level]; 105 | CLAuthorizationStatus authorizationStatus = [CLLocationManager authorizationStatus]; 106 | if (authorizationStatus == kCLAuthorizationStatusAuthorizedWhenInUse && 107 | level == PermissionLevelLocationAlways) { 108 | // don't do anything and continue requesting permissions 109 | } else if (status != PermissionStatusUnknown) { 110 | _result([[NSNumber alloc] initWithInt:status]); 111 | _result = nil; 112 | return; 113 | } 114 | 115 | if (level == PermissionLevelLocation) { 116 | if ([[NSBundle mainBundle] objectForInfoDictionaryKey:@"NSLocationAlwaysUsageDescription"] != 117 | nil) { 118 | _permissionLevel = PermissionLevelLocationAlways; 119 | [_locationManager requestAlwaysAuthorization]; 120 | } else if ([[NSBundle mainBundle] 121 | objectForInfoDictionaryKey:@"NSLocationWhenInUseUsageDescription"] != nil) { 122 | _permissionLevel = PermissionLevelLocationWhenInUse; 123 | [_locationManager requestWhenInUseAuthorization]; 124 | } else { 125 | _result([FlutterError 126 | errorWithCode:@"ERROR_MISSING_PROPERTYKEY" 127 | message:@"To use location in iOS8 you need to define either " 128 | @"NSLocationWhenInUseUsageDescription or NSLocationAlwaysUsageDescription " 129 | @"in the app bundle's Info.plist file" 130 | details:nil]); 131 | _result = nil; 132 | return; 133 | } 134 | } else if (level == PermissionLevelLocationAlways) { 135 | if ([[NSBundle mainBundle] objectForInfoDictionaryKey:@"NSLocationAlwaysUsageDescription"] != 136 | nil) { 137 | _permissionLevel = PermissionLevelLocationAlways; 138 | [_locationManager requestAlwaysAuthorization]; 139 | } else { 140 | _result([FlutterError 141 | errorWithCode:@"ERROR_MISSING_PROPERTYKEY" 142 | message:@"To use location in iOS8 you need to define " 143 | @"NSLocationAlwaysUsageDescription in the app bundle's Info.plist file" 144 | details:nil]); 145 | _result = nil; 146 | return; 147 | } 148 | } else if (level == PermissionLevelLocationWhenInUse) { 149 | if ([[NSBundle mainBundle] objectForInfoDictionaryKey:@"NSLocationWhenInUseUsageDescription"] != 150 | nil) { 151 | _permissionLevel = PermissionLevelLocationWhenInUse; 152 | [_locationManager requestWhenInUseAuthorization]; 153 | } else { 154 | _result([FlutterError 155 | errorWithCode:@"ERROR_MISSING_PROPERTYKEY" 156 | message:@"To use location in iOS8 you need to define " 157 | @"NSLocationWhenInUseUsageDescription in the app bundle's Info.plist file" 158 | details:nil]); 159 | _result = nil; 160 | return; 161 | } 162 | } 163 | } 164 | 165 | - (void)locationManager:(CLLocationManager *)manager 166 | didChangeAuthorizationStatus:(CLAuthorizationStatus)status { 167 | if (_result == nil) { 168 | return; 169 | } 170 | 171 | if (status == kCLAuthorizationStatusNotDetermined) { 172 | _result([[NSNumber alloc] initWithInt:PermissionStatusUnknown]); 173 | _result = nil; 174 | return; 175 | } 176 | 177 | PermissionStatus permissionStatus = 178 | [LocationPermissionsPlugin determinePermissionStatus:_permissionLevel 179 | authorizationStatus:status]; 180 | 181 | _result([[NSNumber alloc] initWithInt:permissionStatus]); 182 | _result = nil; 183 | } 184 | 185 | + (PermissionStatus)determinePermissionStatus:(PermissionLevel)permissionLevel 186 | authorizationStatus:(CLAuthorizationStatus)authorizationStatus { 187 | if (@available(iOS 8.0, *)) { 188 | if (permissionLevel == PermissionLevelLocationAlways) { 189 | switch (authorizationStatus) { 190 | case kCLAuthorizationStatusNotDetermined: 191 | return PermissionStatusUnknown; 192 | case kCLAuthorizationStatusRestricted: 193 | return PermissionStatusRestricted; 194 | case kCLAuthorizationStatusAuthorizedWhenInUse: 195 | case kCLAuthorizationStatusDenied: 196 | return PermissionStatusDenied; 197 | case kCLAuthorizationStatusAuthorizedAlways: 198 | return PermissionStatusGranted; 199 | } 200 | } 201 | 202 | switch (authorizationStatus) { 203 | case kCLAuthorizationStatusNotDetermined: 204 | return PermissionStatusUnknown; 205 | case kCLAuthorizationStatusRestricted: 206 | return PermissionStatusRestricted; 207 | case kCLAuthorizationStatusDenied: 208 | return PermissionStatusDenied; 209 | case kCLAuthorizationStatusAuthorizedAlways: 210 | case kCLAuthorizationStatusAuthorizedWhenInUse: 211 | return PermissionStatusGranted; 212 | } 213 | } 214 | 215 | switch (authorizationStatus) { 216 | case kCLAuthorizationStatusNotDetermined: 217 | return PermissionStatusUnknown; 218 | case kCLAuthorizationStatusRestricted: 219 | return PermissionStatusRestricted; 220 | case kCLAuthorizationStatusDenied: 221 | return PermissionStatusDenied; 222 | #pragma clang diagnostic ignored "-Wdeprecated-declarations" 223 | case kCLAuthorizationStatusAuthorized: 224 | return PermissionStatusGranted; 225 | #pragma clang diagnostic warning "-Wdeprecated-declarations" 226 | default: 227 | return PermissionStatusUnknown; 228 | } 229 | } 230 | 231 | @end 232 | -------------------------------------------------------------------------------- /packages/location_permissions/ios/location_permissions.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 = 'location_permissions' 6 | s.version = '3.0.0+1' 7 | s.summary = 'Location permission plugin for Flutter.' 8 | s.description = <<-DESC 9 | This plugin provides a cross-platform (iOS, Android) API to check and request access to the location services on the 10 | device. 11 | DESC 12 | s.homepage = 'https://github.com/BaseflowIT/flutter-permission-plugins/tree/develop/packages/location_permissions' 13 | s.license = { :file => '../LICENSE' } 14 | s.author = { 'Baseflow' => 'hello@baseflow.com' } 15 | s.source = { :path => '.' } 16 | s.source_files = 'Classes/**/*' 17 | s.public_header_files = 'Classes/**/*.h' 18 | s.dependency 'Flutter' 19 | 20 | s.ios.deployment_target = '8.0' 21 | s.static_framework = true 22 | end 23 | 24 | -------------------------------------------------------------------------------- /packages/location_permissions/lib/location_permissions.dart: -------------------------------------------------------------------------------- 1 | library location_permissions; 2 | 3 | export 'src/location_permissions.dart'; 4 | export 'src/permission_enums.dart'; 5 | -------------------------------------------------------------------------------- /packages/location_permissions/lib/src/location_permissions.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | import 'dart:io'; 3 | 4 | import 'package:flutter/services.dart'; 5 | import 'package:location_permissions/src/permission_enums.dart'; 6 | import 'package:meta/meta.dart'; 7 | 8 | class LocationPermissions { 9 | factory LocationPermissions() { 10 | if (_instance == null) { 11 | const MethodChannel methodChannel = 12 | MethodChannel('com.baseflow.flutter/location_permissions'); 13 | final EventChannel? eventChannel = Platform.isAndroid 14 | ? const EventChannel( 15 | 'com.baseflow.flutter/location_permissions_events') 16 | : null; 17 | 18 | _instance = LocationPermissions.private(methodChannel, eventChannel); 19 | } 20 | return _instance!; 21 | } 22 | 23 | @visibleForTesting 24 | LocationPermissions.private(this._methodChannel, this._eventChannel); 25 | 26 | static LocationPermissions? _instance; 27 | 28 | final MethodChannel _methodChannel; 29 | final EventChannel? _eventChannel; 30 | 31 | /// Check current permission status. 32 | /// 33 | /// Returns a [Future] containing the current permission status for the supplied [LocationPermissionLevel]. 34 | Future checkPermissionStatus( 35 | {LocationPermissionLevel level = 36 | LocationPermissionLevel.location}) async { 37 | final int status = 38 | await _methodChannel.invokeMethod('checkPermissionStatus', level.index); 39 | 40 | return PermissionStatus.values[status]; 41 | } 42 | 43 | /// Check current service status. 44 | /// 45 | /// Returns a [Future] containing the current service status for the supplied [LocationPermissionLevel]. 46 | Future checkServiceStatus( 47 | {LocationPermissionLevel level = 48 | LocationPermissionLevel.location}) async { 49 | final int status = 50 | await _methodChannel.invokeMethod('checkServiceStatus', level.index); 51 | 52 | return ServiceStatus.values[status]; 53 | } 54 | 55 | /// Open the App settings page. 56 | /// 57 | /// Returns [true] if the app settings page could be opened, otherwise [false] is returned. 58 | Future openAppSettings() async { 59 | final bool? hasOpened = 60 | await _methodChannel.invokeMethod('openAppSettings'); 61 | 62 | return hasOpened ?? false; 63 | } 64 | 65 | /// Request the user for access to the location services. 66 | /// 67 | /// Returns a [Future] containing the permission status. 68 | Future requestPermissions( 69 | {LocationPermissionLevel permissionLevel = 70 | LocationPermissionLevel.location}) async { 71 | final int status = await _methodChannel.invokeMethod( 72 | 'requestPermission', permissionLevel.index); 73 | 74 | return PermissionStatus.values[status]; 75 | } 76 | 77 | /// Request to see if you should show a rationale for requesting permission. 78 | /// 79 | /// This method is only implemented on Android, calling this on iOS always 80 | /// returns [false]. 81 | Future shouldShowRequestPermissionRationale( 82 | {LocationPermissionLevel permissionLevel = 83 | LocationPermissionLevel.location}) async { 84 | if (!Platform.isAndroid) { 85 | return false; 86 | } 87 | 88 | final bool? shouldShowRationale = await _methodChannel.invokeMethod( 89 | 'shouldShowRequestPermissionRationale', permissionLevel.index); 90 | 91 | return shouldShowRationale ?? false; 92 | } 93 | 94 | /// Allows listening to the enabled/disabled state of the location service, currently only on Android. 95 | /// 96 | /// This is basically the stream version of [checkPermissionStatus()]. 97 | Stream get serviceStatus { 98 | assert(Platform.isAndroid, 99 | 'Listening to service state changes is only supported on Android.'); 100 | 101 | return _eventChannel!.receiveBroadcastStream().map((dynamic status) => 102 | status ? ServiceStatus.enabled : ServiceStatus.disabled); 103 | } 104 | } 105 | -------------------------------------------------------------------------------- /packages/location_permissions/lib/src/permission_enums.dart: -------------------------------------------------------------------------------- 1 | enum LocationPermissionLevel { 2 | location, 3 | locationWhenInUse, 4 | locationAlways, 5 | } 6 | 7 | enum PermissionStatus { 8 | unknown, 9 | denied, 10 | granted, 11 | restricted, 12 | } 13 | 14 | enum ServiceStatus { 15 | unknown, 16 | disabled, 17 | enabled, 18 | notApplicable, 19 | } 20 | -------------------------------------------------------------------------------- /packages/location_permissions/location_permissions.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /packages/location_permissions/pubspec.lock: -------------------------------------------------------------------------------- 1 | # Generated by pub 2 | # See https://dart.dev/tools/pub/glossary#lockfile 3 | packages: 4 | async: 5 | dependency: transitive 6 | description: 7 | name: async 8 | url: "https://pub.dartlang.org" 9 | source: hosted 10 | version: "2.8.1" 11 | boolean_selector: 12 | dependency: transitive 13 | description: 14 | name: boolean_selector 15 | url: "https://pub.dartlang.org" 16 | source: hosted 17 | version: "2.1.0" 18 | characters: 19 | dependency: transitive 20 | description: 21 | name: characters 22 | url: "https://pub.dartlang.org" 23 | source: hosted 24 | version: "1.1.0" 25 | charcode: 26 | dependency: transitive 27 | description: 28 | name: charcode 29 | url: "https://pub.dartlang.org" 30 | source: hosted 31 | version: "1.3.1" 32 | clock: 33 | dependency: transitive 34 | description: 35 | name: clock 36 | url: "https://pub.dartlang.org" 37 | source: hosted 38 | version: "1.1.0" 39 | collection: 40 | dependency: transitive 41 | description: 42 | name: collection 43 | url: "https://pub.dartlang.org" 44 | source: hosted 45 | version: "1.15.0" 46 | fake_async: 47 | dependency: transitive 48 | description: 49 | name: fake_async 50 | url: "https://pub.dartlang.org" 51 | source: hosted 52 | version: "1.2.0" 53 | flutter: 54 | dependency: "direct main" 55 | description: flutter 56 | source: sdk 57 | version: "0.0.0" 58 | flutter_test: 59 | dependency: "direct dev" 60 | description: flutter 61 | source: sdk 62 | version: "0.0.0" 63 | matcher: 64 | dependency: transitive 65 | description: 66 | name: matcher 67 | url: "https://pub.dartlang.org" 68 | source: hosted 69 | version: "0.12.10" 70 | meta: 71 | dependency: "direct main" 72 | description: 73 | name: meta 74 | url: "https://pub.dartlang.org" 75 | source: hosted 76 | version: "1.7.0" 77 | path: 78 | dependency: transitive 79 | description: 80 | name: path 81 | url: "https://pub.dartlang.org" 82 | source: hosted 83 | version: "1.8.0" 84 | pedantic: 85 | dependency: "direct dev" 86 | description: 87 | name: pedantic 88 | url: "https://pub.dartlang.org" 89 | source: hosted 90 | version: "1.11.0" 91 | sky_engine: 92 | dependency: transitive 93 | description: flutter 94 | source: sdk 95 | version: "0.0.99" 96 | source_span: 97 | dependency: transitive 98 | description: 99 | name: source_span 100 | url: "https://pub.dartlang.org" 101 | source: hosted 102 | version: "1.8.1" 103 | stack_trace: 104 | dependency: transitive 105 | description: 106 | name: stack_trace 107 | url: "https://pub.dartlang.org" 108 | source: hosted 109 | version: "1.10.0" 110 | stream_channel: 111 | dependency: transitive 112 | description: 113 | name: stream_channel 114 | url: "https://pub.dartlang.org" 115 | source: hosted 116 | version: "2.1.0" 117 | string_scanner: 118 | dependency: transitive 119 | description: 120 | name: string_scanner 121 | url: "https://pub.dartlang.org" 122 | source: hosted 123 | version: "1.1.0" 124 | term_glyph: 125 | dependency: transitive 126 | description: 127 | name: term_glyph 128 | url: "https://pub.dartlang.org" 129 | source: hosted 130 | version: "1.2.0" 131 | test_api: 132 | dependency: transitive 133 | description: 134 | name: test_api 135 | url: "https://pub.dartlang.org" 136 | source: hosted 137 | version: "0.4.2" 138 | typed_data: 139 | dependency: transitive 140 | description: 141 | name: typed_data 142 | url: "https://pub.dartlang.org" 143 | source: hosted 144 | version: "1.3.0" 145 | vector_math: 146 | dependency: transitive 147 | description: 148 | name: vector_math 149 | url: "https://pub.dartlang.org" 150 | source: hosted 151 | version: "2.1.0" 152 | sdks: 153 | dart: ">=2.12.0 <3.0.0" 154 | flutter: ">=1.12.8" 155 | -------------------------------------------------------------------------------- /packages/location_permissions/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: location_permissions 2 | description: Location permission plugin for Flutter. This plugin provides a cross-platform (iOS, Android) API to check and request access to the location services on the 3 | device. 4 | version: 4.0.1 5 | homepage: https://github.com/BaseflowIT/flutter-permission-plugins/tree/develop/packages/location_permissions 6 | 7 | environment: 8 | sdk: ">=2.12.0 <3.0.0" 9 | flutter: ">=1.12.8" 10 | 11 | dependencies: 12 | flutter: 13 | sdk: flutter 14 | meta: ^1.3.0 15 | 16 | dev_dependencies: 17 | flutter_test: 18 | sdk: flutter 19 | 20 | pedantic: ^1.11.0 21 | 22 | # For information on the generic Dart part of this file, see the 23 | # following page: https://www.dartlang.org/tools/pub/pubspec 24 | 25 | # The following section is specific to Flutter. 26 | flutter: 27 | # This section identifies this Flutter project as a plugin project. 28 | # The androidPackage and pluginClass identifiers should not ordinarily 29 | # be modified. They are used by the tooling to maintain consistency when 30 | # adding or updating assets for this project. 31 | plugin: 32 | platforms: 33 | android: 34 | package: com.baseflow.location_permissions 35 | pluginClass: LocationPermissionsPlugin 36 | ios: 37 | pluginClass: LocationPermissionsPlugin 38 | 39 | # To add assets to your plugin package, add an assets section, like this: 40 | # assets: 41 | # - images/a_dot_burr.jpeg 42 | # - images/a_dot_ham.jpeg 43 | # 44 | # For details regarding assets in packages, see 45 | # https://flutter.io/assets-and-images/#from-packages 46 | # 47 | # An image asset can refer to one or more resolution-specific "variants", see 48 | # https://flutter.io/assets-and-images/#resolution-aware. 49 | 50 | # To add custom fonts to your plugin package, add a fonts section here, 51 | # in this "flutter" section. Each entry in this list should have a 52 | # "family" key with the font family name, and a "fonts" key with a 53 | # list giving the asset and other descriptors for the font. For 54 | # example: 55 | # fonts: 56 | # - family: Schyler 57 | # fonts: 58 | # - asset: fonts/Schyler-Regular.ttf 59 | # - asset: fonts/Schyler-Italic.ttf 60 | # style: italic 61 | # - family: Trajan Pro 62 | # fonts: 63 | # - asset: fonts/TrajanPro.ttf 64 | # - asset: fonts/TrajanPro_Bold.ttf 65 | # weight: 700 66 | # 67 | # For details regarding fonts in packages, see 68 | # https://flutter.io/custom-fonts/#from-packages 69 | -------------------------------------------------------------------------------- /script/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 android-sdk 5 | export ANDROID_HOME=`pwd`/android-sdk 6 | export PATH=`pwd`/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 20 | export GRADLE_HOME=$PWD/gradle-4.1 21 | export PATH=$GRADLE_HOME/bin:$PATH 22 | gradle -v 23 | git clone https://github.com/flutter/flutter.git 24 | export PATH=`pwd`/flutter/bin:`pwd`/flutter/bin/cache/dart-sdk/bin:$PATH 25 | flutter doctor 26 | pub global activate flutter_plugin_tools 27 | -------------------------------------------------------------------------------- /script/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 https://github.com/flutter/flutter.git 9 | export PATH=`pwd`/flutter/bin:`pwd`/flutter/bin/cache/dart-sdk/bin:$PATH 10 | flutter doctor 11 | pub global activate flutter_plugin_tools 12 | -------------------------------------------------------------------------------- /script/check_publish.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | 4 | # This script checks to make sure that each of the plugins *could* be published. 5 | # It doesn't actually publish anything. 6 | 7 | # So that users can run this script from anywhere and it will work as expected. 8 | SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null && pwd)" 9 | REPO_DIR="$(dirname "$SCRIPT_DIR")" 10 | 11 | source "$SCRIPT_DIR/common.sh" 12 | 13 | function check_publish() { 14 | local failures=() 15 | for package_name in "$@"; do 16 | local dir="$REPO_DIR/packages/$package_name" 17 | echo "Checking that $package_name can be published." 18 | if [[ $(cd "$dir" && cat pubspec.yaml | grep -E "^publish_to: none") ]]; then 19 | echo "Package $package_name is marked as unpublishable. Skipping." 20 | elif (cd "$dir" && pub publish --dry-run > /dev/null); then 21 | echo "Package $package_name is able to be published." 22 | else 23 | error "Unable to publish $package_name" 24 | failures=("${failures[@]}" "$package_name") 25 | fi 26 | done 27 | if [[ "${#failures[@]}" != 0 ]]; then 28 | error "FAIL: The following ${#failures[@]} package(s) failed the publishing check:" 29 | for failure in "${failures[@]}"; do 30 | error "$failure" 31 | done 32 | fi 33 | return "${#failures[@]}" 34 | } 35 | 36 | # Sets CHANGED_PACKAGE_LIST 37 | check_changed_packages 38 | 39 | if [[ "${#CHANGED_PACKAGE_LIST[@]}" != 0 ]]; then 40 | check_publish "${CHANGED_PACKAGE_LIST[@]}" 41 | fi 42 | -------------------------------------------------------------------------------- /script/common.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | function error() { 4 | echo "$@" 1>&2 5 | } 6 | 7 | function check_changed_packages() { 8 | # Try get a merge base for the branch and calculate affected packages. 9 | # We need this check because some CIs can do a single branch clones with a limited history of commits. 10 | local packages 11 | local branch_base_sha="$(git merge-base --fork-point FETCH_HEAD HEAD || git merge-base FETCH_HEAD HEAD)" 12 | if [[ "$?" == 0 ]]; then 13 | echo "Checking for changed packages from $branch_base_sha" 14 | IFS=$'\n' packages=( $(git diff --name-only "$branch_base_sha" HEAD | grep -o "packages/[^/]*" | sed -e "s/packages\///g" | sort | uniq) ) 15 | else 16 | error "Cannot find a merge base for the current branch to run an incremental build..." 17 | error "Please rebase your branch onto the latest master!" 18 | return 1 19 | fi 20 | 21 | # Filter out any packages that don't have a pubspec.yaml: they have probably 22 | # been deleted in this PR. 23 | CHANGED_PACKAGES="" 24 | CHANGED_PACKAGE_LIST=() 25 | for package in "${packages[@]}"; do 26 | if [[ -f "$REPO_DIR/packages/$package/pubspec.yaml" ]]; then 27 | CHANGED_PACKAGES="${CHANGED_PACKAGES},$package" 28 | CHANGED_PACKAGE_LIST=("${CHANGED_PACKAGE_LIST[@]}" "$package") 29 | fi 30 | done 31 | 32 | if [[ "${#CHANGED_PACKAGE_LIST[@]}" == 0 ]]; then 33 | echo "No changes detected in packages." 34 | else 35 | echo "Detected changes in the following ${#CHANGED_PACKAGE_LIST[@]} package(s):" 36 | for package in "${CHANGED_PACKAGE_LIST[@]}"; do 37 | echo "$package" 38 | done 39 | echo "" 40 | fi 41 | return 0 42 | } 43 | -------------------------------------------------------------------------------- /script/incremental_build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | 4 | SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null && pwd)" 5 | REPO_DIR="$(dirname "$SCRIPT_DIR")" 6 | 7 | source "$SCRIPT_DIR/common.sh" 8 | 9 | # Set some default actions if run without arguments. 10 | ACTIONS=("$@") 11 | if [[ "${#ACTIONS[@]}" == 0 ]]; then 12 | ACTIONS=("test" "analyze" "java-test") 13 | fi 14 | 15 | BRANCH_NAME="${BRANCH_NAME:-"$(git rev-parse --abbrev-ref HEAD)"}" 16 | if [[ "${BRANCH_NAME}" == "master" ]]; then 17 | echo "Running for all packages" 18 | (cd "$REPO_DIR" && pub global run flutter_plugin_tools "${ACTIONS[@]}" $PLUGIN_SHARDING) 19 | else 20 | # Sets CHANGED_PACKAGES 21 | check_changed_packages 22 | 23 | if [[ "$CHANGED_PACKAGES" == "" ]]; then 24 | echo "Running for all packages" 25 | (cd "$REPO_DIR" && pub global run flutter_plugin_tools "${ACTIONS[@]}" $PLUGIN_SHARDING) 26 | else 27 | (cd "$REPO_DIR" && pub global run flutter_plugin_tools "${ACTIONS[@]}" --plugins="$CHANGED_PACKAGES" $PLUGIN_SHARDING) 28 | fi 29 | fi 30 | --------------------------------------------------------------------------------