Исправление замечаний
This commit is contained in:
@@ -31,20 +31,20 @@ faq(BuildContext context, bool returnToScanner) {
|
||||
}
|
||||
|
||||
// В методе отправляется запрос на удаление токена кассы, очищаются SharedPreferences приложения.
|
||||
logout(BuildContext context) async {
|
||||
logout(BuildContext context, SqliteHelper helper) async {
|
||||
|
||||
SqliteHelper helper = new SqliteHelper();
|
||||
await helper.open();
|
||||
String token = await helper.getToken();
|
||||
String locale = await helper.getLocale();
|
||||
|
||||
VoidCallback positiveCallback = () {
|
||||
if (token != null) {
|
||||
deleteToken(token).then((response) {
|
||||
print(response.body);
|
||||
platform.invokeMethod('removeKeys').then((result) {
|
||||
deleteToken(token, locale).then((response) {
|
||||
helper.clear().then((result) {
|
||||
helper.close().then((_) {
|
||||
Navigator.of(context).pop();
|
||||
Navigator.of(context).pop();
|
||||
pushRouteReplacement(context, new SplashScreen()); // Запускаем регистрацию
|
||||
});
|
||||
});
|
||||
}).catchError((error) {
|
||||
print(error.toString());
|
||||
@@ -60,8 +60,7 @@ logout(BuildContext context) async {
|
||||
|
||||
forceLogout(String token , BuildContext context) async {
|
||||
|
||||
deleteToken(token).then((response) {
|
||||
print(response.body);
|
||||
deleteToken(token, 'ru').then((response) {
|
||||
SqliteHelper helper = new SqliteHelper();
|
||||
helper.open().then((_) {
|
||||
helper.clear().then((_) {
|
||||
@@ -87,16 +86,13 @@ startScanner(BuildContext context, String app, SqliteHelper helper) async {
|
||||
if (token != null) {
|
||||
platform.setMethodCallHandler((MethodCall call) async {
|
||||
|
||||
print('call.method: ${call.method}');
|
||||
if (call.method == 'logout') {
|
||||
forceLogout(token, context);
|
||||
} else if (call.method == 'faq') {
|
||||
faq(context, true);
|
||||
} else {
|
||||
String userString = call.arguments[0];
|
||||
print('user: ${userString}');
|
||||
String card = call.arguments[1];
|
||||
print('card: ${card}');
|
||||
var route = new MaterialPageRoute<Null>(builder: (BuildContext context) => new PurchaseScreen(userString, card));
|
||||
Navigator.of(context).pushReplacement(route);
|
||||
}
|
||||
@@ -133,6 +129,8 @@ getCurrencyTitle(int code) {
|
||||
case 643: return StringsLocalization.nominativeRuble();
|
||||
case 840: return StringsLocalization.nominativeDollar();
|
||||
case 980: return StringsLocalization.nominativeHryvna();
|
||||
case 978: return StringsLocalization.nominativeEuro();
|
||||
case 398: return StringsLocalization.nominativeEuro();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user