diff --git a/android/build.gradle b/android/build.gradle
index 2434844..20519a3 100644
--- a/android/build.gradle
+++ b/android/build.gradle
@@ -99,7 +99,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-android:+"
- implementation 'com.github.functionland:fula-build-aar:v1.54.14' // From jitpack.io
+ implementation 'com.github.functionland:fula-build-aar:v1.54.15' // 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 c35d208..92044f2 100755
--- a/android/src/main/java/land/fx/fula/FulaModule.java
+++ b/android/src/main/java/land/fx/fula/FulaModule.java
@@ -1832,4 +1832,19 @@ public void getInstallStatus(String pluginName, Promise promise) {
});
}
+ @ReactMethod
+ public void updatePlugin(String pluginName, Promise promise) {
+ ThreadUtils.runOnExecutor(() -> {
+ Log.d("ReactNative", "updatePlugin: pluginName = " + pluginName);
+ try {
+ byte[] result = this.fula.updatePlugin(pluginName);
+ String resultString = toString(result);
+ promise.resolve(resultString);
+ } catch (Exception e) {
+ Log.d("ReactNative", "ERROR:" + e.getMessage());
+ promise.reject(e);
+ }
+ });
+ }
+
}
diff --git a/example/src/App.tsx b/example/src/App.tsx
index 6daba7b..bbddfc7 100644
--- a/example/src/App.tsx
+++ b/example/src/App.tsx
@@ -1,6 +1,7 @@
import React, { useEffect } from 'react';
import { StyleSheet, ScrollView, View, Button } from 'react-native';
import { installPlugin, listPlugins, getInstallOutput, getInstallStatus } from '../../src/protocols/fxblox';
+import { updatePlugin } from '../../.history/src/protocols/fxblox_20241009155857';
import {
fula,
@@ -1232,6 +1233,40 @@ const App = () => {
color={inprogress ? 'green' : 'blue'}
/>
+
+
+
);
};
diff --git a/package.json b/package.json
index 57a4375..4c00e43 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "@functionland/react-native-fula",
- "version": "1.54.23",
+ "version": "1.54.24",
"description": "This package is a bridge to use the Fula libp2p protocols in the react-native which is using wnfs",
"main": "lib/commonjs/index",
"module": "lib/module/index",
diff --git a/src/interfaces/fulaNativeModule.ts b/src/interfaces/fulaNativeModule.ts
index 23b399c..ac69856 100644
--- a/src/interfaces/fulaNativeModule.ts
+++ b/src/interfaces/fulaNativeModule.ts
@@ -144,6 +144,7 @@ interface FulaNativeModule {
showPluginStatus: (pluginName: string, lines: number) => Promise;
getInstallOutput: (pluginName: string, params: string) => Promise;
getInstallStatus: (pluginName: string) => Promise;
+ updatePlugin: (pluginName: string) => Promise;
}
const LINKING_ERROR =
diff --git a/src/protocols/fxblox.ts b/src/protocols/fxblox.ts
index 1e89582..2901da6 100644
--- a/src/protocols/fxblox.ts
+++ b/src/protocols/fxblox.ts
@@ -409,3 +409,35 @@ export const getInstallOutput = (
});
return res;
};
+
+export const updatePlugin = (
+ pluginName: string
+): Promise => {
+ console.log('updatePlugin in react-native started');
+ let res = Fula.updatePlugin(pluginName)
+ .then((res1) => {
+ try {
+ console.log('res1 received');
+ console.log(res1);
+ let jsonRes: BType.UpdatePluginResponse = JSON.parse(res1);
+ if (jsonRes.status) {
+ return jsonRes;
+ } else {
+ console.error('Error updating plugin:', jsonRes.msg);
+ throw jsonRes;
+ }
+ } catch (e) {
+ try {
+ return JSON.parse(res1);
+ } catch (e1) {
+ console.error('Error parsing res in updatePlugin:', e1);
+ throw e1;
+ }
+ }
+ })
+ .catch((err) => {
+ console.error('Error updatePlugin:', err);
+ throw err;
+ });
+ return res;
+};
diff --git a/src/types/fxblox.ts b/src/types/fxblox.ts
index 02b5d6f..8ef96b0 100644
--- a/src/types/fxblox.ts
+++ b/src/types/fxblox.ts
@@ -106,11 +106,16 @@ export interface GetInstallOutputResponse {
msg:
| string
| {
- [key: string]: string;
- };
+ [key: string]: string;
+ };
}
export interface GetInstallStatusResponse {
status: boolean;
msg: string;
}
+
+export interface UpdatePluginResponse {
+ status: boolean;
+ msg: string;
+}