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 {
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<App> with WidgetsBindingObserver {
if (wasPaused) {
globalIsAppInBackground = false;
twonlyDB.markUpdated();
apiService.connect();
apiService.connect(force: true);
}
} else if (state == AppLifecycleState.paused) {
wasPaused = true;

View file

@ -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;

View file

@ -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))),