This commit is contained in:
Hamza-Ayed
2024-10-26 16:31:17 +03:00
parent d6200e28e0
commit 229646d664
24 changed files with 1098 additions and 879 deletions

View File

@@ -11,6 +11,7 @@ import 'package:google_sign_in/google_sign_in.dart';
import '../../onbording_page.dart';
import '../../views/auth/captin/ai_page.dart';
import '../functions/add_error.dart';
class GoogleSignInHelper {
static final GoogleSignIn _googleSignIn = GoogleSignIn(
@@ -81,7 +82,6 @@ class GoogleSignInHelper {
// Get.snackbar('Google Sign-In error', '$error',
// backgroundColor: AppColor.redColor);
// // Log error details
// print('Google Sign-In error: $error');
// return null;
// }
// }
@@ -97,9 +97,6 @@ class GoogleSignInHelper {
final emailDriver =
box.read(BoxName.emailDriver)?.toString() ?? 'Unknown Email';
// print('Driver ID: $driverID');
// print('Email Driver: $emailDriver');
await Get.find<LoginDriverController>()
.loginUsingCredentials(driverID, emailDriver);
}
@@ -109,26 +106,10 @@ class GoogleSignInHelper {
Get.snackbar('Google Sign-In error', '$error',
backgroundColor: AppColor.redColor);
addError(error.toString(), 'GoogleSignInAccount?> signInFromLogin()');
print('Google Sign-In error: $error');
return null;
}
}
addError(String error, where) async {
CRUD().post(link: AppLink.addError, payload: {
'error': error.toString(), // Example error description
'userId': box.read(BoxName.driverID) ??
box.read(BoxName.passengerID), // Example user ID
'userType': box.read(BoxName.driverID) != null
? 'Driver'
: 'passenger', // Example user type
'phone': box.read(BoxName.phone) ??
box.read(BoxName.phoneDriver), // Example phone number
'device': where
});
}
// Method to handle Google Sign-Out
static Future<void> signOut() async {
try {
@@ -172,10 +153,7 @@ class GoogleSignInHelper {
box.write(BoxName.emailDriver, user.email);
// box.write(BoxName.nameDriver, user.displayName);
// box.write(BoxName.driverPhotoUrl, user.photoUrl);
print(box.read(BoxName.driverID).toString());
print(
box.read(BoxName.emailDriver).toString(),
);
// Perform any additional sign-up tasks or API calls here
// For example, you can send the user data to your server for registration
}