From 9925e124473e482b7c7ec0094c51e2fec18bb528 Mon Sep 17 00:00:00 2001 From: Hamza-Ayed Date: Sun, 7 Jul 2024 12:25:20 +0300 Subject: [PATCH] 7/7/1 --- .env | 131 ++++++++---------- lib/constant/api_key.dart | 15 +- lib/constant/char_map.dart | 119 ++++++++-------- lib/controller/auth/login_controller.dart | 2 +- lib/controller/auth/register_controller.dart | 33 +++-- .../home/map_passenger_controller.dart | 13 +- .../map_widget.dart/left_main_menu_icons.dart | 38 ++--- .../map_widget.dart/ride_begin_passenger.dart | 2 +- 8 files changed, 189 insertions(+), 164 deletions(-) diff --git a/.env b/.env index 0de5c3c..bb4b7b6 100644 --- a/.env +++ b/.env @@ -30,86 +30,69 @@ passwordPayMob='g@nkD2#99!hD_.wXrXlBl' integrationIdPayMob=0237730XrXlBl payMobApikey='MDrGqKEWS1rVqHvEPDvPjJ7vZDBExrO7S3BEBgrlfUwTA3i5RnP5ZnvoL3M2S9rEBgrlNTdexH5pTPf7NJrvy1reZJv1Tn7zf7vTIDywjHg1C7Ley38HTDyNA3v7TPfdxJrax1rwPmPtMJyzqKEYZeghq3MuLUrFH3A1AgHcH15CZ9UaZTLOxnw0BTdzHHrBArisZerUMUUzZ1BnBeEijHvNjYLnS1BUICMhSmPhA15ifHyVqKEMHWyKLbyuIPvcH9UeL3vZyDf=XrXlBl' integrationIdPayMobWallet=0237739XrXlBl -ocpApimSubscriptionKey=17373j50x53u07q0830634f512j731yuXrXlBl +ocpApimSubscriptionKey=0f5dacccdbce4131b1a5f952996302e3 smsPasswordEgypt="J)Vh=qb/@MXrXlBl" chatGPTkeySeferNew4=zg-vlie-2l1ZlpxiLJ6wQOvbb4TnC9XrxgUEyVQIu6TID4qP4FUUqoS5XrXlBl anthropicAIkeySeferNew=zg-qbc-qvo39-n4VdMQ5nuJeIYhMN4PDYr7qox3-t2i1Lh7aNTDfYF-Gf8whUJZCs47EeelKn8_UcmUMmiSLaf0UJg0DvUlQrDt-76CRrkQQXrXlBl llama3Key=kzg_uTXy3e9DBbCQ1FnMGxYwTKysx9US1burxJj4fFwOje4LZBUFKJS1XrXlBl -payMobOutClientSecrret='wcP2bUQBRYy254hjCJhNlOatefDzifNDnXRQSiu6UhhcXfZdyCyiBaUr9JQpI2mlIkKVRyoNliuBv1P8QZPLveiZrUeYBLmS6wuVhbQEJku1B5MHhgbB0AboqaOMpqBcXrXlBl' -payMobOutClient_id='gnBTH5kGzR4RGPwzEUxIKCJx9SA5zAwpXiX4vaiTXrXlBl' -payMobOutPassword='#f9vZtxHdIGvAbl5wWMQkvgZTXrXlBl' +payMobOutClientSecrret='xyjjRlahJM0Xc38WjApCOh8bvgL9slFpNdM9YeCu9AhLqboKMPtmSvc2N9O4tXxFLV2JAV6stBSTAGFGCVubGe6MNpc7MzJnZ3SiT6GpavBoCLWkUvVbdSDaM0zHvuBOXrXlBl' +payMobOutClient_id='Z05ut48dVkS2gI2zenFFcKsfDKfHAU0WELqKyJ0LXrXlBl' +payMobOutPassword='D2zJFxkE#LN3vz38z2dYxpNfWXrXlBl' payMobOutUserName='zjujl_qvo_fwjfgjlXrXlBl' +keyOfApp=nqryjp@1737wqnmqqsjyzjujljksvceiXrXlBl +a=q +b=x +c=f +d=y +e=j +f=u +g=k +h=w +i=o +j=e +k=g +l=r +m=n +n=b +o=i +p=v +q=a +r=l +s=z +t=c +u=h +v=p +w=t +x=d +y=s +z=m - -import '../controller/functions/encrypt.dart'; -import '../env/env.dart'; -import 'char_map.dart'; -import 'credential.dart'; - -class AK { - static final AC a = AC(); - static final String publishableKey = - KeyEncryption.decryptKey(Env.stripePublishableKe); - static final String secretKey = KeyEncryption.decryptKey(Env.secretKey); - static final String basicAuthCredentials = - KeyEncryption.decryptKey(Env.basicAuthCredentials); - static final String accountSIDTwillo = - KeyEncryption.decryptKey(Env.accountSIDTwillo); - static final String serverAPI = KeyEncryption.decryptKey(Env.serverAPI); - static final String mapAPIKEY = KeyEncryption.decryptKey(Env.mapAPIKEY); - static final String twilloRecoveryCode = - KeyEncryption.decryptKey(Env.twilloRecoveryCode); - static final String authTokenTwillo = - KeyEncryption.decryptKey(Env.authTokenTwillo); - static final String chatGPTkey = KeyEncryption.decryptKey(Env.chatGPTkey); - static final String transactionCloude = - KeyEncryption.decryptKey(Env.transactionCloude); - static final String visionApi = KeyEncryption.decryptKey(Env.visionApi); - static final String chatGPTkeySefer = - KeyEncryption.decryptKey(Env.chatGPTkeySefer); - static final String chatGPTkeySeferNew = - KeyEncryption.decryptKey(Env.chatGPTkeySeferNew); - static final String serverPHP = Env.serverPHP; - static final String llamaKey = KeyEncryption.decryptKey(Env.llamaKey); - static final String cohere = KeyEncryption.decryptKey(Env.cohere); - static final String claudeAiAPI = KeyEncryption.decryptKey(Env.claudeAiAPI); - static final String payPalClientId = - KeyEncryption.decryptKey(Env.payPalClientId); - static final String payPalSecret = KeyEncryption.decryptKey(Env.payPalSecret); - static final String geminiApi = KeyEncryption.decryptKey(Env.geminiApi); - static final String agoraAppId = KeyEncryption.decryptKey(Env.agoraAppId); - static final String agoraAppCertificate = - KeyEncryption.decryptKey(Env.agoraAppCertificate); - static final String payPalClientIdLive = - KeyEncryption.decryptKey(Env.payPalClientIdLive); - static final String payPalSecretLive = - KeyEncryption.decryptKey(Env.payPalSecretLive); - static final String integrationIdPayMob = - KeyEncryption.decryptKey(Env.integrationIdPayMob); - static final String passwordPayMob = - KeyEncryption.decryptKey(Env.passwordPayMob); - static final String usernamePayMob = - KeyEncryption.decryptKey(Env.usernamePayMob); - static final String payMobApikey = KeyEncryption.decryptKey(Env.payMobApikey); - static final String integrationIdPayMobWallet = - KeyEncryption.decryptKey(Env.integrationIdPayMobWallet); - static final String smsPasswordEgypt = - KeyEncryption.decryptKey(Env.smsPasswordEgypt); - static final String ocpApimSubscriptionKey = Env.ocpApimSubscriptionKey; - static final String chatGPTkeySeferNew4 = - KeyEncryption.decryptKey(Env.chatGPTkeySeferNew4); - static final String anthropicAIkeySeferNew = - KeyEncryption.decryptKey(Env.anthropicAIkeySeferNew); - static final String llama3Key = KeyEncryption.decryptKey(Env.llama3Key); - static final String payMobOutClientSecrret = - KeyEncryption.decryptKey(Env.payMobOutClientSecrret); - static final String payMobOutClient_id = - KeyEncryption.decryptKey(Env.payMobOutClient_id); - static final String payMobOutPassword = - KeyEncryption.decryptKey(Env.payMobOutPassword); - static final String payMobOutUserName = - KeyEncryption.decryptKey(Env.payMobOutUserName); -} +A=Q +B=X +C=F +D=Y +E=J +F=U +G=K +H=W +I=O +J=E +K=G +L=R +M=N +N=B +O=I +P=V +Q=A +R=L +S=Z +T=C +U=H +V=P +W=T +X=D +Y=S +Z=M \ No newline at end of file diff --git a/lib/constant/api_key.dart b/lib/constant/api_key.dart index 03bdf83..3cea15d 100644 --- a/lib/constant/api_key.dart +++ b/lib/constant/api_key.dart @@ -54,10 +54,21 @@ class AK { a.r(a.r(a.r(Env.integrationIdPayMobWallet, cn), cC), cs); static final String smsPasswordEgypt = a.r(a.r(a.r(Env.smsPasswordEgypt, cn), cC), cs); - static final String ocpApimSubscriptionKey = - a.r(a.r(a.r(Env.ocpApimSubscriptionKey, cn), cC), cs); + static final String ocpApimSubscriptionKey = Env.ocpApimSubscriptionKey; static final String chatGPTkeySeferNew4 = a.r(a.r(a.r(Env.chatGPTkeySeferNew4, cn), cC), cs); static final String anthropicAIkeySeferNew = a.r(a.r(a.r(Env.anthropicAIkeySeferNew, cn), cC), cs); + static final String llama3Key = a.r(a.r(a.r(Env.llama3Key, cn), cC), cs); + static final String payMobOutClientSecrret = + a.r(a.r(a.r(Env.payMobOutClientSecrret, cn), cC), cs); + static final String payMobOutClient_id = + a.r(a.r(a.r(Env.payMobOutClient_id, cn), cC), cs); + static final String payMobOutPassword = + a.r(a.r(a.r(Env.payMobOutPassword, cn), cC), cs); + static final String payMobOutUserName = + a.r(a.r(a.r(Env.payMobOutUserName, cn), cC), cs); + +/////////// + static final String keyOfApp = a.r(a.r(a.r(Env.keyOfApp, cn), cC), cs); } diff --git a/lib/constant/char_map.dart b/lib/constant/char_map.dart index d6a6ee7..ca5ee37 100644 --- a/lib/constant/char_map.dart +++ b/lib/constant/char_map.dart @@ -1,3 +1,66 @@ +import '../env/env.dart'; + +Map cs = { + "a": Env.a, + "b": Env.b, + "c": Env.c, + "d": Env.d, + "e": Env.e, + "f": Env.f, + "g": Env.g, + "h": Env.h, + "i": Env.i, + "j": Env.j, + "k": Env.k, + "l": Env.l, + "m": Env.m, + "n": Env.n, + "o": Env.o, + "p": Env.p, + "q": Env.q, + "r": Env.r, + "s": Env.s, + "t": Env.t, + "u": Env.u, + "v": Env.v, + "w": Env.w, + "x": Env.x, + "y": Env.y, + "z": Env.z, +}; +Map cC = { + "A": Env.A, + "B": Env.B, + "C": Env.C, + "D": Env.D, + "E": Env.E, + "F": Env.F, + "G": Env.G, + "H": Env.H, + "I": Env.I, + "J": Env.J, + "K": Env.K, + "L": Env.L, + "M": Env.M, + "N": Env.N, + "O": Env.O, + "P": Env.P, + "Q": Env.Q, + "R": Env.R, + "S": Env.S, + "T": Env.T, + "U": Env.U, + "V": Env.V, + "W": Env.W, + "X": Env.X, + "Y": Env.Y, + "Z": Env.Z +}; + +// + +// + Map cn = { "0": "3", "1": "7", @@ -10,59 +73,3 @@ Map cn = { "8": "4", "9": "8" }; -Map cs = { - "a": "q", - "b": "x", - "c": "f", - "d": "y", - "e": "j", - "f": "u", - "g": "k", - "h": "w", - "i": "o", - "j": "e", - "k": "g", - "l": "r", - "m": "n", - "n": "b", - "o": "i", - "p": "v", - "q": "a", - "r": "l", - "s": "z", - "t": "c", - "u": "h", - "v": "p", - "w": "t", - "x": "d", - "y": "s", - "z": "m" -}; -Map cC = { - "A": "Q", - "B": "X", - "C": "F", - "D": "Y", - "E": "J", - "F": "U", - "G": "K", - "H": "W", - "I": "O", - "J": "E", - "K": "G", - "L": "R", - "M": "N", - "N": "B", - "O": "I", - "P": "V", - "Q": "A", - "R": "L", - "S": "Z", - "T": "C", - "U": "H", - "V": "P", - "W": "T", - "X": "D", - "Y": "S", - "Z": "M" -}; diff --git a/lib/controller/auth/login_controller.dart b/lib/controller/auth/login_controller.dart index 02c04c8..eca3c09 100644 --- a/lib/controller/auth/login_controller.dart +++ b/lib/controller/auth/login_controller.dart @@ -74,7 +74,7 @@ class LoginController extends GetxController { var jsonDecoeded = jsonDecode(res); if (jsonDecoeded.isNotEmpty) { if (jsonDecoeded['status'] == 'success' && - jsonDecoeded['data'][0]['verified'] == 1) { + jsonDecoeded['data'][0]['verified'].toString() == '1') { // box.write(BoxName.isVerified, '1'); box.write(BoxName.email, jsonDecoeded['data'][0]['email']); diff --git a/lib/controller/auth/register_controller.dart b/lib/controller/auth/register_controller.dart index 17bd246..d635832 100644 --- a/lib/controller/auth/register_controller.dart +++ b/lib/controller/auth/register_controller.dart @@ -93,15 +93,28 @@ class RegisterController extends GetxController { .post(link: AppLink.checkPhoneNumberISVerfiedPassenger, payload: { 'phone_number': '+2${phoneController.text}', }); - // if (responseCheker != 'failure') { - var d = jsonDecode(responseCheker); - if (d['message'][0]['verified'].toString() == '1') { - Get.snackbar('Phone number is verified before'.tr, '', - backgroundColor: AppColor.greenColor); - box.write(BoxName.isVerified, '1'); - box.write(BoxName.phone, '+2${phoneController.text}'); - Get.offAll(const MapPagePassenger()); - // } + if (responseCheker != 'failure') { + var d = jsonDecode(responseCheker); + if (d['message'][0]['verified'].toString() == '1') { + Get.snackbar('Phone number is verified before'.tr, '', + backgroundColor: AppColor.greenColor); + box.write(BoxName.isVerified, '1'); + box.write(BoxName.phone, '+2${phoneController.text}'); + Get.offAll(const MapPagePassenger()); + } else { + await CRUD().post(link: AppLink.sendVerifyOtpMessage, payload: { + 'phone_number': '+2${phoneController.text}', + 'token': randomNumber.toString(), + }); + + await smsEgyptController.sendSmsEgypt( + phoneController.text.toString(), randomNumber.toString()); + isSent = true; + remainingTime = 300; // Reset to 5 minutes + startTimer(); + isLoading = false; + update(); + } } else { await CRUD().post(link: AppLink.sendVerifyOtpMessage, payload: { 'phone_number': '+2${phoneController.text}', @@ -115,6 +128,8 @@ class RegisterController extends GetxController { startTimer(); isLoading = false; update(); + + // Get.snackbar(responseCheker, 'message'); } } } diff --git a/lib/controller/home/map_passenger_controller.dart b/lib/controller/home/map_passenger_controller.dart index 2fb39b3..505b2d5 100644 --- a/lib/controller/home/map_passenger_controller.dart +++ b/lib/controller/home/map_passenger_controller.dart @@ -894,8 +894,9 @@ class MapPassengerController extends GetxController { try { Uri uri = Uri.parse(link); - if (uri.host == 'maps.google.com') { + if (uri.host == 'maps.google.com' || uri.host == 'www.google.com') { String? query = uri.queryParameters['q']; + query ??= uri.queryParameters['ll']; if (query != null) { List coordinates = query.split(','); @@ -910,6 +911,9 @@ class MapPassengerController extends GetxController { }; } } + } else if (uri.host == 'goo.gl') { + // Shortened URLs might need to be expanded first + // Implement additional logic to expand the URL here if necessary } } catch (e) { print('Error parsing WhatsApp location link: $e'); @@ -1164,7 +1168,7 @@ class MapPassengerController extends GetxController { } void delayAndFetchRideStatus(String rideId) { - Timer(const Duration(milliseconds: 200), () async { + Timer(const Duration(seconds: 1), () async { if (shouldFetch) { if (remainingTimeToPassengerFromDriverAfterApplied > 0) { var res = await getRideStatus(rideId); @@ -1197,7 +1201,7 @@ class MapPassengerController extends GetxController { } void delayAndFetchRideStatusForAllDriverAvailable(String rideId) { - Timer(const Duration(milliseconds: 200), () async { + Timer(const Duration(milliseconds: 1000), () async { if (shouldFetch) { var res = await getRideStatus(rideId); // var decod = jsonDecode(res); @@ -1532,8 +1536,8 @@ class MapPassengerController extends GetxController { await Future.delayed(const Duration(seconds: 4)); if (rideTimerBegin == true || statusRide == 'Apply') { await getDriverCarsLocationToPassengerAfterApplied(); + reloadMarkerDriverCarsLocationToPassengerAfterApplied(); } - reloadMarkerDriverCarsLocationToPassengerAfterApplied(); } } @@ -2107,6 +2111,7 @@ class MapPassengerController extends GetxController { reloadMarkers() async { if (statusRide == 'wait') { + clearMarkersExceptStartEnd(); await getCarsLocationByPassengerAndReloadMarker(); await getNearestDriverByPassengerLocation(); } diff --git a/lib/views/home/map_widget.dart/left_main_menu_icons.dart b/lib/views/home/map_widget.dart/left_main_menu_icons.dart index 2abf52f..3c479e0 100644 --- a/lib/views/home/map_widget.dart/left_main_menu_icons.dart +++ b/lib/views/home/map_widget.dart/left_main_menu_icons.dart @@ -1,3 +1,5 @@ +import 'package:SEFER/constant/box_name.dart'; +import 'package:SEFER/views/auth/sms_verfy_page.dart'; import 'package:flutter/material.dart'; import 'package:get/get.dart'; import 'package:google_maps_flutter/google_maps_flutter.dart'; @@ -6,6 +8,7 @@ import '../../../constant/colors.dart'; import '../../../constant/credential.dart'; import '../../../controller/functions/tts.dart'; import '../../../controller/home/map_passenger_controller.dart'; +import '../../../main.dart'; GetBuilder leftMainMenuIcons() { final textToSpeechController = Get.put(TextToSpeechController()); @@ -82,23 +85,24 @@ GetBuilder leftMainMenuIcons() { const SizedBox( width: 5, ), - // AnimatedContainer( - // duration: const Duration(microseconds: 200), - // width: controller.widthMapTypeAndTraffic, - // decoration: BoxDecoration( - // color: AppColor.secondaryColor, - // border: Border.all(), - // borderRadius: BorderRadius.circular(15)), - // child: IconButton( - // onPressed: () async { - // makePhoneCall('+201023248456'); - // }, - // icon: const Icon( - // Icons.voice_chat, - // size: 29, - // ), - // ), - // ), + AnimatedContainer( + duration: const Duration(microseconds: 200), + width: controller.widthMapTypeAndTraffic, + decoration: BoxDecoration( + color: AppColor.secondaryColor, + border: Border.all(), + borderRadius: BorderRadius.circular(15)), + child: IconButton( + onPressed: () async { + box.remove(BoxName.isVerified); + Get.to(() => SmsSignupEgypt()); + }, + icon: const Icon( + Icons.voice_chat, + size: 29, + ), + ), + ), // AnimatedContainer( // duration: const Duration(microseconds: 200), // width: controller.widthMapTypeAndTraffic, diff --git a/lib/views/home/map_widget.dart/ride_begin_passenger.dart b/lib/views/home/map_widget.dart/ride_begin_passenger.dart index 96364ce..4759cfb 100644 --- a/lib/views/home/map_widget.dart/ride_begin_passenger.dart +++ b/lib/views/home/map_widget.dart/ride_begin_passenger.dart @@ -298,7 +298,7 @@ class RideBeginPassenger extends StatelessWidget { }, icon: const Icon( Foundation.record, - color: AppColor.yellowColor, + color: AppColor.blueColor, ), ), ),