@@ -8,25 +8,25 @@ import hoistStatics from 'hoist-non-react-statics';
8
8
let NativeCodePush = require ( "react-native" ) . NativeModules . CodePush ;
9
9
const PackageMixins = require ( "./package-mixins" ) ( NativeCodePush ) ;
10
10
11
- async function checkForUpdate ( deploymentKey = null , handleBinaryVersionMismatchCallback = null ) {
11
+ async function checkForUpdate ( releaseChannelPublicId = null , handleBinaryVersionMismatchCallback = null ) {
12
12
/*
13
13
* Before we ask the server if an update exists, we
14
14
* need to retrieve three pieces of information from the
15
- * native side: deployment key , app version (e.g. 1.0.1)
15
+ * native side: release channel , app version (e.g. 1.0.1)
16
16
* and the hash of the currently running update (if there is one).
17
17
* This allows the client to only receive updates which are targetted
18
- * for their specific deployment and version and which are actually
18
+ * for their specific release channel and version and which are actually
19
19
* different from the CodePush update they have already installed.
20
20
*/
21
21
const nativeConfig = await getConfiguration ( ) ;
22
22
/*
23
- * If a deployment key was explicitly provided,
23
+ * If a release channel was explicitly provided,
24
24
* then let's override the one we retrieved
25
25
* from the native-side of the app. This allows
26
26
* dynamically "redirecting" end-users at different
27
- * deployments (e.g. an early access deployment for insiders).
27
+ * release channels (e.g. an early access release channel for insiders).
28
28
*/
29
- const config = deploymentKey ? { ...nativeConfig , ...{ deploymentKey } } : nativeConfig ;
29
+ const config = releaseChannelPublicId ? { ...nativeConfig , ...{ releaseChannelPublicId } } : nativeConfig ;
30
30
const sdk = getPromisifiedSdk ( requestFetchAdapter , config ) ;
31
31
32
32
// Use dynamically overridden getCurrentPackage() during tests.
@@ -84,7 +84,7 @@ async function checkForUpdate(deploymentKey = null, handleBinaryVersionMismatchC
84
84
} else {
85
85
const remotePackage = { ...update , ...PackageMixins . remote ( sdk . reportStatusDownload ) } ;
86
86
remotePackage . failedInstall = await NativeCodePush . isFailedUpdate ( remotePackage . packageHash ) ;
87
- remotePackage . deploymentKey = deploymentKey || nativeConfig . deploymentKey ;
87
+ remotePackage . releaseChannelPublicId = releaseChannelPublicId || nativeConfig . releaseChannelPublicId ;
88
88
return remotePackage ;
89
89
}
90
90
}
@@ -118,6 +118,9 @@ async function getUpdateMetadata(updateState) {
118
118
}
119
119
120
120
function getPromisifiedSdk ( requestFetchAdapter , config ) {
121
+ // TODO MIGRATION Temporary retro-compat while we still use code-push module
122
+ config . deploymentKey = config . releaseChannelPublicId ;
123
+
121
124
// Use dynamically overridden AcquisitionSdk during tests.
122
125
const sdk = new module . exports . AcquisitionSdk ( requestFetchAdapter , config ) ;
123
126
sdk . queryUpdateWithCurrentPackage = ( queryPackage ) => {
@@ -132,9 +135,9 @@ function getPromisifiedSdk(requestFetchAdapter, config) {
132
135
} ) ;
133
136
} ;
134
137
135
- sdk . reportStatusDeploy = ( deployedPackage , status , previousLabelOrAppVersion , previousDeploymentKey ) => {
138
+ sdk . reportStatusDeploy = ( deployedPackage , status , previousLabelOrAppVersion , previousReleaseChannelPublicId ) => {
136
139
return new Promise ( ( resolve , reject ) => {
137
- module . exports . AcquisitionSdk . prototype . reportStatusDeploy . call ( sdk , deployedPackage , status , previousLabelOrAppVersion , previousDeploymentKey , ( err ) => {
140
+ module . exports . AcquisitionSdk . prototype . reportStatusDeploy . call ( sdk , deployedPackage , status , previousLabelOrAppVersion , previousReleaseChannelPublicId , ( err ) => {
138
141
if ( err ) {
139
142
reject ( err ) ;
140
143
} else {
@@ -183,17 +186,17 @@ async function notifyApplicationReadyInternal() {
183
186
async function tryReportStatus ( statusReport , retryOnAppResume ) {
184
187
const config = await getConfiguration ( ) ;
185
188
const previousLabelOrAppVersion = statusReport . previousLabelOrAppVersion ;
186
- const previousDeploymentKey = statusReport . previousDeploymentKey || config . deploymentKey ;
189
+ const previousReleaseChannelPublicId = statusReport . previousReleaseChannelPublicId || config . releaseChannelPublicId ;
187
190
try {
188
191
if ( statusReport . appVersion ) {
189
192
log ( `Reporting binary update (${ statusReport . appVersion } )` ) ;
190
193
191
- if ( ! config . deploymentKey ) {
192
- throw new Error ( "Deployment key is missed " ) ;
194
+ if ( ! config . releaseChannelPublicId ) {
195
+ throw new Error ( "Release channel is missing " ) ;
193
196
}
194
197
195
198
const sdk = getPromisifiedSdk ( requestFetchAdapter , config ) ;
196
- await sdk . reportStatusDeploy ( /* deployedPackage */ null , /* status */ null , previousLabelOrAppVersion , previousDeploymentKey ) ;
199
+ await sdk . reportStatusDeploy ( /* deployedPackage */ null , /* status */ null , previousLabelOrAppVersion , previousReleaseChannelPublicId ) ;
197
200
} else {
198
201
const label = statusReport . package . label ;
199
202
if ( statusReport . status === "DeploymentSucceeded" ) {
@@ -203,9 +206,9 @@ async function tryReportStatus(statusReport, retryOnAppResume) {
203
206
await NativeCodePush . setLatestRollbackInfo ( statusReport . package . packageHash ) ;
204
207
}
205
208
206
- config . deploymentKey = statusReport . package . deploymentKey ;
209
+ config . releaseChannelPublicId = statusReport . package . releaseChannelPublicId ;
207
210
const sdk = getPromisifiedSdk ( requestFetchAdapter , config ) ;
208
- await sdk . reportStatusDeploy ( statusReport . package , statusReport . status , previousLabelOrAppVersion , previousDeploymentKey ) ;
211
+ await sdk . reportStatusDeploy ( statusReport . package , statusReport . status , previousLabelOrAppVersion , previousReleaseChannelPublicId ) ;
209
212
}
210
213
211
214
NativeCodePush . recordStatusReported ( statusReport ) ;
@@ -363,7 +366,7 @@ const sync = (() => {
363
366
async function syncInternal ( options = { } , syncStatusChangeCallback , downloadProgressCallback , handleBinaryVersionMismatchCallback ) {
364
367
let resolvedInstallMode ;
365
368
const syncOptions = {
366
- deploymentKey : null ,
369
+ releaseChannelPublicId : null ,
367
370
ignoreFailedUpdates : true ,
368
371
rollbackRetryOptions : null ,
369
372
installMode : CodePush . InstallMode . ON_NEXT_RESTART ,
@@ -416,7 +419,7 @@ async function syncInternal(options = {}, syncStatusChangeCallback, downloadProg
416
419
await CodePush . notifyApplicationReady ( ) ;
417
420
418
421
syncStatusChangeCallback ( CodePush . SyncStatus . CHECKING_FOR_UPDATE ) ;
419
- const remotePackage = await checkForUpdate ( syncOptions . deploymentKey , handleBinaryVersionMismatchCallback ) ;
422
+ const remotePackage = await checkForUpdate ( syncOptions . releaseChannelPublicId , handleBinaryVersionMismatchCallback ) ;
420
423
421
424
const doDownloadAndInstall = async ( ) => {
422
425
syncStatusChangeCallback ( CodePush . SyncStatus . DOWNLOADING_PACKAGE ) ;
@@ -479,8 +482,8 @@ async function syncInternal(options = {}, syncStatusChangeCallback, downloadProg
479
482
}
480
483
} ) ;
481
484
}
482
-
483
- // Since the install button should be placed to the
485
+
486
+ // Since the install button should be placed to the
484
487
// right of any other button, add it last
485
488
dialogButtons . push ( {
486
489
text : installButtonText ,
0 commit comments