Hide discount widgets for crypto flavor
This commit is contained in:
@@ -138,12 +138,12 @@ android {
|
||||
crypto {
|
||||
applicationId 'com.dinect.checker.crypto'
|
||||
buildConfigField "String", "locale", "\"ru\""
|
||||
buildConfigField "String", "flavor", "\"cryptoq\""
|
||||
buildConfigField "String", "flavor", "\"crypto\""
|
||||
buildConfigField "int", "currency", "643"
|
||||
buildConfigField "String", "supportPhone", "\"8-800-77-55-032\""
|
||||
buildConfigField "String", "supportUrl", "\"http://www.dinect.com\""
|
||||
buildConfigField "String", "endpoint", "\"https://pos-api-crypto-int.dinect.com/20130701/\""
|
||||
buildConfigField "String", "appToken", "\"bdea0f3ba9034b688019a7cac753d1209e2b227f\""
|
||||
buildConfigField "String", "endpoint", "\"https://pos-api-int.dinect.com/20130701/\""
|
||||
buildConfigField "String", "appToken", "\"9fec83cdca38c357e6b65dbb17514cdd36bf2a08\""
|
||||
buildConfigField "String", "appTitle", "\"Dinect Crypto\""
|
||||
buildConfigField "boolean", "showBonus", "true"
|
||||
}
|
||||
|
||||
@@ -165,8 +165,8 @@ public abstract class AbstractScannerActivity extends AppCompatActivity impleme
|
||||
|
||||
// для удобства, чтоб не вводить постоянно руками при разработке
|
||||
|
||||
manualInput.setText("9990010009012057060904229");
|
||||
// manualInput.setText("4620011139016337050236302");
|
||||
// manualInput.setText("9990010009012057060904229");
|
||||
manualInput.setText("4620011139016337050236302");
|
||||
manualInput.setHint(getIntent().getStringExtra("enter_manual"));
|
||||
|
||||
manualInput.setOnEditorActionListener(new TextView.OnEditorActionListener() {
|
||||
|
||||
@@ -14,6 +14,7 @@ import io.flutter.plugin.common.MethodCall;
|
||||
import io.flutter.plugin.common.MethodChannel;
|
||||
import io.flutter.plugin.common.MethodChannel.Result;
|
||||
import io.flutter.plugins.GeneratedPluginRegistrant;
|
||||
import android.support.v4.app.Fragment;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
|
||||
@@ -253,7 +253,7 @@ abstract class BaseState<T extends StatefulWidget> extends State<T> {
|
||||
EdgeInsets getInputFieldContainerPadding() {
|
||||
const double verticalPadding = 12.0;
|
||||
const double horizontalPadding = 16.0;
|
||||
return new EdgeInsets.only(top: 256.0,
|
||||
return new EdgeInsets.only(top: verticalPadding,
|
||||
bottom: verticalPadding,
|
||||
left: horizontalPadding,
|
||||
right: horizontalPadding);
|
||||
@@ -352,7 +352,7 @@ class EnsureVisibleWhenFocusedState extends State<EnsureVisibleWhenFocused> {
|
||||
// TODO: position doesn't seem to notify listeners when metrics change,
|
||||
// perhaps a NotificationListener around the scrollable could avoid
|
||||
// the need insert a delay here.
|
||||
await new Future.delayed(const Duration(milliseconds: 300));
|
||||
await new Future.delayed(const Duration(milliseconds: 1000));
|
||||
|
||||
if (!widget.focusNode.hasFocus)
|
||||
return;
|
||||
|
||||
@@ -43,8 +43,9 @@ initWithSystemValue(String app, String name, SqliteHelper helper) {
|
||||
|
||||
createSettingsTable(String app, String name, String locale, SqliteHelper helper) {
|
||||
platform.invokeMethod('getCurrency').then((currency) {
|
||||
helper.createAppInfo(currency);
|
||||
start(app, name, locale, helper);
|
||||
helper.createAppInfo(currency).then(() {
|
||||
start(app, name, locale, helper);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ class Resources {
|
||||
case 'autobonus': return new Color(0xffeb0004);
|
||||
case 'dinect': return new Color(0xff33cc99);
|
||||
case 'dinect': return new Color(0xff33cc99);
|
||||
case 'crypto': return new Color(0x0f3d87);
|
||||
case 'crypto': return new Color(0xff0f3d87);
|
||||
default: return new Color(0xffffffff);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import 'dart:convert';
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:checker/base/base_screen.dart';
|
||||
import 'package:checker/base/base_state.dart';
|
||||
@@ -57,9 +58,11 @@ class RegistrationScreenState extends BaseState<FinishRegistrationScreen> {
|
||||
// Если токен активирован, то открывается экран со сканером,
|
||||
// Если нет, то отправляется запрос на проверку статуса токена.
|
||||
handleTap() async {
|
||||
print('tokenActive: $_tokenActive');
|
||||
if (_tokenActive) {
|
||||
Navigator.of(context).pop();
|
||||
// FIXME: startScanner(context, app, helper);
|
||||
new Future.delayed(const Duration(milliseconds: 200), () {
|
||||
Navigator.of(context).pop();
|
||||
});
|
||||
} else {
|
||||
if (await platform.invokeMethod('isOnline')) {
|
||||
String token = await helper.getToken();
|
||||
|
||||
@@ -4,6 +4,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'dart:convert';
|
||||
import 'dart:core';
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:checker/resources.dart';
|
||||
import 'package:checker/strings.dart';
|
||||
@@ -33,6 +34,9 @@ class PurchaseScreenState<T> extends BaseState<PurchaseScreen> {
|
||||
|
||||
TextEditingController bonusController = new TextEditingController();
|
||||
|
||||
FocusNode _focusNodeSum = new FocusNode();
|
||||
FocusNode _focusNodeBonus = new FocusNode();
|
||||
|
||||
PurchaseScreenState(SqliteHelper helper, String app, String userString, String card) : super(helper, app) {
|
||||
this.user = JSON.decode(userString);
|
||||
this.card = card;
|
||||
@@ -56,7 +60,6 @@ class PurchaseScreenState<T> extends BaseState<PurchaseScreen> {
|
||||
bool purchaseInProgress = false;
|
||||
Map user;
|
||||
String card = '';
|
||||
String flavor = '';
|
||||
String loyalityType = '';
|
||||
String loyalty = '';
|
||||
String bonus = '';
|
||||
@@ -72,17 +75,19 @@ class PurchaseScreenState<T> extends BaseState<PurchaseScreen> {
|
||||
));
|
||||
widgetList.add(getValueWithDescription(StringsLocalization.card(), card));
|
||||
|
||||
widgetList.add(getValueWithDescription(StringsLocalization.reward(), loyalty));
|
||||
if (app != 'crypto') { // FIXME Заменить на crypto
|
||||
widgetList.add(getValueWithDescription(StringsLocalization.reward(), loyalty));
|
||||
}
|
||||
|
||||
if (bonus.length > 0) {
|
||||
widgetList.add(getValueWithDescription(StringsLocalization.bonus(), bonus));
|
||||
}
|
||||
|
||||
widgetList.add(getHintLabel());
|
||||
|
||||
widgetList.add(getInputField()); // Нельзя добавить еще одно поле таким же способом
|
||||
|
||||
if (this.flavor != 'autobonus') {
|
||||
if (app != 'autobonus') {
|
||||
|
||||
if (this.loyalityType == 'bonus') {
|
||||
widgetList.add(getBonusInputField());
|
||||
}
|
||||
@@ -114,6 +119,7 @@ class PurchaseScreenState<T> extends BaseState<PurchaseScreen> {
|
||||
Resources.getPrimaryColor(app)
|
||||
)
|
||||
));
|
||||
|
||||
return new Column(children: <Widget>[
|
||||
new Expanded(
|
||||
child: new ListView(children: widgetList))
|
||||
@@ -121,7 +127,11 @@ class PurchaseScreenState<T> extends BaseState<PurchaseScreen> {
|
||||
}
|
||||
|
||||
getBonusInputField() {
|
||||
TextField bonusTextField = new TextField(
|
||||
|
||||
var bonusTextField = new EnsureVisibleWhenFocused(
|
||||
focusNode: _focusNodeBonus,
|
||||
child: new TextField(
|
||||
focusNode: _focusNodeBonus,
|
||||
keyboardType: TextInputType.number,
|
||||
decoration: new InputDecoration.collapsed(
|
||||
hintText: StringsLocalization.bonusHint(),
|
||||
@@ -134,7 +144,7 @@ class PurchaseScreenState<T> extends BaseState<PurchaseScreen> {
|
||||
});
|
||||
},
|
||||
textAlign: TextAlign.center,
|
||||
);
|
||||
));
|
||||
|
||||
return new Column(
|
||||
children: <Widget>[
|
||||
@@ -199,7 +209,10 @@ class PurchaseScreenState<T> extends BaseState<PurchaseScreen> {
|
||||
@override
|
||||
getTextWidget() {
|
||||
// ?? TODO переделать, т.к. позволяет иметь только одно поле ввода на странице
|
||||
return new TextField(
|
||||
return new EnsureVisibleWhenFocused(
|
||||
focusNode: _focusNodeSum,
|
||||
child: new TextField(
|
||||
focusNode: _focusNodeSum,
|
||||
keyboardType: TextInputType.number,
|
||||
decoration: new InputDecoration.collapsed(
|
||||
hintText: getHintString(),
|
||||
@@ -212,12 +225,11 @@ class PurchaseScreenState<T> extends BaseState<PurchaseScreen> {
|
||||
},
|
||||
textAlign: TextAlign.center,
|
||||
autofocus: true
|
||||
);
|
||||
));
|
||||
}
|
||||
|
||||
requestAsyncData(Map user) async {
|
||||
bool showBonus = await platform.invokeMethod('showBonus');
|
||||
String flavor = await platform.invokeMethod('getFlavor');
|
||||
if (await platform.invokeMethod('isOnline') && !this.dataRequested) {
|
||||
this.dataRequested = true;
|
||||
var response, couponResponse;
|
||||
@@ -240,12 +252,10 @@ class PurchaseScreenState<T> extends BaseState<PurchaseScreen> {
|
||||
});
|
||||
|
||||
setState(() {
|
||||
this.flavor = flavor;
|
||||
this.coupons = coupons['results'];
|
||||
this.loyalityType = loyality['type'];
|
||||
setBonuses(loyality, showBonus);
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -321,7 +331,6 @@ class PurchaseScreenState<T> extends BaseState<PurchaseScreen> {
|
||||
showDialog(
|
||||
context: context,
|
||||
child: new AlertDialog(
|
||||
//title: new Text(StringsLocalization.()),
|
||||
content: new Text(errorText),
|
||||
actions: <Widget>[
|
||||
new FlatButton(
|
||||
@@ -395,17 +404,20 @@ class PurchaseScreenState<T> extends BaseState<PurchaseScreen> {
|
||||
|
||||
Map coupons = JSON.decode(couponsResponse.body);
|
||||
|
||||
pushRouteReplacement(
|
||||
context,
|
||||
new PurchaseSuccessScreen(
|
||||
new Future.delayed(const Duration(milliseconds: 200), () {
|
||||
print('show purchase success!');
|
||||
var route = new MaterialPageRoute<bool>(builder: (BuildContext context) => new PurchaseSuccessScreen(
|
||||
sumTotal,
|
||||
user['first_name'] == null ? '' : user['first_name'],
|
||||
helper,
|
||||
app,
|
||||
purchase,
|
||||
coupons['results']
|
||||
)
|
||||
);
|
||||
), fullscreenDialog: true);
|
||||
Navigator.of(context).push(route).then((b) {
|
||||
print('finish registration closed: $b');
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -427,8 +439,4 @@ class PurchaseScreenState<T> extends BaseState<PurchaseScreen> {
|
||||
print('kifio ' + this.loyalty);
|
||||
print('bonus ' + this.bonus);
|
||||
}
|
||||
|
||||
// onWillPop() {
|
||||
// return startScanner(context, app, helper);
|
||||
// }
|
||||
}
|
||||
|
||||
@@ -40,7 +40,6 @@ class PurchaseSuccessScreenState<T> extends BaseState<PurchaseSuccessScreen> {
|
||||
int bonusMinus = 0;
|
||||
int currency;
|
||||
bool showBonus;
|
||||
String flavor;
|
||||
|
||||
@override String getTitle() {
|
||||
return StringsLocalization.carryingPurchase();
|
||||
@@ -51,6 +50,7 @@ class PurchaseSuccessScreenState<T> extends BaseState<PurchaseSuccessScreen> {
|
||||
}
|
||||
|
||||
@override Widget build(BuildContext context) {
|
||||
|
||||
if (currency == null) {
|
||||
helper.getCurrency().then((currency) {
|
||||
setState(() {
|
||||
@@ -58,27 +58,20 @@ class PurchaseSuccessScreenState<T> extends BaseState<PurchaseSuccessScreen> {
|
||||
});
|
||||
});
|
||||
}
|
||||
if (this.flavor == null) {
|
||||
platform.invokeMethod('getFlavor').then((flavor) {
|
||||
setState(() {
|
||||
this.flavor = flavor;
|
||||
|
||||
if (this.details['sum_bonus'] is String) {
|
||||
String regexString = r'(\d+) начислено, (\d+).*';
|
||||
RegExp regExp = new RegExp(regexString);
|
||||
var matches = regExp.allMatches(this.details['sum_bonus']);
|
||||
if(matches.length != 0) {
|
||||
var match = matches.elementAt(0); // => extract the first (and only) match
|
||||
this.bonusPlus = int.parse(match.group(1));
|
||||
this.bonusMinus = int.parse(match.group(2));
|
||||
}
|
||||
}
|
||||
|
||||
if (this.details['sum_bonus'] is String) {
|
||||
String regexString = r'(\d+) начислено, (\d+).*';
|
||||
RegExp regExp = new RegExp(regexString);
|
||||
var matches = regExp.allMatches(this.details['sum_bonus']);
|
||||
if(matches.length != 0) {
|
||||
var match = matches.elementAt(0); // => extract the first (and only) match
|
||||
this.bonusPlus = int.parse(match.group(1));
|
||||
this.bonusMinus = int.parse(match.group(2));
|
||||
}
|
||||
}
|
||||
|
||||
if (this.details['sum_bonus'] is int) {
|
||||
this.bonusPlus = this.details['sum_bonus'];
|
||||
}
|
||||
});
|
||||
});
|
||||
if (this.details['sum_bonus'] is int) {
|
||||
this.bonusPlus = this.details['sum_bonus'];
|
||||
}
|
||||
|
||||
return getMainWidget();
|
||||
@@ -97,13 +90,13 @@ class PurchaseSuccessScreenState<T> extends BaseState<PurchaseSuccessScreen> {
|
||||
widgetList.add(getValueWithDescription(StringsLocalization.bonusMinus(), bonusMinus.toString()));
|
||||
}
|
||||
|
||||
if (this.flavor != 'autobonus') {
|
||||
if (app != 'autobonus') {
|
||||
widgetList.add(getValueWithDescription(StringsLocalization.discountRate(), '${details['discount']}%'));
|
||||
widgetList.add(getValueWithDescription(StringsLocalization.discountSum(), '${details['sum_discount']}'));
|
||||
if (app != 'crypto') {
|
||||
widgetList.add(getValueWithDescription(StringsLocalization.discountSum(), '${details['sum_discount']}'));
|
||||
}
|
||||
}
|
||||
|
||||
// widgetList.add( new Expanded(child: new Center()));
|
||||
if (this.coupons.length > 0) {
|
||||
if (app != 'crypto' && this.coupons.length > 0) {
|
||||
widgetList.add(getItemTitle(StringsLocalization.couponsUsed()));
|
||||
this.coupons.forEach((couponItem) {
|
||||
widgetList.add(getItemToggle(
|
||||
@@ -140,8 +133,6 @@ class PurchaseSuccessScreenState<T> extends BaseState<PurchaseSuccessScreen> {
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
getSuccessMessage() {
|
||||
return new Row(
|
||||
children: <Widget>[
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import 'dart:convert';
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:checker/base/base_screen.dart';
|
||||
import 'package:checker/base/base_state.dart';
|
||||
@@ -42,8 +43,7 @@ class RegistrationScreenState extends BaseState<RegistrationScreen> {
|
||||
/// Список виджетов, автоматически прокручиваемый вверх при открытии клавиатуры.
|
||||
@override
|
||||
Widget getScreenContent() {
|
||||
return new Container(
|
||||
child: new ListView(children: <Widget>[
|
||||
return new Container(child: new ListView(children: <Widget>[
|
||||
new Column(children: <Widget>[
|
||||
getLogo(),
|
||||
getHintLabel(),
|
||||
@@ -88,12 +88,12 @@ class RegistrationScreenState extends BaseState<RegistrationScreen> {
|
||||
_registerShop() {
|
||||
setState(() {
|
||||
loading = true;
|
||||
_register();
|
||||
register();
|
||||
});
|
||||
}
|
||||
|
||||
/// Получение от платформы id установки, формирование запроса на получение токена, сохранение токена.
|
||||
_register() async {
|
||||
register() async {
|
||||
if (await platform.invokeMethod('isOnline')) {
|
||||
String posID = await helper.getPosID();
|
||||
|
||||
@@ -110,8 +110,12 @@ class RegistrationScreenState extends BaseState<RegistrationScreen> {
|
||||
|
||||
if (response.statusCode == 201) {
|
||||
helper.createSession(merchantID, posID, parsedMap['token']).then((_) {
|
||||
pushRouteReplacement(
|
||||
context, new FinishRegistrationScreen(helper, app));
|
||||
new Future.delayed(const Duration(milliseconds: 200), () {
|
||||
var route = new MaterialPageRoute<bool>(builder: (BuildContext context) => new FinishRegistrationScreen(helper, app), fullscreenDialog: true);
|
||||
Navigator.of(context).pushReplacement(route).then((b) {
|
||||
print('finish registration closed: $b');
|
||||
});
|
||||
});
|
||||
});
|
||||
} else {
|
||||
setState(() {
|
||||
|
||||
@@ -83,7 +83,16 @@ class _SplashScreenState extends BaseState<SplashScreen> {
|
||||
// В случае, если в приложении отсутствует токен,
|
||||
// необходимо запустить регистрацию кассы.
|
||||
if (token == null) {
|
||||
pushRouteReplacement(context, new RegistrationScreen(helper, app));
|
||||
|
||||
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));
|
||||
} else {
|
||||
if (await platform.invokeMethod('isOnline')) {
|
||||
getCheckTokenStatusRequest(token).then((statusResponse) {
|
||||
@@ -100,7 +109,6 @@ class _SplashScreenState extends BaseState<SplashScreen> {
|
||||
/// Если токен не активен, попробовать создать его еще раз.
|
||||
handleStatusResponse(var statusResponse, SqliteHelper helper) async {
|
||||
int code = statusResponse.statusCode;
|
||||
|
||||
if (code == 404) {
|
||||
helper.clear().then((result) {
|
||||
pushRouteReplacement(context, new RegistrationScreen(helper, app));
|
||||
@@ -191,7 +199,14 @@ class _SplashScreenState extends BaseState<SplashScreen> {
|
||||
} else if (call.method == 'faq') {
|
||||
faq(helper, app, context, true);
|
||||
} else if (call.method == 'settings') {
|
||||
pushRoute(context, new SettingsScreen(helper, app, true));
|
||||
new Future.delayed(const Duration(milliseconds: 200), () {
|
||||
var route = new MaterialPageRoute<bool>(
|
||||
builder: (BuildContext context) => new SettingsScreen(helper, app, true), fullscreenDialog: true);
|
||||
Navigator.of(context).push(route).then((b) {
|
||||
print('purchase closed: $b');
|
||||
_initAndStartScanner(context, app, token, helper);
|
||||
});
|
||||
});
|
||||
} else {
|
||||
String userString;
|
||||
|
||||
@@ -254,5 +269,4 @@ class _SplashScreenState extends BaseState<SplashScreen> {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -152,4 +152,4 @@ packages:
|
||||
source: hosted
|
||||
version: "2.6.0"
|
||||
sdks:
|
||||
dart: ">=2.0.0-dev.23.0 <=2.0.0-edge.0d5cf900b021bf5c9fa593ffa12b15bcd1cc5fe0"
|
||||
dart: ">=2.0.0-dev.23.0 <=2.0.0-edge.fe96de2858f078e4ad04f8f30640184bf3d8102d"
|
||||
|
||||
Reference in New Issue
Block a user