Исправлено отображение бонусов на экране проведения покупки
This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
package="com.dinect.checker"
|
package="com.dinect.checker"
|
||||||
android:versionCode="1"
|
android:versionCode="1"
|
||||||
android:versionName="1.1.2">
|
android:versionName="1.1.3">
|
||||||
|
|
||||||
<uses-sdk
|
<uses-sdk
|
||||||
android:minSdkVersion="16"
|
android:minSdkVersion="16"
|
||||||
|
|||||||
@@ -40,19 +40,9 @@ class PurchaseScreenState<T> extends BaseState<PurchaseScreen> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext ctx) {
|
Widget build(BuildContext ctx) {
|
||||||
if (helper == null) {
|
setState(() {
|
||||||
helper = new SqliteHelper();
|
requestLoyalty(user['loyalty_url']);
|
||||||
helper.open().then((_) {
|
});
|
||||||
if (app == null) {
|
|
||||||
platform.invokeMethod('getFlavor').then((flavor) {
|
|
||||||
app = flavor;
|
|
||||||
setState(() {
|
|
||||||
requestLoyalty(user['loyalty_url']);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
return getMainWidget();
|
return getMainWidget();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -132,8 +122,10 @@ class PurchaseScreenState<T> extends BaseState<PurchaseScreen> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
requestLoyalty(String url) async {
|
requestLoyalty(String url) async {
|
||||||
|
print(url);
|
||||||
if (await platform.invokeMethod('isOnline')) {
|
if (await platform.invokeMethod('isOnline')) {
|
||||||
getLoyaltyRequest(url, helper).then((response) {
|
getLoyaltyRequest(url, helper).then((response) {
|
||||||
|
print(response);
|
||||||
setState(() {
|
setState(() {
|
||||||
setBonuses(JSON.decode(response.body));
|
setBonuses(JSON.decode(response.body));
|
||||||
});
|
});
|
||||||
@@ -254,6 +246,7 @@ class PurchaseScreenState<T> extends BaseState<PurchaseScreen> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void setBonuses(Map bonuses) {
|
void setBonuses(Map bonuses) {
|
||||||
|
print('kifio ' + bonuses['type']);
|
||||||
if (bonuses['type'] == 'amount') {
|
if (bonuses['type'] == 'amount') {
|
||||||
this.loyalty = '${user['discount']}%';
|
this.loyalty = '${user['discount']}%';
|
||||||
} else {
|
} else {
|
||||||
@@ -261,5 +254,6 @@ class PurchaseScreenState<T> extends BaseState<PurchaseScreen> {
|
|||||||
bonuses['amount_to_bonus'][0]) * 100;
|
bonuses['amount_to_bonus'][0]) * 100;
|
||||||
this.loyalty = '${loyaltyVal.toStringAsFixed(0)}%';
|
this.loyalty = '${loyaltyVal.toStringAsFixed(0)}%';
|
||||||
}
|
}
|
||||||
|
print('kifio ' + this.loyalty);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user