How to use the react-native-code-push.checkForUpdate 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 syun0216 / goforeat / app / hoc / CommonHOC.js View on Github external
_checkForUpdate() {
      CodePush.checkForUpdate(CodePushUtils.getDeploymentKey()).then(
        remotePackage => {
          if (remotePackage == null) {
            return;
          }
          this._syncInNonSilent(remotePackage);
        }
      );
    }
    // logic - update - silent
github TrustTheBoy / react-native-component-redux / src / page / Root.js View on Github external
onCheckForUpdate = () => {
        this.onClearTimer();
        this.props.showDialog(dialogType.UPDATE_DIALOG);
        CodePush.checkForUpdate(CONFIG.CODEPUS_KEY)
            .then(update => {
                if (!update) {
                    InteractionManager.runAfterInteractions(() => {
                        this.props.showDialog(dialogType.UP_TO_DATE);
                        this.timer[1] = setTimeout(() => {
                            this.props.hideDialog();
                        }, 1000);
                    });
                } else {
                    //InteractionManager.runAfterInteractions(() => {
                    this.props.showDialog(dialogType.GUODU_DIALOG);
                    // });
                    InteractionManager.runAfterInteractions(() => {
                        update.cancelBtn = () => {
                            this.props.showDialog(dialogType.UPDATE_IGNORED);
                            this.timer[3] = setTimeout(() => {
github FuYaoDe / 30-days-of-react-native / src / containers / Router.js View on Github external
componentDidMount() {

    CodePush.checkForUpdate()
    .then( (update) =>{
        if( !update ){
            Alert.alert("app是最新版了");
        }else {
            Alert.alert("有更新哦");
        }
    });

    CodePush.sync({ updateDialog: true, installMode: CodePush.InstallMode.IMMEDIATE },
      (status) => {
        switch (status) {
          case CodePush.SyncStatus.DOWNLOADING_PACKAGE:
            // this.setState({showDownloadingModal: true});
            // this.refs.modal.open();
            break;
          case CodePush.SyncStatus.INSTALLING_UPDATE:
github duheng / Mozi / src / components / CodepushUpdate / index.js View on Github external
syncImmediate() {
    if (!this.state.next) {
      CodePush.checkForUpdate(this.props.deploymentKey).then(update => {
        if (update) {
          console.log("-------CodePush-------检测到新的热更新包--");
          console.log(update);
          this.setState({ showUpdate: true, updateInfo: update, });
        } else if (this.state.showTips) {
          this.state.showTips = false;
          Toast.show({ title: "已是最新版本!", });
        }
      });
    }
  }
github XboxYan / DYTT / App.js View on Github external
syncImmediate = async () => {
		const RemotePackage = await CodePush.checkForUpdate();
		if(RemotePackage){
			this.modal.init(RemotePackage);
		}
    }
github RN-ONE / RNFrameWorkNew / app / util / CheckCodePushUpdateUtil.js View on Github external
static checkUpdate() {
        codePush.checkForUpdate(codePush.CheckFrequency.ON_APP_START)
            .then((update) => {
                if (update) {
                    //有更新,提示用户
                    NavigationUtil.showMessageDialogOverLayOrModal({
                        title: '检查到新版本',//标题
                        titleColor: AppConfig.COLOR_THEME,
                        contentColor: AppConfig.TEXT_COLOR_GRAY,//内容颜色
                        content: [update.description],//内容
                        ok: {
                            text: '立即更新',
                            callback: () => {
                                NavigationUtil.dismissMessageDialogOverLayOrModal();
                                //立即更新
                                CheckCodePushUpdateUtil.deal(update);
                            },
                        },
github NSWSESMembers / availability-poc / client / src / screens / burger / Root.js View on Github external
checkForUpdate = () => {
    codePush.checkForUpdate()
      .then((update) => {
        if (update) {
          Alert.alert(
            'Update Available',
            `Version ${update.appVersion} (${(update.packageSize / 1024 / 1024).toFixed(2)}mb) is available for download`,
            [
              { text: 'Cancel', style: 'cancel' },
              { text: 'Install & Restart', onPress: this.installUpdate },
            ],
            { cancelable: false },
          );
        } else {
          Alert.alert('No updates available.');
        }
      });
  }
github SystangoTechnologies / Crashalert / RNCrashExamples / js / components / home / index.js View on Github external
async componentWillMount() {
    CodePush.allowRestart();

    CodePush.checkForUpdate().then((update) => {
      if (update) {
        Alert.alert(
          'Upgrade',
          'New update is available. Do you want to upgrade the app?',
          [
            { text: 'YES', onPress: () => {} },
            { text: 'NO', onPress: () => this.syncImmediate() },
          ],
          { cancelable: false }
        );
      }
    });
  }
github shoutem / extensions / shoutem.code-push / app / shared / syncPackage.js View on Github external
export function syncPackage(deploymentKey, showUpdateDialog) {
  codePush.allowRestart();
  codePush.checkForUpdate(deploymentKey)
    .then((remotePackage) => {
      if (remotePackage) {
        remotePackage.download()
          .then((localPackage) => {
            if (showUpdateDialog) {
              Alert.alert(
                I18n.t(ext('newContentAlertTitle')),
                I18n.t(ext('newContentAlertMessage')),
                [
                  {
                    text: I18n.t(ext('laterButton')),
                    onPress: () => localPackage.install(codePush.InstallMode.ON_NEXT_RESTART),
                  },
                  {
                    text: I18n.t(ext('acceptButton')),
                    onPress: () => localPackage.install(codePush.InstallMode.IMMEDIATE),