Исправлено падение приложения из-за попытки сделать запрос к бд, после закрытия соединения с ней
This commit is contained in:
@@ -40,11 +40,11 @@ logout(BuildContext context, SqliteHelper helper) async {
|
||||
if (token != null) {
|
||||
getDeleteTokenRequest(token).then((response) {
|
||||
helper.clear().then((result) {
|
||||
helper.close().then((_) {
|
||||
// helper.close().then((_) {
|
||||
Navigator.of(context).pop();
|
||||
Navigator.of(context).pop();
|
||||
pushRouteReplacement(context, new SplashScreen()); // Запускаем регистрацию
|
||||
});
|
||||
// });
|
||||
});
|
||||
}).catchError((error) {
|
||||
print(error.toString());
|
||||
@@ -63,12 +63,12 @@ forceLogout(String token , BuildContext context) async {
|
||||
SqliteHelper helper = new SqliteHelper();
|
||||
helper.open().then((_) {
|
||||
helper.clear().then((_) {
|
||||
helper.close().then((_) {
|
||||
// helper.close().then((_) {
|
||||
while (Navigator.of(context).canPop()) {
|
||||
Navigator.of(context).pop();
|
||||
}
|
||||
pushRouteReplacement(context, new SplashScreen());
|
||||
});
|
||||
// });
|
||||
});
|
||||
});
|
||||
}).catchError((error) {
|
||||
@@ -117,8 +117,8 @@ startScanner(BuildContext context, String app, SqliteHelper helper) async {
|
||||
}
|
||||
});
|
||||
|
||||
helper.close().then((_){
|
||||
helper = null;
|
||||
// helper.close().then((_){
|
||||
// helper = null;
|
||||
platform.invokeMethod('getEndpoint').then((endpoint) {
|
||||
platform.invokeMethod('getAppToken').then((appToken) async {
|
||||
platform.invokeMethod('startScanner', {
|
||||
@@ -126,13 +126,11 @@ startScanner(BuildContext context, String app, SqliteHelper helper) async {
|
||||
'url': endpoint,
|
||||
'appToken': appToken,
|
||||
'locale': Intl.defaultLocale,
|
||||
'color': Resources
|
||||
.getPrimaryColor(app)
|
||||
.value
|
||||
'color': Resources.getPrimaryColor(app).value
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
// });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user