diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index 4909ae60..4fc6eec0 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -388,7 +388,7 @@ CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; CODE_SIGN_IDENTITY = "Apple Distribution: ITVIO, OOO (VL68C36HYS)"; CODE_SIGN_STYLE = Manual; - CURRENT_PROJECT_VERSION = 29; + CURRENT_PROJECT_VERSION = 30; DEVELOPMENT_TEAM = VL68C36HYS; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( @@ -538,7 +538,7 @@ CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; CODE_SIGN_IDENTITY = "Apple Distribution: ITVIO, OOO (VL68C36HYS)"; CODE_SIGN_STYLE = Manual; - CURRENT_PROJECT_VERSION = 29; + CURRENT_PROJECT_VERSION = 30; DEVELOPMENT_TEAM = VL68C36HYS; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( @@ -576,7 +576,7 @@ CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; CODE_SIGN_IDENTITY = "Apple Distribution: ITVIO, OOO (VL68C36HYS)"; CODE_SIGN_STYLE = Manual; - CURRENT_PROJECT_VERSION = 29; + CURRENT_PROJECT_VERSION = 30; DEVELOPMENT_TEAM = VL68C36HYS; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( diff --git a/ios/Runner/Info.plist b/ios/Runner/Info.plist index a05cd62d..f93e2e21 100644 --- a/ios/Runner/Info.plist +++ b/ios/Runner/Info.plist @@ -21,7 +21,7 @@ CFBundleSignature ???? CFBundleVersion - 29 + 30 ITSAppUsesNonExemptEncryption LSRequiresIPhoneOS diff --git a/lib/core/app_router.dart b/lib/core/app_router.dart index a07e12ba..c29754ab 100644 --- a/lib/core/app_router.dart +++ b/lib/core/app_router.dart @@ -8,6 +8,7 @@ import 'package:eatvio_app/core/websockets/ws_manager.dart'; import 'package:eatvio_app/core/locator_service.dart'; import 'package:eatvio_app/features/auth/presentation/pages/auth_screen.dart'; import 'package:eatvio_app/features/auth/presentation/pages/forget_password_screen.dart'; +import 'package:eatvio_app/features/auth/presentation/pages/scan_qr_code_screen.dart'; import 'package:eatvio_app/features/blog_post/presentation/pages/blog_post_screen.dart'; import 'package:eatvio_app/features/blog_post_create/presentation/pages/blog_post_create_screen.dart'; import 'package:eatvio_app/features/bottom_navigation_bar/presentation/bloc/profile_avatar_cubit/profile_avatar_cubit.dart'; @@ -96,6 +97,11 @@ class AppRouter { name: 'forgetPasswordScreen', builder: (context, state) => const ForgetPasswordScreen(), ), + GoRoute( + path: 'scan-qr-code-screen', + name: 'scanQRCodeScreen', + builder: (context, state) => const ScanQRCodeScreen(), + ), ], ), ShellRoute( diff --git a/lib/features/auth/presentation/pages/auth_screen.dart b/lib/features/auth/presentation/pages/auth_screen.dart index 123eac0f..147e71cd 100644 --- a/lib/features/auth/presentation/pages/auth_screen.dart +++ b/lib/features/auth/presentation/pages/auth_screen.dart @@ -204,38 +204,68 @@ class _AuthScreenState extends State { ), ), const SizedBox(height: 16), - SizedBox( - height: 48, - width: MediaQuery.of(context).size.width - 32, - child: FloatingActionButton.extended( - heroTag: 'authButton', - highlightElevation: 0, - elevation: 0, - focusElevation: 0, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(20), + Row( + children: [ + SizedBox( + height: 48, + width: MediaQuery.of(context).size.width - 88, + child: FloatingActionButton.extended( + heroTag: 'authButton', + highlightElevation: 0, + elevation: 0, + focusElevation: 0, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(20), + ), + backgroundColor: state is AuthStateLoading ? Colors.black.withAlpha(50) : appTheme.blueA400, + onPressed: state is AuthStateLoading + ? null + : () async { + final isAuthenticated = await authCubit.getTokenByCredentials( + emailController.text, + passwordController.text, + ); + if (isAuthenticated) { + if (context.mounted) { + _reconnectWebSocket(context); + } + } + }, + label: state is AuthStateLoading + ? const CupertinoActivityIndicator() + : Text( + 'Войти', + style: theme.textTheme.titleSmall!.copyWith(color: Colors.white), + ), + ), ), - backgroundColor: state is AuthStateLoading ? Colors.black.withAlpha(50) : appTheme.blueA400, - onPressed: state is AuthStateLoading - ? null - : () async { - final isAuthenticated = await authCubit.getTokenByCredentials( - emailController.text, - passwordController.text, - ); - if (isAuthenticated) { - if (context.mounted) { - _reconnectWebSocket(context); - } - } - }, - label: state is AuthStateLoading - ? const CupertinoActivityIndicator() - : Text( - 'Войти', - style: theme.textTheme.titleSmall!.copyWith(color: Colors.white), - ), - ), + const SizedBox(width: 8), + SizedBox( + height: 48, + width: 48, + child: FloatingActionButton.extended( + heroTag: 'authButton', + highlightElevation: 0, + elevation: 0, + focusElevation: 0, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(16), + ), + backgroundColor: state is AuthStateLoading ? Colors.black.withAlpha(50) : appTheme.blueA400, + onPressed: state is AuthStateLoading + ? null + : () { + GoRouter.of(context).pushNamed('scanQRCodeScreen'); + }, + label: state is AuthStateLoading + ? const CupertinoActivityIndicator() + : const Icon( + Icons.qr_code_scanner_rounded, + color: Colors.white, + ), + ), + ), + ], ), ], ), diff --git a/lib/features/auth/presentation/pages/scan_qr_code_screen.dart b/lib/features/auth/presentation/pages/scan_qr_code_screen.dart new file mode 100644 index 00000000..2b72d3a0 --- /dev/null +++ b/lib/features/auth/presentation/pages/scan_qr_code_screen.dart @@ -0,0 +1,20 @@ +import 'package:flutter/material.dart'; + +class ScanQRCodeScreen extends StatefulWidget { + const ScanQRCodeScreen({super.key}); + + @override + State createState() => _ScanQRCodeScreenState(); +} + +class _ScanQRCodeScreenState extends State { + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: const Text('Сканирование QR-кода'), + centerTitle: true, + ), + ); + } +} diff --git a/lib/features/chat/presentation/bloc/chat_room_cubit/chat_room_cubit.dart b/lib/features/chat/presentation/bloc/chat_room_cubit/chat_room_cubit.dart index 58a53ac0..cbb886c2 100644 --- a/lib/features/chat/presentation/bloc/chat_room_cubit/chat_room_cubit.dart +++ b/lib/features/chat/presentation/bloc/chat_room_cubit/chat_room_cubit.dart @@ -176,9 +176,19 @@ class ChatRoomCubit extends Cubit { }); } - Future sendMessage({required String chatId, String? data, List? files}) async { + Future sendMessage({ + required String chatId, + String? data, + List? files, + required String userSlug, + }) async { try { - await chatRepository.sendMessage(chatId: chatId, data: data, files: files != null ? await ImageCompressUtility.compressFilesList(files) : null); + await chatRepository.sendMessage( + chatId: chatId, + data: data, + files: files != null ? await ImageCompressUtility.compressFilesList(files) : null, + slug: userSlug, + ); AudioPlayer().play((AssetSource('audio/send_message.wav'))); return true; } catch (e, st) { diff --git a/lib/features/chat/presentation/pages/chat_screen.dart b/lib/features/chat/presentation/pages/chat_screen.dart index 3f7f1cdd..ba08452a 100644 --- a/lib/features/chat/presentation/pages/chat_screen.dart +++ b/lib/features/chat/presentation/pages/chat_screen.dart @@ -341,7 +341,7 @@ class _ChatScreenState extends State { children: [ const SizedBox(width: 8), InkWell( - onTap: () => showImagePicker(), + onTap: () => showImagePicker(state.chatRoom.users.receiver.slug), customBorder: const CircleBorder(), child: Ink( height: 40, @@ -386,7 +386,11 @@ class _ChatScreenState extends State { customBorder: const CircleBorder(), onTap: () { if (textEditingController.text.isNotEmpty) { - chatRoomCubit.sendMessage(chatId: widget.chatId, data: textEditingController.text.trim()); + chatRoomCubit.sendMessage( + chatId: widget.chatId, + data: textEditingController.text.trim(), + userSlug: state.chatRoom.users.receiver.slug, + ); setState(() { textEditingController.clear(); }); @@ -421,7 +425,7 @@ class _ChatScreenState extends State { ); } - showImagePicker() { + showImagePicker(String slug) { showCupertinoModalPopup( context: context, builder: (context) => CupertinoActionSheet( @@ -432,7 +436,7 @@ class _ChatScreenState extends State { final picker = ImagePicker(); XFile? image = await picker.pickImage(source: ImageSource.camera); if (image != null) { - await chatRoomCubit.sendMessage(chatId: widget.chatId, files: [File(image.path)]); + await chatRoomCubit.sendMessage(chatId: widget.chatId, files: [File(image.path)], userSlug: slug); } }, child: const Row( @@ -472,7 +476,7 @@ class _ChatScreenState extends State { ); if (result != null) { List files = result.paths.map((path) => File(path!)).toList(); - await chatRoomCubit.sendMessage(chatId: widget.chatId, files: files); + await chatRoomCubit.sendMessage(chatId: widget.chatId, files: files, userSlug: slug); } }, child: const Row( diff --git a/lib/features/chat/repositories/chat_repository.dart b/lib/features/chat/repositories/chat_repository.dart index 4d1e9214..1215a5f6 100644 --- a/lib/features/chat/repositories/chat_repository.dart +++ b/lib/features/chat/repositories/chat_repository.dart @@ -28,6 +28,7 @@ class ChatRepository { Future sendMessage({ required String chatId, + required String slug, String? data, List? files, }) async { @@ -46,8 +47,8 @@ class ChatRepository { } } - await chatService.sendMessage( - id: chatId, + await chatService.sendMessageByUserSlug( + userSlug: slug, data: data, mediaData: multipartFiles.isEmpty ? null : multipartFiles, ); diff --git a/pubspec.yaml b/pubspec.yaml index 598e1121..e9316685 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: eatvio_app description: A new Flutter project. -version: 1.1.6+36 +version: 1.1.7+37 publish_to: 'none' environment: