@@ -423,14 +423,18 @@ function codePushify(options = {}) {
423
423
424
424
return class CodePushComponent extends React . Component {
425
425
componentDidMount ( ) {
426
- let rootComponentInstance = this . refs . rootComponent ;
427
- let syncStatusCallback = rootComponentInstance && rootComponentInstance . codePushStatusDidChange ;
428
- let downloadProgressCallback = rootComponentInstance && rootComponentInstance . codePushDownloadDidProgress ;
429
- CodePush . sync ( options , syncStatusCallback , downloadProgressCallback )
430
- if ( options . syncMode === CodePush . SyncMode . ON_APP_RESUME ) {
431
- ReactNative . AppState . addEventListener ( "change" , ( newState ) => {
432
- newState === "active" && CodePush . sync ( options , syncStatusCallback , downloadProgressCallback ) ;
433
- } ) ;
426
+ if ( options . checkFrequency === CodePush . CheckFrequency . MANUAL ) {
427
+ CodePush . notifyAppReady ( ) ;
428
+ } else {
429
+ let rootComponentInstance = this . refs . rootComponent ;
430
+ let syncStatusCallback = rootComponentInstance && rootComponentInstance . codePushStatusDidChange ;
431
+ let downloadProgressCallback = rootComponentInstance && rootComponentInstance . codePushDownloadDidProgress ;
432
+ CodePush . sync ( options , syncStatusCallback , downloadProgressCallback )
433
+ if ( options . checkFrequency === CodePush . CheckFrequency . ON_APP_RESUME ) {
434
+ ReactNative . AppState . addEventListener ( "change" , ( newState ) => {
435
+ newState === "active" && CodePush . sync ( options , syncStatusCallback , downloadProgressCallback ) ;
436
+ } ) ;
437
+ }
434
438
}
435
439
}
436
440
@@ -446,7 +450,8 @@ function codePushify(options = {}) {
446
450
// and therefore, it doesn't make sense initializing
447
451
// the JS interface when it wouldn't work anyways.
448
452
if ( NativeCodePush ) {
449
- CodePush = {
453
+ CodePush = codePushify ;
454
+ Object . assign ( CodePush , {
450
455
AcquisitionSdk : Sdk ,
451
456
checkForUpdate,
452
457
codePushify,
@@ -477,9 +482,10 @@ if (NativeCodePush) {
477
482
DOWNLOADING_PACKAGE : 7 ,
478
483
INSTALLING_UPDATE : 8
479
484
} ,
480
- SyncMode : {
485
+ CheckFrequency : {
481
486
ON_APP_START : 0 ,
482
487
ON_APP_RESUME : 1 ,
488
+ MANUAL : 2
483
489
} ,
484
490
UpdateState : {
485
491
RUNNING : NativeCodePush . codePushUpdateStateRunning ,
@@ -500,7 +506,7 @@ if (NativeCodePush) {
500
506
optionalUpdateMessage : "An update is available. Would you like to install it?" ,
501
507
title : "Update available"
502
508
}
503
- } ;
509
+ } ) ;
504
510
} else {
505
511
log ( "The CodePush module doesn't appear to be properly installed. Please double-check that everything is setup correctly." ) ;
506
512
}
0 commit comments