diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index b6654cc..a3a4e58 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -1,8 +1,8 @@ + android:versionCode="6" + android:versionName="1.1.8"> "Identifier %s is not found" Enter the card number Phone 79XXXXXXXXX - You can use manual input or call the number:\n%s + You can use manual input or call the number:%s Store ID Identifier %s is not found The application is activated @@ -74,11 +74,11 @@ Store log in screen is the first thing you will see after starting the applicati Enter the store number (ID). You can look it up in the loyalty program control panel. If you do not have access to the control panel, ask the administrator. -Click the ""Login"" button. +Click the "Login" button. Please wait while the administrator activates your request. You can refresh your store activation status by pressing the "Update activation status" button. -After the administrator activates your request, click the ""Complete activation"" button. The application is ready to use. +After the administrator activates your request, click the "Complete activation" button. The application is ready to use. If you want to log in as another store, click the Menu button (upper right corner of the screen) and select "Exit". @@ -92,11 +92,11 @@ If the scan is successful, the customer's information will appear on the screen. Step 2: -Enter the purchase amount and click the ""Create a purchase"" button. +Enter the purchase amount and click the "Create a purchase" button. -In a pop-up window press ""YES"" to confirm the amount and allot the points to a customer. +In a pop-up window press "YES" to confirm the amount and allot the points to a customer. -If you want to correct the amount, press ""NO"" and you will return back to the purchase screen where you can adjust the amount. +If you want to correct the amount, press "NO" and you will return back to the purchase screen where you can adjust the amount. diff --git a/assets/values-es/strings.xml b/assets/values-es/strings.xml index 0b4900f..689269b 100644 --- a/assets/values-es/strings.xml +++ b/assets/values-es/strings.xml @@ -64,12 +64,12 @@ Store log in screen is the first thing you will see after starting the applicati Enter the store number (DIN). You can look it up in the loyalty program control panel. If you do not have access to the control panel, ask the administrator. -Click the ""Login"" button. +Click the "Login" button. Please wait while the administrator activates your request. You can refresh your store activation -status by pressing the ""Update activation status"" button. +status by pressing the "Update activation status" button. -After the administrator activates your request, click the ""Complete activation"" button. The +After the administrator activates your request, click the "Complete activation" button. The application is ready to use. If you want to log in as another store, click the Menu button (upper right corner of the screen) @@ -84,11 +84,11 @@ If the scan is successful, the customer's information will appear on the screen. Step 2: -Enter the purchase amount and click the ""Create a purchase"" button. +Enter the purchase amount and click the "Create a purchase" button. -In a pop-up window press ""YES"" to confirm the amount and allot the points to a customer. +In a pop-up window press "YES" to confirm the amount and allot the points to a customer. -If you want to correct the amount, press ""NO"" and you will return back to the purchase screen +If you want to correct the amount, press "NO" and you will return back to the purchase screen where you can adjust the amount. diff --git a/assets/values-ru/strings.xml b/assets/values-ru/strings.xml index 39182dc..055e639 100644 --- a/assets/values-ru/strings.xml +++ b/assets/values-ru/strings.xml @@ -79,7 +79,7 @@ После подтверждения запроса на активацию программы Партнером/менеджером кликните по кнопке «Завершить регистрацию», приложение готово к использованию. -При желании изменить ID магазина, необходимо нажать на кнопку Меню (верхний правый угол экрана) и выбрать "Выход". +При желании изменить ID магазина, необходимо нажать на кнопку Меню (верхний правый угол экрана) и выбрать «Выход». @@ -93,7 +93,7 @@ Введите сумму покупки данного покупателя и нажмите на кнопку «Проведение покупки». -Во всплывающем окне нажмите ""ДА"", для подтверждения суммы покупки +Во всплывающем окне нажмите «ДА», для подтверждения суммы покупки Если вы хотите поправить сумму, нажмите «НЕТ» и Вы вернетесь на экран покупки и сможете её скорректировать. diff --git a/assets/values-ua/strings.xml b/assets/values-ua/strings.xml index b1509d0..ecd0935 100644 --- a/assets/values-ua/strings.xml +++ b/assets/values-ua/strings.xml @@ -8,7 +8,7 @@ "Ідентифікатор %s не знайден Введіть штрихкод вручну Телефон 79XXXXXXXXX - Можете скористатися ручним введенням або зателефонувати на номер:\n%s + Можете скористатися ручним введенням або зателефонувати на номер:%s ID магазину Ідентифікатор %s не знайден Додаток активований diff --git a/ios/Runner.xcodeproj/project.xcworkspace/xcuserdata/kifio.xcuserdatad/UserInterfaceState.xcuserstate b/ios/Runner.xcodeproj/project.xcworkspace/xcuserdata/kifio.xcuserdatad/UserInterfaceState.xcuserstate index 133e97a..9c19406 100644 Binary files a/ios/Runner.xcodeproj/project.xcworkspace/xcuserdata/kifio.xcuserdatad/UserInterfaceState.xcuserstate and b/ios/Runner.xcodeproj/project.xcworkspace/xcuserdata/kifio.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/ios/Runner.xcodeproj/project.xcworkspace/xcuserdata/kifio.xcuserdatad/WorkspaceSettings.xcsettings b/ios/Runner.xcodeproj/project.xcworkspace/xcuserdata/kifio.xcuserdatad/WorkspaceSettings.xcsettings new file mode 100644 index 0000000..a8f6112 --- /dev/null +++ b/ios/Runner.xcodeproj/project.xcworkspace/xcuserdata/kifio.xcuserdatad/WorkspaceSettings.xcsettings @@ -0,0 +1,8 @@ + + + + + BuildLocationStyle + UseTargetSettings + + diff --git a/lib/common.dart b/lib/common.dart index 075ffd2..cb9e2ff 100644 --- a/lib/common.dart +++ b/lib/common.dart @@ -1,7 +1,9 @@ +import 'dart:async'; + import 'package:checker/screens/faq.dart'; import 'package:checker/screens/purchase.dart'; +import 'package:checker/screens/registration.dart'; import 'package:checker/screens/settings.dart'; -import 'package:checker/screens/splash.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:image_picker/image_picker.dart'; @@ -19,13 +21,18 @@ const platform = const MethodChannel('com.dinect.checker/instance_id'); pushRouteReplacement(BuildContext context, Widget widget) { var route = new MaterialPageRoute(builder: (BuildContext context) => widget); - Navigator.of(context).pushReplacement(route); + new Future.delayed(const Duration(milliseconds: 200), () { + Navigator.of(context).pushReplacement(route); + }); } pushRoute(BuildContext context, Widget widget) { var route = - new MaterialPageRoute(builder: (BuildContext context) => widget); - Navigator.of(context).push(route); + new MaterialPageRoute(builder: (BuildContext context) => widget, fullscreenDialog: true); + new Future.delayed(const Duration(milliseconds: 200), () + { + Navigator.of(context).push(route); + }); } // Добавление route, с возможностью вернуться к предыдущему экрану. @@ -37,24 +44,24 @@ faq(SqliteHelper helper, String app, BuildContext context, // В методе отправляется запрос на удаление токена кассы, очищаются SharedPreferences приложения. logout(BuildContext context, SqliteHelper helper) async { String token = await helper.getToken(); -// String locale = await helper.getLocale(); - VoidCallback positiveCallback = () { if (token != null) { getDeleteTokenRequest(token).then((response) { helper.clear().then((result) { -// helper.close().then((_) { -// Navigator.of(context).pop(); - // Navigator.of(context).pop(); - pushRouteReplacement(context, new SplashScreen()); // Запускаем регистрацию -// }); + platform.invokeMethod('getFlavor').then((flavor) { + while (Navigator.of(context).canPop()) { + Navigator.of(context).pop(); + } + pushRouteReplacement(context, new RegistrationScreen(helper, flavor)); + }); }); }).catchError((error) { print(error.toString()); }); } else { - Navigator.of(context).pop(); - Navigator.of(context).pop(); + while (Navigator.of(context).canPop()) { + Navigator.of(context).pop(); + } } }; @@ -62,56 +69,27 @@ logout(BuildContext context, SqliteHelper helper) async { StringsLocalization.askChangeStore(), positiveCallback); } -forceLogout(String token, BuildContext context) async { - getDeleteTokenRequest(token).then((response) { - SqliteHelper helper = new SqliteHelper(); - helper.open().then((_) { - helper.clear().then((_) { -// helper.close().then((_) { - while (Navigator.of(context).canPop()) { - Navigator.of(context).pop(); - } - pushRouteReplacement(context, new SplashScreen()); -// }); - }); - }); - }).catchError((error) { - print(error.toString()); - }); -} - /// Запуск спецефичной для каждой платформы части приложения - сканера. /// Может производиться с нескольких экранов (splash, finish_registration). startScanner(BuildContext context, String app, SqliteHelper helper) async { - if (helper == null) { - helper = new SqliteHelper(); - helper.open().then((_) { - startScanner(context, app, helper); - }); - } else { String token = await helper.getToken(); // Канал ловит вызовы методов из "нативной" части приложения. // Могут быть вызваны либо exit либо faq, либо purchase. if (token != null) { platform.setMethodCallHandler((MethodCall call) async { - print('flutter handler'); - print(call.method); - if (call.method == 'findUser') { - var userResponse; String cardPhone = call.arguments[0]; try { switch (call.arguments[1]) { case 'card': - userResponse = await getUserByCard(cardPhone,token); + userResponse = await getUserByCard(cardPhone, token); break; case 'phone': - userResponse = await getUserByPhone(cardPhone,token); + userResponse = await getUserByPhone(cardPhone, token); break; } - } catch (error) { print(error.toString()); } @@ -119,7 +97,7 @@ startScanner(BuildContext context, String app, SqliteHelper helper) async { List users; - try{ + try { users = JSON.decode(userResponse.body); } catch (error) { print(error); @@ -131,8 +109,6 @@ startScanner(BuildContext context, String app, SqliteHelper helper) async { startScanner(context, app, helper); throw new FlutterError("Users not found"); } - - } else if (call.method == 'faq') { faq(helper, app, context, true); } else if (call.method == 'settings') { @@ -150,13 +126,7 @@ startScanner(BuildContext context, String app, SqliteHelper helper) async { String card = call.arguments[1]; print('$userString, $card'); - var route = new MaterialPageRoute( - builder: (BuildContext context) => - new PurchaseScreen(helper, app, userString, card)); - while (Navigator.of(context).canPop()) { - Navigator.of(context).pop(); - } - Navigator.of(context).pushReplacement(route); + pushRouteReplacement(context, new PurchaseScreen(helper, app, userString, card)); } }); @@ -166,12 +136,14 @@ startScanner(BuildContext context, String app, SqliteHelper helper) async { 'url': await platform.invokeMethod('getEndpoint'), 'appToken': await platform.invokeMethod('getAppToken'), 'localeCode': StringsLocalization.localeCode, - 'color': Resources.getPrimaryColor(app).value.toString() + 'color': Resources + .getPrimaryColor(app) + .value + .toString() }); platform.invokeMethod('startScanner', args); } - } } // Запуск диалога с двумя кнопками diff --git a/lib/resources.dart b/lib/resources.dart index f0d80fc..eeb64a0 100644 --- a/lib/resources.dart +++ b/lib/resources.dart @@ -7,7 +7,6 @@ class Resources { } static String getSplash(String app) { -// app != null ? app : return 'assets/${'pip'}_splash.png'; } diff --git a/lib/screens/purchase.dart b/lib/screens/purchase.dart index 29591b0..7afd0ed 100644 --- a/lib/screens/purchase.dart +++ b/lib/screens/purchase.dart @@ -45,7 +45,7 @@ class PurchaseScreenState extends BaseState { setState(() { requestAsyncData(user); }); - return getMainWidget(); + return new WillPopScope(onWillPop: onWillPop, child: getMainWidget()); } bool purchaseInProgress = false; @@ -423,4 +423,8 @@ class PurchaseScreenState extends BaseState { print('kifio ' + this.loyalty); print('bonus ' + this.bonus); } + + onWillPop() { + return startScanner(context, app, helper); + } }