This repository was archived by the owner on May 20, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -19,8 +19,7 @@ let CodePushDemoApp = React.createClass({
19
19
try {
20
20
return await CodePush . sync (
21
21
{
22
- updateDialog : true ,
23
- installMode : CodePush . InstallMode . ON_NEXT_RESUME
22
+ installMode : CodePush . InstallMode . ON_NEXT_RESTART_OPPORTUNITY ,
24
23
} ,
25
24
( syncStatus ) => {
26
25
switch ( syncStatus ) {
@@ -89,6 +88,15 @@ let CodePushDemoApp = React.createClass({
89
88
return { } ;
90
89
} ,
91
90
91
+ toggleAllowRestart ( ) {
92
+ if ( CodePush . restartAllowed ( ) ) {
93
+ CodePush . disallowRestart ( ) ;
94
+ } else {
95
+ CodePush . allowRestart ( ) ;
96
+ }
97
+ this . forceUpdate ( ) ;
98
+ } ,
99
+
92
100
render ( ) {
93
101
let syncView , syncButton , progressView ;
94
102
@@ -119,6 +127,9 @@ let CodePushDemoApp = React.createClass({
119
127
{ syncView }
120
128
{ progressView }
121
129
< 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 >
122
133
</ View >
123
134
) ;
124
135
}
You can’t perform that action at this time.
0 commit comments