Skip to content

Commit 52d9b0b

Browse files
committed
added more logging around rootCid
1 parent aec16af commit 52d9b0b

File tree

2 files changed

+14
-8
lines changed

2 files changed

+14
-8
lines changed

android/src/main/java/land/fx/fula/FulaModule.java

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -712,7 +712,7 @@ private String[] initInternal(byte[] identity, String storePath, String bloxAddr
712712
this.createNewRootConfig(this.client, identity);
713713
}
714714
} else {
715-
Log.d("ReactNative", "Recovered cid and private ref from keychain store. cid="+cid);
715+
Log.d("ReactNative", "Recovered cid and private ref from keychain store. cid="+cid +" and cid from input was: "+rootCid);
716716
this.rootConfig = new land.fx.wnfslib.Config(cid);
717717
this.reloadFS(this.client, identity, cid);
718718
this.encrypt_and_store_config();
@@ -742,7 +742,7 @@ private String[] initInternal(byte[] identity, String storePath, String bloxAddr
742742
@ReactMethod
743743
public void mkdir(String path, Promise promise) {
744744
ThreadUtils.runOnExecutor(() -> {
745-
Log.d("ReactNative", "mkdir: path = " + path);
745+
Log.d("ReactNative", "mkdir started with: path = " + path + " rootConfig.getCid() = " + this.rootConfig.getCid());
746746
try {
747747
land.fx.wnfslib.Config config = Fs.mkdir(this.client, this.rootConfig.getCid(), path);
748748
if(config != null) {
@@ -751,7 +751,9 @@ public void mkdir(String path, Promise promise) {
751751
if (this.fula != null) {
752752
this.fula.flush();
753753
}
754-
promise.resolve(config.getCid());
754+
String rootCid = this.rootConfig.getCid();
755+
Log.d("ReactNative", "mkdir completed successfully with rootCid = " + rootCid);
756+
promise.resolve(rootCid);
755757
} else {
756758
Log.d("ReactNative", "mkdir Error: config is null");
757759
promise.reject(new Exception("mkdir Error: config is null"));
@@ -783,7 +785,9 @@ public void writeFile(String fulaTargetFilename, String localFilename, Promise p
783785
this.encrypt_and_store_config();
784786
if (this.fula != null) {
785787
this.fula.flush();
786-
promise.resolve(config.getCid());
788+
String rootCid = this.rootConfig.getCid();
789+
Log.d("ReactNative", "writeFileFromPath completed: this.rootConfig.getCid=" + rootCid);
790+
promise.resolve(rootCid);
787791
} else {
788792
Log.d("ReactNative", "writeFile Error: fula is null");
789793
promise.reject(new Exception("writeFile Error: fula is null"));
@@ -844,7 +848,7 @@ public void ls(String path, Promise promise) {
844848
@ReactMethod
845849
public void rm(String path, Promise promise) {
846850
ThreadUtils.runOnExecutor(() -> {
847-
Log.d("ReactNative", "rm: path = " + path);
851+
Log.d("ReactNative", "rm: path = " + path + ", beginning rootCid=" + this.rootConfig.getCid());
848852
try {
849853
land.fx.wnfslib.Config config = Fs.rm(this.client, this.rootConfig.getCid(), path);
850854
if(config != null) {
@@ -853,7 +857,9 @@ public void rm(String path, Promise promise) {
853857
if (this.fula != null) {
854858
this.fula.flush();
855859
}
856-
promise.resolve(config.getCid());
860+
String rootCid = config.getCid();
861+
Log.d("ReactNative", "rm: returned rootCid = " + rootCid);
862+
promise.resolve(rootCid);
857863
} else {
858864
Log.d("ReactNative", "rm Error: config is null");
859865
promise.reject(new Exception("rm Error: config is null"));
@@ -925,7 +931,7 @@ public void readFile(String fulaTargetFilename, String localFilename, Promise pr
925931
ThreadUtils.runOnExecutor(() -> {
926932
Log.d("ReactNative", "readFile: fulaTargetFilename = " + fulaTargetFilename);
927933
try {
928-
Log.d("ReactNative", "readFile: localFilename = " + localFilename + " fulaTargetFilename = " + fulaTargetFilename + " cid = " + this.rootConfig.getCid() + " client = " + this.client);
934+
Log.d("ReactNative", "readFile: localFilename = " + localFilename + " fulaTargetFilename = " + fulaTargetFilename + " beginning rootCid = " + this.rootConfig.getCid());
929935
String path = Fs.readFilestreamToPath(this.client, this.rootConfig.getCid(), fulaTargetFilename, localFilename);
930936
promise.resolve(path);
931937
} catch (Exception e) {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@functionland/react-native-fula",
3-
"version": "1.14.0",
3+
"version": "1.14.1",
44
"description": "This package is a bridge to use the Fula libp2p protocols in the react-native which is using wnfs",
55
"main": "lib/commonjs/index",
66
"module": "lib/module/index",

0 commit comments

Comments
 (0)