🐛 Bug fixes for the AI thought

This commit is contained in:
2025-12-21 21:48:46 +08:00
parent 87a54625aa
commit eb89d9223a
7 changed files with 403 additions and 386 deletions

View File

@@ -19,6 +19,7 @@ import 'package:island/widgets/content/network_status_sheet.dart';
import 'package:island/widgets/tour/tour.dart';
import 'package:island/widgets/post/compose_sheet.dart';
import 'package:island/screens/notification.dart';
import 'package:island/screens/thought/think_sheet.dart';
import 'package:island/services/event_bus.dart';
import 'package:tray_manager/tray_manager.dart';
import 'package:window_manager/window_manager.dart';
@@ -38,6 +39,7 @@ class _AppWrapperState extends ConsumerState<AppWrapper>
StreamSubscription? composeSheetSubs;
StreamSubscription? notificationSheetSubs;
StreamSubscription? thoughtSheetSubs;
@override
void initState() {
@@ -70,6 +72,12 @@ class _AppWrapperState extends ConsumerState<AppWrapper>
}
});
thoughtSheetSubs = eventBus.on<ShowThoughtSheetEvent>().listen((event) {
if (mounted) {
_showThoughtSheet(event);
}
});
final initialUrl = await protocolHandler.getInitialUrl();
if (initialUrl != null && mounted) {
WidgetsBinding.instance.addPostFrameCallback((_) {
@@ -87,6 +95,7 @@ class _AppWrapperState extends ConsumerState<AppWrapper>
ntySubs?.cancel();
composeSheetSubs?.cancel();
notificationSheetSubs?.cancel();
thoughtSheetSubs?.cancel();
super.dispose();
}
@@ -154,6 +163,15 @@ class _AppWrapperState extends ConsumerState<AppWrapper>
);
}
void _showThoughtSheet(ShowThoughtSheetEvent event) {
ThoughtSheet.show(
context,
initialMessage: event.initialMessage,
attachedMessages: event.attachedMessages,
attachedPosts: event.attachedPosts,
);
}
void _handleDeepLink(Uri uri, WidgetRef ref) async {
String path = '/${uri.host}${uri.path}';