notificacion desde cita
This commit is contained in:
@@ -74,7 +74,6 @@ Future<List<Event>> getByProId(String day) async {
|
|||||||
event.id = element.id;
|
event.id = element.id;
|
||||||
eventos.add(event);
|
eventos.add(event);
|
||||||
}
|
}
|
||||||
print('eventos $eventos');
|
|
||||||
return eventos;
|
return eventos;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
print('Error getByProId $e');
|
print('Error getByProId $e');
|
||||||
@@ -96,7 +95,6 @@ Future<List<Event>> getByProIdAll(String state1, String state2) async {
|
|||||||
event.id = element.id;
|
event.id = element.id;
|
||||||
eventos.add(event);
|
eventos.add(event);
|
||||||
}
|
}
|
||||||
print('eventos $eventos');
|
|
||||||
return eventos;
|
return eventos;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
print('Error getByProId $e');
|
print('Error getByProId $e');
|
||||||
@@ -118,7 +116,6 @@ Future<List<Event>> getByUserIdAll(String state1, String state2) async {
|
|||||||
event.id = element.id;
|
event.id = element.id;
|
||||||
eventos.add(event);
|
eventos.add(event);
|
||||||
}
|
}
|
||||||
print('eventos $eventos');
|
|
||||||
return eventos;
|
return eventos;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
print('Error getByUserId $e');
|
print('Error getByUserId $e');
|
||||||
@@ -211,7 +208,6 @@ class Event {
|
|||||||
for (var element in snapshot.docs) {
|
for (var element in snapshot.docs) {
|
||||||
eventos.add(Event.fromJson(element.data()));
|
eventos.add(Event.fromJson(element.data()));
|
||||||
}
|
}
|
||||||
print('eventos $eventos');
|
|
||||||
return eventos;
|
return eventos;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
print('Error getByProId $e');
|
print('Error getByProId $e');
|
||||||
@@ -232,7 +228,6 @@ class Event {
|
|||||||
for (var element in snapshot.docs) {
|
for (var element in snapshot.docs) {
|
||||||
eventos.add(Event.fromJson(element.data()));
|
eventos.add(Event.fromJson(element.data()));
|
||||||
}
|
}
|
||||||
print('eventos $eventos');
|
|
||||||
return eventos;
|
return eventos;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
print('Error getByProId $e');
|
print('Error getByProId $e');
|
||||||
|
|||||||
@@ -61,7 +61,6 @@ class SettingModel {
|
|||||||
|
|
||||||
final Map<String, dynamic>? data = snapshot.data();
|
final Map<String, dynamic>? data = snapshot.data();
|
||||||
|
|
||||||
print('data $data');
|
|
||||||
return fromJson(data!);
|
return fromJson(data!);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
print('Error getting settings: $e');
|
print('Error getting settings: $e');
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ class UserModel {
|
|||||||
json['token'],
|
json['token'],
|
||||||
);
|
);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
print('XD user $e');
|
print('$e');
|
||||||
return UserModel('', '', '', null, null, 0, '', '');
|
return UserModel('', '', '', null, null, 0, '', '');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import 'package:cloud_firestore/cloud_firestore.dart';
|
import 'package:cloud_firestore/cloud_firestore.dart';
|
||||||
|
import 'package:firebase_auth/firebase_auth.dart';
|
||||||
import 'package:firebase_storage/firebase_storage.dart';
|
import 'package:firebase_storage/firebase_storage.dart';
|
||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
@@ -15,6 +16,9 @@ import 'package:prosappco/src/screens/chat.dart';
|
|||||||
import 'package:prosappco/src/screens/score.dart';
|
import 'package:prosappco/src/screens/score.dart';
|
||||||
import 'package:url_launcher/url_launcher.dart';
|
import 'package:url_launcher/url_launcher.dart';
|
||||||
import 'package:community_material_icon/community_material_icon.dart';
|
import 'package:community_material_icon/community_material_icon.dart';
|
||||||
|
import 'package:http/http.dart' as http;
|
||||||
|
import 'dart:convert';
|
||||||
|
import 'package:flutter/gestures.dart';
|
||||||
|
|
||||||
class CitaScreen extends StatefulWidget {
|
class CitaScreen extends StatefulWidget {
|
||||||
final Event evento;
|
final Event evento;
|
||||||
@@ -29,12 +33,15 @@ class _CitaScreenState extends State<CitaScreen> {
|
|||||||
UserModel? user;
|
UserModel? user;
|
||||||
DateTime today = DateTime.now();
|
DateTime today = DateTime.now();
|
||||||
String nombre = '';
|
String nombre = '';
|
||||||
|
String userToken = '';
|
||||||
String numberPhone = '';
|
String numberPhone = '';
|
||||||
int tarifa = 0;
|
int tarifa = 0;
|
||||||
Reference? ref_photo;
|
Reference? ref_photo;
|
||||||
ScoresModel? scoresModel;
|
ScoresModel? scoresModel;
|
||||||
bool? ver = true;
|
bool? ver = true;
|
||||||
bool? pro;
|
bool? pro;
|
||||||
|
String proName = '';
|
||||||
|
late final FirebaseAuth _auth;
|
||||||
|
|
||||||
String formatCurrency(int number) {
|
String formatCurrency(int number) {
|
||||||
final formatter =
|
final formatter =
|
||||||
@@ -42,12 +49,46 @@ class _CitaScreenState extends State<CitaScreen> {
|
|||||||
return '\$${formatter.format(number)}';
|
return '\$${formatter.format(number)}';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<void> sendPushNotification(
|
||||||
|
String user, String accion, String proName) async {
|
||||||
|
try {
|
||||||
|
http.Response response = await http.post(
|
||||||
|
Uri.parse('https://fcm.googleapis.com/fcm/send'),
|
||||||
|
headers: <String, String>{
|
||||||
|
'Content-Type': 'application/json; charset=UTF-8',
|
||||||
|
'Authorization':
|
||||||
|
'key=AAAAORdR-xU:APA91bF_wblg86jHAC-uexrXPHavYRlk5wge1Gf46m56V4J2D2L37Cp_hf46JZUzpvsWPSpqc5ewHelKI9LTifUG_s2mciMI6e5VLKo7E1R8btbNo7iaM9do2ctoyHKUm1atlZBdKaN2',
|
||||||
|
},
|
||||||
|
body: jsonEncode(
|
||||||
|
<String, dynamic>{
|
||||||
|
'notification': <String, dynamic>{
|
||||||
|
'body': accion == 'rechazo'
|
||||||
|
? '$proName a rechazado tu solicitud de servicio'
|
||||||
|
: '$proName a aprobado tu solicitud de servicio',
|
||||||
|
'title': '$proName $accion',
|
||||||
|
},
|
||||||
|
'priority': 'high',
|
||||||
|
'data': <String, dynamic>{
|
||||||
|
'click_action': 'FLUTTER_NOTIFICATION_CLICK',
|
||||||
|
'id': '1',
|
||||||
|
'status': 'done'
|
||||||
|
},
|
||||||
|
'to': user
|
||||||
|
},
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
response;
|
||||||
|
} catch (e) {
|
||||||
|
print('error al enviar notificacion $e');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Future<void> _openMap(double lat, double lng) async {
|
Future<void> _openMap(double lat, double lng) async {
|
||||||
final Uri _url =
|
final Uri _url =
|
||||||
Uri.parse('https://www.google.com/maps/search/?api=1&query=$lat,$lng');
|
Uri.parse('https://www.google.com/maps/search/?api=1&query=$lat,$lng');
|
||||||
|
|
||||||
if (!await launchUrl(_url)) {
|
if (!await launchUrl(_url)) {
|
||||||
print('hola');
|
|
||||||
throw Exception('Could not launch $_url');
|
throw Exception('Could not launch $_url');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -65,6 +106,14 @@ class _CitaScreenState extends State<CitaScreen> {
|
|||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
|
|
||||||
|
final uid = AuthenticationRepository.instance.getCurrentUserUid();
|
||||||
|
_auth = FirebaseAuth.instance;
|
||||||
|
|
||||||
|
final currentUser = _auth.currentUser;
|
||||||
|
if (currentUser != null && currentUser.displayName != null) {
|
||||||
|
proName = currentUser.displayName!;
|
||||||
|
}
|
||||||
|
|
||||||
if (settings == null) {
|
if (settings == null) {
|
||||||
SettingModel.getSettings().then(
|
SettingModel.getSettings().then(
|
||||||
(SettingModel value) => setState(() {
|
(SettingModel value) => setState(() {
|
||||||
@@ -104,6 +153,7 @@ class _CitaScreenState extends State<CitaScreen> {
|
|||||||
setState(() {
|
setState(() {
|
||||||
nombre = value.name;
|
nombre = value.name;
|
||||||
ref_photo = value.photo;
|
ref_photo = value.photo;
|
||||||
|
userToken = value.token ?? '';
|
||||||
numberPhone = value.phoneNumber ?? '';
|
numberPhone = value.phoneNumber ?? '';
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -584,6 +634,10 @@ class _CitaScreenState extends State<CitaScreen> {
|
|||||||
.doc('${widget.evento.id}')
|
.doc('${widget.evento.id}')
|
||||||
.update({"status": "denegado"}).then(
|
.update({"status": "denegado"}).then(
|
||||||
(value) {
|
(value) {
|
||||||
|
if (userToken != '') {
|
||||||
|
sendPushNotification(
|
||||||
|
userToken, 'rechazo', proName);
|
||||||
|
}
|
||||||
Navigator.pushReplacementNamed(
|
Navigator.pushReplacementNamed(
|
||||||
context, '/solicitud');
|
context, '/solicitud');
|
||||||
});
|
});
|
||||||
@@ -625,6 +679,10 @@ class _CitaScreenState extends State<CitaScreen> {
|
|||||||
.doc('${widget.evento.id}')
|
.doc('${widget.evento.id}')
|
||||||
.update({"status": "aprobado"}).then(
|
.update({"status": "aprobado"}).then(
|
||||||
(value) {
|
(value) {
|
||||||
|
if (userToken != '') {
|
||||||
|
sendPushNotification(
|
||||||
|
userToken, 'acepto', proName);
|
||||||
|
}
|
||||||
Navigator.pushReplacementNamed(
|
Navigator.pushReplacementNamed(
|
||||||
context, '/solicitud');
|
context, '/solicitud');
|
||||||
});
|
});
|
||||||
@@ -654,6 +712,10 @@ class _CitaScreenState extends State<CitaScreen> {
|
|||||||
.collection("services")
|
.collection("services")
|
||||||
.doc('${widget.evento.id}')
|
.doc('${widget.evento.id}')
|
||||||
.update({"status": "denegado"}).then((value) {
|
.update({"status": "denegado"}).then((value) {
|
||||||
|
if (userToken != '') {
|
||||||
|
sendPushNotification(
|
||||||
|
userToken, 'rechazo', proName);
|
||||||
|
}
|
||||||
Navigator.pushReplacementNamed(
|
Navigator.pushReplacementNamed(
|
||||||
context, '/solicitud');
|
context, '/solicitud');
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ Future<List<City>> getCountries() async {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
print('xd seqe $e');
|
print('$e');
|
||||||
}
|
}
|
||||||
|
|
||||||
return citys;
|
return citys;
|
||||||
@@ -116,8 +116,6 @@ class _CityScreenState extends State<CityScreen> {
|
|||||||
.collection('users')
|
.collection('users')
|
||||||
.doc(uid)
|
.doc(uid)
|
||||||
.update({'coordsOfCity': coordsCity});
|
.update({'coordsOfCity': coordsCity});
|
||||||
|
|
||||||
print('Ciudad actualizada correctamente');
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
try {
|
try {
|
||||||
await FirebaseFirestore.instance
|
await FirebaseFirestore.instance
|
||||||
|
|||||||
@@ -44,7 +44,6 @@ class HorarioScreen extends StatelessWidget {
|
|||||||
await FirebaseFirestore.instance.collection('users').doc(uid).update({
|
await FirebaseFirestore.instance.collection('users').doc(uid).update({
|
||||||
'horario': horariosMap,
|
'horario': horariosMap,
|
||||||
});
|
});
|
||||||
print('Horarios actualizados correctamente');
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
print('Error al actualizar el horario: $e');
|
print('Error al actualizar el horario: $e');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -70,7 +70,6 @@ class _MyServicesScreenState extends State<MyServicesScreen> {
|
|||||||
event.id = element.id;
|
event.id = element.id;
|
||||||
eventos.add(event);
|
eventos.add(event);
|
||||||
}
|
}
|
||||||
print('eventos $eventos');
|
|
||||||
return eventos;
|
return eventos;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
print('Error getByProId $e');
|
print('Error getByProId $e');
|
||||||
|
|||||||
@@ -65,7 +65,6 @@ class _MyServicesProScreenState extends State<MyServicesProScreen> {
|
|||||||
event.id = element.id;
|
event.id = element.id;
|
||||||
eventos.add(event);
|
eventos.add(event);
|
||||||
}
|
}
|
||||||
print('eventos $eventos');
|
|
||||||
return eventos;
|
return eventos;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
print('Error getByProId $e');
|
print('Error getByProId $e');
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ Future<List<String>> getProfessions() async {
|
|||||||
|
|
||||||
return professionsList;
|
return professionsList;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
print('xd $e');
|
print('$e');
|
||||||
}
|
}
|
||||||
|
|
||||||
return [];
|
return [];
|
||||||
@@ -76,8 +76,6 @@ class _ProfessionScreenState extends State<ProfessionScreen> {
|
|||||||
.collection('users')
|
.collection('users')
|
||||||
.doc(uid)
|
.doc(uid)
|
||||||
.update({'profesion': profession});
|
.update({'profesion': profession});
|
||||||
|
|
||||||
print('Profesion actualizada correctamente');
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
try {
|
try {
|
||||||
await FirebaseFirestore.instance
|
await FirebaseFirestore.instance
|
||||||
|
|||||||
@@ -94,8 +94,6 @@ class _ProfessionalDireccionScreenState
|
|||||||
'latitude': latitude,
|
'latitude': latitude,
|
||||||
'longitude': longitude,
|
'longitude': longitude,
|
||||||
});
|
});
|
||||||
|
|
||||||
print('Ciudad actualizada correctamente');
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
try {
|
try {
|
||||||
await FirebaseFirestore.instance.collection('users').doc(uid).set({
|
await FirebaseFirestore.instance.collection('users').doc(uid).set({
|
||||||
|
|||||||
@@ -212,10 +212,8 @@ class ProfessionalProfileScreenState extends State<ProfessionalProfileScreen> {
|
|||||||
|
|
||||||
if (userSnapshot.exists) {
|
if (userSnapshot.exists) {
|
||||||
await userRef.update({'imgCedula': image});
|
await userRef.update({'imgCedula': image});
|
||||||
print('¡Imagen de cédula actualizada correctamente!');
|
|
||||||
} else {
|
} else {
|
||||||
await userRef.set({'imgCedula': image});
|
await userRef.set({'imgCedula': image});
|
||||||
print('¡Imagen de cédula agregada correctamente!');
|
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
print('Error al agregar o actualizar la imagen de cédula: $e');
|
print('Error al agregar o actualizar la imagen de cédula: $e');
|
||||||
@@ -257,10 +255,8 @@ class ProfessionalProfileScreenState extends State<ProfessionalProfileScreen> {
|
|||||||
|
|
||||||
if (userSnapshot.exists) {
|
if (userSnapshot.exists) {
|
||||||
await userRef.update({'imgCertificado': image});
|
await userRef.update({'imgCertificado': image});
|
||||||
print('¡Imagen de certificado actualizada correctamente!');
|
|
||||||
} else {
|
} else {
|
||||||
await userRef.set({'imgCertificado': image});
|
await userRef.set({'imgCertificado': image});
|
||||||
print('¡Imagen de certificado agregada correctamente!');
|
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
print('Error al agregar o actualizar la imagen de certificado: $e');
|
print('Error al agregar o actualizar la imagen de certificado: $e');
|
||||||
@@ -273,8 +269,6 @@ class ProfessionalProfileScreenState extends State<ProfessionalProfileScreen> {
|
|||||||
.collection('users')
|
.collection('users')
|
||||||
.doc(uid)
|
.doc(uid)
|
||||||
.update({'photo': image});
|
.update({'photo': image});
|
||||||
|
|
||||||
print('imagen actualizada correctamente');
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
try {
|
try {
|
||||||
await FirebaseFirestore.instance
|
await FirebaseFirestore.instance
|
||||||
@@ -393,10 +387,8 @@ class ProfessionalProfileScreenState extends State<ProfessionalProfileScreen> {
|
|||||||
|
|
||||||
if (userSnapshot.exists) {
|
if (userSnapshot.exists) {
|
||||||
await userRef.update({'imgEspecializaciones': photoPaths});
|
await userRef.update({'imgEspecializaciones': photoPaths});
|
||||||
print('¡Imágenes de especializaciones actualizadas correctamente!');
|
|
||||||
} else {
|
} else {
|
||||||
await userRef.set({'imgEspecializaciones': photoPaths});
|
await userRef.set({'imgEspecializaciones': photoPaths});
|
||||||
print('¡Imágenes de especializaciones agregadas correctamente!');
|
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
print(
|
print(
|
||||||
|
|||||||
@@ -347,10 +347,8 @@ class _ProfessionalProfileWebScreenState
|
|||||||
|
|
||||||
if (userSnapshot.exists) {
|
if (userSnapshot.exists) {
|
||||||
await userRef.update({'imgCedula': image});
|
await userRef.update({'imgCedula': image});
|
||||||
print('¡Imagen de cédula actualizada correctamente!');
|
|
||||||
} else {
|
} else {
|
||||||
await userRef.set({'imgCedula': image});
|
await userRef.set({'imgCedula': image});
|
||||||
print('¡Imagen de cédula agregada correctamente!');
|
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
print('Error al agregar o actualizar la imagen de cédula: $e');
|
print('Error al agregar o actualizar la imagen de cédula: $e');
|
||||||
@@ -364,10 +362,8 @@ class _ProfessionalProfileWebScreenState
|
|||||||
|
|
||||||
if (userSnapshot.exists) {
|
if (userSnapshot.exists) {
|
||||||
await userRef.update({'imgCertificado': image});
|
await userRef.update({'imgCertificado': image});
|
||||||
print('¡Imagen de certificado actualizada correctamente!');
|
|
||||||
} else {
|
} else {
|
||||||
await userRef.set({'imgCertificado': image});
|
await userRef.set({'imgCertificado': image});
|
||||||
print('¡Imagen de certificado agregada correctamente!');
|
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
print('Error al agregar o actualizar la imagen de certificado: $e');
|
print('Error al agregar o actualizar la imagen de certificado: $e');
|
||||||
@@ -380,8 +376,6 @@ class _ProfessionalProfileWebScreenState
|
|||||||
.collection('users')
|
.collection('users')
|
||||||
.doc(uid)
|
.doc(uid)
|
||||||
.update({'photo': image});
|
.update({'photo': image});
|
||||||
|
|
||||||
print('imagen actualizada correctamente');
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
try {
|
try {
|
||||||
await FirebaseFirestore.instance
|
await FirebaseFirestore.instance
|
||||||
@@ -403,14 +397,9 @@ class _ProfessionalProfileWebScreenState
|
|||||||
|
|
||||||
if (userSnapshot.exists) {
|
if (userSnapshot.exists) {
|
||||||
await userRef.update({'imgEspecializaciones': filePaths});
|
await userRef.update({'imgEspecializaciones': filePaths});
|
||||||
|
|
||||||
print('¡Imágenes de especializaciones actualizadas correctamente!');
|
|
||||||
} else {
|
} else {
|
||||||
await userRef.set({'imgEspecializaciones': filePaths});
|
await userRef.set({'imgEspecializaciones': filePaths});
|
||||||
print('¡Imágenes de especializaciones agregadas correctamente!');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
print('Archivos de especializaciones actualizados correctamente');
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
print('Error al actualizar los archivos de especializaciones: $e');
|
print('Error al actualizar los archivos de especializaciones: $e');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -87,7 +87,6 @@ class _ProfileScreenState extends State<ProfileScreen> {
|
|||||||
.doc(uid)
|
.doc(uid)
|
||||||
.update({'photo': image});
|
.update({'photo': image});
|
||||||
|
|
||||||
print('imagen actualizada correctamente');
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
try {
|
try {
|
||||||
await FirebaseFirestore.instance
|
await FirebaseFirestore.instance
|
||||||
@@ -246,7 +245,6 @@ class _ProfileScreenState extends State<ProfileScreen> {
|
|||||||
'name': newName,
|
'name': newName,
|
||||||
'lowerName': newName.toLowerCase(),
|
'lowerName': newName.toLowerCase(),
|
||||||
});
|
});
|
||||||
print('Nombre actualizado correctamente');
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
print('Error al actualizar el nombre: $e');
|
print('Error al actualizar el nombre: $e');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -303,8 +303,6 @@ class _ProfileProScreenState extends State<ProfileProScreen> {
|
|||||||
.collection('users')
|
.collection('users')
|
||||||
.doc(uid)
|
.doc(uid)
|
||||||
.update({'banner': image});
|
.update({'banner': image});
|
||||||
|
|
||||||
print('imagen actualizada correctamente');
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
try {
|
try {
|
||||||
await FirebaseFirestore.instance
|
await FirebaseFirestore.instance
|
||||||
|
|||||||
@@ -192,8 +192,6 @@ class _ProfileProWebScreenState extends State<ProfileProWebScreen> {
|
|||||||
.collection('users')
|
.collection('users')
|
||||||
.doc(uid)
|
.doc(uid)
|
||||||
.update({'banner': image});
|
.update({'banner': image});
|
||||||
|
|
||||||
print('imagen actualizada correctamente');
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
try {
|
try {
|
||||||
await FirebaseFirestore.instance
|
await FirebaseFirestore.instance
|
||||||
|
|||||||
@@ -153,7 +153,6 @@ class _ProfileWebScreenState extends State<ProfileWebScreen> {
|
|||||||
'name': newName,
|
'name': newName,
|
||||||
'lowerName': newName.toLowerCase(),
|
'lowerName': newName.toLowerCase(),
|
||||||
});
|
});
|
||||||
print('Nombre actualizado correctamente');
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
print('Error al actualizar el nombre: $e');
|
print('Error al actualizar el nombre: $e');
|
||||||
}
|
}
|
||||||
@@ -167,17 +166,15 @@ class _ProfileWebScreenState extends State<ProfileWebScreen> {
|
|||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (currentUser?.displayName != newName) {
|
|
||||||
try {
|
try {
|
||||||
await FirebaseAuth.instance.currentUser!.updateDisplayName(newName);
|
await FirebaseAuth.instance.currentUser!.updateDisplayName(newName);
|
||||||
await FirebaseFirestore.instance.collection('users').doc(uid).update({
|
await FirebaseFirestore.instance.collection('users').doc(uid).update({
|
||||||
'name': newName,
|
'name': newName,
|
||||||
'lowerName': newName.toLowerCase(),
|
'lowerName': newName.toLowerCase(),
|
||||||
});
|
});
|
||||||
print('Nombre actualizado correctamente');
|
} catch (e) {
|
||||||
} catch (e) {
|
print('Error al actualizar el nombre: $e');
|
||||||
print('Error al actualizar el nombre: $e');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (currentUser?.email != newEmail) {
|
if (currentUser?.email != newEmail) {
|
||||||
@@ -202,7 +199,6 @@ class _ProfileWebScreenState extends State<ProfileWebScreen> {
|
|||||||
await FirebaseFirestore.instance.collection('users').doc(uid).update({
|
await FirebaseFirestore.instance.collection('users').doc(uid).update({
|
||||||
'city': selectedCity,
|
'city': selectedCity,
|
||||||
});
|
});
|
||||||
print('Ciudad actualizada correctamente');
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
print('Error al actualizar la ciudad: $e');
|
print('Error al actualizar la ciudad: $e');
|
||||||
}
|
}
|
||||||
@@ -243,8 +239,6 @@ class _ProfileWebScreenState extends State<ProfileWebScreen> {
|
|||||||
.collection('users')
|
.collection('users')
|
||||||
.doc(uid)
|
.doc(uid)
|
||||||
.update({'photo': image});
|
.update({'photo': image});
|
||||||
|
|
||||||
print('imagen actualizada correctamente');
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
try {
|
try {
|
||||||
await FirebaseFirestore.instance
|
await FirebaseFirestore.instance
|
||||||
|
|||||||
@@ -906,7 +906,6 @@ class _ServiceScreenState extends State<ServiceScreen> {
|
|||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
||||||
const SizedBox(height: 15),
|
const SizedBox(height: 15),
|
||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
|
|||||||
@@ -58,7 +58,6 @@ class SolicitudScreen extends StatelessWidget {
|
|||||||
event.id = element.id;
|
event.id = element.id;
|
||||||
eventos.add(event);
|
eventos.add(event);
|
||||||
}
|
}
|
||||||
print('eventos $eventos');
|
|
||||||
return eventos;
|
return eventos;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
print('Error getByProId $e');
|
print('Error getByProId $e');
|
||||||
|
|||||||
Reference in New Issue
Block a user