decline method

Future<void> decline(
  1. ChatId chatId
)

Declines an OngoingCall identified by the given chatId.

Implementation

Future<void> decline(ChatId chatId) async {
  Log.debug('decline($chatId)', '$runtimeType');

  final Rx<OngoingCall>? call = _callsRepo[chatId];
  if (call != null) {
    // Closing the popup window will kill the pending requests, so it's
    // required to await the decline.
    if (WebUtils.isPopup) {
      await _callsRepo.decline(chatId);
      call.value.state.value = OngoingCallState.ended;
      call.value.dispose();
    } else {
      call.value.state.value = OngoingCallState.ended;
      call.value.dispose();
      await _callsRepo.decline(chatId);
    }
  }
}