From b0c1981c9a8753d8d3a58907ec1c1943e460f950 Mon Sep 17 00:00:00 2001 From: LittleSheep Date: Thu, 29 May 2025 21:59:27 +0800 Subject: [PATCH] :bug: Fix android building --- android/app/src/main/AndroidManifest.xml | 27 +- .../app/src/main/res/xml/provider_paths.xml | 6 + .../reports/problems/problems-report.html | 663 ++++++++++++++++++ lib/screens/chat/room.dart | 36 +- lib/screens/posts/compose.dart | 35 +- linux/flutter/generated_plugin_registrant.cc | 4 + linux/flutter/generated_plugins.cmake | 1 + macos/Flutter/GeneratedPluginRegistrant.swift | 2 + pubspec.lock | 38 +- pubspec.yaml | 13 +- .../flutter/generated_plugin_registrant.cc | 3 + windows/flutter/generated_plugins.cmake | 1 + 12 files changed, 746 insertions(+), 83 deletions(-) create mode 100644 android/app/src/main/res/xml/provider_paths.xml create mode 100644 android/build/reports/problems/problems-report.html diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index f0babb0..29bdf98 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -34,19 +34,22 @@ while the Flutter UI initializes. After that, this theme continues to determine the Window background behind the Flutter UI. --> + android:name="io.flutter.embedding.android.NormalTheme" + android:resource="@style/NormalTheme" + /> - - + + + android:name="androidx.core.content.FileProvider" + android:authorities="dev.solsynth.solian.provider" + android:exported="false" + android:grantUriPermissions="true"> + @@ -61,8 +64,8 @@ In particular, this is used by the Flutter engine in io.flutter.plugin.text.ProcessTextPlugin. --> - - + + - + \ No newline at end of file diff --git a/android/app/src/main/res/xml/provider_paths.xml b/android/app/src/main/res/xml/provider_paths.xml new file mode 100644 index 0000000..791000e --- /dev/null +++ b/android/app/src/main/res/xml/provider_paths.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/android/build/reports/problems/problems-report.html b/android/build/reports/problems/problems-report.html new file mode 100644 index 0000000..a0500a2 --- /dev/null +++ b/android/build/reports/problems/problems-report.html @@ -0,0 +1,663 @@ + + + + + + + + + + + + + Gradle Configuration Cache + + + +
+ +
+ Loading... +
+ + + + + + diff --git a/lib/screens/chat/room.dart b/lib/screens/chat/room.dart index 8c0c643..c9a67f1 100644 --- a/lib/screens/chat/room.dart +++ b/lib/screens/chat/room.dart @@ -3,6 +3,7 @@ import 'dart:convert'; import 'dart:io'; import 'package:auto_route/auto_route.dart'; import 'package:easy_localization/easy_localization.dart'; +import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_hooks/flutter_hooks.dart'; @@ -27,12 +28,12 @@ import 'package:island/widgets/chat/message_item.dart'; import 'package:island/widgets/content/cloud_files.dart'; import 'package:island/widgets/response.dart'; import 'package:material_symbols_icons/material_symbols_icons.dart'; +import 'package:pasteboard/pasteboard.dart'; import 'package:styled_widget/styled_widget.dart'; import 'package:super_sliver_list/super_sliver_list.dart'; import 'package:uuid/uuid.dart'; import 'package:material_symbols_icons/symbols.dart'; import 'package:riverpod_annotation/riverpod_annotation.dart'; -import 'package:super_clipboard/super_clipboard.dart'; import 'chat.dart'; import 'package:island/widgets/chat/call_button.dart'; @@ -745,33 +746,16 @@ class _ChatInput extends ConsumerWidget { } Future _handlePaste() async { - final clipboard = SystemClipboard.instance; + final clipboard = await Pasteboard.image; if (clipboard == null) return; - final reader = await clipboard.read(); - if (reader.canProvide(Formats.png)) { - reader.getFile(Formats.png, (file) async { - final stream = file.getStream(); - final bytes = await stream.toList(); - final imageBytes = bytes.expand((e) => e).toList(); - - // Create a temporary file to store the image - final tempDir = Directory.systemTemp; - final tempFile = File( - '${tempDir.path}/pasted_image_${DateTime.now().millisecondsSinceEpoch}.png', - ); - await tempFile.writeAsBytes(imageBytes); - - // Add the file to attachments - onAttachmentsChanged([ - ...attachments, - UniversalFile( - data: XFile(tempFile.path), - type: UniversalFileType.image, - ), - ]); - }); - } + onAttachmentsChanged([ + ...attachments, + UniversalFile( + data: XFile.fromData(clipboard, mimeType: "image/jpeg"), + type: UniversalFileType.image, + ), + ]); } @override diff --git a/lib/screens/posts/compose.dart b/lib/screens/posts/compose.dart index 23967e7..e368948 100644 --- a/lib/screens/posts/compose.dart +++ b/lib/screens/posts/compose.dart @@ -23,8 +23,8 @@ import 'package:island/widgets/app_scaffold.dart'; import 'package:island/widgets/content/cloud_files.dart'; import 'package:island/widgets/post/publishers_modal.dart'; import 'package:material_symbols_icons/symbols.dart'; +import 'package:pasteboard/pasteboard.dart'; import 'package:styled_widget/styled_widget.dart'; -import 'package:super_clipboard/super_clipboard.dart'; @RoutePage() class PostEditScreen extends HookConsumerWidget { @@ -211,33 +211,16 @@ class PostComposeScreen extends HookConsumerWidget { } Future _handlePaste() async { - final clipboard = SystemClipboard.instance; + final clipboard = await Pasteboard.image; if (clipboard == null) return; - final reader = await clipboard.read(); - if (reader.canProvide(Formats.png)) { - reader.getFile(Formats.png, (file) async { - final stream = file.getStream(); - final bytes = await stream.toList(); - final imageBytes = bytes.expand((e) => e).toList(); - - // Create a temporary file to store the image - final tempDir = Directory.systemTemp; - final tempFile = File( - '${tempDir.path}/pasted_image_${DateTime.now().millisecondsSinceEpoch}.png', - ); - await tempFile.writeAsBytes(imageBytes); - - // Add the file to attachments - attachments.value = [ - ...attachments.value, - UniversalFile( - data: XFile(tempFile.path), - type: UniversalFileType.image, - ), - ]; - }); - } + attachments.value = [ + ...attachments.value, + UniversalFile( + data: XFile.fromData(clipboard, mimeType: "image/jpeg"), + type: UniversalFileType.image, + ), + ]; } void _handleKeyPress(RawKeyEvent event) { diff --git a/linux/flutter/generated_plugin_registrant.cc b/linux/flutter/generated_plugin_registrant.cc index 084fe7c..f7a7fb1 100644 --- a/linux/flutter/generated_plugin_registrant.cc +++ b/linux/flutter/generated_plugin_registrant.cc @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -44,6 +45,9 @@ void fl_register_plugins(FlPluginRegistry* registry) { g_autoptr(FlPluginRegistrar) media_kit_video_registrar = fl_plugin_registry_get_registrar_for_plugin(registry, "MediaKitVideoPlugin"); media_kit_video_plugin_register_with_registrar(media_kit_video_registrar); + g_autoptr(FlPluginRegistrar) pasteboard_registrar = + fl_plugin_registry_get_registrar_for_plugin(registry, "PasteboardPlugin"); + pasteboard_plugin_register_with_registrar(pasteboard_registrar); g_autoptr(FlPluginRegistrar) sqlite3_flutter_libs_registrar = fl_plugin_registry_get_registrar_for_plugin(registry, "Sqlite3FlutterLibsPlugin"); sqlite3_flutter_libs_plugin_register_with_registrar(sqlite3_flutter_libs_registrar); diff --git a/linux/flutter/generated_plugins.cmake b/linux/flutter/generated_plugins.cmake index e4e9336..bd96754 100644 --- a/linux/flutter/generated_plugins.cmake +++ b/linux/flutter/generated_plugins.cmake @@ -11,6 +11,7 @@ list(APPEND FLUTTER_PLUGIN_LIST irondash_engine_context media_kit_libs_linux media_kit_video + pasteboard sqlite3_flutter_libs super_native_extensions url_launcher_linux diff --git a/macos/Flutter/GeneratedPluginRegistrant.swift b/macos/Flutter/GeneratedPluginRegistrant.swift index 6d39abf..b534a7f 100644 --- a/macos/Flutter/GeneratedPluginRegistrant.swift +++ b/macos/Flutter/GeneratedPluginRegistrant.swift @@ -21,6 +21,7 @@ import livekit_client import media_kit_libs_macos_video import media_kit_video import package_info_plus +import pasteboard import path_provider_foundation import shared_preferences_foundation import sqflite_darwin @@ -47,6 +48,7 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { MediaKitLibsMacosVideoPlugin.register(with: registry.registrar(forPlugin: "MediaKitLibsMacosVideoPlugin")) MediaKitVideoPlugin.register(with: registry.registrar(forPlugin: "MediaKitVideoPlugin")) FPPPackageInfoPlusPlugin.register(with: registry.registrar(forPlugin: "FPPPackageInfoPlusPlugin")) + PasteboardPlugin.register(with: registry.registrar(forPlugin: "PasteboardPlugin")) PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin")) SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin")) SqflitePlugin.register(with: registry.registrar(forPlugin: "SqflitePlugin")) diff --git a/pubspec.lock b/pubspec.lock index e4f63cd..cf3181d 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -1086,12 +1086,13 @@ packages: source: hosted version: "1.0.5" irondash_engine_context: - dependency: transitive + dependency: "direct overridden" description: - name: irondash_engine_context - sha256: cd7b769db11a2b5243b037c8a9b1ecaef02e1ae27a2d909ffa78c1dad747bb10 - url: "https://pub.dev" - source: hosted + path: "engine_context/dart" + ref: "refs/pull/66/head" + resolved-ref: e2551d9a3b0272a723b3627c5ef70e01a9e26961 + url: "https://github.com/irondash/irondash.git" + source: git version: "0.5.4" irondash_message_channel: dependency: transitive @@ -1373,6 +1374,14 @@ packages: url: "https://pub.dev" source: hosted version: "3.2.0" + pasteboard: + dependency: "direct main" + description: + name: pasteboard + sha256: "9ff73ada33f79a59ff91f6c01881fd4ed0a0031cfc4ae2d86c0384471525fca1" + url: "https://pub.dev" + source: hosted + version: "0.4.0" path: dependency: "direct main" description: @@ -1874,14 +1883,6 @@ packages: url: "https://pub.dev" source: hosted version: "0.4.1" - super_clipboard: - dependency: "direct main" - description: - name: super_clipboard - sha256: "5203c881d24033c3e6154c2ae01afd94e7f0a3201280373f28e540f1defa3f40" - url: "https://pub.dev" - source: hosted - version: "0.9.0-dev.6" super_context_menu: dependency: "direct main" description: @@ -1891,12 +1892,13 @@ packages: source: hosted version: "0.9.0-dev.6" super_native_extensions: - dependency: transitive + dependency: "direct overridden" description: - name: super_native_extensions - sha256: "09ccc40c475e6f91770eaeb2553bf4803812d7beadc3759aa57d643370619c86" - url: "https://pub.dev" - source: hosted + path: super_native_extensions + ref: "refs/pull/525/head" + resolved-ref: d3020a8c5acd8555707b3b6477fd744d09f3e22f + url: "https://github.com/superlistapp/super_native_extensions.git" + source: git version: "0.9.0-dev.6" super_sliver_list: dependency: "direct main" diff --git a/pubspec.yaml b/pubspec.yaml index d7bbfaf..8fcb792 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -100,9 +100,9 @@ dependencies: photo_view: ^0.15.0 dismissible_page: ^1.0.2 super_sliver_list: ^0.4.1 - super_clipboard: ^0.9.0-dev.6 flutter_webrtc: ^0.14.1 livekit_client: ^2.4.7 + pasteboard: ^0.4.0 dev_dependencies: flutter_test: @@ -130,6 +130,17 @@ dependency_overrides: analyzer_plugin: 0.12.0 # https://github.com/dart-lang/sdk/issues/60784#issuecomment-2906872272 custom_lint_visitor: 1.0.0+7.3.0 + # https://github.com/superlistapp/super_native_extensions/issues/524#issuecomment-2918531753 + super_native_extensions: + git: + url: https://github.com/superlistapp/super_native_extensions.git + ref: refs/pull/525/head + path: super_native_extensions + irondash_engine_context: + git: + url: https://github.com/irondash/irondash.git + ref: refs/pull/66/head + path: engine_context/dart # For information on the generic Dart part of this file, see the # following page: https://dart.dev/tools/pub/pubspec diff --git a/windows/flutter/generated_plugin_registrant.cc b/windows/flutter/generated_plugin_registrant.cc index 811aae6..0b9121b 100644 --- a/windows/flutter/generated_plugin_registrant.cc +++ b/windows/flutter/generated_plugin_registrant.cc @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include @@ -48,6 +49,8 @@ void RegisterPlugins(flutter::PluginRegistry* registry) { registry->GetRegistrarForPlugin("MediaKitLibsWindowsVideoPluginCApi")); MediaKitVideoPluginCApiRegisterWithRegistrar( registry->GetRegistrarForPlugin("MediaKitVideoPluginCApi")); + PasteboardPluginRegisterWithRegistrar( + registry->GetRegistrarForPlugin("PasteboardPlugin")); Sqlite3FlutterLibsPluginRegisterWithRegistrar( registry->GetRegistrarForPlugin("Sqlite3FlutterLibsPlugin")); SuperNativeExtensionsPluginCApiRegisterWithRegistrar( diff --git a/windows/flutter/generated_plugins.cmake b/windows/flutter/generated_plugins.cmake index 85523a4..6652b07 100644 --- a/windows/flutter/generated_plugins.cmake +++ b/windows/flutter/generated_plugins.cmake @@ -15,6 +15,7 @@ list(APPEND FLUTTER_PLUGIN_LIST livekit_client media_kit_libs_windows_video media_kit_video + pasteboard sqlite3_flutter_libs super_native_extensions url_launcher_windows