feat: integrate GService into various root logic classes and log user roles during initialization

This commit is contained in:
2025-12-29 16:44:36 +03:30
parent 4a96dbe2b8
commit 9e2e7845c8
14 changed files with 31 additions and 3 deletions

View File

@@ -39,6 +39,11 @@ class ActiveHatchingLogic extends GetxController {
}
Future<void> getHatchingList([bool isLoadingMore = false]) async {
if (isLoadingMore) {
isLoadingMoreList.value = true;
} else {

View File

@@ -13,6 +13,7 @@ enum ErrorLocationType { serviceDisabled, permissionDenied, none }
class CityPoultryRootLogic extends GetxController {
var tokenService = Get.find<TokenStorageService>();
var gService = Get.find<GService>();
late CityPoultryRepository cityPoultryRepository;
@@ -44,6 +45,7 @@ class CityPoultryRootLogic extends GetxController {
void onInit() {
super.onInit();
cityPoultryRepository = diChicken.get<CityPoultryRepository>();
fLog('gService: ${gService.getRole(Module.chicken)}');
}
void toggleExpanded(int index) {
@@ -69,14 +71,12 @@ class CityPoultryRootLogic extends GetxController {
final currentRoute = Get.routing.current;
// بررسی کن که آیا route فعلی یکی از routeهای داخلی است
final isInternalRoute =
currentRoute == CityPoultryRoutes.activeHatchingCityPoultry ||
currentRoute == CityPoultryRoutes.newInspectionCityPoultry ||
currentRoute == CityPoultryRoutes.actionCityPoultry;
// فقط اگر می‌توان pop کرد و در یکی از صفحه‌های داخلی هستیم، pop کن
if ( isInternalRoute) {
if (isInternalRoute) {
Get.back(id: cityPoultryActionKey);
return;
}