🐛 Fix android building

This commit is contained in:
LittleSheep 2025-05-29 21:59:27 +08:00
parent d943275ed5
commit b0c1981c9a
12 changed files with 746 additions and 83 deletions

View File

@ -43,10 +43,13 @@
</intent-filter> </intent-filter>
</activity> </activity>
<provider <provider
android:name="com.superlist.super_native_extensions.DataProvider" android:name="androidx.core.content.FileProvider"
android:authorities="dev.solsynth.solian.SuperClipboardDataProvider" android:authorities="dev.solsynth.solian.provider"
android:exported="true" android:exported="false"
android:grantUriPermissions="true"> android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/provider_paths" />
</provider> </provider>
<!-- Don't delete the meta-data below. <!-- Don't delete the meta-data below.
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java --> This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<paths xmlns:android="http://schemas.android.com/apk/res/android">
<external-path
name="external_files"
path="." />
</paths>

File diff suppressed because one or more lines are too long

View File

@ -3,6 +3,7 @@ import 'dart:convert';
import 'dart:io'; import 'dart:io';
import 'package:auto_route/auto_route.dart'; import 'package:auto_route/auto_route.dart';
import 'package:easy_localization/easy_localization.dart'; import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:flutter_hooks/flutter_hooks.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/content/cloud_files.dart';
import 'package:island/widgets/response.dart'; import 'package:island/widgets/response.dart';
import 'package:material_symbols_icons/material_symbols_icons.dart'; import 'package:material_symbols_icons/material_symbols_icons.dart';
import 'package:pasteboard/pasteboard.dart';
import 'package:styled_widget/styled_widget.dart'; import 'package:styled_widget/styled_widget.dart';
import 'package:super_sliver_list/super_sliver_list.dart'; import 'package:super_sliver_list/super_sliver_list.dart';
import 'package:uuid/uuid.dart'; import 'package:uuid/uuid.dart';
import 'package:material_symbols_icons/symbols.dart'; import 'package:material_symbols_icons/symbols.dart';
import 'package:riverpod_annotation/riverpod_annotation.dart'; import 'package:riverpod_annotation/riverpod_annotation.dart';
import 'package:super_clipboard/super_clipboard.dart';
import 'chat.dart'; import 'chat.dart';
import 'package:island/widgets/chat/call_button.dart'; import 'package:island/widgets/chat/call_button.dart';
@ -745,33 +746,16 @@ class _ChatInput extends ConsumerWidget {
} }
Future<void> _handlePaste() async { Future<void> _handlePaste() async {
final clipboard = SystemClipboard.instance; final clipboard = await Pasteboard.image;
if (clipboard == null) return; 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([ onAttachmentsChanged([
...attachments, ...attachments,
UniversalFile( UniversalFile(
data: XFile(tempFile.path), data: XFile.fromData(clipboard, mimeType: "image/jpeg"),
type: UniversalFileType.image, type: UniversalFileType.image,
), ),
]); ]);
});
}
} }
@override @override

View File

@ -23,8 +23,8 @@ import 'package:island/widgets/app_scaffold.dart';
import 'package:island/widgets/content/cloud_files.dart'; import 'package:island/widgets/content/cloud_files.dart';
import 'package:island/widgets/post/publishers_modal.dart'; import 'package:island/widgets/post/publishers_modal.dart';
import 'package:material_symbols_icons/symbols.dart'; import 'package:material_symbols_icons/symbols.dart';
import 'package:pasteboard/pasteboard.dart';
import 'package:styled_widget/styled_widget.dart'; import 'package:styled_widget/styled_widget.dart';
import 'package:super_clipboard/super_clipboard.dart';
@RoutePage() @RoutePage()
class PostEditScreen extends HookConsumerWidget { class PostEditScreen extends HookConsumerWidget {
@ -211,33 +211,16 @@ class PostComposeScreen extends HookConsumerWidget {
} }
Future<void> _handlePaste() async { Future<void> _handlePaste() async {
final clipboard = SystemClipboard.instance; final clipboard = await Pasteboard.image;
if (clipboard == null) return; 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 = [
...attachments.value, ...attachments.value,
UniversalFile( UniversalFile(
data: XFile(tempFile.path), data: XFile.fromData(clipboard, mimeType: "image/jpeg"),
type: UniversalFileType.image, type: UniversalFileType.image,
), ),
]; ];
});
}
} }
void _handleKeyPress(RawKeyEvent event) { void _handleKeyPress(RawKeyEvent event) {

View File

@ -14,6 +14,7 @@
#include <irondash_engine_context/irondash_engine_context_plugin.h> #include <irondash_engine_context/irondash_engine_context_plugin.h>
#include <media_kit_libs_linux/media_kit_libs_linux_plugin.h> #include <media_kit_libs_linux/media_kit_libs_linux_plugin.h>
#include <media_kit_video/media_kit_video_plugin.h> #include <media_kit_video/media_kit_video_plugin.h>
#include <pasteboard/pasteboard_plugin.h>
#include <sqlite3_flutter_libs/sqlite3_flutter_libs_plugin.h> #include <sqlite3_flutter_libs/sqlite3_flutter_libs_plugin.h>
#include <super_native_extensions/super_native_extensions_plugin.h> #include <super_native_extensions/super_native_extensions_plugin.h>
#include <url_launcher_linux/url_launcher_plugin.h> #include <url_launcher_linux/url_launcher_plugin.h>
@ -44,6 +45,9 @@ void fl_register_plugins(FlPluginRegistry* registry) {
g_autoptr(FlPluginRegistrar) media_kit_video_registrar = g_autoptr(FlPluginRegistrar) media_kit_video_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "MediaKitVideoPlugin"); fl_plugin_registry_get_registrar_for_plugin(registry, "MediaKitVideoPlugin");
media_kit_video_plugin_register_with_registrar(media_kit_video_registrar); 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 = g_autoptr(FlPluginRegistrar) sqlite3_flutter_libs_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "Sqlite3FlutterLibsPlugin"); fl_plugin_registry_get_registrar_for_plugin(registry, "Sqlite3FlutterLibsPlugin");
sqlite3_flutter_libs_plugin_register_with_registrar(sqlite3_flutter_libs_registrar); sqlite3_flutter_libs_plugin_register_with_registrar(sqlite3_flutter_libs_registrar);

View File

@ -11,6 +11,7 @@ list(APPEND FLUTTER_PLUGIN_LIST
irondash_engine_context irondash_engine_context
media_kit_libs_linux media_kit_libs_linux
media_kit_video media_kit_video
pasteboard
sqlite3_flutter_libs sqlite3_flutter_libs
super_native_extensions super_native_extensions
url_launcher_linux url_launcher_linux

View File

@ -21,6 +21,7 @@ import livekit_client
import media_kit_libs_macos_video import media_kit_libs_macos_video
import media_kit_video import media_kit_video
import package_info_plus import package_info_plus
import pasteboard
import path_provider_foundation import path_provider_foundation
import shared_preferences_foundation import shared_preferences_foundation
import sqflite_darwin import sqflite_darwin
@ -47,6 +48,7 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
MediaKitLibsMacosVideoPlugin.register(with: registry.registrar(forPlugin: "MediaKitLibsMacosVideoPlugin")) MediaKitLibsMacosVideoPlugin.register(with: registry.registrar(forPlugin: "MediaKitLibsMacosVideoPlugin"))
MediaKitVideoPlugin.register(with: registry.registrar(forPlugin: "MediaKitVideoPlugin")) MediaKitVideoPlugin.register(with: registry.registrar(forPlugin: "MediaKitVideoPlugin"))
FPPPackageInfoPlusPlugin.register(with: registry.registrar(forPlugin: "FPPPackageInfoPlusPlugin")) FPPPackageInfoPlusPlugin.register(with: registry.registrar(forPlugin: "FPPPackageInfoPlusPlugin"))
PasteboardPlugin.register(with: registry.registrar(forPlugin: "PasteboardPlugin"))
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin")) PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin")) SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin"))
SqflitePlugin.register(with: registry.registrar(forPlugin: "SqflitePlugin")) SqflitePlugin.register(with: registry.registrar(forPlugin: "SqflitePlugin"))

View File

@ -1086,12 +1086,13 @@ packages:
source: hosted source: hosted
version: "1.0.5" version: "1.0.5"
irondash_engine_context: irondash_engine_context:
dependency: transitive dependency: "direct overridden"
description: description:
name: irondash_engine_context path: "engine_context/dart"
sha256: cd7b769db11a2b5243b037c8a9b1ecaef02e1ae27a2d909ffa78c1dad747bb10 ref: "refs/pull/66/head"
url: "https://pub.dev" resolved-ref: e2551d9a3b0272a723b3627c5ef70e01a9e26961
source: hosted url: "https://github.com/irondash/irondash.git"
source: git
version: "0.5.4" version: "0.5.4"
irondash_message_channel: irondash_message_channel:
dependency: transitive dependency: transitive
@ -1373,6 +1374,14 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "3.2.0" version: "3.2.0"
pasteboard:
dependency: "direct main"
description:
name: pasteboard
sha256: "9ff73ada33f79a59ff91f6c01881fd4ed0a0031cfc4ae2d86c0384471525fca1"
url: "https://pub.dev"
source: hosted
version: "0.4.0"
path: path:
dependency: "direct main" dependency: "direct main"
description: description:
@ -1874,14 +1883,6 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "0.4.1" 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: super_context_menu:
dependency: "direct main" dependency: "direct main"
description: description:
@ -1891,12 +1892,13 @@ packages:
source: hosted source: hosted
version: "0.9.0-dev.6" version: "0.9.0-dev.6"
super_native_extensions: super_native_extensions:
dependency: transitive dependency: "direct overridden"
description: description:
name: super_native_extensions path: super_native_extensions
sha256: "09ccc40c475e6f91770eaeb2553bf4803812d7beadc3759aa57d643370619c86" ref: "refs/pull/525/head"
url: "https://pub.dev" resolved-ref: d3020a8c5acd8555707b3b6477fd744d09f3e22f
source: hosted url: "https://github.com/superlistapp/super_native_extensions.git"
source: git
version: "0.9.0-dev.6" version: "0.9.0-dev.6"
super_sliver_list: super_sliver_list:
dependency: "direct main" dependency: "direct main"

View File

@ -100,9 +100,9 @@ dependencies:
photo_view: ^0.15.0 photo_view: ^0.15.0
dismissible_page: ^1.0.2 dismissible_page: ^1.0.2
super_sliver_list: ^0.4.1 super_sliver_list: ^0.4.1
super_clipboard: ^0.9.0-dev.6
flutter_webrtc: ^0.14.1 flutter_webrtc: ^0.14.1
livekit_client: ^2.4.7 livekit_client: ^2.4.7
pasteboard: ^0.4.0
dev_dependencies: dev_dependencies:
flutter_test: flutter_test:
@ -130,6 +130,17 @@ dependency_overrides:
analyzer_plugin: 0.12.0 analyzer_plugin: 0.12.0
# https://github.com/dart-lang/sdk/issues/60784#issuecomment-2906872272 # https://github.com/dart-lang/sdk/issues/60784#issuecomment-2906872272
custom_lint_visitor: 1.0.0+7.3.0 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 # For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec # following page: https://dart.dev/tools/pub/pubspec

View File

@ -18,6 +18,7 @@
#include <livekit_client/live_kit_plugin.h> #include <livekit_client/live_kit_plugin.h>
#include <media_kit_libs_windows_video/media_kit_libs_windows_video_plugin_c_api.h> #include <media_kit_libs_windows_video/media_kit_libs_windows_video_plugin_c_api.h>
#include <media_kit_video/media_kit_video_plugin_c_api.h> #include <media_kit_video/media_kit_video_plugin_c_api.h>
#include <pasteboard/pasteboard_plugin.h>
#include <sqlite3_flutter_libs/sqlite3_flutter_libs_plugin.h> #include <sqlite3_flutter_libs/sqlite3_flutter_libs_plugin.h>
#include <super_native_extensions/super_native_extensions_plugin_c_api.h> #include <super_native_extensions/super_native_extensions_plugin_c_api.h>
#include <url_launcher_windows/url_launcher_windows.h> #include <url_launcher_windows/url_launcher_windows.h>
@ -48,6 +49,8 @@ void RegisterPlugins(flutter::PluginRegistry* registry) {
registry->GetRegistrarForPlugin("MediaKitLibsWindowsVideoPluginCApi")); registry->GetRegistrarForPlugin("MediaKitLibsWindowsVideoPluginCApi"));
MediaKitVideoPluginCApiRegisterWithRegistrar( MediaKitVideoPluginCApiRegisterWithRegistrar(
registry->GetRegistrarForPlugin("MediaKitVideoPluginCApi")); registry->GetRegistrarForPlugin("MediaKitVideoPluginCApi"));
PasteboardPluginRegisterWithRegistrar(
registry->GetRegistrarForPlugin("PasteboardPlugin"));
Sqlite3FlutterLibsPluginRegisterWithRegistrar( Sqlite3FlutterLibsPluginRegisterWithRegistrar(
registry->GetRegistrarForPlugin("Sqlite3FlutterLibsPlugin")); registry->GetRegistrarForPlugin("Sqlite3FlutterLibsPlugin"));
SuperNativeExtensionsPluginCApiRegisterWithRegistrar( SuperNativeExtensionsPluginCApiRegisterWithRegistrar(

View File

@ -15,6 +15,7 @@ list(APPEND FLUTTER_PLUGIN_LIST
livekit_client livekit_client
media_kit_libs_windows_video media_kit_libs_windows_video
media_kit_video media_kit_video
pasteboard
sqlite3_flutter_libs sqlite3_flutter_libs
super_native_extensions super_native_extensions
url_launcher_windows url_launcher_windows