From 74df7d82db0dd9f8af2f5ad6a28cc65b9a0c9b54 Mon Sep 17 00:00:00 2001 From: mso7nueh Date: Mon, 14 Jul 2025 14:06:07 +0300 Subject: [PATCH 1/7] feat(notifications): Issue-562 --- lib/core/app_router.dart | 18 +++---------- lib/core/const.dart | 1 - lib/core/firebase_api.dart | 25 +++++++++++++++++++ .../auth/presentation/pages/auth_screen.dart | 2 ++ lib/features/chat/services/chat_service.dart | 4 +-- .../registration_cubit.dart | 3 +++ lib/main.dart | 3 ++- 7 files changed, 38 insertions(+), 18 deletions(-) diff --git a/lib/core/app_router.dart b/lib/core/app_router.dart index 9dc8612f..ee0278c8 100644 --- a/lib/core/app_router.dart +++ b/lib/core/app_router.dart @@ -121,7 +121,9 @@ class AppRouter { GoRoute( path: 'forget-password-screen', name: 'forgetPasswordScreen', - builder: (context, state) => ForgetPasswordScreen(isAuth: state.extra as bool,), + builder: (context, state) => ForgetPasswordScreen( + isAuth: state.extra as bool, + ), ), GoRoute( path: 'scan-qr-code-screen', @@ -205,21 +207,9 @@ class AppRouter { builder: (context, state) => const WelcomeScreen(), redirect: (context, state) async { try { - if (await TokenStorage.haveTokenInStorage()) { - final firebaseApi = sl(); - final fbToken = await firebaseApi.getToken(); - final deviceInfo = DeviceInfoPlugin(); - await sl().post( - '/api/profile/notification/token/register', - data: { - 'platform': Platform.isIOS ? 'ios' : 'android', - 'hw_id': Platform.isIOS ? (await deviceInfo.iosInfo).identifierForVendor : (await deviceInfo.androidInfo).id, - 'token': fbToken, - }, - ); - } final sharedPreferences = await SharedPreferences.getInstance(); final welcomeScreenWasShowed = sharedPreferences.getBool('welcomeScreenWasShowed') ?? false; + await sl().registerPushToken(); if (welcomeScreenWasShowed == false) { return null; } else if (await TokenStorage.haveTokenInStorage()) { diff --git a/lib/core/const.dart b/lib/core/const.dart index 31c47e9c..618a9866 100644 --- a/lib/core/const.dart +++ b/lib/core/const.dart @@ -1,5 +1,4 @@ String baseUrl = 'https://eatvio.ru'; -// String baseUrl = 'https://dev2.eatvio.com'; const List durationValues = [7, 14, 21]; diff --git a/lib/core/firebase_api.dart b/lib/core/firebase_api.dart index fbf8e5c1..572b56f6 100644 --- a/lib/core/firebase_api.dart +++ b/lib/core/firebase_api.dart @@ -1,3 +1,10 @@ +import 'dart:developer'; +import 'dart:io'; + +import 'package:device_info_plus/device_info_plus.dart'; +import 'package:dio/dio.dart'; +import 'package:eatvio_app/core/locator_service.dart'; +import 'package:eatvio_app/core/token_storage.dart'; import 'package:firebase_messaging/firebase_messaging.dart'; class FirebaseApi { @@ -7,4 +14,22 @@ class FirebaseApi { await _firebaseMessaging.requestPermission(); return await _firebaseMessaging.getToken(); } + + Future registerPushToken() async { + if (await TokenStorage.haveTokenInStorage()) { + try { + final deviceInfo = DeviceInfoPlugin(); + await sl().post( + '/api/profile/notification/token/register', + data: { + 'platform': Platform.isIOS ? 'ios' : 'android', + 'hw_id': Platform.isIOS ? (await deviceInfo.iosInfo).identifierForVendor : (await deviceInfo.androidInfo).id, + 'token': await getToken(), + }, + ); + } catch (e, st) { + log(e.toString(), stackTrace: st); + } + } + } } diff --git a/lib/features/auth/presentation/pages/auth_screen.dart b/lib/features/auth/presentation/pages/auth_screen.dart index 10fb4172..f5fd7a34 100644 --- a/lib/features/auth/presentation/pages/auth_screen.dart +++ b/lib/features/auth/presentation/pages/auth_screen.dart @@ -1,6 +1,7 @@ import 'dart:async'; import 'package:eatvio_app/core/app_router.dart'; import 'package:eatvio_app/core/const.dart'; +import 'package:eatvio_app/core/firebase_api.dart'; import 'package:eatvio_app/core/locator_service.dart'; import 'package:eatvio_app/core/theme/theme_helper.dart'; import 'package:eatvio_app/core/utils/image_constant.dart'; @@ -66,6 +67,7 @@ class _AuthScreenState extends State { await sl().connectToWebSocket(); await sl().getNotifications(); await sl().connectToWebSocket(); + await sl().registerPushToken(); showSuccessToast('Успешный вход'); } catch (e) { rethrow; diff --git a/lib/features/chat/services/chat_service.dart b/lib/features/chat/services/chat_service.dart index dee63eab..cceaa9d0 100644 --- a/lib/features/chat/services/chat_service.dart +++ b/lib/features/chat/services/chat_service.dart @@ -16,7 +16,7 @@ abstract class ChatService { @GET('/api/chat/index') Future getChatRooms({ @Query('page') required int page, - @Query('find') String? query, + @Query('filters[data][\$conversation_name]') String? query, }); @GET('/api/chat/show/{uuid}') @@ -82,7 +82,7 @@ abstract class ChatService { @Body() required PlanComplainModel body, }); - @GET('/api/v2/chat/get_by_user/{slug}') + @GET('/api/chat/get_by_user/{slug}') Future getChatByUserSlug({ @Path() required String slug, }); 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 83592c3b..fa2948bc 100644 --- a/lib/features/registration/presentation/bloc/registration_cubit/registration_cubit.dart +++ b/lib/features/registration/presentation/bloc/registration_cubit/registration_cubit.dart @@ -1,6 +1,8 @@ import 'dart:developer'; import 'package:eatvio_app/core/app_router.dart'; +import 'package:eatvio_app/core/firebase_api.dart'; +import 'package:eatvio_app/core/locator_service.dart'; import 'package:eatvio_app/core/token_storage.dart'; import 'package:eatvio_app/features/registration/models/user_registration_model.dart'; @@ -59,6 +61,7 @@ class RegistrationCubit extends Cubit { ); await TokenStorage.saveTokenInStorage(token); AppRouter.navigatorKey.currentContext?.pushNamed('verifyEmailScreen'); + await sl().registerPushToken(); } catch (e, st) { log(e.toString(), stackTrace: st); } diff --git a/lib/main.dart b/lib/main.dart index 005afaac..3fd39e7f 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -11,6 +11,7 @@ import 'package:eatvio_app/features/internet_connection_checker/internet_connect import 'package:eatvio_app/firebase_options.dart'; import 'package:eatvio_app/generated/l10n.dart'; import 'package:firebase_core/firebase_core.dart'; +import 'package:firebase_messaging/firebase_messaging.dart'; import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_localizations/flutter_localizations.dart'; @@ -22,8 +23,8 @@ import 'package:sentry_flutter/sentry_flutter.dart'; Future main() async { WidgetsBinding widgetsBinding = SentryWidgetsFlutterBinding.ensureInitialized(); FlutterNativeSplash.preserve(widgetsBinding: widgetsBinding); - await Firebase.initializeApp(options: DefaultFirebaseOptions.currentPlatform); + await FirebaseMessaging.instance.requestPermission(); await di.init(); await SentryFlutter.init( From 2c38be9fa4d7fc6741645dbd4cf47ceac035d0ca Mon Sep 17 00:00:00 2001 From: mso7nueh Date: Mon, 14 Jul 2025 14:49:33 +0300 Subject: [PATCH 2/7] fix(diary): current plan day --- .../diary/presentation/bloc/diary_cubit.dart | 29 +++++++++---------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/lib/features/diary/presentation/bloc/diary_cubit.dart b/lib/features/diary/presentation/bloc/diary_cubit.dart index c973bcaa..45394cbe 100644 --- a/lib/features/diary/presentation/bloc/diary_cubit.dart +++ b/lib/features/diary/presentation/bloc/diary_cubit.dart @@ -183,7 +183,7 @@ class DiaryCubit extends Cubit { final chosenPlanModel = await chatRepository.getChosenPlan(id: diaryDay.chosenPlanId!); planDuration = chosenPlanModel.plan.duration; planName = chosenPlanModel.plan.name; - currentPlanDay = currentDay ?? DateTime.now().difference(chosenPlanModel.startDate).inDays + 1; + currentPlanDay = consultantReview.currentPlanDay; } final nutrition = await getNutrition(diaryDay.id); @@ -194,20 +194,19 @@ class DiaryCubit extends Cubit { diaryDay.typeOfDiary.diaryState == DiaryStateEnum.reviewedByUser; emit( DiaryState.loaded( - diary: diaryDay, - nutrition: nutrition, - selectedDay: selectedDay, - selectedMeal: selectedMeal, - isConsultantView: this.diaryId != null, - consultantReview: consultantReview, - isDiaryFinished: isDiaryFinished, - isDiaryCommented: isDiaryCommented, - chosenPlanCurrentDay: currentPlanDay, - chosenPlanDuration: planDuration, - chosenPlanName: planName, - isMoodEnabled: isMoodEnabled, - isWakeUpAndRetireEnabled: isWakeUpAndRetireTimeEnabled - ), + diary: diaryDay, + nutrition: nutrition, + selectedDay: selectedDay, + selectedMeal: selectedMeal, + isConsultantView: this.diaryId != null, + consultantReview: consultantReview, + isDiaryFinished: isDiaryFinished, + isDiaryCommented: isDiaryCommented, + chosenPlanCurrentDay: currentPlanDay, + chosenPlanDuration: planDuration, + chosenPlanName: planName, + isMoodEnabled: isMoodEnabled, + isWakeUpAndRetireEnabled: isWakeUpAndRetireTimeEnabled), ); } catch (e, st) { log(e.toString(), stackTrace: st); From 6bcd540d546d37e0a9d7e2d90ef2be545edcbd61 Mon Sep 17 00:00:00 2001 From: mso7nueh Date: Mon, 14 Jul 2025 15:16:11 +0300 Subject: [PATCH 3/7] fix: analyzer --- lib/core/app_router.dart | 2 -- lib/features/chat/models/chat_room_model.dart | 6 +----- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/lib/core/app_router.dart b/lib/core/app_router.dart index ee0278c8..0654a961 100644 --- a/lib/core/app_router.dart +++ b/lib/core/app_router.dart @@ -1,5 +1,3 @@ -import 'dart:io'; -import 'package:device_info_plus/device_info_plus.dart'; import 'package:dio/dio.dart'; import 'package:eatvio_app/core/const.dart'; import 'package:eatvio_app/core/firebase_api.dart'; diff --git a/lib/features/chat/models/chat_room_model.dart b/lib/features/chat/models/chat_room_model.dart index dc091ea6..c5ee559f 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, @@ -22,13 +22,9 @@ abstract class ChatRoomModel with _$ChatRoomModel { @freezed abstract class Users with _$Users { const factory Users({ - @JsonKey(name: 'from_chat_user') required ChatUserModel sender, @JsonKey(name: 'to_chat_user') required ChatUserModel receiver, - }) = _Users; factory Users.fromJson(Map json) => _$UsersFromJson(json); } - - From 452c603b95cbebed0eeccd83000175019ab4dacf Mon Sep 17 00:00:00 2001 From: mso7nueh Date: Mon, 14 Jul 2025 15:59:43 +0300 Subject: [PATCH 4/7] feat: diary comments view --- lib/features/diary/repositories/diary_repository.dart | 1 + lib/features/diary/services/diary_service.dart | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/lib/features/diary/repositories/diary_repository.dart b/lib/features/diary/repositories/diary_repository.dart index e807e3d0..14a9576b 100644 --- a/lib/features/diary/repositories/diary_repository.dart +++ b/lib/features/diary/repositories/diary_repository.dart @@ -292,6 +292,7 @@ class DiaryRepository { required int diaryId, }) async { try { + await diaryService.viewCommentOfDiaryDayByConsultant(diaryId: diaryId); return await diaryService.getDiaryComments(planId: planId, diaryId: diaryId); } catch (e) { rethrow; diff --git a/lib/features/diary/services/diary_service.dart b/lib/features/diary/services/diary_service.dart index bb6672d3..d9967200 100644 --- a/lib/features/diary/services/diary_service.dart +++ b/lib/features/diary/services/diary_service.dart @@ -150,4 +150,9 @@ abstract class DiaryService { @Path() required int planId, @Path() required int diaryId, }); + + @POST('/api/diary/{diaryId}/consultant/comment/view') + Future viewCommentOfDiaryDayByConsultant({ + @Path() required int diaryId, + }); } From 09c53a64928605d67e6b5886c93c56c88c20bb01 Mon Sep 17 00:00:00 2001 From: mso7nueh Date: Mon, 14 Jul 2025 17:08:53 +0300 Subject: [PATCH 5/7] feat(notificaion): add notificaion for last day --- lib/features/chat/services/chat_service.dart | 10 ++++---- .../models/notification_model.dart | 24 +++++++++++++++++-- .../notifications_cubit.dart | 1 + .../widgets/notification_widget.dart | 1 + .../service/notifications_service.dart | 5 ++++ 5 files changed, 34 insertions(+), 7 deletions(-) diff --git a/lib/features/chat/services/chat_service.dart b/lib/features/chat/services/chat_service.dart index cceaa9d0..89d65749 100644 --- a/lib/features/chat/services/chat_service.dart +++ b/lib/features/chat/services/chat_service.dart @@ -13,18 +13,18 @@ part 'chat_service.g.dart'; abstract class ChatService { factory ChatService(Dio dio, {String baseUrl}) = _ChatService; - @GET('/api/chat/index') + @GET('/api/v2/chat/index') Future getChatRooms({ @Query('page') required int page, @Query('filters[data][\$conversation_name]') String? query, }); - @GET('/api/chat/show/{uuid}') + @GET('/api/v2/chat/show/{uuid}') Future getChatRoom({ @Path() required String uuid, }); - @POST('/api/chat/message/send/{slug}') + @POST('/api/v2/chat/message/send/{slug}') @MultiPart() Future sendMessage({ @Header('X-Socket-ID') required String socketId, @@ -33,13 +33,13 @@ abstract class ChatService { @Part(name: 'media_data[]', contentType: 'multipart/form-data') List? mediaData, }); - @GET('/api/chat/show/{id}/messages?page={page}') + @GET('/api/v2/chat/show/{id}/messages?page={page}') Future getChatMessages({ @Path() required String id, @Path() required int page, }); - @GET('/api/chat/get_by_user/{user}') + @GET('/api/v2/chat/get_by_user/{user}') Future getChatRoomIdByUserSlug({ @Path() required String user, }); diff --git a/lib/features/notifications/models/notification_model.dart b/lib/features/notifications/models/notification_model.dart index e8489a5a..827a0904 100644 --- a/lib/features/notifications/models/notification_model.dart +++ b/lib/features/notifications/models/notification_model.dart @@ -106,8 +106,7 @@ class DiaryReminderNotification implements BaseNotificationModel { final NotificationType type; @override final bool isRead; - - + DiaryReminderNotification({required this.type, required this.isRead}); factory DiaryReminderNotification.fromJson(Map json, NotificationType type, {bool? isRead}) { @@ -297,6 +296,25 @@ class ChosenPlanFinishedToConsultantNotification implements BaseNotificationMode } } +class ChosenPlanLastDayFinishedForUser implements BaseNotificationModel { + @override + final NotificationType type; + @override + final bool isRead; + + ChosenPlanLastDayFinishedForUser({ + required this.type, + required this.isRead, + }); + + factory ChosenPlanLastDayFinishedForUser.fromJson(Map json, NotificationType type, {bool? isRead}) { + return ChosenPlanLastDayFinishedForUser( + type: type, + isRead: isRead ?? false, + ); + } +} + class UnknownNotification implements BaseNotificationModel { @override final NotificationType type; @@ -323,6 +341,7 @@ enum NotificationType { chosenPlanTomorrowReminderToConsultantNotification, planSubscriptionPaidToAuthor, chosenPlanFinishedToConsultant, + chosenPlanLastDayFinishedForUser, unknown; static NotificationType getTypeFromString(String type) => switch (type) { @@ -339,6 +358,7 @@ enum NotificationType { 'App\\Notifications\\Plan\\ChosenPlanTomorrowReminderToConsultantNotification' => NotificationType.chosenPlanTomorrowReminderToConsultantNotification, 'App\\Notifications\\Plan\\PlanSubscriptionPaidToAuthor' => NotificationType.planSubscriptionPaidToAuthor, 'App\\Notifications\\Plan\\ChosenPlanFinishedToConsultant' => NotificationType.chosenPlanFinishedToConsultant, + 'App\\Notifications\\ChosenPlan\\LastDayFinishedForUser' => NotificationType.chosenPlanLastDayFinishedForUser, _ => NotificationType.unknown, }; } diff --git a/lib/features/notifications/presentation/notifications_cubit/notifications_cubit.dart b/lib/features/notifications/presentation/notifications_cubit/notifications_cubit.dart index 16cf1f40..61eba9a7 100644 --- a/lib/features/notifications/presentation/notifications_cubit/notifications_cubit.dart +++ b/lib/features/notifications/presentation/notifications_cubit/notifications_cubit.dart @@ -42,6 +42,7 @@ class NotificationsCubit extends Cubit { ChosenPlanTomorrowReminderToConsultantNotification.fromJson(notificationJson, type), NotificationType.planSubscriptionPaidToAuthor => PlanSubscriptionPaidToAuthorNotification.fromJson(notificationJson, type), NotificationType.chosenPlanFinishedToConsultant => ChosenPlanFinishedToConsultantNotification.fromJson(notificationJson, type), + NotificationType.chosenPlanLastDayFinishedForUser => ChosenPlanLastDayFinishedForUser.fromJson(notificationJson, type), NotificationType.unknown => UnknownNotification(type: type), }; } catch (e) { diff --git a/lib/features/notifications/presentation/widgets/notification_widget.dart b/lib/features/notifications/presentation/widgets/notification_widget.dart index 83157593..66b6cf18 100644 --- a/lib/features/notifications/presentation/widgets/notification_widget.dart +++ b/lib/features/notifications/presentation/widgets/notification_widget.dart @@ -53,6 +53,7 @@ class NotificationWidget extends StatelessWidget { ChosenPlanFinishedToConsultantNotification() => _ChosenPlanFinishedToConsultantWidget( notification: notification as ChosenPlanFinishedToConsultantNotification, ), + ChosenPlanLastDayFinishedForUser() => Text((notification as ChosenPlanLastDayFinishedForUser).type.toString()), UnknownNotification() => const SizedBox.shrink(), }; } diff --git a/lib/features/notifications/service/notifications_service.dart b/lib/features/notifications/service/notifications_service.dart index 860aab55..ec2aad74 100644 --- a/lib/features/notifications/service/notifications_service.dart +++ b/lib/features/notifications/service/notifications_service.dart @@ -40,6 +40,11 @@ class NotificationsService { PlanSubscriptionPaidToAuthorNotification.fromJson(notificationJson['data'], type, isRead: readDate != null), NotificationType.chosenPlanFinishedToConsultant => ChosenPlanFinishedToConsultantNotification.fromJson(notificationJson['data'], type, isRead: readDate != null), + NotificationType.chosenPlanLastDayFinishedForUser => ChosenPlanLastDayFinishedForUser.fromJson( + notificationJson['data'], + type, + isRead: readDate != null, + ), NotificationType.unknown => UnknownNotification(type: type), }; } catch (e) { From 3e2aff3ad4d4beb1e384b15cd82ac1daa987ba66 Mon Sep 17 00:00:00 2001 From: mso7nueh Date: Tue, 15 Jul 2025 13:47:00 +0300 Subject: [PATCH 6/7] fix(chat): model fields --- ios/Runner.xcodeproj/project.pbxproj | 6 +++--- ios/Runner/Info.plist | 2 +- lib/features/chat/models/chat_room_settings_model.dart | 2 +- .../presentation/bloc/chat_room_cubit/chat_room_cubit.dart | 1 + lib/features/chat/repositories/chat_repository.dart | 3 ++- pubspec.yaml | 2 +- 6 files changed, 9 insertions(+), 7 deletions(-) diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index d2269b71..dc837658 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 = 52; + CURRENT_PROJECT_VERSION = 53; 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 = 52; + CURRENT_PROJECT_VERSION = 53; 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 = 52; + CURRENT_PROJECT_VERSION = 53; DEVELOPMENT_TEAM = VL68C36HYS; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( diff --git a/ios/Runner/Info.plist b/ios/Runner/Info.plist index 6de3b03b..fcaddf14 100644 --- a/ios/Runner/Info.plist +++ b/ios/Runner/Info.plist @@ -21,7 +21,7 @@ CFBundleSignature ???? CFBundleVersion - 52 + 53 ITSAppUsesNonExemptEncryption LSRequiresIPhoneOS diff --git a/lib/features/chat/models/chat_room_settings_model.dart b/lib/features/chat/models/chat_room_settings_model.dart index fa332843..737d0c82 100644 --- a/lib/features/chat/models/chat_room_settings_model.dart +++ b/lib/features/chat/models/chat_room_settings_model.dart @@ -6,7 +6,7 @@ part 'chat_room_settings_model.g.dart'; @freezed abstract class ChatRoomSettingsModel with _$ChatRoomSettingsModel { const factory ChatRoomSettingsModel({ - required String name, + @JsonKey(name: 'room_name') required String name, required String state, }) = _ChatRoomSettingsModel; 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 f4c95d12..c4d8ed45 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 @@ -223,6 +223,7 @@ class ChatRoomCubit extends Cubit { files: compressedFiles, slug: userSlug, ); + sl().getChatRooms(); return true; } catch (e, st) { log(e.toString(), stackTrace: st); diff --git a/lib/features/chat/repositories/chat_repository.dart b/lib/features/chat/repositories/chat_repository.dart index d682c9a0..b1961b2a 100644 --- a/lib/features/chat/repositories/chat_repository.dart +++ b/lib/features/chat/repositories/chat_repository.dart @@ -63,7 +63,8 @@ class ChatRepository { Future getChatRoom(String uuid) async { try { return (await chatService.getChatRoom(uuid: uuid)); - } catch (e) { + } catch (e, st) { + log(e.toString(), stackTrace: st); rethrow; } } diff --git a/pubspec.yaml b/pubspec.yaml index 74b00964..4223ded7 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: eatvio_app description: A new Flutter project. -version: 1.2.2+52 +version: 1.2.4+54 publish_to: 'none' environment: From 46f11a8e786521a9a5f1f3b0a5d17a0b19998dd7 Mon Sep 17 00:00:00 2001 From: mso7nueh Date: Wed, 16 Jul 2025 12:19:29 +0300 Subject: [PATCH 7/7] fix(chat): photo view --- .../chat/presentation/pages/photo_view_screen.dart | 14 ++++++-------- .../presentation/widgets/chat_bubble_widget.dart | 2 +- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/lib/features/chat/presentation/pages/photo_view_screen.dart b/lib/features/chat/presentation/pages/photo_view_screen.dart index 260c051d..886b815a 100644 --- a/lib/features/chat/presentation/pages/photo_view_screen.dart +++ b/lib/features/chat/presentation/pages/photo_view_screen.dart @@ -11,7 +11,7 @@ import 'package:photo_view/photo_view_gallery.dart'; import 'package:url_launcher/url_launcher.dart'; class PhotoViewScreen extends StatefulWidget { - final List imageUrls; + final List imageUrls; final int index; final bool isLocal; @@ -50,14 +50,12 @@ class _PhotoViewScreenState extends State { ), scrollPhysics: const BouncingScrollPhysics(), builder: (BuildContext context, int index) { + final imageProvider = widget.isLocal + ? FileImage(widget.imageUrls[index]) as ImageProvider + : CachedNetworkImageProvider(widget.imageUrls[index]) as ImageProvider; + return PhotoViewGalleryPageOptions( - imageProvider: widget.isLocal - ? FileImage( - File(widget.imageUrls[index]), - ) as ImageProvider - : CachedNetworkImageProvider( - widget.imageUrls[index], - ), + imageProvider: imageProvider, initialScale: PhotoViewComputedScale.contained, minScale: PhotoViewComputedScale.contained, heroAttributes: PhotoViewHeroAttributes( diff --git a/lib/features/chat/presentation/widgets/chat_bubble_widget.dart b/lib/features/chat/presentation/widgets/chat_bubble_widget.dart index d2f5f1bd..60a31c44 100644 --- a/lib/features/chat/presentation/widgets/chat_bubble_widget.dart +++ b/lib/features/chat/presentation/widgets/chat_bubble_widget.dart @@ -110,7 +110,7 @@ class ChatBubbleWidget extends StatelessWidget { onTap: () { context.pushTransparentRoute( PhotoViewScreen( - imageUrls: mediaData.map((e) => '$e').toList(), + imageUrls: mediaData, index: index, isLocal: mediaData[index] is File ? true : false, ),