mirror of
https://gitlab.com/famedly/fluffychat.git
synced 2024-12-29 01:22:37 +01:00
Merge branch 'soru/escape-routes' into 'main'
fix: Properly encode and decode vRouter paths See merge request famedly/fluffychat!487
This commit is contained in:
commit
e05a99293a
@ -139,7 +139,7 @@ class AppRoutes {
|
||||
nestedRoutes: [
|
||||
VWidget(
|
||||
path: '',
|
||||
widget: EmptyPage(),
|
||||
widget: Chat(),
|
||||
buildTransition: _fadeTransition,
|
||||
),
|
||||
VWidget(
|
||||
|
@ -620,7 +620,7 @@ class ChatController extends State<Chat> {
|
||||
future: room.leave,
|
||||
);
|
||||
if (result.error == null) {
|
||||
VRouter.of(context).to('/rooms/${result.result}');
|
||||
VRouter.of(context).toSegments(['rooms', result.result]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -60,7 +60,7 @@ class ChatListController extends State<ChatList> {
|
||||
void editSpace(BuildContext context, String spaceId) async {
|
||||
Scaffold.of(context).openEndDrawer();
|
||||
await Matrix.of(context).client.getRoomById(spaceId).postLoad();
|
||||
VRouter.of(context).to('/spaces/$spaceId');
|
||||
VRouter.of(context).toSegments(['spaces', spaceId]);
|
||||
}
|
||||
|
||||
List<Room> get spaces =>
|
||||
|
@ -32,7 +32,7 @@ class NewGroupController extends State<NewGroup> {
|
||||
),
|
||||
);
|
||||
if (roomID.error == null) {
|
||||
VRouter.of(context).to('/rooms/${roomID.result}/invite');
|
||||
VRouter.of(context).toSegments(['rooms', roomID.result, 'invite']);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -47,7 +47,7 @@ class NewPrivateChatController extends State<NewPrivateChat> {
|
||||
);
|
||||
|
||||
if (roomID.error == null) {
|
||||
VRouter.of(context).to('/rooms/${roomID.result}');
|
||||
VRouter.of(context).toSegments(['rooms', roomID.result]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -34,7 +34,7 @@ class NewSpaceController extends State<NewSpace> {
|
||||
),
|
||||
);
|
||||
if (roomID.error == null) {
|
||||
VRouter.of(context).to('/rooms/${roomID.result}/details');
|
||||
VRouter.of(context).toSegments(['rooms', roomID.result, 'details']);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -77,7 +77,7 @@ class SearchController extends State<Search> {
|
||||
),
|
||||
);
|
||||
if (success.error == null) {
|
||||
VRouter.of(context).to('/rooms/${success.result}');
|
||||
VRouter.of(context).toSegments(['rooms', success.result]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -88,7 +88,8 @@ class UserBottomSheetController extends State<UserBottomSheet> {
|
||||
future: () => widget.user.startDirectChat(),
|
||||
);
|
||||
if (roomIdResult.error != null) return;
|
||||
VRouter.of(widget.outerContext).to('/rooms/${roomIdResult.result}');
|
||||
VRouter.of(widget.outerContext)
|
||||
.toSegments(['rooms', roomIdResult.result]);
|
||||
Navigator.of(context, rootNavigator: false).pop();
|
||||
break;
|
||||
}
|
||||
|
@ -52,11 +52,11 @@ class ChatDetailsView extends StatelessWidget {
|
||||
SliverAppBar(
|
||||
leading: IconButton(
|
||||
icon: Icon(Icons.close_outlined),
|
||||
onPressed: () => VRouter.of(context)
|
||||
.path
|
||||
.startsWith('/spaces/')
|
||||
? VRouter.of(context).pop()
|
||||
: VRouter.of(context).to('/rooms/${controller.roomId}'),
|
||||
onPressed: () =>
|
||||
VRouter.of(context).path.startsWith('/spaces/')
|
||||
? VRouter.of(context).pop()
|
||||
: VRouter.of(context)
|
||||
.toSegments(['rooms', controller.roomId]),
|
||||
),
|
||||
elevation: Theme.of(context).appBarTheme.elevation,
|
||||
expandedHeight: 300.0,
|
||||
@ -264,7 +264,8 @@ class ChatDetailsView extends StatelessWidget {
|
||||
.visibilityOfTheChatHistory),
|
||||
subtitle: Text(
|
||||
room.historyVisibility.getLocalizedString(
|
||||
MatrixLocals(L10n.of(context))),
|
||||
MatrixLocals(L10n.of(context))) ??
|
||||
'',
|
||||
),
|
||||
),
|
||||
),
|
||||
|
@ -23,7 +23,7 @@ class ChatEncryptionSettingsView extends StatelessWidget {
|
||||
leading: IconButton(
|
||||
icon: Icon(Icons.close_outlined),
|
||||
onPressed: () =>
|
||||
VRouter.of(context).to('/rooms/${controller.roomId}'),
|
||||
VRouter.of(context).toSegments(['rooms', controller.roomId]),
|
||||
),
|
||||
title: Text(L10n.of(context).tapOnDeviceToVerify),
|
||||
bottom: PreferredSize(
|
||||
|
@ -22,8 +22,8 @@ class ChatPermissionsSettingsView extends StatelessWidget {
|
||||
? null
|
||||
: IconButton(
|
||||
icon: Icon(Icons.close_outlined),
|
||||
onPressed: () =>
|
||||
VRouter.of(context).to('/rooms/${controller.roomId}'),
|
||||
onPressed: () => VRouter.of(context)
|
||||
.toSegments(['rooms', controller.roomId]),
|
||||
),
|
||||
title: Text(L10n.of(context).editChatPermissions),
|
||||
),
|
||||
|
@ -98,8 +98,8 @@ class ChatView extends StatelessWidget {
|
||||
'${controller.room.getUserByMXIDSync(controller.room.directChatMatrixID).mention} ',
|
||||
),
|
||||
)
|
||||
: () => VRouter.of(context)
|
||||
.to('/rooms/${controller.room.id}/details'),
|
||||
: () => VRouter.of(context).toSegments(
|
||||
['rooms', controller.room.id, 'details']),
|
||||
title: Text(
|
||||
controller.room.getLocalizedDisplayname(
|
||||
MatrixLocals(L10n.of(context))),
|
||||
|
@ -25,8 +25,8 @@ class InvitationSelectionView extends StatelessWidget {
|
||||
? null
|
||||
: IconButton(
|
||||
icon: Icon(Icons.close_outlined),
|
||||
onPressed: () =>
|
||||
VRouter.of(context).to('/rooms/${controller.roomId}'),
|
||||
onPressed: () => VRouter.of(context)
|
||||
.toSegments(['rooms', controller.roomId]),
|
||||
),
|
||||
titleSpacing: 0,
|
||||
title: DefaultAppBarSearchField(
|
||||
|
@ -238,7 +238,8 @@ class SearchView extends StatelessWidget {
|
||||
.startDirectChat(foundProfile.userId),
|
||||
);
|
||||
if (roomID.error == null) {
|
||||
VRouter.of(context).to('/rooms/${roomID.result}');
|
||||
VRouter.of(context)
|
||||
.toSegments(['rooms', roomID.result]);
|
||||
}
|
||||
},
|
||||
leading: Avatar(
|
||||
|
@ -44,8 +44,8 @@ class MultipleEmotesSettingsView extends StatelessWidget {
|
||||
return ListTile(
|
||||
title: Text(packName),
|
||||
onTap: () async {
|
||||
VRouter.of(context)
|
||||
.to('/rooms/${room.id}/details/emotes/${keys[i]}');
|
||||
VRouter.of(context).toSegments(
|
||||
['rooms', room.id, 'details', 'emotes', keys[i]]);
|
||||
},
|
||||
);
|
||||
});
|
||||
|
@ -283,7 +283,7 @@ class BackgroundPush {
|
||||
if (router == null) {
|
||||
return;
|
||||
}
|
||||
router.currentState.to('/rooms/$roomId');
|
||||
router.currentState.toSegments(['rooms', roomId]);
|
||||
} catch (e, s) {
|
||||
Logs().e('[Push] Failed to open room', e, s);
|
||||
}
|
||||
|
@ -110,10 +110,10 @@ class UrlLauncher {
|
||||
if (room != null) {
|
||||
// we have the room, so....just open it
|
||||
if (event != null) {
|
||||
VRouter.of(context)
|
||||
.to('/rooms/${room.id}', queryParameters: {'event': event});
|
||||
VRouter.of(context).toSegments(['rooms', room.id],
|
||||
queryParameters: {'event': event});
|
||||
} else {
|
||||
VRouter.of(context).to('/rooms/${room.id}');
|
||||
VRouter.of(context).toSegments(['rooms', room.id]);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@ -138,9 +138,10 @@ class UrlLauncher {
|
||||
context: context,
|
||||
future: () => Future.delayed(const Duration(seconds: 2)));
|
||||
if (event != null) {
|
||||
VRouter.of(context).to('/rooms/${response.result}/$event');
|
||||
VRouter.of(context).toSegments(['rooms', response.result],
|
||||
queryParameters: {'event': event});
|
||||
} else {
|
||||
VRouter.of(context).to('/rooms/${response.result}');
|
||||
VRouter.of(context).toSegments(['rooms', response.result]);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@ -155,7 +156,7 @@ class UrlLauncher {
|
||||
);
|
||||
var roomId = matrix.client.getDirectChatFromUserId(user.id);
|
||||
if (roomId != null) {
|
||||
VRouter.of(context).to('/rooms/$roomId');
|
||||
VRouter.of(context).toSegments(['rooms', roomId]);
|
||||
|
||||
return;
|
||||
}
|
||||
@ -173,7 +174,7 @@ class UrlLauncher {
|
||||
.result;
|
||||
|
||||
if (roomId != null) {
|
||||
VRouter.of(context).to('/rooms/$roomId');
|
||||
VRouter.of(context).toSegments(['rooms', roomId]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -95,7 +95,8 @@ class _ChatSettingsPopupMenuState extends State<ChatSettingsPopupMenu> {
|
||||
widget.room.setPushRuleState(PushRuleState.notify));
|
||||
break;
|
||||
case 'details':
|
||||
VRouter.of(context).to('/rooms/${widget.room.id}/details');
|
||||
VRouter.of(context)
|
||||
.toSegments(['rooms', widget.room.id, 'details']);
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
@ -102,8 +102,12 @@ class _ContactListTile extends StatelessWidget {
|
||||
fontWeight: FontWeight.bold,
|
||||
)
|
||||
: null),
|
||||
onTap: () => VRouter.of(context).to(
|
||||
'/rooms/${Matrix.of(context).client.getDirectChatFromUserId(contact.senderId)}'),
|
||||
onTap: () => VRouter.of(context).toSegments([
|
||||
'rooms',
|
||||
Matrix.of(context)
|
||||
.client
|
||||
.getDirectChatFromUserId(contact.senderId)
|
||||
]),
|
||||
);
|
||||
});
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ class _EncryptionButtonState extends State<EncryptionButton> {
|
||||
|
||||
void _enableEncryptionAction() async {
|
||||
if (widget.room.encrypted) {
|
||||
VRouter.of(context).to('/rooms/${widget.room.id}/encryption');
|
||||
VRouter.of(context).toSegments(['rooms', widget.room.id, 'encryption']);
|
||||
return;
|
||||
}
|
||||
if (widget.room.joinRules == JoinRules.public) {
|
||||
|
@ -112,7 +112,7 @@ class ChatListItem extends StatelessWidget {
|
||||
}
|
||||
Matrix.of(context).shareContent = null;
|
||||
}
|
||||
VRouter.of(context).to('/rooms/${room.id}');
|
||||
VRouter.of(context).toSegments(['rooms', room.id]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ class PublicRoomListItem extends StatelessWidget {
|
||||
future: () => _joinRoomAndWait(context),
|
||||
);
|
||||
if (success.error == null) {
|
||||
VRouter.of(context).toNamed('/rooms/${success.result}');
|
||||
VRouter.of(context).toSegments(['rooms', success.result]);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user