refactor: optimize wallet JWT management, update security checks for debug builds, and improve pricing data parsing

This commit is contained in:
Hamza-Ayed
2026-06-27 22:50:28 +03:00
parent 43e3f8c939
commit a87cb7c082
7 changed files with 93 additions and 18 deletions

View File

@@ -770,17 +770,30 @@ class HomeCaptainController extends GetxController {
payload: {'country': box.read(BoxName.countryCode).toString()},
);
if (res != 'failure') {
var json = jsonDecode(res);
kazan = double.parse(json['message'][0]['kazan']);
naturePrice = double.parse(json['message'][0]['naturePrice']);
heavyPrice = double.parse(json['message'][0]['heavyPrice']);
latePrice = double.parse(json['message'][0]['latePrice']);
comfortPrice = double.parse(json['message'][0]['comfortPrice']);
speedPrice = double.parse(json['message'][0]['speedPrice']);
deliveryPrice = double.parse(json['message'][0]['deliveryPrice']);
mashwariPrice = double.parse(json['message'][0]['freePrice']);
familyPrice = double.parse(json['message'][0]['familyPrice']);
fuelPrice = double.parse(json['message'][0]['fuelPrice']);
try {
var json = jsonDecode(res);
if (json['message'] is List && json['message'].isNotEmpty) {
final item = json['message'][0];
double parseDouble(dynamic val) {
if (val == null) return 0.0;
return double.tryParse(val.toString()) ?? 0.0;
}
kazan = parseDouble(item['kazanPercent'] ?? item['kazan']);
naturePrice = parseDouble(item['normalMinPrice'] ?? item['naturePrice']);
heavyPrice = parseDouble(item['peakMinPrice'] ?? item['heavyPrice']);
latePrice = parseDouble(item['lateMinPrice'] ?? item['latePrice']);
comfortPrice = parseDouble(item['comfortPrice']);
speedPrice = parseDouble(item['speedPrice']);
deliveryPrice = parseDouble(item['deliveryPrice']);
mashwariPrice = parseDouble(item['freePrice'] ?? item['mishwarVipPrice']);
familyPrice = parseDouble(item['familyPrice'] ?? item['ladyPrice']);
fuelPrice = parseDouble(item['fuelPrice']);
}
} catch (e) {
Log.print("Error parsing kazan percent: $e");
}
}
update();
}