Update: 2026-06-27 05:36:53
This commit is contained in:
@@ -48,10 +48,11 @@ try {
|
||||
uploadLog("✅ File moved successfully to: " . $uploadResult['path']);
|
||||
|
||||
// 3. تحديث قاعدة البيانات ديناميكياً
|
||||
// Use configured domain instead of Host header to prevent host header injection
|
||||
$host = getenv('APP_DOMAIN') ?: 'api.siromove.com';
|
||||
$protocol = 'https';
|
||||
$linkImage = "$protocol://$host/siro/portrate_captain_image/" . $new_filename;
|
||||
// Derive base URL dynamically from the actual request
|
||||
$protocol = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ? 'https' : 'http';
|
||||
$host = getenv('APP_DOMAIN') ?: ($_SERVER['HTTP_HOST'] ?? 'api.siromove.com');
|
||||
$scriptDir = rtrim(dirname($_SERVER['SCRIPT_NAME']), '/');
|
||||
$linkImage = "$protocol://$host$scriptDir/portrate_captain_image/" . $new_filename;
|
||||
|
||||
// تأكد من أن الاتصال قادم من connect.php أو اجلبه
|
||||
$con = Database::get('main');
|
||||
|
||||
53
siro_driver/lib/constant/recharge_tiers.dart
Normal file
53
siro_driver/lib/constant/recharge_tiers.dart
Normal file
@@ -0,0 +1,53 @@
|
||||
import 'package:siro_driver/constant/box_name.dart';
|
||||
import 'package:siro_driver/main.dart';
|
||||
|
||||
class RechargeTier {
|
||||
final double amount;
|
||||
final double bonus;
|
||||
const RechargeTier(this.amount, this.bonus);
|
||||
|
||||
double get total => amount + bonus;
|
||||
}
|
||||
|
||||
class RechargeConfig {
|
||||
final String currencyCode;
|
||||
final List<RechargeTier> tiers;
|
||||
const RechargeConfig({required this.currencyCode, required this.tiers});
|
||||
|
||||
static const Map<String, RechargeConfig> _configs = {
|
||||
'Jordan': RechargeConfig(
|
||||
currencyCode: 'JOD',
|
||||
tiers: [
|
||||
RechargeTier(5, 0),
|
||||
RechargeTier(10, 0),
|
||||
RechargeTier(20, 0),
|
||||
RechargeTier(50, 0),
|
||||
],
|
||||
),
|
||||
'Egypt': RechargeConfig(
|
||||
currencyCode: 'EGP',
|
||||
tiers: [
|
||||
RechargeTier(100, 0),
|
||||
RechargeTier(200, 0),
|
||||
RechargeTier(400, 0),
|
||||
RechargeTier(1000, 0),
|
||||
],
|
||||
),
|
||||
'Syria': RechargeConfig(
|
||||
currencyCode: 'SYP',
|
||||
tiers: [
|
||||
RechargeTier(100, 0),
|
||||
RechargeTier(200, 0),
|
||||
RechargeTier(400, 0),
|
||||
RechargeTier(1000, 0),
|
||||
],
|
||||
),
|
||||
};
|
||||
|
||||
static RechargeConfig get current {
|
||||
final country = box.read(BoxName.countryCode) ?? 'Jordan';
|
||||
return _configs[country] ?? _configs['Jordan']!;
|
||||
}
|
||||
|
||||
static List<RechargeTier> get currentTiers => current.tiers;
|
||||
}
|
||||
@@ -71,7 +71,7 @@ class LoginDriverController extends GetxController {
|
||||
await CountryLogic.initializeCountry();
|
||||
// box.write(BoxName.driverID, '34feffd3fa72d6bee56b');
|
||||
// await getAppTester();
|
||||
getJWT();
|
||||
await getJWT();
|
||||
super.onInit();
|
||||
}
|
||||
|
||||
@@ -147,8 +147,9 @@ class LoginDriverController extends GetxController {
|
||||
return;
|
||||
}
|
||||
Log.print('Security check passed');
|
||||
String fingerPrint = await DeviceHelper.getDeviceFingerprint();
|
||||
dev = Platform.isAndroid ? 'android' : 'ios';
|
||||
var fingerPrint = box.read(BoxName.deviceFingerprint)?.toString() ??
|
||||
await DeviceHelper.getDeviceFingerprint();
|
||||
var payload = {
|
||||
'id': box.read(BoxName.driverID),
|
||||
'password': AK.passnpassenger,
|
||||
@@ -389,6 +390,9 @@ class LoginDriverController extends GetxController {
|
||||
|
||||
// ✅ الحصول على توكن access بدل registration قبل أي طلبات بعد تسجيل الدخول
|
||||
Log.print('🔑 Getting access token after login...');
|
||||
String fingerPrint = await DeviceHelper.getDeviceFingerprint();
|
||||
await storage.write(
|
||||
key: BoxName.fingerPrint, value: fingerPrint.toString());
|
||||
await getJWT();
|
||||
Log.print('🔑 Access token obtained.');
|
||||
|
||||
@@ -406,10 +410,6 @@ class LoginDriverController extends GetxController {
|
||||
payload: {
|
||||
'captain_id': (box.read(BoxName.driverID)).toString()
|
||||
});
|
||||
|
||||
String fingerPrint = await DeviceHelper.getDeviceFingerprint();
|
||||
await storage.write(
|
||||
key: BoxName.fingerPrint, value: fingerPrint.toString());
|
||||
// print(jsonDecode(token)['data'][0]['token'].toString());
|
||||
// print(box.read(BoxName.tokenDriver).toString());
|
||||
// if (box.read(BoxName.emailDriver).toString() !=
|
||||
|
||||
@@ -554,6 +554,15 @@ class ScanDocumentsByApi extends GetxController {
|
||||
}
|
||||
}
|
||||
|
||||
if (responseString.isNotEmpty) {
|
||||
try {
|
||||
final decoded = jsonDecode(responseString);
|
||||
if (decoded['status'] == 'success' && decoded['message']['file_link'] != null) {
|
||||
box.write(BoxName.driverPhotoUrl, decoded['message']['file_link'].toString());
|
||||
}
|
||||
} catch (_) {}
|
||||
}
|
||||
|
||||
isLoading = false;
|
||||
update();
|
||||
|
||||
|
||||
@@ -35,15 +35,17 @@ Future<void> getPermissionOverlay() async {
|
||||
Future<void> showDriverGiftClaim(BuildContext context) async {
|
||||
if (box.read(BoxName.is_claimed).toString() == '0' ||
|
||||
box.read(BoxName.is_claimed) == null) {
|
||||
final country = box.read(BoxName.countryCode)?.toString() ?? 'Jordan';
|
||||
final giftAmount = country == 'Jordan' ? '3' : '300';
|
||||
MyDialog().getDialog(
|
||||
'You have gift 300 ${CurrencyHelper.currency}'.tr, 'This for new registration'.tr, () async {
|
||||
'You have gift $giftAmount ${CurrencyHelper.currency}'.tr, 'This for new registration'.tr, () async {
|
||||
Get.back();
|
||||
var res = await CRUD().post(link: AppLink.updateDriverClaim, payload: {
|
||||
'driverId': box.read(BoxName.driverID),
|
||||
});
|
||||
if (res != 'failure') {
|
||||
Get.find<CaptainWalletController>()
|
||||
.addDriverWallet('new driver', '300', '300');
|
||||
.addDriverWallet('new driver', giftAmount, giftAmount);
|
||||
Confetti.launch(
|
||||
context,
|
||||
options:
|
||||
|
||||
@@ -130,6 +130,9 @@ class SplashScreenController extends GetxController
|
||||
await initializer.initializeApp();
|
||||
await EncryptionHelper.initialize();
|
||||
|
||||
await DeviceHelper.getDeviceFingerprint();
|
||||
await loginController.getJWT();
|
||||
|
||||
await loginController.loginDriver(
|
||||
box.read(BoxName.driverID).toString(),
|
||||
box.read(BoxName.emailDriver).toString(),
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import 'package:siro_driver/constant/currency.dart';
|
||||
import 'package:siro_driver/constant/recharge_tiers.dart';
|
||||
import 'package:local_auth/local_auth.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
@@ -139,22 +140,20 @@ class WalletCaptainRefactored extends StatelessWidget {
|
||||
scrollDirection: Axis.horizontal,
|
||||
physics: const BouncingScrollPhysics(),
|
||||
children: [
|
||||
PointsCaptain(
|
||||
kolor: Colors.blueGrey,
|
||||
pricePoint: 100,
|
||||
countPoint: '100'),
|
||||
PointsCaptain(
|
||||
kolor: Colors.brown,
|
||||
pricePoint: 200,
|
||||
countPoint: '210'),
|
||||
PointsCaptain(
|
||||
kolor: Colors.amber,
|
||||
pricePoint: 400,
|
||||
countPoint: '450'),
|
||||
PointsCaptain(
|
||||
kolor: Colors.orange,
|
||||
pricePoint: 1000,
|
||||
countPoint: '1100'),
|
||||
...RechargeConfig.currentTiers.map((tier) {
|
||||
final colors = [
|
||||
Colors.blueGrey,
|
||||
Colors.brown,
|
||||
Colors.amber,
|
||||
Colors.orange,
|
||||
];
|
||||
final i = RechargeConfig.currentTiers.indexOf(tier);
|
||||
return PointsCaptain(
|
||||
kolor: colors[i % colors.length],
|
||||
pricePoint: tier.amount,
|
||||
countPoint: tier.total.toStringAsFixed(0),
|
||||
);
|
||||
}),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -299,18 +298,20 @@ class WalletCaptainRefactored extends StatelessWidget {
|
||||
scrollDirection: Axis.horizontal,
|
||||
physics: const BouncingScrollPhysics(),
|
||||
children: [
|
||||
PointsCaptain(
|
||||
kolor: Colors.blueGrey,
|
||||
pricePoint: 100,
|
||||
countPoint: '100'),
|
||||
PointsCaptain(
|
||||
kolor: Colors.brown, pricePoint: 200, countPoint: '210'),
|
||||
PointsCaptain(
|
||||
kolor: Colors.amber, pricePoint: 400, countPoint: '450'),
|
||||
PointsCaptain(
|
||||
kolor: Colors.orange,
|
||||
pricePoint: 1000,
|
||||
countPoint: '1100'),
|
||||
...RechargeConfig.currentTiers.map((tier) {
|
||||
final colors = [
|
||||
Colors.blueGrey,
|
||||
Colors.brown,
|
||||
Colors.amber,
|
||||
Colors.orange,
|
||||
];
|
||||
final i = RechargeConfig.currentTiers.indexOf(tier);
|
||||
return PointsCaptain(
|
||||
kolor: colors[i % colors.length],
|
||||
pricePoint: tier.amount,
|
||||
countPoint: tier.total.toStringAsFixed(0),
|
||||
);
|
||||
}),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user