An open-source cross-platform alternative to AirDrop
feat: implement Android SAF (#1501)
Tien Do Nam54e8810ef9a8
diff --git a/app/android/app/src/main/AndroidManifest.xml b/app/android/app/src/main/AndroidManifest.xmlindex da419b48..241e2b87 100644--- a/app/android/app/src/main/AndroidManifest.xml+++ b/app/android/app/src/main/AndroidManifest.xml@@ -5,7 +5,6 @@<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /><uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />- <uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" /><uses-permission android:name="android.permission.READ_MEDIA_IMAGES" /><uses-permission android:name="android.permission.READ_MEDIA_VIDEO" />diff --git a/app/android/app/src/main/kotlin/org/localsend/localsend_app/FastDocumentFile.kt b/app/android/app/src/main/kotlin/org/localsend/localsend_app/FastDocumentFile.ktnew file mode 100644index 00000000..b8d1454a--- /dev/null+++ b/app/android/app/src/main/kotlin/org/localsend/localsend_app/FastDocumentFile.kt@@ -0,0 +1,141 @@+package org.localsend.localsend_app++import android.content.ContentResolver+import android.content.Context+import android.database.Cursor+import android.net.Uri+import android.provider.DocumentsContract+import android.util.Log++const val MIME_TYPE_DIR = "vnd.android.document/directory"++/**+ * Similar to AndroidX/DocumentFile, but faster by querying all fields at once.+ */+class FastDocumentFile(+ private val context: Context,+ private val mime: String,+ val uri: Uri,+ val name: String,+ val size: Long,+ val lastModified: Long,+) {+ val isDirectory: Boolean = mime == MIME_TYPE_DIR+ val isFile: Boolean = !isDirectory && mime.isNotBlank()++ fun listFiles(): List<FastDocumentFile> {+ val resolver: ContentResolver = context.contentResolver+ val childrenUri = DocumentsContract.buildChildDocumentsUriUsingTree(+ uri,+ DocumentsContract.getDocumentId(uri)+ )++ val results = mutableListOf<FastDocumentFile>()++ var cursor: Cursor? = null+ try {+ cursor = resolver.query(+ childrenUri,+ arrayOf(+ DocumentsContract.Document.COLUMN_MIME_TYPE,+ DocumentsContract.Document.COLUMN_DOCUMENT_ID,+ DocumentsContract.Document.COLUMN_DISPLAY_NAME,+ DocumentsContract.Document.COLUMN_SIZE,+ DocumentsContract.Document.COLUMN_LAST_MODIFIED,+ ),+ null,+ null,+ null+ )+ while (cursor!!.moveToNext()) {+ results.add(+ FastDocumentFile(+ context = context,+ mime = cursor.getString(0),+ uri = DocumentsContract.buildDocumentUriUsingTree(+ uri,+ cursor.getString(1)+ ),+ name = cursor.getString(2),+ size = cursor.getLong(3),+ lastModified = cursor.getLong(4)+ )+ )+ }+ } catch (e: Exception) {+ Log.w(TAG, "Error: $e")+ } finally {+ try {+ cursor?.close()+ } catch (_: Exception) {}+ }+ return results+ }++ companion object {+ const val TAG = "FastDocumentFile"++ /**+ * Create a FastDocumentFile from a tree Uri.+ */+ fun fromTreeUri(context: Context, treeUri: Uri): FastDocumentFile {+ val documentId = when {+ DocumentsContract.isDocumentUri(+ context,+ treeUri+ ) -> DocumentsContract.getDocumentId(treeUri)+ else -> DocumentsContract.getTreeDocumentId(treeUri)+ }++ return FastDocumentFile(+ context = context,+ mime = "",+ uri = DocumentsContract.buildDocumentUriUsingTree(+ treeUri,+ documentId,+ ),+ name = "",+ size = 0,+ lastModified = 0,+ )+ }++ fun fromDocumentUri(context: Context, documentUri: Uri): FastDocumentFile? {+ var cursor: Cursor? = null+ try {+ cursor = context.contentResolver.query(+ documentUri,+ arrayOf(+ DocumentsContract.Document.COLUMN_MIME_TYPE,+ DocumentsContract.Document.COLUMN_DISPLAY_NAME,+ DocumentsContract.Document.COLUMN_SIZE,+ DocumentsContract.Document.COLUMN_LAST_MODIFIED,+ ),+ null,+ null,+ null+ )++ return if (cursor != null && cursor.moveToFirst()) {+ FastDocumentFile(+ context = context,+ mime = cursor.getString(0),+ uri = documentUri,+ name = cursor.getString(1),+ size = cursor.getLong(2),+ lastModified = cursor.getLong(3),+ )+ } else {+ null+ }+ } catch (e: Exception) {+ Log.w(TAG, "Error: $e")+ return null+ } finally {+ try {+ cursor?.close()+ } catch (_: Exception) {}+ }+ }+ }+}diff --git a/app/android/app/src/main/kotlin/org/localsend/localsend_app/MainActivity.kt b/app/android/app/src/main/kotlin/org/localsend/localsend_app/MainActivity.ktindex 12363448..09a0131e 100644--- a/app/android/app/src/main/kotlin/org/localsend/localsend_app/MainActivity.kt+++ b/app/android/app/src/main/kotlin/org/localsend/localsend_app/MainActivity.kt@@ -1,5 +1,173 @@package org.localsend.localsend_app+import android.annotation.SuppressLint+import android.app.Activity+import android.content.Intent+import android.net.Uriimport io.flutter.embedding.android.FlutterActivity+import io.flutter.embedding.engine.FlutterEngine+import io.flutter.plugin.common.MethodChannel-class MainActivity : FlutterActivity()+private const val CHANNEL = "org.localsend.localsend_app/localsend"+private const val REQUEST_CODE_PICK_DIRECTORY = 1+private const val REQUEST_CODE_PICK_FILE = 2++class MainActivity : FlutterActivity() {+ private var pendingResult: MethodChannel.Result? = null++ override fun configureFlutterEngine(flutterEngine: FlutterEngine) {+ super.configureFlutterEngine(flutterEngine)+ MethodChannel(+ flutterEngine.dartExecutor.binaryMessenger,+ CHANNEL+ ).setMethodCallHandler { call, result ->+ when (call.method) {+ "pickDirectory" -> {+ pendingResult = result+ openDirectoryPicker()+ }+ "pickFiles" -> {+ pendingResult = result+ openFilePicker()+ }+ else -> result.notImplemented()+ }+ }+ }++ private fun openDirectoryPicker() {+ val intent = Intent(Intent.ACTION_OPEN_DOCUMENT_TREE)+ intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION or Intent.FLAG_GRANT_PERSISTABLE_URI_PERMISSION)+ startActivityForResult(intent, REQUEST_CODE_PICK_DIRECTORY)+ }++ private fun openFilePicker() {+ val intent = Intent(Intent.ACTION_OPEN_DOCUMENT).apply {+ addCategory(Intent.CATEGORY_OPENABLE)+ putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true)+ type = "*/*"+ addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION or Intent.FLAG_GRANT_PERSISTABLE_URI_PERMISSION)+ }+ startActivityForResult(intent, REQUEST_CODE_PICK_FILE)+ }++ @SuppressLint("WrongConstant")+ @Override+ override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent) {+ super.onActivityResult(requestCode, resultCode, data)+ if (resultCode != Activity.RESULT_OK) {+ pendingResult?.error("Error", "Failed to access directory", null)+ pendingResult = null+ return+ }++ when (requestCode) {+ REQUEST_CODE_PICK_DIRECTORY -> {+ val uri: Uri? = data.data+ val takeFlags: Int =+ data.flags and (Intent.FLAG_GRANT_READ_URI_PERMISSION or Intent.FLAG_GRANT_WRITE_URI_PERMISSION)+ if (uri != null) {+ contentResolver.takePersistableUriPermission(uri, takeFlags)++ val files = mutableListOf<FileInfo>()+ listFiles(uri, files)+ val resultData = PickDirectoryResult(uri.toString(), files)+ pendingResult?.success(resultData.toMap())+ pendingResult = null+ } else {+ pendingResult?.error("Error", "Failed to access directory", null)+ pendingResult = null+ }+ }+ REQUEST_CODE_PICK_FILE -> {+ val uriList: List<Uri> = when {+ data.clipData != null -> {+ val clipData = data.clipData+ val uris = mutableListOf<Uri>()+ for (i in 0 until clipData!!.itemCount) {+ uris.add(clipData.getItemAt(i).uri)+ }+ uris+ }+ data.data != null -> listOf(data.data!!)+ else -> {+ pendingResult?.error("Error", "Failed to access file", null)+ return+ }+ }++ val takeFlags: Int =+ data.flags and (Intent.FLAG_GRANT_READ_URI_PERMISSION or Intent.FLAG_GRANT_WRITE_URI_PERMISSION)++ val resultList = mutableListOf<FileInfo>()+ for (uri in uriList) {+ contentResolver.takePersistableUriPermission(uri, takeFlags)+ val documentFile = FastDocumentFile.fromDocumentUri(this, uri)+ if (documentFile == null) {+ pendingResult?.error("Error", "Failed to access file", null)+ return+ }+ resultList.add(+ FileInfo(+ name = documentFile.name,+ size = documentFile.size,+ uri = uri.toString(),+ lastModified = documentFile.lastModified,+ )+ )+ }++ pendingResult?.success(resultList.map { it.toMap() })+ pendingResult = null+ }+ }+ }++ private fun listFiles(uri: Uri, files: MutableList<FileInfo>) {+ val pickedDir: FastDocumentFile = FastDocumentFile.fromTreeUri(this, uri)++ for (file in pickedDir.listFiles()) {+ if (file.isDirectory) {+ // Recursive call+ listFiles(file.uri, files)+ } else if (file.isFile) {+ files.add(+ FileInfo(+ name = file.name,+ size = file.size,+ uri = file.uri.toString(),+ lastModified = file.lastModified,+ ),+ )+ }+ }+ }+}++data class PickDirectoryResult(+ val directoryUri: String,+ val files: List<FileInfo>,+) {+ fun toMap(): Map<String, Any> {+ return mapOf(+ "directoryUri" to directoryUri,+ "files" to files.map { it.toMap() }+ )+ }+}++data class FileInfo(+ val name: String,+ val size: Long,+ val uri: String,+ val lastModified: Long+) {+ fun toMap(): Map<String, Any> {+ return mapOf(+ "name" to name,+ "size" to size,+ "uri" to uri,+ "lastModified" to lastModified+ )+ }+}diff --git a/app/assets/CHANGELOG.md b/app/assets/CHANGELOG.mdindex 5160d125..1cf33729 100644--- a/app/assets/CHANGELOG.md+++ b/app/assets/CHANGELOG.md@@ -7,13 +7,15 @@- feat: add option to open parent folder of received files in history (@Tienisto)- feat: confirm before adding or removing favorites in the nearby devices list (@Tienisto)- feat: add URL view when sharing via link that shows the URL in bigger font (@harriseldon)+- feat: add discovery timeout setting for advanced users (@o2e)+- feat(android): do not require MANAGE_EXTERNAL_STORAGE, implement Android SAF (@Tienisto)+- feat(android): do not copy files to cache when select via file picker (@Tienisto)- feat(windows): add context menu integration ("Send to") (@Tienisto)- feat(windows): toggle "start hidden" in-app instead of referring to the system settings (@Tienisto)- feat(desktop): make auto start + start hidden more stable, now listens to `--hidden` parameter instead of `autostart` (@Tienisto)- feat(desktop): load initial files from command line arguments (@Tienisto)- feat(desktop): show progress in the taskbar (@NightFeather0615)- feat(macos): handle files that were dropped into the app icon (@Tienisto)-- feat: add discovery timeout setting for advanced users (@o2e)- fix: sanitize file names with invalid characters (@Caesarovich)- fix: UI overflow when window height is too small (@CHUNG-HAO)- fix(ios): make documents files visible to the Finder / AppleDevices app (@twinkles-twinstar)diff --git a/app/lib/provider/network/send_provider.dart b/app/lib/provider/network/send_provider.dartindex 071ff990..0e35f268 100644--- a/app/lib/provider/network/send_provider.dart+++ b/app/lib/provider/network/send_provider.dart@@ -23,6 +23,7 @@ import 'package:localsend_app/widget/dialogs/pin_dialog.dart';import 'package:logging/logging.dart';import 'package:refena_flutter/refena_flutter.dart';import 'package:routerino/routerino.dart';+import 'package:uri_content/uri_content.dart';import 'package:uuid/uuid.dart';const _uuid = Uuid();@@ -303,6 +304,7 @@ class SendNotifier extends Notifier<Map<String, SendSessionState>> {state: (s) => s?.copyWith(startTime: DateTime.now().millisecondsSinceEpoch),);+ final uriContent = UriContent();for (final file in files.values) {final token = file.token;if (token == null) {@@ -339,7 +341,11 @@ class SendNotifier extends Notifier<Map<String, SendSessionState>> {'Content-Type': file.file.lookupMime(),},),- data: file.path != null ? File(file.path!).openRead().asBroadcastStream() : file.bytes!,+ data: file.path != null+ ? file.path!.startsWith('content://')+ ? uriContent.getContentStream(Uri.parse(file.path!))+ : File(file.path!).openRead().asBroadcastStream()+ : file.bytes!,onSendProgress: (curr, total) {if (stopwatch.elapsedMilliseconds >= 100) {stopwatch.reset();diff --git a/app/lib/provider/network/server/controller/receive_controller.dart b/app/lib/provider/network/server/controller/receive_controller.dartindex 3fc540c9..d0425cdf 100644--- a/app/lib/provider/network/server/controller/receive_controller.dart+++ b/app/lib/provider/network/server/controller/receive_controller.dart@@ -343,12 +343,12 @@ class ReceiveController {if (checkPlatform([TargetPlatform.android, TargetPlatform.iOS])) {if (checkPlatform([TargetPlatform.android]) && !server.getState().session!.destinationDirectory.startsWith('/storage/emulated/0/Download')) {- // Android requires manageExternalStorage permission to save files outside of the Download directory+ // Android requires more permission to save files outside of the Download directorytry {- final result = await Permission.manageExternalStorage.request();- _logger.info('manageExternalStorage permission: $result');+ final result = await Permission.storage.request();+ _logger.info('storage permission: $result');} catch (e) {- _logger.warning('Could not request manageExternalStorage permission', e);+ _logger.warning('Could not request storage permission', e);}}try {diff --git a/app/lib/provider/network/server/controller/send_controller.dart b/app/lib/provider/network/server/controller/send_controller.dartindex 6663c19c..4a2838e0 100644--- a/app/lib/provider/network/server/controller/send_controller.dart+++ b/app/lib/provider/network/server/controller/send_controller.dart@@ -16,6 +16,7 @@ import 'package:localsend_app/provider/settings_provider.dart';import 'package:localsend_app/util/api_route_builder.dart';import 'package:shelf/shelf.dart';import 'package:shelf_router/shelf_router.dart';+import 'package:uri_content/uri_content.dart';import 'package:uuid/uuid.dart';const _uuid = Uuid();@@ -211,11 +212,20 @@ class SendController {headers: headers,);} else {- return Response(- 200,- body: File(file.path!).openRead().asBroadcastStream(),- headers: headers,- );+ final path = file.path!;+ if (path.startsWith('content://')) {+ return Response(+ 200,+ body: UriContent().getContentStream(Uri.parse(file.path!)),+ headers: headers,+ );+ } else {+ return Response(+ 200,+ body: File(file.path!).openRead().asBroadcastStream(),+ headers: headers,+ );+ }}});}diff --git a/app/lib/provider/selection/selected_sending_files_provider.dart b/app/lib/provider/selection/selected_sending_files_provider.dartindex c8375adf..8b4f4c95 100644--- a/app/lib/provider/selection/selected_sending_files_provider.dart+++ b/app/lib/provider/selection/selected_sending_files_provider.dart@@ -6,7 +6,9 @@ import 'package:common/common.dart';import 'package:localsend_app/model/cross_file.dart';import 'package:localsend_app/util/file_path_helper.dart';import 'package:localsend_app/util/native/cache_helper.dart';+import 'package:localsend_app/util/native/content_uri_helper.dart';import 'package:localsend_app/util/native/cross_file_converters.dart';+import 'package:localsend_app/util/native/pick_directory.dart';import 'package:logging/logging.dart';import 'package:path/path.dart' as p;import 'package:refena_flutter/refena_flutter.dart';@@ -174,6 +176,64 @@ class AddDirectoryAction extends AsyncReduxAction<SelectedSendingFilesNotifier,}}+/// A special [AddDirectoryAction] specifically for Android.+class AddAndroidDirectoryAction extends AsyncReduxAction<SelectedSendingFilesNotifier, List<CrossFile>> {+ final PickDirectoryResult result;++ AddAndroidDirectoryAction(this.result);++ @override+ Future<List<CrossFile>> reduce() async {+ final newFiles = <CrossFile>[];+ _logger.info('Reading files in ${result.directoryUri}');++ final basePath = ContentUriHelper.getFolderPathFromContentUri(result.directoryUri);+ if (basePath == null) {+ _logger.warning('Could not get base path from ${result.directoryUri}');+ return state;+ }+ final folderName = ContentUriHelper.getEntityNameFromPath(basePath);+ if (folderName == null) {+ _logger.warning('Could not get folder name from $basePath');+ return state;+ }++ for (final file in result.files) {+ final relative = ContentUriHelper.guessRelativePathFromPickedFileContentUri(+ folderContentUri: result.directoryUri,+ basePath: basePath,+ folderName: folderName,+ uri: file.uri,+ );+ if (relative == null) {+ _logger.warning('Could not get relative path from ${file.uri}');+ continue;+ }+ _logger.info('Add file $relative (${file.uri})');++ final crossFile = CrossFile(+ name: relative,+ fileType: file.name.guessFileType(),+ size: file.size,+ thumbnail: null,+ asset: null,+ path: file.uri,+ bytes: null,+ );++ final isAlreadySelect = state.any((element) => element.isSameFile(otherFile: crossFile));+ if (!isAlreadySelect) {+ newFiles.add(crossFile);+ }+ }++ return List.unmodifiable([+ ...state,+ ...newFiles,+ ]);+ }+}+/// Removes a file at the given [index].class RemoveSelectedFileAction extends ReduxAction<SelectedSendingFilesNotifier, List<CrossFile>> with GlobalActions {final int index;diff --git a/app/lib/util/native/content_uri_helper.dart b/app/lib/util/native/content_uri_helper.dartnew file mode 100644index 00000000..73cdda2f--- /dev/null+++ b/app/lib/util/native/content_uri_helper.dart@@ -0,0 +1,48 @@+class ContentUriHelper {+ /// Converts+ /// content://com.android.externalstorage.documents/tree/primary%3ADocuments+ /// to primary:Documents+ static String? getFolderPathFromContentUri(String uri) {+ final index = uri.indexOf('/tree/');+ if (index == -1) {+ return null;+ }++ return Uri.decodeComponent(uri.substring(index + 6));+ }++ /// Converts+ /// primary:Documents to Documents+ /// "primary:Documents/Some Folder" to "Some Folder"+ static String? getEntityNameFromPath(String path) {+ final parts = path.replaceAll(':', '/').split('/');+ for (int i = parts.length - 1; i >= 0; i--) {+ if (parts[i].isNotEmpty) {+ return parts[i];+ }+ }++ return null;+ }++ /// Converts+ /// content://com.android.externalstorage.documents/tree/primary%3ADocuments%2FOffice%20Lens/document/primary%3ADocuments%2FOffice%20Lens%2FTest.pdf+ /// to+ /// Office Lens/Test.pdf+ static String? guessRelativePathFromPickedFileContentUri({+ required String folderContentUri,+ required String basePath,+ required String folderName,+ required String uri,+ }) {+ final withoutFolder = uri.replaceFirst(folderContentUri, '');+ String fileUri = withoutFolder;+ if (withoutFolder.startsWith('/document/')) {+ fileUri = withoutFolder.substring(10);+ }++ final decoded = Uri.decodeComponent(fileUri);+ final withoutBasePath = decoded.replaceFirst(basePath, '');+ return '$folderName$withoutBasePath';+ }+}diff --git a/app/lib/util/native/cross_file_converters.dart b/app/lib/util/native/cross_file_converters.dartindex 0cc50fe9..d831ff59 100644--- a/app/lib/util/native/cross_file_converters.dart+++ b/app/lib/util/native/cross_file_converters.dart@@ -7,6 +7,7 @@ import 'package:flutter/foundation.dart';import 'package:image_picker/image_picker.dart';import 'package:localsend_app/model/cross_file.dart';import 'package:localsend_app/util/file_path_helper.dart';+import 'package:localsend_app/util/native/pick_directory.dart';import 'package:share_handler/share_handler.dart';import 'package:wechat_assets_picker/wechat_assets_picker.dart';@@ -61,6 +62,18 @@ class CrossFileConverters {);}+ static Future<CrossFile> convertFileInfo(FileInfo file) async {+ return CrossFile(+ name: file.name,+ fileType: file.name.guessFileType(),+ size: file.size,+ thumbnail: null,+ asset: null,+ path: file.uri,+ bytes: null,+ );+ }+static Future<CrossFile> convertSharedAttachment(SharedAttachment attachment) async {final file = File(attachment.path);final fileName = attachment.path.fileName;diff --git a/app/lib/util/native/file_picker.dart b/app/lib/util/native/file_picker.dartindex 13e53730..a1cb75d1 100644--- a/app/lib/util/native/file_picker.dart+++ b/app/lib/util/native/file_picker.dart@@ -1,9 +1,9 @@import 'dart:async';import 'package:common/common.dart';-import 'package:file_picker/file_picker.dart' as file_picker;import 'package:file_selector/file_selector.dart' as file_selector;import 'package:file_selector/file_selector.dart';+import 'package:flutter/foundation.dart';import 'package:flutter/material.dart';import 'package:flutter/services.dart';import 'package:localsend_app/gen/strings.g.dart';@@ -12,6 +12,7 @@ import 'package:localsend_app/provider/selection/selected_sending_files_providerimport 'package:localsend_app/theme.dart';import 'package:localsend_app/util/determine_image_type.dart';import 'package:localsend_app/util/native/cross_file_converters.dart';+import 'package:localsend_app/util/native/pick_directory.dart';import 'package:localsend_app/util/native/pick_directory_path.dart';import 'package:localsend_app/util/native/platform_check.dart';import 'package:localsend_app/util/sleep.dart';@@ -145,23 +146,20 @@ Future<void> _pickFiles(BuildContext context, Ref ref) async {);}try {- if (checkPlatform([TargetPlatform.android])) {- // We also need to use the file_picker package because file_selector does not expose the raw path.- final result = await file_picker.FilePicker.platform.pickFiles(allowMultiple: true);+ if (defaultTargetPlatform == TargetPlatform.android) {+ final result = await pickFilesAndroid();if (result != null) {await ref.redux(selectedSendingFilesProvider).dispatchAsync(AddFilesAction(- files: result.files,- converter: CrossFileConverters.convertPlatformFile,+ files: result,+ converter: CrossFileConverters.convertFileInfo,));}} else {final result = await file_selector.openFiles();- if (result.isNotEmpty) {- await ref.redux(selectedSendingFilesProvider).dispatchAsync(AddFilesAction(- files: result,- converter: CrossFileConverters.convertXFile,- ));- }+ await ref.redux(selectedSendingFilesProvider).dispatchAsync(AddFilesAction(+ files: result,+ converter: CrossFileConverters.convertXFile,+ ));}} catch (e) {// ignore: use_build_context_synchronously@@ -176,9 +174,9 @@ Future<void> _pickFiles(BuildContext context, Ref ref) async {Future<void> _pickFolder(BuildContext context, Ref ref) async {if (checkPlatform([TargetPlatform.android])) {try {- await Permission.manageExternalStorage.request();+ await Permission.storage.request();} catch (e) {- _logger.warning('Failed to request manageExternalStorage permission', e);+ _logger.warning('Failed to request storage permission', e);}}@@ -194,9 +192,16 @@ Future<void> _pickFolder(BuildContext context, Ref ref) async {);await sleepAsync(200); // Wait for the dialog to be showntry {- final directoryPath = await pickDirectoryPath();- if (directoryPath != null) {- await ref.redux(selectedSendingFilesProvider).dispatchAsync(AddDirectoryAction(directoryPath));+ if (defaultTargetPlatform == TargetPlatform.android) {+ final result = await pickDirectoryAndroid();+ if (result != null) {+ await ref.redux(selectedSendingFilesProvider).dispatchAsync(AddAndroidDirectoryAction(result));+ }+ } else {+ final directoryPath = await pickDirectoryPath();+ if (directoryPath != null) {+ await ref.redux(selectedSendingFilesProvider).dispatchAsync(AddDirectoryAction(directoryPath));+ }}} catch (e) {_logger.warning('Failed to pick directory', e);diff --git a/app/lib/util/native/pick_directory.dart b/app/lib/util/native/pick_directory.dartnew file mode 100644index 00000000..ed00f5d1--- /dev/null+++ b/app/lib/util/native/pick_directory.dart@@ -0,0 +1,53 @@+import 'package:dart_mappable/dart_mappable.dart';+import 'package:flutter/services.dart';++part 'pick_directory.mapper.dart';++const _methodChannel = MethodChannel('org.localsend.localsend_app/localsend');++Future<PickDirectoryResult?> pickDirectoryAndroid() async {+ final result = await _methodChannel.invokeMethod<Map>('pickDirectory');+ if (result == null) {+ return null;+ }++ return PickDirectoryResultMapper.fromJson({+ 'directoryUri': result['directoryUri'],+ 'files': (result['files'] as List).map((e) => FileInfoMapper.fromJson((e as Map).cast<String, dynamic>())).toList(),+ });+}++Future<List<FileInfo>?> pickFilesAndroid() async {+ final result = await _methodChannel.invokeMethod<List>('pickFiles');+ if (result == null) {+ return null;+ }++ return result.map((e) => FileInfoMapper.fromJson((e as Map).cast<String, dynamic>())).toList();+}++@MappableClass()+class PickDirectoryResult with PickDirectoryResultMappable {+ final String directoryUri;+ final List<FileInfo> files;++ PickDirectoryResult({+ required this.directoryUri,+ required this.files,+ });+}++@MappableClass()+class FileInfo with FileInfoMappable {+ final String name;+ final int size;+ final String uri;+ final int lastModified;++ FileInfo({+ required this.name,+ required this.size,+ required this.uri,+ required this.lastModified,+ });+}diff --git a/app/lib/util/native/pick_directory.mapper.dart b/app/lib/util/native/pick_directory.mapper.dartnew file mode 100644index 00000000..342f2a27--- /dev/null+++ b/app/lib/util/native/pick_directory.mapper.dart@@ -0,0 +1,213 @@+// coverage:ignore-file+// GENERATED CODE - DO NOT MODIFY BY HAND+// ignore_for_file: type=lint+// ignore_for_file: unused_element, unnecessary_cast, override_on_non_overriding_member+// ignore_for_file: strict_raw_type, inference_failure_on_untyped_parameter++part of 'pick_directory.dart';++class PickDirectoryResultMapper extends ClassMapperBase<PickDirectoryResult> {+ PickDirectoryResultMapper._();++ static PickDirectoryResultMapper? _instance;+ static PickDirectoryResultMapper ensureInitialized() {+ if (_instance == null) {+ MapperContainer.globals.use(_instance = PickDirectoryResultMapper._());+ FileInfoMapper.ensureInitialized();+ }+ return _instance!;+ }++ @override+ final String id = 'PickDirectoryResult';++ static String _$directoryUri(PickDirectoryResult v) => v.directoryUri;+ static const Field<PickDirectoryResult, String> _f$directoryUri = Field('directoryUri', _$directoryUri);+ static List<FileInfo> _$files(PickDirectoryResult v) => v.files;+ static const Field<PickDirectoryResult, List<FileInfo>> _f$files = Field('files', _$files);++ @override+ final MappableFields<PickDirectoryResult> fields = const {+ #directoryUri: _f$directoryUri,+ #files: _f$files,+ };++ static PickDirectoryResult _instantiate(DecodingData data) {+ return PickDirectoryResult(directoryUri: data.dec(_f$directoryUri), files: data.dec(_f$files));+ }++ @override+ final Function instantiate = _instantiate;++ static PickDirectoryResult fromJson(Map<String, dynamic> map) {+ return ensureInitialized().decodeMap<PickDirectoryResult>(map);+ }++ static PickDirectoryResult deserialize(String json) {+ return ensureInitialized().decodeJson<PickDirectoryResult>(json);+ }+}++mixin PickDirectoryResultMappable {+ String serialize() {+ return PickDirectoryResultMapper.ensureInitialized().encodeJson<PickDirectoryResult>(this as PickDirectoryResult);+ }++ Map<String, dynamic> toJson() {+ return PickDirectoryResultMapper.ensureInitialized().encodeMap<PickDirectoryResult>(this as PickDirectoryResult);+ }++ PickDirectoryResultCopyWith<PickDirectoryResult, PickDirectoryResult, PickDirectoryResult> get copyWith =>+ _PickDirectoryResultCopyWithImpl(this as PickDirectoryResult, $identity, $identity);+ @override+ String toString() {+ return PickDirectoryResultMapper.ensureInitialized().stringifyValue(this as PickDirectoryResult);+ }++ @override+ bool operator ==(Object other) {+ return PickDirectoryResultMapper.ensureInitialized().equalsValue(this as PickDirectoryResult, other);+ }++ @override+ int get hashCode {+ return PickDirectoryResultMapper.ensureInitialized().hashValue(this as PickDirectoryResult);+ }+}++extension PickDirectoryResultValueCopy<$R, $Out> on ObjectCopyWith<$R, PickDirectoryResult, $Out> {+ PickDirectoryResultCopyWith<$R, PickDirectoryResult, $Out> get $asPickDirectoryResult =>+ $base.as((v, t, t2) => _PickDirectoryResultCopyWithImpl(v, t, t2));+}++abstract class PickDirectoryResultCopyWith<$R, $In extends PickDirectoryResult, $Out> implements ClassCopyWith<$R, $In, $Out> {+ ListCopyWith<$R, FileInfo, FileInfoCopyWith<$R, FileInfo, FileInfo>> get files;+ $R call({String? directoryUri, List<FileInfo>? files});+ PickDirectoryResultCopyWith<$R2, $In, $Out2> $chain<$R2, $Out2>(Then<$Out2, $R2> t);+}++class _PickDirectoryResultCopyWithImpl<$R, $Out> extends ClassCopyWithBase<$R, PickDirectoryResult, $Out>+ implements PickDirectoryResultCopyWith<$R, PickDirectoryResult, $Out> {+ _PickDirectoryResultCopyWithImpl(super.value, super.then, super.then2);++ @override+ late final ClassMapperBase<PickDirectoryResult> $mapper = PickDirectoryResultMapper.ensureInitialized();+ @override+ ListCopyWith<$R, FileInfo, FileInfoCopyWith<$R, FileInfo, FileInfo>> get files =>+ ListCopyWith($value.files, (v, t) => v.copyWith.$chain(t), (v) => call(files: v));+ @override+ $R call({String? directoryUri, List<FileInfo>? files}) =>+ $apply(FieldCopyWithData({if (directoryUri != null) #directoryUri: directoryUri, if (files != null) #files: files}));+ @override+ PickDirectoryResult $make(CopyWithData data) =>+ PickDirectoryResult(directoryUri: data.get(#directoryUri, or: $value.directoryUri), files: data.get(#files, or: $value.files));++ @override+ PickDirectoryResultCopyWith<$R2, PickDirectoryResult, $Out2> $chain<$R2, $Out2>(Then<$Out2, $R2> t) =>+ _PickDirectoryResultCopyWithImpl($value, $cast, t);+}++class FileInfoMapper extends ClassMapperBase<FileInfo> {+ FileInfoMapper._();++ static FileInfoMapper? _instance;+ static FileInfoMapper ensureInitialized() {+ if (_instance == null) {+ MapperContainer.globals.use(_instance = FileInfoMapper._());+ }+ return _instance!;+ }++ @override+ final String id = 'FileInfo';++ static String _$name(FileInfo v) => v.name;+ static const Field<FileInfo, String> _f$name = Field('name', _$name);+ static int _$size(FileInfo v) => v.size;+ static const Field<FileInfo, int> _f$size = Field('size', _$size);+ static String _$uri(FileInfo v) => v.uri;+ static const Field<FileInfo, String> _f$uri = Field('uri', _$uri);+ static int _$lastModified(FileInfo v) => v.lastModified;+ static const Field<FileInfo, int> _f$lastModified = Field('lastModified', _$lastModified);++ @override+ final MappableFields<FileInfo> fields = const {+ #name: _f$name,+ #size: _f$size,+ #uri: _f$uri,+ #lastModified: _f$lastModified,+ };++ static FileInfo _instantiate(DecodingData data) {+ return FileInfo(name: data.dec(_f$name), size: data.dec(_f$size), uri: data.dec(_f$uri), lastModified: data.dec(_f$lastModified));+ }++ @override+ final Function instantiate = _instantiate;++ static FileInfo fromJson(Map<String, dynamic> map) {+ return ensureInitialized().decodeMap<FileInfo>(map);+ }++ static FileInfo deserialize(String json) {+ return ensureInitialized().decodeJson<FileInfo>(json);+ }+}++mixin FileInfoMappable {+ String serialize() {+ return FileInfoMapper.ensureInitialized().encodeJson<FileInfo>(this as FileInfo);+ }++ Map<String, dynamic> toJson() {+ return FileInfoMapper.ensureInitialized().encodeMap<FileInfo>(this as FileInfo);+ }++ FileInfoCopyWith<FileInfo, FileInfo, FileInfo> get copyWith => _FileInfoCopyWithImpl(this as FileInfo, $identity, $identity);+ @override+ String toString() {+ return FileInfoMapper.ensureInitialized().stringifyValue(this as FileInfo);+ }++ @override+ bool operator ==(Object other) {+ return FileInfoMapper.ensureInitialized().equalsValue(this as FileInfo, other);+ }++ @override+ int get hashCode {+ return FileInfoMapper.ensureInitialized().hashValue(this as FileInfo);+ }+}++extension FileInfoValueCopy<$R, $Out> on ObjectCopyWith<$R, FileInfo, $Out> {+ FileInfoCopyWith<$R, FileInfo, $Out> get $asFileInfo => $base.as((v, t, t2) => _FileInfoCopyWithImpl(v, t, t2));+}++abstract class FileInfoCopyWith<$R, $In extends FileInfo, $Out> implements ClassCopyWith<$R, $In, $Out> {+ $R call({String? name, int? size, String? uri, int? lastModified});+ FileInfoCopyWith<$R2, $In, $Out2> $chain<$R2, $Out2>(Then<$Out2, $R2> t);+}++class _FileInfoCopyWithImpl<$R, $Out> extends ClassCopyWithBase<$R, FileInfo, $Out> implements FileInfoCopyWith<$R, FileInfo, $Out> {+ _FileInfoCopyWithImpl(super.value, super.then, super.then2);++ @override+ late final ClassMapperBase<FileInfo> $mapper = FileInfoMapper.ensureInitialized();+ @override+ $R call({String? name, int? size, String? uri, int? lastModified}) => $apply(FieldCopyWithData({+ if (name != null) #name: name,+ if (size != null) #size: size,+ if (uri != null) #uri: uri,+ if (lastModified != null) #lastModified: lastModified+ }));+ @override+ FileInfo $make(CopyWithData data) => FileInfo(+ name: data.get(#name, or: $value.name),+ size: data.get(#size, or: $value.size),+ uri: data.get(#uri, or: $value.uri),+ lastModified: data.get(#lastModified, or: $value.lastModified));++ @override+ FileInfoCopyWith<$R2, FileInfo, $Out2> $chain<$R2, $Out2>(Then<$Out2, $R2> t) => _FileInfoCopyWithImpl($value, $cast, t);+}diff --git a/app/lib/util/native/pick_directory_path.dart b/app/lib/util/native/pick_directory_path.dartindex 57df8d07..d0f78171 100644--- a/app/lib/util/native/pick_directory_path.dart+++ b/app/lib/util/native/pick_directory_path.dart@@ -1,8 +1,10 @@import 'package:file_picker/file_picker.dart';import 'package:file_selector/file_selector.dart' as file_selector;-import 'package:flutter/material.dart';+import 'package:flutter/services.dart';import 'package:localsend_app/util/native/platform_check.dart';+const _methodChannel = MethodChannel('org.localsend.localsend_app/localsend');+/// Opens a file picker to select a directory./// Returns null if the user cancels the selection.Future<String?> pickDirectoryPath() async {@@ -16,3 +18,7 @@ Future<String?> pickDirectoryPath() async {return await file_selector.getDirectoryPath();}}++Future<void> pickDirectoryNew() async {+ await _methodChannel.invokeMethod<void>('pickDirectory');+}diff --git a/app/lib/widget/file_thumbnail.dart b/app/lib/widget/file_thumbnail.dartindex 8ebe65a1..f893c2a6 100644--- a/app/lib/widget/file_thumbnail.dart+++ b/app/lib/widget/file_thumbnail.dart@@ -5,6 +5,7 @@ import 'package:common/common.dart';import 'package:flutter/material.dart';import 'package:localsend_app/model/cross_file.dart';import 'package:localsend_app/util/file_type_ext.dart';+import 'package:uri_content/uri_content.dart';import 'package:wechat_assets_picker/wechat_assets_picker.dart';const double defaultThumbnailSize = 50;@@ -75,7 +76,7 @@ class AssetThumbnail extends StatelessWidget {}}-class FilePathThumbnail extends StatelessWidget {+class FilePathThumbnail extends StatefulWidget {final String? path;final FileType fileType;@@ -84,25 +85,64 @@ class FilePathThumbnail extends StatelessWidget {required this.fileType,});+ @override+ State<FilePathThumbnail> createState() => _FilePathThumbnailState();+}++class _FilePathThumbnailState extends State<FilePathThumbnail> {+ Future<Uint8List>? _future;++ @override+ void initState() {+ super.initState();++ if (widget.fileType == FileType.image && widget.path != null && widget.path!.startsWith('content://')) {+ // ignore: discarded_futures+ _future = UriContent().from(Uri.parse(widget.path!));+ }+ }+@overrideWidget build(BuildContext context) {final Widget? thumbnail;- if (path != null && fileType == FileType.image) {- thumbnail = Image.file(- File(path!),- cacheWidth: 64, // reduce memory with low cached size; do not set cacheHeight because the image must keep its ratio- errorBuilder: (_, __, ___) => Padding(- padding: const EdgeInsets.all(10),- child: Icon(fileType.icon, size: 32),- ),- );+ if (widget.path != null && widget.fileType == FileType.image) {+ if (widget.path!.startsWith('content://')) {+ thumbnail = FutureBuilder(+ future: _future,+ builder: (context, snapshot) {+ if (!snapshot.hasData) {+ return Padding(+ padding: const EdgeInsets.all(10),+ child: Icon(widget.fileType.icon, size: 32),+ );+ }++ return Image.memory(+ snapshot.data!,+ cacheWidth: 64, // reduce memory with low cached size; do not set cacheHeight because the image must keep its ratio+ errorBuilder: (_, __, ___) => Padding(+ padding: const EdgeInsets.all(10),+ child: Icon(widget.fileType.icon, size: 32),+ ),+ );+ });+ } else {+ thumbnail = Image.file(+ File(widget.path!),+ cacheWidth: 64, // reduce memory with low cached size; do not set cacheHeight because the image must keep its ratio+ errorBuilder: (_, __, ___) => Padding(+ padding: const EdgeInsets.all(10),+ child: Icon(widget.fileType.icon, size: 32),+ ),+ );+ }} else {thumbnail = null;}return _Thumbnail(thumbnail: thumbnail,- icon: fileType.icon,+ icon: widget.fileType.icon,);}}diff --git a/app/linux/flutter/generated_plugin_registrant.cc b/app/linux/flutter/generated_plugin_registrant.ccindex a3c82ca8..56325a62 100644--- a/app/linux/flutter/generated_plugin_registrant.cc+++ b/app/linux/flutter/generated_plugin_registrant.cc@@ -13,6 +13,7 @@#include <pasteboard/pasteboard_plugin.h>#include <screen_retriever/screen_retriever_plugin.h>#include <tray_manager/tray_manager_plugin.h>+#include <uri_content/uri_content_plugin.h>#include <url_launcher_linux/url_launcher_plugin.h>#include <window_manager/window_manager_plugin.h>@@ -38,6 +39,9 @@ void fl_register_plugins(FlPluginRegistry* registry) {g_autoptr(FlPluginRegistrar) tray_manager_registrar =fl_plugin_registry_get_registrar_for_plugin(registry, "TrayManagerPlugin");tray_manager_plugin_register_with_registrar(tray_manager_registrar);+ g_autoptr(FlPluginRegistrar) uri_content_registrar =+ fl_plugin_registry_get_registrar_for_plugin(registry, "UriContentPlugin");+ uri_content_plugin_register_with_registrar(uri_content_registrar);g_autoptr(FlPluginRegistrar) url_launcher_linux_registrar =fl_plugin_registry_get_registrar_for_plugin(registry, "UrlLauncherPlugin");url_launcher_plugin_register_with_registrar(url_launcher_linux_registrar);diff --git a/app/linux/flutter/generated_plugins.cmake b/app/linux/flutter/generated_plugins.cmakeindex 40adb2d3..18dd3893 100644--- a/app/linux/flutter/generated_plugins.cmake+++ b/app/linux/flutter/generated_plugins.cmake@@ -10,6 +10,7 @@ list(APPEND FLUTTER_PLUGIN_LISTpasteboardscreen_retrievertray_manager+ uri_contenturl_launcher_linuxwindow_manager)diff --git a/app/macos/Flutter/GeneratedPluginRegistrant.swift b/app/macos/Flutter/GeneratedPluginRegistrant.swiftindex f0a2803c..1ca43798 100644--- a/app/macos/Flutter/GeneratedPluginRegistrant.swift+++ b/app/macos/Flutter/GeneratedPluginRegistrant.swift@@ -20,6 +20,7 @@ import photo_managerimport screen_retrieverimport shared_preferences_foundationimport tray_manager+import uri_contentimport url_launcher_macosimport video_player_avfoundationimport wakelock_plus@@ -41,6 +42,7 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {ScreenRetrieverPlugin.register(with: registry.registrar(forPlugin: "ScreenRetrieverPlugin"))SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin"))TrayManagerPlugin.register(with: registry.registrar(forPlugin: "TrayManagerPlugin"))+ UriContentPlugin.register(with: registry.registrar(forPlugin: "UriContentPlugin"))UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin"))FVPVideoPlayerPlugin.register(with: registry.registrar(forPlugin: "FVPVideoPlayerPlugin"))WakelockPlusMacosPlugin.register(with: registry.registrar(forPlugin: "WakelockPlusMacosPlugin"))diff --git a/app/pubspec.lock b/app/pubspec.lockindex c046b105..17a96707 100644--- a/app/pubspec.lock+++ b/app/pubspec.lock@@ -1506,6 +1506,14 @@ packages:url: "https://pub.dev"source: hostedversion: "1.3.2"+ uri_content:+ dependency: "direct main"+ description:+ name: uri_content+ sha256: ad08e63cd995e2daeace00359399f368e3d5dfe381c1a37daa3f9901108b518e+ url: "https://pub.dev"+ source: hosted+ version: "2.2.0"url_launcher:dependency: "direct main"description:diff --git a/app/pubspec.yaml b/app/pubspec.yamlindex 55277407..0acce81b 100644--- a/app/pubspec.yaml+++ b/app/pubspec.yaml@@ -64,6 +64,7 @@ dependencies:slang_flutter: 3.31.0system_settings: 2.1.0tray_manager: 0.2.3+ uri_content: 2.2.0url_launcher: 6.2.4uuid: 3.0.7wakelock_plus: 1.1.4diff --git a/app/test/unit/util/native/content_uri_helper_test.dart b/app/test/unit/util/native/content_uri_helper_test.dartnew file mode 100644index 00000000..7690e573--- /dev/null+++ b/app/test/unit/util/native/content_uri_helper_test.dart@@ -0,0 +1,89 @@+import 'package:localsend_app/util/native/content_uri_helper.dart';+import 'package:test/test.dart';++void main() {+ group('getFolderPathFromContentUri', () {+ test('should return the root folder path from the content uri', () {+ expect(+ ContentUriHelper.getFolderPathFromContentUri('content://com.android.externalstorage.documents/tree/primary%3ADocuments'),+ 'primary:Documents',+ );+ });++ test('should return the folder path from the content uri', () {+ expect(+ ContentUriHelper.getFolderPathFromContentUri('content://com.android.externalstorage.documents/tree/primary%3ADocuments%2FOffice%20Lens'),+ 'primary:Documents/Office Lens',+ );+ });++ test('should return folder path from content uri in SD card', () {+ expect(+ ContentUriHelper.getFolderPathFromContentUri('content://com.android.externalstorage.documents/tree/1234-5678:Documents'),+ '1234-5678:Documents',+ );+ });+ });++ group('getEntityNameFromPath', () {+ test('should return the entity name from the path', () {+ expect(+ ContentUriHelper.getEntityNameFromPath('primary:Documents'),+ 'Documents',+ );+ });++ test('should return the entity name from the path with a folder', () {+ expect(+ ContentUriHelper.getEntityNameFromPath('primary:Documents/Office Lens'),+ 'Office Lens',+ );+ });++ test('should return the entity name from the path with a folder in SD card', () {+ expect(+ ContentUriHelper.getEntityNameFromPath('1234-5678:Documents/Office Lens'),+ 'Office Lens',+ );+ });+ });++ group('guessRelativePathFromPickedFileContentUri', () {+ test('should return the relative path from the picked file content uri', () {+ expect(+ ContentUriHelper.guessRelativePathFromPickedFileContentUri(+ folderContentUri: 'content://com.android.externalstorage.documents/tree/primary%3ADocuments%2FOffice%20Lens',+ basePath: 'primary:Documents/Office Lens',+ folderName: 'Office Lens',+ uri:+ 'content://com.android.externalstorage.documents/tree/primary%3ADocuments%2FOffice%20Lens/document/primary%3ADocuments%2FOffice%20Lens%2FTest.pdf',+ ),+ 'Office Lens/Test.pdf',+ );+ });++ test('should return the relative path from the picked file content uri without the folder', () {+ expect(+ ContentUriHelper.guessRelativePathFromPickedFileContentUri(+ folderContentUri: 'content://com.android.externalstorage.documents/tree/primary%3ADocuments',+ basePath: 'primary:Documents',+ folderName: 'Documents',+ uri: 'content://com.android.externalstorage.documents/tree/primary%3ADocuments/document/primary%3ADocuments%2FTest.pdf',+ ),+ 'Documents/Test.pdf',+ );+ });++ test('should return the relative path from the picked file content uri in SD card', () {+ expect(+ ContentUriHelper.guessRelativePathFromPickedFileContentUri(+ folderContentUri: 'content://com.android.externalstorage.documents/tree/1234-5678:Documents',+ basePath: '1234-5678:Documents',+ folderName: 'Documents',+ uri: 'content://com.android.externalstorage.documents/tree/1234-5678:Documents/document/1234-5678:Documents%2FTest.pdf',+ ),+ 'Documents/Test.pdf',+ );+ });+ });+}diff --git a/app/windows/flutter/generated_plugin_registrant.cc b/app/windows/flutter/generated_plugin_registrant.ccindex d9e22e49..2bdb6d5c 100644--- a/app/windows/flutter/generated_plugin_registrant.cc+++ b/app/windows/flutter/generated_plugin_registrant.cc@@ -15,6 +15,7 @@#include <permission_handler_windows/permission_handler_windows_plugin.h>#include <screen_retriever/screen_retriever_plugin.h>#include <tray_manager/tray_manager_plugin.h>+#include <uri_content/uri_content_plugin_c_api.h>#include <url_launcher_windows/url_launcher_windows.h>#include <window_manager/window_manager_plugin.h>#include <windows_taskbar/windows_taskbar_plugin.h>@@ -38,6 +39,8 @@ void RegisterPlugins(flutter::PluginRegistry* registry) {registry->GetRegistrarForPlugin("ScreenRetrieverPlugin"));TrayManagerPluginRegisterWithRegistrar(registry->GetRegistrarForPlugin("TrayManagerPlugin"));+ UriContentPluginCApiRegisterWithRegistrar(+ registry->GetRegistrarForPlugin("UriContentPluginCApi"));UrlLauncherWindowsRegisterWithRegistrar(registry->GetRegistrarForPlugin("UrlLauncherWindows"));WindowManagerPluginRegisterWithRegistrar(diff --git a/app/windows/flutter/generated_plugins.cmake b/app/windows/flutter/generated_plugins.cmakeindex 6b46f5ce..58c6b393 100644--- a/app/windows/flutter/generated_plugins.cmake+++ b/app/windows/flutter/generated_plugins.cmake@@ -12,6 +12,7 @@ list(APPEND FLUTTER_PLUGIN_LISTpermission_handler_windowsscreen_retrievertray_manager+ uri_contenturl_launcher_windowswindow_managerwindows_taskbar