diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj
index f129a677..c72f1ce3 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/core/app_router.dart b/lib/core/app_router.dart
index c5d173d2..c691b0b2 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';
@@ -121,7 +119,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 +205,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/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);
}
-
-
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/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