chore(example): switch to connectAwaitable
That way it only acts connected when the credentials have been accepted. Also I had to correct the value of "allowPlainAuth" which should be true since a bug with it has been identified, and not yet fixed. Signed-off-by: Blake Leonard <me@blakes.dev>
This commit is contained in:
parent
7b215d5c6e
commit
60c89e28d3
@ -100,13 +100,22 @@ class _MyHomePageState extends State<MyHomePage> {
|
||||
jid: JID.fromString(jidController.text),
|
||||
password: passwordController.text,
|
||||
useDirectTLS: true,
|
||||
allowPlainAuth: false,
|
||||
allowPlainAuth: true,
|
||||
// otherwise, connecting to some servers will
|
||||
// cause an app to hang
|
||||
),
|
||||
);
|
||||
await connection.connect();
|
||||
setState(() {connected = true; loading = false;});
|
||||
final result = await connection.connectAwaitable();
|
||||
setState(() {connected = result.success; loading = false;});
|
||||
if (result.error != null) {
|
||||
print(result.error);
|
||||
if (context.mounted) {
|
||||
showDialog(context: context, builder: (_) => AlertDialog(
|
||||
title: const Text('Error'),
|
||||
content: Text(result.error.toString()),
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
|
Loading…
Reference in New Issue
Block a user