Update: 2026-06-29 00:07:33

This commit is contained in:
Hamza-Ayed
2026-06-29 00:07:33 +03:00
parent 24da2bc7ca
commit d695a4e812
15 changed files with 190 additions and 60 deletions

View File

@@ -526,4 +526,15 @@ class AppLink {
static String get checkStatus => "https://sms.kazumi.me/api/sms/check-status";
static String get updatePhoneInvalidSMSPassenger =>
"$server/auth/sms/updatePhoneInvalidSMSPassenger.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 '';
}
}

View File

@@ -23,6 +23,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);