From 2cdc56c8825ac8e0e9f6ff220085efaf50b6a7a6 Mon Sep 17 00:00:00 2001 From: Blake Leonard Date: Fri, 10 Mar 2023 13:29:30 -0500 Subject: [PATCH] chore: format corrections, comment clarifications Signed-off-by: Blake Leonard --- example/lib/main.dart | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/example/lib/main.dart b/example/lib/main.dart index 9d1b4bb..3a3bb48 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -61,9 +61,10 @@ class _MyHomePageState extends State { final XmppConnection connection = XmppConnection( RandomBackoffReconnectionPolicy(1, 60), AlwaysConnectedConnectivityManager(), - //ExampleTcpSocketWrapper(), // this causes the app to crash - TCPSocketWrapper( - true), // Note: you probably want this to be false in a real app + // The below causes the app to crash. + //ExampleTcpSocketWrapper(), + // In a production app, the below should be false. + TCPSocketWrapper(true), ); TextEditingController jidController = TextEditingController(); TextEditingController passwordController = TextEditingController(); @@ -109,9 +110,11 @@ class _MyHomePageState extends State { jid: JID.fromString(jidController.text), password: passwordController.text, 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, - // otherwise, connecting to some servers will - // cause an app to hang ), ); final result = await connection.connectAwaitable(); @@ -123,11 +126,12 @@ class _MyHomePageState extends State { logger.severe(result.error); if (context.mounted) { showDialog( - context: context, - builder: (_) => AlertDialog( - title: const Text('Error'), - content: Text(result.error.toString()), - )); + context: context, + builder: (_) => AlertDialog( + title: const Text('Error'), + content: Text(result.error.toString()), + ), + ); } } }