handlePushNotification method

void handlePushNotification(
  1. PushMetaData pushMetaData,
  2. CredentialConfig? credentialConfig,
  3. TokenConfig? tokenConfig
)

Handles the push notification received from the backend and initiates the connection with the provided pushMetaData and credentialConfig or tokenConfig If the push notification is received while the client is not connected Note: Do not call the connect method after calling this method, it implicitly calls the connect method with the provided pushMetaData and credentialConfig or tokenConfig

Implementation

void handlePushNotification(PushMetaData pushMetaData,
    CredentialConfig? credentialConfig, TokenConfig? tokenConfig) {
  print(jsonEncode(pushMetaData));
  _isCallFromPush = true;

  if (pushMetaData.isAnswer == true) {
    print("_pendingAnswerFromPush true");
    _pendingAnswerFromPush = true;
  } else {
    print("_pendingAnswerFromPush false");
  }

  if (pushMetaData.isDecline == true) {
    _pendingDeclineFromPush = true;
  }

  _connectWithCallBack(pushMetaData, () {
    if (credentialConfig != null) {
      credentialLogin(credentialConfig);
    } else if (tokenConfig != null) {
      tokenLogin(tokenConfig);
    }
  });
}