fix :
1 - multi module in Auth select save selected module 2 - add flutter gen for assets builder
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
import 'package:rasadyar_auth/auth.dart';
|
||||
import 'package:rasadyar_app/presentation/routes/app_pages.dart';
|
||||
import 'package:rasadyar_auth/data/models/local/module/module_model.dart';
|
||||
import 'package:rasadyar_auth/data/services/token_storage_service.dart';
|
||||
import 'package:rasadyar_core/core.dart';
|
||||
import 'package:rasadyar_inspection/inspection.dart';
|
||||
import 'package:rasadyar_livestock/presentation/routes/app_pages.dart';
|
||||
|
||||
class AuthService extends GetxService {
|
||||
var tokenService = Get.find<TokenStorageService>();
|
||||
@@ -13,25 +15,19 @@ class AuthService extends GetxService {
|
||||
super.onInit();
|
||||
|
||||
ever(tokenService.accessToken, (callback) {
|
||||
iLog('Access token callback: $callback, value: ${tokenService.accessToken.value}');
|
||||
accessRes.value = (callback != null);
|
||||
});
|
||||
|
||||
ever(tokenService.refreshToken, (callback) {
|
||||
fLog('Refresh token callback: $callback, value: ${tokenService.refreshToken.value}');
|
||||
refAccessRes.value = (callback != null);
|
||||
});
|
||||
|
||||
|
||||
everAll([accessRes, refAccessRes], (_) {
|
||||
if (accessRes.value && refAccessRes.value) {
|
||||
|
||||
Get.offAndToNamed(InspectionRoutes.inspection);
|
||||
fLog('Both accessToken and refreshToken are available: accessToken=${tokenService.accessToken.value}, refreshToken=${tokenService.refreshToken.value}');
|
||||
} else {
|
||||
fLog('One or both tokens are missing: accessToken=${tokenService.accessToken.value}, refreshToken=${tokenService.refreshToken.value}');
|
||||
var targetPage = getTargetPage(tokenService.appModule.value);
|
||||
Get.offAndToNamed(targetPage);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import 'package:flutter/animation.dart';
|
||||
import 'package:rasadyar_app/presentation/routes/app_pages.dart';
|
||||
import 'package:rasadyar_auth/data/services/token_storage_service.dart';
|
||||
import 'package:rasadyar_core/core.dart';
|
||||
import 'package:rasadyar_inspection/inspection.dart';
|
||||
|
||||
class SplashLogic extends GetxController with GetTickerProviderStateMixin {
|
||||
late final AnimationController scaleController;
|
||||
@@ -8,6 +9,8 @@ class SplashLogic extends GetxController with GetTickerProviderStateMixin {
|
||||
Rxn<Animation<double>> scaleAnimation = Rxn();
|
||||
Rxn<Animation<double>> rotationAnimation = Rxn();
|
||||
|
||||
var tokenService = Get.find<TokenStorageService>();
|
||||
|
||||
@override
|
||||
void onInit() {
|
||||
super.onInit();
|
||||
@@ -53,8 +56,9 @@ class SplashLogic extends GetxController with GetTickerProviderStateMixin {
|
||||
@override
|
||||
void onReady() {
|
||||
super.onReady();
|
||||
Future.delayed(const Duration(seconds: 1), () {
|
||||
Get.offAllNamed(InspectionRoutes.inspection);
|
||||
Future.delayed(const Duration(seconds: 1), () async {
|
||||
var module = tokenService.appModule.value;
|
||||
Get.offAndToNamed(getTargetPage(module));
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -20,11 +20,10 @@ class SplashPage extends GetView<SplashLogic> {
|
||||
scale: data.value!,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 1),
|
||||
child: Image.asset(
|
||||
Assets.imagesInnerSplash,
|
||||
child: Assets.images.innerSplash.image(
|
||||
width: 190,
|
||||
height: 190,
|
||||
),
|
||||
)
|
||||
),
|
||||
);
|
||||
}, controller.scaleAnimation),
|
||||
@@ -35,7 +34,7 @@ class SplashPage extends GetView<SplashLogic> {
|
||||
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 1),
|
||||
child: Image.asset(Assets.imagesOutterSplash),
|
||||
child: Assets.images.outterSplash.image()
|
||||
),
|
||||
);
|
||||
}, controller.rotationAnimation),
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
import 'package:rasadyar_app/presentation/pages/splash/logic.dart';
|
||||
import 'package:rasadyar_app/presentation/pages/splash/view.dart';
|
||||
import 'package:rasadyar_app/presentation/pages/system_design/system_design.dart';
|
||||
import 'package:rasadyar_auth/auth.dart';
|
||||
import 'package:rasadyar_auth/data/models/local/user_local/user_local_model.dart';
|
||||
import 'package:rasadyar_auth/presentation/routes/pages.dart';
|
||||
import 'package:rasadyar_core/core.dart';
|
||||
import 'package:rasadyar_inspection/inspection.dart';
|
||||
import 'package:rasadyar_livestock/presentation/routes/app_pages.dart';
|
||||
|
||||
part 'app_paths.dart';
|
||||
|
||||
@@ -23,6 +26,18 @@ sealed class AppPages {
|
||||
|
||||
...InspectionPages.pages,
|
||||
...AuthPages.pages,
|
||||
|
||||
...LiveStockPages.pages,
|
||||
];
|
||||
}
|
||||
|
||||
String getTargetPage(Module? value) {
|
||||
eLog('getTargetPage: $value');
|
||||
switch (value) {
|
||||
case Module.inspection:
|
||||
return InspectionRoutes.inspection;
|
||||
case Module.liveStocks:
|
||||
return LiveStockRoutes.init;
|
||||
default:
|
||||
return InspectionRoutes.inspection;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user