7/31/1
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import 'package:SEFER/constant/box_name.dart';
|
||||
import 'package:SEFER/constant/colors.dart';
|
||||
import 'package:SEFER/controller/auth/captin/login_captin_controller.dart';
|
||||
import 'package:SEFER/main.dart';
|
||||
import 'package:SEFER/views/auth/captin/cards/sms_signup.dart';
|
||||
@@ -35,22 +36,69 @@ class GoogleSignInHelper {
|
||||
}
|
||||
}
|
||||
|
||||
// static Future<GoogleSignInAccount?> signInFromLogin() async {
|
||||
// // try {
|
||||
// // final GoogleSignInAccount? googleUser = await _googleSignIn.signIn();
|
||||
// // if (googleUser != null) {
|
||||
// // await _handleSignUp(googleUser);
|
||||
// // // if (box.read(BoxName.countryCode) == 'Egypt') {
|
||||
// // await Get.find<LoginDriverController>().loginUsingCredentials(
|
||||
// // box.read(BoxName.driverID).toString(),
|
||||
// // box.read(BoxName.emailDriver).toString(),
|
||||
// // );
|
||||
// // // } else if (box.read(BoxName.countryCode) == 'Jordan') {
|
||||
// // // // Get.to(() => AiPage());
|
||||
// // // }
|
||||
// // }
|
||||
// // return googleUser;
|
||||
// // } catch (error) {
|
||||
// // return null;
|
||||
// // }
|
||||
// try {
|
||||
// final GoogleSignInAccount? googleUser = await _googleSignIn.signIn();
|
||||
// if (googleUser != null) {
|
||||
// // Handle sign-up logic
|
||||
// await _handleSignUp(googleUser);
|
||||
//
|
||||
// // Get country code
|
||||
// final String countryCode = box.read(BoxName.countryCode).toString();
|
||||
// final String driverID = box.read(BoxName.driverID).toString();
|
||||
// final String emailDriver = box.read(BoxName.emailDriver).toString();
|
||||
//
|
||||
// // Log-in using credentials based on country code
|
||||
// if (countryCode == 'Egypt') {
|
||||
// await Get.find<LoginDriverController>()
|
||||
// .loginUsingCredentials(driverID, emailDriver);
|
||||
// } else if (countryCode == 'Jordan') {
|
||||
// // Add logic for Jordan if needed, e.g., navigate to AiPage
|
||||
// // Get.to(() => AiPage());
|
||||
// }
|
||||
// }
|
||||
// return googleUser;
|
||||
// } catch (error) {
|
||||
// Get.snackbar('Google Sign-In error', '$error',
|
||||
// backgroundColor: AppColor.redColor);
|
||||
// // Log error details
|
||||
// print('Google Sign-In error: $error');
|
||||
// return null;
|
||||
// }
|
||||
// }
|
||||
static Future<GoogleSignInAccount?> signInFromLogin() async {
|
||||
try {
|
||||
final GoogleSignInAccount? googleUser = await _googleSignIn.signIn();
|
||||
if (googleUser != null) {
|
||||
await _handleSignUp(googleUser);
|
||||
// if (box.read(BoxName.countryCode) == 'Egypt') {
|
||||
await Get.find<LoginDriverController>().loginUsingCredentials(
|
||||
box.read(BoxName.driverID).toString(),
|
||||
box.read(BoxName.emailDriver).toString(),
|
||||
);
|
||||
// } else if (box.read(BoxName.countryCode) == 'Jordan') {
|
||||
// // Get.to(() => AiPage());
|
||||
// }
|
||||
}
|
||||
return googleUser;
|
||||
} catch (error) {
|
||||
Get.snackbar('Google Sign-In error', '$error',
|
||||
backgroundColor: AppColor.redColor);
|
||||
// Log error details
|
||||
print('Google Sign-In error: $error');
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user