@revopush/react-native-code-push 2.6.0-rc.4 → 2.6.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/.claude/settings.local.json +5 -1
- package/android/build.gradle +12 -1
- package/android/codepush.gradle +21 -44
- package/android/gradle.properties +2 -0
- package/android/settings.gradle +8 -9
- package/android/src/main/java/com/microsoft/codepush/react/BaseBundleStore.java +78 -0
- package/android/src/main/java/com/microsoft/codepush/react/CodePush.java +14 -3
- package/android/src/main/java/com/microsoft/codepush/react/CodePushConstants.java +2 -0
- package/android/src/main/java/com/microsoft/codepush/react/CodePushNativeModule.java +3 -3
- package/android/src/main/java/com/microsoft/codepush/react/CodePushUpdateManager.java +56 -11
- package/android/src/main/java/com/microsoft/codepush/react/FileUtils.java +7 -5
- package/ios/CodePush/CodePush.h +14 -0
- package/ios/CodePush/CodePushBaseBundleStore.m +104 -0
- package/ios/CodePush/CodePushPackage.m +82 -9
- package/ios/CodePush.xcodeproj/project.pbxproj +6 -0
- package/ios/Frameworks/DiffUpdates.xcframework/ios-arm64/DiffUpdates.framework/DiffUpdates +0 -0
- package/ios/Frameworks/DiffUpdates.xcframework/ios-arm64/DiffUpdates.framework/Headers/DiffUpdates.h +18 -0
- package/ios/Frameworks/DiffUpdates.xcframework/ios-arm64/DiffUpdates.framework/Headers/hpatch_objc.h +23 -0
- package/ios/Frameworks/DiffUpdates.xcframework/ios-arm64/DiffUpdates.framework/Info.plist +0 -0
- package/ios/Frameworks/DiffUpdates.xcframework/ios-arm64_x86_64-simulator/DiffUpdates.framework/DiffUpdates +0 -0
- package/ios/Frameworks/DiffUpdates.xcframework/ios-arm64_x86_64-simulator/DiffUpdates.framework/Headers/DiffUpdates.h +18 -0
- package/ios/Frameworks/DiffUpdates.xcframework/ios-arm64_x86_64-simulator/DiffUpdates.framework/Headers/hpatch_objc.h +23 -0
- package/ios/Frameworks/DiffUpdates.xcframework/ios-arm64_x86_64-simulator/DiffUpdates.framework/Info.plist +0 -0
- package/ios/Frameworks/DiffUpdates.xcframework/ios-arm64_x86_64-simulator/DiffUpdates.framework/_CodeSignature/CodeDirectory +0 -0
- package/ios/Frameworks/DiffUpdates.xcframework/ios-arm64_x86_64-simulator/DiffUpdates.framework/_CodeSignature/CodeResources +12 -9
- package/package.json +10 -14
- package/tsconfig.json +1 -4
- package/typings/react-native-code-push.d.ts +18 -0
- package/ios/Frameworks/DiffUpdates.xcframework/ios-arm64_x86_64-simulator/DiffUpdates.framework/_CodeSignature/CodeRequirements-1 +0 -0
- package/scripts/postlink/android/postlink.js +0 -87
- package/scripts/postlink/ios/postlink.js +0 -116
- package/scripts/postlink/run.js +0 -11
- package/scripts/postunlink/android/postunlink.js +0 -74
- package/scripts/postunlink/ios/postunlink.js +0 -87
- package/scripts/postunlink/run.js +0 -11
- package/scripts/tools/linkToolsAndroid.js +0 -57
- package/scripts/tools/linkToolsIos.js +0 -130
|
@@ -90,12 +90,26 @@ static NSString *const UnzippedFolderName = @"unzipped";
|
|
|
90
90
|
NSString *singleUrl = updatePackage[@"downloadUrl"] ?: updatePackage[@"download_url"];
|
|
91
91
|
|
|
92
92
|
__block BOOL cameFromDiffHandler = (bundleDiffUrl.length > 0);
|
|
93
|
-
|
|
93
|
+
__block BOOL fallbackStarted = NO;
|
|
94
|
+
// Assigned below. commonDone reaches back into it to retry a diff that verified badly.
|
|
95
|
+
__block void (^startFullDownload)(void) = nil;
|
|
94
96
|
|
|
95
97
|
void (^commonDone)(BOOL) = ^(BOOL isZip) {
|
|
96
98
|
NSError *error = nil;
|
|
97
99
|
NSString * unzippedFolderPath = [CodePushPackage getUnzippedFolderPath];
|
|
98
100
|
NSMutableDictionary * mutableUpdatePackage = [updatePackage mutableCopy];
|
|
101
|
+
|
|
102
|
+
// A diff patched against the wrong base still produces a well-formed folder, just one
|
|
103
|
+
// holding the wrong bytes. Retry as a full download rather than failing the update.
|
|
104
|
+
BOOL (^recoverFromIntegrityFailure)(void) = ^BOOL {
|
|
105
|
+
if (!cameFromDiffHandler || fallbackStarted || singleUrl.length == 0) {
|
|
106
|
+
return NO;
|
|
107
|
+
}
|
|
108
|
+
CPLog(@"Falling back to a full download.");
|
|
109
|
+
startFullDownload();
|
|
110
|
+
return YES;
|
|
111
|
+
};
|
|
112
|
+
|
|
99
113
|
if (isZip) {
|
|
100
114
|
if ([[NSFileManager defaultManager] fileExistsAtPath:unzippedFolderPath]) {
|
|
101
115
|
// This removes any unzipped download data that could have been left
|
|
@@ -257,6 +271,9 @@ static NSString *const UnzippedFolderName = @"unzipped";
|
|
|
257
271
|
expectedHash:newUpdateHash
|
|
258
272
|
error:&error]) {
|
|
259
273
|
CPLog(@"The update contents failed the data integrity check.");
|
|
274
|
+
if (recoverFromIntegrityFailure()) {
|
|
275
|
+
return;
|
|
276
|
+
}
|
|
260
277
|
if (!error) {
|
|
261
278
|
error = [CodePushErrorUtils errorWithMessage:@"The update contents failed the data integrity check."];
|
|
262
279
|
}
|
|
@@ -305,6 +322,9 @@ static NSString *const UnzippedFolderName = @"unzipped";
|
|
|
305
322
|
expectedHash:newUpdateHash
|
|
306
323
|
error:&error]) {
|
|
307
324
|
CPLog(@"The update contents failed the data integrity check.");
|
|
325
|
+
if (recoverFromIntegrityFailure()) {
|
|
326
|
+
return;
|
|
327
|
+
}
|
|
308
328
|
if (!error) {
|
|
309
329
|
error = [CodePushErrorUtils errorWithMessage:@"The update contents failed the data integrity check."];
|
|
310
330
|
}
|
|
@@ -347,15 +367,16 @@ static NSString *const UnzippedFolderName = @"unzipped";
|
|
|
347
367
|
}
|
|
348
368
|
};
|
|
349
369
|
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
void (^startFullDownload)(void) = ^{
|
|
370
|
+
startFullDownload = ^{
|
|
353
371
|
if (fallbackStarted) return;
|
|
354
372
|
fallbackStarted = YES;
|
|
355
373
|
|
|
356
374
|
NSError *cleanupErr = nil;
|
|
357
375
|
[[NSFileManager defaultManager] removeItemAtPath:downloadFilePath error:&cleanupErr];
|
|
358
376
|
[[NSFileManager defaultManager] removeItemAtPath:[CodePushPackage getUnzippedFolderPath] error:nil];
|
|
377
|
+
// A diff that got as far as the integrity check already assembled this folder. Whatever it
|
|
378
|
+
// left behind is wrong, and copyEntriesInFolder overlays rather than replaces.
|
|
379
|
+
[[NSFileManager defaultManager] removeItemAtPath:newUpdateFolderPath error:nil];
|
|
359
380
|
|
|
360
381
|
CodePushDownloadHandler *downloadHandler = [[CodePushDownloadHandler alloc]
|
|
361
382
|
init:downloadFilePath
|
|
@@ -378,8 +399,12 @@ static NSString *const UnzippedFolderName = @"unzipped";
|
|
|
378
399
|
|
|
379
400
|
|
|
380
401
|
if (cameFromDiffHandler) {
|
|
381
|
-
|
|
382
|
-
NSString *
|
|
402
|
+
// Retained now: this is the last moment we know the release naming it is still on disk.
|
|
403
|
+
NSString *baseHash = [self basePackageHash:updatePackage];
|
|
404
|
+
NSString *baseBundlePath = [self findBaseBundleForPackageHash:baseHash];
|
|
405
|
+
if (baseBundlePath) {
|
|
406
|
+
[CodePushBaseBundleStore save:baseBundlePath forPackageHash:baseHash];
|
|
407
|
+
}
|
|
383
408
|
|
|
384
409
|
NSError *pkgErr = nil;
|
|
385
410
|
NSDictionary *currentPackage = [CodePushPackage getCurrentPackage:&pkgErr];
|
|
@@ -396,10 +421,13 @@ static NSString *const UnzippedFolderName = @"unzipped";
|
|
|
396
421
|
|
|
397
422
|
CPLog(@"Diff download handler");
|
|
398
423
|
|
|
399
|
-
[diffHandler downloadWithDiffUrl:bundleDiffUrl
|
|
424
|
+
[diffHandler downloadWithDiffUrl:bundleDiffUrl
|
|
425
|
+
assetsUrl:assetsUrl
|
|
426
|
+
assetHash:assetHash
|
|
427
|
+
nativeAssetHash:nativeAssetHash
|
|
428
|
+
currentPackage:currentPackage
|
|
429
|
+
baseBundlePath:baseBundlePath];
|
|
400
430
|
} else {
|
|
401
|
-
NSString *singleUrl = updatePackage[@"downloadUrl"] ?: updatePackage[@"download_url"];
|
|
402
|
-
|
|
403
431
|
CodePushDownloadHandler *downloadHandler = [[CodePushDownloadHandler alloc]
|
|
404
432
|
init:downloadFilePath
|
|
405
433
|
operationQueue:operationQueue
|
|
@@ -540,6 +568,51 @@ static NSString *const UnzippedFolderName = @"unzipped";
|
|
|
540
568
|
return [[self getCodePushPath] stringByAppendingPathComponent:packageHash];
|
|
541
569
|
}
|
|
542
570
|
|
|
571
|
+
/** The package hash the server named as the diff base, or nil if it named none we can use. */
|
|
572
|
+
+ (NSString *)basePackageHash:(NSDictionary *)updatePackage
|
|
573
|
+
{
|
|
574
|
+
NSDictionary *basePackage = updatePackage[@"basePackage"];
|
|
575
|
+
if (![basePackage isKindOfClass:NSDictionary.class]) {
|
|
576
|
+
return nil;
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
NSString *packageHash = basePackage[@"packageHash"];
|
|
580
|
+
if (packageHash.length == 0) {
|
|
581
|
+
// Named a base with no hash: server and SDK disagree on the field name.
|
|
582
|
+
CPLog(@"basePackage has no packageHash. Patching against the binary.");
|
|
583
|
+
return nil;
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
return packageHash;
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
/**
|
|
590
|
+
* The bundle to patch against: the retained copy of that release, else the release's own bundle
|
|
591
|
+
* while its package folder still exists. nil means patch against the binary's bundle instead.
|
|
592
|
+
*/
|
|
593
|
+
+ (NSString *)findBaseBundleForPackageHash:(NSString *)packageHash
|
|
594
|
+
{
|
|
595
|
+
if (packageHash.length == 0) {
|
|
596
|
+
return nil;
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
NSString *bundlePath = [CodePushBaseBundleStore lookup:packageHash];
|
|
600
|
+
if (bundlePath) {
|
|
601
|
+
return bundlePath;
|
|
602
|
+
}
|
|
603
|
+
|
|
604
|
+
NSString *relativeBundlePath = [self getPackage:packageHash error:nil][RelativeBundlePathKey];
|
|
605
|
+
bundlePath = relativeBundlePath.length > 0
|
|
606
|
+
? [[self getPackageFolderPath:packageHash] stringByAppendingPathComponent:relativeBundlePath]
|
|
607
|
+
: nil;
|
|
608
|
+
if (bundlePath && [[NSFileManager defaultManager] fileExistsAtPath:bundlePath]) {
|
|
609
|
+
return bundlePath;
|
|
610
|
+
}
|
|
611
|
+
|
|
612
|
+
CPLog(@"Base %@ not held. Patching against the binary.", packageHash);
|
|
613
|
+
return nil;
|
|
614
|
+
}
|
|
615
|
+
|
|
543
616
|
+ (NSDictionary *)getPreviousPackage:(NSError **)error
|
|
544
617
|
{
|
|
545
618
|
NSString *packageHash = [self getPreviousPackageHash:error];
|
|
@@ -81,6 +81,7 @@
|
|
|
81
81
|
6463C82E1EBA0CFB0095B8CD /* CodePush.m in Sources */ = {isa = PBXBuildFile; fileRef = 13BE3DED1AC21097009241FE /* CodePush.m */; };
|
|
82
82
|
6463C82F1EBA0CFB0095B8CD /* CodePushConfig.m in Sources */ = {isa = PBXBuildFile; fileRef = 81D51F391B6181C2000DA084 /* CodePushConfig.m */; };
|
|
83
83
|
6463C8321EBA0CFB0095B8CD /* CodePushPackage.m in Sources */ = {isa = PBXBuildFile; fileRef = 810D4E6C1B96935000B397E9 /* CodePushPackage.m */; };
|
|
84
|
+
BA5EB00D0000000000000003 /* CodePushBaseBundleStore.m in Sources */ = {isa = PBXBuildFile; fileRef = BA5EB00D0000000000000001 /* CodePushBaseBundleStore.m */; };
|
|
84
85
|
6463C8331EBA0CFB0095B8CD /* CodePushTelemetryManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 5421FE301C58AD5A00986A55 /* CodePushTelemetryManager.m */; };
|
|
85
86
|
6463C8341EBA0CFB0095B8CD /* CodePushUpdateUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = 540D20111C7684FE00D6EF41 /* CodePushUpdateUtils.m */; };
|
|
86
87
|
6463C8351EBA0CFB0095B8CD /* RCTConvert+CodePushInstallMode.m in Sources */ = {isa = PBXBuildFile; fileRef = 1B23B9131BF9267B000BB2F0 /* RCTConvert+CodePushInstallMode.m */; };
|
|
@@ -88,6 +89,7 @@
|
|
|
88
89
|
6463C8451EBA0D1F0095B8CD /* CodePush.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 13BE3DEC1AC21097009241FE /* CodePush.h */; };
|
|
89
90
|
6463C8471EBA0D290095B8CD /* CodePush.h in Headers */ = {isa = PBXBuildFile; fileRef = 13BE3DEC1AC21097009241FE /* CodePush.h */; };
|
|
90
91
|
810D4E6D1B96935000B397E9 /* CodePushPackage.m in Sources */ = {isa = PBXBuildFile; fileRef = 810D4E6C1B96935000B397E9 /* CodePushPackage.m */; };
|
|
92
|
+
BA5EB00D0000000000000002 /* CodePushBaseBundleStore.m in Sources */ = {isa = PBXBuildFile; fileRef = BA5EB00D0000000000000001 /* CodePushBaseBundleStore.m */; };
|
|
91
93
|
81D51F3A1B6181C2000DA084 /* CodePushConfig.m in Sources */ = {isa = PBXBuildFile; fileRef = 81D51F391B6181C2000DA084 /* CodePushConfig.m */; };
|
|
92
94
|
8482F84C1E24C58300F793DB /* CodePush.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 13BE3DEC1AC21097009241FE /* CodePush.h */; };
|
|
93
95
|
8482F84E1E24C66300F793DB /* CodePush.h in Headers */ = {isa = PBXBuildFile; fileRef = 13BE3DEC1AC21097009241FE /* CodePush.h */; };
|
|
@@ -210,6 +212,7 @@
|
|
|
210
212
|
540D20111C7684FE00D6EF41 /* CodePushUpdateUtils.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CodePushUpdateUtils.m; path = CodePush/CodePushUpdateUtils.m; sourceTree = "<group>"; };
|
|
211
213
|
5421FE301C58AD5A00986A55 /* CodePushTelemetryManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CodePushTelemetryManager.m; path = CodePush/CodePushTelemetryManager.m; sourceTree = "<group>"; };
|
|
212
214
|
810D4E6C1B96935000B397E9 /* CodePushPackage.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CodePushPackage.m; path = CodePush/CodePushPackage.m; sourceTree = "<group>"; };
|
|
215
|
+
BA5EB00D0000000000000001 /* CodePushBaseBundleStore.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CodePushBaseBundleStore.m; path = CodePush/CodePushBaseBundleStore.m; sourceTree = "<group>"; };
|
|
213
216
|
81D51F391B6181C2000DA084 /* CodePushConfig.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CodePushConfig.m; path = CodePush/CodePushConfig.m; sourceTree = "<group>"; };
|
|
214
217
|
F85736731F4F03BF00C9C00A /* MF_Base64Additions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MF_Base64Additions.h; sourceTree = "<group>"; };
|
|
215
218
|
F85736741F4F03BF00C9C00A /* MF_Base64Additions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MF_Base64Additions.m; sourceTree = "<group>"; };
|
|
@@ -370,6 +373,7 @@
|
|
|
370
373
|
13BE3DED1AC21097009241FE /* CodePush.m */,
|
|
371
374
|
81D51F391B6181C2000DA084 /* CodePushConfig.m */,
|
|
372
375
|
810D4E6C1B96935000B397E9 /* CodePushPackage.m */,
|
|
376
|
+
BA5EB00D0000000000000001 /* CodePushBaseBundleStore.m */,
|
|
373
377
|
5421FE301C58AD5A00986A55 /* CodePushTelemetryManager.m */,
|
|
374
378
|
540D20111C7684FE00D6EF41 /* CodePushUpdateUtils.m */,
|
|
375
379
|
1B23B9131BF9267B000BB2F0 /* RCTConvert+CodePushInstallMode.m */,
|
|
@@ -763,6 +767,7 @@
|
|
|
763
767
|
F88664511F4AD1EE0036D01B /* JWTAlgorithmNone.m in Sources */,
|
|
764
768
|
3221E4612C8ABE1300268379 /* mz_zip_rw.c in Sources */,
|
|
765
769
|
810D4E6D1B96935000B397E9 /* CodePushPackage.m in Sources */,
|
|
770
|
+
BA5EB00D0000000000000002 /* CodePushBaseBundleStore.m in Sources */,
|
|
766
771
|
3221E4552C8ABE1300268379 /* mz_strm_pkcrypt.c in Sources */,
|
|
767
772
|
F88664531F4AD1EE0036D01B /* JWTAlgorithmESBase.m in Sources */,
|
|
768
773
|
3221E4532C8ABE1300268379 /* mz_strm_os_posix.c in Sources */,
|
|
@@ -783,6 +788,7 @@
|
|
|
783
788
|
6463C82F1EBA0CFB0095B8CD /* CodePushConfig.m in Sources */,
|
|
784
789
|
3221E46E2C8ABE1300268379 /* mz_crypt.c in Sources */,
|
|
785
790
|
6463C8321EBA0CFB0095B8CD /* CodePushPackage.m in Sources */,
|
|
791
|
+
BA5EB00D0000000000000003 /* CodePushBaseBundleStore.m in Sources */,
|
|
786
792
|
6463C8331EBA0CFB0095B8CD /* CodePushTelemetryManager.m in Sources */,
|
|
787
793
|
6463C8341EBA0CFB0095B8CD /* CodePushUpdateUtils.m in Sources */,
|
|
788
794
|
3221E45C2C8ABE1300268379 /* mz_strm_zlib.c in Sources */,
|
|
Binary file
|
package/ios/Frameworks/DiffUpdates.xcframework/ios-arm64/DiffUpdates.framework/Headers/DiffUpdates.h
CHANGED
|
@@ -8,6 +8,12 @@ FOUNDATION_EXPORT const unsigned char DiffUpdatesVersionString[];
|
|
|
8
8
|
|
|
9
9
|
// In this header, you should import all the public headers of your framework using statements like #import <DiffUpdates/PublicHeader.h>
|
|
10
10
|
|
|
11
|
+
#if __has_include(<DiffUpdates/hpatch_objc.h>)
|
|
12
|
+
#import <DiffUpdates/hpatch_objc.h>
|
|
13
|
+
#else
|
|
14
|
+
#import "hpatch_objc.h"
|
|
15
|
+
#endif
|
|
16
|
+
|
|
11
17
|
@interface CodePushDownloadHandler : NSObject <NSURLConnectionDelegate>
|
|
12
18
|
|
|
13
19
|
@property (strong) NSOutputStream *outputFileStream;
|
|
@@ -43,6 +49,18 @@ FOUNDATION_EXPORT const unsigned char DiffUpdatesVersionString[];
|
|
|
43
49
|
doneCallback:(void (^)(BOOL))doneCallback
|
|
44
50
|
failCallback:(void (^)(NSError *err))failCallback;
|
|
45
51
|
|
|
52
|
+
/**
|
|
53
|
+
* Patches against baseBundlePath, or against the binary's own bundle when it is nil.
|
|
54
|
+
* The patched bundle always keeps the binary bundle's file name, whatever the base was.
|
|
55
|
+
*/
|
|
56
|
+
- (void)downloadWithDiffUrl:(NSString *)diffUrl
|
|
57
|
+
assetsUrl:(NSString * _Nullable)assetsUrl
|
|
58
|
+
assetHash:(NSString * _Nullable)assetHash
|
|
59
|
+
nativeAssetHash:(NSString * _Nullable)nativeAssetHash
|
|
60
|
+
currentPackage:(NSDictionary * _Nullable)currentPackage
|
|
61
|
+
baseBundlePath:(NSString * _Nullable)baseBundlePath;
|
|
62
|
+
|
|
63
|
+
/** Patches against the binary's own bundle. Kept so an older SDK links against a newer framework. */
|
|
46
64
|
- (void)downloadWithDiffUrl:(NSString *)diffUrl
|
|
47
65
|
assetsUrl:(NSString * _Nullable)assetsUrl
|
|
48
66
|
assetHash:(NSString * _Nullable)assetHash
|
package/ios/Frameworks/DiffUpdates.xcframework/ios-arm64/DiffUpdates.framework/Headers/hpatch_objc.h
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
#import <Foundation/Foundation.h>
|
|
2
|
+
|
|
3
|
+
@interface hpatcher : NSObject
|
|
4
|
+
|
|
5
|
+
// return THPatchResult, 0 is ok
|
|
6
|
+
// cacheMemory:
|
|
7
|
+
// cacheMemory is used for file IO, different cacheMemory only affects patch speed;
|
|
8
|
+
// recommended 256*1024,1024*1024,... if cacheMemory<0 then default 256*1024;
|
|
9
|
+
// NOTE: if diffFile created by $xdelta3(-S,-S lzma),$open-vcdiff, alloc memory+=sourceWindowSize+targetWindowSize;
|
|
10
|
+
// ( sourceWindowSize & targetWindowSize is set when diff, C API getVcDiffInfo() can got values from diffFile. )
|
|
11
|
+
// if diffFile created by $bsdiff4, and patch very slow,
|
|
12
|
+
// then cacheMemory recommended oldFileSize+256*1024;
|
|
13
|
+
|
|
14
|
+
+ (int)patchWithOld:(NSString *)oldFileName
|
|
15
|
+
withDiff:(NSString *)diffFileName
|
|
16
|
+
toNew:(NSString *)outNewFileName;
|
|
17
|
+
|
|
18
|
+
+ (int)patchWithOld:(NSString *)oldFileName
|
|
19
|
+
withDiff:(NSString *)diffFileName
|
|
20
|
+
toNew:(NSString *)outNewFileName
|
|
21
|
+
byMemory:(int64_t)cacheMemory;
|
|
22
|
+
|
|
23
|
+
@end
|
|
Binary file
|
|
Binary file
|
|
@@ -8,6 +8,12 @@ FOUNDATION_EXPORT const unsigned char DiffUpdatesVersionString[];
|
|
|
8
8
|
|
|
9
9
|
// In this header, you should import all the public headers of your framework using statements like #import <DiffUpdates/PublicHeader.h>
|
|
10
10
|
|
|
11
|
+
#if __has_include(<DiffUpdates/hpatch_objc.h>)
|
|
12
|
+
#import <DiffUpdates/hpatch_objc.h>
|
|
13
|
+
#else
|
|
14
|
+
#import "hpatch_objc.h"
|
|
15
|
+
#endif
|
|
16
|
+
|
|
11
17
|
@interface CodePushDownloadHandler : NSObject <NSURLConnectionDelegate>
|
|
12
18
|
|
|
13
19
|
@property (strong) NSOutputStream *outputFileStream;
|
|
@@ -43,6 +49,18 @@ FOUNDATION_EXPORT const unsigned char DiffUpdatesVersionString[];
|
|
|
43
49
|
doneCallback:(void (^)(BOOL))doneCallback
|
|
44
50
|
failCallback:(void (^)(NSError *err))failCallback;
|
|
45
51
|
|
|
52
|
+
/**
|
|
53
|
+
* Patches against baseBundlePath, or against the binary's own bundle when it is nil.
|
|
54
|
+
* The patched bundle always keeps the binary bundle's file name, whatever the base was.
|
|
55
|
+
*/
|
|
56
|
+
- (void)downloadWithDiffUrl:(NSString *)diffUrl
|
|
57
|
+
assetsUrl:(NSString * _Nullable)assetsUrl
|
|
58
|
+
assetHash:(NSString * _Nullable)assetHash
|
|
59
|
+
nativeAssetHash:(NSString * _Nullable)nativeAssetHash
|
|
60
|
+
currentPackage:(NSDictionary * _Nullable)currentPackage
|
|
61
|
+
baseBundlePath:(NSString * _Nullable)baseBundlePath;
|
|
62
|
+
|
|
63
|
+
/** Patches against the binary's own bundle. Kept so an older SDK links against a newer framework. */
|
|
46
64
|
- (void)downloadWithDiffUrl:(NSString *)diffUrl
|
|
47
65
|
assetsUrl:(NSString * _Nullable)assetsUrl
|
|
48
66
|
assetHash:(NSString * _Nullable)assetHash
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
#import <Foundation/Foundation.h>
|
|
2
|
+
|
|
3
|
+
@interface hpatcher : NSObject
|
|
4
|
+
|
|
5
|
+
// return THPatchResult, 0 is ok
|
|
6
|
+
// cacheMemory:
|
|
7
|
+
// cacheMemory is used for file IO, different cacheMemory only affects patch speed;
|
|
8
|
+
// recommended 256*1024,1024*1024,... if cacheMemory<0 then default 256*1024;
|
|
9
|
+
// NOTE: if diffFile created by $xdelta3(-S,-S lzma),$open-vcdiff, alloc memory+=sourceWindowSize+targetWindowSize;
|
|
10
|
+
// ( sourceWindowSize & targetWindowSize is set when diff, C API getVcDiffInfo() can got values from diffFile. )
|
|
11
|
+
// if diffFile created by $bsdiff4, and patch very slow,
|
|
12
|
+
// then cacheMemory recommended oldFileSize+256*1024;
|
|
13
|
+
|
|
14
|
+
+ (int)patchWithOld:(NSString *)oldFileName
|
|
15
|
+
withDiff:(NSString *)diffFileName
|
|
16
|
+
toNew:(NSString *)outNewFileName;
|
|
17
|
+
|
|
18
|
+
+ (int)patchWithOld:(NSString *)oldFileName
|
|
19
|
+
withDiff:(NSString *)diffFileName
|
|
20
|
+
toNew:(NSString *)outNewFileName
|
|
21
|
+
byMemory:(int64_t)cacheMemory;
|
|
22
|
+
|
|
23
|
+
@end
|
|
Binary file
|
|
Binary file
|
|
@@ -6,11 +6,15 @@
|
|
|
6
6
|
<dict>
|
|
7
7
|
<key>Headers/DiffUpdates.h</key>
|
|
8
8
|
<data>
|
|
9
|
-
|
|
9
|
+
g/pumjyvm0+YW5l1ITg21uE1aks=
|
|
10
|
+
</data>
|
|
11
|
+
<key>Headers/hpatch_objc.h</key>
|
|
12
|
+
<data>
|
|
13
|
+
SaiQblz/yRr77onv7z8Ugu73qD8=
|
|
10
14
|
</data>
|
|
11
15
|
<key>Info.plist</key>
|
|
12
16
|
<data>
|
|
13
|
-
|
|
17
|
+
2zKOg08DVcAALLhU4O6Sww/NWPU=
|
|
14
18
|
</data>
|
|
15
19
|
<key>Modules/module.modulemap</key>
|
|
16
20
|
<data>
|
|
@@ -21,21 +25,20 @@
|
|
|
21
25
|
<dict>
|
|
22
26
|
<key>Headers/DiffUpdates.h</key>
|
|
23
27
|
<dict>
|
|
24
|
-
<key>
|
|
28
|
+
<key>hash2</key>
|
|
25
29
|
<data>
|
|
26
|
-
|
|
30
|
+
wph2g8VsI7OQgHbVrjlwf1Th3yy7DNGvT17//mXP4JY=
|
|
27
31
|
</data>
|
|
32
|
+
</dict>
|
|
33
|
+
<key>Headers/hpatch_objc.h</key>
|
|
34
|
+
<dict>
|
|
28
35
|
<key>hash2</key>
|
|
29
36
|
<data>
|
|
30
|
-
|
|
37
|
+
njsIVvkyjrzbeGuTmt0E8DrCRWuM7HykrRewMTqIatw=
|
|
31
38
|
</data>
|
|
32
39
|
</dict>
|
|
33
40
|
<key>Modules/module.modulemap</key>
|
|
34
41
|
<dict>
|
|
35
|
-
<key>hash</key>
|
|
36
|
-
<data>
|
|
37
|
-
MdjndwGRSccoMYmOwMDjozLG1jc=
|
|
38
|
-
</data>
|
|
39
42
|
<key>hash2</key>
|
|
40
43
|
<data>
|
|
41
44
|
TkYpCqgNFTGwSnC7+iZu51GEITzi1EHKvjZj4HupKms=
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@revopush/react-native-code-push",
|
|
3
|
-
"version": "2.6.
|
|
3
|
+
"version": "2.6.1",
|
|
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",
|
|
@@ -37,18 +37,14 @@
|
|
|
37
37
|
"url": "https://github.com/revopush/react-native-code-push"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@revopush/code-push": "4.
|
|
41
|
-
"
|
|
42
|
-
"hoist-non-react-statics": "^3.3.2",
|
|
43
|
-
"inquirer": "^8.1.5",
|
|
44
|
-
"plist": "^3.0.4",
|
|
45
|
-
"semver": "^7.3.5",
|
|
46
|
-
"xcode": "3.0.1"
|
|
40
|
+
"@revopush/code-push": "4.6.0",
|
|
41
|
+
"hoist-non-react-statics": "^3.3.2"
|
|
47
42
|
},
|
|
48
43
|
"devDependencies": {
|
|
44
|
+
"@react-native/gradle-plugin": "0.79.6",
|
|
49
45
|
"@types/assert": "^1.5.2",
|
|
50
46
|
"@types/mkdirp": "^1.0.1",
|
|
51
|
-
"@types/mocha": "^
|
|
47
|
+
"@types/mocha": "^10.0.0",
|
|
52
48
|
"@types/node": "^14.0.27",
|
|
53
49
|
"@types/q": "^1.5.4",
|
|
54
50
|
"archiver": "latest",
|
|
@@ -57,7 +53,7 @@
|
|
|
57
53
|
"del": "v6.0.0",
|
|
58
54
|
"express": "latest",
|
|
59
55
|
"mkdirp": "latest",
|
|
60
|
-
"mocha": "^
|
|
56
|
+
"mocha": "^11.7.6",
|
|
61
57
|
"q": "^1.5.1",
|
|
62
58
|
"run-sequence": "latest",
|
|
63
59
|
"shx": "^0.3.4",
|
|
@@ -65,6 +61,10 @@
|
|
|
65
61
|
"tslint": "^6.1.3",
|
|
66
62
|
"typescript": "^4.4.3"
|
|
67
63
|
},
|
|
64
|
+
"overrides": {
|
|
65
|
+
"serialize-javascript": "^7.0.3",
|
|
66
|
+
"diff": "^8.0.3"
|
|
67
|
+
},
|
|
68
68
|
"peerDependencies": {
|
|
69
69
|
"react-native": ">=0.83.0"
|
|
70
70
|
},
|
|
@@ -76,10 +76,6 @@
|
|
|
76
76
|
"sharedLibraries": [
|
|
77
77
|
"libz"
|
|
78
78
|
]
|
|
79
|
-
},
|
|
80
|
-
"commands": {
|
|
81
|
-
"postlink": "node node_modules/@revopush/react-native-code-push/scripts/postlink/run",
|
|
82
|
-
"postunlink": "node node_modules/@revopush/react-native-code-push/scripts/postunlink/run"
|
|
83
79
|
}
|
|
84
80
|
}
|
|
85
81
|
}
|
package/tsconfig.json
CHANGED
|
@@ -89,6 +89,24 @@ export interface Package {
|
|
|
89
89
|
* The size of the code contained within the update, in bytes.
|
|
90
90
|
*/
|
|
91
91
|
packageSize: number;
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* The manifest-scheme hash of this update's JS bundle. Present from server versions that
|
|
95
|
+
* report it; used to match a locally held bundle against a diff's base.
|
|
96
|
+
*/
|
|
97
|
+
bundleHash?: string;
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* URL of this update's bundle-only archive.
|
|
101
|
+
*/
|
|
102
|
+
bundleBlobUrl?: string;
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* The base release this update's bundle diff applies to. Absent when the update has no diff.
|
|
106
|
+
*/
|
|
107
|
+
basePackage?: {
|
|
108
|
+
packageHash: string;
|
|
109
|
+
};
|
|
92
110
|
}
|
|
93
111
|
|
|
94
112
|
export interface RemotePackage extends Package {
|
|
Binary file
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
var linkTools = require('../../tools/linkToolsAndroid');
|
|
2
|
-
var fs = require("fs");
|
|
3
|
-
var inquirer = require('inquirer');
|
|
4
|
-
|
|
5
|
-
module.exports = () => {
|
|
6
|
-
|
|
7
|
-
console.log("Running android postlink script");
|
|
8
|
-
|
|
9
|
-
var buildGradlePath = linkTools.getBuildGradlePath();
|
|
10
|
-
var mainApplicationPath = linkTools.getMainApplicationLocation();
|
|
11
|
-
|
|
12
|
-
// 1. Add the getJSBundleFile override
|
|
13
|
-
var getJSBundleFileOverride = linkTools.getJSBundleFileOverride;
|
|
14
|
-
|
|
15
|
-
if (mainApplicationPath) {
|
|
16
|
-
var mainApplicationContents = fs.readFileSync(mainApplicationPath, "utf8");
|
|
17
|
-
if (linkTools.isJsBundleOverridden(mainApplicationContents)) {
|
|
18
|
-
console.log(`"getJSBundleFile" is already overridden`);
|
|
19
|
-
} else {
|
|
20
|
-
var reactNativeHostInstantiation = linkTools.reactNativeHostInstantiation;
|
|
21
|
-
mainApplicationContents = mainApplicationContents.replace(reactNativeHostInstantiation,
|
|
22
|
-
`${reactNativeHostInstantiation}${getJSBundleFileOverride}`);
|
|
23
|
-
fs.writeFileSync(mainApplicationPath, mainApplicationContents);
|
|
24
|
-
}
|
|
25
|
-
} else {
|
|
26
|
-
var mainActivityPath = linkTools.getMainActivityPath();
|
|
27
|
-
if (mainActivityPath) {
|
|
28
|
-
var mainActivityContents = fs.readFileSync(mainActivityPath, "utf8");
|
|
29
|
-
if (linkTools.isJsBundleOverridden(mainActivityContents)) {
|
|
30
|
-
console.log(`"getJSBundleFile" is already overridden`);
|
|
31
|
-
} else {
|
|
32
|
-
var mainActivityClassDeclaration = linkTools.mainActivityClassDeclaration;
|
|
33
|
-
mainActivityContents = mainActivityContents.replace(mainActivityClassDeclaration,
|
|
34
|
-
`${mainActivityClassDeclaration}${getJSBundleFileOverride}`);
|
|
35
|
-
fs.writeFileSync(mainActivityPath, mainActivityContents);
|
|
36
|
-
}
|
|
37
|
-
} else {
|
|
38
|
-
return Promise.reject(`Couldn't find Android application entry point. You might need to update it manually. \
|
|
39
|
-
Please refer to plugin configuration section for Android at \
|
|
40
|
-
https://github.com/microsoft/react-native-code-push/blob/master/docs/setup-android.md#plugin-configuration-for-react-native-lower-than-060-android for more details`);
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
if (!fs.existsSync(buildGradlePath)) {
|
|
45
|
-
return Promise.reject(`Couldn't find build.gradle file. You might need to update it manually. \
|
|
46
|
-
Please refer to plugin installation section for Android at \
|
|
47
|
-
https://github.com/microsoft/react-native-code-push/blob/master/docs/setup-android.md#plugin-installation-android---manual`);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
// 2. Add the codepush.gradle build task definitions
|
|
51
|
-
var buildGradleContents = fs.readFileSync(buildGradlePath, "utf8");
|
|
52
|
-
var reactGradleLink = buildGradleContents.match(/\napply from: ["'].*?react\.gradle["']/)[0];
|
|
53
|
-
var codePushGradleLink = linkTools.codePushGradleLink;
|
|
54
|
-
if (~buildGradleContents.indexOf(codePushGradleLink)) {
|
|
55
|
-
console.log(`"codepush.gradle" is already linked in the build definition`);
|
|
56
|
-
} else {
|
|
57
|
-
buildGradleContents = buildGradleContents.replace(reactGradleLink,
|
|
58
|
-
`${reactGradleLink}${codePushGradleLink}`);
|
|
59
|
-
fs.writeFileSync(buildGradlePath, buildGradleContents);
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
//3. Add deployment key
|
|
63
|
-
var stringsResourcesPath = linkTools.getStringsResourcesPath();
|
|
64
|
-
if (!stringsResourcesPath) {
|
|
65
|
-
return Promise.reject(new Error(`Couldn't find strings.xml. You might need to update it manually.`));
|
|
66
|
-
} else {
|
|
67
|
-
var stringsResourcesContent = fs.readFileSync(stringsResourcesPath, "utf8");
|
|
68
|
-
var deploymentKeyName = linkTools.deploymentKeyName;
|
|
69
|
-
if (~stringsResourcesContent.indexOf(deploymentKeyName)) {
|
|
70
|
-
console.log(`${deploymentKeyName} already specified in the strings.xml`);
|
|
71
|
-
} else {
|
|
72
|
-
return inquirer.prompt({
|
|
73
|
-
"type": "input",
|
|
74
|
-
"name": "androidDeploymentKey",
|
|
75
|
-
"message": "What is your CodePush deployment key for Android (hit <ENTER> to ignore)"
|
|
76
|
-
}).then(function(answer) {
|
|
77
|
-
var insertAfterString = "<resources>";
|
|
78
|
-
var deploymentKeyString = `\t<string moduleConfig="true" name="${deploymentKeyName}">${answer.androidDeploymentKey || "deployment-key-here"}</string>`;
|
|
79
|
-
stringsResourcesContent = stringsResourcesContent.replace(insertAfterString,`${insertAfterString}\n${deploymentKeyString}`);
|
|
80
|
-
fs.writeFileSync(stringsResourcesPath, stringsResourcesContent);
|
|
81
|
-
return Promise.resolve();
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
return Promise.resolve();
|
|
87
|
-
}
|