Browse Source

Merge commit 'refs/tags/jenkins-front-end-screenad-197-v111^{}' into release

tags/jenkins-front-end-screenad-198-v34^0
hupeng 5 years ago
parent
commit
db9261b715
1 changed files with 10 additions and 9 deletions
  1. +10
    -9
      App.js

+ 10
- 9
App.js View File

@@ -82,6 +82,7 @@ let codePushOptions = {
};

export default class MyPage extends Component {
constructor(props) {
super(props);
this.state = {
@@ -105,7 +106,7 @@ export default class MyPage extends Component {

//更新函数
async codePushUpdate() {
CodePush.allowRestart();
await CodePush.getUpdateMetadata(CodePush.UpdateState.RUNNING)
.then((metadata: LocalPackage) => {
this.setState({ versionInfo: metadata ? 'b'+NativeModules.BuildConfig.versionCode+"-" + metadata.label : 'b'+ NativeModules.BuildConfig.versionCode});
@@ -114,15 +115,16 @@ async codePushUpdate() {
this.setState({ versionInfo: "Unknown"});
versionInfo = this.state.versionInfo;
});
await CodePush.disallowRestart();
await CodePush.sync(
{ mandatoryInstallMode: CodePush.InstallMode.IMMEDIATE,
installMode: CodePush.InstallMode.IMMEDIATE},
{ mandatoryInstallMode: CodePush.InstallMode.ON_NEXT_RESTART,
installMode: CodePush.InstallMode.ON_NEXT_RESTART},
this.codePushStatusDidChange.bind(this),
this.codePushDownloadDidProgress.bind(this)
);
await CodePush.allowRestart();
).then((status: SyncStatus) => {

}, (error: any) => {
CodePush.restartApp();
});
}


@@ -527,7 +529,7 @@ render() {
return this.getAdView();
}
}
MyPage = CodePush(codePushOptions)(MyPage);
const styles = StyleSheet.create({
updatePage:{
flex: 2,
@@ -892,5 +894,4 @@ render() {
textDecorationLine: 'line-through',
color : 'gray'
},

});

Loading…
Cancel
Save