ciudad
This commit is contained in:
@@ -27,9 +27,7 @@ class AuthenticationRepository extends GetxController {
|
||||
}
|
||||
|
||||
_setInitialScreen(User? user) {
|
||||
user == null
|
||||
? Get.offAll(() => const LoginScreen())
|
||||
: Get.offAll(() => const WelcomeScreen());
|
||||
user == null ? Get.offAll(LoginScreen()) : Get.offAll(WelcomeScreen());
|
||||
}
|
||||
|
||||
Future<void> phoneAuthentication(String phoneNo) async {
|
||||
@@ -76,8 +74,8 @@ class AuthenticationRepository extends GetxController {
|
||||
email: email, password: password);
|
||||
|
||||
firebaseUser.value != null
|
||||
? Get.offAll(() => WelcomeScreen())
|
||||
: Get.to(() => LoginScreen());
|
||||
? Get.offAll(WelcomeScreen())
|
||||
: Get.to(LoginScreen());
|
||||
} on FirebaseAuthException catch (e) {
|
||||
final ex = SignUpWithEmailAndPasswordFailure.code(e.code);
|
||||
print('FIREBASE AUTH EXCEPTION - ${ex.message}');
|
||||
@@ -122,36 +120,13 @@ class AuthenticationRepository extends GetxController {
|
||||
return user?.uid;
|
||||
}
|
||||
|
||||
Future<void> addNameAndEmail(
|
||||
uid, String name, String email, String city) async {
|
||||
final usersCollection = FirebaseFirestore.instance.collection('users');
|
||||
await usersCollection.doc(uid).set({
|
||||
'name': name,
|
||||
'email': email,
|
||||
'city': city,
|
||||
});
|
||||
}
|
||||
|
||||
Future<String> getName(String uid) async {
|
||||
String name = '...';
|
||||
try {
|
||||
final snapshot =
|
||||
await FirebaseFirestore.instance.collection('users').doc(uid).get();
|
||||
final Map<String, dynamic>? data = snapshot.data();
|
||||
name = data?['name'] ?? '...';
|
||||
} catch (e) {
|
||||
print('Error getting name: $e');
|
||||
}
|
||||
return name;
|
||||
}
|
||||
|
||||
Future<String> getCity(String uid) async {
|
||||
String city = '...';
|
||||
String city = '';
|
||||
try {
|
||||
final snapshot =
|
||||
await FirebaseFirestore.instance.collection('users').doc(uid).get();
|
||||
final Map<String, dynamic>? data = snapshot.data();
|
||||
city = data?['city'] ?? '...';
|
||||
city = data?['city'] ?? '';
|
||||
} catch (e) {
|
||||
print('Error getting city: $e');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user