From 478ac139ddc458c4cc26cee6c97a02e8b89a9467 Mon Sep 17 00:00:00 2001 From: mso7nueh Date: Fri, 4 Jul 2025 16:27:18 +0300 Subject: [PATCH 01/10] feat(chat): WIP: Issue-1594 --- lib/core/app_router.dart | 4 ++-- lib/core/const.dart | 2 +- lib/core/token_storage.dart | 22 +++++++++++++++++++ lib/core/websockets/ws_manager.dart | 21 +++++++++++++++++- lib/features/chat/models/chat_room_model.dart | 2 +- .../models/chat_room_pagination_model.dart | 14 +----------- .../chat/models/chat_room_settings_model.dart | 5 +---- .../bloc/chat_room_cubit/chat_room_cubit.dart | 16 +++++++------- .../bloc/chats_cubit/chats_cubit.dart | 10 ++++----- .../chat/presentation/pages/chat_screen.dart | 10 ++++----- .../presentation/pages/empty_chat_screen.dart | 8 +++---- .../widgets/chat_entry_widget.dart | 2 +- .../chat/repositories/chat_repository.dart | 18 ++++++++------- lib/features/chat/services/chat_service.dart | 19 +++++----------- .../presentation/pages/about_plan_screen.dart | 2 +- .../bloc/profile_cubit/profile_cubit.dart | 2 +- .../widgets/sub_action_button_widget.dart | 2 +- 17 files changed, 90 insertions(+), 69 deletions(-) diff --git a/lib/core/app_router.dart b/lib/core/app_router.dart index 223a8913..9dc8612f 100644 --- a/lib/core/app_router.dart +++ b/lib/core/app_router.dart @@ -373,10 +373,10 @@ class AppRouter { name: 'chatScreen', builder: (context, state) { final data = state.extra as Map; - final chatId = data['chatId'] as String; + final uuid = data['uuid'] as String; final sendInitialMessage = data['sendInitialMessage'] as bool?; return ChatScreen( - chatId: chatId, + uuid: uuid, sendInitialMessage: sendInitialMessage, ); }, diff --git a/lib/core/const.dart b/lib/core/const.dart index 618a9866..8f5ddb59 100644 --- a/lib/core/const.dart +++ b/lib/core/const.dart @@ -1,4 +1,4 @@ -String baseUrl = 'https://eatvio.ru'; +String baseUrl = 'https://mobile-stage.eatvio.ru'; const List durationValues = [7, 14, 21]; diff --git a/lib/core/token_storage.dart b/lib/core/token_storage.dart index cbfb8abb..30906264 100644 --- a/lib/core/token_storage.dart +++ b/lib/core/token_storage.dart @@ -21,3 +21,25 @@ abstract class TokenStorage { static Future removeTokenInStorage() async => (await const FlutterSecureStorage().delete(key: 'token')); } + +abstract class SocketIdStorage { + static Future haveSocketIdInStorage() async { + try { + if (await const FlutterSecureStorage().read(key: 'socketId') == null) { + return false; + } else { + return true; + } + } catch (e) { + return false; + } + } + + static Future getSocketIdFromStorage() async => await const FlutterSecureStorage().read(key: 'socketId'); + + static Future saveSocketIdInStorage(String socketId) async { + await const FlutterSecureStorage().write(key: 'socketId', value: socketId); + } + + static Future removeSocketIdInStorage() async => (await const FlutterSecureStorage().delete(key: 'socketId')); +} diff --git a/lib/core/websockets/ws_manager.dart b/lib/core/websockets/ws_manager.dart index 73431542..0a5f7241 100644 --- a/lib/core/websockets/ws_manager.dart +++ b/lib/core/websockets/ws_manager.dart @@ -1,3 +1,4 @@ +import 'dart:convert'; import 'dart:developer'; import 'package:dart_pusher_channels/dart_pusher_channels.dart'; @@ -59,6 +60,24 @@ class WsManager { ), ); + String? extractSocketId(String? data) { + if (data == null) return null; + try { + final decoded = jsonDecode(data); + return decoded['socket_id'] as String?; + } catch (_) { + return null; + } + } + + client?.eventStream.listen((event) async { + if (event.name == 'pusher:connection_established') { + final data = event.data; + final socketId = extractSocketId(data); + await SocketIdStorage.saveSocketIdInStorage(socketId!); + } + }); + await client?.connect(); client = client; @@ -77,7 +96,7 @@ class WsManager { EasyDebounce.debounce( 'searchChatRoom', const Duration(milliseconds: 300), - () => sl().getChatRooms(), + () => sl().getChatRooms(), ); log(event.rootObject.toString()); }); diff --git a/lib/features/chat/models/chat_room_model.dart b/lib/features/chat/models/chat_room_model.dart index d7bf450a..dc091ea6 100644 --- a/lib/features/chat/models/chat_room_model.dart +++ b/lib/features/chat/models/chat_room_model.dart @@ -9,7 +9,7 @@ part 'chat_room_model.g.dart'; @freezed abstract class ChatRoomModel with _$ChatRoomModel { const factory ChatRoomModel({ - required String id, + required String id, @JsonKey(name: 'chat_room_setting') required ChatRoomSettingsModel chatRoomSettings, required Users users, @JsonKey(name: 'chosen_plan_id') required int? chosenPlanId, diff --git a/lib/features/chat/models/chat_room_pagination_model.dart b/lib/features/chat/models/chat_room_pagination_model.dart index 7bb8ceb5..699df5e8 100644 --- a/lib/features/chat/models/chat_room_pagination_model.dart +++ b/lib/features/chat/models/chat_room_pagination_model.dart @@ -8,29 +8,17 @@ part 'chat_room_pagination_model.g.dart'; @freezed abstract class ChatRoomPaginationModel with _$ChatRoomPaginationModel { const factory ChatRoomPaginationModel({ - @JsonKey(name: "chatRooms") required ChatRooms chatRooms, + @JsonKey(name: "data") required List data, @JsonKey(name: "number_of_unread_chat_rooms") required int unreadChatsCount, }) = _ChatRoomPreviewModel; factory ChatRoomPaginationModel.fromJson(Map json) => _$ChatRoomPaginationModelFromJson(json); } -@freezed -abstract class ChatRooms with _$ChatRooms { - const factory ChatRooms({ - @JsonKey(name: "data") required List data, - @JsonKey(name: "last_page") required int lastPage, - @JsonKey(name: "current_page") required int currentPage, - }) = _ChatRooms; - - factory ChatRooms.fromJson(Map json) => _$ChatRoomsFromJson(json); -} - @freezed abstract class ChatRoom with _$ChatRoom { const factory ChatRoom({ @JsonKey(name: "id") required String id, - @JsonKey(name: "room_name") required String roomName, @JsonKey(name: "last_message", fromJson: parseLastMessage) required ChatMessageModel? lastMessage, @JsonKey(name: "users") required Users users, @JsonKey(name: "unread_messages_count") required int unreadMessagesCount, diff --git a/lib/features/chat/models/chat_room_settings_model.dart b/lib/features/chat/models/chat_room_settings_model.dart index 5298d3d9..fa332843 100644 --- a/lib/features/chat/models/chat_room_settings_model.dart +++ b/lib/features/chat/models/chat_room_settings_model.dart @@ -6,11 +6,8 @@ part 'chat_room_settings_model.g.dart'; @freezed abstract class ChatRoomSettingsModel with _$ChatRoomSettingsModel { const factory ChatRoomSettingsModel({ - required int id, - @JsonKey(name: 'room_name') required String roomName, + required String name, required String state, - @JsonKey(name: 'access_level') required String accessLevel, - @JsonKey(name: 'updated_at') required String updatedAt, }) = _ChatRoomSettingsModel; factory ChatRoomSettingsModel.fromJson(Map json) => _$ChatRoomSettingsModelFromJson(json); 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 63bf9e19..40ee862d 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 @@ -47,14 +47,14 @@ class ChatRoomCubit extends Cubit { _timer?.cancel(); } - Future loadNextPage(String chatId) async { + Future loadNextPage(String uuid) async { if (currentPage < lastPage && !isLoading) { isLoading = true; emit((state as ChatRoomStateLoaded).copyWith(isLoading: isLoading)); try { - final chatMessages = await chatRepository.getChatMessages(chatId, currentPage + 1); + final chatMessages = await chatRepository.getChatMessages(uuid, currentPage + 1); isLoading = false; emit( @@ -89,17 +89,17 @@ class ChatRoomCubit extends Cubit { } } - Future initChat(String chatId, {bool sendInitialMessage = false}) async { + Future initChat(String uuid, {bool sendInitialMessage = false}) async { try { - final chatRoom = await chatRepository.getChatRoom(chatId); + final chatRoom = await chatRepository.getChatRoom(uuid); ChosenPlanModel? chosenPlan; if (chatRoom.chosenPlanId != null) { chosenPlan = await chatRepository.getChosenPlan(id: chatRoom.chosenPlanId!); } - final chatMessages = await chatRepository.getChatMessages(chatId, currentPage); + final chatMessages = await chatRepository.getChatMessages(uuid, currentPage); lastPage = chatMessages.meta.lastPage; - await _subscribeToChatChannel(chatId: chatId); + await _subscribeToChatChannel(uuid: uuid); emit( ChatRoomState.loaded( chatRoom: chatRoom.copyWith(chosenPlan: chosenPlan), @@ -158,10 +158,10 @@ class ChatRoomCubit extends Cubit { } } - Future _subscribeToChatChannel({required String chatId}) async { + Future _subscribeToChatChannel({required String uuid}) async { final client = wsManager.client; if (client == null) return; - await wsManager.initPrivateDirectChatChannel(chatId); + await wsManager.initPrivateDirectChatChannel(uuid); wsManager.subscribeDirectChatChannel(); messagesSubscription = wsManager.directChatStream?.listen((event) { AudioPlayer().play((AssetSource('audio/recive_message.wav'))); diff --git a/lib/features/chat/presentation/bloc/chats_cubit/chats_cubit.dart b/lib/features/chat/presentation/bloc/chats_cubit/chats_cubit.dart index 3b50c995..24028797 100644 --- a/lib/features/chat/presentation/bloc/chats_cubit/chats_cubit.dart +++ b/lib/features/chat/presentation/bloc/chats_cubit/chats_cubit.dart @@ -43,10 +43,10 @@ class ChatsCubit extends Cubit { try { final chatRoomsPaginationModel = await chatRepository.getChatRooms(query: query); final unreadChats = chatRoomsPaginationModel.unreadChatsCount; - lastPage = chatRoomsPaginationModel.chatRooms.lastPage + 1; + // lastPage = chatRoomsPaginationModel.chatRooms.lastPage + 1; emit( state.copyWith( - chatRooms: chatRoomsPaginationModel.chatRooms.data, + chatRooms: chatRoomsPaginationModel.data, chatsWithUnreadMessagesCount: unreadChats, state: BaseState.success, ), @@ -65,10 +65,10 @@ class ChatsCubit extends Cubit { try { final chatRoomsPaginationModel = await chatRepository.getChatRooms(query: query); final unreadChats = chatRoomsPaginationModel.unreadChatsCount; - lastPage = chatRoomsPaginationModel.chatRooms.lastPage + 1; + // lastPage = chatRoomsPaginationModel.chatRooms.lastPage + 1; emit( state.copyWith( - chatRooms: chatRoomsPaginationModel.chatRooms.data, + chatRooms: chatRoomsPaginationModel.data, chatsWithUnreadMessagesCount: unreadChats, state: BaseState.success, ), @@ -90,7 +90,7 @@ class ChatsCubit extends Cubit { final unreadChats = chatRoomsPaginationModel.unreadChatsCount; emit( state.copyWith( - chatRooms: [...state.chatRooms, ...chatRoomsPaginationModel.chatRooms.data], + chatRooms: [...state.chatRooms, ...chatRoomsPaginationModel.data], chatsWithUnreadMessagesCount: unreadChats, state: BaseState.success, isLoadingMoreChats: false, diff --git a/lib/features/chat/presentation/pages/chat_screen.dart b/lib/features/chat/presentation/pages/chat_screen.dart index 55f74d70..c017f047 100644 --- a/lib/features/chat/presentation/pages/chat_screen.dart +++ b/lib/features/chat/presentation/pages/chat_screen.dart @@ -32,10 +32,10 @@ import 'package:intl/intl.dart'; import 'package:visibility_detector/visibility_detector.dart'; class ChatScreen extends StatefulWidget { - final String chatId; + final String uuid; final bool? sendInitialMessage; - const ChatScreen({required this.chatId, super.key, required this.sendInitialMessage}); + const ChatScreen({required this.uuid, super.key, required this.sendInitialMessage}); @override State createState() => _ChatScreenState(); @@ -64,14 +64,14 @@ class _ChatScreenState extends State { void initState() { super.initState(); scrollController.addListener(_onScroll); - chatRoomCubit.initChat(widget.chatId, sendInitialMessage: widget.sendInitialMessage ?? false); + chatRoomCubit.initChat(widget.uuid, sendInitialMessage: widget.sendInitialMessage ?? false); chatRoomCubit.setTimer(); _listener = AppLifecycleListener(onHide: _onHide, onResume: _onResume); } void _onScroll() { if (scrollController.offset >= scrollController.position.maxScrollExtent && !scrollController.position.outOfRange) { - chatRoomCubit.loadNextPage(widget.chatId); + chatRoomCubit.loadNextPage(widget.uuid); } } @@ -93,7 +93,7 @@ class _ChatScreenState extends State { if (state is ChatRoomStateLoaded) { return _buildChat(context, state); } else if (state is ChatRoomStateError) { - return Scaffold(appBar: AppBar(), body: DataErrorWidget(onReload: () => chatRoomCubit.initChat(widget.chatId))); + return Scaffold(appBar: AppBar(), body: DataErrorWidget(onReload: () => chatRoomCubit.initChat(widget.uuid))); } else { return const Scaffold(body: Loader()); } diff --git a/lib/features/chat/presentation/pages/empty_chat_screen.dart b/lib/features/chat/presentation/pages/empty_chat_screen.dart index 3195888c..7b543f86 100644 --- a/lib/features/chat/presentation/pages/empty_chat_screen.dart +++ b/lib/features/chat/presentation/pages/empty_chat_screen.dart @@ -145,7 +145,7 @@ class _EmptyChatScreenState extends State { AppRouter.navigatorKey.currentContext?.pushReplacementNamed( 'chatScreen', extra: { - 'chatId': chatIdOrError, + 'uuid': chatIdOrError, }, ); } @@ -186,7 +186,7 @@ class _EmptyChatScreenState extends State { AppRouter.navigatorKey.currentContext?.pushReplacementNamed( 'chatScreen', extra: { - 'chatId': chatIdOrError, + 'uuid': chatIdOrError, }, ); } @@ -214,7 +214,7 @@ class _EmptyChatScreenState extends State { AppRouter.navigatorKey.currentContext?.pushReplacementNamed( 'chatScreen', extra: { - 'chatId': chatIdOrError, + 'uuid': chatIdOrError, }, ); } @@ -264,7 +264,7 @@ class _EmptyChatScreenState extends State { AppRouter.navigatorKey.currentContext?.pushReplacementNamed( 'chatScreen', extra: { - 'chatId': chatIdOrError, + 'uuid': chatIdOrError, }, ); } diff --git a/lib/features/chat/presentation/widgets/chat_entry_widget.dart b/lib/features/chat/presentation/widgets/chat_entry_widget.dart index 44cc67f9..dacff9cb 100644 --- a/lib/features/chat/presentation/widgets/chat_entry_widget.dart +++ b/lib/features/chat/presentation/widgets/chat_entry_widget.dart @@ -24,7 +24,7 @@ class _ChatEntryWidgetState extends State { onTap: () => GoRouter.of(context).pushNamed( 'chatScreen', extra: { - 'chatId': widget.chatRoom.id.toString(), + 'uuid': widget.chatRoom.id.toString(), }, ), child: Container( diff --git a/lib/features/chat/repositories/chat_repository.dart b/lib/features/chat/repositories/chat_repository.dart index 54924fcd..d682c9a0 100644 --- a/lib/features/chat/repositories/chat_repository.dart +++ b/lib/features/chat/repositories/chat_repository.dart @@ -2,6 +2,7 @@ import 'dart:async'; import 'dart:developer'; import 'dart:io'; import 'package:dio/dio.dart'; +import 'package:eatvio_app/core/token_storage.dart'; import 'package:eatvio_app/features/chat/models/chat_message_model.dart'; import 'package:eatvio_app/features/chat/models/chat_messages_model.dart'; import 'package:eatvio_app/features/chat/models/chat_room_model.dart'; @@ -47,10 +48,11 @@ class ChatRepository { } } - await chatService.sendMessageByUserSlug( - userSlug: slug, + await chatService.sendMessage( + slug: slug, data: data, mediaData: multipartFiles.isEmpty ? null : multipartFiles, + socketId: (await SocketIdStorage.getSocketIdFromStorage())!, ); } catch (e, st) { log(e.toString(), stackTrace: st); @@ -58,9 +60,9 @@ class ChatRepository { } } - Future getChatRoom(String chatId) async { + Future getChatRoom(String uuid) async { try { - return (await chatService.getChatRoom(id: chatId))['chatRoom']!; + return (await chatService.getChatRoom(uuid: uuid)); } catch (e) { rethrow; } @@ -74,9 +76,9 @@ class ChatRepository { } } - Future getChatMessages(String chatId, int page) async { + Future getChatMessages(String id, int page) async { try { - return (await chatService.getChatMessages(id: chatId, page: page)); + return (await chatService.getChatMessages(id: id, page: page)); } catch (e) { rethrow; } @@ -90,9 +92,9 @@ class ChatRepository { } } - Future markMessagesAsRead(String chatId, List messageIds) async { + Future markMessagesAsRead(String id, List messageIds) async { try { - await chatService.markMessagesAsRead(id: chatId, body: {'messages_ids': messageIds}); + await chatService.markMessagesAsRead(id: id, body: {'messages_ids': messageIds}); } catch (e) { rethrow; } diff --git a/lib/features/chat/services/chat_service.dart b/lib/features/chat/services/chat_service.dart index dcdab395..dee63eab 100644 --- a/lib/features/chat/services/chat_service.dart +++ b/lib/features/chat/services/chat_service.dart @@ -19,15 +19,16 @@ abstract class ChatService { @Query('find') String? query, }); - @GET('/api/chat/show/{id}') - Future> getChatRoom({ - @Path() required String id, + @GET('/api/chat/show/{uuid}') + Future getChatRoom({ + @Path() required String uuid, }); - @POST('/api/v2/chat/message/send/{id}') + @POST('/api/chat/message/send/{slug}') @MultiPart() Future sendMessage({ - @Path() required String id, + @Header('X-Socket-ID') required String socketId, + @Path() required String slug, @Part() String? data, @Part(name: 'media_data[]', contentType: 'multipart/form-data') List? mediaData, }); @@ -85,12 +86,4 @@ abstract class ChatService { Future getChatByUserSlug({ @Path() required String slug, }); - - @POST('/api/v2/chat/message/send/{userSlug}') - @MultiPart() - Future sendMessageByUserSlug({ - @Path() required String userSlug, - @Part() String? data, - @Part(name: 'media_data[]', contentType: 'multipart/form-data') List? mediaData, - }); } diff --git a/lib/features/plans/presentation/pages/about_plan_screen.dart b/lib/features/plans/presentation/pages/about_plan_screen.dart index d2984b68..15c12ecb 100644 --- a/lib/features/plans/presentation/pages/about_plan_screen.dart +++ b/lib/features/plans/presentation/pages/about_plan_screen.dart @@ -208,7 +208,7 @@ class _AboutPlanScreenState extends State { GoRouter.of(context).pushReplacementNamed( 'chatScreen', extra: { - 'chatId': chosenPlan.chatId, + 'uuid': chosenPlan.chatId, 'sendInitialMessage': true, }, ); diff --git a/lib/features/profile/presentation/bloc/profile_cubit/profile_cubit.dart b/lib/features/profile/presentation/bloc/profile_cubit/profile_cubit.dart index b088a073..36a98658 100644 --- a/lib/features/profile/presentation/bloc/profile_cubit/profile_cubit.dart +++ b/lib/features/profile/presentation/bloc/profile_cubit/profile_cubit.dart @@ -123,7 +123,7 @@ class ProfileCubit extends Cubit { AppRouter.navigatorKey.currentContext?.pushNamed( 'chatScreen', extra: { - 'chatId': chatIdOrError, + 'uuid': chatIdOrError, }, ); return chatIdOrError; diff --git a/lib/features/profile/presentation/widgets/sub_action_button_widget.dart b/lib/features/profile/presentation/widgets/sub_action_button_widget.dart index bca5e3da..55b4a095 100644 --- a/lib/features/profile/presentation/widgets/sub_action_button_widget.dart +++ b/lib/features/profile/presentation/widgets/sub_action_button_widget.dart @@ -69,7 +69,7 @@ class _SubActionButtonWidgetState extends State { GoRouter.of(context).pushNamed( 'chatScreen', extra: { - 'chatId': await sl().getChatRoomIdBySlug( + 'uuid': await sl().getChatRoomIdBySlug( author: Author( authorSlug: widget.slug, authorName: widget.name, From e04c5c97f95395ea4fa617c77d2ca6794d3c067a Mon Sep 17 00:00:00 2001 From: mso7nueh Date: Tue, 8 Jul 2025 11:35:41 +0300 Subject: [PATCH 02/10] feat(chat): chat without delay --- lib/core/const.dart | 3 +- .../bloc/chat_room_cubit/chat_room_cubit.dart | 22 +- .../widgets/chat_bubble_widget.dart | 16 +- .../consultant_review_model.freezed.dart | 652 +++++++++++++++++- .../profile/models/profile_model.dart | 1 + .../services/profile_service_test.dart | 1 + 6 files changed, 685 insertions(+), 10 deletions(-) diff --git a/lib/core/const.dart b/lib/core/const.dart index 8f5ddb59..5d1aded6 100644 --- a/lib/core/const.dart +++ b/lib/core/const.dart @@ -1,4 +1,5 @@ -String baseUrl = 'https://mobile-stage.eatvio.ru'; +// String baseUrl = 'https://mobile-stage.eatvio.ru'; +String baseUrl = 'https://eatvio.ru'; const List durationValues = [7, 14, 21]; 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 40ee862d..32244e78 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 @@ -189,12 +189,30 @@ class ChatRoomCubit extends Cubit { required String userSlug, }) async { try { + final compressedFiles = files != null ? await ImageCompressUtility.compressFilesList(List.from(files)) : null; + AudioPlayer().play((AssetSource('audio/send_message.wav'))); + emit( + (state as ChatRoomStateLoaded).copyWith( + chatMessages: [ + ChatMessageModel( + id: 1, + data: data ?? '', + mediaData: compressedFiles, + authorId: 1, + updatedAt: DateTime.now(), + isRead: true, + isCurrentUserAuthor: true, + roomId: '', + ), + ...(state as ChatRoomStateLoaded).chatMessages, + ], + ), + ); await chatRepository.sendMessage( data: data, - files: files != null ? await ImageCompressUtility.compressFilesList(List.from(files)) : null, + files: compressedFiles, slug: userSlug, ); - AudioPlayer().play((AssetSource('audio/send_message.wav'))); return true; } catch (e, st) { log(e.toString(), stackTrace: st); diff --git a/lib/features/chat/presentation/widgets/chat_bubble_widget.dart b/lib/features/chat/presentation/widgets/chat_bubble_widget.dart index 74e6f6a6..dd6c7b4c 100644 --- a/lib/features/chat/presentation/widgets/chat_bubble_widget.dart +++ b/lib/features/chat/presentation/widgets/chat_bubble_widget.dart @@ -1,3 +1,5 @@ +import 'dart:io'; + import 'package:cached_network_image/cached_network_image.dart'; import 'package:dismissible_page/dismissible_page.dart'; import 'package:eatvio_app/core/theme/custom_text_style.dart'; @@ -59,8 +61,9 @@ class ChatBubbleWidget extends StatelessWidget { ), ), child: Padding( - padding: - mediaData.isNotEmpty ? const EdgeInsets.all(8) : EdgeInsets.only(top: 8, bottom: 8, left: isCurrentUser ? 16 : 8, right: isCurrentUser ? 8 : 16), + padding: mediaData.isNotEmpty + ? const EdgeInsets.all(8) + : EdgeInsets.only(top: 8, bottom: 8, left: isCurrentUser ? 16 : 8, right: isCurrentUser ? 8 : 16), child: Column( crossAxisAlignment: isCurrentUser ? CrossAxisAlignment.end : CrossAxisAlignment.start, children: [ @@ -109,6 +112,7 @@ class ChatBubbleWidget extends StatelessWidget { PhotoViewScreen( imageUrls: mediaData.map((e) => '$e').toList(), index: index, + isLocal: mediaData[index] is File ? true : false, ), ); }, @@ -117,9 +121,11 @@ class ChatBubbleWidget extends StatelessWidget { transitionOnUserGestures: true, child: ClipRRect( borderRadius: BorderRadius.circular(16), - child: CachedNetworkImage( - imageUrl: '${mediaData[index]}', - ), + child: mediaData[index] is File + ? Image.file(mediaData[index]) + : CachedNetworkImage( + imageUrl: '${mediaData[index]}', + ), ), ), ); diff --git a/lib/features/diary/models/consultant_review_model.freezed.dart b/lib/features/diary/models/consultant_review_model.freezed.dart index a6f79469..36c72066 100644 --- a/lib/features/diary/models/consultant_review_model.freezed.dart +++ b/lib/features/diary/models/consultant_review_model.freezed.dart @@ -1,6 +1,5 @@ -// dart format width=80 -// coverage:ignore-file // GENERATED CODE - DO NOT MODIFY BY HAND +// coverage:ignore-file // ignore_for_file: type=lint // ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark @@ -121,6 +120,172 @@ class _$ConsultantReviewModelCopyWithImpl<$Res> } } +/// Adds pattern-matching-related methods to [ConsultantReviewModel]. +extension ConsultantReviewModelPatterns on ConsultantReviewModel { + /// A variant of `map` that fallback to returning `orElse`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeMap( + TResult Function(_ConsultantReviewModel value)? $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _ConsultantReviewModel() when $default != null: + return $default(_that); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// Callbacks receives the raw object, upcasted. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case final Subclass2 value: + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult map( + TResult Function(_ConsultantReviewModel value) $default, + ) { + final _that = this; + switch (_that) { + case _ConsultantReviewModel(): + return $default(_that); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `map` that fallback to returning `null`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? mapOrNull( + TResult? Function(_ConsultantReviewModel value)? $default, + ) { + final _that = this; + switch (_that) { + case _ConsultantReviewModel() when $default != null: + return $default(_that); + case _: + return null; + } + } + + /// A variant of `when` that fallback to an `orElse` callback. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeWhen( + TResult Function(String planName, int planDuration, int currentPlanDay, + ConsultantComments consultantComments)? + $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _ConsultantReviewModel() when $default != null: + return $default(_that.planName, _that.planDuration, + _that.currentPlanDay, _that.consultantComments); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// As opposed to `map`, this offers destructuring. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case Subclass2(:final field2): + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult when( + TResult Function(String planName, int planDuration, int currentPlanDay, + ConsultantComments consultantComments) + $default, + ) { + final _that = this; + switch (_that) { + case _ConsultantReviewModel(): + return $default(_that.planName, _that.planDuration, + _that.currentPlanDay, _that.consultantComments); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `when` that fallback to returning `null` + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? whenOrNull( + TResult? Function(String planName, int planDuration, int currentPlanDay, + ConsultantComments consultantComments)? + $default, + ) { + final _that = this; + switch (_that) { + case _ConsultantReviewModel() when $default != null: + return $default(_that.planName, _that.planDuration, + _that.currentPlanDay, _that.consultantComments); + case _: + return null; + } + } +} + /// @nodoc @JsonSerializable() class _ConsultantReviewModel implements ConsultantReviewModel { @@ -340,6 +505,172 @@ class _$ConsultantCommentsCopyWithImpl<$Res> } } +/// Adds pattern-matching-related methods to [ConsultantComments]. +extension ConsultantCommentsPatterns on ConsultantComments { + /// A variant of `map` that fallback to returning `orElse`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeMap( + TResult Function(_ConsultantComments value)? $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _ConsultantComments() when $default != null: + return $default(_that); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// Callbacks receives the raw object, upcasted. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case final Subclass2 value: + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult map( + TResult Function(_ConsultantComments value) $default, + ) { + final _that = this; + switch (_that) { + case _ConsultantComments(): + return $default(_that); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `map` that fallback to returning `null`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? mapOrNull( + TResult? Function(_ConsultantComments value)? $default, + ) { + final _that = this; + switch (_that) { + case _ConsultantComments() when $default != null: + return $default(_that); + case _: + return null; + } + } + + /// A variant of `when` that fallback to an `orElse` callback. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeWhen( + TResult Function(String? dayComment, List mealsComments, + List portionsComments)? + $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _ConsultantComments() when $default != null: + return $default( + _that.dayComment, _that.mealsComments, _that.portionsComments); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// As opposed to `map`, this offers destructuring. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case Subclass2(:final field2): + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult when( + TResult Function(String? dayComment, List mealsComments, + List portionsComments) + $default, + ) { + final _that = this; + switch (_that) { + case _ConsultantComments(): + return $default( + _that.dayComment, _that.mealsComments, _that.portionsComments); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `when` that fallback to returning `null` + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? whenOrNull( + TResult? Function(String? dayComment, List mealsComments, + List portionsComments)? + $default, + ) { + final _that = this; + switch (_that) { + case _ConsultantComments() when $default != null: + return $default( + _that.dayComment, _that.mealsComments, _that.portionsComments); + case _: + return null; + } + } +} + /// @nodoc @JsonSerializable() class _ConsultantComments implements ConsultantComments { @@ -532,6 +863,163 @@ class _$MealCommentCopyWithImpl<$Res> implements $MealCommentCopyWith<$Res> { } } +/// Adds pattern-matching-related methods to [MealComment]. +extension MealCommentPatterns on MealComment { + /// A variant of `map` that fallback to returning `orElse`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeMap( + TResult Function(_MealComment value)? $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _MealComment() when $default != null: + return $default(_that); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// Callbacks receives the raw object, upcasted. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case final Subclass2 value: + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult map( + TResult Function(_MealComment value) $default, + ) { + final _that = this; + switch (_that) { + case _MealComment(): + return $default(_that); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `map` that fallback to returning `null`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? mapOrNull( + TResult? Function(_MealComment value)? $default, + ) { + final _that = this; + switch (_that) { + case _MealComment() when $default != null: + return $default(_that); + case _: + return null; + } + } + + /// A variant of `when` that fallback to an `orElse` callback. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeWhen( + TResult Function(String comment, int typeNo)? $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _MealComment() when $default != null: + return $default(_that.comment, _that.typeNo); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// As opposed to `map`, this offers destructuring. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case Subclass2(:final field2): + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult when( + TResult Function(String comment, int typeNo) $default, + ) { + final _that = this; + switch (_that) { + case _MealComment(): + return $default(_that.comment, _that.typeNo); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `when` that fallback to returning `null` + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? whenOrNull( + TResult? Function(String comment, int typeNo)? $default, + ) { + final _that = this; + switch (_that) { + case _MealComment() when $default != null: + return $default(_that.comment, _that.typeNo); + case _: + return null; + } + } +} + /// @nodoc @JsonSerializable() class _MealComment implements MealComment { @@ -692,6 +1180,166 @@ class _$PortionCommentCopyWithImpl<$Res> } } +/// Adds pattern-matching-related methods to [PortionComment]. +extension PortionCommentPatterns on PortionComment { + /// A variant of `map` that fallback to returning `orElse`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeMap( + TResult Function(_PortionComment value)? $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _PortionComment() when $default != null: + return $default(_that); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// Callbacks receives the raw object, upcasted. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case final Subclass2 value: + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult map( + TResult Function(_PortionComment value) $default, + ) { + final _that = this; + switch (_that) { + case _PortionComment(): + return $default(_that); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `map` that fallback to returning `null`. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case final Subclass value: + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? mapOrNull( + TResult? Function(_PortionComment value)? $default, + ) { + final _that = this; + switch (_that) { + case _PortionComment() when $default != null: + return $default(_that); + case _: + return null; + } + } + + /// A variant of `when` that fallback to an `orElse` callback. + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return orElse(); + /// } + /// ``` + + @optionalTypeArgs + TResult maybeWhen( + TResult Function(@JsonKey(name: 'id') int portionId, String comment)? + $default, { + required TResult orElse(), + }) { + final _that = this; + switch (_that) { + case _PortionComment() when $default != null: + return $default(_that.portionId, _that.comment); + case _: + return orElse(); + } + } + + /// A `switch`-like method, using callbacks. + /// + /// As opposed to `map`, this offers destructuring. + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case Subclass2(:final field2): + /// return ...; + /// } + /// ``` + + @optionalTypeArgs + TResult when( + TResult Function(@JsonKey(name: 'id') int portionId, String comment) + $default, + ) { + final _that = this; + switch (_that) { + case _PortionComment(): + return $default(_that.portionId, _that.comment); + case _: + throw StateError('Unexpected subclass'); + } + } + + /// A variant of `when` that fallback to returning `null` + /// + /// It is equivalent to doing: + /// ```dart + /// switch (sealedClass) { + /// case Subclass(:final field): + /// return ...; + /// case _: + /// return null; + /// } + /// ``` + + @optionalTypeArgs + TResult? whenOrNull( + TResult? Function(@JsonKey(name: 'id') int portionId, String comment)? + $default, + ) { + final _that = this; + switch (_that) { + case _PortionComment() when $default != null: + return $default(_that.portionId, _that.comment); + case _: + return null; + } + } +} + /// @nodoc @JsonSerializable() class _PortionComment implements PortionComment { diff --git a/lib/features/profile/models/profile_model.dart b/lib/features/profile/models/profile_model.dart index 8d13bc7e..72e91d0d 100644 --- a/lib/features/profile/models/profile_model.dart +++ b/lib/features/profile/models/profile_model.dart @@ -17,6 +17,7 @@ abstract class ProfileModel with _$ProfileModel { @JsonKey(name: "created_at") DateTime? createdAt, @JsonKey(name: "updated_at") DateTime? updatedAt, @JsonKey(name: "is_public_profile", fromJson: parseBool) required bool isPublicProfile, + @JsonKey(name: "is_blocked_by_me", fromJson: parseBool) required bool isBlockedByMe, @JsonKey(name: 'is_entity_subscribed_by_me') required bool isEntitySubscribedByMe, @JsonKey(name: "slug") required String slug, @JsonKey(name: "profile_photo_url") required String profilePhotoUrl, diff --git a/test/features/profile/services/profile_service_test.dart b/test/features/profile/services/profile_service_test.dart index e735602c..b2c51b01 100644 --- a/test/features/profile/services/profile_service_test.dart +++ b/test/features/profile/services/profile_service_test.dart @@ -21,6 +21,7 @@ void main() { email: 'mso7nueh@mail.ru', isPublicProfile: true, isEntitySubscribedByMe: false, + isBlockedByMe: false, slug: 'slug', profilePhotoUrl: '', roles: ['user'], From 7b1574392b92cd89da70c6568c6c76367711f32f Mon Sep 17 00:00:00 2001 From: mso7nueh Date: Wed, 9 Jul 2025 10:20:21 +0300 Subject: [PATCH 03/10] feat(block): Issue-523 --- .../bloc/profile_cubit/profile_cubit.dart | 2 ++ .../presentation/pages/profile_screen.dart | 27 ++++++++++++++++--- 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/lib/features/profile/presentation/bloc/profile_cubit/profile_cubit.dart b/lib/features/profile/presentation/bloc/profile_cubit/profile_cubit.dart index 36a98658..d0d7a932 100644 --- a/lib/features/profile/presentation/bloc/profile_cubit/profile_cubit.dart +++ b/lib/features/profile/presentation/bloc/profile_cubit/profile_cubit.dart @@ -25,6 +25,7 @@ class ProfileCubit extends Cubit { }) : super(const ProfileState.loading()); Future getProfileBySlug(String slug) async { + emit(const ProfileState.loading()); try { final profile = await profileRepository.getProfileBySlug(slug); emit( @@ -44,6 +45,7 @@ class ProfileCubit extends Cubit { Future getMyProfile({ String period = '1', }) async { + emit(const ProfileState.loading()); _currentPeriod = period; try { final profile = await profileRepository.getMyProfile(); diff --git a/lib/features/profile/presentation/pages/profile_screen.dart b/lib/features/profile/presentation/pages/profile_screen.dart index 7c94e537..07ab1bd2 100644 --- a/lib/features/profile/presentation/pages/profile_screen.dart +++ b/lib/features/profile/presentation/pages/profile_screen.dart @@ -194,9 +194,9 @@ class _ProfileScreenState extends State { ], ), if (state.profileDetails.additionalInfo.isNotEmpty) _additionalInfo(state), - const SizedBox(height: 8), - _messageAndSubscribe(state), - const SizedBox(height: 16), + if (!state.profile.isBlockedByMe) const SizedBox(height: 8), + if (!state.profile.isBlockedByMe) _messageAndSubscribe(state), + if (!state.profile.isBlockedByMe) const SizedBox(height: 16), ], ), ), @@ -1177,7 +1177,21 @@ class _ProfileScreenState extends State { ), ); } else if (value == 'block') { + isFirstFetch = true; sl().blockUser(state.profile.slug); + widget.author == null || widget.author!.authorIsMe ? profileCubit.getMyProfile() : profileCubit.getProfileBySlug(widget.author!.authorSlug); + if (state.profile.roles.contains('consultant')) { + plansCubit.getPlans(state.profile.slug); + } + isFirstFetch = false; + } else if (value == 'unblock') { + isFirstFetch = true; + sl().unblockUser(state.profile.slug); + widget.author == null || widget.author!.authorIsMe ? profileCubit.getMyProfile() : profileCubit.getProfileBySlug(widget.author!.authorSlug); + if (state.profile.roles.contains('consultant')) { + plansCubit.getPlans(state.profile.slug); + } + isFirstFetch = false; } else { showModalBottomSheet( context: context, @@ -1199,11 +1213,16 @@ class _ProfileScreenState extends State { value: 'complain', child: Text('Пожаловаться'), ), - if (widget.author != null) + if (widget.author != null && !state.profile.isBlockedByMe) const PopupMenuItem( value: 'block', child: Text('Заблокировать'), ), + if (widget.author != null && state.profile.isBlockedByMe) + const PopupMenuItem( + value: 'unblock', + child: Text('Разблокировать'), + ), ], child: const Icon(Icons.more_horiz_rounded), ), From ea2ec05ed62696ad62353e54118f1b083df6cbca Mon Sep 17 00:00:00 2001 From: mso7nueh Date: Wed, 9 Jul 2025 15:06:51 +0300 Subject: [PATCH 04/10] fix(chat): websockets --- lib/core/const.dart | 1 - lib/core/websockets/ws_manager.dart | 1 - .../bloc/chat_room_cubit/chat_room_cubit.dart | 24 ++++++++++----- .../registration_cubit.dart | 29 +++++++------------ .../repositories/registration_repository.dart | 10 ++++++- 5 files changed, 36 insertions(+), 29 deletions(-) diff --git a/lib/core/const.dart b/lib/core/const.dart index 5d1aded6..618a9866 100644 --- a/lib/core/const.dart +++ b/lib/core/const.dart @@ -1,4 +1,3 @@ -// String baseUrl = 'https://mobile-stage.eatvio.ru'; String baseUrl = 'https://eatvio.ru'; const List durationValues = [7, 14, 21]; diff --git a/lib/core/websockets/ws_manager.dart b/lib/core/websockets/ws_manager.dart index 0a5f7241..528f2ae9 100644 --- a/lib/core/websockets/ws_manager.dart +++ b/lib/core/websockets/ws_manager.dart @@ -98,7 +98,6 @@ class WsManager { const Duration(milliseconds: 300), () => sl().getChatRooms(), ); - log(event.rootObject.toString()); }); _subscribe(); } catch (e, st) { 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 32244e78..f4c95d12 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 @@ -89,7 +89,10 @@ class ChatRoomCubit extends Cubit { } } - Future initChat(String uuid, {bool sendInitialMessage = false}) async { + Future initChat( + String uuid, { + bool sendInitialMessage = false, + }) async { try { final chatRoom = await chatRepository.getChatRoom(uuid); ChosenPlanModel? chosenPlan; @@ -98,8 +101,7 @@ class ChatRoomCubit extends Cubit { } final chatMessages = await chatRepository.getChatMessages(uuid, currentPage); lastPage = chatMessages.meta.lastPage; - - await _subscribeToChatChannel(uuid: uuid); + await _subscribeToChatChannel(uuid: uuid, chatId: chatRoom.id); emit( ChatRoomState.loaded( chatRoom: chatRoom.copyWith(chosenPlan: chosenPlan), @@ -158,14 +160,14 @@ class ChatRoomCubit extends Cubit { } } - Future _subscribeToChatChannel({required String uuid}) async { + Future _subscribeToChatChannel({required String uuid, required String chatId}) async { final client = wsManager.client; if (client == null) return; - await wsManager.initPrivateDirectChatChannel(uuid); + await wsManager.initPrivateDirectChatChannel(chatId); wsManager.subscribeDirectChatChannel(); messagesSubscription = wsManager.directChatStream?.listen((event) { AudioPlayer().play((AssetSource('audio/recive_message.wav'))); - final message = ChatMessageModel.fromJson(jsonDecode(event.data)['message']); + final message = ChatMessageModel.fromJson(jsonDecode(event.data)); List messagesList = [message, ...(state as ChatRoomStateLoaded).chatMessages]; chatRepository.emitNewMessageToChats(message); emit((state as ChatRoomStateLoaded).copyWith(chatMessages: messagesList, isLoading: isLoading)); @@ -179,7 +181,15 @@ class ChatRoomCubit extends Cubit { typingSubscription = wsManager.clientTypingStream?.listen((event) { emit((state as ChatRoomStateLoaded).copyWith(isTyping: true, isLoading: isLoading)); EasyDebounce.debounce( - 'client-typing', const Duration(seconds: 3), () => emit((state as ChatRoomStateLoaded).copyWith(isTyping: false, isLoading: isLoading))); + 'client-typing', + const Duration(seconds: 3), + () => emit( + (state as ChatRoomStateLoaded).copyWith( + isTyping: false, + isLoading: isLoading, + ), + ), + ); }); } diff --git a/lib/features/registration/presentation/bloc/registration_cubit/registration_cubit.dart b/lib/features/registration/presentation/bloc/registration_cubit/registration_cubit.dart index 9581779d..83592c3b 100644 --- a/lib/features/registration/presentation/bloc/registration_cubit/registration_cubit.dart +++ b/lib/features/registration/presentation/bloc/registration_cubit/registration_cubit.dart @@ -3,7 +3,6 @@ import 'dart:developer'; import 'package:eatvio_app/core/app_router.dart'; import 'package:eatvio_app/core/token_storage.dart'; -import 'package:eatvio_app/core/widgets/show_error_dialog.dart'; import 'package:eatvio_app/features/registration/models/user_registration_model.dart'; import 'package:eatvio_app/features/registration/presentation/bloc/registration_cubit/registration_state.dart'; import 'package:eatvio_app/features/registration/repositories/registration_repository.dart'; @@ -51,25 +50,17 @@ class RegistrationCubit extends Cubit { void updateSheet(UserRegistrationSheet sheet) => emit(RegistrationState(sheet: sheet)); Future tryRegistration() async { - if (await registrationRepository.emailIsReachable(state.sheet.email)) { - try { - final token = await registrationRepository.tryRegister( - state.sheet.copyWith( - phone: state.sheet.phone.replaceAll(' ', '').replaceAll('(', '').replaceAll(')', ''), - responseBody: '{}', - ), - ); - await TokenStorage.saveTokenInStorage(token); - AppRouter.navigatorKey.currentContext?.pushNamed('verifyEmailScreen'); - } catch (e) { - log(e.toString()); - } - } else { - showErrorDialog( - AppRouter.navigatorKey.currentContext!, - title: 'Ошибка регистрации', - description: 'Несуществующая почта.', + try { + final token = await registrationRepository.tryRegister( + state.sheet.copyWith( + phone: state.sheet.phone.replaceAll(' ', '').replaceAll('(', '').replaceAll(')', ''), + responseBody: '{}', + ), ); + await TokenStorage.saveTokenInStorage(token); + AppRouter.navigatorKey.currentContext?.pushNamed('verifyEmailScreen'); + } catch (e, st) { + log(e.toString(), stackTrace: st); } } diff --git a/lib/features/registration/repositories/registration_repository.dart b/lib/features/registration/repositories/registration_repository.dart index 7a4a14ae..0c3008e0 100644 --- a/lib/features/registration/repositories/registration_repository.dart +++ b/lib/features/registration/repositories/registration_repository.dart @@ -1,5 +1,7 @@ + import 'package:dio/dio.dart'; import 'package:eatvio_app/core/locator_service.dart'; +import 'package:eatvio_app/core/utils/toasts.dart'; import 'package:eatvio_app/features/registration/models/user_registration_model.dart'; import 'package:eatvio_app/features/registration/models/location_model.dart'; import 'package:eatvio_app/features/registration/services/registration_service.dart'; @@ -11,7 +13,13 @@ class RegistrationRepository { Future tryRegister(UserRegistrationSheet sheet) async { try { - return (await registrationService.register(sheet: sheet.toJson()))['token']!; + final response = await registrationService.register(sheet: sheet.toJson()); + try { + return (response['token']!); + } catch (e) { + showErrorToast(response.toString()); + rethrow; + } } catch (e) { rethrow; } From 27f97d0e114c244d7b7e975e288d21c03a584f27 Mon Sep 17 00:00:00 2001 From: mso7nueh Date: Wed, 9 Jul 2025 18:49:48 +0300 Subject: [PATCH 05/10] fix: permission --- lib/core/permission_handler/permission_handler.dart | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/core/permission_handler/permission_handler.dart b/lib/core/permission_handler/permission_handler.dart index a311e84d..f107c2c0 100644 --- a/lib/core/permission_handler/permission_handler.dart +++ b/lib/core/permission_handler/permission_handler.dart @@ -1,3 +1,5 @@ +import 'dart:io'; + import 'package:eatvio_app/core/widgets/show_error_dialog.dart'; import 'package:eatvio_app/generated/l10n.dart'; import 'package:flutter/cupertino.dart'; @@ -11,6 +13,10 @@ class PermissionHandler { required Future Function() onGranted, required BuildContext context, }) async { + if (Platform.isAndroid) { + await onGranted(); + return; + } final permissionState = await permission.request(); if (permissionState.isGranted) { await onGranted(); From 0749a53e248e4993c3cd1dacca0ee70aad02746b Mon Sep 17 00:00:00 2001 From: mso7nueh Date: Fri, 11 Jul 2025 14:05:14 +0300 Subject: [PATCH 06/10] fix: horizontal layout --- android/build/reports/problems/problems-report.html | 4 ++-- lib/core/const.dart | 3 ++- lib/core/locator_service.dart | 1 - lib/features/auth/presentation/pages/auth_screen.dart | 3 +++ .../chat/presentation/widgets/chat_bubble_widget.dart | 6 +++--- 5 files changed, 10 insertions(+), 7 deletions(-) diff --git a/android/build/reports/problems/problems-report.html b/android/build/reports/problems/problems-report.html index f21ab9cc..4921e6e4 100644 --- a/android/build/reports/problems/problems-report.html +++ b/android/build/reports/problems/problems-report.html @@ -650,12 +650,12 @@ code + .copy-button { diff --git a/lib/core/const.dart b/lib/core/const.dart index 618a9866..401c7365 100644 --- a/lib/core/const.dart +++ b/lib/core/const.dart @@ -1,4 +1,5 @@ -String baseUrl = 'https://eatvio.ru'; +// String baseUrl = 'https://eatvio.ru'; +String baseUrl = 'https://mobile-stage.eatvio.ru'; const List durationValues = [7, 14, 21]; diff --git a/lib/core/locator_service.dart b/lib/core/locator_service.dart index 9036809a..145a0fce 100644 --- a/lib/core/locator_service.dart +++ b/lib/core/locator_service.dart @@ -240,7 +240,6 @@ Future init() async { 'accept': 'application/json', 'content-type': 'application/json', }, - validateStatus: (status) => status != null && status < 500, ), )..interceptors.addAll( [ diff --git a/lib/features/auth/presentation/pages/auth_screen.dart b/lib/features/auth/presentation/pages/auth_screen.dart index 6b4ec260..10fb4172 100644 --- a/lib/features/auth/presentation/pages/auth_screen.dart +++ b/lib/features/auth/presentation/pages/auth_screen.dart @@ -79,6 +79,9 @@ class _AuthScreenState extends State { @override Widget build(BuildContext context) { + var shortestSide = MediaQuery.sizeOf(context).shortestSide; + final bool useMobileLayout = shortestSide < 600; + if (!useMobileLayout) isFocused = true; final s = S.of(context); FlutterNativeSplash.remove(); return BlocProvider( diff --git a/lib/features/chat/presentation/widgets/chat_bubble_widget.dart b/lib/features/chat/presentation/widgets/chat_bubble_widget.dart index dd6c7b4c..d2f5f1bd 100644 --- a/lib/features/chat/presentation/widgets/chat_bubble_widget.dart +++ b/lib/features/chat/presentation/widgets/chat_bubble_widget.dart @@ -89,17 +89,17 @@ class ChatBubbleWidget extends StatelessWidget { }, leading: const Icon( Icons.file_copy_outlined, - color: Colors.white, + color: Colors.black, ), trailing: const Icon( Icons.download_outlined, - color: Colors.white, + color: Colors.black, ), title: Text( mediaData[index].toString().replaceAll('chat_files/', ''), maxLines: 2, style: const TextStyle( - color: Colors.white, + color: Colors.black, fontSize: 12, overflow: TextOverflow.ellipsis, ), From 631efe6f9ebf12e6adcdc940e9bb4c7c153a5b5e Mon Sep 17 00:00:00 2001 From: mso7nueh Date: Fri, 11 Jul 2025 14:22:11 +0300 Subject: [PATCH 07/10] fix: chats --- lib/features/chat/models/chat_room_pagination_model.dart | 2 ++ .../chat/presentation/bloc/chats_cubit/chats_cubit.dart | 7 ++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/features/chat/models/chat_room_pagination_model.dart b/lib/features/chat/models/chat_room_pagination_model.dart index 699df5e8..19de28c3 100644 --- a/lib/features/chat/models/chat_room_pagination_model.dart +++ b/lib/features/chat/models/chat_room_pagination_model.dart @@ -1,3 +1,4 @@ +import 'package:eatvio_app/core/models/pagination_model.dart'; import 'package:eatvio_app/features/chat/models/chat_message_model.dart'; import 'package:eatvio_app/features/plans/models/chosen_plan_model.dart'; import 'package:freezed_annotation/freezed_annotation.dart'; @@ -10,6 +11,7 @@ abstract class ChatRoomPaginationModel with _$ChatRoomPaginationModel { const factory ChatRoomPaginationModel({ @JsonKey(name: "data") required List data, @JsonKey(name: "number_of_unread_chat_rooms") required int unreadChatsCount, + required Meta meta, }) = _ChatRoomPreviewModel; factory ChatRoomPaginationModel.fromJson(Map json) => _$ChatRoomPaginationModelFromJson(json); diff --git a/lib/features/chat/presentation/bloc/chats_cubit/chats_cubit.dart b/lib/features/chat/presentation/bloc/chats_cubit/chats_cubit.dart index 24028797..174108b3 100644 --- a/lib/features/chat/presentation/bloc/chats_cubit/chats_cubit.dart +++ b/lib/features/chat/presentation/bloc/chats_cubit/chats_cubit.dart @@ -21,7 +21,7 @@ class ChatsCubit extends Cubit { required this.chatRepository, required this.wsManager, required this.profileRepository, - }) : super(ChatsState()) { + }) : super(ChatsState()) { newLastMessageSubscription = chatRepository.newUserMessagesStream.listen((message) { _setNewLastMessage(message); }); @@ -29,6 +29,7 @@ class ChatsCubit extends Cubit { String? _query; int page = 1; late int lastPage; + Future connectToWebSocket() async { await newIncomingMessagesSubscription?.cancel(); newIncomingMessagesSubscription = wsManager.newMessagesStream?.listen((event) { @@ -43,7 +44,7 @@ class ChatsCubit extends Cubit { try { final chatRoomsPaginationModel = await chatRepository.getChatRooms(query: query); final unreadChats = chatRoomsPaginationModel.unreadChatsCount; - // lastPage = chatRoomsPaginationModel.chatRooms.lastPage + 1; + lastPage = chatRoomsPaginationModel.meta.lastPage + 1; emit( state.copyWith( chatRooms: chatRoomsPaginationModel.data, @@ -65,7 +66,7 @@ class ChatsCubit extends Cubit { try { final chatRoomsPaginationModel = await chatRepository.getChatRooms(query: query); final unreadChats = chatRoomsPaginationModel.unreadChatsCount; - // lastPage = chatRoomsPaginationModel.chatRooms.lastPage + 1; + lastPage = chatRoomsPaginationModel.meta.lastPage + 1; emit( state.copyWith( chatRooms: chatRoomsPaginationModel.data, From 958d09906b85a033709ded82a48afeb2415c2665 Mon Sep 17 00:00:00 2001 From: mso7nueh Date: Fri, 11 Jul 2025 14:34:48 +0300 Subject: [PATCH 08/10] baseurl --- ios/Runner.xcodeproj/project.pbxproj | 6 +++--- ios/Runner/Info.plist | 2 +- lib/core/const.dart | 3 +-- pubspec.yaml | 2 +- 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index 046c0614..d2269b71 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 = 39; + CURRENT_PROJECT_VERSION = 52; 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 = 39; + CURRENT_PROJECT_VERSION = 52; 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 = 39; + CURRENT_PROJECT_VERSION = 52; DEVELOPMENT_TEAM = VL68C36HYS; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( diff --git a/ios/Runner/Info.plist b/ios/Runner/Info.plist index d7a769f2..6de3b03b 100644 --- a/ios/Runner/Info.plist +++ b/ios/Runner/Info.plist @@ -21,7 +21,7 @@ CFBundleSignature ???? CFBundleVersion - 39 + 52 ITSAppUsesNonExemptEncryption LSRequiresIPhoneOS diff --git a/lib/core/const.dart b/lib/core/const.dart index 401c7365..618a9866 100644 --- a/lib/core/const.dart +++ b/lib/core/const.dart @@ -1,5 +1,4 @@ -// String baseUrl = 'https://eatvio.ru'; -String baseUrl = 'https://mobile-stage.eatvio.ru'; +String baseUrl = 'https://eatvio.ru'; const List durationValues = [7, 14, 21]; diff --git a/pubspec.yaml b/pubspec.yaml index d5c928e7..74b00964 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: eatvio_app description: A new Flutter project. -version: 1.1.16+46 +version: 1.2.2+52 publish_to: 'none' environment: From 2c59fd09232671ae4995458b54f618f3969b9024 Mon Sep 17 00:00:00 2001 From: mso7nueh Date: Fri, 11 Jul 2025 14:43:56 +0300 Subject: [PATCH 09/10] =?UTF-8?q?=D0=A3=D0=B4=D0=B0=D0=BB=D0=B5=D0=BD?= =?UTF-8?q?=D1=8B=20=D1=81=D0=B3=D0=B5=D0=BD=D0=B5=D1=80=D0=B8=D1=80=D0=BE?= =?UTF-8?q?=D0=B2=D0=B0=D0=BD=D0=BD=D1=8B=D0=B5=20=D1=84=D0=B0=D0=B9=D0=BB?= =?UTF-8?q?=D1=8B=20(freezed,=20g.dart,=20build)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../consultant_review_model.freezed.dart | 784 ------------------ .../models/consultant_review_model.g.dart | 67 -- .../services/profile_service_test.mocks.dart | 526 ------------ 3 files changed, 1377 deletions(-) delete mode 100644 lib/features/diary/models/consultant_review_model.freezed.dart delete mode 100644 lib/features/diary/models/consultant_review_model.g.dart delete mode 100644 test/features/profile/services/profile_service_test.mocks.dart diff --git a/lib/features/diary/models/consultant_review_model.freezed.dart b/lib/features/diary/models/consultant_review_model.freezed.dart deleted file mode 100644 index a6f79469..00000000 --- a/lib/features/diary/models/consultant_review_model.freezed.dart +++ /dev/null @@ -1,784 +0,0 @@ -// dart format width=80 -// coverage:ignore-file -// GENERATED CODE - DO NOT MODIFY BY HAND -// ignore_for_file: type=lint -// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark - -part of 'consultant_review_model.dart'; - -// ************************************************************************** -// FreezedGenerator -// ************************************************************************** - -// dart format off -T _$identity(T value) => value; - -/// @nodoc -mixin _$ConsultantReviewModel { - String get planName; - int get planDuration; - int get currentPlanDay; - ConsultantComments get consultantComments; - - /// Create a copy of ConsultantReviewModel - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - $ConsultantReviewModelCopyWith get copyWith => - _$ConsultantReviewModelCopyWithImpl( - this as ConsultantReviewModel, _$identity); - - /// Serializes this ConsultantReviewModel to a JSON map. - Map toJson(); - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is ConsultantReviewModel && - (identical(other.planName, planName) || - other.planName == planName) && - (identical(other.planDuration, planDuration) || - other.planDuration == planDuration) && - (identical(other.currentPlanDay, currentPlanDay) || - other.currentPlanDay == currentPlanDay) && - (identical(other.consultantComments, consultantComments) || - other.consultantComments == consultantComments)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hash( - runtimeType, planName, planDuration, currentPlanDay, consultantComments); - - @override - String toString() { - return 'ConsultantReviewModel(planName: $planName, planDuration: $planDuration, currentPlanDay: $currentPlanDay, consultantComments: $consultantComments)'; - } -} - -/// @nodoc -abstract mixin class $ConsultantReviewModelCopyWith<$Res> { - factory $ConsultantReviewModelCopyWith(ConsultantReviewModel value, - $Res Function(ConsultantReviewModel) _then) = - _$ConsultantReviewModelCopyWithImpl; - @useResult - $Res call( - {String planName, - int planDuration, - int currentPlanDay, - ConsultantComments consultantComments}); - - $ConsultantCommentsCopyWith<$Res> get consultantComments; -} - -/// @nodoc -class _$ConsultantReviewModelCopyWithImpl<$Res> - implements $ConsultantReviewModelCopyWith<$Res> { - _$ConsultantReviewModelCopyWithImpl(this._self, this._then); - - final ConsultantReviewModel _self; - final $Res Function(ConsultantReviewModel) _then; - - /// Create a copy of ConsultantReviewModel - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? planName = null, - Object? planDuration = null, - Object? currentPlanDay = null, - Object? consultantComments = null, - }) { - return _then(_self.copyWith( - planName: null == planName - ? _self.planName - : planName // ignore: cast_nullable_to_non_nullable - as String, - planDuration: null == planDuration - ? _self.planDuration - : planDuration // ignore: cast_nullable_to_non_nullable - as int, - currentPlanDay: null == currentPlanDay - ? _self.currentPlanDay - : currentPlanDay // ignore: cast_nullable_to_non_nullable - as int, - consultantComments: null == consultantComments - ? _self.consultantComments - : consultantComments // ignore: cast_nullable_to_non_nullable - as ConsultantComments, - )); - } - - /// Create a copy of ConsultantReviewModel - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $ConsultantCommentsCopyWith<$Res> get consultantComments { - return $ConsultantCommentsCopyWith<$Res>(_self.consultantComments, (value) { - return _then(_self.copyWith(consultantComments: value)); - }); - } -} - -/// @nodoc -@JsonSerializable() -class _ConsultantReviewModel implements ConsultantReviewModel { - _ConsultantReviewModel( - {required this.planName, - required this.planDuration, - required this.currentPlanDay, - required this.consultantComments}); - factory _ConsultantReviewModel.fromJson(Map json) => - _$ConsultantReviewModelFromJson(json); - - @override - final String planName; - @override - final int planDuration; - @override - final int currentPlanDay; - @override - final ConsultantComments consultantComments; - - /// Create a copy of ConsultantReviewModel - /// with the given fields replaced by the non-null parameter values. - @override - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - _$ConsultantReviewModelCopyWith<_ConsultantReviewModel> get copyWith => - __$ConsultantReviewModelCopyWithImpl<_ConsultantReviewModel>( - this, _$identity); - - @override - Map toJson() { - return _$ConsultantReviewModelToJson( - this, - ); - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _ConsultantReviewModel && - (identical(other.planName, planName) || - other.planName == planName) && - (identical(other.planDuration, planDuration) || - other.planDuration == planDuration) && - (identical(other.currentPlanDay, currentPlanDay) || - other.currentPlanDay == currentPlanDay) && - (identical(other.consultantComments, consultantComments) || - other.consultantComments == consultantComments)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hash( - runtimeType, planName, planDuration, currentPlanDay, consultantComments); - - @override - String toString() { - return 'ConsultantReviewModel(planName: $planName, planDuration: $planDuration, currentPlanDay: $currentPlanDay, consultantComments: $consultantComments)'; - } -} - -/// @nodoc -abstract mixin class _$ConsultantReviewModelCopyWith<$Res> - implements $ConsultantReviewModelCopyWith<$Res> { - factory _$ConsultantReviewModelCopyWith(_ConsultantReviewModel value, - $Res Function(_ConsultantReviewModel) _then) = - __$ConsultantReviewModelCopyWithImpl; - @override - @useResult - $Res call( - {String planName, - int planDuration, - int currentPlanDay, - ConsultantComments consultantComments}); - - @override - $ConsultantCommentsCopyWith<$Res> get consultantComments; -} - -/// @nodoc -class __$ConsultantReviewModelCopyWithImpl<$Res> - implements _$ConsultantReviewModelCopyWith<$Res> { - __$ConsultantReviewModelCopyWithImpl(this._self, this._then); - - final _ConsultantReviewModel _self; - final $Res Function(_ConsultantReviewModel) _then; - - /// Create a copy of ConsultantReviewModel - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $Res call({ - Object? planName = null, - Object? planDuration = null, - Object? currentPlanDay = null, - Object? consultantComments = null, - }) { - return _then(_ConsultantReviewModel( - planName: null == planName - ? _self.planName - : planName // ignore: cast_nullable_to_non_nullable - as String, - planDuration: null == planDuration - ? _self.planDuration - : planDuration // ignore: cast_nullable_to_non_nullable - as int, - currentPlanDay: null == currentPlanDay - ? _self.currentPlanDay - : currentPlanDay // ignore: cast_nullable_to_non_nullable - as int, - consultantComments: null == consultantComments - ? _self.consultantComments - : consultantComments // ignore: cast_nullable_to_non_nullable - as ConsultantComments, - )); - } - - /// Create a copy of ConsultantReviewModel - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $ConsultantCommentsCopyWith<$Res> get consultantComments { - return $ConsultantCommentsCopyWith<$Res>(_self.consultantComments, (value) { - return _then(_self.copyWith(consultantComments: value)); - }); - } -} - -/// @nodoc -mixin _$ConsultantComments { - String? get dayComment; - List get mealsComments; - List get portionsComments; - - /// Create a copy of ConsultantComments - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - $ConsultantCommentsCopyWith get copyWith => - _$ConsultantCommentsCopyWithImpl( - this as ConsultantComments, _$identity); - - /// Serializes this ConsultantComments to a JSON map. - Map toJson(); - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is ConsultantComments && - (identical(other.dayComment, dayComment) || - other.dayComment == dayComment) && - const DeepCollectionEquality() - .equals(other.mealsComments, mealsComments) && - const DeepCollectionEquality() - .equals(other.portionsComments, portionsComments)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hash( - runtimeType, - dayComment, - const DeepCollectionEquality().hash(mealsComments), - const DeepCollectionEquality().hash(portionsComments)); - - @override - String toString() { - return 'ConsultantComments(dayComment: $dayComment, mealsComments: $mealsComments, portionsComments: $portionsComments)'; - } -} - -/// @nodoc -abstract mixin class $ConsultantCommentsCopyWith<$Res> { - factory $ConsultantCommentsCopyWith( - ConsultantComments value, $Res Function(ConsultantComments) _then) = - _$ConsultantCommentsCopyWithImpl; - @useResult - $Res call( - {String? dayComment, - List mealsComments, - List portionsComments}); -} - -/// @nodoc -class _$ConsultantCommentsCopyWithImpl<$Res> - implements $ConsultantCommentsCopyWith<$Res> { - _$ConsultantCommentsCopyWithImpl(this._self, this._then); - - final ConsultantComments _self; - final $Res Function(ConsultantComments) _then; - - /// Create a copy of ConsultantComments - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? dayComment = freezed, - Object? mealsComments = null, - Object? portionsComments = null, - }) { - return _then(_self.copyWith( - dayComment: freezed == dayComment - ? _self.dayComment - : dayComment // ignore: cast_nullable_to_non_nullable - as String?, - mealsComments: null == mealsComments - ? _self.mealsComments - : mealsComments // ignore: cast_nullable_to_non_nullable - as List, - portionsComments: null == portionsComments - ? _self.portionsComments - : portionsComments // ignore: cast_nullable_to_non_nullable - as List, - )); - } -} - -/// @nodoc -@JsonSerializable() -class _ConsultantComments implements ConsultantComments { - _ConsultantComments( - {required this.dayComment, - required final List mealsComments, - required final List portionsComments}) - : _mealsComments = mealsComments, - _portionsComments = portionsComments; - factory _ConsultantComments.fromJson(Map json) => - _$ConsultantCommentsFromJson(json); - - @override - final String? dayComment; - final List _mealsComments; - @override - List get mealsComments { - if (_mealsComments is EqualUnmodifiableListView) return _mealsComments; - // ignore: implicit_dynamic_type - return EqualUnmodifiableListView(_mealsComments); - } - - final List _portionsComments; - @override - List get portionsComments { - if (_portionsComments is EqualUnmodifiableListView) - return _portionsComments; - // ignore: implicit_dynamic_type - return EqualUnmodifiableListView(_portionsComments); - } - - /// Create a copy of ConsultantComments - /// with the given fields replaced by the non-null parameter values. - @override - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - _$ConsultantCommentsCopyWith<_ConsultantComments> get copyWith => - __$ConsultantCommentsCopyWithImpl<_ConsultantComments>(this, _$identity); - - @override - Map toJson() { - return _$ConsultantCommentsToJson( - this, - ); - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _ConsultantComments && - (identical(other.dayComment, dayComment) || - other.dayComment == dayComment) && - const DeepCollectionEquality() - .equals(other._mealsComments, _mealsComments) && - const DeepCollectionEquality() - .equals(other._portionsComments, _portionsComments)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hash( - runtimeType, - dayComment, - const DeepCollectionEquality().hash(_mealsComments), - const DeepCollectionEquality().hash(_portionsComments)); - - @override - String toString() { - return 'ConsultantComments(dayComment: $dayComment, mealsComments: $mealsComments, portionsComments: $portionsComments)'; - } -} - -/// @nodoc -abstract mixin class _$ConsultantCommentsCopyWith<$Res> - implements $ConsultantCommentsCopyWith<$Res> { - factory _$ConsultantCommentsCopyWith( - _ConsultantComments value, $Res Function(_ConsultantComments) _then) = - __$ConsultantCommentsCopyWithImpl; - @override - @useResult - $Res call( - {String? dayComment, - List mealsComments, - List portionsComments}); -} - -/// @nodoc -class __$ConsultantCommentsCopyWithImpl<$Res> - implements _$ConsultantCommentsCopyWith<$Res> { - __$ConsultantCommentsCopyWithImpl(this._self, this._then); - - final _ConsultantComments _self; - final $Res Function(_ConsultantComments) _then; - - /// Create a copy of ConsultantComments - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $Res call({ - Object? dayComment = freezed, - Object? mealsComments = null, - Object? portionsComments = null, - }) { - return _then(_ConsultantComments( - dayComment: freezed == dayComment - ? _self.dayComment - : dayComment // ignore: cast_nullable_to_non_nullable - as String?, - mealsComments: null == mealsComments - ? _self._mealsComments - : mealsComments // ignore: cast_nullable_to_non_nullable - as List, - portionsComments: null == portionsComments - ? _self._portionsComments - : portionsComments // ignore: cast_nullable_to_non_nullable - as List, - )); - } -} - -/// @nodoc -mixin _$MealComment { - String get comment; - int get typeNo; - - /// Create a copy of MealComment - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - $MealCommentCopyWith get copyWith => - _$MealCommentCopyWithImpl(this as MealComment, _$identity); - - /// Serializes this MealComment to a JSON map. - Map toJson(); - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is MealComment && - (identical(other.comment, comment) || other.comment == comment) && - (identical(other.typeNo, typeNo) || other.typeNo == typeNo)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hash(runtimeType, comment, typeNo); - - @override - String toString() { - return 'MealComment(comment: $comment, typeNo: $typeNo)'; - } -} - -/// @nodoc -abstract mixin class $MealCommentCopyWith<$Res> { - factory $MealCommentCopyWith( - MealComment value, $Res Function(MealComment) _then) = - _$MealCommentCopyWithImpl; - @useResult - $Res call({String comment, int typeNo}); -} - -/// @nodoc -class _$MealCommentCopyWithImpl<$Res> implements $MealCommentCopyWith<$Res> { - _$MealCommentCopyWithImpl(this._self, this._then); - - final MealComment _self; - final $Res Function(MealComment) _then; - - /// Create a copy of MealComment - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? comment = null, - Object? typeNo = null, - }) { - return _then(_self.copyWith( - comment: null == comment - ? _self.comment - : comment // ignore: cast_nullable_to_non_nullable - as String, - typeNo: null == typeNo - ? _self.typeNo - : typeNo // ignore: cast_nullable_to_non_nullable - as int, - )); - } -} - -/// @nodoc -@JsonSerializable() -class _MealComment implements MealComment { - _MealComment({required this.comment, required this.typeNo}); - factory _MealComment.fromJson(Map json) => - _$MealCommentFromJson(json); - - @override - final String comment; - @override - final int typeNo; - - /// Create a copy of MealComment - /// with the given fields replaced by the non-null parameter values. - @override - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - _$MealCommentCopyWith<_MealComment> get copyWith => - __$MealCommentCopyWithImpl<_MealComment>(this, _$identity); - - @override - Map toJson() { - return _$MealCommentToJson( - this, - ); - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _MealComment && - (identical(other.comment, comment) || other.comment == comment) && - (identical(other.typeNo, typeNo) || other.typeNo == typeNo)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hash(runtimeType, comment, typeNo); - - @override - String toString() { - return 'MealComment(comment: $comment, typeNo: $typeNo)'; - } -} - -/// @nodoc -abstract mixin class _$MealCommentCopyWith<$Res> - implements $MealCommentCopyWith<$Res> { - factory _$MealCommentCopyWith( - _MealComment value, $Res Function(_MealComment) _then) = - __$MealCommentCopyWithImpl; - @override - @useResult - $Res call({String comment, int typeNo}); -} - -/// @nodoc -class __$MealCommentCopyWithImpl<$Res> implements _$MealCommentCopyWith<$Res> { - __$MealCommentCopyWithImpl(this._self, this._then); - - final _MealComment _self; - final $Res Function(_MealComment) _then; - - /// Create a copy of MealComment - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $Res call({ - Object? comment = null, - Object? typeNo = null, - }) { - return _then(_MealComment( - comment: null == comment - ? _self.comment - : comment // ignore: cast_nullable_to_non_nullable - as String, - typeNo: null == typeNo - ? _self.typeNo - : typeNo // ignore: cast_nullable_to_non_nullable - as int, - )); - } -} - -/// @nodoc -mixin _$PortionComment { - @JsonKey(name: 'id') - int get portionId; - String get comment; - - /// Create a copy of PortionComment - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - $PortionCommentCopyWith get copyWith => - _$PortionCommentCopyWithImpl( - this as PortionComment, _$identity); - - /// Serializes this PortionComment to a JSON map. - Map toJson(); - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is PortionComment && - (identical(other.portionId, portionId) || - other.portionId == portionId) && - (identical(other.comment, comment) || other.comment == comment)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hash(runtimeType, portionId, comment); - - @override - String toString() { - return 'PortionComment(portionId: $portionId, comment: $comment)'; - } -} - -/// @nodoc -abstract mixin class $PortionCommentCopyWith<$Res> { - factory $PortionCommentCopyWith( - PortionComment value, $Res Function(PortionComment) _then) = - _$PortionCommentCopyWithImpl; - @useResult - $Res call({@JsonKey(name: 'id') int portionId, String comment}); -} - -/// @nodoc -class _$PortionCommentCopyWithImpl<$Res> - implements $PortionCommentCopyWith<$Res> { - _$PortionCommentCopyWithImpl(this._self, this._then); - - final PortionComment _self; - final $Res Function(PortionComment) _then; - - /// Create a copy of PortionComment - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? portionId = null, - Object? comment = null, - }) { - return _then(_self.copyWith( - portionId: null == portionId - ? _self.portionId - : portionId // ignore: cast_nullable_to_non_nullable - as int, - comment: null == comment - ? _self.comment - : comment // ignore: cast_nullable_to_non_nullable - as String, - )); - } -} - -/// @nodoc -@JsonSerializable() -class _PortionComment implements PortionComment { - _PortionComment( - {@JsonKey(name: 'id') required this.portionId, required this.comment}); - factory _PortionComment.fromJson(Map json) => - _$PortionCommentFromJson(json); - - @override - @JsonKey(name: 'id') - final int portionId; - @override - final String comment; - - /// Create a copy of PortionComment - /// with the given fields replaced by the non-null parameter values. - @override - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - _$PortionCommentCopyWith<_PortionComment> get copyWith => - __$PortionCommentCopyWithImpl<_PortionComment>(this, _$identity); - - @override - Map toJson() { - return _$PortionCommentToJson( - this, - ); - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _PortionComment && - (identical(other.portionId, portionId) || - other.portionId == portionId) && - (identical(other.comment, comment) || other.comment == comment)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hash(runtimeType, portionId, comment); - - @override - String toString() { - return 'PortionComment(portionId: $portionId, comment: $comment)'; - } -} - -/// @nodoc -abstract mixin class _$PortionCommentCopyWith<$Res> - implements $PortionCommentCopyWith<$Res> { - factory _$PortionCommentCopyWith( - _PortionComment value, $Res Function(_PortionComment) _then) = - __$PortionCommentCopyWithImpl; - @override - @useResult - $Res call({@JsonKey(name: 'id') int portionId, String comment}); -} - -/// @nodoc -class __$PortionCommentCopyWithImpl<$Res> - implements _$PortionCommentCopyWith<$Res> { - __$PortionCommentCopyWithImpl(this._self, this._then); - - final _PortionComment _self; - final $Res Function(_PortionComment) _then; - - /// Create a copy of PortionComment - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $Res call({ - Object? portionId = null, - Object? comment = null, - }) { - return _then(_PortionComment( - portionId: null == portionId - ? _self.portionId - : portionId // ignore: cast_nullable_to_non_nullable - as int, - comment: null == comment - ? _self.comment - : comment // ignore: cast_nullable_to_non_nullable - as String, - )); - } -} - -// dart format on diff --git a/lib/features/diary/models/consultant_review_model.g.dart b/lib/features/diary/models/consultant_review_model.g.dart deleted file mode 100644 index ad7fa537..00000000 --- a/lib/features/diary/models/consultant_review_model.g.dart +++ /dev/null @@ -1,67 +0,0 @@ -// GENERATED CODE - DO NOT MODIFY BY HAND - -part of 'consultant_review_model.dart'; - -// ************************************************************************** -// JsonSerializableGenerator -// ************************************************************************** - -_ConsultantReviewModel _$ConsultantReviewModelFromJson( - Map json) => - _ConsultantReviewModel( - planName: json['planName'] as String, - planDuration: (json['planDuration'] as num).toInt(), - currentPlanDay: (json['currentPlanDay'] as num).toInt(), - consultantComments: ConsultantComments.fromJson( - json['consultantComments'] as Map), - ); - -Map _$ConsultantReviewModelToJson( - _ConsultantReviewModel instance) => - { - 'planName': instance.planName, - 'planDuration': instance.planDuration, - 'currentPlanDay': instance.currentPlanDay, - 'consultantComments': instance.consultantComments, - }; - -_ConsultantComments _$ConsultantCommentsFromJson(Map json) => - _ConsultantComments( - dayComment: json['dayComment'] as String?, - mealsComments: (json['mealsComments'] as List) - .map((e) => MealComment.fromJson(e as Map)) - .toList(), - portionsComments: (json['portionsComments'] as List) - .map((e) => PortionComment.fromJson(e as Map)) - .toList(), - ); - -Map _$ConsultantCommentsToJson(_ConsultantComments instance) => - { - 'dayComment': instance.dayComment, - 'mealsComments': instance.mealsComments, - 'portionsComments': instance.portionsComments, - }; - -_MealComment _$MealCommentFromJson(Map json) => _MealComment( - comment: json['comment'] as String, - typeNo: (json['typeNo'] as num).toInt(), - ); - -Map _$MealCommentToJson(_MealComment instance) => - { - 'comment': instance.comment, - 'typeNo': instance.typeNo, - }; - -_PortionComment _$PortionCommentFromJson(Map json) => - _PortionComment( - portionId: (json['id'] as num).toInt(), - comment: json['comment'] as String, - ); - -Map _$PortionCommentToJson(_PortionComment instance) => - { - 'id': instance.portionId, - 'comment': instance.comment, - }; diff --git a/test/features/profile/services/profile_service_test.mocks.dart b/test/features/profile/services/profile_service_test.mocks.dart deleted file mode 100644 index 22c3af52..00000000 --- a/test/features/profile/services/profile_service_test.mocks.dart +++ /dev/null @@ -1,526 +0,0 @@ -// Mocks generated by Mockito 5.4.6 from annotations -// in eatvio_app/test/features/profile/services/profile_service_test.dart. -// Do not manually edit this file. - -// ignore_for_file: no_leading_underscores_for_library_prefixes -import 'dart:async' as _i6; -import 'dart:io' as _i10; - -import 'package:eatvio_app/features/feed/models/feed_blog_post_model.dart' - as _i7; -import 'package:eatvio_app/features/profile/models/chosen_diets_pagination_model.dart' - as _i4; -import 'package:eatvio_app/features/profile/models/circumference_model.dart' - as _i9; -import 'package:eatvio_app/features/profile/models/profile_model.dart' as _i2; -import 'package:eatvio_app/features/profile/models/sub_model.dart' as _i3; -import 'package:eatvio_app/features/profile/models/weight_model.dart' as _i8; -import 'package:eatvio_app/features/profile/services/profile_service.dart' - as _i5; -import 'package:mockito/mockito.dart' as _i1; -import 'package:mockito/src/dummies.dart' as _i11; - -// ignore_for_file: type=lint -// ignore_for_file: avoid_redundant_argument_values -// ignore_for_file: avoid_setters_without_getters -// ignore_for_file: comment_references -// ignore_for_file: deprecated_member_use -// ignore_for_file: deprecated_member_use_from_same_package -// ignore_for_file: implementation_imports -// ignore_for_file: invalid_use_of_visible_for_testing_member -// ignore_for_file: must_be_immutable -// ignore_for_file: prefer_const_constructors -// ignore_for_file: unnecessary_parenthesis -// ignore_for_file: camel_case_types -// ignore_for_file: subtype_of_sealed_class - -class _FakeProfileModel_0 extends _i1.SmartFake implements _i2.ProfileModel { - _FakeProfileModel_0( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); -} - -class _FakeProfileDetailsModel_1 extends _i1.SmartFake - implements _i2.ProfileDetailsModel { - _FakeProfileDetailsModel_1( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); -} - -class _FakeSubPaginationModel_2 extends _i1.SmartFake - implements _i3.SubPaginationModel { - _FakeSubPaginationModel_2( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); -} - -class _FakeChosenDietsPaginationModel_3 extends _i1.SmartFake - implements _i4.ChosenDietsPaginationModel { - _FakeChosenDietsPaginationModel_3( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); -} - -/// A class which mocks [ProfileService]. -/// -/// See the documentation for Mockito's code generation for more information. -class MockProfileService extends _i1.Mock implements _i5.ProfileService { - @override - _i6.Future<_i2.ProfileModel> getProfileBySlug({required String? slug}) => - (super.noSuchMethod( - Invocation.method( - #getProfileBySlug, - [], - {#slug: slug}, - ), - returnValue: _i6.Future<_i2.ProfileModel>.value(_FakeProfileModel_0( - this, - Invocation.method( - #getProfileBySlug, - [], - {#slug: slug}, - ), - )), - returnValueForMissingStub: - _i6.Future<_i2.ProfileModel>.value(_FakeProfileModel_0( - this, - Invocation.method( - #getProfileBySlug, - [], - {#slug: slug}, - ), - )), - ) as _i6.Future<_i2.ProfileModel>); - - @override - _i6.Future<_i2.ProfileModel> getMyProfile() => (super.noSuchMethod( - Invocation.method( - #getMyProfile, - [], - ), - returnValue: _i6.Future<_i2.ProfileModel>.value(_FakeProfileModel_0( - this, - Invocation.method( - #getMyProfile, - [], - ), - )), - returnValueForMissingStub: - _i6.Future<_i2.ProfileModel>.value(_FakeProfileModel_0( - this, - Invocation.method( - #getMyProfile, - [], - ), - )), - ) as _i6.Future<_i2.ProfileModel>); - - @override - _i6.Future<_i2.ProfileDetailsModel> getMyProfileDetails() => - (super.noSuchMethod( - Invocation.method( - #getMyProfileDetails, - [], - ), - returnValue: _i6.Future<_i2.ProfileDetailsModel>.value( - _FakeProfileDetailsModel_1( - this, - Invocation.method( - #getMyProfileDetails, - [], - ), - )), - returnValueForMissingStub: _i6.Future<_i2.ProfileDetailsModel>.value( - _FakeProfileDetailsModel_1( - this, - Invocation.method( - #getMyProfileDetails, - [], - ), - )), - ) as _i6.Future<_i2.ProfileDetailsModel>); - - @override - _i6.Future<_i2.ProfileDetailsModel> getProfileDetailsBySlug( - {required String? slug}) => - (super.noSuchMethod( - Invocation.method( - #getProfileDetailsBySlug, - [], - {#slug: slug}, - ), - returnValue: _i6.Future<_i2.ProfileDetailsModel>.value( - _FakeProfileDetailsModel_1( - this, - Invocation.method( - #getProfileDetailsBySlug, - [], - {#slug: slug}, - ), - )), - returnValueForMissingStub: _i6.Future<_i2.ProfileDetailsModel>.value( - _FakeProfileDetailsModel_1( - this, - Invocation.method( - #getProfileDetailsBySlug, - [], - {#slug: slug}, - ), - )), - ) as _i6.Future<_i2.ProfileDetailsModel>); - - @override - _i6.Future addCircumference({ - required int? chestCircumference, - required int? waistCircumference, - required int? hipCircumference, - }) => - (super.noSuchMethod( - Invocation.method( - #addCircumference, - [], - { - #chestCircumference: chestCircumference, - #waistCircumference: waistCircumference, - #hipCircumference: hipCircumference, - }, - ), - returnValue: _i6.Future.value(), - returnValueForMissingStub: _i6.Future.value(), - ) as _i6.Future); - - @override - _i6.Future addWeight({required double? weight}) => (super.noSuchMethod( - Invocation.method( - #addWeight, - [], - {#weight: weight}, - ), - returnValue: _i6.Future.value(), - returnValueForMissingStub: _i6.Future.value(), - ) as _i6.Future); - - @override - _i6.Future> getBlogPostByAuthorSlug( - {required String? slug}) => - (super.noSuchMethod( - Invocation.method( - #getBlogPostByAuthorSlug, - [], - {#slug: slug}, - ), - returnValue: _i6.Future>.value( - <_i7.FeedBlogPostModel>[]), - returnValueForMissingStub: - _i6.Future>.value( - <_i7.FeedBlogPostModel>[]), - ) as _i6.Future>); - - @override - _i6.Future> getWeight({required String? period}) => - (super.noSuchMethod( - Invocation.method( - #getWeight, - [], - {#period: period}, - ), - returnValue: - _i6.Future>.value(<_i8.WeightModel>[]), - returnValueForMissingStub: - _i6.Future>.value(<_i8.WeightModel>[]), - ) as _i6.Future>); - - @override - _i6.Future> getWeightBySlug({ - required String? period, - required String? slug, - }) => - (super.noSuchMethod( - Invocation.method( - #getWeightBySlug, - [], - { - #period: period, - #slug: slug, - }, - ), - returnValue: - _i6.Future>.value(<_i8.WeightModel>[]), - returnValueForMissingStub: - _i6.Future>.value(<_i8.WeightModel>[]), - ) as _i6.Future>); - - @override - _i6.Future> getCircumferences( - {required String? period}) => - (super.noSuchMethod( - Invocation.method( - #getCircumferences, - [], - {#period: period}, - ), - returnValue: _i6.Future>.value( - <_i9.CircumferenceModel>[]), - returnValueForMissingStub: - _i6.Future>.value( - <_i9.CircumferenceModel>[]), - ) as _i6.Future>); - - @override - _i6.Future> getCircumferencesBySlug({ - required String? period, - required String? slug, - }) => - (super.noSuchMethod( - Invocation.method( - #getCircumferencesBySlug, - [], - { - #period: period, - #slug: slug, - }, - ), - returnValue: _i6.Future>.value( - <_i9.CircumferenceModel>[]), - returnValueForMissingStub: - _i6.Future>.value( - <_i9.CircumferenceModel>[]), - ) as _i6.Future>); - - @override - _i6.Future<_i3.SubPaginationModel> getSubscribers({ - required String? slug, - String? query, - }) => - (super.noSuchMethod( - Invocation.method( - #getSubscribers, - [], - { - #slug: slug, - #query: query, - }, - ), - returnValue: - _i6.Future<_i3.SubPaginationModel>.value(_FakeSubPaginationModel_2( - this, - Invocation.method( - #getSubscribers, - [], - { - #slug: slug, - #query: query, - }, - ), - )), - returnValueForMissingStub: - _i6.Future<_i3.SubPaginationModel>.value(_FakeSubPaginationModel_2( - this, - Invocation.method( - #getSubscribers, - [], - { - #slug: slug, - #query: query, - }, - ), - )), - ) as _i6.Future<_i3.SubPaginationModel>); - - @override - _i6.Future<_i3.SubPaginationModel> getSubscriptions({ - required String? slug, - String? query, - }) => - (super.noSuchMethod( - Invocation.method( - #getSubscriptions, - [], - { - #slug: slug, - #query: query, - }, - ), - returnValue: - _i6.Future<_i3.SubPaginationModel>.value(_FakeSubPaginationModel_2( - this, - Invocation.method( - #getSubscriptions, - [], - { - #slug: slug, - #query: query, - }, - ), - )), - returnValueForMissingStub: - _i6.Future<_i3.SubPaginationModel>.value(_FakeSubPaginationModel_2( - this, - Invocation.method( - #getSubscriptions, - [], - { - #slug: slug, - #query: query, - }, - ), - )), - ) as _i6.Future<_i3.SubPaginationModel>); - - @override - _i6.Future subscribe({required String? slug}) => (super.noSuchMethod( - Invocation.method( - #subscribe, - [], - {#slug: slug}, - ), - returnValue: _i6.Future.value(), - returnValueForMissingStub: _i6.Future.value(), - ) as _i6.Future); - - @override - _i6.Future unsubscribe({required String? slug}) => (super.noSuchMethod( - Invocation.method( - #unsubscribe, - [], - {#slug: slug}, - ), - returnValue: _i6.Future.value(), - returnValueForMissingStub: _i6.Future.value(), - ) as _i6.Future); - - @override - _i6.Future uploadPhoto({required _i10.File? photo}) => - (super.noSuchMethod( - Invocation.method( - #uploadPhoto, - [], - {#photo: photo}, - ), - returnValue: _i6.Future.value(), - returnValueForMissingStub: _i6.Future.value(), - ) as _i6.Future); - - @override - _i6.Future deletePhoto() => (super.noSuchMethod( - Invocation.method( - #deletePhoto, - [], - ), - returnValue: _i6.Future.value(), - returnValueForMissingStub: _i6.Future.value(), - ) as _i6.Future); - - @override - _i6.Future<_i4.ChosenDietsPaginationModel> getChosenDiets() => - (super.noSuchMethod( - Invocation.method( - #getChosenDiets, - [], - ), - returnValue: _i6.Future<_i4.ChosenDietsPaginationModel>.value( - _FakeChosenDietsPaginationModel_3( - this, - Invocation.method( - #getChosenDiets, - [], - ), - )), - returnValueForMissingStub: - _i6.Future<_i4.ChosenDietsPaginationModel>.value( - _FakeChosenDietsPaginationModel_3( - this, - Invocation.method( - #getChosenDiets, - [], - ), - )), - ) as _i6.Future<_i4.ChosenDietsPaginationModel>); - - @override - _i6.Future getPassKey({required String? json}) => (super.noSuchMethod( - Invocation.method( - #getPassKey, - [], - {#json: json}, - ), - returnValue: _i6.Future.value(_i11.dummyValue( - this, - Invocation.method( - #getPassKey, - [], - {#json: json}, - ), - )), - returnValueForMissingStub: - _i6.Future.value(_i11.dummyValue( - this, - Invocation.method( - #getPassKey, - [], - {#json: json}, - ), - )), - ) as _i6.Future); - - @override - _i6.Future getMyPhone() => (super.noSuchMethod( - Invocation.method( - #getMyPhone, - [], - ), - returnValue: _i6.Future.value(_i11.dummyValue( - this, - Invocation.method( - #getMyPhone, - [], - ), - )), - returnValueForMissingStub: - _i6.Future.value(_i11.dummyValue( - this, - Invocation.method( - #getMyPhone, - [], - ), - )), - ) as _i6.Future); - - @override - _i6.Future sendEmailCode() => (super.noSuchMethod( - Invocation.method( - #sendEmailCode, - [], - ), - returnValue: _i6.Future.value(), - returnValueForMissingStub: _i6.Future.value(), - ) as _i6.Future); - - @override - _i6.Future tryVerifyEmailByCode({required String? code}) => - (super.noSuchMethod( - Invocation.method( - #tryVerifyEmailByCode, - [], - {#code: code}, - ), - returnValue: _i6.Future.value(), - returnValueForMissingStub: _i6.Future.value(), - ) as _i6.Future); -} From 08cf1ad370c993841149094223a09ca7bffdaaa7 Mon Sep 17 00:00:00 2001 From: mso7nueh Date: Fri, 11 Jul 2025 14:44:44 +0300 Subject: [PATCH 10/10] =?UTF-8?q?=D0=A3=D0=B4=D0=B0=D0=BB=D0=B5=D0=BD?= =?UTF-8?q?=D1=8B=20=D1=81=D0=B3=D0=B5=D0=BD=D0=B5=D1=80=D0=B8=D1=80=D0=BE?= =?UTF-8?q?=D0=B2=D0=B0=D0=BD=D0=BD=D1=8B=D0=B5=20=D1=84=D0=B0=D0=B9=D0=BB?= =?UTF-8?q?=D1=8B=20(freezed,=20g.dart,=20build)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../consultant_review_model.freezed.dart | 1432 ----------------- .../models/consultant_review_model.g.dart | 67 - .../services/profile_service_test.mocks.dart | 526 ------ 3 files changed, 2025 deletions(-) delete mode 100644 lib/features/diary/models/consultant_review_model.freezed.dart delete mode 100644 lib/features/diary/models/consultant_review_model.g.dart delete mode 100644 test/features/profile/services/profile_service_test.mocks.dart diff --git a/lib/features/diary/models/consultant_review_model.freezed.dart b/lib/features/diary/models/consultant_review_model.freezed.dart deleted file mode 100644 index 36c72066..00000000 --- a/lib/features/diary/models/consultant_review_model.freezed.dart +++ /dev/null @@ -1,1432 +0,0 @@ -// GENERATED CODE - DO NOT MODIFY BY HAND -// coverage:ignore-file -// ignore_for_file: type=lint -// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark - -part of 'consultant_review_model.dart'; - -// ************************************************************************** -// FreezedGenerator -// ************************************************************************** - -// dart format off -T _$identity(T value) => value; - -/// @nodoc -mixin _$ConsultantReviewModel { - String get planName; - int get planDuration; - int get currentPlanDay; - ConsultantComments get consultantComments; - - /// Create a copy of ConsultantReviewModel - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - $ConsultantReviewModelCopyWith get copyWith => - _$ConsultantReviewModelCopyWithImpl( - this as ConsultantReviewModel, _$identity); - - /// Serializes this ConsultantReviewModel to a JSON map. - Map toJson(); - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is ConsultantReviewModel && - (identical(other.planName, planName) || - other.planName == planName) && - (identical(other.planDuration, planDuration) || - other.planDuration == planDuration) && - (identical(other.currentPlanDay, currentPlanDay) || - other.currentPlanDay == currentPlanDay) && - (identical(other.consultantComments, consultantComments) || - other.consultantComments == consultantComments)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hash( - runtimeType, planName, planDuration, currentPlanDay, consultantComments); - - @override - String toString() { - return 'ConsultantReviewModel(planName: $planName, planDuration: $planDuration, currentPlanDay: $currentPlanDay, consultantComments: $consultantComments)'; - } -} - -/// @nodoc -abstract mixin class $ConsultantReviewModelCopyWith<$Res> { - factory $ConsultantReviewModelCopyWith(ConsultantReviewModel value, - $Res Function(ConsultantReviewModel) _then) = - _$ConsultantReviewModelCopyWithImpl; - @useResult - $Res call( - {String planName, - int planDuration, - int currentPlanDay, - ConsultantComments consultantComments}); - - $ConsultantCommentsCopyWith<$Res> get consultantComments; -} - -/// @nodoc -class _$ConsultantReviewModelCopyWithImpl<$Res> - implements $ConsultantReviewModelCopyWith<$Res> { - _$ConsultantReviewModelCopyWithImpl(this._self, this._then); - - final ConsultantReviewModel _self; - final $Res Function(ConsultantReviewModel) _then; - - /// Create a copy of ConsultantReviewModel - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? planName = null, - Object? planDuration = null, - Object? currentPlanDay = null, - Object? consultantComments = null, - }) { - return _then(_self.copyWith( - planName: null == planName - ? _self.planName - : planName // ignore: cast_nullable_to_non_nullable - as String, - planDuration: null == planDuration - ? _self.planDuration - : planDuration // ignore: cast_nullable_to_non_nullable - as int, - currentPlanDay: null == currentPlanDay - ? _self.currentPlanDay - : currentPlanDay // ignore: cast_nullable_to_non_nullable - as int, - consultantComments: null == consultantComments - ? _self.consultantComments - : consultantComments // ignore: cast_nullable_to_non_nullable - as ConsultantComments, - )); - } - - /// Create a copy of ConsultantReviewModel - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $ConsultantCommentsCopyWith<$Res> get consultantComments { - return $ConsultantCommentsCopyWith<$Res>(_self.consultantComments, (value) { - return _then(_self.copyWith(consultantComments: value)); - }); - } -} - -/// Adds pattern-matching-related methods to [ConsultantReviewModel]. -extension ConsultantReviewModelPatterns on ConsultantReviewModel { - /// A variant of `map` that fallback to returning `orElse`. - /// - /// It is equivalent to doing: - /// ```dart - /// switch (sealedClass) { - /// case final Subclass value: - /// return ...; - /// case _: - /// return orElse(); - /// } - /// ``` - - @optionalTypeArgs - TResult maybeMap( - TResult Function(_ConsultantReviewModel value)? $default, { - required TResult orElse(), - }) { - final _that = this; - switch (_that) { - case _ConsultantReviewModel() when $default != null: - return $default(_that); - case _: - return orElse(); - } - } - - /// A `switch`-like method, using callbacks. - /// - /// Callbacks receives the raw object, upcasted. - /// It is equivalent to doing: - /// ```dart - /// switch (sealedClass) { - /// case final Subclass value: - /// return ...; - /// case final Subclass2 value: - /// return ...; - /// } - /// ``` - - @optionalTypeArgs - TResult map( - TResult Function(_ConsultantReviewModel value) $default, - ) { - final _that = this; - switch (_that) { - case _ConsultantReviewModel(): - return $default(_that); - case _: - throw StateError('Unexpected subclass'); - } - } - - /// A variant of `map` that fallback to returning `null`. - /// - /// It is equivalent to doing: - /// ```dart - /// switch (sealedClass) { - /// case final Subclass value: - /// return ...; - /// case _: - /// return null; - /// } - /// ``` - - @optionalTypeArgs - TResult? mapOrNull( - TResult? Function(_ConsultantReviewModel value)? $default, - ) { - final _that = this; - switch (_that) { - case _ConsultantReviewModel() when $default != null: - return $default(_that); - case _: - return null; - } - } - - /// A variant of `when` that fallback to an `orElse` callback. - /// - /// It is equivalent to doing: - /// ```dart - /// switch (sealedClass) { - /// case Subclass(:final field): - /// return ...; - /// case _: - /// return orElse(); - /// } - /// ``` - - @optionalTypeArgs - TResult maybeWhen( - TResult Function(String planName, int planDuration, int currentPlanDay, - ConsultantComments consultantComments)? - $default, { - required TResult orElse(), - }) { - final _that = this; - switch (_that) { - case _ConsultantReviewModel() when $default != null: - return $default(_that.planName, _that.planDuration, - _that.currentPlanDay, _that.consultantComments); - case _: - return orElse(); - } - } - - /// A `switch`-like method, using callbacks. - /// - /// As opposed to `map`, this offers destructuring. - /// It is equivalent to doing: - /// ```dart - /// switch (sealedClass) { - /// case Subclass(:final field): - /// return ...; - /// case Subclass2(:final field2): - /// return ...; - /// } - /// ``` - - @optionalTypeArgs - TResult when( - TResult Function(String planName, int planDuration, int currentPlanDay, - ConsultantComments consultantComments) - $default, - ) { - final _that = this; - switch (_that) { - case _ConsultantReviewModel(): - return $default(_that.planName, _that.planDuration, - _that.currentPlanDay, _that.consultantComments); - case _: - throw StateError('Unexpected subclass'); - } - } - - /// A variant of `when` that fallback to returning `null` - /// - /// It is equivalent to doing: - /// ```dart - /// switch (sealedClass) { - /// case Subclass(:final field): - /// return ...; - /// case _: - /// return null; - /// } - /// ``` - - @optionalTypeArgs - TResult? whenOrNull( - TResult? Function(String planName, int planDuration, int currentPlanDay, - ConsultantComments consultantComments)? - $default, - ) { - final _that = this; - switch (_that) { - case _ConsultantReviewModel() when $default != null: - return $default(_that.planName, _that.planDuration, - _that.currentPlanDay, _that.consultantComments); - case _: - return null; - } - } -} - -/// @nodoc -@JsonSerializable() -class _ConsultantReviewModel implements ConsultantReviewModel { - _ConsultantReviewModel( - {required this.planName, - required this.planDuration, - required this.currentPlanDay, - required this.consultantComments}); - factory _ConsultantReviewModel.fromJson(Map json) => - _$ConsultantReviewModelFromJson(json); - - @override - final String planName; - @override - final int planDuration; - @override - final int currentPlanDay; - @override - final ConsultantComments consultantComments; - - /// Create a copy of ConsultantReviewModel - /// with the given fields replaced by the non-null parameter values. - @override - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - _$ConsultantReviewModelCopyWith<_ConsultantReviewModel> get copyWith => - __$ConsultantReviewModelCopyWithImpl<_ConsultantReviewModel>( - this, _$identity); - - @override - Map toJson() { - return _$ConsultantReviewModelToJson( - this, - ); - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _ConsultantReviewModel && - (identical(other.planName, planName) || - other.planName == planName) && - (identical(other.planDuration, planDuration) || - other.planDuration == planDuration) && - (identical(other.currentPlanDay, currentPlanDay) || - other.currentPlanDay == currentPlanDay) && - (identical(other.consultantComments, consultantComments) || - other.consultantComments == consultantComments)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hash( - runtimeType, planName, planDuration, currentPlanDay, consultantComments); - - @override - String toString() { - return 'ConsultantReviewModel(planName: $planName, planDuration: $planDuration, currentPlanDay: $currentPlanDay, consultantComments: $consultantComments)'; - } -} - -/// @nodoc -abstract mixin class _$ConsultantReviewModelCopyWith<$Res> - implements $ConsultantReviewModelCopyWith<$Res> { - factory _$ConsultantReviewModelCopyWith(_ConsultantReviewModel value, - $Res Function(_ConsultantReviewModel) _then) = - __$ConsultantReviewModelCopyWithImpl; - @override - @useResult - $Res call( - {String planName, - int planDuration, - int currentPlanDay, - ConsultantComments consultantComments}); - - @override - $ConsultantCommentsCopyWith<$Res> get consultantComments; -} - -/// @nodoc -class __$ConsultantReviewModelCopyWithImpl<$Res> - implements _$ConsultantReviewModelCopyWith<$Res> { - __$ConsultantReviewModelCopyWithImpl(this._self, this._then); - - final _ConsultantReviewModel _self; - final $Res Function(_ConsultantReviewModel) _then; - - /// Create a copy of ConsultantReviewModel - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $Res call({ - Object? planName = null, - Object? planDuration = null, - Object? currentPlanDay = null, - Object? consultantComments = null, - }) { - return _then(_ConsultantReviewModel( - planName: null == planName - ? _self.planName - : planName // ignore: cast_nullable_to_non_nullable - as String, - planDuration: null == planDuration - ? _self.planDuration - : planDuration // ignore: cast_nullable_to_non_nullable - as int, - currentPlanDay: null == currentPlanDay - ? _self.currentPlanDay - : currentPlanDay // ignore: cast_nullable_to_non_nullable - as int, - consultantComments: null == consultantComments - ? _self.consultantComments - : consultantComments // ignore: cast_nullable_to_non_nullable - as ConsultantComments, - )); - } - - /// Create a copy of ConsultantReviewModel - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $ConsultantCommentsCopyWith<$Res> get consultantComments { - return $ConsultantCommentsCopyWith<$Res>(_self.consultantComments, (value) { - return _then(_self.copyWith(consultantComments: value)); - }); - } -} - -/// @nodoc -mixin _$ConsultantComments { - String? get dayComment; - List get mealsComments; - List get portionsComments; - - /// Create a copy of ConsultantComments - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - $ConsultantCommentsCopyWith get copyWith => - _$ConsultantCommentsCopyWithImpl( - this as ConsultantComments, _$identity); - - /// Serializes this ConsultantComments to a JSON map. - Map toJson(); - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is ConsultantComments && - (identical(other.dayComment, dayComment) || - other.dayComment == dayComment) && - const DeepCollectionEquality() - .equals(other.mealsComments, mealsComments) && - const DeepCollectionEquality() - .equals(other.portionsComments, portionsComments)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hash( - runtimeType, - dayComment, - const DeepCollectionEquality().hash(mealsComments), - const DeepCollectionEquality().hash(portionsComments)); - - @override - String toString() { - return 'ConsultantComments(dayComment: $dayComment, mealsComments: $mealsComments, portionsComments: $portionsComments)'; - } -} - -/// @nodoc -abstract mixin class $ConsultantCommentsCopyWith<$Res> { - factory $ConsultantCommentsCopyWith( - ConsultantComments value, $Res Function(ConsultantComments) _then) = - _$ConsultantCommentsCopyWithImpl; - @useResult - $Res call( - {String? dayComment, - List mealsComments, - List portionsComments}); -} - -/// @nodoc -class _$ConsultantCommentsCopyWithImpl<$Res> - implements $ConsultantCommentsCopyWith<$Res> { - _$ConsultantCommentsCopyWithImpl(this._self, this._then); - - final ConsultantComments _self; - final $Res Function(ConsultantComments) _then; - - /// Create a copy of ConsultantComments - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? dayComment = freezed, - Object? mealsComments = null, - Object? portionsComments = null, - }) { - return _then(_self.copyWith( - dayComment: freezed == dayComment - ? _self.dayComment - : dayComment // ignore: cast_nullable_to_non_nullable - as String?, - mealsComments: null == mealsComments - ? _self.mealsComments - : mealsComments // ignore: cast_nullable_to_non_nullable - as List, - portionsComments: null == portionsComments - ? _self.portionsComments - : portionsComments // ignore: cast_nullable_to_non_nullable - as List, - )); - } -} - -/// Adds pattern-matching-related methods to [ConsultantComments]. -extension ConsultantCommentsPatterns on ConsultantComments { - /// A variant of `map` that fallback to returning `orElse`. - /// - /// It is equivalent to doing: - /// ```dart - /// switch (sealedClass) { - /// case final Subclass value: - /// return ...; - /// case _: - /// return orElse(); - /// } - /// ``` - - @optionalTypeArgs - TResult maybeMap( - TResult Function(_ConsultantComments value)? $default, { - required TResult orElse(), - }) { - final _that = this; - switch (_that) { - case _ConsultantComments() when $default != null: - return $default(_that); - case _: - return orElse(); - } - } - - /// A `switch`-like method, using callbacks. - /// - /// Callbacks receives the raw object, upcasted. - /// It is equivalent to doing: - /// ```dart - /// switch (sealedClass) { - /// case final Subclass value: - /// return ...; - /// case final Subclass2 value: - /// return ...; - /// } - /// ``` - - @optionalTypeArgs - TResult map( - TResult Function(_ConsultantComments value) $default, - ) { - final _that = this; - switch (_that) { - case _ConsultantComments(): - return $default(_that); - case _: - throw StateError('Unexpected subclass'); - } - } - - /// A variant of `map` that fallback to returning `null`. - /// - /// It is equivalent to doing: - /// ```dart - /// switch (sealedClass) { - /// case final Subclass value: - /// return ...; - /// case _: - /// return null; - /// } - /// ``` - - @optionalTypeArgs - TResult? mapOrNull( - TResult? Function(_ConsultantComments value)? $default, - ) { - final _that = this; - switch (_that) { - case _ConsultantComments() when $default != null: - return $default(_that); - case _: - return null; - } - } - - /// A variant of `when` that fallback to an `orElse` callback. - /// - /// It is equivalent to doing: - /// ```dart - /// switch (sealedClass) { - /// case Subclass(:final field): - /// return ...; - /// case _: - /// return orElse(); - /// } - /// ``` - - @optionalTypeArgs - TResult maybeWhen( - TResult Function(String? dayComment, List mealsComments, - List portionsComments)? - $default, { - required TResult orElse(), - }) { - final _that = this; - switch (_that) { - case _ConsultantComments() when $default != null: - return $default( - _that.dayComment, _that.mealsComments, _that.portionsComments); - case _: - return orElse(); - } - } - - /// A `switch`-like method, using callbacks. - /// - /// As opposed to `map`, this offers destructuring. - /// It is equivalent to doing: - /// ```dart - /// switch (sealedClass) { - /// case Subclass(:final field): - /// return ...; - /// case Subclass2(:final field2): - /// return ...; - /// } - /// ``` - - @optionalTypeArgs - TResult when( - TResult Function(String? dayComment, List mealsComments, - List portionsComments) - $default, - ) { - final _that = this; - switch (_that) { - case _ConsultantComments(): - return $default( - _that.dayComment, _that.mealsComments, _that.portionsComments); - case _: - throw StateError('Unexpected subclass'); - } - } - - /// A variant of `when` that fallback to returning `null` - /// - /// It is equivalent to doing: - /// ```dart - /// switch (sealedClass) { - /// case Subclass(:final field): - /// return ...; - /// case _: - /// return null; - /// } - /// ``` - - @optionalTypeArgs - TResult? whenOrNull( - TResult? Function(String? dayComment, List mealsComments, - List portionsComments)? - $default, - ) { - final _that = this; - switch (_that) { - case _ConsultantComments() when $default != null: - return $default( - _that.dayComment, _that.mealsComments, _that.portionsComments); - case _: - return null; - } - } -} - -/// @nodoc -@JsonSerializable() -class _ConsultantComments implements ConsultantComments { - _ConsultantComments( - {required this.dayComment, - required final List mealsComments, - required final List portionsComments}) - : _mealsComments = mealsComments, - _portionsComments = portionsComments; - factory _ConsultantComments.fromJson(Map json) => - _$ConsultantCommentsFromJson(json); - - @override - final String? dayComment; - final List _mealsComments; - @override - List get mealsComments { - if (_mealsComments is EqualUnmodifiableListView) return _mealsComments; - // ignore: implicit_dynamic_type - return EqualUnmodifiableListView(_mealsComments); - } - - final List _portionsComments; - @override - List get portionsComments { - if (_portionsComments is EqualUnmodifiableListView) - return _portionsComments; - // ignore: implicit_dynamic_type - return EqualUnmodifiableListView(_portionsComments); - } - - /// Create a copy of ConsultantComments - /// with the given fields replaced by the non-null parameter values. - @override - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - _$ConsultantCommentsCopyWith<_ConsultantComments> get copyWith => - __$ConsultantCommentsCopyWithImpl<_ConsultantComments>(this, _$identity); - - @override - Map toJson() { - return _$ConsultantCommentsToJson( - this, - ); - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _ConsultantComments && - (identical(other.dayComment, dayComment) || - other.dayComment == dayComment) && - const DeepCollectionEquality() - .equals(other._mealsComments, _mealsComments) && - const DeepCollectionEquality() - .equals(other._portionsComments, _portionsComments)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hash( - runtimeType, - dayComment, - const DeepCollectionEquality().hash(_mealsComments), - const DeepCollectionEquality().hash(_portionsComments)); - - @override - String toString() { - return 'ConsultantComments(dayComment: $dayComment, mealsComments: $mealsComments, portionsComments: $portionsComments)'; - } -} - -/// @nodoc -abstract mixin class _$ConsultantCommentsCopyWith<$Res> - implements $ConsultantCommentsCopyWith<$Res> { - factory _$ConsultantCommentsCopyWith( - _ConsultantComments value, $Res Function(_ConsultantComments) _then) = - __$ConsultantCommentsCopyWithImpl; - @override - @useResult - $Res call( - {String? dayComment, - List mealsComments, - List portionsComments}); -} - -/// @nodoc -class __$ConsultantCommentsCopyWithImpl<$Res> - implements _$ConsultantCommentsCopyWith<$Res> { - __$ConsultantCommentsCopyWithImpl(this._self, this._then); - - final _ConsultantComments _self; - final $Res Function(_ConsultantComments) _then; - - /// Create a copy of ConsultantComments - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $Res call({ - Object? dayComment = freezed, - Object? mealsComments = null, - Object? portionsComments = null, - }) { - return _then(_ConsultantComments( - dayComment: freezed == dayComment - ? _self.dayComment - : dayComment // ignore: cast_nullable_to_non_nullable - as String?, - mealsComments: null == mealsComments - ? _self._mealsComments - : mealsComments // ignore: cast_nullable_to_non_nullable - as List, - portionsComments: null == portionsComments - ? _self._portionsComments - : portionsComments // ignore: cast_nullable_to_non_nullable - as List, - )); - } -} - -/// @nodoc -mixin _$MealComment { - String get comment; - int get typeNo; - - /// Create a copy of MealComment - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - $MealCommentCopyWith get copyWith => - _$MealCommentCopyWithImpl(this as MealComment, _$identity); - - /// Serializes this MealComment to a JSON map. - Map toJson(); - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is MealComment && - (identical(other.comment, comment) || other.comment == comment) && - (identical(other.typeNo, typeNo) || other.typeNo == typeNo)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hash(runtimeType, comment, typeNo); - - @override - String toString() { - return 'MealComment(comment: $comment, typeNo: $typeNo)'; - } -} - -/// @nodoc -abstract mixin class $MealCommentCopyWith<$Res> { - factory $MealCommentCopyWith( - MealComment value, $Res Function(MealComment) _then) = - _$MealCommentCopyWithImpl; - @useResult - $Res call({String comment, int typeNo}); -} - -/// @nodoc -class _$MealCommentCopyWithImpl<$Res> implements $MealCommentCopyWith<$Res> { - _$MealCommentCopyWithImpl(this._self, this._then); - - final MealComment _self; - final $Res Function(MealComment) _then; - - /// Create a copy of MealComment - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? comment = null, - Object? typeNo = null, - }) { - return _then(_self.copyWith( - comment: null == comment - ? _self.comment - : comment // ignore: cast_nullable_to_non_nullable - as String, - typeNo: null == typeNo - ? _self.typeNo - : typeNo // ignore: cast_nullable_to_non_nullable - as int, - )); - } -} - -/// Adds pattern-matching-related methods to [MealComment]. -extension MealCommentPatterns on MealComment { - /// A variant of `map` that fallback to returning `orElse`. - /// - /// It is equivalent to doing: - /// ```dart - /// switch (sealedClass) { - /// case final Subclass value: - /// return ...; - /// case _: - /// return orElse(); - /// } - /// ``` - - @optionalTypeArgs - TResult maybeMap( - TResult Function(_MealComment value)? $default, { - required TResult orElse(), - }) { - final _that = this; - switch (_that) { - case _MealComment() when $default != null: - return $default(_that); - case _: - return orElse(); - } - } - - /// A `switch`-like method, using callbacks. - /// - /// Callbacks receives the raw object, upcasted. - /// It is equivalent to doing: - /// ```dart - /// switch (sealedClass) { - /// case final Subclass value: - /// return ...; - /// case final Subclass2 value: - /// return ...; - /// } - /// ``` - - @optionalTypeArgs - TResult map( - TResult Function(_MealComment value) $default, - ) { - final _that = this; - switch (_that) { - case _MealComment(): - return $default(_that); - case _: - throw StateError('Unexpected subclass'); - } - } - - /// A variant of `map` that fallback to returning `null`. - /// - /// It is equivalent to doing: - /// ```dart - /// switch (sealedClass) { - /// case final Subclass value: - /// return ...; - /// case _: - /// return null; - /// } - /// ``` - - @optionalTypeArgs - TResult? mapOrNull( - TResult? Function(_MealComment value)? $default, - ) { - final _that = this; - switch (_that) { - case _MealComment() when $default != null: - return $default(_that); - case _: - return null; - } - } - - /// A variant of `when` that fallback to an `orElse` callback. - /// - /// It is equivalent to doing: - /// ```dart - /// switch (sealedClass) { - /// case Subclass(:final field): - /// return ...; - /// case _: - /// return orElse(); - /// } - /// ``` - - @optionalTypeArgs - TResult maybeWhen( - TResult Function(String comment, int typeNo)? $default, { - required TResult orElse(), - }) { - final _that = this; - switch (_that) { - case _MealComment() when $default != null: - return $default(_that.comment, _that.typeNo); - case _: - return orElse(); - } - } - - /// A `switch`-like method, using callbacks. - /// - /// As opposed to `map`, this offers destructuring. - /// It is equivalent to doing: - /// ```dart - /// switch (sealedClass) { - /// case Subclass(:final field): - /// return ...; - /// case Subclass2(:final field2): - /// return ...; - /// } - /// ``` - - @optionalTypeArgs - TResult when( - TResult Function(String comment, int typeNo) $default, - ) { - final _that = this; - switch (_that) { - case _MealComment(): - return $default(_that.comment, _that.typeNo); - case _: - throw StateError('Unexpected subclass'); - } - } - - /// A variant of `when` that fallback to returning `null` - /// - /// It is equivalent to doing: - /// ```dart - /// switch (sealedClass) { - /// case Subclass(:final field): - /// return ...; - /// case _: - /// return null; - /// } - /// ``` - - @optionalTypeArgs - TResult? whenOrNull( - TResult? Function(String comment, int typeNo)? $default, - ) { - final _that = this; - switch (_that) { - case _MealComment() when $default != null: - return $default(_that.comment, _that.typeNo); - case _: - return null; - } - } -} - -/// @nodoc -@JsonSerializable() -class _MealComment implements MealComment { - _MealComment({required this.comment, required this.typeNo}); - factory _MealComment.fromJson(Map json) => - _$MealCommentFromJson(json); - - @override - final String comment; - @override - final int typeNo; - - /// Create a copy of MealComment - /// with the given fields replaced by the non-null parameter values. - @override - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - _$MealCommentCopyWith<_MealComment> get copyWith => - __$MealCommentCopyWithImpl<_MealComment>(this, _$identity); - - @override - Map toJson() { - return _$MealCommentToJson( - this, - ); - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _MealComment && - (identical(other.comment, comment) || other.comment == comment) && - (identical(other.typeNo, typeNo) || other.typeNo == typeNo)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hash(runtimeType, comment, typeNo); - - @override - String toString() { - return 'MealComment(comment: $comment, typeNo: $typeNo)'; - } -} - -/// @nodoc -abstract mixin class _$MealCommentCopyWith<$Res> - implements $MealCommentCopyWith<$Res> { - factory _$MealCommentCopyWith( - _MealComment value, $Res Function(_MealComment) _then) = - __$MealCommentCopyWithImpl; - @override - @useResult - $Res call({String comment, int typeNo}); -} - -/// @nodoc -class __$MealCommentCopyWithImpl<$Res> implements _$MealCommentCopyWith<$Res> { - __$MealCommentCopyWithImpl(this._self, this._then); - - final _MealComment _self; - final $Res Function(_MealComment) _then; - - /// Create a copy of MealComment - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $Res call({ - Object? comment = null, - Object? typeNo = null, - }) { - return _then(_MealComment( - comment: null == comment - ? _self.comment - : comment // ignore: cast_nullable_to_non_nullable - as String, - typeNo: null == typeNo - ? _self.typeNo - : typeNo // ignore: cast_nullable_to_non_nullable - as int, - )); - } -} - -/// @nodoc -mixin _$PortionComment { - @JsonKey(name: 'id') - int get portionId; - String get comment; - - /// Create a copy of PortionComment - /// with the given fields replaced by the non-null parameter values. - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - $PortionCommentCopyWith get copyWith => - _$PortionCommentCopyWithImpl( - this as PortionComment, _$identity); - - /// Serializes this PortionComment to a JSON map. - Map toJson(); - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is PortionComment && - (identical(other.portionId, portionId) || - other.portionId == portionId) && - (identical(other.comment, comment) || other.comment == comment)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hash(runtimeType, portionId, comment); - - @override - String toString() { - return 'PortionComment(portionId: $portionId, comment: $comment)'; - } -} - -/// @nodoc -abstract mixin class $PortionCommentCopyWith<$Res> { - factory $PortionCommentCopyWith( - PortionComment value, $Res Function(PortionComment) _then) = - _$PortionCommentCopyWithImpl; - @useResult - $Res call({@JsonKey(name: 'id') int portionId, String comment}); -} - -/// @nodoc -class _$PortionCommentCopyWithImpl<$Res> - implements $PortionCommentCopyWith<$Res> { - _$PortionCommentCopyWithImpl(this._self, this._then); - - final PortionComment _self; - final $Res Function(PortionComment) _then; - - /// Create a copy of PortionComment - /// with the given fields replaced by the non-null parameter values. - @pragma('vm:prefer-inline') - @override - $Res call({ - Object? portionId = null, - Object? comment = null, - }) { - return _then(_self.copyWith( - portionId: null == portionId - ? _self.portionId - : portionId // ignore: cast_nullable_to_non_nullable - as int, - comment: null == comment - ? _self.comment - : comment // ignore: cast_nullable_to_non_nullable - as String, - )); - } -} - -/// Adds pattern-matching-related methods to [PortionComment]. -extension PortionCommentPatterns on PortionComment { - /// A variant of `map` that fallback to returning `orElse`. - /// - /// It is equivalent to doing: - /// ```dart - /// switch (sealedClass) { - /// case final Subclass value: - /// return ...; - /// case _: - /// return orElse(); - /// } - /// ``` - - @optionalTypeArgs - TResult maybeMap( - TResult Function(_PortionComment value)? $default, { - required TResult orElse(), - }) { - final _that = this; - switch (_that) { - case _PortionComment() when $default != null: - return $default(_that); - case _: - return orElse(); - } - } - - /// A `switch`-like method, using callbacks. - /// - /// Callbacks receives the raw object, upcasted. - /// It is equivalent to doing: - /// ```dart - /// switch (sealedClass) { - /// case final Subclass value: - /// return ...; - /// case final Subclass2 value: - /// return ...; - /// } - /// ``` - - @optionalTypeArgs - TResult map( - TResult Function(_PortionComment value) $default, - ) { - final _that = this; - switch (_that) { - case _PortionComment(): - return $default(_that); - case _: - throw StateError('Unexpected subclass'); - } - } - - /// A variant of `map` that fallback to returning `null`. - /// - /// It is equivalent to doing: - /// ```dart - /// switch (sealedClass) { - /// case final Subclass value: - /// return ...; - /// case _: - /// return null; - /// } - /// ``` - - @optionalTypeArgs - TResult? mapOrNull( - TResult? Function(_PortionComment value)? $default, - ) { - final _that = this; - switch (_that) { - case _PortionComment() when $default != null: - return $default(_that); - case _: - return null; - } - } - - /// A variant of `when` that fallback to an `orElse` callback. - /// - /// It is equivalent to doing: - /// ```dart - /// switch (sealedClass) { - /// case Subclass(:final field): - /// return ...; - /// case _: - /// return orElse(); - /// } - /// ``` - - @optionalTypeArgs - TResult maybeWhen( - TResult Function(@JsonKey(name: 'id') int portionId, String comment)? - $default, { - required TResult orElse(), - }) { - final _that = this; - switch (_that) { - case _PortionComment() when $default != null: - return $default(_that.portionId, _that.comment); - case _: - return orElse(); - } - } - - /// A `switch`-like method, using callbacks. - /// - /// As opposed to `map`, this offers destructuring. - /// It is equivalent to doing: - /// ```dart - /// switch (sealedClass) { - /// case Subclass(:final field): - /// return ...; - /// case Subclass2(:final field2): - /// return ...; - /// } - /// ``` - - @optionalTypeArgs - TResult when( - TResult Function(@JsonKey(name: 'id') int portionId, String comment) - $default, - ) { - final _that = this; - switch (_that) { - case _PortionComment(): - return $default(_that.portionId, _that.comment); - case _: - throw StateError('Unexpected subclass'); - } - } - - /// A variant of `when` that fallback to returning `null` - /// - /// It is equivalent to doing: - /// ```dart - /// switch (sealedClass) { - /// case Subclass(:final field): - /// return ...; - /// case _: - /// return null; - /// } - /// ``` - - @optionalTypeArgs - TResult? whenOrNull( - TResult? Function(@JsonKey(name: 'id') int portionId, String comment)? - $default, - ) { - final _that = this; - switch (_that) { - case _PortionComment() when $default != null: - return $default(_that.portionId, _that.comment); - case _: - return null; - } - } -} - -/// @nodoc -@JsonSerializable() -class _PortionComment implements PortionComment { - _PortionComment( - {@JsonKey(name: 'id') required this.portionId, required this.comment}); - factory _PortionComment.fromJson(Map json) => - _$PortionCommentFromJson(json); - - @override - @JsonKey(name: 'id') - final int portionId; - @override - final String comment; - - /// Create a copy of PortionComment - /// with the given fields replaced by the non-null parameter values. - @override - @JsonKey(includeFromJson: false, includeToJson: false) - @pragma('vm:prefer-inline') - _$PortionCommentCopyWith<_PortionComment> get copyWith => - __$PortionCommentCopyWithImpl<_PortionComment>(this, _$identity); - - @override - Map toJson() { - return _$PortionCommentToJson( - this, - ); - } - - @override - bool operator ==(Object other) { - return identical(this, other) || - (other.runtimeType == runtimeType && - other is _PortionComment && - (identical(other.portionId, portionId) || - other.portionId == portionId) && - (identical(other.comment, comment) || other.comment == comment)); - } - - @JsonKey(includeFromJson: false, includeToJson: false) - @override - int get hashCode => Object.hash(runtimeType, portionId, comment); - - @override - String toString() { - return 'PortionComment(portionId: $portionId, comment: $comment)'; - } -} - -/// @nodoc -abstract mixin class _$PortionCommentCopyWith<$Res> - implements $PortionCommentCopyWith<$Res> { - factory _$PortionCommentCopyWith( - _PortionComment value, $Res Function(_PortionComment) _then) = - __$PortionCommentCopyWithImpl; - @override - @useResult - $Res call({@JsonKey(name: 'id') int portionId, String comment}); -} - -/// @nodoc -class __$PortionCommentCopyWithImpl<$Res> - implements _$PortionCommentCopyWith<$Res> { - __$PortionCommentCopyWithImpl(this._self, this._then); - - final _PortionComment _self; - final $Res Function(_PortionComment) _then; - - /// Create a copy of PortionComment - /// with the given fields replaced by the non-null parameter values. - @override - @pragma('vm:prefer-inline') - $Res call({ - Object? portionId = null, - Object? comment = null, - }) { - return _then(_PortionComment( - portionId: null == portionId - ? _self.portionId - : portionId // ignore: cast_nullable_to_non_nullable - as int, - comment: null == comment - ? _self.comment - : comment // ignore: cast_nullable_to_non_nullable - as String, - )); - } -} - -// dart format on diff --git a/lib/features/diary/models/consultant_review_model.g.dart b/lib/features/diary/models/consultant_review_model.g.dart deleted file mode 100644 index ad7fa537..00000000 --- a/lib/features/diary/models/consultant_review_model.g.dart +++ /dev/null @@ -1,67 +0,0 @@ -// GENERATED CODE - DO NOT MODIFY BY HAND - -part of 'consultant_review_model.dart'; - -// ************************************************************************** -// JsonSerializableGenerator -// ************************************************************************** - -_ConsultantReviewModel _$ConsultantReviewModelFromJson( - Map json) => - _ConsultantReviewModel( - planName: json['planName'] as String, - planDuration: (json['planDuration'] as num).toInt(), - currentPlanDay: (json['currentPlanDay'] as num).toInt(), - consultantComments: ConsultantComments.fromJson( - json['consultantComments'] as Map), - ); - -Map _$ConsultantReviewModelToJson( - _ConsultantReviewModel instance) => - { - 'planName': instance.planName, - 'planDuration': instance.planDuration, - 'currentPlanDay': instance.currentPlanDay, - 'consultantComments': instance.consultantComments, - }; - -_ConsultantComments _$ConsultantCommentsFromJson(Map json) => - _ConsultantComments( - dayComment: json['dayComment'] as String?, - mealsComments: (json['mealsComments'] as List) - .map((e) => MealComment.fromJson(e as Map)) - .toList(), - portionsComments: (json['portionsComments'] as List) - .map((e) => PortionComment.fromJson(e as Map)) - .toList(), - ); - -Map _$ConsultantCommentsToJson(_ConsultantComments instance) => - { - 'dayComment': instance.dayComment, - 'mealsComments': instance.mealsComments, - 'portionsComments': instance.portionsComments, - }; - -_MealComment _$MealCommentFromJson(Map json) => _MealComment( - comment: json['comment'] as String, - typeNo: (json['typeNo'] as num).toInt(), - ); - -Map _$MealCommentToJson(_MealComment instance) => - { - 'comment': instance.comment, - 'typeNo': instance.typeNo, - }; - -_PortionComment _$PortionCommentFromJson(Map json) => - _PortionComment( - portionId: (json['id'] as num).toInt(), - comment: json['comment'] as String, - ); - -Map _$PortionCommentToJson(_PortionComment instance) => - { - 'id': instance.portionId, - 'comment': instance.comment, - }; diff --git a/test/features/profile/services/profile_service_test.mocks.dart b/test/features/profile/services/profile_service_test.mocks.dart deleted file mode 100644 index 22c3af52..00000000 --- a/test/features/profile/services/profile_service_test.mocks.dart +++ /dev/null @@ -1,526 +0,0 @@ -// Mocks generated by Mockito 5.4.6 from annotations -// in eatvio_app/test/features/profile/services/profile_service_test.dart. -// Do not manually edit this file. - -// ignore_for_file: no_leading_underscores_for_library_prefixes -import 'dart:async' as _i6; -import 'dart:io' as _i10; - -import 'package:eatvio_app/features/feed/models/feed_blog_post_model.dart' - as _i7; -import 'package:eatvio_app/features/profile/models/chosen_diets_pagination_model.dart' - as _i4; -import 'package:eatvio_app/features/profile/models/circumference_model.dart' - as _i9; -import 'package:eatvio_app/features/profile/models/profile_model.dart' as _i2; -import 'package:eatvio_app/features/profile/models/sub_model.dart' as _i3; -import 'package:eatvio_app/features/profile/models/weight_model.dart' as _i8; -import 'package:eatvio_app/features/profile/services/profile_service.dart' - as _i5; -import 'package:mockito/mockito.dart' as _i1; -import 'package:mockito/src/dummies.dart' as _i11; - -// ignore_for_file: type=lint -// ignore_for_file: avoid_redundant_argument_values -// ignore_for_file: avoid_setters_without_getters -// ignore_for_file: comment_references -// ignore_for_file: deprecated_member_use -// ignore_for_file: deprecated_member_use_from_same_package -// ignore_for_file: implementation_imports -// ignore_for_file: invalid_use_of_visible_for_testing_member -// ignore_for_file: must_be_immutable -// ignore_for_file: prefer_const_constructors -// ignore_for_file: unnecessary_parenthesis -// ignore_for_file: camel_case_types -// ignore_for_file: subtype_of_sealed_class - -class _FakeProfileModel_0 extends _i1.SmartFake implements _i2.ProfileModel { - _FakeProfileModel_0( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); -} - -class _FakeProfileDetailsModel_1 extends _i1.SmartFake - implements _i2.ProfileDetailsModel { - _FakeProfileDetailsModel_1( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); -} - -class _FakeSubPaginationModel_2 extends _i1.SmartFake - implements _i3.SubPaginationModel { - _FakeSubPaginationModel_2( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); -} - -class _FakeChosenDietsPaginationModel_3 extends _i1.SmartFake - implements _i4.ChosenDietsPaginationModel { - _FakeChosenDietsPaginationModel_3( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); -} - -/// A class which mocks [ProfileService]. -/// -/// See the documentation for Mockito's code generation for more information. -class MockProfileService extends _i1.Mock implements _i5.ProfileService { - @override - _i6.Future<_i2.ProfileModel> getProfileBySlug({required String? slug}) => - (super.noSuchMethod( - Invocation.method( - #getProfileBySlug, - [], - {#slug: slug}, - ), - returnValue: _i6.Future<_i2.ProfileModel>.value(_FakeProfileModel_0( - this, - Invocation.method( - #getProfileBySlug, - [], - {#slug: slug}, - ), - )), - returnValueForMissingStub: - _i6.Future<_i2.ProfileModel>.value(_FakeProfileModel_0( - this, - Invocation.method( - #getProfileBySlug, - [], - {#slug: slug}, - ), - )), - ) as _i6.Future<_i2.ProfileModel>); - - @override - _i6.Future<_i2.ProfileModel> getMyProfile() => (super.noSuchMethod( - Invocation.method( - #getMyProfile, - [], - ), - returnValue: _i6.Future<_i2.ProfileModel>.value(_FakeProfileModel_0( - this, - Invocation.method( - #getMyProfile, - [], - ), - )), - returnValueForMissingStub: - _i6.Future<_i2.ProfileModel>.value(_FakeProfileModel_0( - this, - Invocation.method( - #getMyProfile, - [], - ), - )), - ) as _i6.Future<_i2.ProfileModel>); - - @override - _i6.Future<_i2.ProfileDetailsModel> getMyProfileDetails() => - (super.noSuchMethod( - Invocation.method( - #getMyProfileDetails, - [], - ), - returnValue: _i6.Future<_i2.ProfileDetailsModel>.value( - _FakeProfileDetailsModel_1( - this, - Invocation.method( - #getMyProfileDetails, - [], - ), - )), - returnValueForMissingStub: _i6.Future<_i2.ProfileDetailsModel>.value( - _FakeProfileDetailsModel_1( - this, - Invocation.method( - #getMyProfileDetails, - [], - ), - )), - ) as _i6.Future<_i2.ProfileDetailsModel>); - - @override - _i6.Future<_i2.ProfileDetailsModel> getProfileDetailsBySlug( - {required String? slug}) => - (super.noSuchMethod( - Invocation.method( - #getProfileDetailsBySlug, - [], - {#slug: slug}, - ), - returnValue: _i6.Future<_i2.ProfileDetailsModel>.value( - _FakeProfileDetailsModel_1( - this, - Invocation.method( - #getProfileDetailsBySlug, - [], - {#slug: slug}, - ), - )), - returnValueForMissingStub: _i6.Future<_i2.ProfileDetailsModel>.value( - _FakeProfileDetailsModel_1( - this, - Invocation.method( - #getProfileDetailsBySlug, - [], - {#slug: slug}, - ), - )), - ) as _i6.Future<_i2.ProfileDetailsModel>); - - @override - _i6.Future addCircumference({ - required int? chestCircumference, - required int? waistCircumference, - required int? hipCircumference, - }) => - (super.noSuchMethod( - Invocation.method( - #addCircumference, - [], - { - #chestCircumference: chestCircumference, - #waistCircumference: waistCircumference, - #hipCircumference: hipCircumference, - }, - ), - returnValue: _i6.Future.value(), - returnValueForMissingStub: _i6.Future.value(), - ) as _i6.Future); - - @override - _i6.Future addWeight({required double? weight}) => (super.noSuchMethod( - Invocation.method( - #addWeight, - [], - {#weight: weight}, - ), - returnValue: _i6.Future.value(), - returnValueForMissingStub: _i6.Future.value(), - ) as _i6.Future); - - @override - _i6.Future> getBlogPostByAuthorSlug( - {required String? slug}) => - (super.noSuchMethod( - Invocation.method( - #getBlogPostByAuthorSlug, - [], - {#slug: slug}, - ), - returnValue: _i6.Future>.value( - <_i7.FeedBlogPostModel>[]), - returnValueForMissingStub: - _i6.Future>.value( - <_i7.FeedBlogPostModel>[]), - ) as _i6.Future>); - - @override - _i6.Future> getWeight({required String? period}) => - (super.noSuchMethod( - Invocation.method( - #getWeight, - [], - {#period: period}, - ), - returnValue: - _i6.Future>.value(<_i8.WeightModel>[]), - returnValueForMissingStub: - _i6.Future>.value(<_i8.WeightModel>[]), - ) as _i6.Future>); - - @override - _i6.Future> getWeightBySlug({ - required String? period, - required String? slug, - }) => - (super.noSuchMethod( - Invocation.method( - #getWeightBySlug, - [], - { - #period: period, - #slug: slug, - }, - ), - returnValue: - _i6.Future>.value(<_i8.WeightModel>[]), - returnValueForMissingStub: - _i6.Future>.value(<_i8.WeightModel>[]), - ) as _i6.Future>); - - @override - _i6.Future> getCircumferences( - {required String? period}) => - (super.noSuchMethod( - Invocation.method( - #getCircumferences, - [], - {#period: period}, - ), - returnValue: _i6.Future>.value( - <_i9.CircumferenceModel>[]), - returnValueForMissingStub: - _i6.Future>.value( - <_i9.CircumferenceModel>[]), - ) as _i6.Future>); - - @override - _i6.Future> getCircumferencesBySlug({ - required String? period, - required String? slug, - }) => - (super.noSuchMethod( - Invocation.method( - #getCircumferencesBySlug, - [], - { - #period: period, - #slug: slug, - }, - ), - returnValue: _i6.Future>.value( - <_i9.CircumferenceModel>[]), - returnValueForMissingStub: - _i6.Future>.value( - <_i9.CircumferenceModel>[]), - ) as _i6.Future>); - - @override - _i6.Future<_i3.SubPaginationModel> getSubscribers({ - required String? slug, - String? query, - }) => - (super.noSuchMethod( - Invocation.method( - #getSubscribers, - [], - { - #slug: slug, - #query: query, - }, - ), - returnValue: - _i6.Future<_i3.SubPaginationModel>.value(_FakeSubPaginationModel_2( - this, - Invocation.method( - #getSubscribers, - [], - { - #slug: slug, - #query: query, - }, - ), - )), - returnValueForMissingStub: - _i6.Future<_i3.SubPaginationModel>.value(_FakeSubPaginationModel_2( - this, - Invocation.method( - #getSubscribers, - [], - { - #slug: slug, - #query: query, - }, - ), - )), - ) as _i6.Future<_i3.SubPaginationModel>); - - @override - _i6.Future<_i3.SubPaginationModel> getSubscriptions({ - required String? slug, - String? query, - }) => - (super.noSuchMethod( - Invocation.method( - #getSubscriptions, - [], - { - #slug: slug, - #query: query, - }, - ), - returnValue: - _i6.Future<_i3.SubPaginationModel>.value(_FakeSubPaginationModel_2( - this, - Invocation.method( - #getSubscriptions, - [], - { - #slug: slug, - #query: query, - }, - ), - )), - returnValueForMissingStub: - _i6.Future<_i3.SubPaginationModel>.value(_FakeSubPaginationModel_2( - this, - Invocation.method( - #getSubscriptions, - [], - { - #slug: slug, - #query: query, - }, - ), - )), - ) as _i6.Future<_i3.SubPaginationModel>); - - @override - _i6.Future subscribe({required String? slug}) => (super.noSuchMethod( - Invocation.method( - #subscribe, - [], - {#slug: slug}, - ), - returnValue: _i6.Future.value(), - returnValueForMissingStub: _i6.Future.value(), - ) as _i6.Future); - - @override - _i6.Future unsubscribe({required String? slug}) => (super.noSuchMethod( - Invocation.method( - #unsubscribe, - [], - {#slug: slug}, - ), - returnValue: _i6.Future.value(), - returnValueForMissingStub: _i6.Future.value(), - ) as _i6.Future); - - @override - _i6.Future uploadPhoto({required _i10.File? photo}) => - (super.noSuchMethod( - Invocation.method( - #uploadPhoto, - [], - {#photo: photo}, - ), - returnValue: _i6.Future.value(), - returnValueForMissingStub: _i6.Future.value(), - ) as _i6.Future); - - @override - _i6.Future deletePhoto() => (super.noSuchMethod( - Invocation.method( - #deletePhoto, - [], - ), - returnValue: _i6.Future.value(), - returnValueForMissingStub: _i6.Future.value(), - ) as _i6.Future); - - @override - _i6.Future<_i4.ChosenDietsPaginationModel> getChosenDiets() => - (super.noSuchMethod( - Invocation.method( - #getChosenDiets, - [], - ), - returnValue: _i6.Future<_i4.ChosenDietsPaginationModel>.value( - _FakeChosenDietsPaginationModel_3( - this, - Invocation.method( - #getChosenDiets, - [], - ), - )), - returnValueForMissingStub: - _i6.Future<_i4.ChosenDietsPaginationModel>.value( - _FakeChosenDietsPaginationModel_3( - this, - Invocation.method( - #getChosenDiets, - [], - ), - )), - ) as _i6.Future<_i4.ChosenDietsPaginationModel>); - - @override - _i6.Future getPassKey({required String? json}) => (super.noSuchMethod( - Invocation.method( - #getPassKey, - [], - {#json: json}, - ), - returnValue: _i6.Future.value(_i11.dummyValue( - this, - Invocation.method( - #getPassKey, - [], - {#json: json}, - ), - )), - returnValueForMissingStub: - _i6.Future.value(_i11.dummyValue( - this, - Invocation.method( - #getPassKey, - [], - {#json: json}, - ), - )), - ) as _i6.Future); - - @override - _i6.Future getMyPhone() => (super.noSuchMethod( - Invocation.method( - #getMyPhone, - [], - ), - returnValue: _i6.Future.value(_i11.dummyValue( - this, - Invocation.method( - #getMyPhone, - [], - ), - )), - returnValueForMissingStub: - _i6.Future.value(_i11.dummyValue( - this, - Invocation.method( - #getMyPhone, - [], - ), - )), - ) as _i6.Future); - - @override - _i6.Future sendEmailCode() => (super.noSuchMethod( - Invocation.method( - #sendEmailCode, - [], - ), - returnValue: _i6.Future.value(), - returnValueForMissingStub: _i6.Future.value(), - ) as _i6.Future); - - @override - _i6.Future tryVerifyEmailByCode({required String? code}) => - (super.noSuchMethod( - Invocation.method( - #tryVerifyEmailByCode, - [], - {#code: code}, - ), - returnValue: _i6.Future.value(), - returnValueForMissingStub: _i6.Future.value(), - ) as _i6.Future); -}