Merge pull request 'fix: black screen Issue-514' (#528) from mso7nueh/eatvio_app:main into main

Reviewed-on: eatvio/eatvio_app#528
This commit is contained in:
mso7nueh
2025-06-25 12:38:06 +00:00
8 changed files with 42 additions and 16 deletions

View File

@@ -388,7 +388,7 @@
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CODE_SIGN_IDENTITY = "Apple Distribution: ITVIO, OOO (VL68C36HYS)"; CODE_SIGN_IDENTITY = "Apple Distribution: ITVIO, OOO (VL68C36HYS)";
CODE_SIGN_STYLE = Manual; CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 31; CURRENT_PROJECT_VERSION = 32;
DEVELOPMENT_TEAM = VL68C36HYS; DEVELOPMENT_TEAM = VL68C36HYS;
ENABLE_BITCODE = NO; ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = ( FRAMEWORK_SEARCH_PATHS = (
@@ -538,7 +538,7 @@
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CODE_SIGN_IDENTITY = "Apple Distribution: ITVIO, OOO (VL68C36HYS)"; CODE_SIGN_IDENTITY = "Apple Distribution: ITVIO, OOO (VL68C36HYS)";
CODE_SIGN_STYLE = Manual; CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 31; CURRENT_PROJECT_VERSION = 32;
DEVELOPMENT_TEAM = VL68C36HYS; DEVELOPMENT_TEAM = VL68C36HYS;
ENABLE_BITCODE = NO; ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = ( FRAMEWORK_SEARCH_PATHS = (
@@ -576,7 +576,7 @@
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CODE_SIGN_IDENTITY = "Apple Distribution: ITVIO, OOO (VL68C36HYS)"; CODE_SIGN_IDENTITY = "Apple Distribution: ITVIO, OOO (VL68C36HYS)";
CODE_SIGN_STYLE = Manual; CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 31; CURRENT_PROJECT_VERSION = 32;
DEVELOPMENT_TEAM = VL68C36HYS; DEVELOPMENT_TEAM = VL68C36HYS;
ENABLE_BITCODE = NO; ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = ( FRAMEWORK_SEARCH_PATHS = (

View File

@@ -21,7 +21,7 @@
<key>CFBundleSignature</key> <key>CFBundleSignature</key>
<string>????</string> <string>????</string>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
<string>31</string> <string>32</string>
<key>ITSAppUsesNonExemptEncryption</key> <key>ITSAppUsesNonExemptEncryption</key>
<false/> <false/>
<key>LSRequiresIPhoneOS</key> <key>LSRequiresIPhoneOS</key>

View File

@@ -1,4 +1,5 @@
import 'dart:async'; import 'dart:async';
import 'package:eatvio_app/core/app_router.dart';
import 'package:eatvio_app/core/const.dart'; import 'package:eatvio_app/core/const.dart';
import 'package:eatvio_app/core/locator_service.dart'; import 'package:eatvio_app/core/locator_service.dart';
import 'package:eatvio_app/core/theme/theme_helper.dart'; import 'package:eatvio_app/core/theme/theme_helper.dart';
@@ -60,17 +61,20 @@ class _AuthScreenState extends State<AuthScreen> {
} }
if (context.mounted) { if (context.mounted) {
try { try {
context.read<ProfileAvatarCubit>().getMyProfile(); await sl<ProfileAvatarCubit>().getMyProfile();
context.read<ChatsCubit>().getChatRoomsWithLoading(); await sl<ChatsCubit>().getChatRoomsWithLoading();
context.read<ChatsCubit>().connectToWebSocket(); await sl<ChatsCubit>().connectToWebSocket();
context.read<NotificationsCubit>().getNotifications(); await sl<NotificationsCubit>().getNotifications();
context.read<NotificationsCubit>().connectToWebSocket(); await sl<NotificationsCubit>().connectToWebSocket();
showSuccessToast('Успешный вход'); showSuccessToast('Успешный вход');
} catch (e) { } catch (e) {
rethrow; rethrow;
} }
GoRouter.of(context).go('/feed-screen', extra: {'needToInitializeWebSocket': false});
} }
AppRouter.navigatorKey.currentContext?.go(
'/feed-screen',
extra: {'needToInitializeWebSocket': false},
);
} }
@override @override

View File

@@ -6,6 +6,10 @@ import 'package:eatvio_app/core/const.dart';
import 'package:eatvio_app/core/locator_service.dart'; import 'package:eatvio_app/core/locator_service.dart';
import 'package:eatvio_app/core/token_storage.dart'; import 'package:eatvio_app/core/token_storage.dart';
import 'package:eatvio_app/core/utils/toasts.dart'; import 'package:eatvio_app/core/utils/toasts.dart';
import 'package:eatvio_app/core/websockets/ws_manager.dart';
import 'package:eatvio_app/features/bottom_navigation_bar/presentation/bloc/profile_avatar_cubit/profile_avatar_cubit.dart';
import 'package:eatvio_app/features/chat/presentation/bloc/chats_cubit/chats_cubit.dart';
import 'package:eatvio_app/features/notifications/presentation/notifications_cubit/notifications_cubit.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart'; import 'package:go_router/go_router.dart';
import 'package:qr_code_scanner_plus/qr_code_scanner_plus.dart'; import 'package:qr_code_scanner_plus/qr_code_scanner_plus.dart';
@@ -58,7 +62,7 @@ class _ScanQRCodeScreenState extends State<ScanQRCodeScreen> {
setState(() { setState(() {
result = scanData; result = scanData;
}); });
controller.pauseCamera(); await controller.pauseCamera();
try { try {
final scannedUrl = scanData.code; final scannedUrl = scanData.code;
final uri = Uri.parse(scannedUrl ?? ''); final uri = Uri.parse(scannedUrl ?? '');
@@ -76,14 +80,29 @@ class _ScanQRCodeScreenState extends State<ScanQRCodeScreen> {
); );
final token = response.data['token']; final token = response.data['token'];
await TokenStorage.saveTokenInStorage(token); await TokenStorage.saveTokenInStorage(token);
try {
await sl<WsManager>().clear();
await sl<WsManager>().initialize();
} catch (e) {
rethrow;
}
try {
await sl<ProfileAvatarCubit>().getMyProfile();
await sl<ChatsCubit>().getChatRoomsWithLoading();
await sl<ChatsCubit>().connectToWebSocket();
await sl<NotificationsCubit>().getNotifications();
await sl<NotificationsCubit>().connectToWebSocket();
} catch (e) {
rethrow;
}
AppRouter.navigatorKey.currentContext?.go( AppRouter.navigatorKey.currentContext?.go(
'/feed-screen', '/feed-screen',
extra: {'needToInitializeWebSocket': false}, extra: {'needToInitializeWebSocket': false},
); );
showSuccessToast('Добро пожаловать!'); showSuccessToast('Добро пожаловать!');
} catch (e) { } catch (e) {
controller.resumeCamera(); await controller.resumeCamera();
showErrorToast('Что-то пошло не так, попробуйте обновить страницу с qr кодом или используйте вход через логин и пароль'); showErrorToast('Что-то пошло не так. Попробуйте обновить страницу с QR-кодом или войдите с помощью логина и пароля.');
} }
}); });
} }

View File

@@ -1,6 +1,8 @@
import 'package:eatvio_app/core/app_router.dart';
import 'package:eatvio_app/features/bottom_navigation_bar/presentation/bloc/profile_avatar_cubit/profile_avatar_state.dart'; import 'package:eatvio_app/features/bottom_navigation_bar/presentation/bloc/profile_avatar_cubit/profile_avatar_state.dart';
import 'package:eatvio_app/features/profile/repositories/profile_repository.dart'; import 'package:eatvio_app/features/profile/repositories/profile_repository.dart';
import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:go_router/go_router.dart';
class ProfileAvatarCubit extends Cubit<ProfileAvatarState> { class ProfileAvatarCubit extends Cubit<ProfileAvatarState> {
final ProfileRepository profileRepository; final ProfileRepository profileRepository;
@@ -18,6 +20,7 @@ class ProfileAvatarCubit extends Cubit<ProfileAvatarState> {
), ),
); );
} catch (e) { } catch (e) {
AppRouter.navigatorKey.currentContext?.go('/auth-screen');
emit(ProfileAvatarState.error(errorMessage: e.toString())); emit(ProfileAvatarState.error(errorMessage: e.toString()));
} }
} }

View File

@@ -114,7 +114,7 @@ class MenuScreen extends StatelessWidget {
child: const Text("Отмена"), child: const Text("Отмена"),
), ),
], ],
content: const Text("Вы уверены что хотите выйти из аккаунта?"), content: const Text("Вы уверены, что хотите выйти из аккаунта?"),
), ),
); );
}; };

View File

@@ -27,7 +27,7 @@ Future<void> main() async {
await di.init(); await di.init();
await SentryFlutter.init( await SentryFlutter.init(
(options) { (options) {
options.dsn = 'http://ba7f2653067776f3034e6e89850e85a1@sentry.md-desk.ru:9000/2'; options.dsn = 'http://ba7f2653067776f3034e6e89850e85a1@sentry.md-desk.ru:9000/2';
options.tracesSampleRate = 1.0; options.tracesSampleRate = 1.0;
options.debug = false; options.debug = false;

View File

@@ -1,6 +1,6 @@
name: eatvio_app name: eatvio_app
description: A new Flutter project. description: A new Flutter project.
version: 1.1.8+38 version: 1.1.9+39
publish_to: 'none' publish_to: 'none'
environment: environment: