onWebViewRedirect method

void onWebViewRedirect(
  1. JavaScriptMessage message
)

Implementation

void onWebViewRedirect(JavaScriptMessage message) {
  BootpayPrint('onWebViewRedirect: ${requestType}, ${message.message}');

  final data = json.decode(message.message);
  switch(data["event"]) {
    case "cancel":
      // widget.updateProgressShow(false);
      // if (this.widget.onCancel != null) this.widget.onCancel!(message.message);
      // bootpayClose();
      if(onCallbackCancel != null) onCallbackCancel!(message.message);
      if(onCallbackDebounceClose != null) onCallbackDebounceClose!();
      break;
    case "error":
      // widget.updateProgressShow(false);
      // if (this.widget.onError != null) this.widget.onError!(message.message);
      // if(this.widget.payload?.extra?.displayErrorResult != true) {
      //   bootpayClose();
      // }
      if(data["error_code"] == "PASSWORD_TOKEN_STOP") {
        if(onCallbackCancel != null) onCallbackCancel!(message.message);
        if(onCallbackDebounceClose != null) onCallbackDebounceClose!();

      } else {
        if(onCallbackError != null) onCallbackError!(message.message);
        if(payload?.extra?.displayErrorResult != true) {
          if(onCallbackDebounceClose != null) onCallbackDebounceClose!();
        }
      }

      break;
    case "close":
      // widget.updateProgressShow(false);
      if(payload?.extra?.displayErrorResult != true) {
        if(onCallbackDebounceClose != null) onCallbackDebounceClose!();
      }
      // if(this.widget.onClose != null) this.widget.onClose!();
      // BootpayBio().dismiss(context);
      break;
    case "issued":
      // widget.updateProgressShow(false);
      if(onCallbackIssued != null) onCallbackIssued!(message.message);
      if(payload?.extra?.displayErrorResult != true) {
        if(onCallbackDebounceClose != null) onCallbackDebounceClose!();
      }
      break;
    case "confirm":
      goConfirmEvent(message);
      break;
    case "done":
      // widget.updateProgressShow(false);
      // if (this.widget.onDone != null) this.widget.onDone!(message.message);
      // if(this.widget.payload?.extra?.displaySuccessResult != true) {
      //   bootpayClose();
      // }
      if(onCallbackDone != null) onCallbackDone!(message.message);
      if(payload?.extra?.displaySuccessResult != true) {
        if(onCallbackDebounceClose != null) onCallbackDebounceClose!();
      }
      break;
  }
}