forked from eatvio/eatvio_app
feat(chat): fix native analyze
This commit is contained in:
@@ -33,6 +33,7 @@ linter:
|
||||
# - newline-before-return
|
||||
# - no-boolean-literal-compare
|
||||
# - no-empty-block
|
||||
# - prefer-trailing-comma
|
||||
# - prefer-conditional-expressions
|
||||
# - no-equal-then-else
|
||||
rules:
|
||||
- prefer-trailing-comma
|
||||
@@ -52,5 +52,10 @@
|
||||
<true/>
|
||||
<key>UIApplicationSupportsIndirectInputEvents</key>
|
||||
<true/>
|
||||
<key>NSAppTransportSecurity</key>
|
||||
<dict>
|
||||
<key>NSAllowsArbitraryLoads</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</dict>
|
||||
</plist>
|
||||
|
||||
@@ -5,8 +5,6 @@ import 'package:eatvio_app/features/chat/repositories/chat_repository.dart';
|
||||
import 'package:pusher_client/pusher_client.dart';
|
||||
|
||||
class InitializationCubit extends Cubit<InitializationState> {
|
||||
late final webSocketChannel;
|
||||
|
||||
final ChatRepository chatRepository;
|
||||
|
||||
InitializationCubit({required this.chatRepository}) : super(const InitializationState.loading());
|
||||
@@ -29,20 +27,27 @@ class InitializationCubit extends Cubit<InitializationState> {
|
||||
),
|
||||
);
|
||||
|
||||
PusherClient pusher = PusherClient(
|
||||
PusherClient pusherClient = PusherClient(
|
||||
wsUrl.key,
|
||||
options,
|
||||
autoConnect: true,
|
||||
enableLogging: true,
|
||||
);
|
||||
|
||||
await pusher.connect();
|
||||
|
||||
// Channel channel = pusher.subscribe('private-direct-chat.');
|
||||
// channel.registerListener(classId, method);
|
||||
await pusherClient.connect();
|
||||
|
||||
emit(const InitializationState.success());
|
||||
|
||||
Channel channel = pusherClient.subscribe('private-direct-chat.' + '7909ea56-7822-4d5f-8892-134bc937127f');
|
||||
|
||||
channel.bind("pusher_internal:subscription_succeeded", (PusherEvent? event) {
|
||||
channel.trigger("pusher_internal:subscription_succeeded", {});
|
||||
});
|
||||
|
||||
channel.registerListener('pusher:subscribe', (data) => print(data.toString()));
|
||||
|
||||
} catch (e) {
|
||||
print(e);
|
||||
emit(InitializationState.error(errorMessage: e.toString()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import 'package:eatvio_app/core/initialization_cubit/initialization_cubit.dart';
|
||||
import 'package:eatvio_app/features/chat/presentation/bloc/chat_room_cubit/chat_room_cubit.dart';
|
||||
import 'package:eatvio_app/features/chat/presentation/bloc/chat_room_cubit/chat_room_state.dart';
|
||||
import 'package:eatvio_app/features/chat/presentation/widgets/chat_bubble_widget.dart';
|
||||
@@ -6,7 +7,7 @@ import 'package:flutter/cupertino.dart';
|
||||
import 'package:eatvio_app/core/app_export.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class ChatScreen extends StatelessWidget {
|
||||
class ChatScreen extends StatefulWidget {
|
||||
final String chatId;
|
||||
|
||||
const ChatScreen({
|
||||
@@ -14,9 +15,14 @@ class ChatScreen extends StatelessWidget {
|
||||
super.key,
|
||||
});
|
||||
|
||||
@override
|
||||
State<ChatScreen> createState() => _ChatScreenState();
|
||||
}
|
||||
|
||||
class _ChatScreenState extends State<ChatScreen> {
|
||||
Widget build(BuildContext context) {
|
||||
return BlocProvider<ChatRoomCubit>(
|
||||
create: (BuildContext context) => sl()..initChat(chatId),
|
||||
create: (BuildContext context) => sl()..initChat(widget.chatId),
|
||||
child: BlocBuilder<ChatRoomCubit, ChatRoomState>(
|
||||
builder: (context, state) {
|
||||
if (state is ChatRoomStateLoading) {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import 'package:eatvio_app/app_router.dart';
|
||||
import 'package:eatvio_app/core/initialization_cubit/initialization_cubit.dart';
|
||||
import 'package:eatvio_app/core/initialization_cubit/initialization_state.dart';
|
||||
import 'package:eatvio_app/features/chat/presentation/pages/chat_select_screen/bloc/chat_select_bloc.dart';
|
||||
import 'package:eatvio_app/features/chat/presentation/pages/chat_select_screen/models/chat_select_model.dart';
|
||||
import 'package:eatvio_app/locator_service.dart';
|
||||
@@ -42,7 +43,7 @@ class MyApp extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
return MultiBlocProvider(
|
||||
providers: [
|
||||
BlocProvider<InitializationCubit>(create: (context) => sl<InitializationCubit>()..runInitialization()),
|
||||
BlocProvider<InitializationCubit>(create: (context) => InitializationCubit(chatRepository: sl())..runInitialization()),
|
||||
BlocProvider<ThemeBloc>(create: (context) => ThemeBloc(ThemeState(themeType: PrefUtils().getThemeData()))),
|
||||
BlocProvider<MyProfileBloc>(create: (context) => MyProfileBloc(MyProfileState(myProfileModelObj: MyProfileModel()))..add(MyProfileInitialEvent())),
|
||||
BlocProvider<FeedBloc>(create: (context) => FeedBloc(FeedState(myProfileModelObj: FeedModel()))..add(FeedInitialEvent())),
|
||||
@@ -51,33 +52,37 @@ class MyApp extends StatelessWidget {
|
||||
create: (context) => ChatSelectBloc(ChatSelectState(chatSelectModelObj: ChatSelectModel()))..add(ChatSelectInitialEvent()),
|
||||
),
|
||||
],
|
||||
child: BlocBuilder<ThemeBloc, ThemeState>(
|
||||
builder: (context, state) {
|
||||
return KeyboardDismisser(
|
||||
gestures: [
|
||||
GestureType.onTap,
|
||||
GestureType.onPanUpdateDownDirection,
|
||||
],
|
||||
child: MaterialApp.router(
|
||||
theme: theme,
|
||||
title: 'Eatvio',
|
||||
routerConfig: AppRouter.appRouter,
|
||||
debugShowCheckedModeBanner: false,
|
||||
localizationsDelegates: [
|
||||
AppLocalizationDelegate(),
|
||||
GlobalMaterialLocalizations.delegate,
|
||||
GlobalWidgetsLocalizations.delegate,
|
||||
GlobalCupertinoLocalizations.delegate,
|
||||
],
|
||||
supportedLocales: [
|
||||
Locale(
|
||||
'ru',
|
||||
'',
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
child: BlocListener<InitializationCubit, InitializationState>(
|
||||
listener: (BuildContext context, InitializationState state) {
|
||||
},
|
||||
child: BlocBuilder<ThemeBloc, ThemeState>(
|
||||
builder: (context, state) {
|
||||
return KeyboardDismisser(
|
||||
gestures: [
|
||||
GestureType.onTap,
|
||||
GestureType.onPanUpdateDownDirection,
|
||||
],
|
||||
child: MaterialApp.router(
|
||||
theme: theme,
|
||||
title: 'Eatvio',
|
||||
routerConfig: AppRouter.appRouter,
|
||||
debugShowCheckedModeBanner: false,
|
||||
localizationsDelegates: [
|
||||
AppLocalizationDelegate(),
|
||||
GlobalMaterialLocalizations.delegate,
|
||||
GlobalWidgetsLocalizations.delegate,
|
||||
GlobalCupertinoLocalizations.delegate,
|
||||
],
|
||||
supportedLocales: [
|
||||
Locale(
|
||||
'ru',
|
||||
'',
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
name: eatvio_app
|
||||
description: A new Flutter project.
|
||||
version: 0.0.0+1
|
||||
publish_to: 'none'
|
||||
|
||||
environment:
|
||||
sdk: ">=3.3.4 <4.0.0"
|
||||
|
||||
Reference in New Issue
Block a user