Remove Cupertino chat conversation branches
Keep the Material-only conversation implementation while preserving public Cupertino parameters for callers. Narrow affected tests to Material hosts so the dead platform paths are no longer exercised.
This commit is contained in:
@@ -226,124 +226,115 @@ Future<void> replyChatHistory(
|
||||
}
|
||||
|
||||
void main() {
|
||||
for (final cupertino in [false, true]) {
|
||||
testWidgets(
|
||||
'a wide /chat/s1 deep link shows that thread beside the list and route Back returns to /chat ($cupertino)',
|
||||
(tester) async {
|
||||
tester.view.physicalSize = const Size(900, 900);
|
||||
tester.view.devicePixelRatio = 1;
|
||||
addTearDown(tester.view.resetPhysicalSize);
|
||||
addTearDown(tester.view.resetDevicePixelRatio);
|
||||
if (cupertino) {
|
||||
tester.platformDispatcher.platformBrightnessTestValue =
|
||||
Brightness.dark;
|
||||
addTearDown(
|
||||
tester.platformDispatcher.clearPlatformBrightnessTestValue,
|
||||
);
|
||||
}
|
||||
testWidgets(
|
||||
'a wide /chat/s1 deep link shows that thread beside the list and route Back returns to /chat',
|
||||
(tester) async {
|
||||
tester.view.physicalSize = const Size(900, 900);
|
||||
tester.view.devicePixelRatio = 1;
|
||||
addTearDown(tester.view.resetPhysicalSize);
|
||||
addTearDown(tester.view.resetDevicePixelRatio);
|
||||
|
||||
final channel = FakeChannel()..readyCompleter.complete();
|
||||
final client = PipelinesClient(channelFactory: (_) => channel);
|
||||
final provider = PlatformRouteInformationProvider(
|
||||
initialRouteInformation: RouteInformation(uri: Uri.parse('/chat/s1')),
|
||||
);
|
||||
addTearDown(provider.dispose);
|
||||
final channel = FakeChannel()..readyCompleter.complete();
|
||||
final client = PipelinesClient(channelFactory: (_) => channel);
|
||||
final provider = PlatformRouteInformationProvider(
|
||||
initialRouteInformation: RouteInformation(uri: Uri.parse('/chat/s1')),
|
||||
);
|
||||
addTearDown(provider.dispose);
|
||||
|
||||
await tester.pumpWidget(
|
||||
PipelinesApp(
|
||||
androidSupported: false,
|
||||
server: webServer(),
|
||||
client: client,
|
||||
cupertino: cupertino,
|
||||
routeInformationProvider: provider,
|
||||
),
|
||||
);
|
||||
await tester.pump();
|
||||
await tester.pumpWidget(
|
||||
PipelinesApp(
|
||||
androidSupported: false,
|
||||
server: webServer(),
|
||||
client: client,
|
||||
cupertino: false,
|
||||
routeInformationProvider: provider,
|
||||
),
|
||||
);
|
||||
await tester.pump();
|
||||
|
||||
await replySessions(tester, channel);
|
||||
await replySubscribe(tester, channel);
|
||||
await replyHistory(tester, channel);
|
||||
await tester.pumpAndSettle();
|
||||
await replySessions(tester, channel);
|
||||
await replySubscribe(tester, channel);
|
||||
await replyHistory(tester, channel);
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(provider.value.uri.path, '/chat/s1');
|
||||
expect(find.byType(ChatThreadView), findsOneWidget);
|
||||
// The exact route names the session; the request carries the same id.
|
||||
expect(requestOf(channel, 'chat_subscribe')!['chat_subscribe'], {
|
||||
'session_id': 's1',
|
||||
});
|
||||
expect(requestOf(channel, 'chat_messages')!['chat_query'], {
|
||||
'session_id': 's1',
|
||||
'limit': 200,
|
||||
'cursor': '',
|
||||
});
|
||||
expect(find.text('The stored reply stays readable.'), findsOneWidget);
|
||||
expect(find.text('Ran 1 command'), findsOneWidget);
|
||||
expect(find.byKey(const Key('chat-turn-activity')), findsOneWidget);
|
||||
expect(find.text('Kept behind a native disclosure.'), findsNothing);
|
||||
expect(provider.value.uri.path, '/chat/s1');
|
||||
expect(find.byType(ChatThreadView), findsOneWidget);
|
||||
// The exact route names the session; the request carries the same id.
|
||||
expect(requestOf(channel, 'chat_subscribe')!['chat_subscribe'], {
|
||||
'session_id': 's1',
|
||||
});
|
||||
expect(requestOf(channel, 'chat_messages')!['chat_query'], {
|
||||
'session_id': 's1',
|
||||
'limit': 200,
|
||||
'cursor': '',
|
||||
});
|
||||
expect(find.text('The stored reply stays readable.'), findsOneWidget);
|
||||
expect(find.text('Ran 1 command'), findsOneWidget);
|
||||
expect(find.byKey(const Key('chat-turn-activity')), findsOneWidget);
|
||||
expect(find.text('Kept behind a native disclosure.'), findsNothing);
|
||||
|
||||
// The shell bar stays over the list and tabs; the open chat draws its
|
||||
// own floating bar in its pane, with no Back: the list beside it is the
|
||||
// way out.
|
||||
expect(find.byType(ChatSessionsScreen), findsOneWidget);
|
||||
expect(find.byType(NavigationRail), findsNothing);
|
||||
expect(find.byType(FloatingDestinationBar), findsOneWidget);
|
||||
// The shell's bar and the conversation's own header.
|
||||
expect(find.byType(SegmentedBar), findsNWidgets(2));
|
||||
expect(find.byType(AppBar), findsNothing);
|
||||
expect(find.byType(CupertinoNavigationBar), findsNothing);
|
||||
expect(find.byKey(const Key('chat-thread-header')), findsOneWidget);
|
||||
expect(findNativeBack(), findsNothing);
|
||||
// The shell bar stays over the list and tabs; the open chat draws its
|
||||
// own floating bar in its pane, with no Back: the list beside it is the
|
||||
// way out.
|
||||
expect(find.byType(ChatSessionsScreen), findsOneWidget);
|
||||
expect(find.byType(NavigationRail), findsNothing);
|
||||
expect(find.byType(FloatingDestinationBar), findsOneWidget);
|
||||
// The shell's bar and the conversation's own header.
|
||||
expect(find.byType(SegmentedBar), findsNWidgets(2));
|
||||
expect(find.byType(AppBar), findsNothing);
|
||||
expect(find.byType(CupertinoNavigationBar), findsNothing);
|
||||
expect(find.byKey(const Key('chat-thread-header')), findsOneWidget);
|
||||
expect(findNativeBack(), findsNothing);
|
||||
|
||||
// A live frame updates the held thread.
|
||||
channel.incoming.add(
|
||||
jsonEncode({
|
||||
'type': 'chat_event',
|
||||
'chat_event': {
|
||||
'session_id': 's1',
|
||||
'message_id': 'a1',
|
||||
'kind': 'text',
|
||||
'part': {'id': 'p2', 'type': 'text'},
|
||||
'delta': 'A live line arrived.',
|
||||
},
|
||||
}),
|
||||
);
|
||||
await tester.pump();
|
||||
await tester.pump();
|
||||
expect(find.text('A live line arrived.'), findsOneWidget);
|
||||
// A live frame updates the held thread.
|
||||
channel.incoming.add(
|
||||
jsonEncode({
|
||||
'type': 'chat_event',
|
||||
'chat_event': {
|
||||
'session_id': 's1',
|
||||
'message_id': 'a1',
|
||||
'kind': 'text',
|
||||
'part': {'id': 'p2', 'type': 'text'},
|
||||
'delta': 'A live line arrived.',
|
||||
},
|
||||
}),
|
||||
);
|
||||
await tester.pump();
|
||||
await tester.pump();
|
||||
expect(find.text('A live line arrived.'), findsOneWidget);
|
||||
|
||||
// The thread's own bar carries its controls once: no second bar.
|
||||
expect(find.byKey(const Key('chat-thread-header')), findsOneWidget);
|
||||
// Browser Back to /chat clears the open pane and keeps the list.
|
||||
await provider.didPushRouteInformation(
|
||||
RouteInformation(uri: Uri.parse('/chat')),
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
expect(provider.value.uri.path, '/chat');
|
||||
expect(find.byType(ChatThreadView), findsNothing);
|
||||
expect(find.byType(ChatSessionsScreen), findsOneWidget);
|
||||
expect(find.text('Wire chat'), findsOneWidget);
|
||||
expect(find.text('Select a chat to open it here.'), findsOneWidget);
|
||||
// The thread's own bar carries its controls once: no second bar.
|
||||
expect(find.byKey(const Key('chat-thread-header')), findsOneWidget);
|
||||
// Browser Back to /chat clears the open pane and keeps the list.
|
||||
await provider.didPushRouteInformation(
|
||||
RouteInformation(uri: Uri.parse('/chat')),
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
expect(provider.value.uri.path, '/chat');
|
||||
expect(find.byType(ChatThreadView), findsNothing);
|
||||
expect(find.byType(ChatSessionsScreen), findsOneWidget);
|
||||
expect(find.text('Wire chat'), findsOneWidget);
|
||||
expect(find.text('Select a chat to open it here.'), findsOneWidget);
|
||||
|
||||
// Browser Forward re-opens the same session through its route.
|
||||
await provider.didPushRouteInformation(
|
||||
RouteInformation(uri: Uri.parse('/chat/s1')),
|
||||
);
|
||||
await tester.pump();
|
||||
expect(provider.value.uri.path, '/chat/s1');
|
||||
await replySubscribe(tester, channel, index: 1);
|
||||
await replyHistory(
|
||||
tester,
|
||||
channel,
|
||||
index: 1,
|
||||
text: 'Reopened from the route.',
|
||||
);
|
||||
expect(find.text('Reopened from the route.'), findsOneWidget);
|
||||
// Browser Forward re-opens the same session through its route.
|
||||
await provider.didPushRouteInformation(
|
||||
RouteInformation(uri: Uri.parse('/chat/s1')),
|
||||
);
|
||||
await tester.pump();
|
||||
expect(provider.value.uri.path, '/chat/s1');
|
||||
await replySubscribe(tester, channel, index: 1);
|
||||
await replyHistory(
|
||||
tester,
|
||||
channel,
|
||||
index: 1,
|
||||
text: 'Reopened from the route.',
|
||||
);
|
||||
expect(find.text('Reopened from the route.'), findsOneWidget);
|
||||
|
||||
await tester.pumpWidget(const SizedBox.shrink());
|
||||
await tester.pump();
|
||||
},
|
||||
);
|
||||
}
|
||||
await tester.pumpWidget(const SizedBox.shrink());
|
||||
await tester.pump();
|
||||
},
|
||||
);
|
||||
|
||||
testWidgets(
|
||||
'mobile Chats retap reopens the retained multi-pane workspace after tabs',
|
||||
|
||||
Reference in New Issue
Block a user