Поправил много неприятных косяков
This commit is contained in:
@@ -16,8 +16,6 @@ class SplashScreen extends StatelessWidget {
|
||||
// Появляется splash screen, проверяется токен.
|
||||
new Future.delayed(const Duration(milliseconds: 500), () {
|
||||
showNextScreen(context);
|
||||
// startScanner(context);
|
||||
// pushRoute(context, new PurchaseScreen(null));
|
||||
});
|
||||
|
||||
return new Stack(children: <Widget>[getBackgroundContainer(),
|
||||
@@ -45,7 +43,6 @@ class SplashScreen extends StatelessWidget {
|
||||
if (token == null) {
|
||||
pushRoute(context, new RegistrationScreen());
|
||||
} else {
|
||||
|
||||
checkTokenStatus(token).then((statusResponse) {
|
||||
handleStatusResponse(context, statusResponse);
|
||||
}).catchError((error) {
|
||||
@@ -77,23 +74,23 @@ class SplashScreen extends StatelessWidget {
|
||||
} else {
|
||||
createToken(await platform.invokeMethod('getMerchantID'), await platform.invokeMethod('getPosID')).then((response) {
|
||||
print('response.body: ${response.body}');
|
||||
|
||||
|
||||
if (response.statusCode == 409) {
|
||||
pushRoute(context, new FinishRegistrationScreen());
|
||||
} else {
|
||||
deleteToken(token).then((response) {
|
||||
print(response.body);
|
||||
platform.invokeMethod('removeKeys');
|
||||
Navigator.of(context).pop(); // Убираем текущий route
|
||||
pushRoute(context, new RegistrationScreen()); // Запускаем регистрацию
|
||||
}).catchError((error) {
|
||||
print(error.toString());
|
||||
} else if (response.statusCode == 201) {
|
||||
platform.invokeMethod('removeKeys').then((result) {
|
||||
Map parsedMap = JSON.decode(result);
|
||||
String t = parsedMap['token'];
|
||||
deleteToken(t).then((response) {
|
||||
print(response.body);
|
||||
Navigator.of(context).pop(); // Убираем текущий route
|
||||
pushRoute(context, new RegistrationScreen()); // Запускаем регистрацию
|
||||
}).catchError((error) {
|
||||
print(error.toString());
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
}).catchError((error) {
|
||||
platform.invokeMethod('removeKeys').then((result) => pushRoute(context, new RegistrationScreen()));
|
||||
});
|
||||
}).catchError((error) => print(error.toString()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user