Skip to content

Commit 0113ed7

Browse files
Bump the version of ZipArchive to 2.5.5 (#2709)
* Bump the version of zipArchive to 2.5.5 * add SSZipArchive code from 2.5.5 tag * Fix Xcode project * Bump iOS and tvOS min versions to 15.5 --------- Co-authored-by: Dmitriy Kirakosyan <[email protected]>
1 parent 1f1bd87 commit 0113ed7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+13867
-10284
lines changed

CodePush.podspec

+3-3
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ Pod::Spec.new do |s|
1010
s.license = package['license']
1111
s.homepage = package['homepage']
1212
s.source = { :git => 'https://github.com/microsoft/react-native-code-push.git', :tag => "v#{s.version}"}
13-
s.ios.deployment_target = '9.0'
14-
s.tvos.deployment_target = '9.0'
13+
s.ios.deployment_target = '15.5'
14+
s.tvos.deployment_target = '15.5'
1515
s.preserve_paths = '*.js'
1616
s.library = 'z'
1717
s.source_files = 'ios/CodePush/*.{h,m}'
@@ -21,7 +21,7 @@ Pod::Spec.new do |s|
2121
# we explicitly let CocoaPods pull in the versions below so all dependencies are resolved and
2222
# linked properly at a parent workspace level.
2323
s.dependency 'React-Core'
24-
s.dependency 'SSZipArchive', '~> 2.2.2'
24+
s.dependency 'SSZipArchive', '~> 2.5.5'
2525
s.dependency 'JWT', '~> 3.0.0-beta.12'
2626
s.dependency 'Base64', '~> 1.1'
2727
end

ios/CodePush.xcodeproj/project.pbxproj

+242-130
Large diffs are not rendered by default.

ios/CodePush/SSZipArchive/Common.h

-81
This file was deleted.

ios/CodePush/SSZipArchive/Info.plist

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>CFBundleDevelopmentRegion</key>
6+
<string>en</string>
7+
<key>CFBundleExecutable</key>
8+
<string>$(EXECUTABLE_NAME)</string>
9+
<key>CFBundleIdentifier</key>
10+
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
11+
<key>CFBundleInfoDictionaryVersion</key>
12+
<string>6.0</string>
13+
<key>CFBundleName</key>
14+
<string>$(PRODUCT_NAME)</string>
15+
<key>CFBundlePackageType</key>
16+
<string>FMWK</string>
17+
<key>CFBundleShortVersionString</key>
18+
<string>1.0</string>
19+
<key>CFBundleSignature</key>
20+
<string>????</string>
21+
<key>CFBundleVersion</key>
22+
<string>$(CURRENT_PROJECT_VERSION)</string>
23+
<key>NSPrincipalClass</key>
24+
<string></string>
25+
</dict>
26+
</plist>

ios/CodePush/SSZipArchive/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
The source code in this folder is taken from [https://github.com/ZipArchive/ZipArchive/tree/35fe9b6af48527cde0b5db52287474ed3a32d75f/SSZipArchive](https://github.com/ZipArchive/ZipArchive/tree/35fe9b6af48527cde0b5db52287474ed3a32d75f/SSZipArchive) which is [MIT licensed](https://github.com/ZipArchive/ZipArchive/blob/35fe9b6af48527cde0b5db52287474ed3a32d75f/LICENSE.txt).
1+
The source code in this folder is taken from [https://github.com/ZipArchive/ZipArchive/tree/2.5.5/SSZipArchive](https://github.com/ZipArchive/ZipArchive/tree/2.5.5/SSZipArchive) which is [MIT licensed](https://github.com/ZipArchive/ZipArchive/blob/2.5.5/LICENSE.txt).

ios/CodePush/SSZipArchive/SSZipArchive.h

+129-27
Original file line numberDiff line numberDiff line change
@@ -3,56 +3,157 @@
33
// SSZipArchive
44
//
55
// Created by Sam Soffes on 7/21/10.
6-
// Copyright (c) Sam Soffes 2010-2015. All rights reserved.
76
//
87

98
#ifndef _SSZIPARCHIVE_H
109
#define _SSZIPARCHIVE_H
1110

1211
#import <Foundation/Foundation.h>
13-
#include "Common.h"
12+
13+
#import "SSZipCommon.h"
14+
15+
NS_ASSUME_NONNULL_BEGIN
16+
17+
extern NSString *const SSZipArchiveErrorDomain;
18+
typedef NS_ENUM(NSInteger, SSZipArchiveErrorCode) {
19+
SSZipArchiveErrorCodeFailedOpenZipFile = -1,
20+
SSZipArchiveErrorCodeFailedOpenFileInZip = -2,
21+
SSZipArchiveErrorCodeFileInfoNotLoadable = -3,
22+
SSZipArchiveErrorCodeFileContentNotReadable = -4,
23+
SSZipArchiveErrorCodeFailedToWriteFile = -5,
24+
SSZipArchiveErrorCodeInvalidArguments = -6,
25+
SSZipArchiveErrorCodeSymlinkEscapesTargetDirectory = -7,
26+
};
1427

1528
@protocol SSZipArchiveDelegate;
1629

1730
@interface SSZipArchive : NSObject
1831

32+
// Password check
33+
+ (BOOL)isFilePasswordProtectedAtPath:(NSString *)path;
34+
+ (BOOL)isPasswordValidForArchiveAtPath:(NSString *)path password:(NSString *)pw error:(NSError * _Nullable * _Nullable)error NS_SWIFT_NOTHROW;
35+
36+
// Total payload size
37+
+ (NSNumber *)payloadSizeForArchiveAtPath:(NSString *)path error:(NSError **)error;
38+
1939
// Unzip
2040
+ (BOOL)unzipFileAtPath:(NSString *)path toDestination:(NSString *)destination;
21-
+ (BOOL)unzipFileAtPath:(NSString *)path toDestination:(NSString *)destination delegate:(id<SSZipArchiveDelegate>)delegate;
41+
+ (BOOL)unzipFileAtPath:(NSString *)path toDestination:(NSString *)destination delegate:(nullable id<SSZipArchiveDelegate>)delegate;
42+
43+
+ (BOOL)unzipFileAtPath:(NSString *)path
44+
toDestination:(NSString *)destination
45+
overwrite:(BOOL)overwrite
46+
password:(nullable NSString *)password
47+
error:(NSError * *)error;
48+
49+
+ (BOOL)unzipFileAtPath:(NSString *)path
50+
toDestination:(NSString *)destination
51+
overwrite:(BOOL)overwrite
52+
password:(nullable NSString *)password
53+
error:(NSError * *)error
54+
delegate:(nullable id<SSZipArchiveDelegate>)delegate NS_REFINED_FOR_SWIFT;
55+
56+
+ (BOOL)unzipFileAtPath:(NSString *)path
57+
toDestination:(NSString *)destination
58+
preserveAttributes:(BOOL)preserveAttributes
59+
overwrite:(BOOL)overwrite
60+
password:(nullable NSString *)password
61+
error:(NSError * *)error
62+
delegate:(nullable id<SSZipArchiveDelegate>)delegate;
63+
64+
+ (BOOL)unzipFileAtPath:(NSString *)path
65+
toDestination:(NSString *)destination
66+
progressHandler:(void (^_Nullable)(NSString *entry, unz_file_info zipInfo, long entryNumber, long total))progressHandler
67+
completionHandler:(void (^_Nullable)(NSString *path, BOOL succeeded, NSError * _Nullable error))completionHandler;
2268

23-
+ (BOOL)unzipFileAtPath:(NSString *)path toDestination:(NSString *)destination overwrite:(BOOL)overwrite password:(NSString *)password error:(NSError * *)error;
24-
+ (BOOL)unzipFileAtPath:(NSString *)path toDestination:(NSString *)destination overwrite:(BOOL)overwrite password:(NSString *)password error:(NSError * *)error delegate:(id<SSZipArchiveDelegate>)delegate;
69+
+ (BOOL)unzipFileAtPath:(NSString *)path
70+
toDestination:(NSString *)destination
71+
overwrite:(BOOL)overwrite
72+
password:(nullable NSString *)password
73+
progressHandler:(void (^_Nullable)(NSString *entry, unz_file_info zipInfo, long entryNumber, long total))progressHandler
74+
completionHandler:(void (^_Nullable)(NSString *path, BOOL succeeded, NSError * _Nullable error))completionHandler;
2575

2676
+ (BOOL)unzipFileAtPath:(NSString *)path
27-
toDestination:(NSString *)destination
28-
progressHandler:(void (^)(NSString *entry, unz_file_info zipInfo, long entryNumber, long total))progressHandler
29-
completionHandler:(void (^)(NSString *path, BOOL succeeded, NSError *error))completionHandler;
77+
toDestination:(NSString *)destination
78+
preserveAttributes:(BOOL)preserveAttributes
79+
overwrite:(BOOL)overwrite
80+
nestedZipLevel:(NSInteger)nestedZipLevel
81+
password:(nullable NSString *)password
82+
error:(NSError **)error
83+
delegate:(nullable id<SSZipArchiveDelegate>)delegate
84+
progressHandler:(void (^_Nullable)(NSString *entry, unz_file_info zipInfo, long entryNumber, long total))progressHandler
85+
completionHandler:(void (^_Nullable)(NSString *path, BOOL succeeded, NSError * _Nullable error))completionHandler;
3086

3187
+ (BOOL)unzipFileAtPath:(NSString *)path
32-
toDestination:(NSString *)destination
33-
overwrite:(BOOL)overwrite
34-
password:(NSString *)password
35-
progressHandler:(void (^)(NSString *entry, unz_file_info zipInfo, long entryNumber, long total))progressHandler
36-
completionHandler:(void (^)(NSString *path, BOOL succeeded, NSError *error))completionHandler;
88+
toDestination:(NSString *)destination
89+
preserveAttributes:(BOOL)preserveAttributes
90+
overwrite:(BOOL)overwrite
91+
symlinksValidWithin:(nullable NSString *)symlinksValidWithin
92+
nestedZipLevel:(NSInteger)nestedZipLevel
93+
password:(nullable NSString *)password
94+
error:(NSError **)error
95+
delegate:(nullable id<SSZipArchiveDelegate>)delegate
96+
progressHandler:(void (^_Nullable)(NSString *entry, unz_file_info zipInfo, long entryNumber, long total))progressHandler
97+
completionHandler:(void (^_Nullable)(NSString *path, BOOL succeeded, NSError * _Nullable error))completionHandler;
3798

3899
// Zip
100+
// default compression level is Z_DEFAULT_COMPRESSION (from "zlib.h")
101+
// keepParentDirectory: if YES, then unzipping will give `directoryName/fileName`. If NO, then unzipping will just give `fileName`. Default is NO.
39102

40103
// without password
41-
+ (BOOL)createZipFileAtPath:(NSString *)path withFilesAtPaths:(NSArray *)paths;
104+
+ (BOOL)createZipFileAtPath:(NSString *)path withFilesAtPaths:(NSArray<NSString *> *)paths;
42105
+ (BOOL)createZipFileAtPath:(NSString *)path withContentsOfDirectory:(NSString *)directoryPath;
43-
+ (BOOL)createZipFileAtPath:(NSString *)path withContentsOfDirectory:(NSString *)directoryPath keepParentDirectory:(BOOL)keepParentDirector;
44106

45-
// with password, password could be nil
46-
+ (BOOL)createZipFileAtPath:(NSString *)path withFilesAtPaths:(NSArray *)paths withPassword:(NSString *)password;
47-
+ (BOOL)createZipFileAtPath:(NSString *)path withContentsOfDirectory:(NSString *)directoryPath withPassword:(NSString *)password;
48-
+ (BOOL)createZipFileAtPath:(NSString *)path withContentsOfDirectory:(NSString *)directoryPath keepParentDirectory:(BOOL)keepParentDirectory withPassword:(NSString *)password;
49-
50-
- (instancetype)initWithPath:(NSString *)path;
51-
@property (NS_NONATOMIC_IOSONLY, readonly, getter = isOpen) BOOL open;
52-
- (BOOL)writeFile:(NSString *)path withPassword:(NSString *)password;
53-
- (BOOL)writeFileAtPath:(NSString *)path withFileName:(NSString *)fileName withPassword:(NSString *)password;
54-
- (BOOL)writeData:(NSData *)data filename:(NSString *)filename withPassword:(NSString *)password;
55-
@property (NS_NONATOMIC_IOSONLY, readonly, getter = isClosed) BOOL close;
107+
+ (BOOL)createZipFileAtPath:(NSString *)path withContentsOfDirectory:(NSString *)directoryPath keepParentDirectory:(BOOL)keepParentDirectory;
108+
109+
// with optional password, default encryption is AES
110+
// don't use AES if you need compatibility with native macOS unzip and Archive Utility
111+
+ (BOOL)createZipFileAtPath:(NSString *)path withFilesAtPaths:(NSArray<NSString *> *)paths withPassword:(nullable NSString *)password;
112+
+ (BOOL)createZipFileAtPath:(NSString *)path withFilesAtPaths:(NSArray<NSString *> *)paths withPassword:(nullable NSString *)password progressHandler:(void(^ _Nullable)(NSUInteger entryNumber, NSUInteger total))progressHandler;
113+
+ (BOOL)createZipFileAtPath:(NSString *)path withContentsOfDirectory:(NSString *)directoryPath withPassword:(nullable NSString *)password;
114+
+ (BOOL)createZipFileAtPath:(NSString *)path withContentsOfDirectory:(NSString *)directoryPath keepParentDirectory:(BOOL)keepParentDirectory withPassword:(nullable NSString *)password;
115+
+ (BOOL)createZipFileAtPath:(NSString *)path
116+
withContentsOfDirectory:(NSString *)directoryPath
117+
keepParentDirectory:(BOOL)keepParentDirectory
118+
withPassword:(nullable NSString *)password
119+
andProgressHandler:(void(^ _Nullable)(NSUInteger entryNumber, NSUInteger total))progressHandler;
120+
+ (BOOL)createZipFileAtPath:(NSString *)path
121+
withContentsOfDirectory:(NSString *)directoryPath
122+
keepParentDirectory:(BOOL)keepParentDirectory
123+
compressionLevel:(int)compressionLevel
124+
password:(nullable NSString *)password
125+
AES:(BOOL)aes
126+
progressHandler:(void(^ _Nullable)(NSUInteger entryNumber, NSUInteger total))progressHandler;
127+
//suport symlink compress --file
128+
+ (BOOL)createZipFileAtPath:(NSString *)path withFilesAtPaths:(NSArray<NSString *> *)paths withPassword:(nullable NSString *)password keepSymlinks:(BOOL)keeplinks;
129+
//suport symlink compress --directory
130+
+ (BOOL)createZipFileAtPath:(NSString *)path
131+
withContentsOfDirectory:(NSString *)directoryPath
132+
keepParentDirectory:(BOOL)keepParentDirectory
133+
compressionLevel:(int)compressionLevel
134+
password:(nullable NSString *)password
135+
AES:(BOOL)aes
136+
progressHandler:(void(^ _Nullable)(NSUInteger entryNumber, NSUInteger total))progressHandler
137+
keepSymlinks:(BOOL)keeplinks;
138+
139+
- (instancetype)init NS_UNAVAILABLE;
140+
- (instancetype)initWithPath:(NSString *)path NS_DESIGNATED_INITIALIZER;
141+
- (BOOL)open;
142+
- (BOOL)openForAppending;
143+
144+
/// write empty folder
145+
- (BOOL)writeFolderAtPath:(NSString *)path withFolderName:(NSString *)folderName withPassword:(nullable NSString *)password;
146+
/// write file
147+
- (BOOL)writeFile:(NSString *)path withPassword:(nullable NSString *)password;
148+
- (BOOL)writeFileAtPath:(NSString *)path withFileName:(nullable NSString *)fileName withPassword:(nullable NSString *)password;
149+
- (BOOL)writeFileAtPath:(NSString *)path withFileName:(nullable NSString *)fileName compressionLevel:(int)compressionLevel password:(nullable NSString *)password AES:(BOOL)aes;
150+
///write symlink files
151+
- (BOOL)writeSymlinkFileAtPath:(NSString *)path withFileName:(nullable NSString *)fileName compressionLevel:(int)compressionLevel password:(nullable NSString *)password AES:(BOOL)aes;
152+
/// write data
153+
- (BOOL)writeData:(NSData *)data filename:(nullable NSString *)filename withPassword:(nullable NSString *)password;
154+
- (BOOL)writeData:(NSData *)data filename:(nullable NSString *)filename compressionLevel:(int)compressionLevel password:(nullable NSString *)password AES:(BOOL)aes;
155+
156+
- (BOOL)close;
56157

57158
@end
58159

@@ -69,8 +170,9 @@
69170
- (void)zipArchiveDidUnzipFileAtIndex:(NSInteger)fileIndex totalFiles:(NSInteger)totalFiles archivePath:(NSString *)archivePath unzippedFilePath:(NSString *)unzippedFilePath;
70171

71172
- (void)zipArchiveProgressEvent:(unsigned long long)loaded total:(unsigned long long)total;
72-
- (void)zipArchiveDidUnzipArchiveFile:(NSString *)zipFile entryPath:(NSString *)entryPath destPath:(NSString *)destPath;
73173

74174
@end
75175

176+
NS_ASSUME_NONNULL_END
177+
76178
#endif /* _SSZIPARCHIVE_H */

0 commit comments

Comments
 (0)