small fix
This commit is contained in:
@@ -136,10 +136,8 @@ public abstract class AbstractScannerActivity extends AppCompatActivity {
|
|||||||
private void initManualInput() {
|
private void initManualInput() {
|
||||||
EditText manualInput = (EditText) findViewById(R.id.manual_input);
|
EditText manualInput = (EditText) findViewById(R.id.manual_input);
|
||||||
|
|
||||||
//if (BuildConfig.applicationId == "com.dinect.develop") {
|
// для удобства, чтоб не вводить постоянно руками при разработке
|
||||||
// для удобства, чтоб не вводить постоянно руками при разработке
|
// manualInput.setText("4620011139016317023320337");
|
||||||
//manualInput.setText("4620011139016317023320337");
|
|
||||||
//}
|
|
||||||
|
|
||||||
manualInput.setOnEditorActionListener(new TextView.OnEditorActionListener() {
|
manualInput.setOnEditorActionListener(new TextView.OnEditorActionListener() {
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -52,6 +52,7 @@ class PurchaseScreenState<T> extends BaseState<PurchaseScreen> {
|
|||||||
Map user;
|
Map user;
|
||||||
String card = '';
|
String card = '';
|
||||||
String flavor = '';
|
String flavor = '';
|
||||||
|
String loyalityType = '';
|
||||||
String loyalty = '';
|
String loyalty = '';
|
||||||
String bonus = '';
|
String bonus = '';
|
||||||
bool dataLoaded = false;
|
bool dataLoaded = false;
|
||||||
@@ -75,7 +76,7 @@ class PurchaseScreenState<T> extends BaseState<PurchaseScreen> {
|
|||||||
|
|
||||||
widgets.add(getInputField()); // Нельзя добавить еще одно поле таким же способом
|
widgets.add(getInputField()); // Нельзя добавить еще одно поле таким же способом
|
||||||
|
|
||||||
if (this.flavor != 'autobonus') {
|
if (this.loyalityType == 'bonus') {
|
||||||
widgets.add(getBonusInputField());
|
widgets.add(getBonusInputField());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -195,9 +196,11 @@ class PurchaseScreenState<T> extends BaseState<PurchaseScreen> {
|
|||||||
getLoyaltyRequest(url, helper).then((response) {
|
getLoyaltyRequest(url, helper).then((response) {
|
||||||
print(response);
|
print(response);
|
||||||
this.dataLoaded = true;
|
this.dataLoaded = true;
|
||||||
|
Map loyality = JSON.decode(response.body);
|
||||||
setState(() {
|
setState(() {
|
||||||
this.flavor = flavor;
|
this.flavor = flavor;
|
||||||
setBonuses(JSON.decode(response.body), showBonus );
|
this.loyalityType = loyality['type'];
|
||||||
|
setBonuses(loyality, showBonus);
|
||||||
});
|
});
|
||||||
}).catchError((error) {
|
}).catchError((error) {
|
||||||
print(error.toString());
|
print(error.toString());
|
||||||
@@ -355,7 +358,7 @@ class PurchaseScreenState<T> extends BaseState<PurchaseScreen> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void setBonuses(Map bonuses, bool showBonus) {
|
void setBonuses(Map bonuses, bool showBonus) {
|
||||||
print('kifio ' + bonuses['type']);
|
print('kifio ' + this.loyalityType);
|
||||||
if (bonuses['type'] == 'amount') {
|
if (bonuses['type'] == 'amount') {
|
||||||
this.loyalty = '${user['discount']}%';
|
this.loyalty = '${user['discount']}%';
|
||||||
} else {
|
} else {
|
||||||
@@ -364,7 +367,7 @@ class PurchaseScreenState<T> extends BaseState<PurchaseScreen> {
|
|||||||
this.loyalty = '${loyaltyVal.toStringAsFixed(0)}%';
|
this.loyalty = '${loyaltyVal.toStringAsFixed(0)}%';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (showBonus && (bonuses['type'] == 'bonus')) {
|
if (showBonus && (this.loyalityType == 'bonus')) {
|
||||||
this.bonus = '${user['bonus']}';
|
this.bonus = '${user['bonus']}';
|
||||||
}
|
}
|
||||||
print('kifio ' + this.loyalty);
|
print('kifio ' + this.loyalty);
|
||||||
|
|||||||
Reference in New Issue
Block a user