BASE: Initialize Localization.
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import 'package:customer/themes/show_toast_dialog.dart';
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:firebase_auth/firebase_auth.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
@@ -18,12 +19,12 @@ class MobileLoginController extends GetxController {
|
||||
final countryCode = countryCodeController.value.text.trim();
|
||||
|
||||
if (mobile.isEmpty || mobile.length != 10) {
|
||||
ShowToastDialog.showToast("Please enter a valid 10-digit mobile number".tr);
|
||||
ShowToastDialog.showToast("Please enter a valid 10-digit mobile number".tr());
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
ShowToastDialog.showLoader("Sending OTP...".tr);
|
||||
ShowToastDialog.showLoader("Sending OTP...".tr());
|
||||
|
||||
await _auth.verifyPhoneNumber(
|
||||
phoneNumber: '$countryCode$mobile',
|
||||
@@ -33,9 +34,9 @@ class MobileLoginController extends GetxController {
|
||||
verificationFailed: (FirebaseAuthException e) {
|
||||
ShowToastDialog.closeLoader();
|
||||
if (e.code == 'invalid-phone-number') {
|
||||
ShowToastDialog.showToast("Invalid phone number".tr);
|
||||
ShowToastDialog.showToast("Invalid phone number".tr());
|
||||
} else {
|
||||
ShowToastDialog.showToast(e.message ?? "OTP verification failed".tr);
|
||||
ShowToastDialog.showToast(e.message ?? "OTP verification failed".tr());
|
||||
}
|
||||
},
|
||||
codeSent: (String verificationId, int? resendToken) {
|
||||
@@ -44,13 +45,13 @@ class MobileLoginController extends GetxController {
|
||||
},
|
||||
codeAutoRetrievalTimeout: (String verificationId) {
|
||||
ShowToastDialog.closeLoader();
|
||||
ShowToastDialog.showToast("OTP timed out. Please try again.".tr);
|
||||
ShowToastDialog.showToast("OTP timed out. Please try again.".tr());
|
||||
// Optional: Handle timeout
|
||||
},
|
||||
);
|
||||
} catch (e) {
|
||||
ShowToastDialog.closeLoader();
|
||||
ShowToastDialog.showToast("Something went wrong. Please try again.".tr);
|
||||
ShowToastDialog.showToast("Something went wrong. Please try again.".tr());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user