diff --git a/ios/Runner/Info.plist b/ios/Runner/Info.plist
index f5484e9..4dea81c 100644
--- a/ios/Runner/Info.plist
+++ b/ios/Runner/Info.plist
@@ -41,5 +41,9 @@
UIViewControllerBasedStatusBarAppearance
+ NSCameraUsageDescription
+ Требуется доступ к камере для сканирования QR-кодов и штрих-кодов
+ io.flutter.embedded_views_preview
+
diff --git a/lib/core/redux/actions/user_actions.dart b/lib/core/redux/actions/user_actions.dart
index 440c280..d785136 100644
--- a/lib/core/redux/actions/user_actions.dart
+++ b/lib/core/redux/actions/user_actions.dart
@@ -45,6 +45,27 @@ ThunkAction authenticate(String email, String password) {
};
}
+ThunkAction authenticateByToken(String token) {
+ return (Store store) async {
+ store.dispatch(SetUserStateAction(UserState(isLoading: true)));
+ try {
+ AuthResponse result = await _api.authorization(token);
+ if ( result.operation!) {
+ _api.token = result.token!;
+ store.dispatch(SetUserStateAction(UserState(isLoading: false, auth: result)));
+ _navigation.replace(MainViewRoute);
+ _afterAuth(store);
+ } else {
+ _dialogService.showDialog(title: 'Внимание', buttonTitle: 'Ok', description: result.message!);
+ }
+ } catch (e) {
+ print(e);
+ } finally {
+ store.dispatch(SetUserStateAction(UserState(isLoading: false)));
+ }
+ };
+}
+
Future auth(Store store) async {
store.dispatch(SetUserStateAction(UserState(isLoading: true)));
try {
diff --git a/lib/core/redux/store.dart b/lib/core/redux/store.dart
index c668bcb..d344ab9 100644
--- a/lib/core/redux/store.dart
+++ b/lib/core/redux/store.dart
@@ -95,8 +95,8 @@ class Redux {
serializer: JsonSerializer(AppState.fromJson), // Or use other serializers
);
- final initialState = await persist.load();
- final userStateInitial = UserState.initial(initialState!.userState!);
+ final AppState? initialState = await persist.load();
+ final userStateInitial = UserState.initial(initialState?.userState);
final navStateInitial = NavState.initial();
final sellStateInitial = SellState.initial();
diff --git a/lib/core/services/dictionary_service.dart b/lib/core/services/dictionary_service.dart
index cb69690..35c4b08 100644
--- a/lib/core/services/dictionary_service.dart
+++ b/lib/core/services/dictionary_service.dart
@@ -91,6 +91,22 @@ class DictionaryService extends BaseService {
return list;
}
+ Future> getGoodsByEan( String code ) async {
+ List list = [];
+ try {
+ int? appCompanyId = Redux.store!.state.userState!.auth!.companyId;
+ String where = '( $GoodColumnAppCompanyId = ? and $GoodColumnEan like ? ) ';
+ List args = [appCompanyId, '%$code%'];
+ List