Поправил много неприятных косяков
This commit is contained in:
@@ -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');
|
||||
}
|
||||
|
||||
// Запуск диалога с двумя кнопками
|
||||
|
||||
Reference in New Issue
Block a user