notificaciones al pedir servicio y al enviar mensaje de chat
This commit is contained in:
+49
-168
@@ -1,181 +1,62 @@
|
||||
// import 'package:flutter/material.dart';
|
||||
// import 'package:flutter/services.dart';
|
||||
// import 'package:get/get.dart';
|
||||
// import 'package:intl/date_symbol_data_local.dart';
|
||||
// import 'package:prosappco/src/authentication/authentication_repository.dart';
|
||||
// import 'package:prosappco/src/presentation/screens/service_web.dart';
|
||||
// import 'package:prosappco/src/providers/user_provider.dart';
|
||||
// import 'package:prosappco/src/presentation/screens/calendar.dart';
|
||||
// import 'package:prosappco/src/presentation/screens/city.dart';
|
||||
// import 'package:prosappco/src/presentation/screens/login/login.dart';
|
||||
// import 'package:firebase_core/firebase_core.dart';
|
||||
// import 'package:prosappco/src/presentation/screens/login/login_email.dart';
|
||||
// import 'package:prosappco/src/presentation/screens/my_services.dart';
|
||||
// import 'package:prosappco/src/presentation/screens/my_services_pro.dart';
|
||||
// import 'package:prosappco/src/presentation/screens/new_number.dart';
|
||||
// import 'package:prosappco/src/presentation/screens/new_password.dart';
|
||||
// import 'package:prosappco/src/presentation/screens/profession.dart';
|
||||
// import 'package:prosappco/src/presentation/screens/professional_profile.dart';
|
||||
// import 'package:prosappco/src/presentation/screens/professional_revision.dart';
|
||||
// import 'package:prosappco/src/presentation/screens/profile/profile.dart';
|
||||
// import 'package:prosappco/src/presentation/screens/profile/profile_pro.dart';
|
||||
// import 'package:prosappco/src/presentation/screens/register/register.dart';
|
||||
// import 'package:prosappco/src/presentation/screens/request_sent.dart';
|
||||
// import 'package:prosappco/src/presentation/screens/reset_password/reset_password.dart';
|
||||
// import 'package:prosappco/src/presentation/screens/map/service.dart';
|
||||
// import 'package:prosappco/src/presentation/screens/solicitudes.dart';
|
||||
// import 'package:prosappco/src/services/local_notifications.dart';
|
||||
// import 'firebase_options.dart';
|
||||
// import 'package:firebase_messaging/firebase_messaging.dart';
|
||||
// import 'package:flutter/foundation.dart' show kIsWeb;
|
||||
// import 'package:provider/provider.dart';
|
||||
// import 'package:flutter_localizations/flutter_localizations.dart';
|
||||
|
||||
// Future<void> _firebaseMessagingBackgroundHandler(RemoteMessage message) async {
|
||||
// await Firebase.initializeApp();
|
||||
|
||||
// print('Handling a backdround message: ${message.messageId}');
|
||||
// }
|
||||
|
||||
// void main() async {
|
||||
// WidgetsFlutterBinding.ensureInitialized();
|
||||
// await Firebase.initializeApp(
|
||||
// options: DefaultFirebaseOptions.currentPlatform,
|
||||
// ).then((value) => Get.put(AuthenticationRepository()));
|
||||
|
||||
// // Evitar la solicitud de permiso en la versión web
|
||||
// if (!kIsWeb) {
|
||||
// FirebaseMessaging messaging = FirebaseMessaging.instance;
|
||||
|
||||
// await messaging.requestPermission(
|
||||
// alert: true,
|
||||
// announcement: false,
|
||||
// badge: true,
|
||||
// carPlay: false,
|
||||
// criticalAlert: false,
|
||||
// provisional: false,
|
||||
// sound: true,
|
||||
// );
|
||||
|
||||
// FirebaseMessaging.onBackgroundMessage(
|
||||
// (_firebaseMessagingBackgroundHandler));
|
||||
|
||||
// FirebaseMessaging.onMessage.listen((RemoteMessage message) {});
|
||||
// }
|
||||
|
||||
// await initNotifications();
|
||||
|
||||
// await initializeDateFormatting('es_MX', null);
|
||||
|
||||
// SystemChrome.setPreferredOrientations([
|
||||
// DeviceOrientation.portraitUp,
|
||||
// DeviceOrientation.portraitDown,
|
||||
// ]);
|
||||
|
||||
// runApp(const MyApp());
|
||||
// }
|
||||
|
||||
// class MyApp extends StatelessWidget {
|
||||
// const MyApp({super.key});
|
||||
|
||||
// @override
|
||||
// Widget build(BuildContext context) {
|
||||
// return MultiProvider(
|
||||
// providers: [
|
||||
// ChangeNotifierProvider(
|
||||
// create: (_) => UserProvider(),
|
||||
// ),
|
||||
// ],
|
||||
// child: GetMaterialApp(
|
||||
// theme: ThemeData(fontFamily: 'Poppins'),
|
||||
// debugShowCheckedModeBanner: false,
|
||||
// localizationsDelegates: const [
|
||||
// GlobalMaterialLocalizations.delegate,
|
||||
// GlobalWidgetsLocalizations.delegate,
|
||||
// GlobalCupertinoLocalizations.delegate,
|
||||
// ],
|
||||
// supportedLocales: const [
|
||||
// Locale('es', 'US'),
|
||||
// ],
|
||||
// title: 'ProsApp',
|
||||
// initialRoute: '/',
|
||||
// routes: {
|
||||
// '/': (context) => const LoginScreen(),
|
||||
// '/splash': (context) => const SplashScreen(),
|
||||
// '/login': (context) => const LoginEmailScreen(),
|
||||
// '/profile': (context) => const ProfileScreen(),
|
||||
// '/register': (context) => const RegisterScreen(),
|
||||
// '/city': (context) => const CityScreen(),
|
||||
// '/profession': (context) => const ProfessionScreen(),
|
||||
// '/newNumber': (context) => const NewNumberScreen(),
|
||||
// '/profesionalRevision': (context) =>
|
||||
// const ProfessionalRevisionScreen(),
|
||||
// '/profesionalProfile': (context) => const ProfessionalProfileScreen(),
|
||||
// '/solicitudEnviada': (context) => const RequestSentScreen(),
|
||||
// '/nuevaPassword': (context) => NewPasswordScreen(),
|
||||
// '/servicio': (context) => const ServiceScreen(),
|
||||
// '/servicioWeb': (context) => const ServiceWebScreen(),
|
||||
// '/profilePro': (context) => const ProfileProScreen(),
|
||||
// '/calendar': (context) => const CalendarScreen(),
|
||||
// '/solicitud': (context) => SolicitudScreen(),
|
||||
// '/misserviciospro': (context) => MyServicesProScreen(),
|
||||
// '/misservicios': (context) => MyServicesScreen(),
|
||||
// '/resetpassword': (context) => const ResetPasswordScreen(),
|
||||
// },
|
||||
// onGenerateRoute: (settings) {
|
||||
// throw Exception('Ruta desconocida: ${settings.name}');
|
||||
// },
|
||||
// ),
|
||||
// );
|
||||
// }
|
||||
// }
|
||||
|
||||
// class SplashScreen extends StatefulWidget {
|
||||
// const SplashScreen({super.key});
|
||||
|
||||
// @override
|
||||
// State<SplashScreen> createState() => _SplashScreenState();
|
||||
// }
|
||||
|
||||
// class _SplashScreenState extends State<SplashScreen> {
|
||||
// @override
|
||||
// void initState() {
|
||||
// super.initState();
|
||||
// if (kIsWeb) {
|
||||
// // Espera 3 segundos y luego redirige a LoginScreen
|
||||
// Future.delayed(const Duration(seconds: 3), () {
|
||||
// Navigator.pushReplacement(
|
||||
// context,
|
||||
// MaterialPageRoute(builder: (context) => const LoginScreen()),
|
||||
// );
|
||||
// });
|
||||
// }
|
||||
// }
|
||||
|
||||
// @override
|
||||
// Widget build(BuildContext context) {
|
||||
// return Scaffold(
|
||||
// backgroundColor: Colors.blue,
|
||||
// body: Center(
|
||||
// child: kIsWeb ? Image.asset('/images/splash.png') : const LoginScreen(),
|
||||
// ),
|
||||
// );
|
||||
// }
|
||||
// }
|
||||
|
||||
import 'package:firebase_messaging/firebase_messaging.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:firebase_core/firebase_core.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:injector/injector.dart';
|
||||
import 'package:prosappco/app_view.dart';
|
||||
import 'package:prosappco/blocs/authentication_bloc/authentication_bloc.dart';
|
||||
import 'package:prosappco/blocs/my_user_bloc/my_user_bloc.dart';
|
||||
import 'package:prosappco/blocs/notification_bloc/notification_bloc.dart';
|
||||
import 'package:prosappco/blocs/professional_bloc/professional_bloc.dart';
|
||||
import 'package:prosappco/blocs/professional_profile_bloc/professional_profile_bloc.dart';
|
||||
import 'package:prosappco/blocs/profile_bloc/profile_bloc.dart';
|
||||
import 'package:prosappco/dependency/app_di.dart';
|
||||
import 'app.dart';
|
||||
import 'package:prosappco/local_notifications/local_notifications.dart';
|
||||
import 'simple_bloc_observer.dart';
|
||||
|
||||
void main() async {
|
||||
WidgetsFlutterBinding.ensureInitialized();
|
||||
await Firebase.initializeApp();
|
||||
FirebaseMessaging.onBackgroundMessage(firebaseMessagingBackgroundHandler);
|
||||
|
||||
// await Firebase.initializeApp();
|
||||
await NotificationBloc.initializeFCM();
|
||||
await LocalNotifications.initializeLocalNotifications();
|
||||
|
||||
Bloc.observer = SimpleBlocObserver();
|
||||
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
|
||||
AppDI().register();
|
||||
runApp(const MainApp());
|
||||
|
||||
runApp(
|
||||
MultiBlocProvider(
|
||||
providers: [
|
||||
BlocProvider<AuthenticationBloc>(
|
||||
create: (context) => Injector.appInstance.get<AuthenticationBloc>(),
|
||||
),
|
||||
BlocProvider<MyUserBloc>(
|
||||
create: (context) => Injector.appInstance.get<MyUserBloc>(),
|
||||
),
|
||||
BlocProvider<ProfileBloc>(
|
||||
create: (context) => Injector.appInstance.get<ProfileBloc>(),
|
||||
),
|
||||
BlocProvider<ProfessionalBloc>(
|
||||
create: (context) => Injector.appInstance.get<ProfessionalBloc>(),
|
||||
),
|
||||
BlocProvider<ProfessionalProfileBloc>(
|
||||
create: (context) =>
|
||||
Injector.appInstance.get<ProfessionalProfileBloc>(),
|
||||
),
|
||||
BlocProvider<NotificationBloc>(
|
||||
create: (context) => Injector.appInstance.get<NotificationBloc>(),
|
||||
)
|
||||
],
|
||||
child: BlocBuilder<MyUserBloc, MyUserState>(
|
||||
builder: (context, state) {
|
||||
return const SafeArea(child: MyAppView());
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
// runApp(const MainApp());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user