@functionland/react-native-fula 1.54.32 → 1.54.34
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/ios/Fula.swift +25 -6
- package/package.json +1 -1
package/ios/Fula.swift
CHANGED
|
@@ -1222,7 +1222,7 @@ class FulaModule: NSObject {
|
|
|
1222
1222
|
|
|
1223
1223
|
@objc
|
|
1224
1224
|
func deleteDsLock(_ resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
|
|
1225
|
-
let lockFilePath = (fulaConfig
|
|
1225
|
+
let lockFilePath = (fulaConfig!.storePath as NSString).appendingPathComponent("LOCK")
|
|
1226
1226
|
let fileManager = FileManager.default
|
|
1227
1227
|
|
|
1228
1228
|
do {
|
|
@@ -1569,13 +1569,32 @@ class FulaModule: NSObject {
|
|
|
1569
1569
|
|
|
1570
1570
|
@objc(getFolderSize:withResolver:withRejecter:)
|
|
1571
1571
|
func getFolderSize(folderPath: String, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) -> Void {
|
|
1572
|
+
// Validate the folder path
|
|
1573
|
+
guard !folderPath.isEmpty else {
|
|
1574
|
+
reject("ERR_INVALID_PATH", "The folder path is empty.", nil)
|
|
1575
|
+
return
|
|
1576
|
+
}
|
|
1577
|
+
|
|
1572
1578
|
do {
|
|
1573
|
-
|
|
1574
|
-
let
|
|
1575
|
-
|
|
1579
|
+
// Ensure fula is not nil before calling getFolderSize
|
|
1580
|
+
guard let fula = self.fula else {
|
|
1581
|
+
reject("ERR_FULA", "Fula instance is not initialized.", nil)
|
|
1582
|
+
return
|
|
1583
|
+
}
|
|
1584
|
+
|
|
1585
|
+
// Attempt to get the folder size
|
|
1586
|
+
let result = try fula.getFolderSize(folderPath)
|
|
1587
|
+
|
|
1588
|
+
// Convert the result to a UTF-8 string safely
|
|
1589
|
+
if let resultString = result.toUTF8String() {
|
|
1590
|
+
resolve(resultString)
|
|
1591
|
+
} else {
|
|
1592
|
+
reject("ERR_CONVERSION", "Failed to convert result to UTF-8 string.", nil)
|
|
1593
|
+
}
|
|
1576
1594
|
} catch let error {
|
|
1577
|
-
|
|
1578
|
-
|
|
1595
|
+
// Log and reject with detailed error information
|
|
1596
|
+
print("getFolderSize error:", error.localizedDescription)
|
|
1597
|
+
reject("ERR_FULA", "Failed to get folder size: \(error.localizedDescription)", error)
|
|
1579
1598
|
}
|
|
1580
1599
|
}
|
|
1581
1600
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@functionland/react-native-fula",
|
|
3
|
-
"version": "1.54.
|
|
3
|
+
"version": "1.54.34",
|
|
4
4
|
"description": "This package is a bridge to use the Fula libp2p protocols in the react-native which is using wnfs",
|
|
5
5
|
"main": "lib/commonjs/index",
|
|
6
6
|
"module": "lib/module/index",
|