@capgo/capacitor-updater 5.3.45 → 5.3.48
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/android/src/main/java/ee/forgr/capacitor_updater/CapacitorUpdater.java +2 -1
- package/android/src/main/java/ee/forgr/capacitor_updater/CapacitorUpdaterPlugin.java +1 -1
- package/ios/Plugin/CapacitorUpdater.swift +20 -2
- package/ios/Plugin/CapacitorUpdaterPlugin.swift +1 -1
- package/package.json +1 -1
|
@@ -488,9 +488,10 @@ public class CapacitorUpdater {
|
|
|
488
488
|
}
|
|
489
489
|
|
|
490
490
|
private String getChecksum(File file) throws IOException {
|
|
491
|
+
final int BUFFER_SIZE = 1024 * 1024 * 5; // 5 MB buffer size
|
|
491
492
|
CRC32 crc = new CRC32();
|
|
492
493
|
try (FileInputStream fis = new FileInputStream(file)) {
|
|
493
|
-
byte[] buffer = new byte[
|
|
494
|
+
byte[] buffer = new byte[BUFFER_SIZE];
|
|
494
495
|
int length;
|
|
495
496
|
while ((length = fis.read(buffer)) != -1) {
|
|
496
497
|
crc.update(buffer, 0, length);
|
|
@@ -55,7 +55,7 @@ public class CapacitorUpdaterPlugin extends Plugin {
|
|
|
55
55
|
private static final String channelUrlDefault =
|
|
56
56
|
"https://api.capgo.app/channel_self";
|
|
57
57
|
|
|
58
|
-
private final String PLUGIN_VERSION = "5.3.
|
|
58
|
+
private final String PLUGIN_VERSION = "5.3.48";
|
|
59
59
|
private static final String DELAY_CONDITION_PREFERENCES = "";
|
|
60
60
|
|
|
61
61
|
private SharedPreferences.Editor editor;
|
|
@@ -332,9 +332,27 @@ extension CustomError: LocalizedError {
|
|
|
332
332
|
}
|
|
333
333
|
|
|
334
334
|
private func getChecksum(filePath: URL) -> String {
|
|
335
|
+
let bufferSize = 1024 * 1024 * 5 // 5 MB
|
|
336
|
+
var checksum = uLong(0)
|
|
337
|
+
|
|
335
338
|
do {
|
|
336
|
-
let
|
|
337
|
-
|
|
339
|
+
let fileHandle = try FileHandle(forReadingFrom: filePath)
|
|
340
|
+
defer {
|
|
341
|
+
fileHandle.closeFile()
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
while autoreleasepool(invoking: {
|
|
345
|
+
let fileData = fileHandle.readData(ofLength: bufferSize)
|
|
346
|
+
if fileData.count > 0 {
|
|
347
|
+
checksum = fileData.withUnsafeBytes {
|
|
348
|
+
crc32(checksum, $0.bindMemory(to: Bytef.self).baseAddress, uInt(fileData.count))
|
|
349
|
+
}
|
|
350
|
+
return true // Continue
|
|
351
|
+
} else {
|
|
352
|
+
return false // End of file
|
|
353
|
+
}
|
|
354
|
+
}) {}
|
|
355
|
+
|
|
338
356
|
return String(format: "%08X", checksum).lowercased()
|
|
339
357
|
} catch {
|
|
340
358
|
print("\(self.TAG) Cannot get checksum: \(filePath.path)", error)
|
|
@@ -15,7 +15,7 @@ import Version
|
|
|
15
15
|
@objc(CapacitorUpdaterPlugin)
|
|
16
16
|
public class CapacitorUpdaterPlugin: CAPPlugin {
|
|
17
17
|
public var implementation = CapacitorUpdater()
|
|
18
|
-
private let PLUGIN_VERSION: String = "5.3.
|
|
18
|
+
private let PLUGIN_VERSION: String = "5.3.48"
|
|
19
19
|
static let updateUrlDefault = "https://api.capgo.app/updates"
|
|
20
20
|
static let statsUrlDefault = "https://api.capgo.app/stats"
|
|
21
21
|
static let channelUrlDefault = "https://api.capgo.app/channel_self"
|