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