diff --git a/android/build.gradle b/android/build.gradle index 022ba41..639f716 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -94,7 +94,7 @@ dependencies { // For > 0.71, this will be replaced by `com.facebook.react:react-android:$version` by react gradle plugin //noinspection GradleDynamicVersion implementation "com.facebook.react:react-native:+" - implementation 'com.github.functionland:fula-build-aar:v1.20.0' // From jitpack.io + implementation 'com.github.functionland:fula-build-aar:v1.29.0' // From jitpack.io implementation 'com.github.functionland:wnfs-android:v1.8.1' // From jitpack.io implementation 'commons-io:commons-io:20030203.000550' implementation 'commons-codec:commons-codec:1.15' diff --git a/android/src/main/java/land/fx/fula/FulaModule.java b/android/src/main/java/land/fx/fula/FulaModule.java index 4ef09fe..07791f1 100755 --- a/android/src/main/java/land/fx/fula/FulaModule.java +++ b/android/src/main/java/land/fx/fula/FulaModule.java @@ -707,6 +707,9 @@ private String[] initInternal(byte[] identity, String storePath, String bloxAddr if(rootCid != null && !rootCid.isEmpty()){ Log.d("ReactNative", "Re-setting cid from input: "+rootCid); cid = rootCid; + this.rootConfig = new land.fx.wnfslib.Config(cid); + this.reloadFS(this.client, identity, cid); + this.encrypt_and_store_config(); } if(cid == null || cid.isEmpty()) { Log.d("ReactNative", "Tried to recover cid but was not successful. Creating new ones"); diff --git a/example/src/App.tsx b/example/src/App.tsx index ed06e74..bc6b99b 100644 --- a/example/src/App.tsx +++ b/example/src/App.tsx @@ -13,7 +13,9 @@ const App = () => { const [value, setValue] = React.useState(''); const [inprogress, setInprogress] = React.useState(false); const [newRootCid, setNewRootCid] = React.useState(''); - const seed = '0xmd93c00b5v99f99ti871r8r17r2rt66ee277777ge1be6fb47709b691efb0e777'; + const root_cid = 'bafyr4ibz4okarrsr7awv6wrwbnpnwi73rk72cnwgi5unvad5l75lr2zctu'; + const seed = + '0xmd93c00b5v99f99ti871r8r17r2rt66ee277777ge1be6fb47709b691efb0e777'; const [initComplete, setInitComplete] = React.useState< { peerId: string; rootCid: string; private_ref: string } | {} @@ -53,17 +55,22 @@ const App = () => { 153, 106, 217, 201, 106, 9, 66, 33, 214, 195, 255, 234, 178, 244, 203, 112, 62, 91, 140, 55, 179, 10, 208, 210, 177, 111, 61, 46, 73, 148, 14, 62, ]; - const bloxPeerId_tower = - '12D3KooWACVcVsQh18jM9UudRQzeYEjxCJQJgFUaAgs41tayjxC4'; - const bloxPeerId_laptop = - '12D3KooWLGatFxDzMrKd4S6UC4GAtuM4zcFJW8RPuMR9SH7j46A8'; + const bloxPeerId_tower = '12D3KooWACVcVsQh18jM9UudRQzeYEjxCJQJgFUaAgs41tayjxC4'; + const bloxPeerId_laptop = '12D3KooWRTzN7HfmjoUBHokyRZuKdyohVVSGqKBMF24ZC3tGK78Q'; const bloxAddr = '/dns/relay.dev.fx.land/tcp/4001/p2p/12D3KooWDRrBaAfPwsGJivBoUw5fE7ZpDiyfUjqgiURq2DEcL835/p2p-circuit/p2p/' + bloxPeerId_laptop; //const bloxAddr = '/ip4/192.168.2.14/tcp/40001/p2p/' + bloxPeerId_laptop; const initFula = async () => { try { - return fula.init(privateKey_tower.toString(), '', bloxAddr, ''); + return fula.init( + privateKey_tower.toString(), + '', + bloxAddr, + '', + true, + root_cid + ); } catch (e) { console.log(e); return Promise.reject(e); @@ -460,6 +467,56 @@ const App = () => { color={inprogress ? 'green' : 'blue'} /> +