import 'package:flyinsono/js_platform/methods.dart';
import 'package:flyinsono/managers/interfaces/window_state_manager.dart';
import 'package:get/get.dart';
import 'package:fis_common/logger/logger.dart';
import 'base.dart';

class SlaveWindowStatusChangeHandler extends MethodHandlerBase {
  SlaveWindowStatusChangeHandler()
      : super(TargetMethodName.SecondWindowStateChange);

  @override
  void execute(List<String> args) {
    print('SlaveWindowStatusChangeHandler execute with args:${args[0]}');
    logger.i('SlaveWindowStatusChangeHandler execute with args:${args[0]}');

    final windowStateManager = Get.find<IWindowStateManager>();
    windowStateManager.onSecondWindowChange
        .emit(this, args[0] == 'true' || args[0] == 'True');
  }
}
