This commit is contained in:
Hamza-Ayed
2024-07-05 23:46:05 +03:00
parent dc4677a6bf
commit 23ecaba97c
17 changed files with 310 additions and 225 deletions

View File

@@ -68,6 +68,9 @@ class AK {
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);
}
//

View File

@@ -1,3 +1,5 @@
import 'package:SEFER/env/env.dart';
Map<String, String> cn = {
"0": "3",
"1": "7",
@@ -11,58 +13,58 @@ Map<String, String> cn = {
"9": "8"
};
Map<String, String> 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"
"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<String, String> 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"
"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
};

View File

@@ -12,7 +12,7 @@ class AC {
if (box.read(BoxName.apiKeyRun).toString() != 'run') {
var res = await CRUD().get(link: AppLink.getApiKey, payload: {});
var decod = jsonDecode(res);
print(decod);
// print(decod);
Map<String, dynamic> jsonData = {};
for (var i = 0; i < decod['message'].length; i++) {
String h = decod['message'][i]['hashed_key'].toString();

View File

@@ -1,14 +1,14 @@
class AppInformation {
static const String companyName = 'Mobile-App';
static const String companyName = 'SEFER LLC';
static const String appName = 'SEFER';
static const String appVersion = 'SEFER Captain';
static const String phoneNumber = '962798583052';
static const String linkedInProfile =
'https://www.linkedin.com/in/hamza-ayed/';
static const String website = 'https://mobile-app.store';
static const String email = 'hamzaayed@mobile-app.store';
static const String website = 'https://sefer.live';
static const String email = 'hamzaayed@sefer.live';
static const String privacyPolicy =
'''
static const String privacyPolicy = '''
<body monica-version="2.4.0" monica-id="ofpnmcalabcbjgholdjcjblkibolbppb">

View File

@@ -206,6 +206,7 @@ class AppLink {
static String authCaptin = '$server/auth/captin';
static String loginCaptin = "$authCaptin/login.php";
static String loginFromGoogleCaptin = "$authCaptin/loginFromGoogle.php";
static String packageInfo = "$server/auth/packageInfo.php";
static String signUpCaptin = "$authCaptin/register.php";
static String sendVerifyEmailCaptin = "$authCaptin/sendVerifyEmail.php";
static String sendVerifyOtpMessage =

View File

@@ -42,9 +42,9 @@ class AppStyle {
static BoxDecoration boxDecoration = const BoxDecoration(
boxShadow: [
BoxShadow(
color: AppColor.accentColor, blurRadius: 5, offset: Offset(2, 4)),
color: AppColor.accentColor, blurRadius: 2, offset: Offset(1, 2)),
BoxShadow(
color: AppColor.accentColor, blurRadius: 5, offset: Offset(-2, -2))
color: AppColor.accentColor, blurRadius: 2, offset: Offset(-1, -1))
],
color: AppColor.secondaryColor,
borderRadius: BorderRadius.all(
@@ -53,9 +53,9 @@ class AppStyle {
static BoxDecoration boxDecoration1 = const BoxDecoration(
boxShadow: [
BoxShadow(
color: AppColor.accentColor, blurRadius: 5, offset: Offset(2, 4)),
color: AppColor.accentColor, blurRadius: 2, offset: Offset(1, 2)),
BoxShadow(
color: AppColor.accentColor, blurRadius: 5, offset: Offset(-2, -2))
color: AppColor.accentColor, blurRadius: 2, offset: Offset(-1, -1))
],
color: AppColor.secondaryColor,
borderRadius: BorderRadius.all(

View File

@@ -1,21 +1,19 @@
import 'package:encrypt/encrypt.dart' as encrypt;
import 'dart:convert';
import 'package:http/http.dart' as http;
import 'package:encrypt/encrypt.dart' as encrypt;
//
import 'dart:convert';
import 'dart:math';
import 'package:encrypt/encrypt.dart' as encrypt;
import '../../constant/api_key.dart';
class KeyEncryption {
static final _key = encrypt.Key.fromUtf8('mehmetDEV@2101'); // ضع مفتاحك هنا
// استخدم مفتاح بطول 32 حرفًا
static final _key = encrypt.Key.fromUtf8(AK.keyOfApp);
static final _iv =
encrypt.IV.fromLength(16); // توليد تهيئة عشوائية بطول 16 بايت
static String encryptKey(String key) {
final iv = encrypt.IV.fromLength(16); // توليد تهيئة عشوائية
final encrypter =
encrypt.Encrypter(encrypt.AES(_key, mode: encrypt.AESMode.cbc));
final encrypted = encrypter.encrypt(key, iv: iv);
final result = iv.bytes + encrypted.bytes; // تضمين التهيئة مع النص المشفر
final encrypted = encrypter.encrypt(key, iv: _iv);
final result = _iv.bytes + encrypted.bytes; // تضمين التهيئة مع النص المشفر
return base64Encode(result);
}
@@ -29,55 +27,3 @@ class KeyEncryption {
return encrypter.decrypt(encrypted, iv: iv);
}
}
// class KeyEncryption {
// static final _key = encrypt.Key.fromUtf8('7'); // ضع مفتاحك هنا
//
// static String encryptKey(String key) {
// final iv = encrypt.IV.fromLength(16); // توليد تهيئة عشوائية
// final encrypter =
// encrypt.Encrypter(encrypt.AES(_key, mode: encrypt.AESMode.cbc));
// final encrypted = encrypter.encrypt(key, iv: iv);
// final result = iv.bytes + encrypted.bytes; // تضمين التهيئة مع النص المشفر
// return base64Encode(result);
// }
//
// static String decryptKey(String encryptedKey) {
// final decoded = base64Decode(encryptedKey);
// final iv = encrypt.IV(decoded.sublist(0, 16)); // استخراج التهيئة
// final encrypted =
// encrypt.Encrypted(decoded.sublist(16)); // استخراج النص المشفر
// final encrypter =
// encrypt.Encrypter(encrypt.AES(_key, mode: encrypt.AESMode.cbc));
// return encrypter.decrypt(encrypted, iv: iv);
// }
// }
// class KeyEncryption {
// static final _key =
// encrypt.Key.fromUtf8('32-character-key....'); // ضع مفتاحك هنا
//
// static String encryptKey(String key) {
// final iv = encrypt.IV.fromLength(16); // توليد تهيئة عشوائية
// final encrypter =
// encrypt.Encrypter(encrypt.AES(_key, mode: encrypt.AESMode.cbc));
// final encrypted = encrypter.encrypt(key, iv: iv);
// final result = iv.bytes + encrypted.bytes; // تضمين التهيئة مع النص المشفر
// return base64Encode(result);
// }
//
// static Future<void> storeApiKeys(List<String> apiKeys) async {
// final encryptedKeys = apiKeys.map((key) => encryptKey(key)).toList();
// final response = await http.post(
// Uri.parse('https://yourdomain.com/store_keys.php'),
// body: jsonEncode({'keys': encryptedKeys}),
// headers: {'Content-Type': 'application/json'},
// );
//
// if (response.statusCode == 200) {
// print('Keys stored successfully.');
// } else {
// print('Failed to store keys.');
// }
// }
// }

View File

@@ -0,0 +1,67 @@
import 'dart:convert';
import 'dart:io';
import 'package:SEFER/constant/links.dart';
import 'package:SEFER/controller/functions/crud.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:package_info_plus/package_info_plus.dart';
import 'package:url_launcher/url_launcher.dart';
import '../../constant/info.dart';
Future<void> checkForUpdate(BuildContext context) async {
final packageInfo = await PackageInfo.fromPlatform();
final currentVersion = packageInfo.buildNumber;
print('currentVersion is : $currentVersion');
// Fetch the latest version from your server
String latestVersion = await getPackageInfo();
if (latestVersion.isNotEmpty && latestVersion != currentVersion) {
showUpdateDialog(context);
}
}
Future<String> getPackageInfo() async {
final response = await CRUD().get(link: AppLink.packageInfo, payload: {
"platform": Platform.isAndroid ? 'android' : 'ios',
"appName": AppInformation.appName,
});
if (response != 'failure') {
return jsonDecode(response)['message'][0]['version'];
}
return '';
}
void showUpdateDialog(BuildContext context) {
final String storeUrl = Platform.isAndroid
? 'https://play.google.com/store/apps/details?id=com.sefer_driver'
: 'https://apps.apple.com/ae/app/sefer/id6458734951';
showCupertinoDialog(
context: context,
barrierDismissible: false,
builder: (BuildContext context) {
return CupertinoAlertDialog(
title: Text('Update Available'.tr),
content: Text(
'A new version of the app is available. Please update to the latest version.'
.tr,
),
actions: <Widget>[
CupertinoDialogAction(
child: Text('Update'.tr),
onPressed: () async {
if (await canLaunchUrl(Uri.parse(storeUrl))) {
await launchUrl(Uri.parse(storeUrl));
} else {
print('Could not launch $storeUrl');
}
Navigator.of(context).pop();
},
),
],
);
},
);
}

View File

@@ -4,6 +4,9 @@ class MyTranslation extends Translations {
@override
Map<String, Map<String, String>> get keys => {
"ar": {
"Update Available": "تحديث متوفر",
"A new version of the app is available. Please update to the latest version.":
"تتوفر نسخة جديدة من التطبيق. يرجى التحديث إلى أحدث إصدار.",
"We use location to get accurate and nearest passengers for you":
"نستخدم الموقع للحصول على أقرب الركاب وأكثرهم دقة لك",
"This ride is already applied by another driver.":

View File

@@ -56,43 +56,44 @@ class RateController extends GetxController {
if (value != 'failure') {
Get.snackbar('Wallet Added'.tr, '',
backgroundColor: AppColor.greenColor);
if (double.parse(
Get.find<CaptainWalletController>().totalAmountVisa) >
remainingFee) {
var paymentToken3 = await Get.find<MapDriverController>()
.generateTokenDriver((-1 * remainingFee).toString());
// if (double.parse(
// Get.find<CaptainWalletController>().totalAmountVisa) >
// remainingFee) {
var paymentToken3 = await Get.find<MapDriverController>()
.generateTokenDriver((-1 * remainingFee).toString());
await CRUD().post(link: AppLink.addDrivePayment, payload: {
'rideId': 'remain$rideId',
'amount': (-1 * remainingFee).toString(),
'payment_method': 'Remainder',
'passengerID': passengerId,
'token': paymentToken3,
'driverID': box.read(BoxName.driverID).toString(),
});
} else {
double pointsSubtraction = 0;
pointsSubtraction = remainingFee *
(-1) /
double.parse(
Get.find<MapDriverController>().kazan); // for egypt /100
var paymentToken4 = await Get.find<MapDriverController>()
.generateTokenDriver((pointsSubtraction).toStringAsFixed(0));
var res = await CRUD()
.post(link: AppLink.addDriversWalletPoints, payload: {
'paymentID': 'rideId$rideId',
'amount': (pointsSubtraction).toStringAsFixed(0),
'paymentMethod': 'Remainder',
'token': paymentToken4,
'driverID': box.read(BoxName.driverID).toString(),
});
FirebaseMessagesController().sendNotificationToAnyWithoutData(
'Wallet Added'.tr,
'Wallet Added${(remainingFee).toStringAsFixed(0)}'.tr,
Get.find<MapDriverController>().tokenPassenger,
'tone2.wav');
walletChecked = 'true';
}
await CRUD().post(link: AppLink.addDrivePayment, payload: {
'rideId': 'remain$rideId',
'amount': (-1 * remainingFee).toString(),
'payment_method': 'Remainder',
'passengerID': passengerId,
'token': paymentToken3,
'driverID': box.read(BoxName.driverID).toString(),
});
// }
// else {
// double pointsSubtraction = 0;
// pointsSubtraction = remainingFee *
// (-1) /
// double.parse(
// Get.find<MapDriverController>().kazan); // for egypt /100
// var paymentToken4 = await Get.find<MapDriverController>()
// .generateTokenDriver((pointsSubtraction).toStringAsFixed(0));
// var res = await CRUD()
// .post(link: AppLink.addDriversWalletPoints, payload: {
// 'paymentID': 'rideId$rideId',
// 'amount': (pointsSubtraction).toStringAsFixed(0),
// 'paymentMethod': 'Remainder',
// 'token': paymentToken4,
// 'driverID': box.read(BoxName.driverID).toString(),
// });
FirebaseMessagesController().sendNotificationToAnyWithoutData(
'Wallet Added'.tr,
'Wallet Added${(remainingFee).toStringAsFixed(0)}'.tr,
Get.find<MapDriverController>().tokenPassenger,
'tone2.wav');
walletChecked = 'true';
// }
update();
}

View File

@@ -17,6 +17,7 @@ import 'constant/info.dart';
import 'controller/firebase/firbase_messge.dart';
import 'controller/firebase/local_notification.dart';
import 'controller/functions/location_controller.dart';
import 'controller/functions/package_info.dart';
import 'controller/local/local_controller.dart';
import 'controller/local/translations.dart';
import 'controller/payment/paymob/paymob_wallet.dart';
@@ -109,7 +110,7 @@ class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
LocaleController localController = Get.put(LocaleController());
// checkForUpdate(context);
return GetMaterialApp(
title: AppInformation.appName,
translations: MyTranslation(),

View File

@@ -10,6 +10,7 @@ import '../../../../constant/info.dart';
import '../../../../constant/style.dart';
import '../../../../constant/table_names.dart';
import '../../../../controller/functions/location_controller.dart';
import '../../../../controller/functions/package_info.dart';
import '../../../../controller/home/captin/home_captain_controller.dart';
import '../../../../controller/home/captin/order_request_controller.dart';
import '../../../widgets/circle_container.dart';
@@ -28,6 +29,9 @@ class HomeCaptain extends StatelessWidget {
Widget build(BuildContext context) {
Get.put(OrderRequestController());
Get.put(HomeCaptainController());
WidgetsBinding.instance.addPostFrameCallback((_) {
checkForUpdate(context);
});
return Scaffold(
appBar: AppBar(
// backgroundColor: AppColor.accentColor,

View File

@@ -22,50 +22,52 @@ GetBuilder<HomeCaptainController> leftMainMenuCaptainIcons() {
left: 6,
child: Column(
children: [
// AnimatedContainer(
// duration: const Duration(microseconds: 200),
// width: controller.widthMapTypeAndTraffic,
// decoration: BoxDecoration(
// border: Border.all(color: AppColor.blueColor),
// color: AppColor.secondaryColor,
// borderRadius: BorderRadius.circular(15)),
// child: IconButton(
// onPressed: () {
// // AC credentials = AC();
// String apiKey = 'mehmetDEV@2101';
// // String convertedStringN = credentials.c(
// // credentials.c(credentials.c(apiKey, cs), cC), cn);
// // print(convertedStringN);
// // String retrievedStringS = credentials.r(
// // credentials.r(credentials.r(convertedStringN, cn), cC),
// // cs);
// // print(retrievedStringS);
// // //
// // if (retrievedStringS == apiKey) {
// // print('same');
// // }
//
// // key.forEach((key, apiKey) {
// String encryptedApiKey = KeyEncryption.encryptKey(apiKey);
// print('Encrypted = $encryptedApiKey');
//
// String decryptedApiKey =
// KeyEncryption.decryptKey(encryptedApiKey);
// print('Decrypted : $decryptedApiKey');
//
// // if (decryptedApiKey == apiKey) {
// // print('Keys match for $decryptedApiKey');
// // } else {
// // // print('Keys do not match for $key');
// // }
// // });
// },
// icon: const Icon(
// FontAwesome.map_signs,
// size: 24,
// color: Colors.black,
// )),
// ),
AnimatedContainer(
duration: const Duration(microseconds: 200),
width: controller.widthMapTypeAndTraffic,
decoration: BoxDecoration(
border: Border.all(color: AppColor.blueColor),
color: AppColor.secondaryColor,
borderRadius: BorderRadius.circular(15)),
child: IconButton(
onPressed: () {
// AC credentials = AC();
String apiKey = 'maldev@2101hamzaayedseferegyptjo';
// String convertedStringN = credentials.c(
// credentials.c(credentials.c(apiKey, cs), cC), cn);
// print(convertedStringN);
// String retrievedStringS = credentials.r(
// credentials.r(credentials.r(convertedStringN, cn), cC),
// cs);
// print(retrievedStringS);
// //
// if (retrievedStringS == apiKey) {
// print('same');
// }
// key.forEach((key, apiKey) {
// keys.forEach((key, apiKey) {
String encryptedApiKey = KeyEncryption.encryptKey(apiKey);
print('Encrypted API Key for : $encryptedApiKey');
String decryptedApiKey = KeyEncryption.decryptKey(
"Hsd7tLdt4ZsSRMCCs0xia2ct9O1jrJKyZu6pvh6MjL8qg6TkJ9FZCW4H/OqCkMjtokBOTdTX0P2sASLTcTxBVA==");
print('Decrypted API Key for : $decryptedApiKey');
if (decryptedApiKey == apiKey) {
print('Keys match for ');
} else {
print('Keys do not match for ');
}
// });
},
icon: const Icon(
FontAwesome.map_signs,
size: 24,
color: Colors.black,
)),
),
const SizedBox(
height: 5,
),