feat : profile and map
This commit is contained in:
@@ -1,5 +1,3 @@
|
||||
|
||||
import 'package:rasadyar_chicken/data/di/chicken_di.dart';
|
||||
import 'package:rasadyar_core/core.dart';
|
||||
|
||||
final di = GetIt.instance;
|
||||
@@ -7,7 +5,3 @@ final di = GetIt.instance;
|
||||
Future<void> setupPreInjection() async {
|
||||
await setupAllCoreProvider();
|
||||
}
|
||||
|
||||
Future<void> setupInjection() async {
|
||||
await setupChickenDI();
|
||||
}
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:rasadyar_app/infrastructure/di/di.dart';
|
||||
import 'package:rasadyar_chicken/chicken.dart';
|
||||
import 'package:rasadyar_chicken/data/di/chicken_di.dart';
|
||||
import 'package:rasadyar_core/core.dart';
|
||||
import 'package:rasadyar_inspection/injection/inspection_di.dart';
|
||||
import 'package:rasadyar_inspection/inspection.dart';
|
||||
|
||||
class CustomNavigationObserver extends NavigatorObserver {
|
||||
bool _isWorkDone = false;
|
||||
@@ -16,7 +18,11 @@ class CustomNavigationObserver extends NavigatorObserver {
|
||||
final routeName = route.settings.name;
|
||||
if (!_isWorkDone && routeName == ChickenRoutes.init) {
|
||||
_isWorkDone = true;
|
||||
await setupInjection();
|
||||
setupChickenDI();
|
||||
} else if (!_isWorkDone && (routeName == InspectionRoutes.init || routeName == InspectionRoutes.auth)) {
|
||||
_isWorkDone = true;
|
||||
|
||||
await setupInspectionDI();
|
||||
}
|
||||
tLog('CustomNavigationObserver: didPush - $routeName');
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ Future<void> main() async {
|
||||
await Get.find<TokenStorageService>().init();
|
||||
Get.put<AuthRouteResolver>(AppAuthRouteResolver());
|
||||
Get.put(AuthMiddleware());
|
||||
|
||||
runApp(MyApp());
|
||||
|
||||
// runApp(DevicePreview(builder: (context) => ForDevicePreview(),));
|
||||
|
||||
@@ -1,28 +1,28 @@
|
||||
|
||||
import 'package:rasadyar_core/core.dart';
|
||||
|
||||
class ModulesLogic extends GetxController {
|
||||
TokenStorageService tokenService = Get.find<TokenStorageService>();
|
||||
|
||||
List<ModuleModel> moduleList=[
|
||||
List<ModuleModel> moduleList = [
|
||||
ModuleModel(title: 'بازرسی', icon: Assets.icons.inspection.path, module: Module.inspection),
|
||||
ModuleModel(title: 'دام', icon: Assets.icons.liveStock.path, module: Module.liveStocks),
|
||||
ModuleModel(title: 'مرغ', icon: Assets.icons.liveStock.path, module: Module.chicken),
|
||||
];
|
||||
|
||||
|
||||
RxnInt selectedIndex = RxnInt(null);
|
||||
|
||||
|
||||
@override
|
||||
void onReady() {
|
||||
super.onReady();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@override
|
||||
void onClose() {
|
||||
super.onClose();
|
||||
}
|
||||
|
||||
void saveModule(Module module) {
|
||||
tokenService.saveModule(module);
|
||||
tokenService.appModule.value = module;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,6 +25,9 @@ class ModulesPage extends GetView<ModulesLogic> {
|
||||
icon: module.icon,
|
||||
onTap: () {
|
||||
controller.selectedIndex.value = index;
|
||||
controller.saveModule(module.module);
|
||||
|
||||
// Navigate to the appropriate route based on the selected module
|
||||
switch (module.module) {
|
||||
case Module.inspection:
|
||||
Get.toNamed(InspectionRoutes.init);
|
||||
|
||||
@@ -152,7 +152,7 @@ class SplashLogic extends GetxController with GetTickerProviderStateMixin {
|
||||
try {
|
||||
final isUpdateNeeded = await checkVersion();
|
||||
if (isUpdateNeeded) return;
|
||||
|
||||
tokenService.getModule();
|
||||
final module = tokenService.appModule.value;
|
||||
final target = getTargetPage(module);
|
||||
Get.offAndToNamed(target);
|
||||
|
||||
Reference in New Issue
Block a user