@algocare/react-native-code-push 12.0.0 → 12.1.1
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.
- package/CodePush.js +49 -15
- 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,53 @@ async function checkForUpdate(
|
|
|
84
87
|
const releaseHistory =
|
|
85
88
|
await sharedCodePushOptions.releaseHistoryFetcher(updateRequest)
|
|
86
89
|
|
|
87
|
-
const
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
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
|
-
|
|
96
|
-
|
|
97
|
-
|
|
95
|
+
console.log('prNumber')
|
|
96
|
+
console.log(prNumber)
|
|
97
|
+
|
|
98
|
+
if (
|
|
99
|
+
!prNumber &&
|
|
100
|
+
updateRequest.label &&
|
|
101
|
+
updateRequest.label.includes('-') &&
|
|
102
|
+
releaseHistoryVersions.includes(updateRequest.label)
|
|
103
|
+
) {
|
|
104
|
+
// Pull Request 업데이트 체크 후 재시작 시 다시 시작 방지
|
|
105
|
+
console.log('after updating pull request, skip update check')
|
|
106
|
+
return
|
|
107
|
+
}
|
|
98
108
|
|
|
109
|
+
const filteredReleaseHistory = prNumber
|
|
110
|
+
? Object.entries(releaseHistory)
|
|
111
|
+
.filter(([key]) => key.includes(prNumber))
|
|
112
|
+
.reduce((acc, [key, value]) => {
|
|
113
|
+
const version = key.split('-')[1]
|
|
114
|
+
acc[version] = value
|
|
115
|
+
return acc
|
|
116
|
+
}, {})
|
|
117
|
+
: Object.entries(releaseHistory)
|
|
118
|
+
.filter(([key]) => !key.includes('-'))
|
|
119
|
+
.reduce((acc, [key, value]) => {
|
|
120
|
+
acc[key] = value
|
|
121
|
+
return acc
|
|
122
|
+
}, {})
|
|
123
|
+
|
|
124
|
+
console.log('filteredReleaseHistory')
|
|
125
|
+
console.log(filteredReleaseHistory)
|
|
99
126
|
/**
|
|
100
127
|
* `runtimeVersion`
|
|
101
128
|
* The version of currently running CodePush update. (It can be undefined if the app is running without CodePush update.)
|
|
102
129
|
* @type {string|undefined}
|
|
103
130
|
*/
|
|
104
|
-
const runtimeVersion =
|
|
105
|
-
|
|
106
|
-
|
|
131
|
+
const runtimeVersion =
|
|
132
|
+
updateRequest.label && updateRequest.label.includes('-')
|
|
133
|
+
? updateRequest.label.split('-')[1]
|
|
134
|
+
: updateRequest.label
|
|
107
135
|
|
|
108
|
-
const versioning = new SemverVersioning(
|
|
136
|
+
const versioning = new SemverVersioning(filteredReleaseHistory)
|
|
109
137
|
|
|
110
138
|
const shouldRollbackToBinary =
|
|
111
139
|
versioning.shouldRollbackToBinary(runtimeVersion)
|
|
@@ -120,6 +148,9 @@ async function checkForUpdate(
|
|
|
120
148
|
versioning.findLatestRelease()
|
|
121
149
|
const isMandatory = versioning.checkIsMandatory(runtimeVersion)
|
|
122
150
|
|
|
151
|
+
console.log('latestVersion')
|
|
152
|
+
console.log(latestVersion)
|
|
153
|
+
|
|
123
154
|
/**
|
|
124
155
|
* Convert the update information decided from `ReleaseHistoryInterface` to be passed to the library core (original CodePush library).
|
|
125
156
|
*
|
|
@@ -139,7 +170,7 @@ async function checkForUpdate(
|
|
|
139
170
|
* Retrieve the update version from the ReleaseHistory and store it in the label.
|
|
140
171
|
* This information can be accessed at runtime through the CodePush bundle metadata.
|
|
141
172
|
*/
|
|
142
|
-
label: latestVersion,
|
|
173
|
+
label: prNumber ? `${prNumber}-${latestVersion}` : latestVersion,
|
|
143
174
|
// false 전달해야 정상 동작함
|
|
144
175
|
update_app_version: false,
|
|
145
176
|
// 그닥 쓸모 없음
|
|
@@ -260,6 +291,7 @@ async function getUpdateMetadata(updateState) {
|
|
|
260
291
|
let updateMetadata = await NativeCodePush.getUpdateMetadata(
|
|
261
292
|
updateState || CodePush.UpdateState.RUNNING
|
|
262
293
|
)
|
|
294
|
+
|
|
263
295
|
if (updateMetadata) {
|
|
264
296
|
updateMetadata = { ...PackageMixins.local, ...updateMetadata }
|
|
265
297
|
updateMetadata.failedInstall = await NativeCodePush.isFailedUpdate(
|
|
@@ -564,6 +596,8 @@ async function syncInternal(
|
|
|
564
596
|
await CodePush.notifyApplicationReady()
|
|
565
597
|
|
|
566
598
|
syncStatusChangeCallback(CodePush.SyncStatus.CHECKING_FOR_UPDATE)
|
|
599
|
+
console.log('syncOptions')
|
|
600
|
+
console.log(syncOptions)
|
|
567
601
|
const remotePackage = await checkForUpdate(
|
|
568
602
|
syncOptions.prNumber,
|
|
569
603
|
syncOptions.packageHash,
|