This commit is contained in:
Hamza-Ayed
2024-10-11 08:43:49 +03:00
parent 9b0caf3bed
commit 9854f80971
9 changed files with 295 additions and 98 deletions

View File

@@ -16,6 +16,7 @@ import 'package:SEFER/main.dart';
import 'package:SEFER/views/home/Captin/home_captain/home_captin.dart';
import 'package:location/location.dart';
import '../../../constant/info.dart';
import '../../../views/auth/captin/cards/egypt_card_a_i.dart';
import '../../firebase/firbase_messge.dart';
@@ -26,6 +27,7 @@ class LoginDriverController extends GetxController {
TextEditingController passwordController = TextEditingController();
bool isAgreeTerms = false;
bool isloading = false;
late int isTest = 1;
final FlutterSecureStorage _storage = const FlutterSecureStorage();
final location = Location();
void changeAgreeTerm() {
@@ -33,6 +35,35 @@ class LoginDriverController extends GetxController {
update();
}
@override
void onInit() async {
box.read(BoxName.isTest) == null ||
box.read(BoxName.isTest).toString() == '0'
? await getAppTester()
: null;
super.onInit();
}
getAppTester() async {
var res = await CRUD().get(
link: AppLink.getTesterApp,
payload: {'appPlatform': AppInformation.appName});
if (res != 'failure') {
var d = jsonDecode(res);
isTest = d['message'][0]['isTest'];
update();
} else {
return false;
}
}
updateAppTester(String appPlatform) async {
await CRUD().post(
link: AppLink.updateTesterApp, payload: {'appPlatform': appPlatform});
}
void saveAgreementTerms() {
box.write(BoxName.agreeTerms, 'agreed');
update();
@@ -75,6 +106,8 @@ class LoginDriverController extends GetxController {
if (jsonDecoeded['status'] == 'success' &&
jsonDecoeded['data'][0]['is_verified'].toString() == '1') {
box.write(BoxName.emailDriver, jsonDecoeded['data'][0]['email']);
box.write(BoxName.driverID, jsonDecoeded['data'][0]['id']);
box.write(BoxName.isTest, '1');
box.write(BoxName.gender, jsonDecoeded['data'][0]['gender']);
box.write(BoxName.phoneVerified,
jsonDecoeded['data'][0]['is_verified'].toString());
@@ -110,9 +143,7 @@ class LoginDriverController extends GetxController {
2002) {
box.write(BoxName.carTypeOfDriver, 'Awfar Car');
}
Log.print(
' box.write(BoxName.carTypeOfDriver: ${box.read(BoxName.carTypeOfDriver)}');
updateAppTester(AppInformation.appName);
var token = await CRUD().get(
link: AppLink.getDriverToken,

View File

@@ -178,6 +178,11 @@ class MyTranslation extends Translations {
"Enter phone": "أدخل رقم الهاتف",
"Send Invite": "إرسال دعوة",
"Show Invitations": "عرض الدعوات",
'We need access to your location to match you with nearby passengers and ensure accurate navigation.':
'نحتاج إلى الوصول إلى موقعك لمطابقتك مع الركاب القريبين وضمان التنقل الدقيق.',
'Please allow location access at all times to receive ride requests and ensure smooth service.':
'يرجى السماح بالوصول إلى الموقع في جميع الأوقات لتلقي طلبات الرحلات وضمان خدمة سلسة.',
"No invitation found yet!": "لم يتم العثور على دعوات حتى الآن!",
"Trip": "رحلة",
"Your Passenger Referral Code": "رمز الإحالة الخاص بالراكب",