Open active chat when Chat is reselected
Route destination re-selections through the adaptive shell so Chat can restore its retained workspace and focus the composer. Add shell and phone coverage plus implementation notes for the empty-list behavior and verification limits.
This commit is contained in:
@@ -697,20 +697,29 @@ class _PipelinesAppState extends State<PipelinesApp>
|
||||
}
|
||||
|
||||
void _selectDestination(AppDestination destination) {
|
||||
final current = tabForRoute(_delegate.route);
|
||||
final last = _tabRoutes[destination];
|
||||
if (destination == AppDestination.chat && current == destination) {
|
||||
final reopened = chatRouteForRetap(
|
||||
_delegate.shellRoute,
|
||||
_chatWorkspaceRoute,
|
||||
isValidSession: (id) =>
|
||||
_availableChatSessionIds == null ||
|
||||
_availableChatSessionIds!.contains(id),
|
||||
);
|
||||
_delegate.goTo(reopened ?? _routeOf(destination));
|
||||
_delegate.goTo(last ?? _routeOf(destination));
|
||||
}
|
||||
|
||||
/// A tap on the destination already shown. Chat reopens its retained
|
||||
/// workspace when the list is showing; other tabs select as before.
|
||||
void _reselectDestination(AppDestination destination) {
|
||||
if (destination != AppDestination.chat) {
|
||||
_selectDestination(destination);
|
||||
return;
|
||||
}
|
||||
_delegate.goTo(last ?? _routeOf(destination));
|
||||
final onList = _delegate.shellRoute.chatSessionId == null;
|
||||
final reopened = chatRouteForRetap(
|
||||
_delegate.shellRoute,
|
||||
_chatWorkspaceRoute,
|
||||
isValidSession: (id) =>
|
||||
_availableChatSessionIds == null ||
|
||||
_availableChatSessionIds!.contains(id),
|
||||
);
|
||||
_delegate.goTo(reopened ?? _routeOf(destination));
|
||||
// From the list, the reopened chat's composer takes focus, as Ctrl+K does.
|
||||
// A chat already showing keeps its focus behaviour.
|
||||
if (onList && reopened != null) _focusOpenChatComposer();
|
||||
}
|
||||
|
||||
void _routeChanged() {
|
||||
@@ -832,6 +841,7 @@ class _PipelinesAppState extends State<PipelinesApp>
|
||||
runningRunCount: counts.running,
|
||||
destination: _destinationOf(route.kind),
|
||||
onDestinationSelected: _selectDestination,
|
||||
onDestinationReselected: _reselectDestination,
|
||||
onOpenChat: _focusOpenChatComposer,
|
||||
onClosePage: () => _delegate.goTo(
|
||||
_bodyRoutes[AppDestination.pipelines] ?? AppRoute.pipelines,
|
||||
|
||||
Reference in New Issue
Block a user