@algocare/react-native-code-push 12.0.0 → 12.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/CodePush.js +48 -15
  2. package/package.json +1 -1
package/CodePush.js CHANGED
@@ -67,6 +67,9 @@ async function checkForUpdate(
67
67
  client_unique_id: config.clientUniqueId,
68
68
  }
69
69
 
70
+ console.log('updateRequest')
71
+ console.log(updateRequest)
72
+
70
73
  /**
71
74
  * @type {updateChecker|undefined}
72
75
  * @deprecated
@@ -84,28 +87,52 @@ async function checkForUpdate(
84
87
  const releaseHistory =
85
88
  await sharedCodePushOptions.releaseHistoryFetcher(updateRequest)
86
89
 
87
- const filteredReleaseHistory = Object.entries(releaseHistory)
88
- .filter(([key]) => key.includes(prNumber))
89
- .reduce((acc, [key, value]) => {
90
- const version = key.split('-')[1]
91
- acc[version] = value
92
- return acc
93
- }, {})
90
+ const releaseHistoryVersions = Object.keys(releaseHistory)
91
+
92
+ console.log('releaseHistory')
93
+ console.log(releaseHistory)
94
94
 
95
- const _releaseHistory = packageHash
96
- ? filteredReleaseHistory
97
- : releaseHistory
95
+ console.log('prNumber')
96
+ console.log(prNumber)
97
+
98
+ if (
99
+ !prNumber &&
100
+ updateRequest.label.includes('-') &&
101
+ releaseHistoryVersions.includes(updateRequest.label)
102
+ ) {
103
+ // Pull Request 업데이트 체크 후 재시작 시 다시 시작 방지
104
+ console.log('after updating pull request, skip update check')
105
+ return
106
+ }
98
107
 
108
+ const filteredReleaseHistory = prNumber
109
+ ? Object.entries(releaseHistory)
110
+ .filter(([key]) => key.includes(prNumber))
111
+ .reduce((acc, [key, value]) => {
112
+ const version = key.split('-')[1]
113
+ acc[version] = value
114
+ return acc
115
+ }, {})
116
+ : Object.entries(releaseHistory)
117
+ .filter(([key]) => !key.includes('-'))
118
+ .reduce((acc, [key, value]) => {
119
+ acc[key] = value
120
+ return acc
121
+ }, {})
122
+
123
+ console.log('filteredReleaseHistory')
124
+ console.log(filteredReleaseHistory)
99
125
  /**
100
126
  * `runtimeVersion`
101
127
  * The version of currently running CodePush update. (It can be undefined if the app is running without CodePush update.)
102
128
  * @type {string|undefined}
103
129
  */
104
- const runtimeVersion = packageHash
105
- ? updateRequest.label.split('-')[1]
106
- : updateRequest.label
130
+ const runtimeVersion =
131
+ updateRequest.label && updateRequest.label.includes('-')
132
+ ? updateRequest.label.split('-')[1]
133
+ : updateRequest.label
107
134
 
108
- const versioning = new SemverVersioning(_releaseHistory)
135
+ const versioning = new SemverVersioning(filteredReleaseHistory)
109
136
 
110
137
  const shouldRollbackToBinary =
111
138
  versioning.shouldRollbackToBinary(runtimeVersion)
@@ -120,6 +147,9 @@ async function checkForUpdate(
120
147
  versioning.findLatestRelease()
121
148
  const isMandatory = versioning.checkIsMandatory(runtimeVersion)
122
149
 
150
+ console.log('latestVersion')
151
+ console.log(latestVersion)
152
+
123
153
  /**
124
154
  * Convert the update information decided from `ReleaseHistoryInterface` to be passed to the library core (original CodePush library).
125
155
  *
@@ -139,7 +169,7 @@ async function checkForUpdate(
139
169
  * Retrieve the update version from the ReleaseHistory and store it in the label.
140
170
  * This information can be accessed at runtime through the CodePush bundle metadata.
141
171
  */
142
- label: latestVersion,
172
+ label: prNumber ? `${prNumber}-${latestVersion}` : latestVersion,
143
173
  // false 전달해야 정상 동작함
144
174
  update_app_version: false,
145
175
  // 그닥 쓸모 없음
@@ -260,6 +290,7 @@ async function getUpdateMetadata(updateState) {
260
290
  let updateMetadata = await NativeCodePush.getUpdateMetadata(
261
291
  updateState || CodePush.UpdateState.RUNNING
262
292
  )
293
+
263
294
  if (updateMetadata) {
264
295
  updateMetadata = { ...PackageMixins.local, ...updateMetadata }
265
296
  updateMetadata.failedInstall = await NativeCodePush.isFailedUpdate(
@@ -564,6 +595,8 @@ async function syncInternal(
564
595
  await CodePush.notifyApplicationReady()
565
596
 
566
597
  syncStatusChangeCallback(CodePush.SyncStatus.CHECKING_FOR_UPDATE)
598
+ console.log('syncOptions')
599
+ console.log(syncOptions)
567
600
  const remotePackage = await checkForUpdate(
568
601
  syncOptions.prNumber,
569
602
  syncOptions.packageHash,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@algocare/react-native-code-push",
3
- "version": "12.0.0",
3
+ "version": "12.1.0",
4
4
  "description": "React Native plugin for the CodePush service",
5
5
  "main": "CodePush.js",
6
6
  "typings": "typings/react-native-code-push.d.ts",