🐛 Fix missing new publisher button

This commit is contained in:
2025-02-15 00:36:55 +08:00
parent 48b6d5f6c1
commit 5ddd4fed2e
4 changed files with 107 additions and 50 deletions

View File

@ -42,22 +42,22 @@ class WebSocketProvider extends ChangeNotifier {
_connectCompleter = null;
}
_connectCompleter = Completer<void>();
if (!_ua.isAuthorized) return;
if (isConnected || conn != null) {
disconnect();
}
final atk = await _sn.getFreshAtk();
final uri = Uri.parse(
'${_sn.client.options.baseUrl.replaceFirst('http', 'ws')}/ws?tk=$atk',
);
isBusy = true;
notifyListeners();
try {
_connectCompleter = Completer<void>();
final atk = await _sn.getFreshAtk();
final uri = Uri.parse(
'${_sn.client.options.baseUrl.replaceFirst('http', 'ws')}/ws?tk=$atk',
);
isBusy = true;
notifyListeners();
conn = WebSocketChannel.connect(uri);
await conn!.ready;
_wsStream = conn!.stream.asBroadcastStream();
@ -82,6 +82,7 @@ class WebSocketProvider extends ChangeNotifier {
isBusy = false;
notifyListeners();
_connectCompleter!.complete();
_connectCompleter = null;
}
}