@@ -156,13 +156,6 @@ class VPN {
156156 connectionNotifier? .setLoading ();
157157 });
158158
159- WidgetsBinding .instance.addPostFrameCallback ((_) {
160- connectionNotifier? .setAnalyzing ();
161- });
162- WidgetsBinding .instance.addPostFrameCallback ((_) {
163- loggerNotifier? .setLoading ();
164- });
165-
166159 alertService.heartbeat ();
167160
168161 final networkIsConnected = await _networkStatus.checkConnectivity ();
@@ -186,6 +179,10 @@ class VPN {
186179 analyticsService.logVpnConnectAttempt (pattern.isEmpty ? 'auto' : pattern);
187180
188181 await _vpnBridge.startVPN (flowLineStorage, pattern);
182+ WidgetsBinding .instance.addPostFrameCallback ((_) {
183+ loggerNotifier? .setLoading ();
184+ connectionNotifier? .setAnalyzing ();
185+ });
189186 }
190187
191188 Future <void > _onFailerConnect () async {
@@ -226,12 +223,12 @@ class VPN {
226223 analyticsService.logVpnConnected (
227224 pattern, groupState? .groupName, connectionDuration);
228225
229- await _container? .read (flowlineServiceProvider).saveFlowline ();
226+ await _container? .read (flowlineServiceProvider).saveFlowline (false );
230227 }
231228
232229 Future <void > refreshPing () async {
233- _container? .read (pingLoadingProvider.notifier).state = true ;
234230 _container? .read (flagLoadingProvider.notifier).state = true ;
231+ _container? .read (pingLoadingProvider.notifier).state = true ;
235232 _container? .read (pingProvider.notifier).state =
236233 await _networkStatus.getPing ();
237234 _container? .read (pingLoadingProvider.notifier).state = false ;
@@ -324,7 +321,6 @@ class VPN {
324321 case ConnectionStatus .connected:
325322 await _disconnect (ref);
326323 return ;
327- case ConnectionStatus .loading:
328324 case ConnectionStatus .analyzing:
329325 await _stopVPN (ref);
330326 return ;
@@ -333,6 +329,7 @@ class VPN {
333329 case ConnectionStatus .noInternet:
334330 await _connect ();
335331 return ;
332+ case ConnectionStatus .loading:
336333 default :
337334 break ;
338335 }
@@ -351,8 +348,11 @@ class VPN {
351348 }
352349
353350 Future <void > initVPN () async {
351+ _container? .read (settingsLoadingProvider.notifier).state = true ;
352+ await _container? .read (flowlineServiceProvider).saveFlowline (true );
354353 await _vpnBridge.setAsnName ();
355- await _container? .read (flowlineServiceProvider).saveFlowline ();
354+ await _container? .read (flowlineServiceProvider).saveFlowline (false );
355+ _container? .read (settingsLoadingProvider.notifier).state = false ;
356356 }
357357
358358 Future <void > _updatePing () async {
0 commit comments