Update: 2026-06-29 00:07:33
This commit is contained in:
@@ -622,4 +622,15 @@ class AppLink {
|
||||
"$serviceApp/getComplaintAllData.php";
|
||||
static String get getComplaintAllDataForDriver =>
|
||||
"$serviceApp/getComplaintAllDataForDriver.php";
|
||||
|
||||
static String detectCountryFromPhone(String phone) {
|
||||
final clean = phone.replaceAll(RegExp(r'[^0-9]'), '');
|
||||
if (clean.startsWith('962')) return 'Jordan';
|
||||
if (clean.startsWith('963')) return 'Syria';
|
||||
if (clean.startsWith('20')) return 'Egypt';
|
||||
if (clean.startsWith('07') || clean.startsWith('7')) return 'Jordan';
|
||||
if (clean.startsWith('09') || clean.startsWith('9')) return 'Syria';
|
||||
if (clean.startsWith('01') || clean.startsWith('1')) return 'Egypt';
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,6 +24,10 @@ class PhoneAuthHelper {
|
||||
/// Sends an OTP to the provided phone number.
|
||||
static Future<bool> sendOtp(String phoneNumber) async {
|
||||
try {
|
||||
final detectedCountry = AppLink.detectCountryFromPhone(phoneNumber);
|
||||
if (detectedCountry.isNotEmpty) {
|
||||
await box.write(BoxName.countryCode, detectedCountry);
|
||||
}
|
||||
final fixedPhone = CountryLogic.formatCurrentCountryPhone(phoneNumber);
|
||||
Log.print('fixedPhone: $fixedPhone');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user