Поправил много неприятных косяков

This commit is contained in:
Ivan Murashov
2017-07-27 18:47:42 +03:00
parent 303f3e2ff3
commit 311d532898
9 changed files with 116 additions and 69 deletions

View File

@@ -31,8 +31,11 @@ logout(BuildContext context) {
if (token != null) {
deleteToken(token).then((response) {
print(response.body);
platform.invokeMethod('removeKeys');
pushRoute(context, new RegistrationScreen()); // Запускаем регистрацию
platform.invokeMethod('removeKeys').then((result) {
Navigator.of(context).pop();
Navigator.of(context).pop();
pushRoute(context, new RegistrationScreen()); // Запускаем регистрацию
});
}).catchError((error) {
print(error.toString());
});
@@ -45,6 +48,19 @@ logout(BuildContext context) {
showYesNoDialog(context, 'Подтверждение', 'Вы действительно хотите выйти и ввести другой номер магазина?', positiveCalback);
}
forceLogout(BuildContext context) {
deleteToken(token).then((response) {
print(response.body);
platform.invokeMethod('removeKeys').then((result) {
Navigator.of(context).pop();
pushRoute(context, new RegistrationScreen()); // Запускаем регистрацию
});
}).catchError((error) {
print(error.toString());
});
}
/// Запуск спецефичной для каждой платформы части приложения - сканера.
/// Может производиться с нескольких экранов (splash, finish_registration).
startScanner(BuildContext context) async {
@@ -56,7 +72,7 @@ startScanner(BuildContext context) async {
print('call.method: ${call.method}');
if (call.method == 'logout') {
logout(context);
forceLogout(context);
} else if (call.method == 'faq') {
faq(context, true);
} else {
@@ -68,9 +84,8 @@ startScanner(BuildContext context) async {
Navigator.of(context).pushReplacement(route);
}
});
await platform.invokeMethod('startScanner', {'token' : token});
}
await platform.invokeMethod('startScanner');
}
// Запуск диалога с двумя кнопками