diff --git a/api/Nexus/Check Status.bru b/api/Nexus/Check Status.bru new file mode 100644 index 0000000..b0cb454 --- /dev/null +++ b/api/Nexus/Check Status.bru @@ -0,0 +1,11 @@ +meta { + name: Check Status + type: http + seq: 1 +} + +get { + url: {{endpoint}}/directory/status + body: none + auth: none +} diff --git a/api/Nexus/List Services.bru b/api/Nexus/List Services.bru new file mode 100644 index 0000000..1169f14 --- /dev/null +++ b/api/Nexus/List Services.bru @@ -0,0 +1,11 @@ +meta { + name: List Services + type: http + seq: 2 +} + +get { + url: {{endpoint}}/directory/services + body: none + auth: none +} diff --git a/lib/controllers/chat_message_controller.dart b/lib/controllers/chat_message_controller.dart index f38106c..faed2a2 100644 --- a/lib/controllers/chat_message_controller.dart +++ b/lib/controllers/chat_message_controller.dart @@ -38,6 +38,7 @@ class ChatMessageController extends ChangeNotifier { bool isPending = true; bool isLoading = false; + bool isAggressiveLoading = false; int? messageTotal; @@ -320,7 +321,7 @@ class ChatMessageController extends ChangeNotifier { /// Check the local storage is up to date with the server. /// If the local storage is not up to date, it will be updated. Future checkUpdate() async { - isLoading = true; + isAggressiveLoading = true; notifyListeners(); final mostRecentMessage = await (_dt.db.snLocalChatMessage.select() @@ -357,7 +358,7 @@ class ChatMessageController extends ChangeNotifier { rethrow; } finally { await loadMessages(); - isLoading = false; + isAggressiveLoading = false; isCheckedUpdate = true; _saveMessageToLocal(incomeStrandedQueue).then((_) { diff --git a/lib/providers/websocket.dart b/lib/providers/websocket.dart index fe8ea24..5620939 100644 --- a/lib/providers/websocket.dart +++ b/lib/providers/websocket.dart @@ -39,7 +39,7 @@ class WebSocketProvider extends ChangeNotifier { Future connect({noRetry = false}) async { if (_connectCompleter != null) { await _connectCompleter!.future; - _connectCompleter = null; + return; } if (!_ua.isAuthorized) return; diff --git a/lib/screens/chat/room.dart b/lib/screens/chat/room.dart index 64ac6b4..a1b6afa 100644 --- a/lib/screens/chat/room.dart +++ b/lib/screens/chat/room.dart @@ -89,6 +89,12 @@ class _ChatRoomScreenState extends State { if (!mounted) return; final nty = context.read(); nty.skippableNotifyChannel = _channel!.id; + final ws = context.read(); + if (_channel != null) { + ws.conn?.sink.add({ + 'channel_id': _channel?.id, + }); + } } catch (err) { if (!mounted) return; context.showErrorDialog(err); @@ -239,6 +245,12 @@ class _ChatRoomScreenState extends State { _messageController.dispose(); final nty = context.read(); nty.skippableNotifyChannel = null; + final ws = context.read(); + if (_channel != null) { + ws.conn?.sink.add({ + 'channel_id': _channel?.id, + }); + } super.dispose(); } @@ -289,7 +301,9 @@ class _ChatRoomScreenState extends State { builder: (context, _) { return Column( children: [ - LoadingIndicator(isActive: _isBusy), + LoadingIndicator( + isActive: _isBusy || _messageController.isAggressiveLoading, + ), SingleChildScrollView( physics: const NeverScrollableScrollPhysics(), child: MaterialBanner( @@ -315,8 +329,8 @@ class _ChatRoomScreenState extends State { if (_messageController.isPending) Expanded( child: const CircularProgressIndicator().center(), - ), - if (!_messageController.isPending) + ) + else Expanded( child: InfiniteList( reverse: true,