@hot-updater/react-native 0.29.4 → 0.29.5
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.
|
@@ -7,7 +7,6 @@
|
|
|
7
7
|
#import "React/RCTConstants.h"
|
|
8
8
|
#import "React/RCTRootView.h"
|
|
9
9
|
#import "React/RCTUtils.h" // Needed for RCTPromiseResolveBlock/RejectBlock in Swift
|
|
10
|
-
#import <SSZipArchive/SSZipArchive.h>
|
|
11
10
|
|
|
12
11
|
@interface HotUpdaterRecoverySignalBridge : NSObject
|
|
13
12
|
+ (void)installSignalHandlers:(NSString *)crashMarkerPath;
|
|
@@ -249,6 +249,7 @@ enum ZipArchiveExtractor {
|
|
|
249
249
|
extractionResult = try extractDeflatedEntry(
|
|
250
250
|
from: handle,
|
|
251
251
|
compressedSize: entry.compressedSize,
|
|
252
|
+
path: entry.path,
|
|
252
253
|
to: outputHandle
|
|
253
254
|
)
|
|
254
255
|
default:
|
|
@@ -300,6 +301,7 @@ enum ZipArchiveExtractor {
|
|
|
300
301
|
private static func extractDeflatedEntry(
|
|
301
302
|
from handle: FileHandle,
|
|
302
303
|
compressedSize: UInt64,
|
|
304
|
+
path: String,
|
|
303
305
|
to outputHandle: FileHandle
|
|
304
306
|
) throws -> (writtenSize: UInt64, checksum: UInt32) {
|
|
305
307
|
let outputBuffer = UnsafeMutablePointer<UInt8>.allocate(capacity: ArchiveExtractionUtilities.bufferSize)
|
|
@@ -345,22 +347,23 @@ enum ZipArchiveExtractor {
|
|
|
345
347
|
|
|
346
348
|
stream.next_in = UnsafeMutablePointer(mutating: baseAddress)
|
|
347
349
|
stream.avail_in = uInt(chunk.count)
|
|
350
|
+
var needsMoreInput = false
|
|
348
351
|
|
|
349
352
|
repeat {
|
|
350
353
|
stream.next_out = outputBuffer
|
|
351
354
|
stream.avail_out = uInt(ArchiveExtractionUtilities.bufferSize)
|
|
352
355
|
|
|
353
356
|
let status = inflate(&stream, Z_NO_FLUSH)
|
|
357
|
+
let producedBytes = ArchiveExtractionUtilities.bufferSize - Int(stream.avail_out)
|
|
358
|
+
if producedBytes > 0 {
|
|
359
|
+
let outputData = Data(bytes: outputBuffer, count: producedBytes)
|
|
360
|
+
outputHandle.write(outputData)
|
|
361
|
+
totalWritten += UInt64(producedBytes)
|
|
362
|
+
checksum = updateCRC32(checksum, with: outputData)
|
|
363
|
+
}
|
|
364
|
+
|
|
354
365
|
switch status {
|
|
355
366
|
case Z_OK, Z_STREAM_END:
|
|
356
|
-
let producedBytes = ArchiveExtractionUtilities.bufferSize - Int(stream.avail_out)
|
|
357
|
-
if producedBytes > 0 {
|
|
358
|
-
let outputData = Data(bytes: outputBuffer, count: producedBytes)
|
|
359
|
-
outputHandle.write(outputData)
|
|
360
|
-
totalWritten += UInt64(producedBytes)
|
|
361
|
-
checksum = updateCRC32(checksum, with: outputData)
|
|
362
|
-
}
|
|
363
|
-
|
|
364
367
|
if status == Z_STREAM_END {
|
|
365
368
|
guard stream.avail_in == 0, remainingBytes == 0 else {
|
|
366
369
|
throw NSError(
|
|
@@ -372,16 +375,33 @@ enum ZipArchiveExtractor {
|
|
|
372
375
|
|
|
373
376
|
reachedStreamEnd = true
|
|
374
377
|
}
|
|
378
|
+
case Z_BUF_ERROR:
|
|
379
|
+
guard stream.avail_in == 0, remainingBytes > 0 else {
|
|
380
|
+
let message = stream.msg.map { String(cString: $0) } ?? "Unknown zlib error"
|
|
381
|
+
throw NSError(
|
|
382
|
+
domain: "ZipArchiveExtractor",
|
|
383
|
+
code: 13,
|
|
384
|
+
userInfo: [
|
|
385
|
+
NSLocalizedDescriptionKey:
|
|
386
|
+
"ZIP deflate failed for \(path): status=\(status) totalIn=\(stream.total_in) totalOut=\(stream.total_out) \(message)"
|
|
387
|
+
]
|
|
388
|
+
)
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
needsMoreInput = true
|
|
375
392
|
|
|
376
393
|
default:
|
|
377
394
|
let message = stream.msg.map { String(cString: $0) } ?? "Unknown zlib error"
|
|
378
395
|
throw NSError(
|
|
379
396
|
domain: "ZipArchiveExtractor",
|
|
380
397
|
code: 13,
|
|
381
|
-
userInfo: [
|
|
398
|
+
userInfo: [
|
|
399
|
+
NSLocalizedDescriptionKey:
|
|
400
|
+
"ZIP deflate failed for \(path): status=\(status) totalIn=\(stream.total_in) totalOut=\(stream.total_out) \(message)"
|
|
401
|
+
]
|
|
382
402
|
)
|
|
383
403
|
}
|
|
384
|
-
} while stream.avail_in > 0 || stream.avail_out == 0
|
|
404
|
+
} while (stream.avail_in > 0 || stream.avail_out == 0) && !needsMoreInput && !reachedStreamEnd
|
|
385
405
|
}
|
|
386
406
|
|
|
387
407
|
if reachedStreamEnd {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hot-updater/react-native",
|
|
3
|
-
"version": "0.29.
|
|
3
|
+
"version": "0.29.5",
|
|
4
4
|
"description": "React Native OTA solution for self-hosted",
|
|
5
5
|
"main": "lib/commonjs/index",
|
|
6
6
|
"module": "lib/module/index",
|
|
@@ -120,14 +120,14 @@
|
|
|
120
120
|
"react-native": "0.79.1",
|
|
121
121
|
"react-native-builder-bob": "^0.40.10",
|
|
122
122
|
"typescript": "^6.0.2",
|
|
123
|
-
"hot-updater": "0.29.
|
|
123
|
+
"hot-updater": "0.29.5"
|
|
124
124
|
},
|
|
125
125
|
"dependencies": {
|
|
126
126
|
"use-sync-external-store": "1.5.0",
|
|
127
|
-
"@hot-updater/
|
|
128
|
-
"@hot-updater/
|
|
129
|
-
"@hot-updater/plugin-core": "0.29.
|
|
130
|
-
"@hot-updater/core": "0.29.
|
|
127
|
+
"@hot-updater/cli-tools": "0.29.5",
|
|
128
|
+
"@hot-updater/js": "0.29.5",
|
|
129
|
+
"@hot-updater/plugin-core": "0.29.5",
|
|
130
|
+
"@hot-updater/core": "0.29.5"
|
|
131
131
|
},
|
|
132
132
|
"scripts": {
|
|
133
133
|
"build": "bob build && tsc -p plugin/tsconfig.build.json",
|