getInfo method

IdenaUrl getInfo(
  1. String link
)

Implementation

IdenaUrl getInfo(String link) {
  this.deepLinkParamSignin = null;
  this.deepLinkParamSend = null;
  var list;
  Uri _latestUri;
  if (link != null) _latestUri = Uri.parse(link);

  if (_latestUri != null && _latestUri.host == DeepLinkParamSend.HOST) {
    list = _latestUri?.queryParametersAll?.entries?.toList();
    if (list != null) {
      deepLinkParamSend = new DeepLinkParamSend();
      for (var i = 0; i < list.length; i++) {
        switch (list[i].key) {
          case "address":
            {
              deepLinkParamSend.address = list[i].value[0];
            }
            break;
          case "amount":
            {
              deepLinkParamSend.amount = list[i].value[0];
            }
            break;
          case "comment":
            {
              deepLinkParamSend.comment = list[i].value[0];
            }
            break;
        }
      }
    }
    //print("address: " + deepLinkParamSend.address);
    //print("amount: " + deepLinkParamSend.amount);
    //print("comment: " + deepLinkParamSend.comment);
    this.deepLinkParamSend = deepLinkParamSend;

    return this;
  } else if (_latestUri != null &&
      _latestUri.host == DeepLinkParamSignin.HOST) {
    list = _latestUri?.queryParametersAll?.entries?.toList();
    if (list != null) {
      deepLinkParamSignin = new DeepLinkParamSignin();
      for (var i = 0; i < list.length; i++) {
        switch (list[i].key) {
          case "nonce_endpoint":
            {
              deepLinkParamSignin.nonceEndpoint = list[i].value[0];
            }
            break;
          case "token":
            {
              deepLinkParamSignin.token = list[i].value[0];
            }
            break;
          case "callback_url":
            {
              deepLinkParamSignin.callbackUrl = list[i].value[0];
            }
            break;
          case "authentication_endpoint":
            {
              deepLinkParamSignin.authenticationEndpoint = list[i].value[0];
            }
            break;
        }
      }
      //print("nonce_endpoint: " + deepLinkParamSignin.nonceEndpoint);
      //print("token: " + deepLinkParamSignin.token);
      //print("callback_url: " + deepLinkParamSignin.callbackUrl);
      //print("authentication_endpoint: " +
      //    deepLinkParamSignin.authenticationEndpoint);
      this.deepLinkParamSignin = deepLinkParamSignin;

      return this;
    }
  }

  return null;
}