From f68dd7a1f679a85c31ed4089bfeb9adeb75e951d Mon Sep 17 00:00:00 2001 From: Daniel Ponte Date: Thu, 24 Oct 2024 20:00:19 -0400 Subject: [PATCH] wip --- lib/controller/stillbox.dart | 6 ++++-- lib/views/radio.dart | 6 +++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/controller/stillbox.dart b/lib/controller/stillbox.dart index fb1e09d..9475eff 100644 --- a/lib/controller/stillbox.dart +++ b/lib/controller/stillbox.dart @@ -81,9 +81,11 @@ class Stillbox extends ChangeNotifier { } try { await connect(); - } on WebSocketChannelException catch(e) { + } on WebSocketChannelException catch (e) { return false; } + + return true; } return false; } @@ -95,7 +97,7 @@ class Stillbox extends ChangeNotifier { channel.connect(_wsUri); try { await channel.channel?.ready; - } on WebSocketChannelException catch(e) { + } on WebSocketChannelException catch (e) { _handleError(e); } channel.stream.listen((event) => _handleData(event), diff --git a/lib/views/radio.dart b/lib/views/radio.dart index 22e1c9c..a70674d 100644 --- a/lib/views/radio.dart +++ b/lib/views/radio.dart @@ -53,6 +53,7 @@ class _MainRadioState extends State { }); } }); + sb.callQStream.stream.listen((ctAdd) { setState(() { queueLen += ctAdd; @@ -62,7 +63,7 @@ class _MainRadioState extends State { _callLoop(sb); } - void _handleSocketError(dynamic error) { + void _handleSocketError(Exception error) { Navigator.pushReplacement( context, PageRouteBuilder( @@ -73,6 +74,9 @@ class _MainRadioState extends State { transitionDuration: const Duration(milliseconds: 0), ), ); + ScaffoldMessenger.of(context).showSnackBar( + SnackBar(content: Text(error)), + ); } void _callLoop(Stillbox sb) async {