12345678910111213141516171819202122232425262728293031 |
- 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<TokenReplacedNotification> {
- 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);
- }
- }
|