Skip to content
This repository was archived by the owner on May 20, 2025. It is now read-only.

Commit 4017fe3

Browse files
committed
adjust example to test delaying restart
1 parent 088daea commit 4017fe3

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

Examples/CodePushDemoApp/crossplatformdemo.js

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@ let CodePushDemoApp = React.createClass({
1919
try {
2020
return await CodePush.sync(
2121
{
22-
updateDialog: true,
23-
installMode: CodePush.InstallMode.ON_NEXT_RESUME
22+
installMode: CodePush.InstallMode.ON_NEXT_RESTART_OPPORTUNITY,
2423
},
2524
(syncStatus) => {
2625
switch(syncStatus) {
@@ -89,6 +88,15 @@ let CodePushDemoApp = React.createClass({
8988
return { };
9089
},
9190

91+
toggleAllowRestart() {
92+
if (CodePush.restartAllowed()) {
93+
CodePush.disallowRestart();
94+
} else {
95+
CodePush.allowRestart();
96+
}
97+
this.forceUpdate();
98+
},
99+
92100
render() {
93101
let syncView, syncButton, progressView;
94102

@@ -119,6 +127,9 @@ let CodePushDemoApp = React.createClass({
119127
{syncView}
120128
{progressView}
121129
<Image style={styles.image} resizeMode={Image.resizeMode.contain} source={require('./images/laptop_phone_howitworks.png')}/>
130+
<Button onPress={this.toggleAllowRestart}>
131+
Restart { CodePush.restartAllowed() ? "allowed" : "forbidden"}
132+
</Button>
122133
</View>
123134
);
124135
}

0 commit comments

Comments
 (0)