fix: Make tap on pills and matrix.to links work again

This commit is contained in:
Sorunome 2021-01-19 17:41:37 +01:00
parent 2c3c0dbdb2
commit 48ad322857
No known key found for this signature in database
GPG Key ID: B19471D07FC9BE9C
2 changed files with 34 additions and 18 deletions

View File

@ -82,45 +82,51 @@ class FluffyRoutes {
emptyView: (_) => EmptyPage(),
);
case 'rooms':
final roomId = parts[2];
if (parts.length == 3) {
return ViewData(
leftView: (_) => ChatList(activeChat: parts[2]),
mainView: (_) => Chat(parts[2]),
leftView: (_) => ChatList(activeChat: roomId),
mainView: (_) => Chat(roomId),
);
} else if (parts.length == 4) {
final roomId = parts[2];
final action = parts[3];
switch (action) {
case 'details':
return ViewData(
leftView: (_) => ChatList(activeChat: parts[2]),
mainView: (_) => Chat(parts[2]),
leftView: (_) => ChatList(activeChat: roomId),
mainView: (_) => Chat(roomId),
rightView: (_) => ChatDetails(roomId),
);
case 'encryption':
return ViewData(
leftView: (_) => ChatList(activeChat: parts[2]),
mainView: (_) => Chat(parts[2]),
leftView: (_) => ChatList(activeChat: roomId),
mainView: (_) => Chat(roomId),
rightView: (_) => ChatEncryptionSettings(roomId),
);
case 'permissions':
return ViewData(
leftView: (_) => ChatList(activeChat: parts[2]),
mainView: (_) => Chat(parts[2]),
leftView: (_) => ChatList(activeChat: roomId),
mainView: (_) => Chat(roomId),
rightView: (_) => ChatPermissionsSettings(roomId),
);
case 'invite':
return ViewData(
leftView: (_) => ChatList(activeChat: parts[2]),
mainView: (_) => Chat(parts[2]),
leftView: (_) => ChatList(activeChat: roomId),
mainView: (_) => Chat(roomId),
rightView: (_) => InvitationSelection(roomId),
);
case 'emotes':
return ViewData(
leftView: (_) => ChatList(activeChat: parts[2]),
mainView: (_) => Chat(parts[2]),
leftView: (_) => ChatList(activeChat: roomId),
mainView: (_) => Chat(roomId),
rightView: (_) => MultipleEmotesSettings(roomId),
);
default:
return ViewData(
leftView: (_) => ChatList(activeChat: roomId),
mainView: (_) => Chat(roomId,
scrollToEventId: action.sigil == '\$' ? action : null),
);
}
}
return ViewData(

View File

@ -71,9 +71,14 @@ class UrlLauncher {
}
}
if (room != null) {
// we have the room, so....just open it!
await AdaptivePageLayout.of(context)
.pushNamedAndRemoveUntilIsFirst('/rooms/${room.id}/$event');
// we have the room, so....just open it
if (event != null) {
await AdaptivePageLayout.of(context)
.pushNamedAndRemoveUntilIsFirst('/rooms/${room.id}/$event');
} else {
await AdaptivePageLayout.of(context)
.pushNamedAndRemoveUntilIsFirst('/rooms/${room.id}');
}
return;
}
if (roomIdOrAlias.sigil == '!') {
@ -95,8 +100,13 @@ class UrlLauncher {
await showFutureLoadingDialog(
context: context,
future: () => Future.delayed(const Duration(seconds: 2)));
await AdaptivePageLayout.of(context).pushNamedAndRemoveUntilIsFirst(
'/rooms/${response.result}/$event');
if (event != null) {
await AdaptivePageLayout.of(context).pushNamedAndRemoveUntilIsFirst(
'/rooms/${response.result}/$event');
} else {
await AdaptivePageLayout.of(context)
.pushNamedAndRemoveUntilIsFirst('/rooms/${response.result}');
}
}
} else {
await AdaptivePageLayout.of(context)