From 156217c3aeed3f3358d732fa67ab403ef3c9cab5 Mon Sep 17 00:00:00 2001 From: Krille Date: Sat, 18 Mar 2023 17:02:12 +0100 Subject: [PATCH] refactor: Switch to file_picker package and get rid of some dependency overrides --- assets/l10n/intl_en.arb | 9 +- lib/pages/add_story/add_story.dart | 16 ++- lib/pages/chat/chat.dart | 29 ++-- lib/pages/chat_details/chat_details.dart | 16 ++- .../homeserver_picker/homeserver_picker.dart | 10 +- lib/pages/settings/settings.dart | 16 ++- .../settings_emotes/settings_emotes.dart | 16 ++- .../settings_security/settings_security.dart | 30 ++-- lib/pages/settings_style/settings_style.dart | 19 +-- .../matrix_file_extension.dart | 70 +++++++++- linux/flutter/generated_plugin_registrant.cc | 4 - linux/flutter/generated_plugins.cmake | 1 - macos/Flutter/GeneratedPluginRegistrant.swift | 4 +- pubspec.lock | 130 ++---------------- pubspec.yaml | 9 +- .../flutter/generated_plugin_registrant.cc | 6 +- windows/flutter/generated_plugins.cmake | 2 +- 17 files changed, 175 insertions(+), 212 deletions(-) diff --git a/assets/l10n/intl_en.arb b/assets/l10n/intl_en.arb index adf9febf..dcd48ee7 100644 --- a/assets/l10n/intl_en.arb +++ b/assets/l10n/intl_en.arb @@ -2519,5 +2519,12 @@ "reopenChat": "Reopen chat", "noBackupWarning": "Warning! Without enabling chat backup, you will lose access to your encrypted messages. It is highly recommended to enable the chat backup first before logging out.", "noOtherDevicesFound": "No other devices found", - "fileIsTooBigForServer": "The server reports that the file is too large to be sent." + "fileIsTooBigForServer": "The server reports that the file is too large to be sent.", + "fileHasBeenSavedAt": "File has been saved at {path}", + "@fileHasBeenSavedAt": { + "type": "text", + "placeholders": { + "path": {} + } + } } diff --git a/lib/pages/add_story/add_story.dart b/lib/pages/add_story/add_story.dart index 5b5d5392..11d8b4a2 100644 --- a/lib/pages/add_story/add_story.dart +++ b/lib/pages/add_story/add_story.dart @@ -3,7 +3,8 @@ import 'dart:math'; import 'package:flutter/material.dart'; -import 'package:file_picker_cross/file_picker_cross.dart'; +import 'package:collection/collection.dart'; +import 'package:file_picker/file_picker.dart'; import 'package:future_loading_dialog/future_loading_dialog.dart'; import 'package:image_picker/image_picker.dart'; import 'package:matrix/matrix.dart'; @@ -68,14 +69,15 @@ class AddStoryController extends State { } void importMedia() async { - final picked = await FilePickerCross.importFromStorage( - type: FileTypeCross.image, + final picked = await FilePicker.platform.pickFiles( + type: FileType.image, + withData: true, ); - final fileName = picked.fileName; - if (fileName == null) return; + final file = picked?.files.firstOrNull; + if (file == null) return; final matrixFile = MatrixImageFile( - bytes: picked.toUint8List(), - name: fileName, + bytes: file.bytes!, + name: file.name, ); setState(() { image = matrixFile; diff --git a/lib/pages/chat/chat.dart b/lib/pages/chat/chat.dart index 7a250419..bf50e853 100644 --- a/lib/pages/chat/chat.dart +++ b/lib/pages/chat/chat.dart @@ -9,7 +9,7 @@ import 'package:adaptive_dialog/adaptive_dialog.dart'; import 'package:desktop_drop/desktop_drop.dart'; import 'package:device_info_plus/device_info_plus.dart'; import 'package:emoji_picker_flutter/emoji_picker_flutter.dart'; -import 'package:file_picker_cross/file_picker_cross.dart'; +import 'package:file_picker/file_picker.dart'; import 'package:flutter_gen/gen_l10n/l10n.dart'; import 'package:future_loading_dialog/future_loading_dialog.dart'; import 'package:image_picker/image_picker.dart'; @@ -352,19 +352,20 @@ class ChatController extends State { } void sendFileAction() async { - final result = await FilePickerCross.importMultipleFromStorage( - type: FileTypeCross.any, + final result = await FilePicker.platform.pickFiles( + allowMultiple: true, + withData: true, ); - if (result.isEmpty) return; + if (result == null || result.files.isEmpty) return; await showDialog( context: context, useRootNavigator: false, builder: (c) => SendFileDialog( - files: result + files: result.files .map( (xfile) => MatrixFile( - bytes: xfile.toUint8List(), - name: xfile.fileName!, + bytes: xfile.bytes!, + name: xfile.name, ).detectFileType, ) .toList(), @@ -374,20 +375,22 @@ class ChatController extends State { } void sendImageAction() async { - final result = await FilePickerCross.importMultipleFromStorage( - type: FileTypeCross.image, + final result = await FilePicker.platform.pickFiles( + type: FileType.image, + withData: true, + allowMultiple: true, ); - if (result.isEmpty) return; + if (result == null || result.files.isEmpty) return; await showDialog( context: context, useRootNavigator: false, builder: (c) => SendFileDialog( - files: result + files: result.files .map( (xfile) => MatrixFile( - bytes: xfile.toUint8List(), - name: xfile.fileName!, + bytes: xfile.bytes!, + name: xfile.name, ).detectFileType, ) .toList(), diff --git a/lib/pages/chat_details/chat_details.dart b/lib/pages/chat_details/chat_details.dart index 9dcbca92..07e6388c 100644 --- a/lib/pages/chat_details/chat_details.dart +++ b/lib/pages/chat_details/chat_details.dart @@ -2,7 +2,8 @@ import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:adaptive_dialog/adaptive_dialog.dart'; -import 'package:file_picker_cross/file_picker_cross.dart'; +import 'package:collection/collection.dart'; +import 'package:file_picker/file_picker.dart'; import 'package:flutter_gen/gen_l10n/l10n.dart'; import 'package:future_loading_dialog/future_loading_dialog.dart'; import 'package:image_picker/image_picker.dart'; @@ -312,12 +313,15 @@ class ChatDetailsController extends State { name: result.path, ); } else { - final result = - await FilePickerCross.importFromStorage(type: FileTypeCross.image); - if (result.fileName == null) return; + final picked = await FilePicker.platform.pickFiles( + type: FileType.image, + withData: true, + ); + final pickedFile = picked?.files.firstOrNull; + if (pickedFile == null) return; file = MatrixFile( - bytes: result.toUint8List(), - name: result.fileName!, + bytes: pickedFile.bytes!, + name: pickedFile.name, ); } await showFutureLoadingDialog( diff --git a/lib/pages/homeserver_picker/homeserver_picker.dart b/lib/pages/homeserver_picker/homeserver_picker.dart index 90bd682b..89c08970 100644 --- a/lib/pages/homeserver_picker/homeserver_picker.dart +++ b/lib/pages/homeserver_picker/homeserver_picker.dart @@ -4,7 +4,8 @@ import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:adaptive_dialog/adaptive_dialog.dart'; -import 'package:file_picker_cross/file_picker_cross.dart'; +import 'package:collection/collection.dart'; +import 'package:file_picker/file_picker.dart'; import 'package:flutter_gen/gen_l10n/l10n.dart'; import 'package:future_loading_dialog/future_loading_dialog.dart'; import 'package:hive_flutter/hive_flutter.dart'; @@ -186,14 +187,15 @@ class HomeserverPickerController extends State { } Future restoreBackup() async { - final file = await FilePickerCross.importFromStorage(); - if (file.fileName == null) return; + final picked = await FilePicker.platform.pickFiles(withData: true); + final file = picked?.files.firstOrNull; + if (file == null) return; await showFutureLoadingDialog( context: context, future: () async { try { final client = Matrix.of(context).getLoginClient(); - await client.importDump(file.toString()); + await client.importDump(String.fromCharCodes(file.bytes!)); Matrix.of(context).initMatrix(); } catch (e, s) { Logs().e('Future error:', e, s); diff --git a/lib/pages/settings/settings.dart b/lib/pages/settings/settings.dart index 97b4dc63..e3465363 100644 --- a/lib/pages/settings/settings.dart +++ b/lib/pages/settings/settings.dart @@ -3,7 +3,8 @@ import 'dart:async'; import 'package:flutter/material.dart'; import 'package:adaptive_dialog/adaptive_dialog.dart'; -import 'package:file_picker_cross/file_picker_cross.dart'; +import 'package:collection/collection.dart'; +import 'package:file_picker/file_picker.dart'; import 'package:flutter_gen/gen_l10n/l10n.dart'; import 'package:future_loading_dialog/future_loading_dialog.dart'; import 'package:image_picker/image_picker.dart'; @@ -134,12 +135,15 @@ class SettingsController extends State { name: result.path, ); } else { - final result = - await FilePickerCross.importFromStorage(type: FileTypeCross.image); - if (result.fileName == null) return; + final result = await FilePicker.platform.pickFiles( + type: FileType.image, + withData: true, + ); + final pickedFile = result?.files.firstOrNull; + if (pickedFile == null) return; file = MatrixFile( - bytes: result.toUint8List(), - name: result.fileName!, + bytes: pickedFile.bytes!, + name: pickedFile.name, ); } final success = await showFutureLoadingDialog( diff --git a/lib/pages/settings_emotes/settings_emotes.dart b/lib/pages/settings_emotes/settings_emotes.dart index 41e145d2..67988514 100644 --- a/lib/pages/settings_emotes/settings_emotes.dart +++ b/lib/pages/settings_emotes/settings_emotes.dart @@ -1,7 +1,8 @@ import 'package:flutter/material.dart'; import 'package:adaptive_dialog/adaptive_dialog.dart'; -import 'package:file_picker_cross/file_picker_cross.dart'; +import 'package:collection/collection.dart'; +import 'package:file_picker/file_picker.dart'; import 'package:flutter_gen/gen_l10n/l10n.dart'; import 'package:future_loading_dialog/future_loading_dialog.dart'; import 'package:matrix/matrix.dart'; @@ -209,12 +210,15 @@ class EmotesSettingsController extends State { void imagePickerAction( ValueNotifier controller, ) async { - final result = - await FilePickerCross.importFromStorage(type: FileTypeCross.image); - if (result.fileName == null) return; + final result = await FilePicker.platform.pickFiles( + type: FileType.image, + withData: true, + ); + final pickedFile = result?.files.firstOrNull; + if (pickedFile == null) return; var file = MatrixImageFile( - bytes: result.toUint8List(), - name: result.fileName!, + bytes: pickedFile.bytes!, + name: pickedFile.name, ); try { file = (await file.generateThumbnail( diff --git a/lib/pages/settings_security/settings_security.dart b/lib/pages/settings_security/settings_security.dart index cc951b17..40950a7d 100644 --- a/lib/pages/settings_security/settings_security.dart +++ b/lib/pages/settings_security/settings_security.dart @@ -4,7 +4,6 @@ import 'dart:typed_data'; import 'package:flutter/material.dart'; import 'package:adaptive_dialog/adaptive_dialog.dart'; -import 'package:file_picker_cross/file_picker_cross.dart'; import 'package:flutter_app_lock/flutter_app_lock.dart'; import 'package:flutter_gen/gen_l10n/l10n.dart'; import 'package:flutter_secure_storage/flutter_secure_storage.dart'; @@ -13,6 +12,7 @@ import 'package:intl/intl.dart'; import 'package:matrix/matrix.dart'; import 'package:fluffychat/config/setting_keys.dart'; +import 'package:fluffychat/utils/matrix_sdk_extensions/matrix_file_extension.dart'; import 'package:fluffychat/widgets/matrix.dart'; import '../bootstrap/bootstrap_dialog.dart'; import 'settings_security_view.dart'; @@ -177,25 +177,23 @@ class SettingsSecurityController extends State { if (response != OkCancelResult.ok) { return; } - await showFutureLoadingDialog( + final file = await showFutureLoadingDialog( context: context, future: () async { - try { - final export = await Matrix.of(context).client.exportDump(); - final filePickerCross = FilePickerCross( - Uint8List.fromList(const Utf8Codec().encode(export!)), - path: - '/fluffychat-export-${DateFormat(DateFormat.YEAR_MONTH_DAY).format(DateTime.now())}.fluffybackup', - fileExtension: 'fluffybackup', - ); - await filePickerCross.exportToStorage( - subject: L10n.of(context)!.dehydrateShare, - ); - } catch (e, s) { - Logs().e('Export error', e, s); - } + final export = await Matrix.of(context).client.exportDump(); + if (export == null) throw Exception('Export data is null.'); + + final exportBytes = Uint8List.fromList( + const Utf8Codec().encode(export), + ); + + final exportFileName = + 'fluffychat-export-${DateFormat(DateFormat.YEAR_MONTH_DAY).format(DateTime.now())}.fluffybackup'; + + return MatrixFile(bytes: exportBytes, name: exportFileName); }, ); + file.result?.save(context); } @override diff --git a/lib/pages/settings_style/settings_style.dart b/lib/pages/settings_style/settings_style.dart index 59e60ced..b4a3e7b8 100644 --- a/lib/pages/settings_style/settings_style.dart +++ b/lib/pages/settings_style/settings_style.dart @@ -1,8 +1,7 @@ -import 'dart:io'; - import 'package:flutter/material.dart'; -import 'package:file_picker_cross/file_picker_cross.dart'; +import 'package:collection/collection.dart'; +import 'package:file_picker/file_picker.dart'; import 'package:fluffychat/config/app_config.dart'; import 'package:fluffychat/config/setting_keys.dart'; @@ -19,14 +18,16 @@ class SettingsStyle extends StatefulWidget { class SettingsStyleController extends State { void setWallpaperAction() async { - final wallpaper = - await FilePickerCross.importFromStorage(type: FileTypeCross.image); - final path = wallpaper.path; - if (path == null) return; - Matrix.of(context).wallpaper = File(path); + final picked = await FilePicker.platform.pickFiles( + type: FileType.image, + withData: false, + ); + final pickedFile = picked?.files.firstOrNull; + + if (pickedFile == null) return; await Matrix.of(context) .store - .setItem(SettingKeys.wallpaper, wallpaper.path); + .setItem(SettingKeys.wallpaper, pickedFile.path); setState(() {}); } diff --git a/lib/utils/matrix_sdk_extensions/matrix_file_extension.dart b/lib/utils/matrix_sdk_extensions/matrix_file_extension.dart index 70d43c28..f95992c5 100644 --- a/lib/utils/matrix_sdk_extensions/matrix_file_extension.dart +++ b/lib/utils/matrix_sdk_extensions/matrix_file_extension.dart @@ -1,9 +1,14 @@ +import 'dart:io'; + import 'package:flutter/material.dart'; -import 'package:file_picker_cross/file_picker_cross.dart'; -import 'package:image_picker/image_picker.dart'; +import 'package:file_picker/file_picker.dart'; +import 'package:flutter_gen/gen_l10n/l10n.dart'; +import 'package:future_loading_dialog/future_loading_dialog.dart'; import 'package:matrix/matrix.dart'; +import 'package:path_provider/path_provider.dart'; import 'package:share_plus/share_plus.dart'; +import 'package:universal_html/html.dart' as html; import 'package:fluffychat/utils/platform_infos.dart'; import 'package:fluffychat/utils/size_string.dart'; @@ -13,10 +18,65 @@ extension MatrixFileExtension on MatrixFile { if (PlatformInfos.isIOS) { return share(context); } - final fileName = name.split('/').last; - final file = FilePickerCross(bytes); - await file.exportToStorage(fileName: fileName, share: false); + if (PlatformInfos.isWeb) { + _webDownload(); + return; + } + + final downloadPath = PlatformInfos.isAndroid + ? await getDownloadPathAndroid() + : await FilePicker.platform.saveFile( + dialogTitle: L10n.of(context)!.saveFile, + fileName: name, + type: filePickerFileType, + ); + if (downloadPath == null) return; + + final result = await showFutureLoadingDialog( + context: context, + future: () => File(downloadPath).writeAsBytes(bytes), + ); + if (result.error != null) return; + + ScaffoldMessenger.of(context).showSnackBar( + SnackBar( + content: Text( + L10n.of(context)!.fileHasBeenSavedAt(downloadPath), + ), + ), + ); + } + + Future getDownloadPathAndroid() async { + final downloadDirectories = await getExternalStorageDirectories( + type: StorageDirectory.downloads, + ); + if (downloadDirectories != null && downloadDirectories.isNotEmpty) { + return downloadDirectories.first.path; + } + final fallbackDirectory = await getApplicationDocumentsDirectory(); + return fallbackDirectory.path; + } + + FileType get filePickerFileType { + if (this is MatrixImageFile) return FileType.image; + if (this is MatrixAudioFile) return FileType.audio; + if (this is MatrixVideoFile) return FileType.video; + return FileType.any; + } + + void _webDownload() { + html.AnchorElement( + href: html.Url.createObjectUrlFromBlob( + html.Blob( + [bytes], + 'application/octet-stream', + ), + ), + ) + ..download = name + ..click(); } void share(BuildContext context) async { diff --git a/linux/flutter/generated_plugin_registrant.cc b/linux/flutter/generated_plugin_registrant.cc index 14a0ae40..2035a409 100644 --- a/linux/flutter/generated_plugin_registrant.cc +++ b/linux/flutter/generated_plugin_registrant.cc @@ -10,7 +10,6 @@ #include #include #include -#include #include #include #include @@ -29,9 +28,6 @@ void fl_register_plugins(FlPluginRegistry* registry) { g_autoptr(FlPluginRegistrar) emoji_picker_flutter_registrar = fl_plugin_registry_get_registrar_for_plugin(registry, "EmojiPickerFlutterPlugin"); emoji_picker_flutter_plugin_register_with_registrar(emoji_picker_flutter_registrar); - g_autoptr(FlPluginRegistrar) file_selector_linux_registrar = - fl_plugin_registry_get_registrar_for_plugin(registry, "FileSelectorPlugin"); - file_selector_plugin_register_with_registrar(file_selector_linux_registrar); g_autoptr(FlPluginRegistrar) flutter_secure_storage_linux_registrar = fl_plugin_registry_get_registrar_for_plugin(registry, "FlutterSecureStorageLinuxPlugin"); flutter_secure_storage_linux_plugin_register_with_registrar(flutter_secure_storage_linux_registrar); diff --git a/linux/flutter/generated_plugins.cmake b/linux/flutter/generated_plugins.cmake index 75edb169..86a165fa 100644 --- a/linux/flutter/generated_plugins.cmake +++ b/linux/flutter/generated_plugins.cmake @@ -7,7 +7,6 @@ list(APPEND FLUTTER_PLUGIN_LIST desktop_lifecycle dynamic_color emoji_picker_flutter - file_selector_linux flutter_secure_storage_linux handy_window record_linux diff --git a/macos/Flutter/GeneratedPluginRegistrant.swift b/macos/Flutter/GeneratedPluginRegistrant.swift index b5c1f2c1..a7283a50 100644 --- a/macos/Flutter/GeneratedPluginRegistrant.swift +++ b/macos/Flutter/GeneratedPluginRegistrant.swift @@ -12,7 +12,6 @@ import desktop_lifecycle import device_info_plus import dynamic_color import emoji_picker_flutter -import file_selector_macos import flutter_app_badger import flutter_local_notifications import flutter_secure_storage_macos @@ -24,7 +23,7 @@ import macos_ui import package_info_plus_macos import path_provider_foundation import record_macos -import share_plus_macos +import share_plus import shared_preferences_macos import sqflite import url_launcher_macos @@ -39,7 +38,6 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { DeviceInfoPlusMacosPlugin.register(with: registry.registrar(forPlugin: "DeviceInfoPlusMacosPlugin")) DynamicColorPlugin.register(with: registry.registrar(forPlugin: "DynamicColorPlugin")) EmojiPickerFlutterPlugin.register(with: registry.registrar(forPlugin: "EmojiPickerFlutterPlugin")) - FileSelectorPlugin.register(with: registry.registrar(forPlugin: "FileSelectorPlugin")) FlutterAppBadgerPlugin.register(with: registry.registrar(forPlugin: "FlutterAppBadgerPlugin")) FlutterLocalNotificationsPlugin.register(with: registry.registrar(forPlugin: "FlutterLocalNotificationsPlugin")) FlutterSecureStoragePlugin.register(with: registry.registrar(forPlugin: "FlutterSecureStoragePlugin")) diff --git a/pubspec.lock b/pubspec.lock index 3d66952d..91f44104 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -337,14 +337,6 @@ packages: url: "https://pub.dev" source: hosted version: "7.0.0" - disk_space: - dependency: transitive - description: - name: disk_space - sha256: fb27eb2d09ac04784f45b95b1355538b2355c76a081eeaa8439d1a5cfa263888 - url: "https://pub.dev" - source: hosted - version: "0.2.1" dynamic_color: dependency: "direct main" description: @@ -418,77 +410,13 @@ packages: source: hosted version: "6.1.4" file_picker: - dependency: transitive - description: - name: file_picker - sha256: "704259669b5e9cb24e15c11cfcf02caf5f20d30901b3916d60b6d1c2d647035f" - url: "https://pub.dev" - source: hosted - version: "4.6.1" - file_picker_cross: dependency: "direct main" description: - name: file_picker_cross - sha256: f418cb32f29ad3f1a48ec7ed88b3007e8a7aadb2e18f38addb65db1e81d6b6fa + name: file_picker + sha256: d8e9ca7e5d1983365c277f12c21b4362df6cf659c99af146ad4d04eb33033013 url: "https://pub.dev" source: hosted - version: "4.6.0" - file_selector: - dependency: "direct overridden" - description: - name: file_selector - sha256: b20af14306e7ce567b7c76076b8c010dcce4bc2f3c4b5137dceb9e4db8ece006 - url: "https://pub.dev" - source: hosted - version: "0.9.2+2" - file_selector_ios: - dependency: transitive - description: - name: file_selector_ios - sha256: "904091b110b64565566fbb98b334590670de5d7ddd7541be15db22d4e64203eb" - url: "https://pub.dev" - source: hosted - version: "0.5.0+2" - file_selector_linux: - dependency: "direct overridden" - description: - name: file_selector_linux - sha256: "30edefcdb76be8f4a2dadf57554b42a2791c06cdbc2db62894a918ea36c37cff" - url: "https://pub.dev" - source: hosted - version: "0.9.1" - file_selector_macos: - dependency: transitive - description: - name: file_selector_macos - sha256: "6fd5242e12b6b0b0d2e59e779a7eafaeaa374687c84e8ad1e948e5dad8941109" - url: "https://pub.dev" - source: hosted - version: "0.9.0+4" - file_selector_platform_interface: - dependency: transitive - description: - name: file_selector_platform_interface - sha256: "17cdfe3d13a7d3e29e3d3978577ce840fcf94497d7de51bdea378abf9a34fc2c" - url: "https://pub.dev" - source: hosted - version: "2.4.0" - file_selector_web: - dependency: transitive - description: - name: file_selector_web - sha256: "0175186c42ef8d622c7cf214e46294f8dbe81ae32ae4407896c773c8f7dc930b" - url: "https://pub.dev" - source: hosted - version: "0.9.0+2" - file_selector_windows: - dependency: transitive - description: - name: file_selector_windows - sha256: "1cfeddc127f78f3f96803ad7c3d3ce500791cbefb15a7b19b9ee71e7b92ff4b4" - url: "https://pub.dev" - source: hosted - version: "0.9.1+4" + version: "5.2.6" flutter: dependency: "direct main" description: flutter @@ -531,14 +459,6 @@ packages: description: flutter source: sdk version: "0.0.0" - flutter_file_dialog: - dependency: transitive - description: - name: flutter_file_dialog - sha256: fb19d8b7c811a70947344695001e82777921fdc0ed5c80289440f096ae22b10f - url: "https://pub.dev" - source: hosted - version: "2.3.2" flutter_foreground_task: dependency: "direct main" description: @@ -1667,26 +1587,10 @@ packages: dependency: "direct main" description: name: share_plus - sha256: f582d5741930f3ad1bf0211d358eddc0508cc346e5b4b248bd1e569c995ebb7a + sha256: "8c6892037b1824e2d7e8f59d54b3105932899008642e6372e5079c6939b4b625" url: "https://pub.dev" source: hosted - version: "4.5.3" - share_plus_linux: - dependency: transitive - description: - name: share_plus_linux - sha256: dc32bf9f1151b9864bb86a997c61a487967a08f2e0b4feaa9a10538712224da4 - url: "https://pub.dev" - source: hosted - version: "3.0.1" - share_plus_macos: - dependency: transitive - description: - name: share_plus_macos - sha256: "44daa946f2845045ecd7abb3569b61cd9a55ae9cc4cbec9895b2067b270697ae" - url: "https://pub.dev" - source: hosted - version: "3.0.1" + version: "6.3.1" share_plus_platform_interface: dependency: transitive description: @@ -1695,22 +1599,6 @@ packages: url: "https://pub.dev" source: hosted version: "3.2.0" - share_plus_web: - dependency: transitive - description: - name: share_plus_web - sha256: eaef05fa8548b372253e772837dd1fbe4ce3aca30ea330765c945d7d4f7c9935 - url: "https://pub.dev" - source: hosted - version: "3.1.0" - share_plus_windows: - dependency: transitive - description: - name: share_plus_windows - sha256: "3a21515ae7d46988d42130cd53294849e280a5de6ace24bae6912a1bffd757d4" - url: "https://pub.dev" - source: hosted - version: "3.0.1" shared_preferences: dependency: "direct main" description: @@ -2208,10 +2096,10 @@ packages: dependency: transitive description: name: wakelock_windows - sha256: "108b1b73711f1664ee462e73af34a9286ff496e27d4d8371e2fb4da8fde4cdac" + sha256: "857f77b3fe6ae82dd045455baa626bc4b93cb9bb6c86bf3f27c182167c3a5567" url: "https://pub.dev" source: hosted - version: "0.2.0" + version: "0.2.1" watcher: dependency: transitive description: @@ -2240,10 +2128,10 @@ packages: dependency: transitive description: name: win32 - sha256: "6b75ac2ddd42f5c226fdaf4498a2b04071c06f1f2b8f7ab1c3f77cc7f2285ff1" + sha256: c9ebe7ee4ab0c2194e65d3a07d8c54c5d00bb001b76081c4a04cdb8448b59e46 url: "https://pub.dev" source: hosted - version: "2.7.0" + version: "3.1.3" wkt_parser: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index ef418019..165c3767 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -25,7 +25,7 @@ dependencies: emoji_proposal: ^0.0.1 emojis: ^0.9.9 #fcm_shared_isolate: ^0.1.0 - file_picker_cross: ^4.6.0 + file_picker: ^5.2.6 flutter: sdk: flutter flutter_app_badger: ^1.5.0 @@ -72,7 +72,7 @@ dependencies: receive_sharing_intent: ^1.4.5 record: ^4.4.4 scroll_to_index: ^3.0.1 - share_plus: ^4.0.10+1 + share_plus: ^6.3.1 shared_preferences: 2.0.15 # Pinned because https://github.com/flutter/flutter/issues/118401 slugify: ^2.0.0 swipe_to_action: ^0.2.0 @@ -143,11 +143,8 @@ msix_config: install_certificate: false dependency_overrides: - # Until all dependencies are compatible. Missing: file_picker_cross, flutter_matrix_html + # Until all dependencies are compatible. Missing: flutter_matrix_html ffi: ^2.0.0 - # This otherwise breaks on linux with flutter 3.7.0, let's override it for now. - file_selector: ^0.9.2+2 - file_selector_linux: ^0.9.1 # fake secure storage plugin for Windows # See: https://gitlab.com/gitlab-com/gl-infra/reliability/-/issues/15161 flutter_secure_storage_windows: diff --git a/windows/flutter/generated_plugin_registrant.cc b/windows/flutter/generated_plugin_registrant.cc index 1dff97c2..6649d186 100644 --- a/windows/flutter/generated_plugin_registrant.cc +++ b/windows/flutter/generated_plugin_registrant.cc @@ -11,10 +11,10 @@ #include #include #include -#include #include #include #include +#include #include void RegisterPlugins(flutter::PluginRegistry* registry) { @@ -28,14 +28,14 @@ void RegisterPlugins(flutter::PluginRegistry* registry) { registry->GetRegistrarForPlugin("DynamicColorPluginCApi")); EmojiPickerFlutterPluginCApiRegisterWithRegistrar( registry->GetRegistrarForPlugin("EmojiPickerFlutterPluginCApi")); - FileSelectorWindowsRegisterWithRegistrar( - registry->GetRegistrarForPlugin("FileSelectorWindows")); FlutterWebRTCPluginRegisterWithRegistrar( registry->GetRegistrarForPlugin("FlutterWebRTCPlugin")); PermissionHandlerWindowsPluginRegisterWithRegistrar( registry->GetRegistrarForPlugin("PermissionHandlerWindowsPlugin")); RecordWindowsPluginCApiRegisterWithRegistrar( registry->GetRegistrarForPlugin("RecordWindowsPluginCApi")); + SharePlusWindowsPluginCApiRegisterWithRegistrar( + registry->GetRegistrarForPlugin("SharePlusWindowsPluginCApi")); UrlLauncherWindowsRegisterWithRegistrar( registry->GetRegistrarForPlugin("UrlLauncherWindows")); } diff --git a/windows/flutter/generated_plugins.cmake b/windows/flutter/generated_plugins.cmake index b39d7c7a..ff0374aa 100644 --- a/windows/flutter/generated_plugins.cmake +++ b/windows/flutter/generated_plugins.cmake @@ -8,10 +8,10 @@ list(APPEND FLUTTER_PLUGIN_LIST desktop_lifecycle dynamic_color emoji_picker_flutter - file_selector_windows flutter_webrtc permission_handler_windows record_windows + share_plus url_launcher_windows )