How to use the react-native-code-push.allowRestart 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
CodePush.sync({ installMode: CodePush.InstallMode.IMMEDIATE }, codePushStatusDidChange, progress => {
    console.info('[CodePush]codePushDownloadDidProgress: ', progress)
    if (progress.receivedBytes >= progress.totalBytes) {
      console.info('[CodePush]syncImmediate-强制更新')
      CodePush.allowRestart() // 强制更新
    }
  })
}
github RN-ONE / RNFrameWorkNew / app / util / CheckCodePushUpdateUtil.js View on Github external
instance.install(codePush.InstallMode.IMMEDIATE).then(() => {
                console.log("安装完成");
                codePush.notifyAppReady();
                codePush.allowRestart();
                codePush.restartApp(true);
            }).catch(reason => {
                CheckCodePushUpdateUtil.error();
github XboxYan / DYTT / App.js View on Github external
async componentDidMount() {
		CodePush.allowRestart();//在加载完了,允许重启
		const data = await Storage.get('themeColor');
		if(data){
			this.setState({themeColor:data.themeColor});
		}
		setTimeout(() => {
			SplashScreen.hide();
			this.syncImmediate(); //开始检查更新
		}, 500);
	}
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')),
github duheng / Mozi / src / components / CodepushUpdate / index.js View on Github external
componentDidMount() {
    CodePush.allowRestart();

    if (this.props.isActiveCheck) {
      AppState.addEventListener("change", this._handleAppStateChange);
    }
    this._handleAppStateChange("active");

    this.listener = DeviceEventEmitter.addListener(
      "ImmediateCheckCodePush",
      e => {
        this.setState({ next: false, showTips: true, }, () => {
          this._handleAppStateChange("active");
        });
      }
    );
  }
github listenzz / react-native-engineering / app / App.tsx View on Github external
componentDidAppear() {
    CodePush.allowRestart()
  }
github lisong / code-push-demo-app / App.js View on Github external
toggleAllowRestart() {
    this.state.restartAllowed
      ? CodePush.disallowRestart()
      : CodePush.allowRestart();

    this.setState({ restartAllowed: !this.state.restartAllowed });
  }
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 SystangoTechnologies / Crashalert / RNCrashExamples / js / components / home / index.js View on Github external
toggleAllowRestart() {
    this.state.restartAllowed
      ? CodePush.disallowRestart()
      : CodePush.allowRestart();

    this.setState({ restartAllowed: !this.state.restartAllowed });
  }