iOS crypto target

This commit is contained in:
Ivan Murashov
2018-03-11 01:40:57 +03:00
parent cae46b60f9
commit c229ea8c9e
41 changed files with 811 additions and 192 deletions

View File

@@ -78,24 +78,23 @@ class _SplashScreenState extends BaseState<SplashScreen> {
]));
}
startRegistration(Widget screen) {
new Future.delayed(const Duration(milliseconds: 200), () {
var route = new MaterialPageRoute<String>(
builder: (BuildContext context) => screen, fullscreenDialog: true);
Navigator.of(context).push(route).then((token) {
_initAndStartScanner(context, app, token, helper);
});
});
}
/// Запуск следующего экрана приложения.
showNextScreen() async {
String token = await helper.getToken();
// В случае, если в приложении отсутствует токен,
// необходимо запустить регистрацию кассы.
if (token == null) {
new Future.delayed(const Duration(milliseconds: 200), () {
var route = new MaterialPageRoute<bool>(
builder: (BuildContext context) => new RegistrationScreen(helper, app), fullscreenDialog: true);
Navigator.of(context).push(route).then((b) {
_initAndStartScanner(context, app, token, helper);
});
});
// pushRoute(context, new RegistrationScreen(helper, app));
startRegistration(new RegistrationScreen(helper, app));
} else {
if (await platform.invokeMethod('isOnline')) {
getCheckTokenStatusRequest(token).then((statusResponse) {
@@ -114,7 +113,7 @@ class _SplashScreenState extends BaseState<SplashScreen> {
int code = statusResponse.statusCode;
if (code == 404) {
helper.clear().then((result) {
pushRouteReplacement(context, new RegistrationScreen(helper, app));
startRegistration(new RegistrationScreen(helper, app));
});
} else {
Map status = JSON.decode(statusResponse.body);
@@ -146,8 +145,7 @@ class _SplashScreenState extends BaseState<SplashScreen> {
getCreateTokenRequest({'merchant_shop': merchantID, 'pos': posID})
.then((response) {
if (response.statusCode == 409) {
pushRouteReplacement(
context, new FinishRegistrationScreen(helper, app));
startRegistration(new FinishRegistrationScreen(helper, app));
} else if (response.statusCode == 201) {
clearToken(response, helper);
}
@@ -161,8 +159,7 @@ class _SplashScreenState extends BaseState<SplashScreen> {
helper.clear().then((_) {
Map parsedMap = JSON.decode(response.body);
getDeleteTokenRequest(parsedMap['token']).then((_) {
Navigator.of(context).pop();
pushRouteReplacement(context, new RegistrationScreen(helper, app));
startRegistration(new RegistrationScreen(helper, app));
}).catchError((error) {
print(error.toString());
});
@@ -186,6 +183,8 @@ class _SplashScreenState extends BaseState<SplashScreen> {
userResponse.then((response) {
List<Map> users;
try {
users = JSON.decode(response.body);
} catch (error) {
@@ -203,10 +202,9 @@ class _SplashScreenState extends BaseState<SplashScreen> {
faq(helper, app, context, true);
} else if (call.method == 'settings') {
new Future.delayed(const Duration(milliseconds: 200), () {
var route = new MaterialPageRoute<bool>(
var route = new MaterialPageRoute<Null>(
builder: (BuildContext context) => new SettingsScreen(helper, app, true), fullscreenDialog: true);
Navigator.of(context).push(route).then((b) {
print('purchase closed: $b');
Navigator.of(context).push(route).then((_) {
_initAndStartScanner(context, app, token, helper);
});
});
@@ -246,10 +244,9 @@ class _SplashScreenState extends BaseState<SplashScreen> {
startScanner(String token, String userString, String card) {
new Future.delayed(const Duration(milliseconds: 200), () {
var route = new MaterialPageRoute<bool>(
var route = new MaterialPageRoute<Null>(
builder: (BuildContext context) => new PurchaseScreen(helper, app, userString, card), fullscreenDialog: true);
Navigator.of(context).push(route).then((b) {
print('purchase closed: $b');
Navigator.of(context).push(route).then((_) {
_initAndStartScanner(context, app, token, helper);
});
});
@@ -272,4 +269,4 @@ class _SplashScreenState extends BaseState<SplashScreen> {
return null;
}
}
}
}