feat: integrate GService into various root logic classes and log user roles during initialization
This commit is contained in:
@@ -14,6 +14,7 @@ enum ErrorLocationType { serviceDisabled, permissionDenied, none }
|
|||||||
|
|
||||||
class CityJahadRootLogic extends GetxController {
|
class CityJahadRootLogic extends GetxController {
|
||||||
var tokenService = Get.find<TokenStorageService>();
|
var tokenService = Get.find<TokenStorageService>();
|
||||||
|
var gService = Get.find<GService>();
|
||||||
|
|
||||||
late CityJahadRepository cityJahadRepository;
|
late CityJahadRepository cityJahadRepository;
|
||||||
|
|
||||||
@@ -45,6 +46,7 @@ class CityJahadRootLogic extends GetxController {
|
|||||||
void onInit() {
|
void onInit() {
|
||||||
super.onInit();
|
super.onInit();
|
||||||
cityJahadRepository = diChicken.get<CityJahadRepository>();
|
cityJahadRepository = diChicken.get<CityJahadRepository>();
|
||||||
|
fLog('gService: ${gService.getRole(Module.chicken)}');
|
||||||
}
|
}
|
||||||
|
|
||||||
void toggleExpanded(int index) {
|
void toggleExpanded(int index) {
|
||||||
|
|||||||
@@ -39,6 +39,11 @@ class ActiveHatchingLogic extends GetxController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<void> getHatchingList([bool isLoadingMore = false]) async {
|
Future<void> getHatchingList([bool isLoadingMore = false]) async {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (isLoadingMore) {
|
if (isLoadingMore) {
|
||||||
isLoadingMoreList.value = true;
|
isLoadingMoreList.value = true;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ enum ErrorLocationType { serviceDisabled, permissionDenied, none }
|
|||||||
|
|
||||||
class CityPoultryRootLogic extends GetxController {
|
class CityPoultryRootLogic extends GetxController {
|
||||||
var tokenService = Get.find<TokenStorageService>();
|
var tokenService = Get.find<TokenStorageService>();
|
||||||
|
var gService = Get.find<GService>();
|
||||||
|
|
||||||
late CityPoultryRepository cityPoultryRepository;
|
late CityPoultryRepository cityPoultryRepository;
|
||||||
|
|
||||||
@@ -44,6 +45,7 @@ class CityPoultryRootLogic extends GetxController {
|
|||||||
void onInit() {
|
void onInit() {
|
||||||
super.onInit();
|
super.onInit();
|
||||||
cityPoultryRepository = diChicken.get<CityPoultryRepository>();
|
cityPoultryRepository = diChicken.get<CityPoultryRepository>();
|
||||||
|
fLog('gService: ${gService.getRole(Module.chicken)}');
|
||||||
}
|
}
|
||||||
|
|
||||||
void toggleExpanded(int index) {
|
void toggleExpanded(int index) {
|
||||||
@@ -69,13 +71,11 @@ class CityPoultryRootLogic extends GetxController {
|
|||||||
|
|
||||||
final currentRoute = Get.routing.current;
|
final currentRoute = Get.routing.current;
|
||||||
|
|
||||||
// بررسی کن که آیا route فعلی یکی از routeهای داخلی است
|
|
||||||
final isInternalRoute =
|
final isInternalRoute =
|
||||||
currentRoute == CityPoultryRoutes.activeHatchingCityPoultry ||
|
currentRoute == CityPoultryRoutes.activeHatchingCityPoultry ||
|
||||||
currentRoute == CityPoultryRoutes.newInspectionCityPoultry ||
|
currentRoute == CityPoultryRoutes.newInspectionCityPoultry ||
|
||||||
currentRoute == CityPoultryRoutes.actionCityPoultry;
|
currentRoute == CityPoultryRoutes.actionCityPoultry;
|
||||||
|
|
||||||
// فقط اگر میتوان pop کرد و در یکی از صفحههای داخلی هستیم، pop کن
|
|
||||||
if (isInternalRoute) {
|
if (isInternalRoute) {
|
||||||
Get.back(id: cityPoultryActionKey);
|
Get.back(id: cityPoultryActionKey);
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -176,6 +176,7 @@ class ProfileLogic extends GetxController {
|
|||||||
Future<void> changeUserRole(String newRole) async {
|
Future<void> changeUserRole(String newRole) async {
|
||||||
dLog(newRole);
|
dLog(newRole);
|
||||||
await gService.saveRoute(Module.chicken, newRole);
|
await gService.saveRoute(Module.chicken, newRole);
|
||||||
|
await gService.saveRole(Module.chicken, newRole);
|
||||||
|
|
||||||
Get.offAllNamed(newRole);
|
Get.offAllNamed(newRole);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ enum ErrorLocationType { serviceDisabled, permissionDenied, none }
|
|||||||
|
|
||||||
class JahadRootLogic extends GetxController {
|
class JahadRootLogic extends GetxController {
|
||||||
var tokenService = Get.find<TokenStorageService>();
|
var tokenService = Get.find<TokenStorageService>();
|
||||||
|
var gService = Get.find<GService>();
|
||||||
|
|
||||||
late JahadRepository jahadRepository;
|
late JahadRepository jahadRepository;
|
||||||
|
|
||||||
@@ -45,6 +46,7 @@ class JahadRootLogic extends GetxController {
|
|||||||
void onInit() {
|
void onInit() {
|
||||||
super.onInit();
|
super.onInit();
|
||||||
jahadRepository = diChicken.get<JahadRepository>();
|
jahadRepository = diChicken.get<JahadRepository>();
|
||||||
|
fLog('gService: ${gService.getRole(Module.chicken)}');
|
||||||
}
|
}
|
||||||
|
|
||||||
void toggleExpanded(int index) {
|
void toggleExpanded(int index) {
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ class KillHouseRootLogic extends GetxController {
|
|||||||
RxInt currentPage = 1.obs;
|
RxInt currentPage = 1.obs;
|
||||||
|
|
||||||
var tokenService = Get.find<TokenStorageService>();
|
var tokenService = Get.find<TokenStorageService>();
|
||||||
|
var gService = Get.find<GService>();
|
||||||
|
|
||||||
late KillHouseRepository killHouseRepository;
|
late KillHouseRepository killHouseRepository;
|
||||||
|
|
||||||
@@ -19,6 +20,7 @@ class KillHouseRootLogic extends GetxController {
|
|||||||
void onInit() {
|
void onInit() {
|
||||||
super.onInit();
|
super.onInit();
|
||||||
killHouseRepository = diChicken.get<KillHouseRepository>();
|
killHouseRepository = diChicken.get<KillHouseRepository>();
|
||||||
|
fLog('gService: ${gService.getRole(Module.chicken)}');
|
||||||
}
|
}
|
||||||
|
|
||||||
final pages = [
|
final pages = [
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ class WarehouseAndDistributionRootLogic extends GetxController {
|
|||||||
|
|
||||||
late DioRemote dioRemote;
|
late DioRemote dioRemote;
|
||||||
var tokenService = Get.find<TokenStorageService>();
|
var tokenService = Get.find<TokenStorageService>();
|
||||||
|
var gService = Get.find<GService>();
|
||||||
|
|
||||||
RxInt currentPage = 2.obs;
|
RxInt currentPage = 2.obs;
|
||||||
List<Widget> pages = [
|
List<Widget> pages = [
|
||||||
@@ -68,6 +69,7 @@ class WarehouseAndDistributionRootLogic extends GetxController {
|
|||||||
super.onInit();
|
super.onInit();
|
||||||
|
|
||||||
killHouseRepository = diChicken.get<KillHouseRepository>();
|
killHouseRepository = diChicken.get<KillHouseRepository>();
|
||||||
|
fLog('gService: ${gService.getRole(Module.chicken)}');
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ enum ErrorLocationType { serviceDisabled, permissionDenied, none }
|
|||||||
|
|
||||||
class PoultryScienceRootLogic extends GetxController {
|
class PoultryScienceRootLogic extends GetxController {
|
||||||
var tokenService = Get.find<TokenStorageService>();
|
var tokenService = Get.find<TokenStorageService>();
|
||||||
|
var gService = Get.find<GService>();
|
||||||
|
|
||||||
late PoultryScienceRepository poultryRepository;
|
late PoultryScienceRepository poultryRepository;
|
||||||
|
|
||||||
@@ -46,6 +47,7 @@ class PoultryScienceRootLogic extends GetxController {
|
|||||||
void onInit() {
|
void onInit() {
|
||||||
super.onInit();
|
super.onInit();
|
||||||
poultryRepository = diChicken.get<PoultryScienceRepository>();
|
poultryRepository = diChicken.get<PoultryScienceRepository>();
|
||||||
|
fLog('gService: ${gService.getRole(Module.chicken)}');
|
||||||
}
|
}
|
||||||
|
|
||||||
void toggleExpanded(int index) {
|
void toggleExpanded(int index) {
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ enum ErrorLocationType { serviceDisabled, permissionDenied, none }
|
|||||||
|
|
||||||
class ProvinceInspectorRootLogic extends GetxController {
|
class ProvinceInspectorRootLogic extends GetxController {
|
||||||
var tokenService = Get.find<TokenStorageService>();
|
var tokenService = Get.find<TokenStorageService>();
|
||||||
|
var gService = Get.find<GService>();
|
||||||
|
|
||||||
late ProvinceInspectorRepository provinceInspectorRepository;
|
late ProvinceInspectorRepository provinceInspectorRepository;
|
||||||
|
|
||||||
@@ -45,6 +46,7 @@ class ProvinceInspectorRootLogic extends GetxController {
|
|||||||
void onInit() {
|
void onInit() {
|
||||||
super.onInit();
|
super.onInit();
|
||||||
provinceInspectorRepository = diChicken.get<ProvinceInspectorRepository>();
|
provinceInspectorRepository = diChicken.get<ProvinceInspectorRepository>();
|
||||||
|
fLog('gService: ${gService.getRole(Module.chicken)}');
|
||||||
}
|
}
|
||||||
|
|
||||||
void toggleExpanded(int index) {
|
void toggleExpanded(int index) {
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ enum ErrorLocationType { serviceDisabled, permissionDenied, none }
|
|||||||
|
|
||||||
class ProvinceOperatorRootLogic extends GetxController {
|
class ProvinceOperatorRootLogic extends GetxController {
|
||||||
var tokenService = Get.find<TokenStorageService>();
|
var tokenService = Get.find<TokenStorageService>();
|
||||||
|
var gService = Get.find<GService>();
|
||||||
|
|
||||||
late ProvinceOperatorRepository provinceOperatorRepository;
|
late ProvinceOperatorRepository provinceOperatorRepository;
|
||||||
|
|
||||||
@@ -44,6 +45,7 @@ class ProvinceOperatorRootLogic extends GetxController {
|
|||||||
void onInit() {
|
void onInit() {
|
||||||
super.onInit();
|
super.onInit();
|
||||||
provinceOperatorRepository = diChicken.get<ProvinceOperatorRepository>();
|
provinceOperatorRepository = diChicken.get<ProvinceOperatorRepository>();
|
||||||
|
fLog('gService: ${gService.getRole(Module.chicken)}');
|
||||||
}
|
}
|
||||||
|
|
||||||
void toggleExpanded(int index) {
|
void toggleExpanded(int index) {
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ enum ErrorLocationType { serviceDisabled, permissionDenied, none }
|
|||||||
|
|
||||||
class ProvinceSupervisorRootLogic extends GetxController {
|
class ProvinceSupervisorRootLogic extends GetxController {
|
||||||
var tokenService = Get.find<TokenStorageService>();
|
var tokenService = Get.find<TokenStorageService>();
|
||||||
|
var gService = Get.find<GService>();
|
||||||
|
|
||||||
late ProvinceSupervisorRepository provinceSupervisorRepository;
|
late ProvinceSupervisorRepository provinceSupervisorRepository;
|
||||||
|
|
||||||
@@ -46,6 +47,7 @@ class ProvinceSupervisorRootLogic extends GetxController {
|
|||||||
super.onInit();
|
super.onInit();
|
||||||
provinceSupervisorRepository = diChicken
|
provinceSupervisorRepository = diChicken
|
||||||
.get<ProvinceSupervisorRepository>();
|
.get<ProvinceSupervisorRepository>();
|
||||||
|
fLog('gService: ${gService.getRole(Module.chicken)}');
|
||||||
}
|
}
|
||||||
|
|
||||||
void toggleExpanded(int index) {
|
void toggleExpanded(int index) {
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ class StewardRootLogic extends GetxController {
|
|||||||
|
|
||||||
late DioRemote dioRemote;
|
late DioRemote dioRemote;
|
||||||
var tokenService = Get.find<TokenStorageService>();
|
var tokenService = Get.find<TokenStorageService>();
|
||||||
|
var gService = Get.find<GService>();
|
||||||
late CommonRepository commonRepository;
|
late CommonRepository commonRepository;
|
||||||
late StewardRepository stewardRepository;
|
late StewardRepository stewardRepository;
|
||||||
late ChickenLocalDataSource localDatasource;
|
late ChickenLocalDataSource localDatasource;
|
||||||
@@ -61,6 +62,7 @@ class StewardRootLogic extends GetxController {
|
|||||||
localDatasource = diChicken.get<ChickenLocalDataSource>();
|
localDatasource = diChicken.get<ChickenLocalDataSource>();
|
||||||
commonRepository = diChicken.get<CommonRepository>();
|
commonRepository = diChicken.get<CommonRepository>();
|
||||||
stewardRepository = diChicken.get<StewardRepository>();
|
stewardRepository = diChicken.get<StewardRepository>();
|
||||||
|
fLog('gService: ${gService.getRole(Module.chicken)}');
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ enum ErrorLocationType { serviceDisabled, permissionDenied, none }
|
|||||||
|
|
||||||
class SuperAdminRootLogic extends GetxController {
|
class SuperAdminRootLogic extends GetxController {
|
||||||
var tokenService = Get.find<TokenStorageService>();
|
var tokenService = Get.find<TokenStorageService>();
|
||||||
|
var gService = Get.find<GService>();
|
||||||
|
|
||||||
late SuperAdminRepository superAdminRepository;
|
late SuperAdminRepository superAdminRepository;
|
||||||
|
|
||||||
@@ -45,6 +46,7 @@ class SuperAdminRootLogic extends GetxController {
|
|||||||
void onInit() {
|
void onInit() {
|
||||||
super.onInit();
|
super.onInit();
|
||||||
superAdminRepository = diChicken.get<SuperAdminRepository>();
|
superAdminRepository = diChicken.get<SuperAdminRepository>();
|
||||||
|
fLog('gService: ${gService.getRole(Module.chicken)}');
|
||||||
}
|
}
|
||||||
|
|
||||||
void toggleExpanded(int index) {
|
void toggleExpanded(int index) {
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ enum ErrorLocationType { serviceDisabled, permissionDenied, none }
|
|||||||
|
|
||||||
class VetFarmRootLogic extends GetxController {
|
class VetFarmRootLogic extends GetxController {
|
||||||
var tokenService = Get.find<TokenStorageService>();
|
var tokenService = Get.find<TokenStorageService>();
|
||||||
|
var gService = Get.find<GService>();
|
||||||
|
|
||||||
late VetFarmRepository vetFarmRepository;
|
late VetFarmRepository vetFarmRepository;
|
||||||
|
|
||||||
@@ -45,6 +46,7 @@ class VetFarmRootLogic extends GetxController {
|
|||||||
void onInit() {
|
void onInit() {
|
||||||
super.onInit();
|
super.onInit();
|
||||||
vetFarmRepository = diChicken.get<VetFarmRepository>();
|
vetFarmRepository = diChicken.get<VetFarmRepository>();
|
||||||
|
fLog('gService: ${gService.getRole(Module.chicken)}');
|
||||||
}
|
}
|
||||||
|
|
||||||
void toggleExpanded(int index) {
|
void toggleExpanded(int index) {
|
||||||
|
|||||||
Reference in New Issue
Block a user