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