Skip to content
This repository was archived by the owner on May 20, 2025. It is now read-only.

Commit 85d614e

Browse files
author
max-mironov
committed
2 parents 867d398 + 72cb03d commit 85d614e

File tree

4 files changed

+20
-8
lines changed

4 files changed

+20
-8
lines changed

CodePush.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ package = JSON.parse(File.read(File.join(__dir__, 'package.json')))
55
Pod::Spec.new do |s|
66

77
s.name = 'CodePush'
8-
s.version = package['version'].sub('-beta', '')
8+
s.version = package['version'].gsub(/v|-beta/, '')
99
s.summary = package['description']
1010
s.author = package['author']
1111
s.license = package['license']

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-native-code-push",
3-
"version": "1000.0.0-beta",
3+
"version": "1.17.2-beta",
44
"description": "React Native plugin for the CodePush service",
55
"main": "CodePush.js",
66
"typings": "typings/react-native-code-push.d.ts",

windows/CodePush.Net46/UpdateManager.cs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,10 @@ internal async Task DownloadPackageAsync(JObject updatePackage, string expectedB
4545
try
4646
{
4747
// Unzip the downloaded file and then delete the zip
48-
var unzippedFolder = await GetUnzippedFolderAsync().ConfigureAwait(false);
48+
var unzippedFolder = await CreateUnzippedFolderAsync().ConfigureAwait(false);
4949
/**
5050
* TODO:
5151
* 1) ZipFile.ExtractToDirectory is not reliable and throws exception if:
52-
* - folder exists already
5352
* - path is too long (> 250 chars)
5453
*
5554
* 2) Un-zipping is quite long operation. Does it make sense for async?
@@ -292,9 +291,16 @@ private async Task<IFile> GetStatusFileAsync()
292291
return await codePushFolder.CreateFileAsync(CodePushConstants.StatusFileName, CreationCollisionOption.OpenIfExists).ConfigureAwait(false);
293292
}
294293

295-
private async Task<IFolder> GetUnzippedFolderAsync()
294+
private async Task<IFolder> CreateUnzippedFolderAsync()
296295
{
297296
var codePushFolder = await UpdateUtils.GetCodePushFolderAsync().ConfigureAwait(false);
297+
var isUnzippedFolderExists = await codePushFolder.CheckExistsAsync(CodePushConstants.UnzippedFolderName).ConfigureAwait(false);
298+
299+
if (isUnzippedFolderExists != ExistenceCheckResult.NotFound)
300+
{
301+
await codePushFolder.GetFolderAsync(CodePushConstants.UnzippedFolderName).ContinueWith((existingFolder) => existingFolder.Result.DeleteAsync());
302+
}
303+
298304
return await codePushFolder.CreateFolderAsync(CodePushConstants.UnzippedFolderName, CreationCollisionOption.OpenIfExists).ConfigureAwait(false);
299305
}
300306

windows/CodePush/UpdateManager.cs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ internal async Task DownloadPackageAsync(JObject updatePackage, string expectedB
5353
try
5454
{
5555
// Unzip the downloaded file and then delete the zip
56-
StorageFolder unzippedFolder = await GetUnzippedFolderAsync().ConfigureAwait(false);
56+
StorageFolder unzippedFolder = await CreateUnzippedFolderAsync().ConfigureAwait(false);
5757
ZipFile.ExtractToDirectory(downloadFile.Path, unzippedFolder.Path);
5858
await downloadFile.DeleteAsync().AsTask().ConfigureAwait(false);
5959

@@ -99,7 +99,6 @@ internal async Task DownloadPackageAsync(JObject updatePackage, string expectedB
9999
await downloadFile.MoveAsync(newUpdateFolder).AsTask().ConfigureAwait(false);
100100
}
101101
/*TODO: ZipFile.ExtractToDirectory is not reliable and throws exceptions if:
102-
- folder exists already
103102
- path is too long
104103
it needs to be handled
105104
*/
@@ -278,9 +277,16 @@ private async Task<StorageFile> GetStatusFileAsync()
278277
return await codePushFolder.CreateFileAsync(CodePushConstants.StatusFileName, CreationCollisionOption.OpenIfExists).AsTask().ConfigureAwait(false);
279278
}
280279

281-
private async Task<StorageFolder> GetUnzippedFolderAsync()
280+
private async Task<StorageFolder> CreateUnzippedFolderAsync()
282281
{
283282
StorageFolder codePushFolder = await GetCodePushFolderAsync().ConfigureAwait(false);
283+
var unzippedFolder = await codePushFolder.TryGetItemAsync(CodePushConstants.UnzippedFolderName).AsTask().ConfigureAwait(false);
284+
285+
if (unzippedFolder != null)
286+
{
287+
await unzippedFolder.DeleteAsync();
288+
}
289+
284290
return await codePushFolder.CreateFolderAsync(CodePushConstants.UnzippedFolderName, CreationCollisionOption.OpenIfExists).AsTask().ConfigureAwait(false);
285291
}
286292

0 commit comments

Comments
 (0)