Retain boot chat deep links for Chats tab restore
This commit is contained in:
@@ -247,8 +247,8 @@ class _PipelinesAppState extends State<PipelinesApp>
|
||||
builder: _buildShell,
|
||||
);
|
||||
_delegate.addListener(_routeChanged);
|
||||
_tabRoutes[_destinationOf(_delegate.shellRoute.kind)] =
|
||||
_delegate.shellRoute;
|
||||
// Seed retained destinations for deep links as well as later navigation.
|
||||
_routeChanged();
|
||||
_chatQuestionNotices = ChatQuestionNotices(
|
||||
gateway: _session.gateway,
|
||||
canNotify: () => _notifications.canNotify,
|
||||
|
||||
@@ -33,3 +33,8 @@ The session-list refresh test answers the cached thread's outstanding network
|
||||
reads before refreshing, matching the client's serialized request protocol.
|
||||
Focused follow-up: 18 tests passed (`/tmp/memwatch/out.0cayzm`); no new product
|
||||
implementation changes were needed for these acceptance cases.
|
||||
|
||||
Boot deep links now seed the same retained route as later selections. A full-app
|
||||
regression opens `/chat/a` directly, folds from wide to phone, goes Back and
|
||||
retaps Chats; the conversation and original draft return. Six application
|
||||
chat-registration tests pass (`/tmp/memwatch/out.hPT6re`).
|
||||
|
||||
@@ -658,4 +658,52 @@ void main() {
|
||||
expect(tester.takeException(), isNull);
|
||||
},
|
||||
);
|
||||
testWidgets('Chats retap restores a boot deep link after folding and Back', (
|
||||
tester,
|
||||
) async {
|
||||
SharedPreferences.setMockInitialValues({});
|
||||
tester.view.physicalSize = const Size(1000, 1000);
|
||||
tester.view.devicePixelRatio = 1;
|
||||
addTearDown(tester.view.reset);
|
||||
final channel = FakeChannel()..readyCompleter.complete();
|
||||
final client = PipelinesClient(channelFactory: (_) => channel);
|
||||
final provider = PlatformRouteInformationProvider(
|
||||
initialRouteInformation: RouteInformation(uri: Uri.parse('/chat/a')),
|
||||
);
|
||||
addTearDown(provider.dispose);
|
||||
addTearDown(client.dispose);
|
||||
await tester.pumpWidget(
|
||||
PipelinesApp(
|
||||
server: webServer(),
|
||||
client: client,
|
||||
cupertino: false,
|
||||
routeInformationProvider: provider,
|
||||
),
|
||||
);
|
||||
await tester.pump();
|
||||
await replyChatSessions(tester, channel, ['a']);
|
||||
await replyChatHistory(tester, channel, subscribeIndex: 0, historyIndex: 0);
|
||||
await tester.pumpAndSettle();
|
||||
await tester.enterText(
|
||||
find.byKey(const Key('chat-composer-field')),
|
||||
'deep link draft',
|
||||
);
|
||||
tester.view.physicalSize = const Size(560, 1000);
|
||||
await tester.pumpAndSettle();
|
||||
await tester.tap(find.byTooltip('Back').hitTestable());
|
||||
await tester.pumpAndSettle();
|
||||
expect(provider.value.uri.path, '/chat');
|
||||
await tester.tap(find.byKey(const ValueKey('shell.destination.chat')));
|
||||
await tester.pumpAndSettle();
|
||||
expect(provider.value.uri.path, '/chat/a');
|
||||
expect(find.byType(ChatThreadView), findsOneWidget);
|
||||
expect(
|
||||
tester
|
||||
.widget<TextField>(find.byKey(const Key('chat-composer-field')))
|
||||
.controller!
|
||||
.text,
|
||||
'deep link draft',
|
||||
);
|
||||
expect(tester.takeException(), isNull);
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user