From 0581da038a108255c181144ba3df33838a55d5fb Mon Sep 17 00:00:00 2001 From: mso7nueh Date: Mon, 16 Jun 2025 17:33:17 +0300 Subject: [PATCH 1/3] feat(chat): Issue-440 add photo/file picker, fix black screen --- lib/core/app_router.dart | 36 +++--- .../chat/presentation/pages/chat_screen.dart | 107 +++++++++++++----- .../feed/presentation/pages/feed_screen.dart | 2 + .../internet_connection_checker_screen.dart | 2 + lib/main.dart | 1 - 5 files changed, 102 insertions(+), 46 deletions(-) diff --git a/lib/core/app_router.dart b/lib/core/app_router.dart index 0bd17c58..7291ed95 100644 --- a/lib/core/app_router.dart +++ b/lib/core/app_router.dart @@ -166,7 +166,7 @@ class AppRouter { await sl().post( '/api/profile/notification/token/register', data: { - 'platform': Platform.isIOS ? 'ios': 'android', + 'platform': Platform.isIOS ? 'ios' : 'android', 'hw_id': Platform.isIOS ? (await deviceInfo.iosInfo).identifierForVendor : (await deviceInfo.androidInfo).id, 'token': fbToken, }, @@ -175,12 +175,16 @@ class AppRouter { } catch (e) { rethrow; } - final sharedPreferences = await SharedPreferences.getInstance(); - final welcomeScreenWasShowed = sharedPreferences.getBool('welcomeScreenWasShowed'); - if (welcomeScreenWasShowed == true) { + try { + final sharedPreferences = await SharedPreferences.getInstance(); + final welcomeScreenWasShowed = sharedPreferences.getBool('welcomeScreenWasShowed'); + if (welcomeScreenWasShowed == true) { + return '/feed-screen'; + } else { + return null; + } + } catch (e) { return '/feed-screen'; - } else { - return null; } }, ), @@ -189,14 +193,18 @@ class AppRouter { name: 'updateScreen', builder: (context, state) => const UpdateScreen(), redirect: (context, state) async { - final versions = (await sl().get('$baseUrl/api/app_versions')).data; - PackageInfo packageInfo = await PackageInfo.fromPlatform(); - String version = packageInfo.version; - Version currentVersion = Version.parse(version); - Version latestVersion = Version.parse(versions['min_version']); - if (latestVersion > currentVersion) { - return null; - } else { + try { + final versions = (await sl().get('$baseUrl/api/app_versions')).data; + PackageInfo packageInfo = await PackageInfo.fromPlatform(); + String version = packageInfo.version; + Version currentVersion = Version.parse(version); + Version latestVersion = Version.parse(versions['min_version']); + if (latestVersion > currentVersion) { + return null; + } else { + return '/welcome-screen'; + } + } catch (e) { return '/welcome-screen'; } }, diff --git a/lib/features/chat/presentation/pages/chat_screen.dart b/lib/features/chat/presentation/pages/chat_screen.dart index 5ec98c6c..3f7f1cdd 100644 --- a/lib/features/chat/presentation/pages/chat_screen.dart +++ b/lib/features/chat/presentation/pages/chat_screen.dart @@ -21,15 +21,18 @@ import 'package:eatvio_app/features/plans/enums/chosen_plan_state_enum.dart'; import 'package:eatvio_app/features/user_details/presentation/user_details_screen.dart'; import 'package:eatvio_app/generated/l10n.dart'; import 'package:file_picker/file_picker.dart'; +import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:go_router/go_router.dart'; +import 'package:image_picker/image_picker.dart'; import 'package:intl/intl.dart'; import 'package:visibility_detector/visibility_detector.dart'; class ChatScreen extends StatefulWidget { final String chatId; final bool? sendInitialMessage; + const ChatScreen({required this.chatId, super.key, required this.sendInitialMessage}); @override @@ -338,37 +341,7 @@ class _ChatScreenState extends State { children: [ const SizedBox(width: 8), InkWell( - onTap: () async { - FilePickerResult? result = await FilePicker.platform.pickFiles( - allowMultiple: true, - type: FileType.custom, - allowedExtensions: [ - 'pdf', - 'doc', - 'docx', - 'json', - 'ppt', - 'pptx', - 'rtf', - 'txt', - 'xls', - 'xlsx', - 'csv', - 'jpeg', - 'jpg', - 'png', - 'gif', - 'svg', - 'xml', - 'webp', - ], - ); - - if (result != null) { - List files = result.paths.map((path) => File(path!)).toList(); - await chatRoomCubit.sendMessage(chatId: widget.chatId, files: files); - } - }, + onTap: () => showImagePicker(), customBorder: const CircleBorder(), child: Ink( height: 40, @@ -448,6 +421,78 @@ class _ChatScreenState extends State { ); } + showImagePicker() { + showCupertinoModalPopup( + context: context, + builder: (context) => CupertinoActionSheet( + actions: [ + CupertinoActionSheetAction( + onPressed: () async { + Navigator.of(context).pop(); + final picker = ImagePicker(); + XFile? image = await picker.pickImage(source: ImageSource.camera); + if (image != null) { + await chatRoomCubit.sendMessage(chatId: widget.chatId, files: [File(image.path)]); + } + }, + child: const Row( + children: [ + Icon(Icons.photo_camera), + SizedBox(width: 8), + Text('Фото'), + ], + ), + ), + CupertinoActionSheetAction( + onPressed: () async { + Navigator.of(context).pop(); + FilePickerResult? result = await FilePicker.platform.pickFiles( + allowMultiple: true, + type: FileType.custom, + allowedExtensions: [ + 'pdf', + 'doc', + 'docx', + 'json', + 'ppt', + 'pptx', + 'rtf', + 'txt', + 'xls', + 'xlsx', + 'csv', + 'jpeg', + 'jpg', + 'png', + 'gif', + 'svg', + 'xml', + 'webp', + ], + ); + if (result != null) { + List files = result.paths.map((path) => File(path!)).toList(); + await chatRoomCubit.sendMessage(chatId: widget.chatId, files: files); + } + }, + child: const Row( + children: [ + Icon(Icons.file_present_rounded), + SizedBox(width: 8), + Text('Файлы'), + ], + ), + ), + ], + cancelButton: CupertinoActionSheetAction( + onPressed: () => Navigator.of(context).pop(), + isDestructiveAction: true, + child: const Text('Отмена'), + ), + ), + ); + } + _messageDate(DateTime date) { return Center( child: Padding( diff --git a/lib/features/feed/presentation/pages/feed_screen.dart b/lib/features/feed/presentation/pages/feed_screen.dart index 0fb3cc3d..a18cb9a7 100644 --- a/lib/features/feed/presentation/pages/feed_screen.dart +++ b/lib/features/feed/presentation/pages/feed_screen.dart @@ -21,6 +21,7 @@ import 'package:eatvio_app/core/theme/theme_helper.dart'; import 'package:eatvio_app/features/create_recipe/presentation/pages/recipe_create_screen.dart'; import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; +import 'package:flutter_native_splash/flutter_native_splash.dart'; import 'package:go_router/go_router.dart'; import '../widgets/recipes.dart'; @@ -100,6 +101,7 @@ class _FeedScreenContentState extends State { @override Widget build(BuildContext context) { + FlutterNativeSplash.remove(); return Scaffold( floatingActionButton: _selectedChipIndex == 1 ? FloatingActionButton.small( diff --git a/lib/features/internet_connection_checker/internet_connection_checker_screen.dart b/lib/features/internet_connection_checker/internet_connection_checker_screen.dart index 0f7f6e2c..3aa1bc34 100644 --- a/lib/features/internet_connection_checker/internet_connection_checker_screen.dart +++ b/lib/features/internet_connection_checker/internet_connection_checker_screen.dart @@ -7,6 +7,7 @@ import 'package:eatvio_app/core/theme/theme_helper.dart'; import 'package:eatvio_app/core/widgets/custom_outlined_button.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; +import 'package:flutter_native_splash/flutter_native_splash.dart'; import 'package:flutter_svg/svg.dart'; import 'package:http/http.dart' as http; @@ -116,6 +117,7 @@ class NoInternetScreen extends StatelessWidget { final Future Function() onTryAgain; @override Widget build(BuildContext context) { + FlutterNativeSplash.remove(); return Scaffold( body: Column( children: [ diff --git a/lib/main.dart b/lib/main.dart index d7d37793..1616d9eb 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -28,7 +28,6 @@ Future main() async { options.dsn = 'http://ba7f2653067776f3034e6e89850e85a1@sentry.md-desk.ru:9000/2'; options.tracesSampleRate = 1.0; }, appRunner: () => runApp(const MyApp())); - FlutterNativeSplash.remove(); } class MyApp extends StatelessWidget { From ca296040f2e7e821f9b2911e95b7886308f5a631 Mon Sep 17 00:00:00 2001 From: mso7nueh Date: Wed, 18 Jun 2025 09:55:33 +0300 Subject: [PATCH 2/3] fix: Issue-514 and Issue-497 --- .../repositories/service_repository.dart | 32 +++++++++++++++++++ .../settings/services/settings_service.dart | 10 ++++++ .../presentation/update_screen.dart | 2 ++ .../presentation/pages/welcome_screen.dart | 2 ++ 4 files changed, 46 insertions(+) diff --git a/lib/features/settings/repositories/service_repository.dart b/lib/features/settings/repositories/service_repository.dart index eb462de3..e1e71f09 100644 --- a/lib/features/settings/repositories/service_repository.dart +++ b/lib/features/settings/repositories/service_repository.dart @@ -38,4 +38,36 @@ class SettingsRepository { rethrow; } } + + Future sendEmailCodeForPasswordChange(String email) async { + try { + return await settingsService.sendEmailCodeForPasswordChange( + data: { + 'email': email, + }, + ); + } catch (e) { + rethrow; + } + } + + Future confirmPasswordChange( + String code, + String password, + String passwordConfirmation, + String email, + ) async { + try { + return await settingsService.confirmPasswordChange( + data: { + 'code': code, + 'password': password, + 'password_confirmation': passwordConfirmation, + 'email': email, + }, + ); + } catch (e) { + rethrow; + } + } } diff --git a/lib/features/settings/services/settings_service.dart b/lib/features/settings/services/settings_service.dart index d17b5842..e4cdb6b7 100644 --- a/lib/features/settings/services/settings_service.dart +++ b/lib/features/settings/services/settings_service.dart @@ -21,4 +21,14 @@ abstract class SettingsService { Future updateProfileDetails({ @Body() required Map data, }); + + @POST('/api/send_password_reset_code') + Future sendEmailCodeForPasswordChange({ + @Body() required Map data, + }); + + @POST('/api/confirm_password_reset_code') + Future confirmPasswordChange({ + @Body() required Map data, + }); } diff --git a/lib/features/update_screen/presentation/update_screen.dart b/lib/features/update_screen/presentation/update_screen.dart index 99e9e880..186987c2 100644 --- a/lib/features/update_screen/presentation/update_screen.dart +++ b/lib/features/update_screen/presentation/update_screen.dart @@ -1,6 +1,7 @@ import 'dart:io'; import 'package:flutter/material.dart'; +import 'package:flutter_native_splash/flutter_native_splash.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:url_launcher/url_launcher.dart'; @@ -11,6 +12,7 @@ class UpdateScreen extends StatelessWidget { @override Widget build(BuildContext context) { + FlutterNativeSplash.remove(); return Scaffold( body: Stack( clipBehavior: Clip.none, diff --git a/lib/features/welcome/presentation/pages/welcome_screen.dart b/lib/features/welcome/presentation/pages/welcome_screen.dart index 70a5904e..25922a10 100644 --- a/lib/features/welcome/presentation/pages/welcome_screen.dart +++ b/lib/features/welcome/presentation/pages/welcome_screen.dart @@ -4,6 +4,7 @@ import 'package:go_router/go_router.dart'; import 'package:shared_preferences/shared_preferences.dart'; import '../../../../core/theme/theme_helper.dart'; +import 'package:flutter_native_splash/flutter_native_splash.dart'; class WelcomeScreen extends StatefulWidget { const WelcomeScreen({super.key}); @@ -23,6 +24,7 @@ class _WelcomeScreenState extends State { @override Widget build(BuildContext context) { + FlutterNativeSplash.remove(); return Scaffold( body: Stack( clipBehavior: Clip.none, From 7682859d3208fd5eede01a9d3720f2d4b0538842 Mon Sep 17 00:00:00 2001 From: mso7nueh Date: Wed, 18 Jun 2025 16:56:42 +0300 Subject: [PATCH 3/3] fix: Issue-514 BlackScreens + info for apple --- android/app/src/main/AndroidManifest.xml | 1 + ios/Runner.xcodeproj/project.pbxproj | 6 +- ios/Runner/Info.plist | 4 +- lib/core/app_router.dart | 15 +- .../auth/presentation/pages/auth_screen.dart | 24 ++- .../widgets/bottom_navigation_bar_widget.dart | 4 +- .../widgets/blog_post_widget.dart | 144 +++++++++--------- .../presentation/widgets/comments_widget.dart | 6 +- .../presentation/pages/profile_screen.dart | 9 +- .../widgets/profile_blog_post_widget.dart | 7 +- .../presentation/pages/welcome_screen.dart | 10 +- lib/main.dart | 16 +- pubspec.yaml | 2 +- 13 files changed, 138 insertions(+), 110 deletions(-) diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index c7878e41..d8c4ec86 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -5,6 +5,7 @@ CFBundleSignature ???? CFBundleVersion - 27 + 28 ITSAppUsesNonExemptEncryption LSRequiresIPhoneOS @@ -31,6 +31,8 @@ NSAllowsArbitraryLoads + NSAppleMusicUsageDescription + This permission is not needed by the app, but it is required by an underlying API. If you see this dialog, contact us. NSCameraUsageDescription Предоставление доступа позволит Вам делать фотографии и добавлять к записям NSLocationWhenInUseUsageDescription diff --git a/lib/core/app_router.dart b/lib/core/app_router.dart index 7291ed95..d8da4a42 100644 --- a/lib/core/app_router.dart +++ b/lib/core/app_router.dart @@ -158,6 +158,7 @@ class AppRouter { name: 'welcomeScreen', builder: (context, state) => const WelcomeScreen(), redirect: (context, state) async { + try { if (await TokenStorage.haveTokenInStorage()) { final firebaseApi = sl(); @@ -172,19 +173,17 @@ class AppRouter { }, ); } - } catch (e) { - rethrow; - } - try { final sharedPreferences = await SharedPreferences.getInstance(); - final welcomeScreenWasShowed = sharedPreferences.getBool('welcomeScreenWasShowed'); - if (welcomeScreenWasShowed == true) { + final welcomeScreenWasShowed = sharedPreferences.getBool('welcomeScreenWasShowed') ?? false; + if (welcomeScreenWasShowed == false) { + return null; + } else if (await TokenStorage.haveTokenInStorage()) { return '/feed-screen'; } else { - return null; + return '/auth-screen'; } } catch (e) { - return '/feed-screen'; + rethrow; } }, ), diff --git a/lib/features/auth/presentation/pages/auth_screen.dart b/lib/features/auth/presentation/pages/auth_screen.dart index 5455d5fd..179e0974 100644 --- a/lib/features/auth/presentation/pages/auth_screen.dart +++ b/lib/features/auth/presentation/pages/auth_screen.dart @@ -52,15 +52,23 @@ class _AuthScreenState extends State { } Future _reconnectWebSocket(BuildContext context) async { - await sl().clear(); - await sl().initialize(); + try { + await sl().clear(); + await sl().initialize(); + } catch (e) { + rethrow; + } if (context.mounted) { - context.read().getMyProfile(); - context.read().getChatRoomsWithLoading(); - context.read().connectToWebSocket(); - context.read().getNotifications(); - context.read().connectToWebSocket(); - showSuccessToast('Успешный вход'); + try { + context.read().getMyProfile(); + context.read().getChatRoomsWithLoading(); + context.read().connectToWebSocket(); + context.read().getNotifications(); + context.read().connectToWebSocket(); + showSuccessToast('Успешный вход'); + } catch (e) { + rethrow; + } GoRouter.of(context).go('/feed-screen', extra: {'needToInitializeWebSocket': false}); } } diff --git a/lib/features/bottom_navigation_bar/presentation/widgets/bottom_navigation_bar_widget.dart b/lib/features/bottom_navigation_bar/presentation/widgets/bottom_navigation_bar_widget.dart index 0fae58a6..e370452a 100644 --- a/lib/features/bottom_navigation_bar/presentation/widgets/bottom_navigation_bar_widget.dart +++ b/lib/features/bottom_navigation_bar/presentation/widgets/bottom_navigation_bar_widget.dart @@ -82,7 +82,9 @@ class _BottomNavigationBarWidgetState extends State { BottomNavigationBarItem( label: '', icon: CircleAvatar( - foregroundImage: NetworkImage(baseUrl + widget.profileModel.profilePhotoUrl), + foregroundImage: NetworkImage( + widget.profileModel.profilePhotoUrl.contains('https') ? widget.profileModel.profilePhotoUrl : baseUrl + widget.profileModel.profilePhotoUrl, + ), backgroundImage: const AssetImage('assets/images/no_avatar.png'), radius: 16, ), diff --git a/lib/features/feed/presentation/widgets/blog_post_widget.dart b/lib/features/feed/presentation/widgets/blog_post_widget.dart index bc7faec0..b349f8fa 100644 --- a/lib/features/feed/presentation/widgets/blog_post_widget.dart +++ b/lib/features/feed/presentation/widgets/blog_post_widget.dart @@ -56,81 +56,85 @@ class _BlogPostWidgetState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ const SizedBox(height: 12), - Padding( - padding: const EdgeInsets.symmetric(horizontal: 12), - child: Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - GestureDetector( - onTap: () { - GoRouter.of(context).pushNamed( - 'profileScreen', - extra: Author( - authorSlug: state.feedBlogPostList[widget.index].author.authorSlug, - authorName: state.feedBlogPostList[widget.index].author.authorName, - authorProfileIcon: state.feedBlogPostList[widget.index].author.authorProfileIcon, - authorIsMe: state.feedBlogPostList[widget.index].author.authorIsMe, - ), - ); - }, - child: CircleAvatar( - radius: 20, - backgroundColor: Colors.black12, - foregroundImage: NetworkImage( - baseUrl + state.feedBlogPostList[widget.index].author.authorProfileIcon, - ), - backgroundImage: const AssetImage('assets/images/no_avatar.png'), - ), - ), - const SizedBox(width: 8), - // Имя и дата внутри Expanded - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - state.feedBlogPostList[widget.index].author.authorName, - overflow: TextOverflow.ellipsis, - style: const TextStyle( - height: 1, - color: Colors.black87, - fontWeight: FontWeight.w500, - fontSize: 16, + Padding( + padding: const EdgeInsets.symmetric(horizontal: 12), + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + GestureDetector( + onTap: () { + GoRouter.of(context).pushNamed( + 'profileScreen', + extra: Author( + authorSlug: state.feedBlogPostList[widget.index].author.authorSlug, + authorName: state.feedBlogPostList[widget.index].author.authorName, + authorProfileIcon: state.feedBlogPostList[widget.index].author.authorProfileIcon.contains('https') + ? state.feedBlogPostList[widget.index].author.authorProfileIcon + : baseUrl + state.feedBlogPostList[widget.index].author.authorProfileIcon, + authorIsMe: state.feedBlogPostList[widget.index].author.authorIsMe, ), + ); + }, + child: CircleAvatar( + radius: 20, + backgroundColor: Colors.black12, + foregroundImage: NetworkImage( + state.feedBlogPostList[widget.index].author.authorProfileIcon.contains('https') + ? state.feedBlogPostList[widget.index].author.authorProfileIcon + : baseUrl + state.feedBlogPostList[widget.index].author.authorProfileIcon, ), - const SizedBox(height: 4), - Text( - '${calculateDifference(state.feedBlogPostList[widget.index].createdAt)} в ${state.feedBlogPostList[widget.index].createdAt.hour.toString().padLeft(2, '0')}:${state.feedBlogPostList[widget.index].createdAt.minute.toString().padLeft(2, '0')}', - style: const TextStyle( - height: 1, - color: Colors.black45, - fontSize: 14, - ), - ), - ], - ), - ), - // Кнопка подписки (если нужно) - if (!(state.feedBlogPostList[widget.index].author.isEntitySubscribedByMe ?? false) && - !state.feedBlogPostList[widget.index].author.authorIsMe) - Padding( - padding: const EdgeInsets.only(right: 8), - child: SubscribeButtonWidget( - slug: state.feedBlogPostList[widget.index].author.authorSlug, + backgroundImage: const AssetImage('assets/images/no_avatar.png'), ), ), - // Кнопка меню - CustomPopup( - isAuthor: state.feedBlogPostList[widget.index].author.authorIsMe, - complainedContentType: ComplainedContent.posts, - path: 'blog_post/${(state.feedBlogPostList[widget.index].id)}', - id: state.feedBlogPostList[widget.index].id, - feedBlogPostModel: state.feedBlogPostList[widget.index], - ), - ], + const SizedBox(width: 8), + // Имя и дата внутри Expanded + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + state.feedBlogPostList[widget.index].author.authorName, + overflow: TextOverflow.ellipsis, + style: const TextStyle( + height: 1, + color: Colors.black87, + fontWeight: FontWeight.w500, + fontSize: 16, + ), + ), + const SizedBox(height: 4), + Text( + '${calculateDifference(state.feedBlogPostList[widget.index].createdAt)} в ${state.feedBlogPostList[widget.index].createdAt.hour.toString().padLeft(2, '0')}:${state.feedBlogPostList[widget.index].createdAt.minute.toString().padLeft(2, '0')}', + style: const TextStyle( + height: 1, + color: Colors.black45, + fontSize: 14, + ), + ), + ], + ), + ), + // Кнопка подписки (если нужно) + if (!(state.feedBlogPostList[widget.index].author.isEntitySubscribedByMe ?? false) && + !state.feedBlogPostList[widget.index].author.authorIsMe) + Padding( + padding: const EdgeInsets.only(right: 8), + child: SubscribeButtonWidget( + slug: state.feedBlogPostList[widget.index].author.authorSlug, + ), + ), + // Кнопка меню + CustomPopup( + isAuthor: state.feedBlogPostList[widget.index].author.authorIsMe, + complainedContentType: ComplainedContent.posts, + path: 'blog_post/${(state.feedBlogPostList[widget.index].id)}', + id: state.feedBlogPostList[widget.index].id, + feedBlogPostModel: state.feedBlogPostList[widget.index], + ), + ], + ), ), - ), - if (state.feedBlogPostList[widget.index].title.isNotEmpty) ...[ + if (state.feedBlogPostList[widget.index].title.isNotEmpty) ...[ const SizedBox(height: 12), Padding( padding: const EdgeInsets.symmetric(horizontal: 12), diff --git a/lib/features/feed/presentation/widgets/comments_widget.dart b/lib/features/feed/presentation/widgets/comments_widget.dart index 16f52f90..1e1a90d5 100644 --- a/lib/features/feed/presentation/widgets/comments_widget.dart +++ b/lib/features/feed/presentation/widgets/comments_widget.dart @@ -72,13 +72,15 @@ class _CommentsWidgetState extends State { extra: Author( authorSlug: comment.authorSlug, authorName: comment.authorName, - authorProfileIcon: comment.authorProfileIcon, + authorProfileIcon: comment.authorProfileIcon.contains('https') ? comment.authorProfileIcon : baseUrl + comment.authorProfileIcon, authorIsMe: (sl().state as ProfileAvatarStateLoaded).profile.slug == comment.authorSlug ? true : false, ), ); }, child: CircleAvatar( - foregroundImage: NetworkImage(baseUrl + comment.authorProfileIcon), + foregroundImage: NetworkImage( + comment.authorProfileIcon.contains('https') ? comment.authorProfileIcon : baseUrl + comment.authorProfileIcon, + ), backgroundImage: const AssetImage('assets/images/no_avatar.png'), radius: radius, ), diff --git a/lib/features/profile/presentation/pages/profile_screen.dart b/lib/features/profile/presentation/pages/profile_screen.dart index 363c2152..70bd7e84 100644 --- a/lib/features/profile/presentation/pages/profile_screen.dart +++ b/lib/features/profile/presentation/pages/profile_screen.dart @@ -600,9 +600,7 @@ class _ProfileScreenState extends State { _educationBlock(String title, String date) { final parsedDate = DateTime.tryParse(date); - final formattedDate = parsedDate != null - ? DateFormat('d MMMM y', 'ru_RU').format(parsedDate) - : date; + final formattedDate = parsedDate != null ? DateFormat('d MMMM y', 'ru_RU').format(parsedDate) : date; return SizedBox( width: double.infinity, @@ -640,7 +638,6 @@ class _ProfileScreenState extends State { ); } - _socialLinks(ProfileStateLoaded state) { if (!state.profile.roles.contains('consultant')) { return const SizedBox.shrink(); @@ -1065,7 +1062,9 @@ class _ProfileScreenState extends State { tag: state.profile.profilePhotoUrl, child: CircleAvatar( radius: 32, - foregroundImage: NetworkImage(baseUrl + state.profile.profilePhotoUrl), + foregroundImage: NetworkImage( + state.profile.profilePhotoUrl.contains('https') ? state.profile.profilePhotoUrl : baseUrl + state.profile.profilePhotoUrl, + ), backgroundImage: const AssetImage('assets/images/no_avatar.png'), ), ), diff --git a/lib/features/profile/presentation/widgets/profile_blog_post_widget.dart b/lib/features/profile/presentation/widgets/profile_blog_post_widget.dart index 18f2a878..5ac4d60e 100644 --- a/lib/features/profile/presentation/widgets/profile_blog_post_widget.dart +++ b/lib/features/profile/presentation/widgets/profile_blog_post_widget.dart @@ -67,7 +67,9 @@ class _ProfileBlogPostWidgetState extends State { radius: 20, backgroundColor: Colors.black12, foregroundImage: NetworkImage( - baseUrl + state.blogPosts[widget.index].author.authorProfileIcon, + state.blogPosts[widget.index].author.authorProfileIcon.contains('https') + ? state.blogPosts[widget.index].author.authorProfileIcon + : baseUrl + state.blogPosts[widget.index].author.authorProfileIcon, ), backgroundImage: const AssetImage('assets/images/no_avatar.png'), ), @@ -119,8 +121,7 @@ class _ProfileBlogPostWidgetState extends State { ), ], if (state.blogPosts[widget.index].title.isEmpty) const SizedBox(height: 8), - if (state.blogPosts[widget.index].title.isNotEmpty && state.blogPosts[widget.index].description.isNotEmpty) - const SizedBox(height: 8), + if (state.blogPosts[widget.index].title.isNotEmpty && state.blogPosts[widget.index].description.isNotEmpty) const SizedBox(height: 8), if (state.blogPosts[widget.index].description.isNotEmpty) Padding( padding: const EdgeInsets.symmetric(horizontal: 4), diff --git a/lib/features/welcome/presentation/pages/welcome_screen.dart b/lib/features/welcome/presentation/pages/welcome_screen.dart index 25922a10..31b4bf0f 100644 --- a/lib/features/welcome/presentation/pages/welcome_screen.dart +++ b/lib/features/welcome/presentation/pages/welcome_screen.dart @@ -1,9 +1,9 @@ +import 'package:eatvio_app/core/theme/theme_helper.dart'; +import 'package:eatvio_app/core/token_storage.dart'; import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:go_router/go_router.dart'; import 'package:shared_preferences/shared_preferences.dart'; - -import '../../../../core/theme/theme_helper.dart'; import 'package:flutter_native_splash/flutter_native_splash.dart'; class WelcomeScreen extends StatefulWidget { @@ -82,7 +82,11 @@ class _WelcomeScreenState extends State { onTap: () async { final sharedPreferences = await SharedPreferences.getInstance(); await sharedPreferences.setBool('welcomeScreenWasShowed', true); - goRouter.go('/feed-screen'); + if (await TokenStorage.haveTokenInStorage()) { + goRouter.go('/feed-screen'); + } else { + goRouter.go('/auth-screen'); + } }, borderRadius: BorderRadius.circular(8), child: Ink( diff --git a/lib/main.dart b/lib/main.dart index 1616d9eb..a712f6e3 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -20,14 +20,20 @@ import 'package:keyboard_dismisser/keyboard_dismisser.dart'; import 'package:sentry_flutter/sentry_flutter.dart'; Future main() async { - WidgetsBinding widgetsBinding = WidgetsFlutterBinding.ensureInitialized(); + WidgetsBinding widgetsBinding = SentryWidgetsFlutterBinding.ensureInitialized(); FlutterNativeSplash.preserve(widgetsBinding: widgetsBinding); + await Firebase.initializeApp(options: DefaultFirebaseOptions.currentPlatform); await di.init(); - await SentryFlutter.init((options) { - options.dsn = 'http://ba7f2653067776f3034e6e89850e85a1@sentry.md-desk.ru:9000/2'; - options.tracesSampleRate = 1.0; - }, appRunner: () => runApp(const MyApp())); + + await SentryFlutter.init( + (options) { + options.dsn = 'http://ba7f2653067776f3034e6e89850e85a1@sentry.md-desk.ru:9000/2'; + options.tracesSampleRate = 1.0; + options.debug = false; + }, + appRunner: () => runApp(const MyApp()), + ); } class MyApp extends StatelessWidget { diff --git a/pubspec.yaml b/pubspec.yaml index c9e7430b..0a1982b6 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: eatvio_app description: A new Flutter project. -version: 1.1.4+34 +version: 1.1.5+35 publish_to: 'none' environment: