diff --git a/lib/app.dart b/lib/app.dart index bc7d9cd..00e3852 100644 --- a/lib/app.dart +++ b/lib/app.dart @@ -72,7 +72,7 @@ class _AppState extends State with WidgetsBindingObserver { Future initAsync() async { setUserPlan(); - await apiService.connect(); + await apiService.connect(force: true); // call this function so invalid media files are get purged retryMediaUpload(true); } @@ -84,7 +84,7 @@ class _AppState extends State with WidgetsBindingObserver { if (wasPaused) { globalIsAppInBackground = false; twonlyDB.markUpdated(); - apiService.connect(); + apiService.connect(force: true); } } else if (state == AppLifecycleState.paused) { wasPaused = true; diff --git a/lib/src/services/api.service.dart b/lib/src/services/api.service.dart index fb5246f..d85efdc 100644 --- a/lib/src/services/api.service.dart +++ b/lib/src/services/api.service.dart @@ -142,6 +142,7 @@ class ApiService { String apiUrl = "ws$apiSecure://$apiHost/api/client"; Log.info("connecting to $apiUrl"); + if (await _connectTo(apiUrl)) { await onConnected(); return true; diff --git a/lib/src/views/settings/subscription/subscription.view.dart b/lib/src/views/settings/subscription/subscription.view.dart index ca9b617..028018e 100644 --- a/lib/src/views/settings/subscription/subscription.view.dart +++ b/lib/src/views/settings/subscription/subscription.view.dart @@ -561,7 +561,7 @@ Future redeemUserInviteCode(BuildContext context, String newPlan) async { ); // reconnect to load new plan. await apiService.close(() {}); - await apiService.connect(); + await apiService.connect(force: true); } else { ScaffoldMessenger.of(context).showSnackBar( SnackBar(content: Text(errorCodeToText(context, res.error))),