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()); setState(() => passwordError = exception.toString());
return setState(() => loading = false); return setState(() => loading = false);
} }
await matrix.client.onLoginStateChanged.stream
.firstWhere((l) => l == LoginState.logged);
try { try {
await matrix.client.setDisplayname(widget.displayname); await matrix.client.setDisplayname(widget.displayname);
} catch (exception) { } catch (exception) {
Toast.show(I18n.of(context).couldNotSetDisplayname, context, duration: 5); Toast.show(I18n.of(context).couldNotSetDisplayname, context, duration: 5);
} }
try { if (widget.avatar != null) {
await matrix.client.setAvatar( try {
MatrixFile( await matrix.client.setAvatar(
bytes: await widget.avatar.readAsBytes(), MatrixFile(
path: widget.avatar.path, bytes: await widget.avatar.readAsBytes(),
), path: widget.avatar.path,
); ),
} catch (exception) { );
Toast.show(I18n.of(context).couldNotSetAvatar, context, duration: 5); } 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);
} }
await Navigator.of(context).pushAndRemoveUntil(
AppRoute.defaultRoute(context, ChatListView()), (r) => false);
setState(() => loading = false); setState(() => loading = false);
} }

View File

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

View File

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