import 'package:fis_common/logger/logger.dart';
import 'package:flyinsono/architecture/router/router.dart';
import 'package:flyinsono/js_platform/methods.dart';
import 'package:flyinsono/views/desktop/user_setting/controller.dart';
import 'package:get/get.dart';

import '../../architecture/router/desktop/names.dart';
import 'base.dart';

class SecondWindowStatusHandler extends MethodHandlerBase {
  SecondWindowStatusHandler()
      : super(TargetMethodName.SecondWindowOperationDown);

  @override
  void execute(List<String> args) {
    try {
      final currentRouter = router.getCurrentNameByNavId(NavIds.HOME);
      if (currentRouter == RouteNames.User.Setting) {
        final userSettingController = Get.find<UserSettingController>();
        userSettingController.handleSecondWindowStatus(args[0]);
      }
    } catch (e) {
      logger.e('SecondWindowStatusHandler  execute ex:', e);
    }
  }
}
