showWaitingPopup method

void showWaitingPopup()

Implementation

void showWaitingPopup() {
  isWaitingCanceled = false;
  waitingCompleter = Completer<void>();

  Helper.showAlert(
      message: Constants.videoSwitchRequestMessage,
      actions: [
        TextButton(
            onPressed: () {
              isWaitingCanceled = true;
              outGoingRequest = false;
              closeDialog();
              Mirrorfly.cancelVideoCallSwitch();
            },
            child:
                const Text("CANCEL", style: TextStyle(color: buttonBgColor)))
      ],
      barrierDismissible: false,
      context: context);

  // Wait for 20 seconds or until canceled
  Future.delayed(const Duration(seconds: 20)).then((_) async {
    debugPrint("waiting duration end");
    if (!isWaitingCanceled) {
      outGoingRequest = false;
      closeDialog();
      Mirrorfly.cancelVideoCallSwitch();
      waitingCompleter.complete();
      // Get.back();
      var profile =
          await getProfileDetails(callList.first.userJid!.value.checkNull());
      toToast("No response from ${profile.getName()}");
    }
  });
}