25-8-4-1
This commit is contained in:
@@ -2,10 +2,10 @@ import 'package:encrypt/encrypt.dart' as encrypt;
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:secure_string_operations/secure_string_operations.dart';
|
||||
|
||||
import '../../constant/box_name.dart';
|
||||
import '../../constant/char_map.dart';
|
||||
import '../../env/env.dart';
|
||||
import '../../main.dart';
|
||||
import '../../print.dart';
|
||||
|
||||
class EncryptionHelper {
|
||||
static EncryptionHelper? _instance;
|
||||
@@ -29,16 +29,14 @@ class EncryptionHelper {
|
||||
return; // Prevent re-initialization
|
||||
}
|
||||
debugPrint("Initializing EncryptionHelper...");
|
||||
// Read stored keys
|
||||
var keyOfApp = r(Env.keyOfApp).toString().split(Env.addd)[0];
|
||||
var initializationVector =
|
||||
r(Env.initializationVector).toString().split(Env.addd)[0];
|
||||
|
||||
// Log.print('initializationVector: ${initializationVector}');
|
||||
// Set the global instance
|
||||
_instance = EncryptionHelper._(
|
||||
encrypt.Key.fromUtf8(keyOfApp),
|
||||
encrypt.IV.fromUtf8(initializationVector),
|
||||
encrypt.Key.fromUtf8(keyOfApp!),
|
||||
encrypt.IV.fromUtf8(initializationVector!),
|
||||
);
|
||||
debugPrint("EncryptionHelper initialized successfully.");
|
||||
}
|
||||
@@ -46,8 +44,8 @@ class EncryptionHelper {
|
||||
/// Encrypts a string
|
||||
String encryptData(String plainText) {
|
||||
try {
|
||||
final encrypter = encrypt.Encrypter(
|
||||
encrypt.AES(key, mode: encrypt.AESMode.cbc)); // AES-GCM
|
||||
final encrypter =
|
||||
encrypt.Encrypter(encrypt.AES(key, mode: encrypt.AESMode.cbc));
|
||||
final encrypted = encrypter.encrypt(plainText, iv: iv);
|
||||
return encrypted.base64;
|
||||
} catch (e) {
|
||||
|
||||
@@ -5,6 +5,7 @@ import 'package:get/get.dart';
|
||||
import 'package:google_maps_flutter/google_maps_flutter.dart';
|
||||
import 'package:location/location.dart';
|
||||
import 'package:sefer_driver/constant/table_names.dart';
|
||||
import 'package:sefer_driver/controller/home/captin/map_driver_controller.dart';
|
||||
|
||||
import '../../constant/box_name.dart';
|
||||
import '../../constant/links.dart';
|
||||
@@ -87,7 +88,7 @@ class LocationController extends GetxController {
|
||||
Get.find<CaptainWalletController>().totalPoints.toString();
|
||||
isActive = Get.find<HomeCaptainController>().isActive;
|
||||
|
||||
if (isActive && double.parse(totalPoints) > -300) {
|
||||
if (isActive && double.parse(totalPoints) > -30000) {
|
||||
await getLocation();
|
||||
if (myLocation.latitude == 0 && myLocation.longitude == 0) return;
|
||||
|
||||
@@ -147,13 +148,25 @@ class LocationController extends GetxController {
|
||||
Get.find<HomeCaptainController>()
|
||||
.mapHomeCaptainController
|
||||
?.animateCamera(
|
||||
CameraUpdate.newLatLng(
|
||||
LatLng(
|
||||
myLocation.latitude,
|
||||
myLocation.longitude,
|
||||
CameraUpdate.newCameraPosition(
|
||||
CameraPosition(
|
||||
bearing: Get.find<LocationController>().heading,
|
||||
target: myLocation,
|
||||
zoom: 17, // Adjust zoom level as needed
|
||||
),
|
||||
),
|
||||
);
|
||||
// if (Get.isRegistered()) {
|
||||
// Get.find<MapDriverController>().mapController?.animateCamera(
|
||||
// CameraUpdate.newCameraPosition(
|
||||
// CameraPosition(
|
||||
// bearing: Get.find<LocationController>().heading,
|
||||
// target: myLocation,
|
||||
// zoom: 17, // Adjust zoom level as needed
|
||||
// ),
|
||||
// ),
|
||||
// );
|
||||
// }
|
||||
}
|
||||
} catch (e) {
|
||||
print('Location update error: $e');
|
||||
|
||||
@@ -15,13 +15,15 @@ import 'package:package_info_plus/package_info_plus.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
import '../../constant/info.dart';
|
||||
import '../../main.dart';
|
||||
import '../../print.dart';
|
||||
import 'encrypt_decrypt.dart';
|
||||
|
||||
Future<void> checkForUpdate(BuildContext context) async {
|
||||
final packageInfo = await PackageInfo.fromPlatform();
|
||||
final currentVersion = packageInfo.buildNumber;
|
||||
final version = packageInfo.version;
|
||||
// print('currentVersion is : $currentVersion');
|
||||
Log.print('version: ${version}');
|
||||
print('currentVersion is : $currentVersion');
|
||||
// Fetch the latest version from your server
|
||||
String latestVersion = await getPackageInfo();
|
||||
box.write(BoxName.packagInfo, version);
|
||||
@@ -45,8 +47,8 @@ Future<String> getPackageInfo() async {
|
||||
|
||||
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-driver/id6502189302';
|
||||
? 'https://play.google.com/store/apps/details?id=com.intaleq_driver'
|
||||
: 'https://apps.apple.com/ae/app/intaleq-driver/id6502189302';
|
||||
|
||||
showGeneralDialog(
|
||||
context: context,
|
||||
|
||||
@@ -14,6 +14,7 @@ import 'package:path_provider/path_provider.dart' as path_provider;
|
||||
|
||||
import '../../constant/box_name.dart';
|
||||
import '../../constant/colors.dart';
|
||||
import '../../constant/info.dart';
|
||||
import '../../main.dart';
|
||||
import '../../print.dart';
|
||||
import 'encrypt_decrypt.dart';
|
||||
@@ -310,17 +311,20 @@ class ImageController extends GetxController {
|
||||
Log.print('request: ${request}');
|
||||
var length = await file.length();
|
||||
var stream = http.ByteStream(file.openRead());
|
||||
final headers = {
|
||||
'Authorization':
|
||||
'Bearer ${r(box.read(BoxName.jwt)).split(AppInformation.addd)[0]}',
|
||||
'X-HMAC-Auth': '${box.read(BoxName.hmac)}',
|
||||
};
|
||||
var multipartFile = http.MultipartFile(
|
||||
'image',
|
||||
stream,
|
||||
length,
|
||||
filename: basename(file.path),
|
||||
);
|
||||
request.headers.addAll({
|
||||
'Authorization':
|
||||
'Basic ${base64Encode(utf8.encode(AK.basicAuthCredentials.toString()))}',
|
||||
});
|
||||
request.headers.addAll(headers);
|
||||
// Set the file name to the driverID
|
||||
|
||||
request.files.add(
|
||||
http.MultipartFile(
|
||||
'image',
|
||||
@@ -418,14 +422,11 @@ class ImageController extends GetxController {
|
||||
try {
|
||||
await uploadImage(
|
||||
compressedImage,
|
||||
{
|
||||
'driverID':
|
||||
(box.read(BoxName.driverID)) ?? (box.read(BoxName.passengerID)),
|
||||
'imageType': imageType
|
||||
},
|
||||
{'driverID': (box.read(BoxName.driverID)), 'imageType': imageType},
|
||||
link,
|
||||
);
|
||||
} catch (e) {
|
||||
Log.print('e: ${e}');
|
||||
mySnackeBarError('Image Upload Failed'.tr);
|
||||
// Get.snackbar('Image Upload Failed'.tr, e.toString(),
|
||||
// backgroundColor: AppColor.redColor);
|
||||
|
||||
Reference in New Issue
Block a user