Clean up
This commit is contained in:
parent
12f60d812a
commit
dbf472665a
|
@ -24,7 +24,6 @@ class _SignUpPasswordState extends State<SignUpPassword> {
|
||||||
String passwordError;
|
String passwordError;
|
||||||
bool loading = false;
|
bool loading = false;
|
||||||
bool showPassword = true;
|
bool showPassword = true;
|
||||||
int currentStage = 0;
|
|
||||||
|
|
||||||
void _signUpAction(BuildContext context, {Map<String, dynamic> auth}) async {
|
void _signUpAction(BuildContext context, {Map<String, dynamic> auth}) async {
|
||||||
MatrixState matrix = Matrix.of(context);
|
MatrixState matrix = Matrix.of(context);
|
||||||
|
@ -43,11 +42,6 @@ class _SignUpPasswordState extends State<SignUpPassword> {
|
||||||
setState(() => loading = true);
|
setState(() => loading = true);
|
||||||
Future<LoginState> waitForLogin =
|
Future<LoginState> waitForLogin =
|
||||||
matrix.client.onLoginStateChanged.stream.first;
|
matrix.client.onLoginStateChanged.stream.first;
|
||||||
if (auth == null) {
|
|
||||||
currentStage = 0;
|
|
||||||
} else {
|
|
||||||
currentStage++;
|
|
||||||
}
|
|
||||||
await matrix.client.register(
|
await matrix.client.register(
|
||||||
username: widget.username,
|
username: widget.username,
|
||||||
password: passwordController.text,
|
password: passwordController.text,
|
||||||
|
@ -63,9 +57,16 @@ class _SignUpPasswordState extends State<SignUpPassword> {
|
||||||
.firstWhere((a) => !a.stages.contains("m.login.email.identity"))
|
.firstWhere((a) => !a.stages.contains("m.login.email.identity"))
|
||||||
.stages;
|
.stages;
|
||||||
|
|
||||||
if (stages[currentStage] == "m.login.dummy") {
|
final String currentStage =
|
||||||
|
exception.completedAuthenticationFlows == null
|
||||||
|
? stages.first
|
||||||
|
: stages.firstWhere((stage) =>
|
||||||
|
!exception.completedAuthenticationFlows.contains(stage) ??
|
||||||
|
true);
|
||||||
|
|
||||||
|
if (currentStage == "m.login.dummy") {
|
||||||
_signUpAction(context, auth: {
|
_signUpAction(context, auth: {
|
||||||
"type": stages[currentStage],
|
"type": currentStage,
|
||||||
"session": exception.session,
|
"session": exception.session,
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
@ -73,7 +74,7 @@ class _SignUpPasswordState extends State<SignUpPassword> {
|
||||||
AppRoute.defaultRoute(
|
AppRoute.defaultRoute(
|
||||||
context,
|
context,
|
||||||
AuthWebView(
|
AuthWebView(
|
||||||
stages[currentStage],
|
currentStage,
|
||||||
exception.session,
|
exception.session,
|
||||||
() => _signUpAction(context, auth: {
|
() => _signUpAction(context, auth: {
|
||||||
"session": exception.session,
|
"session": exception.session,
|
||||||
|
|
Loading…
Reference in a new issue