diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml
index 45dc354fa..9392a6a76 100644
--- a/android/app/src/main/AndroidManifest.xml
+++ b/android/app/src/main/AndroidManifest.xml
@@ -15,14 +15,22 @@
-
-
-
-
+
+
-
+
+
+
+
+
+
+
+
@@ -31,7 +39,7 @@
diff --git a/android/app/src/main/res/drawable-hdpi/ic_launcher_background.png b/android/app/src/main/res/drawable-hdpi/ic_launcher_background.png
new file mode 100644
index 000000000..433c3ead1
Binary files /dev/null and b/android/app/src/main/res/drawable-hdpi/ic_launcher_background.png differ
diff --git a/android/app/src/main/res/drawable-hdpi/ic_launcher_foreground.png b/android/app/src/main/res/drawable-hdpi/ic_launcher_foreground.png
new file mode 100644
index 000000000..433c3ead1
Binary files /dev/null and b/android/app/src/main/res/drawable-hdpi/ic_launcher_foreground.png differ
diff --git a/android/app/src/main/res/drawable-mdpi/ic_launcher_background.png b/android/app/src/main/res/drawable-mdpi/ic_launcher_background.png
new file mode 100644
index 000000000..9ae0ac550
Binary files /dev/null and b/android/app/src/main/res/drawable-mdpi/ic_launcher_background.png differ
diff --git a/android/app/src/main/res/drawable-mdpi/ic_launcher_foreground.png b/android/app/src/main/res/drawable-mdpi/ic_launcher_foreground.png
new file mode 100644
index 000000000..9ae0ac550
Binary files /dev/null and b/android/app/src/main/res/drawable-mdpi/ic_launcher_foreground.png differ
diff --git a/android/app/src/main/res/drawable-xhdpi/ic_launcher_background.png b/android/app/src/main/res/drawable-xhdpi/ic_launcher_background.png
new file mode 100644
index 000000000..d5d158c62
Binary files /dev/null and b/android/app/src/main/res/drawable-xhdpi/ic_launcher_background.png differ
diff --git a/android/app/src/main/res/drawable-xhdpi/ic_launcher_foreground.png b/android/app/src/main/res/drawable-xhdpi/ic_launcher_foreground.png
new file mode 100644
index 000000000..d5d158c62
Binary files /dev/null and b/android/app/src/main/res/drawable-xhdpi/ic_launcher_foreground.png differ
diff --git a/android/app/src/main/res/drawable-xxhdpi/ic_launcher_background.png b/android/app/src/main/res/drawable-xxhdpi/ic_launcher_background.png
new file mode 100644
index 000000000..3224e1ba7
Binary files /dev/null and b/android/app/src/main/res/drawable-xxhdpi/ic_launcher_background.png differ
diff --git a/android/app/src/main/res/drawable-xxhdpi/ic_launcher_foreground.png b/android/app/src/main/res/drawable-xxhdpi/ic_launcher_foreground.png
new file mode 100644
index 000000000..3224e1ba7
Binary files /dev/null and b/android/app/src/main/res/drawable-xxhdpi/ic_launcher_foreground.png differ
diff --git a/android/app/src/main/res/drawable-xxxhdpi/ic_launcher_background.png b/android/app/src/main/res/drawable-xxxhdpi/ic_launcher_background.png
new file mode 100644
index 000000000..2e45f66f8
Binary files /dev/null and b/android/app/src/main/res/drawable-xxxhdpi/ic_launcher_background.png differ
diff --git a/android/app/src/main/res/drawable-xxxhdpi/ic_launcher_foreground.png b/android/app/src/main/res/drawable-xxxhdpi/ic_launcher_foreground.png
new file mode 100644
index 000000000..2e45f66f8
Binary files /dev/null and b/android/app/src/main/res/drawable-xxxhdpi/ic_launcher_foreground.png differ
diff --git a/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
new file mode 100644
index 000000000..d04776081
--- /dev/null
+++ b/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
diff --git a/android/app/src/main/res/mipmap-hdpi/ic_launcher.png b/android/app/src/main/res/mipmap-hdpi/ic_launcher.png
index db77bb4b7..139504172 100644
Binary files a/android/app/src/main/res/mipmap-hdpi/ic_launcher.png and b/android/app/src/main/res/mipmap-hdpi/ic_launcher.png differ
diff --git a/android/app/src/main/res/mipmap-mdpi/ic_launcher.png b/android/app/src/main/res/mipmap-mdpi/ic_launcher.png
index 17987b79b..ca11ca41a 100644
Binary files a/android/app/src/main/res/mipmap-mdpi/ic_launcher.png and b/android/app/src/main/res/mipmap-mdpi/ic_launcher.png differ
diff --git a/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
index 09d439148..e6fd03dc8 100644
Binary files a/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png and b/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ
diff --git a/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
index d5f1c8d34..86cd8be74 100644
Binary files a/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png and b/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ
diff --git a/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
index 4d6372eeb..6b630e054 100644
Binary files a/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png and b/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ
diff --git a/android/app/src/main/res/values/colors.xml b/android/app/src/main/res/values/colors.xml
new file mode 100644
index 000000000..ab9832824
--- /dev/null
+++ b/android/app/src/main/res/values/colors.xml
@@ -0,0 +1,4 @@
+
+
+ #ffffff
+
\ No newline at end of file
diff --git a/assets/icon.png b/assets/icon.png
new file mode 100644
index 000000000..a230cd0aa
Binary files /dev/null and b/assets/icon.png differ
diff --git a/lib/external_path/external_path_service.dart b/lib/external_path/external_path_service.dart
index 2d5549bd8..ca4f03e75 100644
--- a/lib/external_path/external_path_service.dart
+++ b/lib/external_path/external_path_service.dart
@@ -6,6 +6,7 @@ import 'package:file_picker/file_picker.dart';
import 'package:file_selector/file_selector.dart';
import 'package:gtk/gtk.dart';
import 'package:m3u_parser_nullsafe/m3u_parser_nullsafe.dart';
+import 'package:permission_handler/permission_handler.dart';
import 'package:pls/pls.dart';
import 'package:yaru/yaru.dart';
@@ -168,7 +169,7 @@ class ExternalPathService {
}
Future getPathOfDirectory() async {
- if (isMobile) {
+ if (isMobile && await _androidPermissionsGranted()) {
return FilePicker.platform.getDirectoryPath();
}
@@ -177,4 +178,29 @@ class ExternalPathService {
}
return null;
}
+
+ Future _androidPermissionsGranted() async {
+ final mediaLibraryIsGranted = (await Permission.mediaLibrary
+ .onDeniedCallback(() {})
+ .onGrantedCallback(() {})
+ .onPermanentlyDeniedCallback(() {})
+ .onRestrictedCallback(() {})
+ .onLimitedCallback(() {})
+ .onProvisionalCallback(() {})
+ .request())
+ .isGranted;
+
+ final manageExternalStorageIsGranted = (await Permission
+ .manageExternalStorage
+ .onDeniedCallback(() {})
+ .onGrantedCallback(() {})
+ .onPermanentlyDeniedCallback(() {})
+ .onRestrictedCallback(() {})
+ .onLimitedCallback(() {})
+ .onProvisionalCallback(() {})
+ .request())
+ .isGranted;
+
+ return mediaLibraryIsGranted && manageExternalStorageIsGranted;
+ }
}
diff --git a/pubspec.lock b/pubspec.lock
index ac887e974..016ffcdd9 100644
--- a/pubspec.lock
+++ b/pubspec.lock
@@ -271,6 +271,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.0.3"
+ cli_util:
+ dependency: transitive
+ description:
+ name: cli_util
+ sha256: ff6785f7e9e3c38ac98b2fb035701789de90154024a75b6cb926445e83197d1c
+ url: "https://pub.dev"
+ source: hosted
+ version: "0.4.2"
clock:
dependency: transitive
description:
@@ -548,6 +556,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "3.0.0-beta.2"
+ flutter_launcher_icons:
+ dependency: "direct dev"
+ description:
+ name: flutter_launcher_icons
+ sha256: "619817c4b65b322b5104b6bb6dfe6cda62d9729bd7ad4303ecc8b4e690a67a77"
+ url: "https://pub.dev"
+ source: hosted
+ version: "0.14.1"
flutter_lints:
dependency: "direct dev"
description:
@@ -1093,6 +1109,54 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.3.0"
+ permission_handler:
+ dependency: "direct main"
+ description:
+ name: permission_handler
+ sha256: "18bf33f7fefbd812f37e72091a15575e72d5318854877e0e4035a24ac1113ecb"
+ url: "https://pub.dev"
+ source: hosted
+ version: "11.3.1"
+ permission_handler_android:
+ dependency: transitive
+ description:
+ name: permission_handler_android
+ sha256: "71bbecfee799e65aff7c744761a57e817e73b738fedf62ab7afd5593da21f9f1"
+ url: "https://pub.dev"
+ source: hosted
+ version: "12.0.13"
+ permission_handler_apple:
+ dependency: transitive
+ description:
+ name: permission_handler_apple
+ sha256: e6f6d73b12438ef13e648c4ae56bd106ec60d17e90a59c4545db6781229082a0
+ url: "https://pub.dev"
+ source: hosted
+ version: "9.4.5"
+ permission_handler_html:
+ dependency: transitive
+ description:
+ name: permission_handler_html
+ sha256: af26edbbb1f2674af65a8f4b56e1a6f526156bc273d0e65dd8075fab51c78851
+ url: "https://pub.dev"
+ source: hosted
+ version: "0.1.3+2"
+ permission_handler_platform_interface:
+ dependency: transitive
+ description:
+ name: permission_handler_platform_interface
+ sha256: e9c8eadee926c4532d0305dff94b85bf961f16759c3af791486613152af4b4f9
+ url: "https://pub.dev"
+ source: hosted
+ version: "4.2.3"
+ permission_handler_windows:
+ dependency: transitive
+ description:
+ name: permission_handler_windows
+ sha256: "1a790728016f79a41216d88672dbc5df30e686e811ad4e698bfc51f76ad91f1e"
+ url: "https://pub.dev"
+ source: hosted
+ version: "0.2.1"
petitparser:
dependency: transitive
description:
diff --git a/pubspec.yaml b/pubspec.yaml
index fd2d9bff4..6abcc6eac 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -56,6 +56,7 @@ dependencies:
palette_generator: ^0.3.3+3
path: ^1.9.0
path_provider: ^2.1.2
+ permission_handler: ^11.3.1
phoenix_theme:
git:
url: https://github.com/ubuntu-flutter-community/phoenix_theme
@@ -85,9 +86,17 @@ dependencies:
dev_dependencies:
build_runner: ^2.4.8
+ flutter_launcher_icons: ^0.14.1
flutter_lints: ^5.0.0
flutter_test:
sdk: flutter
+flutter_launcher_icons:
+ android: true
+ ios: false
+ min_sdk_android: 23
+ image_path: "assets/icon.png"
+ adaptive_icon_background: "assets/icon.png"
+ adaptive_icon_foreground: "assets/icon.png"
flutter:
generate: true
diff --git a/windows/flutter/generated_plugin_registrant.cc b/windows/flutter/generated_plugin_registrant.cc
index f5e21409a..c28d6dd72 100644
--- a/windows/flutter/generated_plugin_registrant.cc
+++ b/windows/flutter/generated_plugin_registrant.cc
@@ -11,6 +11,7 @@
#include
#include
#include
+#include
#include
#include
#include
@@ -29,6 +30,8 @@ void RegisterPlugins(flutter::PluginRegistry* registry) {
registry->GetRegistrarForPlugin("MediaKitLibsWindowsVideoPluginCApi"));
MediaKitVideoPluginCApiRegisterWithRegistrar(
registry->GetRegistrarForPlugin("MediaKitVideoPluginCApi"));
+ PermissionHandlerWindowsPluginRegisterWithRegistrar(
+ registry->GetRegistrarForPlugin("PermissionHandlerWindowsPlugin"));
ScreenBrightnessWindowsPluginRegisterWithRegistrar(
registry->GetRegistrarForPlugin("ScreenBrightnessWindowsPlugin"));
ScreenRetrieverWindowsPluginCApiRegisterWithRegistrar(
diff --git a/windows/flutter/generated_plugins.cmake b/windows/flutter/generated_plugins.cmake
index 1b0b4b024..cff2be31f 100644
--- a/windows/flutter/generated_plugins.cmake
+++ b/windows/flutter/generated_plugins.cmake
@@ -8,6 +8,7 @@ list(APPEND FLUTTER_PLUGIN_LIST
irondash_engine_context
media_kit_libs_windows_video
media_kit_video
+ permission_handler_windows
screen_brightness_windows
screen_retriever_windows
super_native_extensions