Update: 2026-06-26 04:04:03

This commit is contained in:
Hamza-Ayed
2026-06-26 04:04:04 +03:00
parent aea0c8e44e
commit da9e6eb981
10 changed files with 325 additions and 112 deletions

View File

@@ -79,18 +79,12 @@ class SessionManager extends GetxController {
for (int attempt = 1; attempt <= _maxRetries; attempt++) {
Log.print('🔄 Session refresh attempt $attempt/$_maxRetries');
await CRUD().getJWT();
final success = await CRUD().getJWT();
// التحقق من نجاح التجديد
final newRawToken = box.read(BoxName.jwt)?.toString() ?? '';
final newToken = newRawToken.isNotEmpty ? r(newRawToken).toString().split(Env.addd)[0] : '';
final isValid = CRUD.isJwtValid(newToken);
if (isValid) {
if (success) {
status.value = SessionStatus.valid;
isRefreshing.value = false;
// إشعار النجاح
if (!silent) {
_showSessionRefreshedNotification();
}
@@ -99,7 +93,6 @@ class SessionManager extends GetxController {
return true;
}
// إذا فشلت المحاولة، انتظر قبل إعادة المحاولة
if (attempt < _maxRetries) {
await Future.delayed(Duration(seconds: attempt));
}