♻️ Add splash screen for loading data

This commit is contained in:
2024-12-14 01:32:13 +08:00
parent c7d5cb48ac
commit f763c7515a
13 changed files with 163 additions and 54 deletions

View File

@ -23,16 +23,13 @@ class WebSocketProvider extends ChangeNotifier {
WebSocketProvider(BuildContext context) {
_sn = context.read<SnNetworkProvider>();
_ua = context.read<UserProvider>();
}
// Wait for the userinfo provide initialize authorization status
Future.delayed(const Duration(milliseconds: 250), () async {
if (_ua.isAuthorized) {
log('[WebSocket] Connecting to the server...');
await connect();
} else {
log('[WebSocket] Unable connect to the server, unauthorized.');
}
});
Future<void> tryConnect() async {
if (!_ua.isAuthorized) return;
log('[WebSocket] Connecting to the server...');
await connect();
}
Future<void> connect({noRetry = false}) async {