Terms and Conditions
1 TERMS OF USE
-
By downloading, browsing, accessing or using the Mobile Application; “Sefer”, Users agree to be bound by these Terms and Conditions of Use. We reserve the right to amend these terms and conditions at any time. If the User disagrees with any of these Terms and Conditions of Use, the User must immediately discontinue their access to the Mobile Application and their use of the services offered on the Mobile Application. Continued use of the Mobile Application will constitute acceptance of these Terms and Conditions of Use, as may be amended from time to time.
+
By downloading, browsing, accessing or using the Mobile Application; “SPEED”, Users agree to be bound by these Terms and Conditions of Use. We reserve the right to amend these terms and conditions at any time. If the User disagrees with any of these Terms and Conditions of Use, the User must immediately discontinue their access to the Mobile Application and their use of the services offered on the Mobile Application. Continued use of the Mobile Application will constitute acceptance of these Terms and Conditions of Use, as may be amended from time to time.
2.1. DEFINITIONS
In these Terms and Conditions of Use, the following capitalized terms shall have the following meanings, except where the context otherwise requires:
-
“Mobile Application” or “Sefer” refers to the smartphone software through which the company mediates services between Users and Service Providers.
+
“Mobile Application” or “SPEED” refers to the smartphone software through which the company mediates services between Users and Service Providers.
"Account" means an account created by a User or a Service Provider on the Mobile Application as part of Registration.
“Service Providers” refers to the individuals or companies registered within the Company to provide products or services approved and mediated by the Company/Mobile Application and that are requested/purchased by “Users”. “Service Provider” means any one of them.
"Users" means users of the Mobile Application, including you and "User" means any one of them. “Users” also includes Service Providers using the Mobile Application version dedicated to the use of Service Providers.
@@ -87,8 +87,8 @@ class AppInformation {
"Redemption" means the act of redeeming such products or services.
"Register" means to create an Account on the Mobile Application and "Registration" means the act of creating such an Account.
"Services" means all the services provided by Service Providers via the Mobile Application and mediated by the Company to Users, and "Service" means any one of them.
-
2.2. WHAT IS THE MOBILE APPLICATION, “Sefer”?
-
The “Sefer” Mobile Application consists in a specialize service with the purpose to schedule/match the Service Provider with the User, however without creating any employee relationship with the Service Provider, meaning that the Mobile Application should be considered only as a service mediator with the purpose of scheduling/matching between Users and Service Providers for the latter to fulfill the service requested by Users. Through the system, the Company allows, totally free of charge, the Users to sign up and request the desired available services from Service Providers in a more efficient way than the conventional existing methods. The Service Providers, by their means, can register on the Mobile Application dedicated for Service Providers through the methods indicated by the Company, pending an evaluation from the Company and the necessary documentation when signing up in accordance with guidelines set by the Transportation General Authority (TGA) to provide services through the Mobile Application. The Service Provider will pay a profit margin fee determined by the Company -in knowledge of the Service Provider- per completed service. Users can pay their ride fare using Apple Pay as an additional payment method in Saudi Arabia on iPhones
+
2.2. WHAT IS THE MOBILE APPLICATION, “SPEED”?
+
The “SPEED” Mobile Application consists in a specialize service with the purpose to schedule/match the Service Provider with the User, however without creating any employee relationship with the Service Provider, meaning that the Mobile Application should be considered only as a service mediator with the purpose of scheduling/matching between Users and Service Providers for the latter to fulfill the service requested by Users. Through the system, the Company allows, totally free of charge, the Users to sign up and request the desired available services from Service Providers in a more efficient way than the conventional existing methods. The Service Providers, by their means, can register on the Mobile Application dedicated for Service Providers through the methods indicated by the Company, pending an evaluation from the Company and the necessary documentation when signing up in accordance with guidelines set by the Transportation General Authority (TGA) to provide services through the Mobile Application. The Service Provider will pay a profit margin fee determined by the Company -in knowledge of the Service Provider- per completed service. Users can pay their ride fare using Apple Pay as an additional payment method in Saudi Arabia on iPhones
3. GENERAL ISSUES ABOUT THE MOBILE APPLICATION AND THE SERVICES
3.1 Applicability of terms and conditions: The use of any Services and/or the Mobile Application and the making of any Redemptions are subject to these Terms and Conditions of Use.
@@ -143,7 +143,7 @@ class AppInformation {
7.3 We do not give any warranty that the Services and the Mobile Application are free from viruses or anything else which may have a harmful effect on any technology.
7.4 We reserve the right to change, modify, substitute, suspend or remove without notice any information or Services on the Mobile Application from time to time. Users’ access to the Mobile Application and/or the Services may also be occasionally restricted to allow for repairs, maintenance or the introduction of new facilities or services. We will attempt to restore such access as soon as we reasonably can. For the avoidance of doubt, we reserve the right to withdraw any information or Services from the Mobile Application at any time.
7.5 We reserve the right to block access to and/or to edit or remove any material which in our reasonable opinion may give rise to a breach of these Terms and Conditions of Use.
-
7.6 The acceptance and denial of the service request may occur at first by the Service Provider, who can accept or deny the service when receiving a notification for a request. The User may cancel the contract for any reason which may or may not apply cancellation fees for which the conditions and amount is determined and communicated by the Company. Both recognize that “Sefer” is not liable for any delays, cancellations, failure to cancel the contract and miscommunication between the User and the Service Provider, nor for any delay or failure in the delivery of services from the Service Provider.
+
7.6 The acceptance and denial of the service request may occur at first by the Service Provider, who can accept or deny the service when receiving a notification for a request. The User may cancel the contract for any reason which may or may not apply cancellation fees for which the conditions and amount is determined and communicated by the Company. Both recognize that “SPEED” is not liable for any delays, cancellations, failure to cancel the contract and miscommunication between the User and the Service Provider, nor for any delay or failure in the delivery of services from the Service Provider.
8. SUSPENSION AND TERMINATION
8.1 If the User uses (or others, with the User’s permission use) the Mobile Application, any Services in contravention of these Terms and Conditions of Use, we may suspend their use of the Services and/or Mobile Application.
@@ -194,7 +194,7 @@ class AppInformation {
(f) We will protect personal information by reasonable security safeguards against loss or theft, as well as unauthorized access, disclosure, copying, use or modification.
(g) The Company further reserves the right to use all legal means possible and to identify the Users, as well as to request, at any time, additional data and documents it considers appropriate in order to verify personal data informed by the user.
We are committed to conducting our business in accordance with these principles in order to ensure that the confidentiality of personal information is protected and maintained.
-
14.3 Social logins policy
Our Services offers you the ability to register and login using Facebook. Where you choose to do this, we will receive certain profile information about you from your social media provider. The profile Information may include your name and social token.
We will use the information we receive only to associate your social token with your Sefer account or for the purposes that are described in this privacy policy.
14.4 Account and data deletion
Based on the applicable laws of your country, you may have the right to request the deletion of your personal data in some circumstances. If you want to delete your account or personal data in the application, please contact us via e-mail: support@mobile-app.store. We will respond to your request within 30 days.
+
14.3 Social logins policy
Our Services offers you the ability to register and login using Facebook. Where you choose to do this, we will receive certain profile information about you from your social media provider. The profile Information may include your name and social token.
We will use the information we receive only to associate your social token with your SPEED account or for the purposes that are described in this privacy policy.
14.4 Account and data deletion
Based on the applicable laws of your country, you may have the right to request the deletion of your personal data in some circumstances. If you want to delete your account or personal data in the application, please contact us via e-mail: support@mobile-app.store. We will respond to your request within 30 days.
15. In-Ride Policy
15.1 Smoking Policy:
No smoking or other use of tobacco products (including, but not limited to, cigarettes, pipes, cigars, snuff, or chewing tobacco) is permitted during rides. No cigarette butts or other traces of smell, litter, or tobacco use should be present in the vehicle.
@@ -2335,7 +2335,7 @@ double nearestDistance = double.infinity;
Arabic (Egypt)
-
@@ -2359,8 +2359,8 @@ double nearestDistance = double.infinity;
Arabic (Egypt)
-
@@ -2455,8 +2455,8 @@ double nearestDistance = double.infinity;
Arabic (Egypt)
-

diff --git a/lib/constant/links.dart b/lib/constant/links.dart
index ce98cdd..1031013 100644
--- a/lib/constant/links.dart
+++ b/lib/constant/links.dart
@@ -8,17 +8,29 @@ class AppLink {
// static final String seferAlexandriaServer = Env.seferAlexandriaServer;
// static final String seferCairoServer = Env.seferCairoServer;
static String serverPHP = box.read('serverPHP');
- static String seferCairoServer = box.read('seferCairoServer');
- static String seferGizaServer = box.read('seferGizaServer');
- static String seferAlexandriaServer = box.read('seferAlexandriaServer');
- static String seferPaymentServer = box.read('seferPaymentServer');
+ // static String seferCairoServer =
+ // box.read(BoxName.locationName)[0]['server_link'];
+ // static String seferGizaServer = box.read(BoxName.serverChosen);
+ // static String seferAlexandriaServer = box.read(BoxName.serverChosen);
+ // static String seferPaymentServer = box.read('seferPaymentServer');
+
+ static String seferPaymentServer = box.read(BoxName.paymentLink);
+ // 'https://wallet.sefer.live/seferpw.shop/sefer/';
static String seferPaymentServer0 = box.read('seferPaymentServer');
// static const String seferGizaServer = 'https://gizasefer.online/sefer';
// static final String seferGizaServer = Env.seferGizaServer;
- static final String endPoint = box.read(BoxName.serverChosen);
- static final String server = Env.seferCairoServer;
+ // static final String endPoint = box.read(BoxName.serverChosen);
+ // static final String server = endPoint;
// static final String server = Env.serverPHP;
+ static final String endPoint =
+ box.read(BoxName.serverChosen) ?? box.read(BoxName.basicLink);
+ // 'https://server.sefer.live/sefer.click/sefer';
+ static final String server = endPoint;
+ static String seferCairoServer = endPoint;
+ static String seferGizaServer = box.read('Giza');
+ static String seferAlexandriaServer = box.read('Alexandria');
+
static String googleMapsLink = 'https://maps.googleapis.com/maps/api/';
static String searcMaps =
'https://autosuggest.search.hereapi.com/v1/autosuggest';
@@ -217,6 +229,9 @@ class AppLink {
//==================certifcate==========
static String location = '${box.read(BoxName.serverChosen)}/ride/location';
static String getCarsLocationByPassenger = "$location/get.php";
+
+ static String getLocationAreaLinks =
+ "https://server.sefer.live/sefer.click/sefer/ride/location/get_location_area_links.php";
static String addpassengerLocation = "$location/addpassengerLocation.php";
static String getCarsLocationByPassengerSpeed = "$location/getSpeed.php";
static String getCarsLocationByPassengerComfort = "$location/getComfort.php";
diff --git a/lib/controller/auth/google_sign.dart b/lib/controller/auth/google_sign.dart
index f02d2e6..df206c3 100644
--- a/lib/controller/auth/google_sign.dart
+++ b/lib/controller/auth/google_sign.dart
@@ -2,6 +2,7 @@ import 'dart:io';
import 'package:SEFER/constant/box_name.dart';
import 'package:SEFER/controller/auth/login_controller.dart';
+import 'package:SEFER/controller/functions/encrypt_decrypt.dart';
import 'package:SEFER/main.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
@@ -164,9 +165,11 @@ class GoogleSignInHelper {
static Future
_handleSignUp(GoogleSignInAccount user) async {
// Store driver information
box.write(BoxName.passengerID, user.id);
- box.write(BoxName.email, user.email);
- box.write(BoxName.name, user.displayName);
- box.write(BoxName.passengerPhotoUrl, user.photoUrl);
+ box.write(BoxName.email, encryptionHelper.encryptData(user.email));
+ box.write(BoxName.name,
+ encryptionHelper.encryptData(user.displayName.toString()));
+ box.write(BoxName.passengerPhotoUrl,
+ encryptionHelper.encryptData(user.photoUrl.toString()));
// Perform any additional sign-up tasks or API calls here
// For example, you can send the user data to your server for registration
diff --git a/lib/controller/auth/login_controller.dart b/lib/controller/auth/login_controller.dart
index 64b6c38..27b0d9a 100644
--- a/lib/controller/auth/login_controller.dart
+++ b/lib/controller/auth/login_controller.dart
@@ -6,6 +6,7 @@ import 'package:SEFER/controller/firebase/firbase_messge.dart';
import 'package:SEFER/controller/functions/add_error.dart';
import 'package:SEFER/views/auth/login_page.dart';
import 'package:SEFER/views/auth/sms_verfy_page.dart';
+import 'package:SEFER/views/widgets/mydialoug.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:SEFER/constant/box_name.dart';
@@ -16,6 +17,7 @@ import 'package:SEFER/views/home/map_page_passenger.dart';
import 'package:location/location.dart';
import '../../print.dart';
+import '../functions/encrypt_decrypt.dart';
import '../functions/package_info.dart';
class LoginController extends GetxController {
@@ -106,41 +108,56 @@ class LoginController extends GetxController {
box.write(BoxName.validity, d['validity']);
box.write(BoxName.isInstall, d['isInstall'] ?? 'none');
box.write(BoxName.isGiftToken, d['isGiftToken'] ?? 'none');
- box.write(BoxName.inviteCode, d['inviteCode'] ?? 'none');
+ box.write(
+ BoxName.inviteCode,
+ encryptionHelper.decryptData(d['inviteCode'].toString()) ??
+ 'none');
var token = await CRUD().get(link: AppLink.getTokens, payload: {
'passengerID': box.read(BoxName.passengerID).toString()
});
if (token != 'failure') {
- if (jsonDecode(token)['data'][0]['token'] !=
+ if (encryptionHelper.decryptData(
+ jsonDecode(token)['data'][0]['token'].toString()) !=
box.read(BoxName.tokenFCM)) {
- Get.put(FirebaseMessagesController()).sendNotificationToDriverMAP(
- 'token change'.tr,
- 'change device'.tr,
- jsonDecode(token)['data'][0]['token'].toString(),
- [],
- 'cancel.wav',
- );
+ MyDialog().getDialog('change device'.tr, 'token change'.tr,
+ () async {
+ List updatetoken = [
+ CRUD().post(
+ link: "${AppLink.server}/ride/firebase/add.php",
+ payload: {
+ 'token': box.read(BoxName.tokenFCM),
+ 'passengerID': box.read(BoxName.passengerID).toString()
+ }),
+ CRUD().post(
+ link:
+ "${AppLink.seferAlexandriaServer}/ride/firebase/add.php",
+ payload: {
+ 'token': box.read(BoxName.tokenFCM),
+ 'passengerID': box.read(BoxName.passengerID).toString()
+ }),
+ CRUD().post(
+ link: "${AppLink.seferGizaServer}/ride/firebase/add.php",
+ payload: {
+ 'token': box.read(BoxName.tokenFCM),
+ 'passengerID': box.read(BoxName.passengerID).toString()
+ }),
+ ];
+ // cameras = await availableCameras();
+ await Future.wait(updatetoken);
+ Get.put(FirebaseMessagesController())
+ .sendNotificationToDriverMAP(
+ 'token change'.tr,
+ 'change device'.tr,
+ encryptionHelper.decryptData(
+ jsonDecode(token)['data'][0]['token'].toString()),
+ [],
+ 'cancel.wav',
+ );
+ });
+
Future.delayed(const Duration(seconds: 1));
- await CRUD().post(
- link: "${AppLink.server}/ride/firebase/add.php",
- payload: {
- 'token': box.read(BoxName.tokenFCM),
- 'passengerID': box.read(BoxName.passengerID).toString()
- });
- CRUD().post(
- link:
- "${AppLink.seferAlexandriaServer}/ride/firebase/add.php",
- payload: {
- 'token': box.read(BoxName.tokenFCM),
- 'passengerID': box.read(BoxName.passengerID).toString()
- });
- CRUD().post(
- link: "${AppLink.seferGizaServer}/ride/firebase/add.php",
- payload: {
- 'token': box.read(BoxName.tokenFCM),
- 'passengerID': box.read(BoxName.passengerID).toString()
- });
+
Get.defaultDialog(
title: 'Device Change Detected'.tr,
middleText:
@@ -158,11 +175,14 @@ class LoginController extends GetxController {
}
} // Logging to check if inviteCode is written correctly
- if (box.read(BoxName.inviteCode).toString() != 'none' &&
+ if (d['inviteCode'] != 'none' &&
+ d['inviteCode'] != null &&
+ // box.read(BoxName.inviteCode).toString() != 'none' &&
box.read(BoxName.isInstall).toString() != '1') {
await CRUD()
.post(link: AppLink.updatePassengersInvitation, payload: {
- "inviteCode": box.read(BoxName.inviteCode).toString(),
+ "inviteCode": encryptionHelper
+ .encryptData(box.read(BoxName.inviteCode).toString()),
"passengerID": box.read(BoxName.passengerID).toString(),
});
Get.defaultDialog(
@@ -174,7 +194,7 @@ class LoginController extends GetxController {
try {
CRUD().post(link: AppLink.addPassengersPromo, payload: {
"promoCode":
- 'S-${box.read(BoxName.name).toString().split(' ')[0]}',
+ 'S-${encryptionHelper.decryptData(box.read(BoxName.name)).toString().split(' ')[0]}',
"amount": '25',
"passengerID": box.read(BoxName.passengerID).toString(),
"description": 'promo first'
diff --git a/lib/controller/auth/register_controller.dart b/lib/controller/auth/register_controller.dart
index 0d75b10..8bad066 100644
--- a/lib/controller/auth/register_controller.dart
+++ b/lib/controller/auth/register_controller.dart
@@ -5,7 +5,7 @@ import 'dart:math';
import 'package:SEFER/constant/colors.dart';
import 'package:SEFER/controller/auth/login_controller.dart';
import 'package:SEFER/controller/functions/add_error.dart';
-import 'package:SEFER/controller/local/phone_intel/phone_number.dart';
+import 'package:SEFER/controller/functions/encrypt_decrypt.dart';
import 'package:SEFER/views/home/map_page_passenger.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
@@ -143,7 +143,7 @@ class RegisterController extends GetxController {
var responseChecker = await CRUD().post(
link: AppLink.checkPhoneNumberISVerfiedPassenger,
payload: {
- 'phone_number': phoneNumber,
+ 'phone_number': encryptionHelper.encryptData(phoneNumber),
'email': box.read(BoxName.email),
},
);
@@ -156,7 +156,8 @@ class RegisterController extends GetxController {
Get.snackbar('Phone number is verified before'.tr, '',
backgroundColor: AppColor.greenColor);
box.write(BoxName.isVerified, '1');
- box.write(BoxName.phone, phoneNumber);
+ box.write(
+ BoxName.phone, encryptionHelper.encryptData(phoneNumber));
Get.offAll(const MapPagePassenger());
} else {
await sendOtp(phoneNumber, randomNumber, isEgyptianNumber,
@@ -192,29 +193,34 @@ class RegisterController extends GetxController {
// Trim any leading or trailing whitespace from the phone number
phoneNumber = phoneNumber.trim();
var dd = await CRUD().post(link: AppLink.sendVerifyOtpMessage, payload: {
- 'phone_number': phoneNumber,
- 'token': otp.toString(),
+ 'phone_number': encryptionHelper.encryptData(phoneNumber),
+ 'token': encryptionHelper.encryptData(otp.toString()),
});
Log.print('dd: ${dd}');
if (isEgyptian) {
await CRUD().post(link: AppLink.updatePhoneInvalidSMSPassenger, payload: {
- "phone_number": Get.find().phoneController.text
+ "phone_number": encryptionHelper
+ .encryptData(Get.find().phoneController.text)
});
- box.write(BoxName.phoneDriver, phoneController.text);
- var nameParts = box.read(BoxName.name).toString().split(' ');
+ box.write(
+ BoxName.phone, encryptionHelper.encryptData(phoneController.text));
+ var nameParts = encryptionHelper
+ .decryptData(box.read(BoxName.name))
+ .toString()
+ .split(' ');
var firstName = nameParts.isNotEmpty ? nameParts[0] : 'unknown';
var lastName = nameParts.length > 1 ? nameParts[1] : 'unknown';
var payload = {
'id': box.read(BoxName.passengerID),
- 'phone': phoneController.text,
+ 'phone': encryptionHelper.decryptData(phoneController.text),
'email': box.read(BoxName.email),
- 'password': 'unknown',
- 'gender': 'unknown',
+ 'password': encryptionHelper.encryptData('unknown'),
+ 'gender': encryptionHelper.encryptData('unknown'),
'birthdate': '2002-01-01',
'site': box.read(BoxName.passengerPhotoUrl) ?? 'unknown',
- 'first_name': firstName,
- 'last_name': lastName,
+ 'first_name': encryptionHelper.encryptData(firstName),
+ 'last_name': encryptionHelper.encryptData(lastName),
};
var res1 = await CRUD().post(
@@ -223,18 +229,24 @@ class RegisterController extends GetxController {
);
if (res1 != 'failure') {
- await CRUD().post(
- link: '${AppLink.seferAlexandriaServer}/auth/signup.php',
- payload: payload,
- );
- await CRUD().post(
- link: '${AppLink.seferGizaServer}/auth/signup.php',
- payload: payload,
- );
+ if (AppLink.seferAlexandriaServer != AppLink.seferCairoServer) {
+ List signUp = [
+ CRUD().post(
+ link: '${AppLink.seferAlexandriaServer}/auth/signup.php',
+ payload: payload,
+ ),
+ CRUD().post(
+ link: '${AppLink.seferGizaServer}/auth/signup.php',
+ payload: payload,
+ )
+ ];
+ await Future.wait(signUp);
+ }
box.write(BoxName.isVerified, '1');
box.write(BoxName.isFirstTime, '0');
- box.write(BoxName.phone, phoneController.text);
+ box.write(
+ BoxName.phone, encryptionHelper.encryptData(phoneController.text));
Get.put(LoginController()).loginUsingCredentials(
box.read(BoxName.passengerID).toString(),
@@ -257,19 +269,23 @@ class RegisterController extends GetxController {
try {
if (formKey3.currentState!.validate()) {
var res = await CRUD().post(link: AppLink.verifyOtpMessage, payload: {
- 'phone_number': phoneController.text,
- 'token': verifyCode.text.toString(),
+ 'phone_number': encryptionHelper.encryptData(phoneController.text),
+ 'token': encryptionHelper.encryptData(verifyCode.text.toString()),
});
if (res != 'failure') {
- box.write(BoxName.phoneDriver, phoneController.text);
- var nameParts = box.read(BoxName.name).toString().split(' ');
+ box.write(BoxName.phone,
+ encryptionHelper.encryptData(phoneController.text));
+ var nameParts = encryptionHelper
+ .decryptData(box.read(BoxName.name))
+ .toString()
+ .split(' ');
var firstName = nameParts.isNotEmpty ? nameParts[0] : 'unknown';
var lastName = nameParts.length > 1 ? nameParts[1] : 'unknown';
var payload = {
'id': box.read(BoxName.passengerID),
- 'phone': phoneController.text,
+ 'phone': encryptionHelper.decryptData(phoneController.text),
'email': box.read(BoxName.email),
'password': 'unknown',
'gender': 'unknown',
@@ -285,18 +301,24 @@ class RegisterController extends GetxController {
);
if (res1 != 'failure') {
- await CRUD().post(
- link: '${AppLink.seferAlexandriaServer}/auth/signup.php',
- payload: payload,
- );
- await CRUD().post(
- link: '${AppLink.seferGizaServer}/auth/signup.php',
- payload: payload,
- );
+ if (AppLink.seferAlexandriaServer != AppLink.seferCairoServer) {
+ List signUp = [
+ CRUD().post(
+ link: '${AppLink.seferAlexandriaServer}/auth/signup.php',
+ payload: payload,
+ ),
+ CRUD().post(
+ link: '${AppLink.seferGizaServer}/auth/signup.php',
+ payload: payload,
+ )
+ ];
+ await Future.wait(signUp);
+ }
box.write(BoxName.isVerified, '1');
box.write(BoxName.isFirstTime, '0');
- box.write(BoxName.phone, phoneController.text);
+ box.write(BoxName.phone,
+ encryptionHelper.decryptData(phoneController.text));
Get.put(LoginController()).loginUsingCredentials(
box.read(BoxName.passengerID).toString(),
diff --git a/lib/controller/auth/tokens_controller.dart b/lib/controller/auth/tokens_controller.dart
index 3458470..4c85885 100644
--- a/lib/controller/auth/tokens_controller.dart
+++ b/lib/controller/auth/tokens_controller.dart
@@ -6,6 +6,7 @@ import 'package:http/http.dart' as http;
import '../../constant/box_name.dart';
import '../../constant/links.dart';
import '../../main.dart';
+import '../functions/encrypt_decrypt.dart';
class TokenController extends GetxController {
bool isloading = false;
@@ -22,7 +23,8 @@ class TokenController extends GetxController {
'Basic ${base64Encode(utf8.encode(basicAuthCredentials.toString()))}',
},
body: {
- 'token': box.read(BoxName.tokenFCM.toString()),
+ 'token':
+ encryptionHelper.decryptData(box.read(BoxName.tokenFCM.toString())),
'passengerID': box.read(BoxName.passengerID).toString()
},
);
diff --git a/lib/controller/firebase/firbase_messge.dart b/lib/controller/firebase/firbase_messge.dart
index f803de7..b43a99b 100644
--- a/lib/controller/firebase/firbase_messge.dart
+++ b/lib/controller/firebase/firbase_messge.dart
@@ -1,5 +1,6 @@
import 'dart:convert';
import 'dart:io';
+import 'package:SEFER/controller/functions/encrypt_decrypt.dart';
import 'package:firebase_messaging/firebase_messaging.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
@@ -93,7 +94,8 @@ class FirebaseMessagesController extends GetxController {
Future getToken() async {
fcmToken.getToken().then((token) {
- box.write(BoxName.tokenFCM, token);
+ box.write(
+ BoxName.tokenFCM, encryptionHelper.encryptData(token.toString()));
});
FirebaseMessaging.onMessage.listen((RemoteMessage message) {
@@ -166,7 +168,8 @@ class FirebaseMessagesController extends GetxController {
'token change'.tr, 'token change'.tr, 'cancel');
}
GoogleSignInHelper.signOut();
- } else if (message.notification!.title! == 'Driver Is Going To Passenger'.tr) {
+ } else if (message.notification!.title! ==
+ 'Driver Is Going To Passenger'.tr) {
Get.find().isDriverInPassengerWay = true;
Get.find().update();
if (Platform.isAndroid) {
diff --git a/lib/controller/functions/crud.dart b/lib/controller/functions/crud.dart
index a5f0dbc..891627a 100644
--- a/lib/controller/functions/crud.dart
+++ b/lib/controller/functions/crud.dart
@@ -30,7 +30,9 @@ class CRUD {
'Basic ${base64Encode(utf8.encode(AK.basicAuthCredentials.toString()))}',
},
);
-
+ // Log.print('req: ${response.request}');
+ // Log.print('response: ${response.body}');
+ // Log.print('payload: ${payload}');
// if (response.statusCode == 200) {
var jsonData = jsonDecode(response.body);
if (jsonData['status'] == 'success') {
@@ -40,6 +42,46 @@ class CRUD {
return jsonData['status'];
}
+ Future post({
+ required String link,
+ Map? payload,
+ }) async {
+ var url = Uri.parse(link);
+ try {
+ var response = await http.post(
+ url,
+ body: payload,
+ headers: {
+ "Content-Type": "application/x-www-form-urlencoded",
+ 'Authorization':
+ 'Basic ${base64Encode(utf8.encode(AK.basicAuthCredentials))}',
+ },
+ );
+
+ if (response.statusCode == 200) {
+ try {
+ var jsonData = jsonDecode(response.body);
+
+ if (jsonData['status'] == 'success') {
+ return jsonData;
+ } else {
+ return jsonData['status'];
+ }
+ } catch (e) {
+ addError(e.toString(), 'crud().post');
+ return 'failure'; // Return a recognizable failure string for JSON errors
+ }
+ } else {
+ addError(
+ 'Non-200 response code: ${response.statusCode}', 'crud().post');
+ return 'failure'; // Handle unexpected status codes as failures
+ }
+ } catch (e) {
+ addError('HTTP request error: $e', 'crud().post');
+ return 'failure'; // Handle HTTP request errors as failures
+ }
+ }
+
Future getTokenParent({
required String link,
Map? payload,
@@ -298,45 +340,6 @@ class CRUD {
// return response.statusCode;
// }
// }
- Future post({
- required String link,
- Map? payload,
- }) async {
- var url = Uri.parse(link);
- try {
- var response = await http.post(
- url,
- body: payload,
- headers: {
- "Content-Type": "application/x-www-form-urlencoded",
- 'Authorization':
- 'Basic ${base64Encode(utf8.encode(AK.basicAuthCredentials))}',
- },
- );
-
- if (response.statusCode == 200) {
- try {
- var jsonData = jsonDecode(response.body);
-
- if (jsonData['status'] == 'success') {
- return jsonData;
- } else {
- return jsonData['status'];
- }
- } catch (e) {
- addError(e.toString(), 'crud().post');
- return 'failure'; // Return a recognizable failure string for JSON errors
- }
- } else {
- addError(
- 'Non-200 response code: ${response.statusCode}', 'crud().post');
- return 'failure'; // Handle unexpected status codes as failures
- }
- } catch (e) {
- addError('HTTP request error: $e', 'crud().post');
- return 'failure'; // Handle HTTP request errors as failures
- }
- }
Future postPayMob({
required String link,
diff --git a/lib/controller/functions/encrypt_decrypt.dart b/lib/controller/functions/encrypt_decrypt.dart
new file mode 100644
index 0000000..c483fee
--- /dev/null
+++ b/lib/controller/functions/encrypt_decrypt.dart
@@ -0,0 +1,52 @@
+import 'package:encrypt/encrypt.dart' as encrypt;
+import 'package:flutter/foundation.dart';
+
+import '../../env/env.dart';
+
+var secretKey = Env.keyOfApp
+ .toString()
+ .split('XrXlBl')[0]; // Must be 16 characters for AES-128
+String initializationVector = Env.initializationVector; // Must be 16 characters
+final encryptionHelper = EncryptionHelper(
+ secretKey: secretKey,
+ initializationVector: initializationVector,
+);
+
+class EncryptionHelper {
+ final encrypt.Key key;
+ final encrypt.IV iv;
+
+ EncryptionHelper(
+ {required String secretKey, required String initializationVector})
+ : key = encrypt.Key.fromUtf8(secretKey),
+ iv = encrypt.IV.fromUtf8(initializationVector);
+
+ // Initialize the helper
+
+ /// Encrypts the given plain text
+ String encryptData(String plainText) {
+ try {
+ final encrypter = encrypt.Encrypter(encrypt.AES(key,
+ mode: encrypt.AESMode.cbc)); // Explicitly use CBC mode
+ final encrypted = encrypter.encrypt(plainText, iv: iv);
+ return encrypted.base64;
+ } catch (e) {
+ debugPrint('Encryption Error: $e');
+ return '';
+ }
+ }
+
+ /// Decrypts the given encrypted text
+ String decryptData(String encryptedText) {
+ try {
+ final encrypter = encrypt.Encrypter(encrypt.AES(key,
+ mode: encrypt.AESMode.cbc)); // Explicitly use CBC mode
+ final encrypted = encrypt.Encrypted.fromBase64(encryptedText);
+ final decrypted = encrypter.decrypt(encrypted, iv: iv);
+ return decrypted;
+ } catch (e) {
+ debugPrint('Decryption Error: $e');
+ return '';
+ }
+ }
+}
diff --git a/lib/controller/functions/location_background_controller.dart b/lib/controller/functions/location_background_controller.dart
deleted file mode 100644
index 360baa4..0000000
--- a/lib/controller/functions/location_background_controller.dart
+++ /dev/null
@@ -1,64 +0,0 @@
-// import 'dart:async';
-// import 'package:background_location/background_location.dart';
-// import 'package:get/get.dart';
-// import 'package:permission_handler/permission_handler.dart';
-
-// class LocationBackgroundController extends GetxController {
-// @override
-// void onInit() {
-// super.onInit();
-// requestLocationPermission();
-// configureBackgroundLocation();
-// }
-
-// Future requestLocationPermission() async {
-// var status = await Permission.locationAlways.status;
-// if (!status.isGranted) {
-// await Permission.locationAlways.request();
-// }
-// }
-
-// Future configureBackgroundLocation() async {
-// await BackgroundLocation.setAndroidNotification(
-// title: "Background Location",
-// message: "Tracking location...",
-// icon: "@mipmap/ic_launcher",
-// );
-
-// BackgroundLocation.setAndroidConfiguration(1000);
-// BackgroundLocation.startLocationService();
-// BackgroundLocation.getLocationUpdates((location) {
-// // Handle location updates here
-// });
-// }
-
-// startBackLocation() async {
-// Timer.periodic(const Duration(seconds: 5), (timer) {
-// getBackgroundLocation();
-// });
-// }
-
-// getBackgroundLocation() async {
-// var status = await Permission.locationAlways.status;
-// if (status.isGranted) {
-// await BackgroundLocation.startLocationService(
-// distanceFilter: 20, forceAndroidLocationManager: true);
-// BackgroundLocation.setAndroidConfiguration(
-// Duration.microsecondsPerSecond); // Set interval to 5 seconds
-
-// BackgroundLocation.getLocationUpdates((location1) {
-// Latitude: ${location1.latitude.toString()}
-// Longitude: ${location1.longitude.toString()}
-// Altitude: ${location1.altitude.toString()}
-// Accuracy: ${location1.accuracy.toString()}
-// Bearing: ${location1.bearing.toString()}
-// Speed: ${location1.speed.toString()}
-
-
-// ''');
-// });
-// } else {
-// await Permission.locationAlways.request();
-// }
-// }
-// }
diff --git a/lib/controller/functions/secure_storage.dart b/lib/controller/functions/secure_storage.dart
index af10ff0..d6210e7 100644
--- a/lib/controller/functions/secure_storage.dart
+++ b/lib/controller/functions/secure_storage.dart
@@ -1,10 +1,13 @@
import 'dart:convert';
+import 'package:SEFER/constant/box_name.dart';
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
import '../../constant/links.dart';
import '../../main.dart';
+import '../../print.dart';
import 'crud.dart';
+import 'encrypt_decrypt.dart';
class SecureStorage {
final FlutterSecureStorage _storage = const FlutterSecureStorage();
@@ -28,31 +31,47 @@ const List keysToFetch = [
];
class AppInitializer {
- // final FlutterSecureStorage _storage = const FlutterSecureStorage();
+ List