import 'package:fis_i18n/i18n.dart'; import 'package:fis_jsonrpc/rpc.dart'; import 'package:flyinsonolite/helpers/dialoghelper.dart'; import 'package:flyinsonolite/infrastructure/storage.dart'; import 'package:flyinsonolite/infrastructure/routeconstants.dart'; import 'package:get/get.dart'; /// 账号被挤出通知 class TokenReplacedNotificationHandler extends NotificationHandler { TokenReplacedNotificationHandler() : super(NotificationTypeEnum.TokenReplacedNotification); @override void execute(TokenReplacedNotification message) async { super.execute(message); await Storage.user.handleLogOutAsync(goToLoginPage: false); if (Get.context == null) return; DialogHelper.showConfirmDialog( Get.context!, i18nBook.auth.tokenReplacedTips.t, () async { Get.close(1); if (Get.currentRoute != RouteConstants.consultationRouteConstants.applyconsultation) { ///applyconsultation如果直接offAllNamed会多次Rebuild Get.close(1); } await Get.offAllNamed(Storage.loginRoute); }, showCancelButton: false, showCloseButton: false); } }