import 'package:flyinsono/managers/interfaces/live_consultation.dart';
import 'package:get/get.dart';

import 'real_time_consultation_controller.dart';

class ListenerController {
  RealTimeConsultationController controller;

  ListenerController(this.controller) {
    _initListener();
  }

  void _initListener() {
    Get.find<ILiveConsultationManager>()
        .onExitConsultation
        .addListener(_onExitConsultation);
  }

  void dispose() {
    Get.find<ILiveConsultationManager>()
        .onExitConsultation
        .removeListener(_onExitConsultation);
  }

  void _onExitConsultation(Object sender, bool e) {
    controller.refreshRealTimeConsultation();
  }
}
