import 'package:get/get.dart'; import 'package:app/jpush/jpush_receive.dart'; import 'package:initializer/app_initializer.dart'; import 'package:plugin_basic/constants/app_constant.dart'; import 'package:plugin_basic/service/user_service.dart'; import 'package:plugin_platform/engine/sp/sp_util.dart'; import 'package:router/componentRouter/component_router_service.dart'; import 'package:shared/utils/device_utils.dart'; import 'package:shared/utils/log_utils.dart'; import 'package:shared/utils/util.dart'; class SplashController extends GetxController { @override void onReady() { super.onReady(); UserService.to; _gotoNextPage(); } } void _gotoNextPage() async { // await AppInitializer.delayInitialize(futureTasks: [ // () async { // await FlutterBugly.init( // androidAppId: "12345678", // iOSAppId: "12345678", // ); // }, // ], normalTasks: [ // () { // if (DeviceUtils.isIOS || DeviceUtils.isAndroid) { // jpush.init(); // } // }, // ]); // 先查询原生平台有没有保存需要跳转的子路由 // String routerName = await AppChannel.getNativeRouterName(); // Log.d('SplashController - 查询原生平台有没有保存需要跳转的子路由:$routerName'); String? token = SPUtil.getString(AppConstant.storageToken); UserService.to.setToken(token); if (UserService.to.isLogin) { //去Attendance页面签到 Log.d("去首页页面"); ComponentRouterServices.authService.startPopAllMainPage(); } else { //去登录页面 Log.d("去登录页面"); ComponentRouterServices.authService.startPopAllLoginPage(); } // if (!Utils.isEmpty(routerName)) { // // 只跳转一次 // Get.offAllNamed(routerName); // AppChannel.clearNativeRouterName(); // } else { // // 如果没有经历过GUIDE页面,进入GUIDE,否则进入首页 // MainPage.startWithPopAll(); // } //跳转页面之后清除 Android 的 SplashScreen 库 // if (Device.isAndroid) { // AppChannel.skipAndroidSplashScreen(); // } }