Исправлено отображение бонусов на экране проведения покупки

This commit is contained in:
Ivan Murashov
2017-09-27 12:40:30 +03:00
parent ac7146f46e
commit 62669665f1
2 changed files with 8 additions and 14 deletions

View File

@@ -2,7 +2,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.dinect.checker"
android:versionCode="1"
android:versionName="1.1.2">
android:versionName="1.1.3">
<uses-sdk
android:minSdkVersion="16"

View File

@@ -40,19 +40,9 @@ class PurchaseScreenState<T> extends BaseState<PurchaseScreen> {
@override
Widget build(BuildContext ctx) {
if (helper == null) {
helper = new SqliteHelper();
helper.open().then((_) {
if (app == null) {
platform.invokeMethod('getFlavor').then((flavor) {
app = flavor;
setState(() {
requestLoyalty(user['loyalty_url']);
});
});
}
});
}
return getMainWidget();
}
@@ -132,8 +122,10 @@ class PurchaseScreenState<T> extends BaseState<PurchaseScreen> {
}
requestLoyalty(String url) async {
print(url);
if (await platform.invokeMethod('isOnline')) {
getLoyaltyRequest(url, helper).then((response) {
print(response);
setState(() {
setBonuses(JSON.decode(response.body));
});
@@ -254,6 +246,7 @@ class PurchaseScreenState<T> extends BaseState<PurchaseScreen> {
}
void setBonuses(Map bonuses) {
print('kifio ' + bonuses['type']);
if (bonuses['type'] == 'amount') {
this.loyalty = '${user['discount']}%';
} else {
@@ -261,5 +254,6 @@ class PurchaseScreenState<T> extends BaseState<PurchaseScreen> {
bonuses['amount_to_bonus'][0]) * 100;
this.loyalty = '${loyaltyVal.toStringAsFixed(0)}%';
}
print('kifio ' + this.loyalty);
}
}