На экране проведения покупки правильно обрабатывается сумма покупки, передается на экран подтверждения

This commit is contained in:
Ivan Murashov
2017-07-24 18:07:30 +03:00
parent 355c05cf06
commit 080c7ec471
9 changed files with 200 additions and 140 deletions

View File

@@ -33,8 +33,13 @@ const Color tokenActiveTextColor = const Color(0xff1f5a1f);
const Color tokenActivateTextColor = const Color(0xff4e3a19);
const Color greenBackground = const Color(0xff8ae28a);
// Margins
// Dimens
const double verticalMargin = 28.0;
const double buttonVerticalMargin = 64.0;
const double buttonHeight = 48.0;
const double iconHeight = 20.0;
const platform = const MethodChannel('com.dinect.checker/instance_id');
// HttpClient
final httpClient = createHttpClient();
@@ -56,14 +61,12 @@ checkToken(BuildContext context) async {
/// Может производиться с нескольких экранов (splash, finish_registration).
startScanner(BuildContext context) async {
const platform = const MethodChannel('com.dinect.checker/instance_id');
// Канал слушает ловит вызовы методов из "нативной" части приложения.
// Могут быть вызваны либо logaut либо faq, либо purchase.
platform.setMethodCallHandler((MethodCall call) async {
if (call.method == 'foo') {
logout();
logout(context);
} else {
pushRoute(context, new PurchaseScreen());
}
@@ -71,22 +74,24 @@ startScanner(BuildContext context) async {
return result;
});
Navigator.of(context).pop();
await platform.invokeMethod('startScanner');
}
logout(BuildContext context) {
// String url = intUrl + 'tokens/' + token + '?_dmapptoken=' + intToken;
String url = intUrl + 'tokens/' + 'khooi' + '?_dmapptoken=' + intToken;
print(url);
httpClient.delete(url).then((response) {
print(response.body);
const platform = const MethodChannel('com.dinect.checker/instance_id');
platform.invokeMethod('removeKeys');
pushRoute(context, new RegistrationScreen());
}).catchError((error) {
print(error.toString());
});
// httpClient.delete(url).then((response) {
// print(response.body);
// }).catchError((error) {
// print(error.toString());
// });
pushRoute(context, new RegistrationScreen());
}
/// Навигация по приложению.