Исправление замечаний
This commit is contained in:
@@ -42,10 +42,6 @@ abstract class BaseState<T extends StatefulWidget> extends State<T> {
|
|||||||
fit: BoxFit.cover)));
|
fit: BoxFit.cover)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void onStart() {
|
|
||||||
print("ON START!");
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Возвращает контейнер с всеми виджетами экрана.
|
/// Возвращает контейнер с всеми виджетами экрана.
|
||||||
Widget getScreenContent();
|
Widget getScreenContent();
|
||||||
|
|
||||||
@@ -88,8 +84,8 @@ abstract class BaseState<T extends StatefulWidget> extends State<T> {
|
|||||||
pushRoute(context, new FAQScreen(false));
|
pushRoute(context, new FAQScreen(false));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 0: {
|
case 2: {
|
||||||
logout(context);
|
logout(context, helper);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ abstract class SettingsBaseState<T extends StatefulWidget> extends BaseState<T>
|
|||||||
@override
|
@override
|
||||||
Widget getScreenContent() {
|
Widget getScreenContent() {
|
||||||
|
|
||||||
print('getScreenContent: $selectedItem');
|
|
||||||
getSelectedValue();
|
getSelectedValue();
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -31,20 +31,20 @@ faq(BuildContext context, bool returnToScanner) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// В методе отправляется запрос на удаление токена кассы, очищаются SharedPreferences приложения.
|
// В методе отправляется запрос на удаление токена кассы, очищаются SharedPreferences приложения.
|
||||||
logout(BuildContext context) async {
|
logout(BuildContext context, SqliteHelper helper) async {
|
||||||
|
|
||||||
SqliteHelper helper = new SqliteHelper();
|
|
||||||
await helper.open();
|
|
||||||
String token = await helper.getToken();
|
String token = await helper.getToken();
|
||||||
|
String locale = await helper.getLocale();
|
||||||
|
|
||||||
VoidCallback positiveCallback = () {
|
VoidCallback positiveCallback = () {
|
||||||
if (token != null) {
|
if (token != null) {
|
||||||
deleteToken(token).then((response) {
|
deleteToken(token, locale).then((response) {
|
||||||
print(response.body);
|
helper.clear().then((result) {
|
||||||
platform.invokeMethod('removeKeys').then((result) {
|
helper.close().then((_) {
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
pushRouteReplacement(context, new SplashScreen()); // Запускаем регистрацию
|
pushRouteReplacement(context, new SplashScreen()); // Запускаем регистрацию
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}).catchError((error) {
|
}).catchError((error) {
|
||||||
print(error.toString());
|
print(error.toString());
|
||||||
@@ -60,8 +60,7 @@ logout(BuildContext context) async {
|
|||||||
|
|
||||||
forceLogout(String token , BuildContext context) async {
|
forceLogout(String token , BuildContext context) async {
|
||||||
|
|
||||||
deleteToken(token).then((response) {
|
deleteToken(token, 'ru').then((response) {
|
||||||
print(response.body);
|
|
||||||
SqliteHelper helper = new SqliteHelper();
|
SqliteHelper helper = new SqliteHelper();
|
||||||
helper.open().then((_) {
|
helper.open().then((_) {
|
||||||
helper.clear().then((_) {
|
helper.clear().then((_) {
|
||||||
@@ -87,16 +86,13 @@ startScanner(BuildContext context, String app, SqliteHelper helper) async {
|
|||||||
if (token != null) {
|
if (token != null) {
|
||||||
platform.setMethodCallHandler((MethodCall call) async {
|
platform.setMethodCallHandler((MethodCall call) async {
|
||||||
|
|
||||||
print('call.method: ${call.method}');
|
|
||||||
if (call.method == 'logout') {
|
if (call.method == 'logout') {
|
||||||
forceLogout(token, context);
|
forceLogout(token, context);
|
||||||
} else if (call.method == 'faq') {
|
} else if (call.method == 'faq') {
|
||||||
faq(context, true);
|
faq(context, true);
|
||||||
} else {
|
} else {
|
||||||
String userString = call.arguments[0];
|
String userString = call.arguments[0];
|
||||||
print('user: ${userString}');
|
|
||||||
String card = call.arguments[1];
|
String card = call.arguments[1];
|
||||||
print('card: ${card}');
|
|
||||||
var route = new MaterialPageRoute<Null>(builder: (BuildContext context) => new PurchaseScreen(userString, card));
|
var route = new MaterialPageRoute<Null>(builder: (BuildContext context) => new PurchaseScreen(userString, card));
|
||||||
Navigator.of(context).pushReplacement(route);
|
Navigator.of(context).pushReplacement(route);
|
||||||
}
|
}
|
||||||
@@ -133,6 +129,8 @@ getCurrencyTitle(int code) {
|
|||||||
case 643: return StringsLocalization.nominativeRuble();
|
case 643: return StringsLocalization.nominativeRuble();
|
||||||
case 840: return StringsLocalization.nominativeDollar();
|
case 840: return StringsLocalization.nominativeDollar();
|
||||||
case 980: return StringsLocalization.nominativeHryvna();
|
case 980: return StringsLocalization.nominativeHryvna();
|
||||||
|
case 978: return StringsLocalization.nominativeEuro();
|
||||||
|
case 398: return StringsLocalization.nominativeEuro();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -83,14 +83,12 @@ class SqliteHelper {
|
|||||||
Future<String> getToken() async {
|
Future<String> getToken() async {
|
||||||
Map session = await selectAll(tableSession);
|
Map session = await selectAll(tableSession);
|
||||||
String token = session != null ? session[columnToken] : null;
|
String token = session != null ? session[columnToken] : null;
|
||||||
print('token: {$token}');
|
|
||||||
return token;
|
return token;
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<String> getMerchantID() async {
|
Future<String> getMerchantID() async {
|
||||||
Map session = await selectAll(tableSession);
|
Map session = await selectAll(tableSession);
|
||||||
String merchantID = session != null ? session[columnMerchantID] : null;
|
String merchantID = session != null ? session[columnMerchantID] : null;
|
||||||
print('merchantID: {$merchantID}');
|
|
||||||
return merchantID;
|
return merchantID;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -103,27 +101,23 @@ class SqliteHelper {
|
|||||||
Map session = await selectAll(tableSession);
|
Map session = await selectAll(tableSession);
|
||||||
int docID = session != null ? session[columnDocID] : 0;
|
int docID = session != null ? session[columnDocID] : 0;
|
||||||
db.update(tableSession, {columnDocID: docID + 1});
|
db.update(tableSession, {columnDocID: docID + 1});
|
||||||
print('docid: {$docID}');
|
|
||||||
return docID;
|
return docID;
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<String> getLocale() async {
|
Future<String> getLocale() async {
|
||||||
Map settings = await selectAll(tableSettings);
|
Map settings = await selectAll(tableSettings);
|
||||||
String locale = settings != null ? settings[columnLocale] : null;
|
String locale = settings != null ? settings[columnLocale] : null;
|
||||||
print('locale: {$locale}');
|
|
||||||
return locale;
|
return locale;
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<int> getCurrency() async {
|
Future<int> getCurrency() async {
|
||||||
Map settings = await selectAll(tableSettings);
|
Map settings = await selectAll(tableSettings);
|
||||||
int currency = settings != null ? settings[columnCurrency] : null;
|
int currency = settings != null ? settings[columnCurrency] : null;
|
||||||
print('currency: {$currency}');
|
|
||||||
return currency;
|
return currency;
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<int> saveCurrency(int currency) async {
|
Future<int> saveCurrency(int currency) async {
|
||||||
db.update(tableSettings, {columnCurrency: currency});
|
db.update(tableSettings, {columnCurrency: currency});
|
||||||
print('currency: {$currency}');
|
|
||||||
return currency;
|
return currency;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -52,6 +52,12 @@ class MessageLookup extends MessageLookupByLibrary {
|
|||||||
"plural_dollar": MessageLookupByLibrary.simpleMessage("Долларов"),
|
"plural_dollar": MessageLookupByLibrary.simpleMessage("Долларов"),
|
||||||
"nominative_hryvna": MessageLookupByLibrary.simpleMessage("Гривна"),
|
"nominative_hryvna": MessageLookupByLibrary.simpleMessage("Гривна"),
|
||||||
"singular_hryvna": MessageLookupByLibrary.simpleMessage("Гривны"),
|
"singular_hryvna": MessageLookupByLibrary.simpleMessage("Гривны"),
|
||||||
"plural_hryvna": MessageLookupByLibrary.simpleMessage("Гривен")
|
"plural_hryvna": MessageLookupByLibrary.simpleMessage("Гривен"),
|
||||||
|
"nominative_tenge": MessageLookupByLibrary.simpleMessage("Тенге"),
|
||||||
|
"singular_tenge": MessageLookupByLibrary.simpleMessage("Тенге"),
|
||||||
|
"plural_tenge": MessageLookupByLibrary.simpleMessage("Тенге"),
|
||||||
|
"nominative_euro": MessageLookupByLibrary.simpleMessage("Евро"),
|
||||||
|
"singular_euro": MessageLookupByLibrary.simpleMessage("Евро"),
|
||||||
|
"plural_euro": MessageLookupByLibrary.simpleMessage("Евро")
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ final httpClient = createHttpClient();
|
|||||||
// Попытка создать токен для кассы.
|
// Попытка создать токен для кассы.
|
||||||
// В случае если токен для кассы уже существует, вернется ошибка 409.
|
// В случае если токен для кассы уже существует, вернется ошибка 409.
|
||||||
// На сервере есть ограничение в 40 токенов.
|
// На сервере есть ограничение в 40 токенов.
|
||||||
createToken(String merchantId, String posID) async {
|
createToken(String merchantId, String posID, String locale) async {
|
||||||
|
|
||||||
// Поле description - необязательное.
|
// Поле description - необязательное.
|
||||||
var body = {
|
var body = {
|
||||||
@@ -16,15 +16,15 @@ createToken(String merchantId, String posID) async {
|
|||||||
'pos': posID,
|
'pos': posID,
|
||||||
};
|
};
|
||||||
|
|
||||||
return httpClient.post(url + 'tokens/?_dmapptoken=' + appToken, body: body);
|
return httpClient.post(url + 'tokens/?_dmapptoken=' + appToken, body: body, headers: {'Accept-Language': locale});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Проверка статуса токена. В ответе приходит параметр active, который может быть либо true, либо false,.
|
// Проверка статуса токена. В ответе приходит параметр active, который может быть либо true, либо false,.
|
||||||
checkTokenStatus(String token) async {
|
checkTokenStatus(String token, String locale) async {
|
||||||
return httpClient.get(url + 'tokens/' + token + '?_dmapptoken=' + appToken);
|
return httpClient.get(url + 'tokens/' + token + '?_dmapptoken=' + appToken, headers: {'Accept-Language': locale});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Удаление токена на сервере.
|
// Удаление токена на сервере.
|
||||||
deleteToken(String token) async {
|
deleteToken(String token, String locale) async {
|
||||||
return httpClient.delete(url + 'tokens/' + token + '?_dmapptoken=' + appToken);
|
return httpClient.delete(url + 'tokens/' + token + '?_dmapptoken=' + appToken, headers: {'Accept-Language': locale});
|
||||||
}
|
}
|
||||||
@@ -15,7 +15,7 @@ class CurrenciesScreen extends BaseScreen {
|
|||||||
|
|
||||||
class _CurrenciesState extends SettingsBaseState<CurrenciesScreen> {
|
class _CurrenciesState extends SettingsBaseState<CurrenciesScreen> {
|
||||||
|
|
||||||
List<int> currencies = const [643, 840, 980];
|
List<int> currencies = const [643, 840, 980, 978, 398];
|
||||||
|
|
||||||
_CurrenciesState(SqliteHelper helper, String app) : super(helper, app);
|
_CurrenciesState(SqliteHelper helper, String app) : super(helper, app);
|
||||||
|
|
||||||
@@ -26,8 +26,10 @@ class _CurrenciesState extends SettingsBaseState<CurrenciesScreen> {
|
|||||||
String ruble = StringsLocalization.nominativeRuble();
|
String ruble = StringsLocalization.nominativeRuble();
|
||||||
String dollar = StringsLocalization.nominativeDollar();
|
String dollar = StringsLocalization.nominativeDollar();
|
||||||
String hryvna = StringsLocalization.nominativeHryvna();
|
String hryvna = StringsLocalization.nominativeHryvna();
|
||||||
|
String euro = StringsLocalization.nominativeEuro();
|
||||||
|
String tenge = StringsLocalization.nominativeTenge();
|
||||||
|
|
||||||
return [ruble, dollar, hryvna];
|
return [ruble, dollar, hryvna, euro, tenge];
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import 'package:checker/strings.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
import 'package:checker/base/base_state.dart';
|
import 'package:checker/base/base_state.dart';
|
||||||
@@ -46,9 +47,10 @@ class FAQScreenState<T> extends BaseState<FAQScreen> {
|
|||||||
|
|
||||||
FAQScreenState(this.returnToScanner);
|
FAQScreenState(this.returnToScanner);
|
||||||
final bool returnToScanner;
|
final bool returnToScanner;
|
||||||
|
String app;
|
||||||
|
|
||||||
@override String getTitle() {
|
@override String getTitle() {
|
||||||
return "FAQ";
|
return StringsLocalization.help();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override String getHint() {
|
@override String getHint() {
|
||||||
@@ -56,7 +58,18 @@ class FAQScreenState<T> extends BaseState<FAQScreen> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@override Widget build(BuildContext context) {
|
@override Widget build(BuildContext context) {
|
||||||
return getScreenContent();
|
if (app == null) {
|
||||||
|
platform.invokeMethod('getFlavor').then((flavor) {
|
||||||
|
setState(() {
|
||||||
|
app = flavor;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return new Scaffold(appBar: getAppBar(),body: getScreenContent());
|
||||||
|
}
|
||||||
|
|
||||||
|
@override List<Widget> getMenuButtons() {
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Метод возвращает ListView с блоками faq.
|
/// Метод возвращает ListView с блоками faq.
|
||||||
|
|||||||
@@ -66,8 +66,8 @@ class RegistrationScreenState extends BaseState<FinishRegistrationScreen> {
|
|||||||
} else {
|
} else {
|
||||||
if (await platform.invokeMethod('isOnline')) {
|
if (await platform.invokeMethod('isOnline')) {
|
||||||
String token = await helper.getToken();
|
String token = await helper.getToken();
|
||||||
checkTokenStatus(token).then((response) {
|
String locale = await helper.getLocale();
|
||||||
print(response.body);
|
checkTokenStatus(token, locale).then((response) {
|
||||||
Map parsedMap = JSON.decode(response.body);
|
Map parsedMap = JSON.decode(response.body);
|
||||||
|
|
||||||
// Обновить экран, заменить сообщение о необходимости активации токена, на сообщние о том, что токен активен.
|
// Обновить экран, заменить сообщение о необходимости активации токена, на сообщние о том, что токен активен.
|
||||||
|
|||||||
@@ -38,7 +38,6 @@ class LanguagesState extends SettingsBaseState<LanguagesScreen> {
|
|||||||
void getSelectedValue() {
|
void getSelectedValue() {
|
||||||
helper.getLocale().then((locale) {
|
helper.getLocale().then((locale) {
|
||||||
setState(() {
|
setState(() {
|
||||||
print(selectedItem);
|
|
||||||
selectedItem = getOptions().indexOf(getLocaleTitle(locale));
|
selectedItem = getOptions().indexOf(getLocaleTitle(locale));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ class PurchaseScreenState<T> extends BaseState<PurchaseScreen> {
|
|||||||
@override Widget getScreenContent() {
|
@override Widget getScreenContent() {
|
||||||
return new Column(
|
return new Column(
|
||||||
children: <Widget>[new Expanded(child: new ListView(children: <Widget>[
|
children: <Widget>[new Expanded(child: new ListView(children: <Widget>[
|
||||||
getValueWithDescription(StringsLocalization.userName(), user['first_name'] == null ? '' : user['first_name']),
|
getValueWithDescription(StringsLocalization.buyer(), user['first_name'] == null ? '' : user['first_name']),
|
||||||
getValueWithDescription(StringsLocalization.card(), card),
|
getValueWithDescription(StringsLocalization.card(), card),
|
||||||
getValueWithDescription(StringsLocalization.reward(), loyalty),
|
getValueWithDescription(StringsLocalization.reward(), loyalty),
|
||||||
getHintLabel(),
|
getHintLabel(),
|
||||||
@@ -123,10 +123,12 @@ class PurchaseScreenState<T> extends BaseState<PurchaseScreen> {
|
|||||||
if (await platform.invokeMethod('isOnline')) {
|
if (await platform.invokeMethod('isOnline')) {
|
||||||
|
|
||||||
String token = await helper.getToken();
|
String token = await helper.getToken();
|
||||||
|
String locale = await helper.getLocale();
|
||||||
|
|
||||||
var headers = {
|
var headers = {
|
||||||
'DM-Authorization': 'dmapptoken $appToken',
|
'DM-Authorization': 'dmapptoken $appToken',
|
||||||
'Authorization': 'dmtoken ${token}'
|
'Authorization': 'dmtoken ${token}',
|
||||||
|
'Accept-Language': locale
|
||||||
};
|
};
|
||||||
|
|
||||||
httpClient.get(url, headers: headers).then((response) {
|
httpClient.get(url, headers: headers).then((response) {
|
||||||
@@ -216,6 +218,7 @@ class PurchaseScreenState<T> extends BaseState<PurchaseScreen> {
|
|||||||
purchaseInProgress = true;
|
purchaseInProgress = true;
|
||||||
|
|
||||||
String token = await helper.getToken();
|
String token = await helper.getToken();
|
||||||
|
String locale = await helper.getLocale();
|
||||||
helper.getMerchantID().then((result) {
|
helper.getMerchantID().then((result) {
|
||||||
|
|
||||||
String url = user['purchases_url'];
|
String url = user['purchases_url'];
|
||||||
@@ -230,7 +233,8 @@ class PurchaseScreenState<T> extends BaseState<PurchaseScreen> {
|
|||||||
|
|
||||||
var headers = {
|
var headers = {
|
||||||
'DM-Authorization': 'dmapptoken $appToken',
|
'DM-Authorization': 'dmapptoken $appToken',
|
||||||
'Authorization': 'dmtoken ${token}'
|
'Authorization': 'dmtoken ${token}',
|
||||||
|
'Accept-Language': locale
|
||||||
};
|
};
|
||||||
|
|
||||||
httpClient.post(url, body: body, headers: headers).then((response) {
|
httpClient.post(url, body: body, headers: headers).then((response) {
|
||||||
|
|||||||
@@ -88,8 +88,8 @@ class RegistrationScreenState extends BaseState<RegistrationScreen> {
|
|||||||
_register() async {
|
_register() async {
|
||||||
if (await platform.invokeMethod('isOnline')) {
|
if (await platform.invokeMethod('isOnline')) {
|
||||||
String posID = await helper.getPosID();
|
String posID = await helper.getPosID();
|
||||||
|
String locale = await helper.getLocale();
|
||||||
createToken(dinCode, posID).then((response) {
|
createToken(dinCode, posID, locale).then((response) {
|
||||||
setState(() {
|
setState(() {
|
||||||
error = null;
|
error = null;
|
||||||
loading = false;
|
loading = false;
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ class _SplashScreenState extends BaseState<SplashScreen> {
|
|||||||
return getScreenContent();
|
return getScreenContent();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override void onStart() {
|
void onStart() {
|
||||||
helper.getSettings().then((info) {
|
helper.getSettings().then((info) {
|
||||||
if (info == null) {
|
if (info == null) {
|
||||||
platform.invokeMethod('getCurrency').then((currency) {
|
platform.invokeMethod('getCurrency').then((currency) {
|
||||||
@@ -113,6 +113,7 @@ class _SplashScreenState extends BaseState<SplashScreen> {
|
|||||||
/// Запуск следующего экрана приложения.
|
/// Запуск следующего экрана приложения.
|
||||||
showNextScreen() async {
|
showNextScreen() async {
|
||||||
String token = await helper.getToken();
|
String token = await helper.getToken();
|
||||||
|
String locale = await helper.getLocale();
|
||||||
|
|
||||||
// В случае, если в приложении отсутствует токен,
|
// В случае, если в приложении отсутствует токен,
|
||||||
// необходимо запустить регистрацию кассы.
|
// необходимо запустить регистрацию кассы.
|
||||||
@@ -120,7 +121,7 @@ class _SplashScreenState extends BaseState<SplashScreen> {
|
|||||||
pushRouteReplacement(context, new RegistrationScreen(helper, app));
|
pushRouteReplacement(context, new RegistrationScreen(helper, app));
|
||||||
} else {
|
} else {
|
||||||
if (await platform.invokeMethod('isOnline')) {
|
if (await platform.invokeMethod('isOnline')) {
|
||||||
checkTokenStatus(token).then((statusResponse) {
|
checkTokenStatus(token, locale).then((statusResponse) {
|
||||||
handleStatusResponse(statusResponse, helper);
|
handleStatusResponse(statusResponse, helper);
|
||||||
}).catchError((error) {
|
}).catchError((error) {
|
||||||
handleError(error.toString());
|
handleError(error.toString());
|
||||||
@@ -134,7 +135,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;
|
||||||
print('resp: ${code}');
|
|
||||||
|
|
||||||
if (code == 404) {
|
if (code == 404) {
|
||||||
helper.clear().then((result) {
|
helper.clear().then((result) {
|
||||||
@@ -164,8 +164,9 @@ class _SplashScreenState extends BaseState<SplashScreen> {
|
|||||||
_createToken(SqliteHelper helper) async {
|
_createToken(SqliteHelper helper) async {
|
||||||
String merchantID = await helper.getMerchantID();
|
String merchantID = await helper.getMerchantID();
|
||||||
String posID = await helper.getPosID();
|
String posID = await helper.getPosID();
|
||||||
|
String locale = await helper.getLocale();
|
||||||
|
|
||||||
createToken(merchantID, posID).then((response) {
|
createToken(merchantID, posID, locale).then((response) {
|
||||||
if (response.statusCode == 409) {
|
if (response.statusCode == 409) {
|
||||||
pushRouteReplacement(context, new FinishRegistrationScreen(helper, app));
|
pushRouteReplacement(context, new FinishRegistrationScreen(helper, app));
|
||||||
} else if (response.statusCode == 201) {
|
} else if (response.statusCode == 201) {
|
||||||
@@ -177,10 +178,11 @@ class _SplashScreenState extends BaseState<SplashScreen> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Очищаем бд, делаем запрос на удаление токена.
|
/// Очищаем бд, делаем запрос на удаление токена.
|
||||||
void clearToken(Response response, SqliteHelper helper) {
|
Future clearToken(Response response, SqliteHelper helper) async {
|
||||||
|
String locale = await helper.getLocale();
|
||||||
helper.clear().then((_) {
|
helper.clear().then((_) {
|
||||||
Map parsedMap = JSON.decode(response.body);
|
Map parsedMap = JSON.decode(response.body);
|
||||||
deleteToken(parsedMap['token']).then((_) {
|
deleteToken(parsedMap['token'], locale).then((_) {
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
pushRouteReplacement(context, new RegistrationScreen(helper, app));
|
pushRouteReplacement(context, new RegistrationScreen(helper, app));
|
||||||
}).catchError((error) {
|
}).catchError((error) {
|
||||||
|
|||||||
@@ -50,6 +50,16 @@ class StringsLocalization {
|
|||||||
singular = singularHryvna();
|
singular = singularHryvna();
|
||||||
plural = pluralHryvna();
|
plural = pluralHryvna();
|
||||||
break;
|
break;
|
||||||
|
case 978:
|
||||||
|
nominative = nominativeHryvna();
|
||||||
|
singular = singularHryvna();
|
||||||
|
plural = pluralHryvna();
|
||||||
|
break;
|
||||||
|
case 398:
|
||||||
|
nominative = nominativeTenge();
|
||||||
|
singular = singularTenge();
|
||||||
|
plural = pluralTenge();
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -59,13 +69,11 @@ class StringsLocalization {
|
|||||||
|
|
||||||
static String confirmPurchase(String val, int code) {
|
static String confirmPurchase(String val, int code) {
|
||||||
String trimmedVal =val.substring(0, val.length - 3);
|
String trimmedVal =val.substring(0, val.length - 3);
|
||||||
print(trimmedVal);
|
|
||||||
return sprintf(Intl.message('confirm_purchase', name: 'confirm_purchase', locale: Intl.defaultLocale), [trimmedVal, declineCurrency(int.parse(trimmedVal), code)]);
|
return sprintf(Intl.message('confirm_purchase', name: 'confirm_purchase', locale: Intl.defaultLocale), [trimmedVal, declineCurrency(int.parse(trimmedVal), code)]);
|
||||||
}
|
}
|
||||||
|
|
||||||
static String purchaseCompleted(String val, int code) {
|
static String purchaseCompleted(String val, int code) {
|
||||||
String trimmedVal =val.substring(0, val.length - 3);
|
String trimmedVal =val.substring(0, val.length - 3);
|
||||||
print(trimmedVal);
|
|
||||||
return sprintf(Intl.message('purchase_complite', name: 'purchase_complite', locale: Intl.defaultLocale), [val, declineCurrency(int.parse(trimmedVal), code)]);
|
return sprintf(Intl.message('purchase_complite', name: 'purchase_complite', locale: Intl.defaultLocale), [val, declineCurrency(int.parse(trimmedVal), code)]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -82,7 +90,6 @@ class StringsLocalization {
|
|||||||
static String appActivated() => Intl.message('app_activ', name: 'app_activ', locale: Intl.defaultLocale);
|
static String appActivated() => Intl.message('app_activ', name: 'app_activ', locale: Intl.defaultLocale);
|
||||||
static String completeRegistration() => Intl.message('complite_activ', name: 'complite_activ', locale: Intl.defaultLocale);
|
static String completeRegistration() => Intl.message('complite_activ', name: 'complite_activ', locale: Intl.defaultLocale);
|
||||||
static String cardScanner() => Intl.message('card_scaner', name: 'card_scaner', locale: Intl.defaultLocale);
|
static String cardScanner() => Intl.message('card_scaner', name: 'card_scaner', locale: Intl.defaultLocale);
|
||||||
static String userName() => Intl.message('user_name', name: 'user_name', locale: Intl.defaultLocale);
|
|
||||||
static String card() => Intl.message('card', name: 'card', locale: Intl.defaultLocale);
|
static String card() => Intl.message('card', name: 'card', locale: Intl.defaultLocale);
|
||||||
static String reward() => Intl.message('reward', name: 'reward', locale: Intl.defaultLocale);
|
static String reward() => Intl.message('reward', name: 'reward', locale: Intl.defaultLocale);
|
||||||
static String sum() => Intl.message('sum', name: 'sum', locale: Intl.defaultLocale);
|
static String sum() => Intl.message('sum', name: 'sum', locale: Intl.defaultLocale);
|
||||||
@@ -102,6 +109,11 @@ class StringsLocalization {
|
|||||||
static String singularRuble() => Intl.message('singular_ruble', name: 'singular_ruble', locale: Intl.defaultLocale);
|
static String singularRuble() => Intl.message('singular_ruble', name: 'singular_ruble', locale: Intl.defaultLocale);
|
||||||
static String pluralRuble() => Intl.message('plural_ruble', name: 'plural_ruble', locale: Intl.defaultLocale);
|
static String pluralRuble() => Intl.message('plural_ruble', name: 'plural_ruble', locale: Intl.defaultLocale);
|
||||||
|
|
||||||
|
static String nominativeEuro() => Intl.message('nominative_euro', name: 'nominative_euro', locale: Intl.defaultLocale);
|
||||||
|
static String singularEuro() => Intl.message('singular_euro', name: 'singular_euro', locale: Intl.defaultLocale);
|
||||||
|
static String pluralEuro() => Intl.message('plural_euro', name: 'plural_euro', locale: Intl.defaultLocale);
|
||||||
|
|
||||||
|
|
||||||
static String nominativeDollar() => Intl.message('nominative_dollar', name: 'nominative_dollar', locale: Intl.defaultLocale);
|
static String nominativeDollar() => Intl.message('nominative_dollar', name: 'nominative_dollar', locale: Intl.defaultLocale);
|
||||||
static String singularDollar() => Intl.message('singular_dollar', name: 'singular_dollar', locale: Intl.defaultLocale);
|
static String singularDollar() => Intl.message('singular_dollar', name: 'singular_dollar', locale: Intl.defaultLocale);
|
||||||
static String pluralDollar() => Intl.message('plural_dollar', name: 'plural_dollar', locale: Intl.defaultLocale);
|
static String pluralDollar() => Intl.message('plural_dollar', name: 'plural_dollar', locale: Intl.defaultLocale);
|
||||||
@@ -110,4 +122,8 @@ class StringsLocalization {
|
|||||||
static String singularHryvna() => Intl.message('singular_hryvna', name: 'singular_hryvna', locale: Intl.defaultLocale);
|
static String singularHryvna() => Intl.message('singular_hryvna', name: 'singular_hryvna', locale: Intl.defaultLocale);
|
||||||
static String pluralHryvna() => Intl.message('plural_hryvna', name: 'plural_hryvna', locale: Intl.defaultLocale);
|
static String pluralHryvna() => Intl.message('plural_hryvna', name: 'plural_hryvna', locale: Intl.defaultLocale);
|
||||||
|
|
||||||
|
static String nominativeTenge() => Intl.message('nominative_tenge', name: 'nominative_tenge', locale: Intl.defaultLocale);
|
||||||
|
static String singularTenge() => Intl.message('singular_tenge', name: 'singular_tenge', locale: Intl.defaultLocale);
|
||||||
|
static String pluralTenge() => Intl.message('plural_tenge', name: 'plural_tenge', locale: Intl.defaultLocale);
|
||||||
|
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user