Fix registration

This commit is contained in:
Christian Pauly 2020-01-29 10:36:30 +01:00
parent 7ce7d322ea
commit 8014bf7b10
3 changed files with 18 additions and 16 deletions

View file

@ -91,25 +91,27 @@ class _SignUpPasswordState extends State<SignUpPassword> {
setState(() => passwordError = exception.toString());
return setState(() => loading = false);
}
await matrix.client.onLoginStateChanged.stream
.firstWhere((l) => l == LoginState.logged);
try {
await matrix.client.setDisplayname(widget.displayname);
} catch (exception) {
Toast.show(I18n.of(context).couldNotSetDisplayname, context, duration: 5);
}
try {
await matrix.client.setAvatar(
MatrixFile(
bytes: await widget.avatar.readAsBytes(),
path: widget.avatar.path,
),
);
} catch (exception) {
Toast.show(I18n.of(context).couldNotSetAvatar, context, duration: 5);
}
if (matrix.client.isLogged()) {
await Navigator.of(context).pushAndRemoveUntil(
AppRoute.defaultRoute(context, ChatListView()), (r) => false);
if (widget.avatar != null) {
try {
await matrix.client.setAvatar(
MatrixFile(
bytes: await widget.avatar.readAsBytes(),
path: widget.avatar.path,
),
);
} catch (exception) {
Toast.show(I18n.of(context).couldNotSetAvatar, context, duration: 5);
}
}
await Navigator.of(context).pushAndRemoveUntil(
AppRoute.defaultRoute(context, ChatListView()), (r) => false);
setState(() => loading = false);
}

View file

@ -110,8 +110,8 @@ packages:
dependency: "direct main"
description:
path: "."
ref: "87f1a4ed99e067b184c99919656b1cde925f4a8f"
resolved-ref: "87f1a4ed99e067b184c99919656b1cde925f4a8f"
ref: "2e6a1ab4d4b4f9d635890610310f4b683853a549"
resolved-ref: "2e6a1ab4d4b4f9d635890610310f4b683853a549"
url: "https://gitlab.com/famedly/famedlysdk.git"
source: git
version: "0.0.1"

View file

@ -27,7 +27,7 @@ dependencies:
famedlysdk:
git:
url: https://gitlab.com/famedly/famedlysdk.git
ref: 87f1a4ed99e067b184c99919656b1cde925f4a8f
ref: 2e6a1ab4d4b4f9d635890610310f4b683853a549
localstorage: ^3.0.1+4
bubble: ^1.1.9+1