diff --git a/android/.project b/android/.project deleted file mode 100644 index 9551783f6..000000000 --- a/android/.project +++ /dev/null @@ -1,23 +0,0 @@ - - - permission_handler - Project permission_handler created by Buildship. - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.buildship.core.gradleprojectbuilder - - - - - - org.eclipse.jdt.core.javanature - org.eclipse.buildship.core.gradleprojectnature - - diff --git a/example/.idea/libraries/Dart_SDK.xml b/example/.idea/libraries/Dart_SDK.xml deleted file mode 100644 index be31de242..000000000 --- a/example/.idea/libraries/Dart_SDK.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/example/.idea/libraries/Flutter_for_Android.xml b/example/.idea/libraries/Flutter_for_Android.xml deleted file mode 100644 index 8e06791ca..000000000 --- a/example/.idea/libraries/Flutter_for_Android.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/example/.idea/modules.xml b/example/.idea/modules.xml deleted file mode 100644 index 5c250154b..000000000 --- a/example/.idea/modules.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/example/.idea/runConfigurations/main_dart.xml b/example/.idea/runConfigurations/main_dart.xml deleted file mode 100644 index aab7b5cd8..000000000 --- a/example/.idea/runConfigurations/main_dart.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - \ No newline at end of file diff --git a/example/.idea/workspace.xml b/example/.idea/workspace.xml deleted file mode 100644 index 5b3388cc1..000000000 --- a/example/.idea/workspace.xml +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/example/android/.project b/example/android/.project deleted file mode 100644 index 3964dd3f5..000000000 --- a/example/android/.project +++ /dev/null @@ -1,17 +0,0 @@ - - - android - Project android created by Buildship. - - - - - org.eclipse.buildship.core.gradleprojectbuilder - - - - - - org.eclipse.buildship.core.gradleprojectnature - - diff --git a/example/android/gradle/wrapper/gradle-wrapper.jar b/example/android/gradle/wrapper/gradle-wrapper.jar deleted file mode 100644 index 13372aef5..000000000 Binary files a/example/android/gradle/wrapper/gradle-wrapper.jar and /dev/null differ diff --git a/example/android/gradlew b/example/android/gradlew deleted file mode 100755 index 9d82f7891..000000000 --- a/example/android/gradlew +++ /dev/null @@ -1,160 +0,0 @@ -#!/usr/bin/env bash - -############################################################################## -## -## Gradle start up script for UN*X -## -############################################################################## - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS="" - -APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` - -# Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" - -warn ( ) { - echo "$*" -} - -die ( ) { - echo - echo "$*" - echo - exit 1 -} - -# OS specific support (must be 'true' or 'false'). -cygwin=false -msys=false -darwin=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; -esac - -# Attempt to set APP_HOME -# Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi -done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null - -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar - -# Determine the Java command to use to start the JVM. -if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" - else - JAVACMD="$JAVA_HOME/bin/java" - fi - if [ ! -x "$JAVACMD" ] ; then - die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." - fi -else - JAVACMD="java" - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." -fi - -# Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi -fi - -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi - -# For Cygwin, switch paths to Windows format before running java -if $cygwin ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi - # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" - fi - i=$((i+1)) - done - case $i in - (0) set -- ;; - (1) set -- "$args0" ;; - (2) set -- "$args0" "$args1" ;; - (3) set -- "$args0" "$args1" "$args2" ;; - (4) set -- "$args0" "$args1" "$args2" "$args3" ;; - (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; - esac -fi - -# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules -function splitJvmOpts() { - JVM_OPTS=("$@") -} -eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS -JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" - -exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" diff --git a/example/android/gradlew.bat b/example/android/gradlew.bat deleted file mode 100644 index 8a0b282aa..000000000 --- a/example/android/gradlew.bat +++ /dev/null @@ -1,90 +0,0 @@ -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS= - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto init - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:init -@rem Get command-line arguments, handling Windowz variants - -if not "%OS%" == "Windows_NT" goto win9xME_args -if "%@eval[2+2]" == "4" goto 4NT_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* -goto execute - -:4NT_args -@rem Get arguments from the 4NT Shell from JP Software -set CMD_LINE_ARGS=%$ - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega diff --git a/example/permission_handler_example.iml b/example/permission_handler_example.iml deleted file mode 100644 index e5c837191..000000000 --- a/example/permission_handler_example.iml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/lib/permission_handler.dart b/lib/permission_handler.dart deleted file mode 100644 index bc2088324..000000000 --- a/lib/permission_handler.dart +++ /dev/null @@ -1,4 +0,0 @@ -library permission_handler; - -export 'src/permission_enums.dart'; -export 'src/permission_handler.dart'; diff --git a/permission_handler.iml b/permission_handler.iml deleted file mode 100644 index 73e7ebd0d..000000000 --- a/permission_handler.iml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/CHANGELOG.md b/permission_handler/CHANGELOG.md similarity index 92% rename from CHANGELOG.md rename to permission_handler/CHANGELOG.md index 0fb338ea7..e21117828 100644 --- a/CHANGELOG.md +++ b/permission_handler/CHANGELOG.md @@ -1,7 +1,9 @@ -## vNext +## 4.4.0 +* Updated plugin structure to confirm to the Flutter federated plugin architecture. This will make it easier to add new platform implementations (see: https://medium.com/flutter/how-to-write-a-flutter-web-plugin-part-2-afdddb69ece6); * Android: Migrate to FlutterPlugin Android API (better support for Add-to-App); -* Android: Suppress JAVA warnings which are generated to old platform code (only executes on older platforms). +* Android: Suppress JAVA warnings which are generated to old platform code (only executes on older platforms); +* Android: Fixed issue which sometimes resulting in illegal cast exception. ## 4.3.0 diff --git a/LICENSE b/permission_handler/LICENSE similarity index 100% rename from LICENSE rename to permission_handler/LICENSE diff --git a/README.md b/permission_handler/README.md similarity index 98% rename from README.md rename to permission_handler/README.md index f040c91e4..9ca7f679e 100644 --- a/README.md +++ b/permission_handler/README.md @@ -17,7 +17,7 @@ To use this plugin, add `permission_handler` as a [dependency in your pubspec.ya ```yaml dependencies: - permission_handler: '^4.3.0' + permission_handler: '^4.4.0' ``` > **NOTE:** As of version 3.1.0 the permission_handler plugin switched to 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). @@ -312,7 +312,7 @@ Please file any issues, bugs or feature request as an issue on our [GitHub](http ## Want to contribute -If you would like to contribute to the plugin (e.g. by improving the documentation, solving a bug or adding a cool new feature), please carefully review our [contribution guide](CONTRIBUTING.md) and send us your [pull request](https://github.com/Baseflow/flutter-permission-handler/pulls). +If you would like to contribute to the plugin (e.g. by improving the documentation, solving a bug or adding a cool new feature), please carefully review our [contribution guide](../CONTRIBUTING.md) and send us your [pull request](https://github.com/Baseflow/flutter-permission-handler/pulls). ## Author diff --git a/analysis_options.yaml b/permission_handler/analysis_options.yaml similarity index 100% rename from analysis_options.yaml rename to permission_handler/analysis_options.yaml diff --git a/android/.classpath b/permission_handler/android/.classpath similarity index 100% rename from android/.classpath rename to permission_handler/android/.classpath diff --git a/android/.gitignore b/permission_handler/android/.gitignore similarity index 100% rename from android/.gitignore rename to permission_handler/android/.gitignore diff --git a/android/.settings/org.eclipse.buildship.core.prefs b/permission_handler/android/.settings/org.eclipse.buildship.core.prefs similarity index 100% rename from android/.settings/org.eclipse.buildship.core.prefs rename to permission_handler/android/.settings/org.eclipse.buildship.core.prefs diff --git a/android/build.gradle b/permission_handler/android/build.gradle similarity index 100% rename from android/build.gradle rename to permission_handler/android/build.gradle diff --git a/android/gradle.properties b/permission_handler/android/gradle.properties similarity index 100% rename from android/gradle.properties rename to permission_handler/android/gradle.properties diff --git a/android/settings.gradle b/permission_handler/android/settings.gradle similarity index 100% rename from android/settings.gradle rename to permission_handler/android/settings.gradle diff --git a/android/src/main/AndroidManifest.xml b/permission_handler/android/src/main/AndroidManifest.xml similarity index 100% rename from android/src/main/AndroidManifest.xml rename to permission_handler/android/src/main/AndroidManifest.xml diff --git a/android/src/main/java/com/baseflow/permissionhandler/AppSettingsManager.java b/permission_handler/android/src/main/java/com/baseflow/permissionhandler/AppSettingsManager.java similarity index 100% rename from android/src/main/java/com/baseflow/permissionhandler/AppSettingsManager.java rename to permission_handler/android/src/main/java/com/baseflow/permissionhandler/AppSettingsManager.java diff --git a/android/src/main/java/com/baseflow/permissionhandler/MethodCallHandlerImpl.java b/permission_handler/android/src/main/java/com/baseflow/permissionhandler/MethodCallHandlerImpl.java similarity index 100% rename from android/src/main/java/com/baseflow/permissionhandler/MethodCallHandlerImpl.java rename to permission_handler/android/src/main/java/com/baseflow/permissionhandler/MethodCallHandlerImpl.java diff --git a/android/src/main/java/com/baseflow/permissionhandler/PermissionConstants.java b/permission_handler/android/src/main/java/com/baseflow/permissionhandler/PermissionConstants.java similarity index 100% rename from android/src/main/java/com/baseflow/permissionhandler/PermissionConstants.java rename to permission_handler/android/src/main/java/com/baseflow/permissionhandler/PermissionConstants.java diff --git a/android/src/main/java/com/baseflow/permissionhandler/PermissionHandlerPlugin.java b/permission_handler/android/src/main/java/com/baseflow/permissionhandler/PermissionHandlerPlugin.java similarity index 100% rename from android/src/main/java/com/baseflow/permissionhandler/PermissionHandlerPlugin.java rename to permission_handler/android/src/main/java/com/baseflow/permissionhandler/PermissionHandlerPlugin.java diff --git a/android/src/main/java/com/baseflow/permissionhandler/PermissionManager.java b/permission_handler/android/src/main/java/com/baseflow/permissionhandler/PermissionManager.java similarity index 100% rename from android/src/main/java/com/baseflow/permissionhandler/PermissionManager.java rename to permission_handler/android/src/main/java/com/baseflow/permissionhandler/PermissionManager.java diff --git a/android/src/main/java/com/baseflow/permissionhandler/PermissionUtils.java b/permission_handler/android/src/main/java/com/baseflow/permissionhandler/PermissionUtils.java similarity index 100% rename from android/src/main/java/com/baseflow/permissionhandler/PermissionUtils.java rename to permission_handler/android/src/main/java/com/baseflow/permissionhandler/PermissionUtils.java diff --git a/android/src/main/java/com/baseflow/permissionhandler/ServiceManager.java b/permission_handler/android/src/main/java/com/baseflow/permissionhandler/ServiceManager.java similarity index 100% rename from android/src/main/java/com/baseflow/permissionhandler/ServiceManager.java rename to permission_handler/android/src/main/java/com/baseflow/permissionhandler/ServiceManager.java diff --git a/example/.gitignore b/permission_handler/example/.gitignore similarity index 100% rename from example/.gitignore rename to permission_handler/example/.gitignore diff --git a/example/.metadata b/permission_handler/example/.metadata similarity index 100% rename from example/.metadata rename to permission_handler/example/.metadata diff --git a/example/README.md b/permission_handler/example/README.md similarity index 100% rename from example/README.md rename to permission_handler/example/README.md diff --git a/example/android/.settings/org.eclipse.buildship.core.prefs b/permission_handler/example/android/.settings/org.eclipse.buildship.core.prefs similarity index 100% rename from example/android/.settings/org.eclipse.buildship.core.prefs rename to permission_handler/example/android/.settings/org.eclipse.buildship.core.prefs diff --git a/example/android/app/build.gradle b/permission_handler/example/android/app/build.gradle similarity index 100% rename from example/android/app/build.gradle rename to permission_handler/example/android/app/build.gradle diff --git a/example/android/app/src/main/AndroidManifest.xml b/permission_handler/example/android/app/src/main/AndroidManifest.xml similarity index 100% rename from example/android/app/src/main/AndroidManifest.xml rename to permission_handler/example/android/app/src/main/AndroidManifest.xml diff --git a/example/android/app/src/main/res/drawable/launch_background.xml b/permission_handler/example/android/app/src/main/res/drawable/launch_background.xml similarity index 100% rename from example/android/app/src/main/res/drawable/launch_background.xml rename to permission_handler/example/android/app/src/main/res/drawable/launch_background.xml diff --git a/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png b/permission_handler/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png similarity index 100% rename from example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png rename to permission_handler/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png diff --git a/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png b/permission_handler/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png similarity index 100% rename from example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png rename to permission_handler/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png diff --git a/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/permission_handler/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png similarity index 100% rename from example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png rename to permission_handler/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png diff --git a/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/permission_handler/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png similarity index 100% rename from example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png rename to permission_handler/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png diff --git a/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/permission_handler/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png similarity index 100% rename from example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png rename to permission_handler/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png diff --git a/example/android/app/src/main/res/values/styles.xml b/permission_handler/example/android/app/src/main/res/values/styles.xml similarity index 100% rename from example/android/app/src/main/res/values/styles.xml rename to permission_handler/example/android/app/src/main/res/values/styles.xml diff --git a/example/android/app/src/profile/AndroidManifest.xml b/permission_handler/example/android/app/src/profile/AndroidManifest.xml similarity index 100% rename from example/android/app/src/profile/AndroidManifest.xml rename to permission_handler/example/android/app/src/profile/AndroidManifest.xml diff --git a/example/android/build.gradle b/permission_handler/example/android/build.gradle similarity index 100% rename from example/android/build.gradle rename to permission_handler/example/android/build.gradle diff --git a/example/android/gradle.properties b/permission_handler/example/android/gradle.properties similarity index 100% rename from example/android/gradle.properties rename to permission_handler/example/android/gradle.properties diff --git a/example/android/gradle/wrapper/gradle-wrapper.properties b/permission_handler/example/android/gradle/wrapper/gradle-wrapper.properties similarity index 100% rename from example/android/gradle/wrapper/gradle-wrapper.properties rename to permission_handler/example/android/gradle/wrapper/gradle-wrapper.properties diff --git a/example/android/settings.gradle b/permission_handler/example/android/settings.gradle similarity index 100% rename from example/android/settings.gradle rename to permission_handler/example/android/settings.gradle diff --git a/example/ios/Flutter/AppFrameworkInfo.plist b/permission_handler/example/ios/Flutter/AppFrameworkInfo.plist similarity index 100% rename from example/ios/Flutter/AppFrameworkInfo.plist rename to permission_handler/example/ios/Flutter/AppFrameworkInfo.plist diff --git a/example/ios/Flutter/Debug.xcconfig b/permission_handler/example/ios/Flutter/Debug.xcconfig similarity index 100% rename from example/ios/Flutter/Debug.xcconfig rename to permission_handler/example/ios/Flutter/Debug.xcconfig diff --git a/example/ios/Flutter/Flutter.podspec b/permission_handler/example/ios/Flutter/Flutter.podspec similarity index 100% rename from example/ios/Flutter/Flutter.podspec rename to permission_handler/example/ios/Flutter/Flutter.podspec diff --git a/example/ios/Flutter/Release.xcconfig b/permission_handler/example/ios/Flutter/Release.xcconfig similarity index 100% rename from example/ios/Flutter/Release.xcconfig rename to permission_handler/example/ios/Flutter/Release.xcconfig diff --git a/example/ios/Podfile b/permission_handler/example/ios/Podfile similarity index 100% rename from example/ios/Podfile rename to permission_handler/example/ios/Podfile diff --git a/example/ios/Runner.xcodeproj/project.pbxproj b/permission_handler/example/ios/Runner.xcodeproj/project.pbxproj similarity index 100% rename from example/ios/Runner.xcodeproj/project.pbxproj rename to permission_handler/example/ios/Runner.xcodeproj/project.pbxproj diff --git a/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/permission_handler/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata similarity index 100% rename from example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata rename to permission_handler/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata diff --git a/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/permission_handler/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme similarity index 100% rename from example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme rename to permission_handler/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme diff --git a/example/ios/Runner.xcworkspace/contents.xcworkspacedata b/permission_handler/example/ios/Runner.xcworkspace/contents.xcworkspacedata similarity index 100% rename from example/ios/Runner.xcworkspace/contents.xcworkspacedata rename to permission_handler/example/ios/Runner.xcworkspace/contents.xcworkspacedata diff --git a/example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/permission_handler/example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist similarity index 100% rename from example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist rename to permission_handler/example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist diff --git a/example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/permission_handler/example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings similarity index 100% rename from example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings rename to permission_handler/example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings diff --git a/example/ios/Runner/AppDelegate.h b/permission_handler/example/ios/Runner/AppDelegate.h similarity index 100% rename from example/ios/Runner/AppDelegate.h rename to permission_handler/example/ios/Runner/AppDelegate.h diff --git a/example/ios/Runner/AppDelegate.m b/permission_handler/example/ios/Runner/AppDelegate.m similarity index 100% rename from example/ios/Runner/AppDelegate.m rename to permission_handler/example/ios/Runner/AppDelegate.m diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json b/permission_handler/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json similarity index 100% rename from example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json rename to permission_handler/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png b/permission_handler/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png similarity index 100% rename from example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png rename to permission_handler/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png b/permission_handler/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png similarity index 100% rename from example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png rename to permission_handler/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png b/permission_handler/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png similarity index 100% rename from example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png rename to permission_handler/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png b/permission_handler/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png similarity index 100% rename from example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png rename to permission_handler/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png b/permission_handler/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png similarity index 100% rename from example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png rename to permission_handler/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png b/permission_handler/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png similarity index 100% rename from example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png rename to permission_handler/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png b/permission_handler/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png similarity index 100% rename from example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png rename to permission_handler/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png b/permission_handler/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png similarity index 100% rename from example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png rename to permission_handler/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png b/permission_handler/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png similarity index 100% rename from example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png rename to permission_handler/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png b/permission_handler/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png similarity index 100% rename from example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png rename to permission_handler/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png b/permission_handler/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png similarity index 100% rename from example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png rename to permission_handler/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png b/permission_handler/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png similarity index 100% rename from example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png rename to permission_handler/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png b/permission_handler/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png similarity index 100% rename from example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png rename to permission_handler/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png b/permission_handler/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png similarity index 100% rename from example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png rename to permission_handler/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png b/permission_handler/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png similarity index 100% rename from example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png rename to permission_handler/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png diff --git a/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json b/permission_handler/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json similarity index 100% rename from example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json rename to permission_handler/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json diff --git a/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png b/permission_handler/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png similarity index 100% rename from example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png rename to permission_handler/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png diff --git a/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png b/permission_handler/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png similarity index 100% rename from example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png rename to permission_handler/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png diff --git a/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png b/permission_handler/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png similarity index 100% rename from example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png rename to permission_handler/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png diff --git a/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md b/permission_handler/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md similarity index 100% rename from example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md rename to permission_handler/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md diff --git a/example/ios/Runner/Base.lproj/LaunchScreen.storyboard b/permission_handler/example/ios/Runner/Base.lproj/LaunchScreen.storyboard similarity index 100% rename from example/ios/Runner/Base.lproj/LaunchScreen.storyboard rename to permission_handler/example/ios/Runner/Base.lproj/LaunchScreen.storyboard diff --git a/example/ios/Runner/Base.lproj/Main.storyboard b/permission_handler/example/ios/Runner/Base.lproj/Main.storyboard similarity index 100% rename from example/ios/Runner/Base.lproj/Main.storyboard rename to permission_handler/example/ios/Runner/Base.lproj/Main.storyboard diff --git a/example/ios/Runner/Info.plist b/permission_handler/example/ios/Runner/Info.plist similarity index 100% rename from example/ios/Runner/Info.plist rename to permission_handler/example/ios/Runner/Info.plist diff --git a/example/ios/Runner/Runner.entitlements b/permission_handler/example/ios/Runner/Runner.entitlements similarity index 100% rename from example/ios/Runner/Runner.entitlements rename to permission_handler/example/ios/Runner/Runner.entitlements diff --git a/example/ios/Runner/main.m b/permission_handler/example/ios/Runner/main.m similarity index 100% rename from example/ios/Runner/main.m rename to permission_handler/example/ios/Runner/main.m diff --git a/example/lib/main.dart b/permission_handler/example/lib/main.dart similarity index 100% rename from example/lib/main.dart rename to permission_handler/example/lib/main.dart diff --git a/example/pubspec.yaml b/permission_handler/example/pubspec.yaml similarity index 100% rename from example/pubspec.yaml rename to permission_handler/example/pubspec.yaml diff --git a/ios/.gitignore b/permission_handler/ios/.gitignore similarity index 100% rename from ios/.gitignore rename to permission_handler/ios/.gitignore diff --git a/ios/Assets/.gitkeep b/permission_handler/ios/Assets/.gitkeep similarity index 100% rename from ios/Assets/.gitkeep rename to permission_handler/ios/Assets/.gitkeep diff --git a/ios/Classes/PermissionHandlerEnums.h b/permission_handler/ios/Classes/PermissionHandlerEnums.h similarity index 100% rename from ios/Classes/PermissionHandlerEnums.h rename to permission_handler/ios/Classes/PermissionHandlerEnums.h diff --git a/ios/Classes/PermissionHandlerPlugin.h b/permission_handler/ios/Classes/PermissionHandlerPlugin.h similarity index 100% rename from ios/Classes/PermissionHandlerPlugin.h rename to permission_handler/ios/Classes/PermissionHandlerPlugin.h diff --git a/ios/Classes/PermissionHandlerPlugin.m b/permission_handler/ios/Classes/PermissionHandlerPlugin.m similarity index 100% rename from ios/Classes/PermissionHandlerPlugin.m rename to permission_handler/ios/Classes/PermissionHandlerPlugin.m diff --git a/ios/Classes/PermissionManager.h b/permission_handler/ios/Classes/PermissionManager.h similarity index 100% rename from ios/Classes/PermissionManager.h rename to permission_handler/ios/Classes/PermissionManager.h diff --git a/ios/Classes/PermissionManager.m b/permission_handler/ios/Classes/PermissionManager.m similarity index 100% rename from ios/Classes/PermissionManager.m rename to permission_handler/ios/Classes/PermissionManager.m diff --git a/ios/Classes/strategies/AudioVideoPermissionStrategy.h b/permission_handler/ios/Classes/strategies/AudioVideoPermissionStrategy.h similarity index 100% rename from ios/Classes/strategies/AudioVideoPermissionStrategy.h rename to permission_handler/ios/Classes/strategies/AudioVideoPermissionStrategy.h diff --git a/ios/Classes/strategies/AudioVideoPermissionStrategy.m b/permission_handler/ios/Classes/strategies/AudioVideoPermissionStrategy.m similarity index 100% rename from ios/Classes/strategies/AudioVideoPermissionStrategy.m rename to permission_handler/ios/Classes/strategies/AudioVideoPermissionStrategy.m diff --git a/ios/Classes/strategies/ContactPermissionStrategy.h b/permission_handler/ios/Classes/strategies/ContactPermissionStrategy.h similarity index 100% rename from ios/Classes/strategies/ContactPermissionStrategy.h rename to permission_handler/ios/Classes/strategies/ContactPermissionStrategy.h diff --git a/ios/Classes/strategies/ContactPermissionStrategy.m b/permission_handler/ios/Classes/strategies/ContactPermissionStrategy.m similarity index 100% rename from ios/Classes/strategies/ContactPermissionStrategy.m rename to permission_handler/ios/Classes/strategies/ContactPermissionStrategy.m diff --git a/ios/Classes/strategies/EventPermissionStrategy.h b/permission_handler/ios/Classes/strategies/EventPermissionStrategy.h similarity index 100% rename from ios/Classes/strategies/EventPermissionStrategy.h rename to permission_handler/ios/Classes/strategies/EventPermissionStrategy.h diff --git a/ios/Classes/strategies/EventPermissionStrategy.m b/permission_handler/ios/Classes/strategies/EventPermissionStrategy.m similarity index 100% rename from ios/Classes/strategies/EventPermissionStrategy.m rename to permission_handler/ios/Classes/strategies/EventPermissionStrategy.m diff --git a/ios/Classes/strategies/LocationPermissionStrategy.h b/permission_handler/ios/Classes/strategies/LocationPermissionStrategy.h similarity index 100% rename from ios/Classes/strategies/LocationPermissionStrategy.h rename to permission_handler/ios/Classes/strategies/LocationPermissionStrategy.h diff --git a/ios/Classes/strategies/LocationPermissionStrategy.m b/permission_handler/ios/Classes/strategies/LocationPermissionStrategy.m similarity index 100% rename from ios/Classes/strategies/LocationPermissionStrategy.m rename to permission_handler/ios/Classes/strategies/LocationPermissionStrategy.m diff --git a/ios/Classes/strategies/MediaLibraryPermissionStrategy.h b/permission_handler/ios/Classes/strategies/MediaLibraryPermissionStrategy.h similarity index 100% rename from ios/Classes/strategies/MediaLibraryPermissionStrategy.h rename to permission_handler/ios/Classes/strategies/MediaLibraryPermissionStrategy.h diff --git a/ios/Classes/strategies/MediaLibraryPermissionStrategy.m b/permission_handler/ios/Classes/strategies/MediaLibraryPermissionStrategy.m similarity index 100% rename from ios/Classes/strategies/MediaLibraryPermissionStrategy.m rename to permission_handler/ios/Classes/strategies/MediaLibraryPermissionStrategy.m diff --git a/ios/Classes/strategies/NotificationPermissionStrategy.h b/permission_handler/ios/Classes/strategies/NotificationPermissionStrategy.h similarity index 100% rename from ios/Classes/strategies/NotificationPermissionStrategy.h rename to permission_handler/ios/Classes/strategies/NotificationPermissionStrategy.h diff --git a/ios/Classes/strategies/NotificationPermissionStrategy.m b/permission_handler/ios/Classes/strategies/NotificationPermissionStrategy.m similarity index 100% rename from ios/Classes/strategies/NotificationPermissionStrategy.m rename to permission_handler/ios/Classes/strategies/NotificationPermissionStrategy.m diff --git a/ios/Classes/strategies/PermissionStrategy.h b/permission_handler/ios/Classes/strategies/PermissionStrategy.h similarity index 100% rename from ios/Classes/strategies/PermissionStrategy.h rename to permission_handler/ios/Classes/strategies/PermissionStrategy.h diff --git a/ios/Classes/strategies/PhonePermissionStrategy.h b/permission_handler/ios/Classes/strategies/PhonePermissionStrategy.h similarity index 100% rename from ios/Classes/strategies/PhonePermissionStrategy.h rename to permission_handler/ios/Classes/strategies/PhonePermissionStrategy.h diff --git a/ios/Classes/strategies/PhonePermissionStrategy.m b/permission_handler/ios/Classes/strategies/PhonePermissionStrategy.m similarity index 100% rename from ios/Classes/strategies/PhonePermissionStrategy.m rename to permission_handler/ios/Classes/strategies/PhonePermissionStrategy.m diff --git a/ios/Classes/strategies/PhotoPermissionStrategy.h b/permission_handler/ios/Classes/strategies/PhotoPermissionStrategy.h similarity index 100% rename from ios/Classes/strategies/PhotoPermissionStrategy.h rename to permission_handler/ios/Classes/strategies/PhotoPermissionStrategy.h diff --git a/ios/Classes/strategies/PhotoPermissionStrategy.m b/permission_handler/ios/Classes/strategies/PhotoPermissionStrategy.m similarity index 100% rename from ios/Classes/strategies/PhotoPermissionStrategy.m rename to permission_handler/ios/Classes/strategies/PhotoPermissionStrategy.m diff --git a/ios/Classes/strategies/SensorPermissionStrategy.h b/permission_handler/ios/Classes/strategies/SensorPermissionStrategy.h similarity index 100% rename from ios/Classes/strategies/SensorPermissionStrategy.h rename to permission_handler/ios/Classes/strategies/SensorPermissionStrategy.h diff --git a/ios/Classes/strategies/SensorPermissionStrategy.m b/permission_handler/ios/Classes/strategies/SensorPermissionStrategy.m similarity index 100% rename from ios/Classes/strategies/SensorPermissionStrategy.m rename to permission_handler/ios/Classes/strategies/SensorPermissionStrategy.m diff --git a/ios/Classes/strategies/SpeechPermissionStrategy.h b/permission_handler/ios/Classes/strategies/SpeechPermissionStrategy.h similarity index 100% rename from ios/Classes/strategies/SpeechPermissionStrategy.h rename to permission_handler/ios/Classes/strategies/SpeechPermissionStrategy.h diff --git a/ios/Classes/strategies/SpeechPermissionStrategy.m b/permission_handler/ios/Classes/strategies/SpeechPermissionStrategy.m similarity index 100% rename from ios/Classes/strategies/SpeechPermissionStrategy.m rename to permission_handler/ios/Classes/strategies/SpeechPermissionStrategy.m diff --git a/ios/Classes/strategies/StoragePermissionStrategy.h b/permission_handler/ios/Classes/strategies/StoragePermissionStrategy.h similarity index 100% rename from ios/Classes/strategies/StoragePermissionStrategy.h rename to permission_handler/ios/Classes/strategies/StoragePermissionStrategy.h diff --git a/ios/Classes/strategies/StoragePermissionStrategy.m b/permission_handler/ios/Classes/strategies/StoragePermissionStrategy.m similarity index 100% rename from ios/Classes/strategies/StoragePermissionStrategy.m rename to permission_handler/ios/Classes/strategies/StoragePermissionStrategy.m diff --git a/ios/Classes/strategies/UnknownPermissionStrategy.h b/permission_handler/ios/Classes/strategies/UnknownPermissionStrategy.h similarity index 100% rename from ios/Classes/strategies/UnknownPermissionStrategy.h rename to permission_handler/ios/Classes/strategies/UnknownPermissionStrategy.h diff --git a/ios/Classes/strategies/UnknownPermissionStrategy.m b/permission_handler/ios/Classes/strategies/UnknownPermissionStrategy.m similarity index 100% rename from ios/Classes/strategies/UnknownPermissionStrategy.m rename to permission_handler/ios/Classes/strategies/UnknownPermissionStrategy.m diff --git a/ios/Classes/util/Codec.h b/permission_handler/ios/Classes/util/Codec.h similarity index 100% rename from ios/Classes/util/Codec.h rename to permission_handler/ios/Classes/util/Codec.h diff --git a/ios/Classes/util/Codec.m b/permission_handler/ios/Classes/util/Codec.m similarity index 100% rename from ios/Classes/util/Codec.m rename to permission_handler/ios/Classes/util/Codec.m diff --git a/ios/permission_handler.podspec b/permission_handler/ios/permission_handler.podspec similarity index 100% rename from ios/permission_handler.podspec rename to permission_handler/ios/permission_handler.podspec diff --git a/permission_handler/lib/permission_handler.dart b/permission_handler/lib/permission_handler.dart new file mode 100644 index 000000000..18fee4941 --- /dev/null +++ b/permission_handler/lib/permission_handler.dart @@ -0,0 +1,45 @@ +import 'dart:async'; +import 'dart:io'; + +import 'package:permission_handler_platform_interface/permission_handler_platform_interface.dart'; + +export 'package:permission_handler_platform_interface/permission_handler_platform_interface.dart' + show PermissionGroup, PermissionStatus, ServiceStatus; + +/// The Android and iOS implementation of [PermissionHandlerPlatform]. +/// +/// This class implements the `package:permission_handler` functionality for +/// the Android and iOS platforms. +class PermissionHandler extends PermissionHandlerPlatform { + @override + Future checkServiceStatus(PermissionGroup permission) { + return PermissionHandlerPlatform.instance.checkServiceStatus(permission); + } + + @override + Future checkPermissionStatus(PermissionGroup permission) { + return PermissionHandlerPlatform.instance.checkPermissionStatus(permission); + } + + @override + Future openAppSettings() { + return PermissionHandlerPlatform.instance.openAppSettings(); + } + + @override + Future> requestPermissions( + List permissions) { + return PermissionHandlerPlatform.instance.requestPermissions(permissions); + } + + @override + Future shouldShowRequestPermissionRationale( + PermissionGroup permission) { + if(!Platform.isAndroid) { + return Future.value(false); + } + + return PermissionHandlerPlatform.instance + .shouldShowRequestPermissionRationale(permission); + } +} diff --git a/pubspec.yaml b/permission_handler/pubspec.yaml similarity index 58% rename from pubspec.yaml rename to permission_handler/pubspec.yaml index 9eb0cf64a..4ab04a5ad 100644 --- a/pubspec.yaml +++ b/permission_handler/pubspec.yaml @@ -1,6 +1,6 @@ name: permission_handler description: Permission plugin for Flutter. This plugin provides a cross-platform (iOS, Android) API to request and check permissions. -version: 4.3.0 +version: 4.4.0 homepage: https://github.com/baseflowit/flutter-permission-handler environment: @@ -9,13 +9,18 @@ environment: dependencies: flutter: sdk: flutter - meta: ^1.1.6 + permission_handler_platform_interface: ^1.0.0 dev_dependencies: effective_dart: ^1.2.1 + plugin_platform_interface: ^1.0.1 flutter: plugin: - androidPackage: com.baseflow.permissionhandler - pluginClass: PermissionHandlerPlugin + platforms: + android: + package: com.baseflow.permissionhandler + pluginClass: PermissionHandlerPlugin + ios: + pluginClass: PermissionHandlerPlugin diff --git a/scripts/before_build_apks.sh b/permission_handler/scripts/before_build_apks.sh similarity index 100% rename from scripts/before_build_apks.sh rename to permission_handler/scripts/before_build_apks.sh diff --git a/scripts/before_build_ipas.sh b/permission_handler/scripts/before_build_ipas.sh similarity index 100% rename from scripts/before_build_ipas.sh rename to permission_handler/scripts/before_build_ipas.sh diff --git a/permission_handler_android.iml b/permission_handler_android.iml deleted file mode 100644 index ac5d744d7..000000000 --- a/permission_handler_android.iml +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - diff --git a/permission_handler_platform_interface/CHANGELOG.md b/permission_handler_platform_interface/CHANGELOG.md new file mode 100644 index 000000000..4558861a2 --- /dev/null +++ b/permission_handler_platform_interface/CHANGELOG.md @@ -0,0 +1,3 @@ +## 1.0.0 + +- Initial open-source release. \ No newline at end of file diff --git a/permission_handler_platform_interface/LICENSE b/permission_handler_platform_interface/LICENSE new file mode 100644 index 000000000..bd6192f25 --- /dev/null +++ b/permission_handler_platform_interface/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2018 Baseflow + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/permission_handler_platform_interface/README.md b/permission_handler_platform_interface/README.md new file mode 100644 index 000000000..19cbb31e8 --- /dev/null +++ b/permission_handler_platform_interface/README.md @@ -0,0 +1,38 @@ +# permission_handler_platform_interface + +A common platform interface for the [`permission_handler`][1] plugin. + +This interface allows platform-specific implementations of the +`permission_handler` plugin, as well as the plugin itself, to ensure they are +supporting the same interface. + +# Usage + +To implement a new platform-specific implementation of `permission_handler`, +extend [`PermissionHandlerPlatform`][2] with an implementation that performs +the platform-specific behavior, and when you register your plugin, set the +default `PermissionHandlerPlatform` by calling +`PermissionHandlerPlatform.instance = MyPlatformPermissionHandler()`. + +# Issues + +Please file any issues, bugs or feature request as an issue on our [GitHub](https://github.com/Baseflow/flutter-permission-handler/issues) page. + +# Want to contribute + +If you would like to contribute to the plugin (e.g. by improving the documentation, solving a bug or adding a cool new feature), please carefully review our [contribution guide](../CONTRIBUTING.md) and send us your [pull request](https://github.com/Baseflow/flutter-permission-handler/pulls). + +## Note on breaking changes + +Strongly prefer non-breaking changes (such as adding a method to the interface) +over breaking changes for this package. + +See https://flutter.dev/go/platform-interface-breaking-changes for a discussion +on why a less-clean interface is preferable to a breaking change. + +# Author + +This Permission handler plugin for Flutter is developed by [Baseflow](https://baseflow.com). You can contact us at + +[1]: ../permission_handler +[2]: lib/permission_handler_platform_interface.dart \ No newline at end of file diff --git a/permission_handler_platform_interface/lib/permission_handler_platform_interface.dart b/permission_handler_platform_interface/lib/permission_handler_platform_interface.dart new file mode 100644 index 000000000..cc79cea73 --- /dev/null +++ b/permission_handler_platform_interface/lib/permission_handler_platform_interface.dart @@ -0,0 +1,8 @@ +library permission_handler_platform_interface; + +import 'dart:async'; +import 'package:plugin_platform_interface/plugin_platform_interface.dart'; +import 'src/method_channel/method_channel_permission_handler.dart'; + +part 'src/permission_handler_platform_interface.dart'; +part 'src/permission_handler_enums.dart'; diff --git a/lib/src/permission_handler.dart b/permission_handler_platform_interface/lib/src/method_channel/method_channel_permission_handler.dart similarity index 74% rename from lib/src/permission_handler.dart rename to permission_handler_platform_interface/lib/src/method_channel/method_channel_permission_handler.dart index a253599d4..1742c2691 100644 --- a/lib/src/permission_handler.dart +++ b/permission_handler_platform_interface/lib/src/method_channel/method_channel_permission_handler.dart @@ -1,40 +1,15 @@ import 'dart:async'; -import 'dart:convert'; -import 'dart:io'; import 'package:flutter/services.dart'; -import 'package:meta/meta.dart'; -import 'permission_enums.dart'; -import 'utils/codec.dart'; - -/// Provides a cross-platform (iOS, Android) API to request and check -/// permissions. -class PermissionHandler { - /// Constructs a singleton instance of [Geolocator]. - /// - /// When a second instance is created, the first instance will not be able to - /// listen to the EventChannel because it is overridden. Forcing the class to - /// be a singleton class can prevent misuse of creating a second instance - /// from a programmer. - factory PermissionHandler() { - if (_instance == null) { - const methodChannel = - MethodChannel('flutter.baseflow.com/permissions/methods'); - - _instance = PermissionHandler.private(methodChannel); - } - return _instance; - } - - /// This constructor is only used for testing and shouldn't be accessed by - /// users of the plugin. - @visibleForTesting - PermissionHandler.private(this._methodChannel); - static PermissionHandler _instance; +import '../../permission_handler_platform_interface.dart'; +import 'utils/codec.dart'; - final MethodChannel _methodChannel; +const MethodChannel _methodChannel = + MethodChannel('flutter.baseflow.com/permissions/methods'); +/// An implementation of [PermissionHandlerPlatform] that uses method channels. +class MethodChannelPermissionHandler extends PermissionHandlerPlatform { /// Check current permission status. /// /// Returns a [Future] containing the current permission status for the @@ -105,10 +80,6 @@ class PermissionHandler { /// returns [false]. Future shouldShowRequestPermissionRationale( PermissionGroup permission) async { - if (!Platform.isAndroid) { - return false; - } - final shouldShowRationale = await _methodChannel.invokeMethod( 'shouldShowRequestPermissionRationale', permission.value); diff --git a/lib/src/utils/codec.dart b/permission_handler_platform_interface/lib/src/method_channel/utils/codec.dart similarity index 95% rename from lib/src/utils/codec.dart rename to permission_handler_platform_interface/lib/src/method_channel/utils/codec.dart index c13617a11..5df27bb7f 100644 --- a/lib/src/utils/codec.dart +++ b/permission_handler_platform_interface/lib/src/method_channel/utils/codec.dart @@ -1,4 +1,4 @@ -import '../permission_enums.dart'; +import '../../../permission_handler_platform_interface.dart'; /// Provides utility methods for encoding messages that are send on the Flutter /// message channel. diff --git a/lib/src/permission_enums.dart b/permission_handler_platform_interface/lib/src/permission_handler_enums.dart similarity index 99% rename from lib/src/permission_enums.dart rename to permission_handler_platform_interface/lib/src/permission_handler_enums.dart index 02148e1e6..270e554c3 100644 --- a/lib/src/permission_enums.dart +++ b/permission_handler_platform_interface/lib/src/permission_handler_enums.dart @@ -1,3 +1,5 @@ +part of permission_handler_platform_interface; + /// Defines the state of a permission group class PermissionStatus { const PermissionStatus._(this.value); diff --git a/permission_handler_platform_interface/lib/src/permission_handler_platform_interface.dart b/permission_handler_platform_interface/lib/src/permission_handler_platform_interface.dart new file mode 100644 index 000000000..fe605884a --- /dev/null +++ b/permission_handler_platform_interface/lib/src/permission_handler_platform_interface.dart @@ -0,0 +1,92 @@ +part of permission_handler_platform_interface; + +/// The interface that implementations of permission_handler must implement. +/// +/// Platform implementations should extend this class rather than implement it +/// as `permission_handler` does not consider newly added methods to be +/// breaking changes. Extending this class (using `extends`) ensures that the +/// subclass will get the default implementation, while platform +/// implementations that `implements` this interface will be broken by newly +/// added [PermissionHandlerPlatform] methods. +abstract class PermissionHandlerPlatform extends PlatformInterface { + /// Constructs a PermissionHandlerPlatform. + PermissionHandlerPlatform() : super(token: _token); + + static final Object _token = Object(); + + static PermissionHandlerPlatform _instance = MethodChannelPermissionHandler(); + + /// The default instance of [PermissionHandlerPlatform] to use. + /// + /// Defaults to [MethodChannelPermissionHandler]. + static PermissionHandlerPlatform get instance => _instance; + + /// Platform-specific plugins should set this with their own platform-specific + /// class that extends [PermissionHandlerPlatform] when they register themselves. + static set instance(PermissionHandlerPlatform instance) { + PlatformInterface.verifyToken(instance, _token); + _instance = instance; + } + + /// Check current permission status. + /// + /// Returns a [Future] containing the current permission status for the + /// supplied [PermissionGroup]. + Future checkPermissionStatus(PermissionGroup permission) { + throw UnimplementedError( + 'checkPermissionStatus() has not been implemented.'); + } + + /// Check current service status. + /// + /// Returns a [Future] containing the current service status for the supplied + /// [PermissionGroup]. + /// + /// Notes about specific PermissionGroups: + /// - **PermissionGroup.phone** + /// - Android: + /// - The method will return [ServiceStatus.notApplicable] when: + /// 1. the device lacks the TELEPHONY feature + /// 1. TelephonyManager.getPhoneType() returns PHONE_TYPE_NONE + /// 1. when no Intents can be resolved to handle the `tel:` scheme + /// - The method will return [ServiceStatus.disabled] when: + /// 1. the SIM card is missing + /// - iOS: + /// - The method will return [ServiceStatus.notApplicable] when: + /// 1. the native code can not find a handler for the `tel:` scheme + /// - The method will return [ServiceStatus.disabled] when: + /// 1. the mobile network code (MNC) is either 0 or 65535. See + /// https://stackoverflow.com/a/11595365 for details + /// - **PLEASE NOTE that this is still not a perfect indication** of the + /// devices' capability to place & connect phone calls + /// as it also depends on the network condition. + Future checkServiceStatus(PermissionGroup permission) { + throw UnimplementedError('checkServiceStatus() has not been implemented.'); + } + + /// Open the App settings page. + /// + /// Returns [true] if the app settings page could be opened, + /// otherwise [false] is returned. + Future openAppSettings() { + throw UnimplementedError('openAppSettings() has not been implemented.'); + } + + /// Request the user for access to the supplied list of permissiongroups. + /// + /// Returns a [Map] containing the status per requested permissiongroup. + Future> requestPermissions( + List permissions) { + throw UnimplementedError('requestPermissions() has not been implemented.'); + } + + /// Request to see if you should show a rationale for requesting permission. + /// + /// This method is only implemented on Android, calling this on iOS always + /// returns [false]. + Future shouldShowRequestPermissionRationale( + PermissionGroup permission) { + throw UnimplementedError( + 'shouldShowRequestPermissionRationale() has not been implemented.'); + } +} diff --git a/permission_handler_platform_interface/pubspec.yaml b/permission_handler_platform_interface/pubspec.yaml new file mode 100644 index 000000000..bc8334ea8 --- /dev/null +++ b/permission_handler_platform_interface/pubspec.yaml @@ -0,0 +1,22 @@ +name: permission_handler_platform_interface +description: A common platform interface for the permission_handler plugin. +homepage: https://github.com/baseflow/flutter-permission-handler/tree/master/permission_handler_platform_interface +# NOTE: We strongly prefer non-breaking changes, even at the expense of a +# less-clean API. See https://flutter.dev/go/platform-interface-breaking-changes +version: 1.0.0 + +dependencies: + flutter: + sdk: flutter + meta: ^1.0.5 + plugin_platform_interface: ^1.0.1 + +dev_dependencies: + flutter_test: + sdk: flutter + mockito: ^4.1.1 + effective_dart: ^1.2.1 + +environment: + sdk: ">=2.0.0-dev.28.0 <3.0.0" + flutter: ">=1.9.1+hotfix.4 <2.0.0" \ No newline at end of file