How to use the react-native-code-push.SyncStatus function in react-native-code-push

To help you get started, we’ve selected a few react-native-code-push 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 sishuguojixuefu / react-native-template-sishu-0.59 / app / utils / CodePushSync.ts View on Github external
const codePushStatusDidChange = (syncStatus: number) => {
  switch (syncStatus) {
    case CodePush.SyncStatus.UP_TO_DATE: // 已更新 0
      console.info(`[CodePush]${syncStatus}: 已更新`)
      break
    case CodePush.SyncStatus.INSTALLING_UPDATE: // 下载更新 1
      console.info(`[CodePush]${syncStatus}: 下载更新`)
      break
    case CodePush.SyncStatus.UPDATE_IGNORED: // 忽略更新 2
      console.info(`[CodePush]${syncStatus}: 忽略更新`)
      break
    case CodePush.SyncStatus.UNKNOWN_ERROR: // 未知错误 3
      console.info(`[CodePush]${syncStatus}: 未知错误`)
      break
    case CodePush.SyncStatus.SYNC_IN_PROGRESS: // 正在同步 4
      console.info(`[CodePush]${syncStatus}: 正在同步`)
      break
    case CodePush.SyncStatus.CHECKING_FOR_UPDATE: // 检查更新 5
      console.info(`[CodePush]${syncStatus}: 检查更新`)
      break
    case CodePush.SyncStatus.AWAITING_USER_ACTION: // 等待用户操作 6
      console.info(`[CodePush]${syncStatus}: 等待用户操作`)
      break
    case CodePush.SyncStatus.DOWNLOADING_PACKAGE: // 正在下载 7
      console.info(`[CodePush]${syncStatus}: 正在下载`)
github FuYaoDe / 30-days-of-react-native / src / containers / Router.js View on Github external
(status) => {
        switch (status) {
          case CodePush.SyncStatus.DOWNLOADING_PACKAGE:
            // this.setState({showDownloadingModal: true});
            // this.refs.modal.open();
            break;
          case CodePush.SyncStatus.INSTALLING_UPDATE:
            // this.setState({showInstalling: true});
            break;
          case CodePush.SyncStatus.UPDATE_INSTALLED:
            // this.refs.modal.close();
            // this.setState({showDownloadingModal: false});
            break;
        }
      },
      ({ receivedBytes, totalBytes, }) => {
github lhr000lhr / wechat / Wechat / app / router.js View on Github external
codePushStatusDidChange(status) {
    // alert(111)
    switch (status) {
      case codePush.SyncStatus.DOWNLOADING_PACKAGE:
        // Show "downloading" modal
        Toast.show('正在下载更新...')

        break
      case codePush.SyncStatus.INSTALLING_UPDATE:
        // Hide "downloading" modal
        Toast.show('正在升级...')

        break
      case codePush.SyncStatus.UPDATE_INSTALLED:
        Toast.show('更新成功')

        break
    }
  }
  backHandle = () => {
github ZevenFang / react-native-redux-zhihudaily / src / components / SliderBar.js View on Github external
codePushStatusDidChange = (syncStatus) => {
    switch(syncStatus) {
      case CodePush.SyncStatus.CHECKING_FOR_UPDATE:
        Toast.show('正在检查更新');
        break;
      case CodePush.SyncStatus.DOWNLOADING_PACKAGE:
        Toast.show('用户确认更新');
        break;
      case CodePush.SyncStatus.AWAITING_USER_ACTION:
        Toast.show('等待用户确认');
        break;
      case CodePush.SyncStatus.INSTALLING_UPDATE:
        // Toast.show('正在更新');
        break;
      case CodePush.SyncStatus.UP_TO_DATE:
        Toast.show('已经是最新版本');
        break;
      case CodePush.SyncStatus.UPDATE_IGNORED:
        Toast.show('用户取消更新');
        break;
      case CodePush.SyncStatus.UPDATE_INSTALLED:
        Toast.show('安装更新成功,重启应用以完成更新');
        setTimeout(function () {
          BackAndroid.exitApp();
        },2000);
        break;
      case CodePush.SyncStatus.UNKNOWN_ERROR:
        Toast.show('未知错误');
github duheng / Mozi / src / components / CodepushUpdate / index.js View on Github external
codePushStatusDidChange(syncStatus) {
    console.log("-codePushStatusDidChange-");
    console.log(syncStatus);
    let syncMessage = this.state.syncMessage;
    switch (syncStatus) {
      case CodePush.SyncStatus.CHECKING_FOR_UPDATE:
        this.syncMessage = "Checking for update";
        syncMessage = "正在检查更新...";
        break;
      case CodePush.SyncStatus.DOWNLOADING_PACKAGE:
        this.syncMessage = "Downloading package";
        syncMessage = "下载更新包中...";
        break;
      case CodePush.SyncStatus.AWAITING_USER_ACTION:
        this.syncMessage = "Awaiting user action";
        syncMessage = "等待选择更新";
        break;
      case CodePush.SyncStatus.INSTALLING_UPDATE:
        this.syncMessage = "Installing update";
        syncMessage = "安装更新中...";
        break;
      case CodePush.SyncStatus.UP_TO_DATE:
github SuTV / react-native-base-project / src / scenes / Splash / index.js View on Github external
codePushStatusDidChange(syncStatus) {
    switch(syncStatus) {
      case CodePush.SyncStatus.CHECKING_FOR_UPDATE:
        this.setState({ syncMessage: I18n.t('splash.update.checking') });
        break;
      case CodePush.SyncStatus.DOWNLOADING_PACKAGE:
        this.setState({ syncMessage: I18n.t('splash.update.downloading') });
        break;
      case CodePush.SyncStatus.INSTALLING_UPDATE:
        this.setState({ syncMessage: I18n.t('splash.update.installing') });
        break;
      case CodePush.SyncStatus.UP_TO_DATE:
        this.setState({ syncMessage: I18n.t('splash.update.up_to_date'), progress: false });
        break;
      case CodePush.SyncStatus.UPDATE_INSTALLED:
        this.setState({ syncMessage: I18n.t('splash.update.installed'), progress: false });
        break;
      case CodePush.SyncStatus.SYNC_IN_PROGRESS:
        this.setState({ syncMessage: I18n.t('splash.update.sycn_in_progress'), progress: false });
        break;
      case CodePush.SyncStatus.UNKNOWN_ERROR:
        this.setState({ syncMessage: I18n.t('splash.update.unknown_error'), progress: false });
        break;
      default:
        this.setState({ progress: false });
        break;
    }
  }
github microsoft / appcenter-sampleapp-react-native / src / components / codePush.tsx View on Github external
codePushStatusDidChange(syncStatus) {
    switch (syncStatus) {
      case CodePushLib.SyncStatus.CHECKING_FOR_UPDATE:
        this.setState({ syncMessage: "Checking for update." });
        break;
      case CodePushLib.SyncStatus.DOWNLOADING_PACKAGE:
        this.setState({ syncMessage: "Downloading package." });
        break;
      case CodePushLib.SyncStatus.AWAITING_USER_ACTION:
        this.setState({ syncMessage: "Awaiting user action." });
        break;
      case CodePushLib.SyncStatus.INSTALLING_UPDATE:
        this.setState({ syncMessage: "Installing update." });
        break;
      case CodePushLib.SyncStatus.UP_TO_DATE:
        this.setState({ syncMessage: "App up to date.", progress: null });
        break;
      case CodePushLib.SyncStatus.UPDATE_IGNORED:
        this.setState({ syncMessage: "Update cancelled by user.", progress: null });
        break;
      case CodePushLib.SyncStatus.UPDATE_INSTALLED:
        this.setState({ syncMessage: "Update installed and will be applied on restart.", progress: null });
        break;
      case CodePushLib.SyncStatus.UNKNOWN_ERROR:
        this.setState({ syncMessage: "An unknown error occurred.", progress: null });
        break;
    }
  }
github birkir / kvikmyndr-app / src / screens / settings / Settings.tsx View on Github external
async onCodePushPress() {
    this.isUpdating = true;

    const config = codePushConfig();
    config.installMode = CodePush.InstallMode.IMMEDIATE;
    const update = await CodePush.sync(config, undefined, this.onDownloadProgress, this.onBinaryVersionMismatch);

    this.isUpdating = false;
    this.progress = null;

    switch (update) {
      case CodePush.SyncStatus.UP_TO_DATE:
        Alert.alert(locales[Store.settings.language].NO_UPDATE_AVAILABLE);
        break;
      case CodePush.SyncStatus.UNKNOWN_ERROR:
        Alert.alert('Unknown error');
        break;
    }
  }
github okoala / 30DaysofReactNative / checkUpdate.js View on Github external
CodePush.sync(options, status => {
    switch (status) {
      case CodePush.SyncStatus.DOWNLOADING_PACKAGE:
        this.refs.nav.push({
          component: Loading,
          title: ' ',
          navigationBarHidden: true,
          leftButtonTitle: '',
          onLeftButtonPress: () => {}
        })
        break
      case CodePush.SyncStatus.INSTALLING_UPDATE:
        break
      case CodePush.SyncStatus.AWAITING_USER_ACTION:
        break
    }
  })
}
github start-react / native-starter-kit / js / App.js View on Github external
(status) => {
              switch (status) {
                  case CodePush.SyncStatus.DOWNLOADING_PACKAGE:
                      this.setState({showDownloadingModal: true});
                      this.refs.modal.open();
                      break;
                  case CodePush.SyncStatus.INSTALLING_UPDATE:
                      this.setState({showInstalling: true});
                      break;
                  case CodePush.SyncStatus.UPDATE_INSTALLED:
                      this.refs.modal.close();
                      this.setState({showDownloadingModal: false});
                      break;
              }
          },
          ({ receivedBytes, totalBytes, }) => {