fix: Buggy routing

This commit is contained in:
Christian Pauly 2021-04-09 15:54:54 +02:00
parent de9e3739fe
commit 62bf380e40

View File

@ -61,14 +61,10 @@ class FluffyRoutes {
} }
// Routes IF user is logged in // Routes IF user is logged in
else { else {
final activeRoomId = Matrix.of(context).client.activeRoomId;
switch (parts[1]) { switch (parts[1]) {
case '': case '':
return ViewData( return ViewData(
mainView: (_) => ChatList(), mainView: (_) => ChatList(), emptyView: (_) => EmptyPage());
emptyView: (_) =>
activeRoomId != null ? Chat(activeRoomId) : EmptyPage(),
);
case 'rooms': case 'rooms':
final roomId = parts[2]; final roomId = parts[2];
if (parts.length == 3) { if (parts.length == 3) {
@ -118,10 +114,7 @@ class FluffyRoutes {
} }
} }
return ViewData( return ViewData(
mainView: (_) => ChatList(), mainView: (_) => ChatList(), emptyView: (_) => EmptyPage());
emptyView: (_) =>
activeRoomId != null ? Chat(activeRoomId) : EmptyPage(),
);
case 'archive': case 'archive':
return ViewData( return ViewData(
leftView: (_) => Settings(), leftView: (_) => Settings(),
@ -144,16 +137,11 @@ class FluffyRoutes {
case 'search': case 'search':
if (parts.length == 3) { if (parts.length == 3) {
return ViewData( return ViewData(
mainView: (_) => SearchView(alias: parts[2]), mainView: (_) => SearchView(alias: parts[2]),
emptyView: (_) => emptyView: (_) => EmptyPage());
activeRoomId != null ? Chat(activeRoomId) : EmptyPage(),
);
} }
return ViewData( return ViewData(
mainView: (_) => SearchView(), mainView: (_) => SearchView(), emptyView: (_) => EmptyPage());
emptyView: (_) =>
activeRoomId != null ? Chat(activeRoomId) : EmptyPage(),
);
case 'settings': case 'settings':
if (parts.length == 3) { if (parts.length == 3) {
final action = parts[2]; final action = parts[2];
@ -196,16 +184,10 @@ class FluffyRoutes {
} }
} else { } else {
return ViewData( return ViewData(
mainView: (_) => Settings(), mainView: (_) => Settings(), emptyView: (_) => EmptyPage());
emptyView: (_) =>
activeRoomId != null ? Chat(activeRoomId) : EmptyPage(),
);
} }
return ViewData( return ViewData(
mainView: (_) => ChatList(), mainView: (_) => ChatList(), emptyView: (_) => EmptyPage());
emptyView: (_) =>
activeRoomId != null ? Chat(activeRoomId) : EmptyPage(),
);
} }
} }