@@ -3,25 +3,25 @@ import CodePush from "react-native-code-push";
3
3
// This module wraps CodePush API calls to add test message callbacks to every function for simpler test code.
4
4
5
5
module . exports = {
6
- checkForUpdate : function ( testApp , onSuccess , onError , deploymentKey ) {
6
+ checkForUpdate : function ( testApp , onSuccess , onError , deploymentKey ) {
7
7
return CodePush . checkForUpdate ( deploymentKey )
8
8
. then ( ( remotePackage ) => {
9
9
return testApp . checkUpdateSuccess ( remotePackage ) . then ( ( ) => { return onSuccess && onSuccess ( remotePackage ) ; } ) ;
10
10
} , ( error ) => {
11
11
return testApp . checkUpdateError ( error ) . then ( ( ) => { return onError && onError ( error ) ; } ) ;
12
12
} ) ;
13
13
} ,
14
-
15
- download : function ( testApp , onSuccess , onError , remotePackage ) {
14
+
15
+ download : function ( testApp , onSuccess , onError , remotePackage ) {
16
16
return remotePackage . download ( )
17
17
. then ( ( localPackage ) => {
18
18
return testApp . downloadSuccess ( localPackage ) . then ( ( ) => { return onSuccess && onSuccess ( localPackage ) ; } ) ;
19
19
} , ( error ) => {
20
20
return testApp . downloadError ( error ) . then ( ( ) => { return onError && onError ( error ) ; } ) ;
21
21
} ) ;
22
22
} ,
23
-
24
- install : function ( testApp , onSuccess , onError , installMode , minBackgroundDuration , localPackage ) {
23
+
24
+ install : function ( testApp , onSuccess , onError , installMode , minBackgroundDuration , localPackage ) {
25
25
return localPackage . install ( installMode , minBackgroundDuration )
26
26
. then ( ( ) => {
27
27
// Since immediate installs cannot be reliably logged (due to async network calls), we only log "UPDATE_INSTALLED" if it is a resume or restart update.
@@ -31,14 +31,14 @@ module.exports = {
31
31
return testApp . installError ( ) . then ( ( ) => { return onError && onError ( ) ; } ) ;
32
32
} ) ;
33
33
} ,
34
-
35
- checkAndInstall : function ( testApp , onSuccess , onError , installMode , minBackgroundDuration ) {
34
+
35
+ checkAndInstall : function ( testApp , onSuccess , onError , installMode , minBackgroundDuration ) {
36
36
var installUpdate = this . install . bind ( this , testApp , onSuccess , onError , installMode , minBackgroundDuration ) ;
37
37
var downloadUpdate = this . download . bind ( this , testApp , installUpdate , onError ) ;
38
38
return this . checkForUpdate ( testApp , downloadUpdate , onError ) ;
39
39
} ,
40
-
41
- sync : function ( testApp , onSyncStatus , onSyncError , options ) {
40
+
41
+ sync : function ( testApp , onSyncStatus , onSyncError , options ) {
42
42
return CodePush . checkForUpdate ( )
43
43
. then (
44
44
( remotePackage ) => {
@@ -48,7 +48,7 @@ module.exports = {
48
48
var regularUpdateIsImmediate = options && options . installMode === CodePush . InstallMode . IMMEDIATE ;
49
49
var mandatoryUpdateIsImmediate = ! options || ( options && ( ! options . mandatoryInstallMode || options . mandatoryInstallMode === CodePush . InstallMode . IMMEDIATE ) ) ;
50
50
var isInstallImmediate = ( remotePackage && remotePackage . isMandatory ) ? mandatoryUpdateIsImmediate : regularUpdateIsImmediate ;
51
-
51
+
52
52
return CodePush . sync ( options )
53
53
. then ( ( status ) => {
54
54
if ( ! ( isInstallImmediate && status === CodePush . SyncStatus . UPDATE_INSTALLED ) ) {
0 commit comments