chore: Update matrix und vrouter

This commit is contained in:
Christian Pauly 2021-07-08 17:10:20 +02:00
parent 37179a0665
commit fbc78119fa
35 changed files with 63 additions and 63 deletions

View File

@ -427,7 +427,7 @@ class ChatController extends State<Chat> {
};
}
setState(() => selectedEvents.clear());
VRouter.of(context).push('/rooms');
VRouter.of(context).to('/rooms');
}
void sendAgainAction() {
@ -594,7 +594,7 @@ class ChatController extends State<Chat> {
future: room.leave,
);
if (result.error == null) {
VRouter.of(context).push('/rooms/${result.result}');
VRouter.of(context).to('/rooms/${result.result}');
}
}

View File

@ -240,9 +240,9 @@ class ChatDetailsController extends State<ChatDetails> {
if ((room.states['im.ponies.room_emotes'] ?? <String, Event>{})
.keys
.any((String s) => s.isNotEmpty)) {
VRouter.of(context).push('/rooms/${room.id}/details/multiple_emotes');
VRouter.of(context).to('/rooms/${room.id}/details/multiple_emotes');
} else {
VRouter.of(context).push('/rooms/${room.id}/details/emotes');
VRouter.of(context).to('/rooms/${room.id}/details/emotes');
}
}

View File

@ -53,7 +53,7 @@ class ChatListController extends State<ChatList> {
await BootstrapDialog(
client: Matrix.of(context).client,
).show(context);
VRouter.of(context).push('/rooms');
VRouter.of(context).to('/rooms');
}
String get activeChat => VRouter.of(context).pathParameters['roomid'];
@ -66,7 +66,7 @@ class ChatListController extends State<ChatList> {
void _processIncomingSharedFiles(List<SharedMediaFile> files) {
if (files?.isEmpty ?? true) return;
VRouter.of(context).push('/rooms');
VRouter.of(context).to('/rooms');
final file = File(files.first.path);
Matrix.of(context).shareContent = {
@ -80,7 +80,7 @@ class ChatListController extends State<ChatList> {
void _processIncomingSharedText(String text) {
if (text == null) return;
VRouter.of(context).push('/rooms');
VRouter.of(context).to('/rooms');
if (text.toLowerCase().startsWith(AppConfig.inviteLinkPrefix) ||
(text.toLowerCase().startsWith(AppConfig.schemePrefix) &&
!RegExp(r'\s').hasMatch(text))) {
@ -97,7 +97,7 @@ class ChatListController extends State<ChatList> {
if (text.toLowerCase().startsWith(AppConfig.inviteLinkPrefix) ||
(text.toLowerCase().startsWith(AppConfig.schemePrefix) &&
!RegExp(r'\s').hasMatch(text))) {
VRouter.of(context).push('/rooms');
VRouter.of(context).to('/rooms');
UrlLauncher(context, text).openMatrixToUrl();
return;
}
@ -221,7 +221,7 @@ class ChatListController extends State<ChatList> {
setStatus();
break;
case PopupMenuAction.settings:
VRouter.of(context).push('/settings');
VRouter.of(context).to('/settings');
break;
case PopupMenuAction.invite:
FluffyShare.share(
@ -230,10 +230,10 @@ class ChatListController extends State<ChatList> {
context);
break;
case PopupMenuAction.newGroup:
VRouter.of(context).push('/newgroup');
VRouter.of(context).to('/newgroup');
break;
case PopupMenuAction.archive:
VRouter.of(context).push('/archive');
VRouter.of(context).to('/archive');
break;
}
}

View File

@ -64,7 +64,7 @@ class HomeserverPickerController extends State<HomeserverPicker> {
void _processIncomingUris(String text) async {
if (text == null || !text.startsWith(AppConfig.appOpenUrlScheme)) return;
VRouter.of(context).push('/home');
VRouter.of(context).to('/home');
final token = Uri.parse(text).queryParameters['loginToken'];
if (token != null) _loginWithToken(token);
}

View File

@ -21,7 +21,7 @@ class ImageViewerController extends State<ImageViewer> {
/// Forward this image to another room.
void forwardAction() {
Matrix.of(context).shareContent = widget.event.content;
VRouter.of(context).push('/rooms');
VRouter.of(context).to('/rooms');
}
/// Open this file with a system call.

View File

@ -32,7 +32,7 @@ class NewGroupController extends State<NewGroup> {
),
);
if (roomID.error == null) {
VRouter.of(context).push('/rooms/${roomID.result}/invite');
VRouter.of(context).to('/rooms/${roomID.result}/invite');
}
}

View File

@ -47,7 +47,7 @@ class NewPrivateChatController extends State<NewPrivateChat> {
);
if (roomID.error == null) {
VRouter.of(context).push('/rooms/${roomID.result}');
VRouter.of(context).to('/rooms/${roomID.result}');
}
}

View File

@ -78,7 +78,7 @@ class SearchController extends State<Search> {
),
);
if (success.error == null) {
VRouter.of(context).push('/rooms/${success.result}');
VRouter.of(context).to('/rooms/${success.result}');
}
}

View File

@ -84,7 +84,7 @@ class UserBottomSheetController extends State<UserBottomSheet> {
break;
case 'message':
final roomId = await widget.user.startDirectChat();
VRouter.of(widget.outerContext).push('/rooms/$roomId');
VRouter.of(widget.outerContext).to('/rooms/$roomId');
Navigator.of(context, rootNavigator: false).pop();
break;
}

View File

@ -53,7 +53,7 @@ class ChatDetailsView extends StatelessWidget {
leading: IconButton(
icon: Icon(Icons.close_outlined),
onPressed: () =>
VRouter.of(context).push('/rooms/${controller.roomId}'),
VRouter.of(context).to('/rooms/${controller.roomId}'),
),
elevation: Theme.of(context).appBarTheme.elevation,
expandedHeight: 300.0,
@ -313,8 +313,8 @@ class ChatDetailsView extends StatelessWidget {
foregroundColor: Colors.grey,
child: Icon(Icons.edit_attributes_outlined),
),
onTap: () => VRouter.of(context).push(
'/rooms/${room.id}/details/permissions'),
onTap: () => VRouter.of(context)
.to('/rooms/${room.id}/details/permissions'),
),
Divider(thickness: 1),
ListTile(
@ -341,7 +341,7 @@ class ChatDetailsView extends StatelessWidget {
child: Icon(Icons.add_outlined),
),
onTap: () => VRouter.of(context)
.push('/rooms/${room.id}/invite'),
.to('/rooms/${room.id}/invite'),
)
: Container(),
],

View File

@ -23,7 +23,7 @@ class ChatEncryptionSettingsView extends StatelessWidget {
leading: IconButton(
icon: Icon(Icons.close_outlined),
onPressed: () =>
VRouter.of(context).push('/rooms/${controller.roomId}'),
VRouter.of(context).to('/rooms/${controller.roomId}'),
),
title: Text(L10n.of(context).tapOnDeviceToVerify),
bottom: PreferredSize(

View File

@ -83,7 +83,7 @@ class ChatListView extends StatelessWidget {
icon: Icon(Icons.search_outlined),
tooltip: L10n.of(context).search,
onPressed: () =>
VRouter.of(context).push('/search'),
VRouter.of(context).to('/search'),
),
PopupMenuButton<PopupMenuAction>(
onSelected: controller.onPopupMenuSelect,
@ -295,7 +295,7 @@ class ChatListView extends StatelessWidget {
? FloatingActionButton(
heroTag: 'main_fab',
onPressed: () =>
VRouter.of(context).push('/newprivatechat'),
VRouter.of(context).to('/newprivatechat'),
child: Icon(CupertinoIcons.chat_bubble),
)
: null,

View File

@ -21,7 +21,7 @@ class ChatPermissionsSettingsView extends StatelessWidget {
leading: IconButton(
icon: Icon(Icons.close_outlined),
onPressed: () =>
VRouter.of(context).push('/rooms/${controller.roomId}'),
VRouter.of(context).to('/rooms/${controller.roomId}'),
),
title: Text(L10n.of(context).editChatPermissions),
),

View File

@ -90,7 +90,7 @@ class ChatView extends StatelessWidget {
),
)
: () => VRouter.of(context)
.push('/rooms/${controller.room.id}/details'),
.to('/rooms/${controller.room.id}/details'),
title: Text(
controller.room.getLocalizedDisplayname(
MatrixLocals(L10n.of(context))),

View File

@ -122,8 +122,8 @@ class HomeserverPickerView extends StatelessWidget {
child: Container(
height: 64,
child: OutlinedButton.icon(
onPressed: () => VRouter.of(context)
.push('/login'),
onPressed: () =>
VRouter.of(context).to('/login'),
icon: Icon(Icons.login_outlined),
label: Text(L10n.of(context).login),
),

View File

@ -24,7 +24,7 @@ class InvitationSelectionView extends StatelessWidget {
leading: IconButton(
icon: Icon(Icons.close_outlined),
onPressed: () =>
VRouter.of(context).push('/rooms/${controller.roomId}'),
VRouter.of(context).to('/rooms/${controller.roomId}'),
),
titleSpacing: 0,
title: DefaultAppBarSearchField(

View File

@ -22,7 +22,7 @@ class NewPrivateChatView extends StatelessWidget {
elevation: 0,
actions: [
TextButton(
onPressed: () => VRouter.of(context).push('/newgroup'),
onPressed: () => VRouter.of(context).to('/newgroup'),
child: Text(
L10n.of(context).createNewGroup,
style: TextStyle(color: Theme.of(context).colorScheme.secondary),

View File

@ -239,7 +239,7 @@ class SearchView extends StatelessWidget {
.startDirectChat(foundProfile.userId),
);
if (roomID.error == null) {
VRouter.of(context).push('/rooms/${roomID.result}');
VRouter.of(context).to('/rooms/${roomID.result}');
}
},
leading: Avatar(

View File

@ -36,7 +36,7 @@ class SettingsAccountView extends StatelessWidget {
ListTile(
trailing: Icon(Icons.devices_other_outlined),
title: Text(L10n.of(context).devices),
onTap: () => VRouter.of(context).push('devices'),
onTap: () => VRouter.of(context).to('devices'),
),
ListTile(
trailing: Icon(Icons.exit_to_app_outlined),

View File

@ -22,12 +22,12 @@ class SettingsChatView extends StatelessWidget {
children: [
ListTile(
title: Text(L10n.of(context).changeTheme),
onTap: () => VRouter.of(context).push('style'),
onTap: () => VRouter.of(context).to('style'),
trailing: Icon(Icons.style_outlined),
),
ListTile(
title: Text(L10n.of(context).emoteSettings),
onTap: () => VRouter.of(context).push('emotes'),
onTap: () => VRouter.of(context).to('emotes'),
trailing: Icon(Icons.insert_emoticon_outlined),
),
Divider(height: 1),

View File

@ -45,7 +45,7 @@ class MultipleEmotesSettingsView extends StatelessWidget {
title: Text(packName),
onTap: () async {
VRouter.of(context)
.push('/rooms/${room.id}/details/emotes/${keys[i]}');
.to('/rooms/${room.id}/details/emotes/${keys[i]}');
},
);
});

View File

@ -24,7 +24,7 @@ class SettingsSecurityView extends StatelessWidget {
ListTile(
trailing: Icon(Icons.block_outlined),
title: Text(L10n.of(context).ignoredUsers),
onTap: () => VRouter.of(context).push('ignorelist'),
onTap: () => VRouter.of(context).to('ignorelist'),
),
ListTile(
trailing: Icon(Icons.security_outlined),
@ -36,7 +36,7 @@ class SettingsSecurityView extends StatelessWidget {
ListTile(
trailing: Icon(Icons.email_outlined),
title: Text(L10n.of(context).passwordRecovery),
onTap: () => VRouter.of(context).push('3pid'),
onTap: () => VRouter.of(context).to('3pid'),
),
if (Matrix.of(context).client.encryption != null) ...{
Divider(thickness: 1),

View File

@ -40,22 +40,22 @@ class SettingsView extends StatelessWidget {
ListTile(
leading: Icon(Icons.notifications_outlined),
title: Text(L10n.of(context).notifications),
onTap: () => VRouter.of(context).push('/settings/notifications'),
onTap: () => VRouter.of(context).to('/settings/notifications'),
),
ListTile(
leading: Icon(Icons.chat_bubble_outline),
title: Text(L10n.of(context).chat),
onTap: () => VRouter.of(context).push('/settings/chat'),
onTap: () => VRouter.of(context).to('/settings/chat'),
),
ListTile(
leading: Icon(Icons.account_box_outlined),
title: Text(L10n.of(context).account),
onTap: () => VRouter.of(context).push('/settings/account'),
onTap: () => VRouter.of(context).to('/settings/account'),
),
ListTile(
leading: Icon(Icons.security_outlined),
title: Text(L10n.of(context).security),
onTap: () => VRouter.of(context).push('/settings/security'),
onTap: () => VRouter.of(context).to('/settings/security'),
),
Divider(thickness: 1),
ListTile(

View File

@ -283,7 +283,7 @@ class BackgroundPush {
if (router == null) {
return;
}
router.currentState.push('/rooms/$roomId');
router.currentState.to('/rooms/$roomId');
} catch (e, s) {
Logs().e('[Push] Failed to open room', e, s);
}

View File

@ -56,7 +56,7 @@ abstract class PlatformInfos {
child: Text(AppConfig.emojiFontName),
),
OutlinedButton(
onPressed: () => VRouter.of(context).push('logs'),
onPressed: () => VRouter.of(context).to('logs'),
child: Text('Logs'),
),
SentrySwitchListTile(label: L10n.of(context).sendBugReports),

View File

@ -62,9 +62,9 @@ class UrlLauncher {
// we have the room, so....just open it
if (event != null) {
VRouter.of(context)
.push('/rooms/${room.id}', queryParameters: {'event': event});
.to('/rooms/${room.id}', queryParameters: {'event': event});
} else {
VRouter.of(context).push('/rooms/${room.id}');
VRouter.of(context).to('/rooms/${room.id}');
}
return;
}
@ -89,13 +89,13 @@ class UrlLauncher {
context: context,
future: () => Future.delayed(const Duration(seconds: 2)));
if (event != null) {
VRouter.of(context).push('/rooms/${response.result}/$event');
VRouter.of(context).to('/rooms/${response.result}/$event');
} else {
VRouter.of(context).push('/rooms/${response.result}');
VRouter.of(context).to('/rooms/${response.result}');
}
}
} else {
VRouter.of(context).push('/search', queryParameters: {
VRouter.of(context).to('/search', queryParameters: {
if (roomIdOrAlias != null) 'query': roomIdOrAlias
});
}
@ -106,7 +106,7 @@ class UrlLauncher {
);
var roomId = matrix.client.getDirectChatFromUserId(user.id);
if (roomId != null) {
VRouter.of(context).push('/rooms/$roomId');
VRouter.of(context).to('/rooms/$roomId');
return;
}
@ -124,7 +124,7 @@ class UrlLauncher {
.result;
if (roomId != null) {
VRouter.of(context).push('/rooms/$roomId');
VRouter.of(context).to('/rooms/$roomId');
}
}
}

View File

@ -78,7 +78,7 @@ class _ChatSettingsPopupMenuState extends State<ChatSettingsPopupMenu> {
final success = await showFutureLoadingDialog(
context: context, future: () => widget.room.leave());
if (success.error == null) {
VRouter.of(context).push('/rooms');
VRouter.of(context).to('/rooms');
}
}
break;
@ -95,7 +95,7 @@ class _ChatSettingsPopupMenuState extends State<ChatSettingsPopupMenu> {
widget.room.setPushRuleState(PushRuleState.notify));
break;
case 'details':
VRouter.of(context).push('/rooms/${widget.room.id}/details');
VRouter.of(context).to('/rooms/${widget.room.id}/details');
break;
}
},

View File

@ -102,7 +102,7 @@ class _ContactListTile extends StatelessWidget {
fontWeight: FontWeight.bold,
)
: null),
onTap: () => VRouter.of(context).push(
onTap: () => VRouter.of(context).to(
'/rooms/${Matrix.of(context).client.getDirectChatFromUserId(contact.senderId)}'),
);
});

View File

@ -21,7 +21,7 @@ class _EncryptionButtonState extends State<EncryptionButton> {
void _enableEncryptionAction() async {
if (widget.room.encrypted) {
VRouter.of(context).push('/rooms/${widget.room.id}/encryption');
VRouter.of(context).to('/rooms/${widget.room.id}/encryption');
return;
}
if (widget.room.joinRules == JoinRules.public) {

View File

@ -9,7 +9,7 @@ class LoadingView extends StatelessWidget {
Widget build(BuildContext context) {
if (Matrix.of(context).loginState != null) {
WidgetsBinding.instance.addPostFrameCallback(
(_) => context.vRouter.push(
(_) => VRouter.of(context).to(
Matrix.of(context).loginState == LoginState.logged
? '/rooms'
: '/home',

View File

@ -105,7 +105,7 @@ class ChatListItem extends StatelessWidget {
}
Matrix.of(context).shareContent = null;
}
context.vRouter.push('/rooms/${room.id}');
VRouter.of(context).to('/rooms/${room.id}');
}
}
}

View File

@ -18,7 +18,7 @@ class PublicRoomListItem extends StatelessWidget {
future: () => _joinRoomAndWait(context),
);
if (success.error == null) {
VRouter.of(context).pushNamed('/rooms/${success.result}');
VRouter.of(context).toNamed('/rooms/${success.result}');
}
}

View File

@ -326,7 +326,7 @@ class MatrixState extends State<Matrix> with WidgetsBindingObserver {
.contains(widget.router.currentState.url);
if (widget.router.currentState.url == '/' ||
(state == LoginState.logged) == isInLoginRoutes) {
widget.router.currentState.push(
widget.router.currentState.to(
loginState == LoginState.logged ? '/rooms' : '/home',
queryParameters: widget.router.currentState.queryParameters,
);

View File

@ -589,7 +589,7 @@ packages:
name: matrix
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.5"
version: "0.1.6"
matrix_api_lite:
dependency: transitive
description:
@ -1170,7 +1170,7 @@ packages:
name: unifiedpush
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.6"
version: "1.0.3"
universal_html:
dependency: "direct main"
description:
@ -1268,7 +1268,7 @@ packages:
name: vrouter
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.4+16"
version: "1.2.0+4"
watcher:
dependency: transitive
description:

View File

@ -41,7 +41,7 @@ dependencies:
image_picker: ^0.7.4
intl: any
localstorage: ^4.0.0+1
matrix: ^0.1.5
matrix: ^0.1.6
mime_type: ^1.0.0
native_imaging:
git:
@ -64,7 +64,7 @@ dependencies:
unifiedpush: ^1.0.2
universal_html: ^2.0.8
url_launcher: ^6.0.3
vrouter: ^1.1.4+16
vrouter: ^1.2.0+4
dev_dependencies:
dapackages: ^1.6.0