refactor: migrate JWT storage to secure storage, update assets, and enhance login verification logic.

This commit is contained in:
Hamza-Ayed
2026-08-06 22:54:52 +03:00
parent 52101e650c
commit 97471fd2bd
12 changed files with 239 additions and 138 deletions
@@ -939,13 +939,18 @@ class HomeCaptainController extends GetxController {
bool isZeroCommissionActive = false;
getCountRideToday() async {
var res = await CRUD().get(
var res = await CRUD().getWallet(
link: AppLink.getCountRide,
payload: {'driver_id': box.read(BoxName.driverID).toString()});
data = jsonDecode(res);
countRideToday = data['message'][0]['count'].toString();
update();
if (res != 'failure' && res != 'token_expired' && res != 'rate_limited') {
try {
var dataDecoded = res is String ? jsonDecode(res) : res;
if (dataDecoded is Map && dataDecoded['status'] == 'success' && dataDecoded['message'] != null) {
countRideToday = dataDecoded['message'][0]['count'].toString();
update();
}
} catch (_) {}
}
// Fetch Gamification Streak as well
getDriverStreak();
@@ -87,8 +87,7 @@ class ComplaintController extends GetxController {
var uri = Uri.parse(AppLink.uploadAudio);
var request = http.MultipartRequest('POST', uri);
final jwt = box.read(BoxName.jwt);
String token = jwt != null ? r(jwt).toString().split(Env.addd)[0] : '';
String token = await storage.read(key: BoxName.jwt) ?? '';
final String fingerPrint = box.read(BoxName.deviceFingerprint)?.toString() ?? '';
var mimeType = lookupMimeType(audioFile.path);