merge(app): land flutter/chat-question-notice
This commit is contained in:
@@ -10,6 +10,7 @@ import '../core/transport/pipelines_client.dart';
|
||||
import '../shell/adaptive_shell.dart';
|
||||
import '../shell/destination.dart';
|
||||
import '../features/attention/notify/notification_controller.dart';
|
||||
import '../features/attention/notify/chat_question_notices.dart';
|
||||
import '../features/attention/notify/notification_store.dart';
|
||||
import '../features/attention/runtime/attention_controller.dart';
|
||||
import '../features/attention/runtime/attention_store.dart';
|
||||
@@ -91,6 +92,7 @@ class _PipelinesAppState extends State<PipelinesApp>
|
||||
late final NotificationController _notifications = NotificationController(
|
||||
store: const SharedPreferencesNotificationStore(),
|
||||
);
|
||||
ChatQuestionNotices? _chatQuestionNotices;
|
||||
|
||||
/// One attention surface for the app: the Runs heading's bell draws from it
|
||||
/// and the shell mirrors its count on the Runs tab, so the badge is visible
|
||||
@@ -149,6 +151,17 @@ class _PipelinesAppState extends State<PipelinesApp>
|
||||
builder: _buildShell,
|
||||
);
|
||||
_delegate.addListener(_routeChanged);
|
||||
_chatQuestionNotices = ChatQuestionNotices(
|
||||
gateway: _session.gateway,
|
||||
canNotify: () => _notifications.canNotify,
|
||||
activeChatSessionId: () {
|
||||
final route = _delegate.shellRoute;
|
||||
return route.kind == AppRouteKind.chat ? route.chatSessionId : null;
|
||||
},
|
||||
sessionTitle: _chatSessionTitle,
|
||||
openChat: (id) => _delegate.goTo(AppRoute.chatSession(id)),
|
||||
bridge: _notifications.bridge,
|
||||
);
|
||||
_config = RouterConfig<AppRoute>(
|
||||
routeInformationParser: const AppRouteParser(),
|
||||
routerDelegate: _delegate,
|
||||
@@ -166,6 +179,7 @@ class _PipelinesAppState extends State<PipelinesApp>
|
||||
_attention.dispose();
|
||||
_attentionCount.dispose();
|
||||
_notifications.dispose();
|
||||
_chatQuestionNotices?.dispose();
|
||||
_delegate.removeListener(_routeChanged);
|
||||
_delegate.dispose();
|
||||
if (_ownsProvider) {
|
||||
@@ -297,6 +311,16 @@ class _PipelinesAppState extends State<PipelinesApp>
|
||||
setState(() => _pendingRunSearch = null);
|
||||
}
|
||||
|
||||
Future<String?> _chatSessionTitle(String id) async {
|
||||
final reply = await _session.gateway.call('chat_sessions');
|
||||
final sessions = reply['chat_sessions'];
|
||||
if (sessions is! List) return null;
|
||||
for (final value in sessions) {
|
||||
if (value is Map && value['id'] == id) return '${value['title'] ?? ''}';
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/// The Templates page above Settings. Closing it restores the same Settings
|
||||
/// screen instance, so an edited field or an open connection state survives.
|
||||
Widget _buildSchedules(BuildContext context) => SchedulesDestination(
|
||||
|
||||
Reference in New Issue
Block a user