chore: format corrections, comment clarifications
Signed-off-by: Blake Leonard <me@blakes.dev>
This commit is contained in:
parent
f5059d8008
commit
2cdc56c882
@ -61,9 +61,10 @@ class _MyHomePageState extends State<MyHomePage> {
|
|||||||
final XmppConnection connection = XmppConnection(
|
final XmppConnection connection = XmppConnection(
|
||||||
RandomBackoffReconnectionPolicy(1, 60),
|
RandomBackoffReconnectionPolicy(1, 60),
|
||||||
AlwaysConnectedConnectivityManager(),
|
AlwaysConnectedConnectivityManager(),
|
||||||
//ExampleTcpSocketWrapper(), // this causes the app to crash
|
// The below causes the app to crash.
|
||||||
TCPSocketWrapper(
|
//ExampleTcpSocketWrapper(),
|
||||||
true), // Note: you probably want this to be false in a real app
|
// In a production app, the below should be false.
|
||||||
|
TCPSocketWrapper(true),
|
||||||
);
|
);
|
||||||
TextEditingController jidController = TextEditingController();
|
TextEditingController jidController = TextEditingController();
|
||||||
TextEditingController passwordController = TextEditingController();
|
TextEditingController passwordController = TextEditingController();
|
||||||
@ -109,9 +110,11 @@ class _MyHomePageState extends State<MyHomePage> {
|
|||||||
jid: JID.fromString(jidController.text),
|
jid: JID.fromString(jidController.text),
|
||||||
password: passwordController.text,
|
password: passwordController.text,
|
||||||
useDirectTLS: true,
|
useDirectTLS: true,
|
||||||
|
// If `allowPlainAuth` is `false`, connecting to some
|
||||||
|
// servers will cause apps to hang, and never connect.
|
||||||
|
// The hang is a bug that will be fixed, so when it is,
|
||||||
|
// allowPlainAuth should be set to false.
|
||||||
allowPlainAuth: true,
|
allowPlainAuth: true,
|
||||||
// otherwise, connecting to some servers will
|
|
||||||
// cause an app to hang
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
final result = await connection.connectAwaitable();
|
final result = await connection.connectAwaitable();
|
||||||
@ -123,11 +126,12 @@ class _MyHomePageState extends State<MyHomePage> {
|
|||||||
logger.severe(result.error);
|
logger.severe(result.error);
|
||||||
if (context.mounted) {
|
if (context.mounted) {
|
||||||
showDialog(
|
showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (_) => AlertDialog(
|
builder: (_) => AlertDialog(
|
||||||
title: const Text('Error'),
|
title: const Text('Error'),
|
||||||
content: Text(result.error.toString()),
|
content: Text(result.error.toString()),
|
||||||
));
|
),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user