mirror of
https://github.com/twonlyapp/twonly-app.git
synced 2026-01-15 11:18:41 +00:00
use force connect
This commit is contained in:
parent
9a18062407
commit
ab125042e2
3 changed files with 4 additions and 3 deletions
|
|
@ -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;
|
||||||
|
|
|
||||||
|
|
@ -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;
|
||||||
|
|
|
||||||
|
|
@ -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))),
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue