From 99e0f9ae91aca62dc43a19257bc429c8fba2783f Mon Sep 17 00:00:00 2001 From: zontreck Date: Tue, 2 Jul 2024 16:36:27 -0700 Subject: [PATCH] Verbose retry counter --- lib/main.dart | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/lib/main.dart b/lib/main.dart index 29edbf0..d1f260a 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -83,9 +83,16 @@ class ServerPage extends StatelessWidget { ScaffoldMessenger.of(context).showSnackBar(SnackBar( content: Text("Login Success - Downloading remote Settings"))); + + int retryCount = 0; while (true) { try { - await Future.delayed(Duration(seconds: 5)); + if (retryCount > 0) + ScaffoldMessenger.of(context).showSnackBar(SnackBar( + content: Text( + "> Retrying to download settings in 10 seconds (Attempt $retryCount"))); + + await Future.delayed(Duration(seconds: 10)); S2CResponse settingsData = await settings.client! .send(C2SRequestSettingsPacket(), true); C2SRequestSettingsPacket settingsBack = @@ -93,7 +100,9 @@ class ServerPage extends StatelessWidget { settingsBack.decodeTag(settingsData.contents); settingsBack.handleClientPacket(); break; - } catch (E) {} + } catch (E) { + retryCount++; + } } Navigator.pushNamed(context, "/home");