2026-04-03-pre map libra
This commit is contained in:
@@ -433,14 +433,58 @@ class HomeCaptainController extends GetxController {
|
||||
return totalDuration;
|
||||
}
|
||||
|
||||
void startPeriodicExecution() {
|
||||
Timer.periodic(const Duration(seconds: 30), (timer) async {
|
||||
await getCaptainDurationOnToday();
|
||||
Timer? _localDurationTimer;
|
||||
RxString totalDurationDisplay = "00:00:00".obs; // لعرض الوقت في الواجهة
|
||||
Duration _currentDuration = Duration.zero; // لتخزين الوقت ككائن Duration
|
||||
|
||||
void startPeriodicExecution() async {
|
||||
await getCaptainDurationOnToday();
|
||||
String? initialDurationStr = totalDurationToday;
|
||||
|
||||
if (initialDurationStr != null) {
|
||||
// تحويل النص (01:20:30) إلى كائن Duration
|
||||
List<String> parts = initialDurationStr.split(':');
|
||||
_currentDuration = Duration(
|
||||
hours: int.parse(parts[0]),
|
||||
minutes: int.parse(parts[1]),
|
||||
seconds: int.parse(parts[2]),
|
||||
);
|
||||
|
||||
// بدء العداد المحلي
|
||||
_startLocalClock();
|
||||
}
|
||||
|
||||
// Timer.periodic(const Duration(seconds: 30), (timer) async {
|
||||
// await getCaptainDurationOnToday();
|
||||
// });
|
||||
}
|
||||
|
||||
void _startLocalClock() {
|
||||
_localDurationTimer?.cancel();
|
||||
_localDurationTimer = Timer.periodic(const Duration(seconds: 1), (timer) {
|
||||
// زيادة ثانية واحدة محلياً
|
||||
_currentDuration += const Duration(seconds: 1);
|
||||
|
||||
// تحديث النص المعروض في الواجهة (Formatting)
|
||||
totalDurationDisplay.value = _formatDuration(_currentDuration);
|
||||
|
||||
// اختيارياً: كل 5 دقائق فقط، قم بتحديث القيمة من السيرفر للتأكد من المزامنة
|
||||
if (timer.tick % 300 == 0) {
|
||||
getCaptainDurationOnToday();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
String _formatDuration(Duration duration) {
|
||||
String twoDigits(int n) => n.toString().padLeft(2, "0");
|
||||
String hours = twoDigits(duration.inHours);
|
||||
String minutes = twoDigits(duration.inMinutes.remainder(60));
|
||||
String seconds = twoDigits(duration.inSeconds.remainder(60));
|
||||
return "$hours:$minutes:$seconds";
|
||||
}
|
||||
|
||||
void stopTimer() {
|
||||
timer?.cancel();
|
||||
_localDurationTimer?.cancel();
|
||||
}
|
||||
|
||||
getlocation() async {
|
||||
|
||||
@@ -22,11 +22,11 @@ class PaymobPayout extends GetxController {
|
||||
if (isAvailable) {
|
||||
// Authenticate the user
|
||||
bool didAuthenticate = await LocalAuthentication().authenticate(
|
||||
localizedReason: 'Use Touch ID or Face ID to confirm payment',
|
||||
options: AuthenticationOptions(
|
||||
biometricOnly: true,
|
||||
sensitiveTransaction: true,
|
||||
));
|
||||
localizedReason: 'Use Touch ID or Face ID to confirm payment',
|
||||
// options: AuthenticationOptions(
|
||||
biometricOnly: true,
|
||||
sensitiveTransaction: true,
|
||||
);
|
||||
if (didAuthenticate) {
|
||||
// var dec = await CRUD()
|
||||
// .postWallet(link: AppLink.paymobPayoutDriverWallet, payload: {
|
||||
@@ -116,11 +116,11 @@ class PaymobPayout extends GetxController {
|
||||
if (isAvailable) {
|
||||
// Authenticate the user
|
||||
bool didAuthenticate = await LocalAuthentication().authenticate(
|
||||
localizedReason: 'Use Touch ID or Face ID to confirm payment',
|
||||
options: AuthenticationOptions(
|
||||
biometricOnly: true,
|
||||
sensitiveTransaction: true,
|
||||
));
|
||||
localizedReason: 'Use Touch ID or Face ID to confirm payment',
|
||||
// options: AuthenticationOptions(
|
||||
biometricOnly: true,
|
||||
sensitiveTransaction: true,
|
||||
);
|
||||
if (didAuthenticate) {
|
||||
var body = {
|
||||
"issuer": "bank_card",
|
||||
@@ -187,11 +187,11 @@ class PaymobPayout extends GetxController {
|
||||
if (isAvailable) {
|
||||
// Authenticate the user
|
||||
bool didAuthenticate = await LocalAuthentication().authenticate(
|
||||
localizedReason: 'Use Touch ID or Face ID to confirm payment',
|
||||
options: AuthenticationOptions(
|
||||
biometricOnly: true,
|
||||
sensitiveTransaction: true,
|
||||
));
|
||||
localizedReason: 'Use Touch ID or Face ID to confirm payment',
|
||||
// options: AuthenticationOptions(
|
||||
biometricOnly: true,
|
||||
sensitiveTransaction: true,
|
||||
);
|
||||
if (didAuthenticate) {
|
||||
await payToDriverWallet(amount, issuer, msisdn);
|
||||
} else {
|
||||
@@ -213,11 +213,11 @@ class PaymobPayout extends GetxController {
|
||||
if (isAvailable) {
|
||||
// Authenticate the user
|
||||
bool didAuthenticate = await LocalAuthentication().authenticate(
|
||||
localizedReason: 'Use Touch ID or Face ID to confirm payment',
|
||||
options: AuthenticationOptions(
|
||||
biometricOnly: true,
|
||||
sensitiveTransaction: true,
|
||||
));
|
||||
localizedReason: 'Use Touch ID or Face ID to confirm payment',
|
||||
// options: AuthenticationOptions(
|
||||
biometricOnly: true,
|
||||
sensitiveTransaction: true,
|
||||
);
|
||||
if (didAuthenticate) {
|
||||
await payToDriverBankAccount(amount, bankCardNumber, bankCode);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user