use force connect

This commit is contained in:
otsmr 2025-06-05 16:07:39 +02:00
parent 9a18062407
commit ab125042e2
3 changed files with 4 additions and 3 deletions

View file

@ -72,7 +72,7 @@ class _AppState extends State<App> with WidgetsBindingObserver {
Future initAsync() async { Future initAsync() async {
setUserPlan(); setUserPlan();
await apiService.connect(); await apiService.connect(force: true);
// call this function so invalid media files are get purged // call this function so invalid media files are get purged
retryMediaUpload(true); retryMediaUpload(true);
} }
@ -84,7 +84,7 @@ class _AppState extends State<App> with WidgetsBindingObserver {
if (wasPaused) { if (wasPaused) {
globalIsAppInBackground = false; globalIsAppInBackground = false;
twonlyDB.markUpdated(); twonlyDB.markUpdated();
apiService.connect(); apiService.connect(force: true);
} }
} else if (state == AppLifecycleState.paused) { } else if (state == AppLifecycleState.paused) {
wasPaused = true; wasPaused = true;

View file

@ -142,6 +142,7 @@ class ApiService {
String apiUrl = "ws$apiSecure://$apiHost/api/client"; String apiUrl = "ws$apiSecure://$apiHost/api/client";
Log.info("connecting to $apiUrl"); Log.info("connecting to $apiUrl");
if (await _connectTo(apiUrl)) { if (await _connectTo(apiUrl)) {
await onConnected(); await onConnected();
return true; return true;

View file

@ -561,7 +561,7 @@ Future redeemUserInviteCode(BuildContext context, String newPlan) async {
); );
// reconnect to load new plan. // reconnect to load new plan.
await apiService.close(() {}); await apiService.close(() {});
await apiService.connect(); await apiService.connect(force: true);
} else { } else {
ScaffoldMessenger.of(context).showSnackBar( ScaffoldMessenger.of(context).showSnackBar(
SnackBar(content: Text(errorCodeToText(context, res.error))), SnackBar(content: Text(errorCodeToText(context, res.error))),