How to use the xdl.Exp.sendAsync function in xdl

To help you get started, we’ve selected a few xdl examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github expo / exp / src / sendTo.js View on Github external
async function sendUrlAsync(url, recipient) {
  log('Sending URL to', recipient);
  simpleSpinner.start();
  try {
    var result = await Exp.sendAsync(recipient, url);
  } finally {
    simpleSpinner.stop();
  }
  log('Sent.');
  return result;
}
github expo / xde / src / ui / App.js View on Github external
await UserSettings.mergeAsync({'confirmBeforePublish': false});
      } else if (choice === 2) {
        return;
      }
    }

    this._logInfo("Publishing...");
    try {
      let result = await Project.publishAsync(this.state.projectRoot);
      this._logInfo(`Published to ${result.url}`);

      let notificationMessage = 'Project published successfully.';
      let sendTo = this.state.sendTo;
      if (sendTo) {
        try {
          await Exp.sendAsync(sendTo, result.url);
          this._logInfo(`Sent link ${result.url} to ${sendTo}.`);
        } catch (err) {
          this._logError(`Could not send link to ${sendTo}: ${err}`);
        }
        notificationMessage = `${notificationMessage} Sent to ${sendTo}`;
      }
      this._showNotification('success', notificationMessage);
    } catch (err) {
      this._showNotification('error', 'Project failed to publish.');
      this._logError(`Failed to publish package: ${err.message}`);
    }
  };
github expo / xde / src / ui / MainScreen.js View on Github external
_sendClickedAsync = async sendTo => {
    Analytics.logEvent('Click Send');

    this.setState({ sendTo });
    let url_ = this.state.computedUrl;
    try {
      await Exp.sendAsync(sendTo, url_);
      this._logInfo(`Sent link ${url_} to ${sendTo}.`);
    } catch (err) {
      this._logError(`Could not send link to ${sendTo}: ${err}`);
      this._logError(
        "If you're trying to SMS a link to a mobile device, make sure you are using the `+` sign and the country code at the beginning of the number."
      );
      return;
    }
    await UserSettings.setAsync('sendTo', sendTo);
  };
github expo / xde / src / ui / App.js View on Github external
_sendClickedAsync = async (sendTo) => {
    Analytics.logEvent('Click Send');

    this.setState({sendTo});
    let url_ = this.state.computedUrl;
    try {
      await Exp.sendAsync(sendTo, url_);
      this._logInfo(`Sent link ${url_} to ${sendTo}.`);
      UserSettings.updateAsync('sendTo', sendTo);
    } catch (err) {
      this._logError(`Could not send link to ${sendTo}: ${err}`);
      this._logError("If you're trying to SMS a link to a mobile device, make sure you are using the `+` sign and the country code at the beginning of the number.");
    }
  };
github NervJS / taro / packages / taro-rn-runner / src / index.js View on Github external
rl.question(defaultRecipient ? `[default: ${defaultRecipient}]> ` : '> ', async sendTo => {
        cleanup()
        if (!sendTo && defaultRecipient) {
          sendTo = defaultRecipient
        }
        sendTo = sendTo && sendTo.trim()
        if (!sendTo) {
          cancel()
          return
        }
        log.withTimestamp(`Sending ${lanAddress} to ${sendTo}...`)

        let sent = false
        try {
          await Exp.sendAsync(sendTo, lanAddress, true)
          log.withTimestamp(`Sent link successfully.`)
          sent = true
        } catch (err) {
          log.withTimestamp(`Could not send link. ${err}`)
        }
        printUsage()
        if (sent) {
          await UserSettings.setAsync('sendTo', sendTo)
        }
      })
      return
github react-community / create-react-native-app / react-native-scripts / src / scripts / start.js View on Github external
rl.question(defaultRecipient ? `[default: ${defaultRecipient}]> ` : '> ', async sendTo => {
        cleanup();
        if (!sendTo && defaultRecipient) {
          sendTo = defaultRecipient;
        }
        sendTo = sendTo && sendTo.trim();
        if (!sendTo) {
          cancel();
          return;
        }
        log.withTimestamp(`Sending ${lanAddress} to ${sendTo}...`);

        let sent = false;
        try {
          await Exp.sendAsync(sendTo, lanAddress, true);
          log.withTimestamp(`Sent link successfully.`);
          sent = true;
        } catch (err) {
          log.withTimestamp(`Could not send link. ${err}`);
        }
        printUsage();
        if (sent) {
          await UserSettings.setAsync('sendTo', sendTo);
        }
      });
      return;
github expo / xde / src / ui / MainScreen.js View on Github external
}
    }

    this._logInfo('Publishing...');
    try {
      let result = await Project.publishAsync(this.state.projectRoot);
      await new Promise(resolve => {
        requestAnimationFrame(resolve);
      });

      this._logInfo(`Published to ${result.url}`);
      let notificationMessage = 'Project published successfully.';
      let sendTo = this.state.sendTo;
      if (sendTo) {
        try {
          await Exp.sendAsync(sendTo, result.url);
          this._logInfo(`Sent link ${result.url} to ${sendTo}.`);
        } catch (err) {
          this._logError(`Could not send link to ${sendTo}: ${err}`);
        }
        notificationMessage = `${notificationMessage} Sent to ${sendTo}`;
      }
      this._showNotification('success', notificationMessage);
    } catch (err) {
      this._showNotification('error', 'Project failed to publish.');
      this._logError(`Failed to publish package: ${err.message}`);
    }
  };