Skip to content

Commit c3172db

Browse files
committed
!!!!
1 parent 37b1fb3 commit c3172db

File tree

7 files changed

+20
-22
lines changed

7 files changed

+20
-22
lines changed

android/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ buildscript {
77
}
88

99
dependencies {
10-
classpath 'com.android.tools.build:gradle:7.0.4'
10+
classpath 'com.android.tools.build:gradle:7.3.0'
1111
}
1212
}
1313
}
@@ -64,6 +64,6 @@ dependencies {
6464
//noinspection GradleDynamicVersion
6565
implementation "com.facebook.react:react-native:+" // From node_modules
6666
implementation 'com.github.functionland:fula-build-aar:v0.7.3' // From jitpack.io
67-
implementation 'com.github.functionland:wnfs-build-aar:v1.2.7' // From jitpack.io
67+
implementation 'com.github.functionland:wnfs-build-aar:v1.2.9' // From jitpack.io
6868
// implementation files('mobile.aar')
6969
}

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

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,14 @@
2525

2626
@ReactModule(name = FulaModule.NAME)
2727
public class FulaModule extends ReactContextBaseJavaModule {
28+
29+
30+
@Override
31+
public void initialize() {
32+
System.loadLibrary("wnfslib");
33+
}
34+
35+
2836
public static final String NAME = "FulaModule";
2937
fulamobile.Client fula;
3038
Client client;
@@ -47,21 +55,26 @@ public class Client implements land.fx.wnfslib.Datastore {
4755
@Override
4856
public byte[] get(@NonNull byte[] cid) {
4957
try {
50-
internalClient.get(cid);
58+
Log.d("ReactNative", Arrays.toString(cid));
59+
return internalClient.get(cid);
5160
} catch (Exception e) {
5261
e.printStackTrace();
5362
}
63+
Log.d("ReactNative","Error get");
5464
return cid;
5565
}
5666

5767
@NonNull
5868
@Override
5969
public byte[] put(@NonNull byte[] data, long codec) {
6070
try {
71+
//Log.d("ReactNative", "data="+ Arrays.toString(data) +" ;codec="+codec);
6172
return client.put(data, codec);
6273
} catch (Exception e) {
74+
Log.d("ReactNative", "put Error="+e.getMessage());
6375
e.printStackTrace();
6476
}
77+
Log.d("ReactNative","Error put");
6578
return data;
6679
}
6780
}

example/android/app/src/debug/AndroidManifest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@
44

55
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
66

7-
<application android:usesCleartextTraffic="true" tools:targetApi="28" tools:ignore="GoogleAppIndexingWarning" />
7+
<application android:usesCleartextTraffic="true" tools:targetApi="31" tools:ignore="GoogleAppIndexingWarning" />
88
</manifest>

example/android/app/src/main/AndroidManifest.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
android:theme="@style/AppTheme">
1414
<activity
1515
android:name=".MainActivity"
16-
android:label="@string/app_name"
1716
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
1817
android:launchMode="singleTask"
1918
android:exported="true"

example/android/app/src/main/java/com/example/reactnativefula/MainApplication.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ public boolean getUseDeveloperSupport() {
2323

2424
@Override
2525
protected List<ReactPackage> getPackages() {
26-
@SuppressWarnings("UnnecessaryLocalVariable")
2726
List<ReactPackage> packages = new PackageList(this).getPackages();
2827
// Packages that cannot be autolinked yet can be added manually here, for FulaExample:
2928
// packages.add(new MyReactNativePackage());
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
<resources>
2-
<string name="app_name">Fula Example</string>
2+
<string name="app_name">FulaExample</string>
33
</resources>

example/src/App.tsx

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const App = () => {
2323
let f = await fula.init(
2424
privateKey.toString(),
2525
'',
26-
'/ip4/59.23.13.76/tcp/46640/p2p/QmRS9H18XHFrbmGKxi2TEBFz5ZzurkU9cbAwMsRzXcjr5X',
26+
'',
2727
'noop'
2828
);
2929
console.log('initialization result', f);
@@ -53,23 +53,10 @@ const App = () => {
5353
title={inprogress ? 'Putting & Getting...' : 'Test'}
5454
onPress={async () => {
5555
try {
56-
/*const jsonvalue = { hello: 'world' };
57-
const cid =
58-
'bagaaierasords4njcts6vs7qvdjfcvgnume4hqohf65zsfguprqphs3icwea';*/
59-
const ciduint8 = [
60-
1, 112, 18, 32, 195, 196, 115, 62, 200, 175, 253, 6, 207, 158,
61-
159, 245, 15, 252, 107, 205, 46, 200, 90, 97, 112, 0, 75, 183,
62-
9, 102, 156, 49, 222, 148, 57, 26,
63-
];
6456

6557
if (initComplete) {
6658
console.log('initialization is completed. putting key/value');
67-
const res = await fula.put(ciduint8.toString(), '');
68-
console.log(res);
69-
console.log('Now fetching key...');
70-
const res2 = await fula.get(ciduint8.toString());
71-
console.log(JSON.parse(res2));
72-
//setBS64(_bs64)
59+
7360
} else {
7461
console.log('wait for init to complete');
7562
}

0 commit comments

Comments
 (0)