@@ -97,22 +97,23 @@ class _InputWindowState extends State<InputWindow> {
9797
9898 _reconnectTimer = Timer .periodic (const Duration (seconds: 3 ), (_) async {
9999 if (! mounted) return ;
100- if (! ws.clientConnected) await connectWS ();
100+ if (! ws.clientConnected) connectWS ();
101101 });
102102 }
103103
104104 Future <void > connectWS () async {
105- debugPrint ("connectWS: connecting... now: ${ws .clientConnected }" );
106105 ws.client.connect ();
106+ final start = DateTime .now ();
107107 await Future .doWhile (() async {
108108 await Future .delayed (Duration (milliseconds: 10 ));
109- return ! ws.client.connected.value;
109+ return
110+ ! ws.clientConnected
111+ && DateTime .now ().difference (start) < const Duration (seconds: 3 );
110112 });
111- debugPrint ("connectWS: connected? ${ws .clientConnected }" );
112113 if (! ws.clientConnected) return ;
113114
114115 ws.client.sendSignal (MessageType .DATA_JSON );
115- while (mounted && ! ws.client.boss.value) {
116+ while (mounted && ! ws.client.boss.value && ws.client.connected.value ) {
116117 ws.client.sendSignal (MessageType .IM_THE_BOSS );
117118 await Future .delayed (Duration (seconds: 10 ));
118119 }
@@ -160,8 +161,8 @@ class _InputWindowState extends State<InputWindow> {
160161 end = await dialog (
161162 "Spieltag beenden?" ,
162163 "Es sieht so aus, als würde das aktuelle Spiel noch laufen.\n "
163- "Bist du sicher, dass du den Spieltag trotzdem beenden willst?\n "
164- "Die Ergebnisse werden gespeichert und du kannst jederzeit zurückgehen, allerdings wird die Zeit gestoppt!" ,
164+ "Bist du sicher, dass du den Spieltag trotzdem beenden willst?\n\n "
165+ "Die Ergebnisse werden gespeichert und du kannst jederzeit zurückgehen, aber die Zeit wird gestoppt!" ,
165166 ["Hier bleiben" , "Trotzem beenden" ]
166167 ) == 1 ? true : false ;
167168 }
0 commit comments