@revopush/react-native-code-push 2.5.0-rc.4 → 2.5.0-rc.6

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.
@@ -56,7 +56,7 @@ dependencies {
56
56
  // For > 0.71, this will be replaced by `com.facebook.react:react-android:$version` by react gradle plugin
57
57
  //noinspection GradleDynamicVersion
58
58
 
59
- implementation "org.revopush:revopush-diff:0.0.5"
59
+ implementation "org.revopush:revopush-diff:0.0.7"
60
60
  implementation "com.facebook.react:react-native:+"
61
61
  }
62
62
  }
@@ -52,12 +52,6 @@ static def findNodeModulePath(baseDir, packageName) {
52
52
  return null
53
53
  }
54
54
 
55
- android.buildTypes.each { buildType ->
56
- // to prevent incorrect long value restoration from strings.xml we need to wrap it with double quotes
57
- // https://github.com/microsoft/cordova-plugin-code-push/issues/264
58
- buildType.resValue 'string', "CODE_PUSH_APK_BUILD_TIME", String.format("\"%d\"", System.currentTimeMillis())
59
- }
60
-
61
55
  gradle.projectsEvaluated {
62
56
  def debuggableVariants = config.debuggableVariants ? config.debuggableVariants.get() : ['debug']
63
57
 
@@ -82,7 +76,7 @@ gradle.projectsEvaluated {
82
76
  def jsBundleFile;
83
77
 
84
78
  // Additional node commandline arguments
85
- def nodeExecutableAndArgs = config.nodeExecutableAndArgs ? config.nodeExecutableAndArgs.get(): ["node"]
79
+ def nodeExecutableAndArgs = config.nodeExecutableAndArgs ? config.nodeExecutableAndArgs.get() : ["node"]
86
80
  def extraPackagerArgs = config.extraPackagerArgs ? config.extraPackagerArgs.get() : []
87
81
 
88
82
  // Make this task run right after the bundle task
@@ -104,7 +98,7 @@ gradle.projectsEvaluated {
104
98
  generateBundledResourcesHash = tasks.create(
105
99
  name: "generateBundledResourcesHash${targetName}",
106
100
  type: Exec) {
107
- commandLine (*nodeExecutableAndArgs, "${nodeModulesPath}/scripts/generateBundledResourcesHash.js", resourcesDir, jsBundleFile, jsBundleDir)
101
+ commandLine(*nodeExecutableAndArgs, "${nodeModulesPath}/scripts/generateBundledResourcesHash.js", resourcesDir, jsBundleFile, jsBundleDir)
108
102
 
109
103
  enabled !debuggableVariants.contains(variant.name) ?: targetName.toLowerCase().contains("release")
110
104
  }
@@ -113,11 +107,11 @@ gradle.projectsEvaluated {
113
107
  runBefore("merge${targetName}Assets", generateBundledResourcesHash)
114
108
  } else {
115
109
  def jsBundleDirConfigName = "jsBundleDir${targetName}"
116
- jsBundleDir = elvisFile(config."$jsBundleDirConfigName") ? elvisFile(config."$jsBundleDirConfigName").get():
110
+ jsBundleDir = elvisFile(config."$jsBundleDirConfigName") ? elvisFile(config."$jsBundleDirConfigName").get() :
117
111
  file("$buildDir/intermediates/assets/${targetPath}")
118
112
 
119
113
  def resourcesDirConfigName = "resourcesDir${targetName}"
120
- resourcesDir = elvisFile(config."${resourcesDirConfigName}") ? elvisFile(config."${resourcesDirConfigName}").get():
114
+ resourcesDir = elvisFile(config."${resourcesDirConfigName}") ? elvisFile(config."${resourcesDirConfigName}").get() :
121
115
  file("$buildDir/intermediates/res/merged/${targetPath}")
122
116
 
123
117
  // In case version of 'Android Plugin for Gradle'' is lower than 1.3.0
@@ -129,19 +123,19 @@ gradle.projectsEvaluated {
129
123
 
130
124
  jsBundleFile = file("$jsBundleDir/$bundleAssetName")
131
125
 
132
- def resourcesMapTempFileName = "CodePushResourcesMap-" + java.util.UUID.randomUUID().toString().substring(0,8) + ".json"
126
+ def resourcesMapTempFileName = "CodePushResourcesMap-" + java.util.UUID.randomUUID().toString().substring(0, 8) + ".json"
133
127
 
134
128
  generateBundledResourcesHash = tasks.create(
135
129
  name: "generateBundledResourcesHash${targetName}",
136
130
  type: Exec) {
137
- commandLine (*nodeExecutableAndArgs, "${nodeModulesPath}/scripts/generateBundledResourcesHash.js", resourcesDir, jsBundleFile, jsBundleDir, resourcesMapTempFileName)
131
+ commandLine(*nodeExecutableAndArgs, "${nodeModulesPath}/scripts/generateBundledResourcesHash.js", resourcesDir, jsBundleFile, jsBundleDir, resourcesMapTempFileName)
138
132
  }
139
133
 
140
134
  // Make this task run right before the bundle task
141
135
  def recordFilesBeforeBundleCommand = tasks.create(
142
136
  name: "recordFilesBeforeBundleCommand${targetName}",
143
137
  type: Exec) {
144
- commandLine (*nodeExecutableAndArgs, "${nodeModulesPath}/scripts/recordFilesBeforeBundleCommand.js", resourcesDir, resourcesMapTempFileName)
138
+ commandLine(*nodeExecutableAndArgs, "${nodeModulesPath}/scripts/recordFilesBeforeBundleCommand.js", resourcesDir, resourcesMapTempFileName)
145
139
  }
146
140
 
147
141
  recordFilesBeforeBundleCommand.dependsOn("merge${targetName}Resources")
@@ -160,3 +154,21 @@ gradle.projectsEvaluated {
160
154
  runBefore("process${targetName}Resources", generateBundledResourcesHash)
161
155
  }
162
156
  }
157
+
158
+ project.extensions.findByName("androidComponents")?.finalizeDsl { extension ->
159
+ // This disables density-based APK splitting for the App Bundle
160
+ extension.bundle.density.enableSplit = false
161
+
162
+ extension.androidResources.noCompress += "png"
163
+
164
+ extension.buildTypes.all { buildType ->
165
+ // disable PNG crunching for release builds to align APK resources with what Metro builds
166
+ if(!buildType.debuggable){
167
+ crunchPngs = false
168
+ }
169
+
170
+ // to prevent incorrect long value restoration from strings.xml we need to wrap it with double quotes
171
+ // https://github.com/microsoft/cordova-plugin-code-push/issues/264
172
+ buildType.resValue('string', "CODE_PUSH_APK_BUILD_TIME", String.format("\"%d\"", System.currentTimeMillis()))
173
+ }
174
+ }
@@ -36,9 +36,7 @@ public class FileUtils {
36
36
  }
37
37
  }
38
38
 
39
- if (!file.delete()) {
40
- CodePushUtils.log("Error deleting file " + file.getName());
41
- }
39
+ file.delete()
42
40
  }
43
41
 
44
42
  public static boolean fileAtPathExists(String filePath) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@revopush/react-native-code-push",
3
- "version": "2.5.0-rc.4",
3
+ "version": "2.5.0-rc.6",
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",
@@ -52,7 +52,7 @@ function getBundleResourceEntries(resourcesDir, assetsDir) {
52
52
 
53
53
  const normalizePath = (it) => path.join(CODE_PUSH_FOLDER_PREFIX, it).replace(/\\/g, "/")
54
54
  return {
55
- resources: Object.fromEntries(resourceFilesRelative.map((it) => [path.parse(it).name, normalizePath(it)])),
55
+ resources: Object.fromEntries(resourceFilesRelative.map((it) => [normalizePath(it), path.parse(it).name])),
56
56
  assets: Object.fromEntries(assetsFilesRelative.map((it) => [it.replace(/\\/g, "/"), normalizePath(it)]))
57
57
  }
58
58
  }
@@ -122,8 +122,8 @@ export interface SyncOptions {
122
122
 
123
123
  /**
124
124
  * Specifies the minimum number of seconds that the app needs to have been in the background before restarting the app. This property
125
- * only applies to updates which are installed using `InstallMode.ON_NEXT_RESUME` or `InstallMode.ON_NEXT_SUSPEND`, and can be useful
126
- * for getting your update in front of end users sooner, without being too obtrusive. Defaults to `0`, which has the effect of applying
125
+ * only applies to updates which are installed using `InstallMode.ON_NEXT_RESUME` or `InstallMode.ON_NEXT_SUSPEND`, and can be useful
126
+ * for getting your update in front of end users sooner, without being too obtrusive. Defaults to `0`, which has the effect of applying
127
127
  * the update immediately after a resume or unless the app suspension is long enough to not matter, regardless how long it was in the background.
128
128
  */
129
129
  minimumBackgroundDuration?: number;
@@ -144,6 +144,12 @@ export interface SyncOptions {
144
144
  * one or more of the default values.
145
145
  */
146
146
  rollbackRetryOptions?: RollbackRetryOptions;
147
+
148
+ /**
149
+ * Indicates whether you would like to ignore failed updates. This is useful in scenarios where you want to install an update irrespective
150
+ * of whether the previous update was successful or not.
151
+ */
152
+ ignoreFailedUpdates?: Boolean;
147
153
  }
148
154
 
149
155
  export interface UpdateDialog {
@@ -257,7 +263,7 @@ declare namespace CodePush {
257
263
  * Asks the CodePush service whether the configured app deployment has an update available.
258
264
  *
259
265
  * @param deploymentKey The deployment key to use to query the CodePush server for an update.
260
- *
266
+ *
261
267
  * @param handleBinaryVersionMismatchCallback An optional callback for handling target binary version mismatch
262
268
  */
263
269
  function checkForUpdate(deploymentKey?: string, handleBinaryVersionMismatchCallback?: HandleBinaryVersionMismatchCallback): Promise<RemotePackage | null>;
@@ -267,12 +273,12 @@ declare namespace CodePush {
267
273
  *
268
274
  * @param updateState The state of the update you want to retrieve the metadata for. Defaults to UpdateState.RUNNING.
269
275
  */
270
- function getUpdateMetadata(updateState?: UpdateState) : Promise<LocalPackage|null>;
276
+ function getUpdateMetadata(updateState?: UpdateState): Promise<LocalPackage | null>;
271
277
 
272
278
  /**
273
279
  * Notifies the CodePush runtime that an installed update is considered successful.
274
280
  */
275
- function notifyAppReady(): Promise<StatusReport|void>;
281
+ function notifyAppReady(): Promise<StatusReport | void>;
276
282
 
277
283
  /**
278
284
  * Allow CodePush to restart the app.
@@ -326,7 +332,7 @@ declare namespace CodePush {
326
332
  /**
327
333
  * Indicates that you want to install the update, but don't want to restart the app until the next time
328
334
  * the end user resumes it from the background. This way, you don't disrupt their current session,
329
- * but you can get the update in front of them sooner then having to wait for the next natural restart.
335
+ * but you can get the update in front of them sooner then having to wait for the next natural restart.
330
336
  * This value is appropriate for silent installs that can be applied on resume in a non-invasive way.
331
337
  */
332
338
  ON_NEXT_RESUME,
@@ -347,30 +353,30 @@ declare namespace CodePush {
347
353
  * The app is up-to-date with the CodePush server.
348
354
  */
349
355
  UP_TO_DATE,
350
-
356
+
351
357
  /**
352
358
  * An available update has been installed and will be run either immediately after the
353
359
  * syncStatusChangedCallback function returns or the next time the app resumes/restarts,
354
360
  * depending on the InstallMode specified in SyncOptions
355
361
  */
356
362
  UPDATE_INSTALLED,
357
-
363
+
358
364
  /**
359
365
  * The app had an optional update which the end user chose to ignore.
360
366
  * (This is only applicable when the updateDialog is used)
361
367
  */
362
368
  UPDATE_IGNORED,
363
-
369
+
364
370
  /**
365
371
  * The sync operation encountered an unknown error.
366
372
  */
367
373
  UNKNOWN_ERROR,
368
-
374
+
369
375
  /**
370
376
  * There is an ongoing sync operation running which prevents the current call from being executed.
371
377
  */
372
378
  SYNC_IN_PROGRESS,
373
-
379
+
374
380
  /**
375
381
  * The CodePush server is being queried for an update.
376
382
  */