Update: 2026-07-30 02:27:45

This commit is contained in:
Hamza-Ayed
2026-07-30 02:27:45 +03:00
parent 5f62455113
commit ca4a7c2e70
56 changed files with 3391 additions and 709 deletions
@@ -10,6 +10,10 @@ import '../../../core/utils/app_snackbar.dart';
import '../../../core/services/push_notification_service.dart';
class AuthController extends GetxController {
/// App-store review account that skips biometric setup. Must match
/// REVIEWER_EMAIL on the server.
static const String _reviewerEmail = 'reviewer@musadaq.jo';
final Dio _dio = DioClient().client;
final SecureStorage _storage = SecureStorage();
@@ -96,6 +100,12 @@ class AuthController extends GetxController {
// Save secure data
await _storage.saveToken(data['access_token']);
await _storage.saveDeviceSecret(data['device_secret']);
// Both are required to refresh the session later: the server keeps
// refresh tokens per device.
await _storage.saveDeviceId(deviceId);
if (data['refresh_token'] != null) {
await _storage.saveRefreshToken(data['refresh_token']);
}
if (data['user']['email'] != null) {
await _storage.saveEmail(data['user']['email']);
}
@@ -103,7 +113,7 @@ class AuthController extends GetxController {
AppSnackbar.showSuccess('مرحباً بك', 'تم تسجيل الدخول بنجاح');
// Navigate to Biometric Setup (unless it's the reviewer)
if (data['user']['email'] == 'reviewer@musadaq.jo') {
if (data['user']['email'] == _reviewerEmail) {
Get.offAllNamed(AppRoutes.MAIN);
} else {
Get.offAllNamed(AppRoutes.BIOMETRIC_SETUP);
@@ -170,6 +180,10 @@ class AuthController extends GetxController {
if (data['device_secret'] != null) {
await _storage.saveDeviceSecret(data['device_secret']);
}
await _storage.saveDeviceId(deviceId);
if (data['refresh_token'] != null) {
await _storage.saveRefreshToken(data['refresh_token']);
}
if (data['user']['email'] != null) {
await _storage.saveEmail(data['user']['email']);
@@ -178,7 +192,7 @@ class AuthController extends GetxController {
AppSnackbar.showSuccess('مرحباً بك', 'تم تسجيل الدخول بنجاح');
// Navigate to Dashboard for reviewer, else Biometric Setup
if (email == 'reviewer@musadaq.jo') {
if (email == _reviewerEmail) {
Get.offAllNamed(AppRoutes.MAIN);
} else {
Get.offAllNamed(AppRoutes.BIOMETRIC_SETUP);