@functionland/react-native-fula 1.1.7 → 1.1.8

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.
@@ -164,6 +164,7 @@ public class FulaModule extends ReactContextBaseJavaModule {
164
164
  if (this.fula != null) {
165
165
  try {
166
166
  boolean connectionStatus = this.checkConnectionInternal(timeout);
167
+ Log.d("ReactNative", "checkConnection ended " + connectionStatus);
167
168
  promise.resolve(connectionStatus);
168
169
  }
169
170
  catch (Exception e) {
@@ -524,6 +525,7 @@ public class FulaModule extends ReactContextBaseJavaModule {
524
525
  }
525
526
  if (this.fula == null || refresh) {
526
527
  Log.d("ReactNative", "Creating a new Fula instance");
528
+ shutdownInternal();
527
529
  this.fula = Fulamobile.newClient(fulaConfig);
528
530
  }
529
531
  if (this.fula != null) {
@@ -1001,20 +1003,23 @@ public class FulaModule extends ReactContextBaseJavaModule {
1001
1003
  });
1002
1004
  }
1003
1005
 
1006
+ private void shutdownInternal() throws Exception {
1007
+ try {
1008
+ if(this.fula != null) {
1009
+ this.fula.shutdown();
1010
+ this.fula = null;
1011
+ this.client = null;
1012
+ }
1013
+ } catch (Exception e) {
1014
+ Log.d("ReactNative", "shutdownInternal"+ e.getMessage());
1015
+ throw (e);
1016
+ }
1017
+ }
1018
+
1004
1019
  @ReactMethod
1005
1020
  public void shutdown(Promise promise) {
1006
1021
  ThreadUtils.runOnExecutor(() -> {
1007
- try {
1008
- if(this.fula != null) {
1009
- this.fula.shutdown();
1010
- this.fula = null;
1011
- this.client = null;
1012
- }
1013
- promise.resolve(true);
1014
- } catch (Exception e) {
1015
- promise.reject(e);
1016
- Log.d("ReactNative", "shutdown"+ e.getMessage());
1017
- }
1022
+ shutdownInternal();
1018
1023
  });
1019
1024
  }
1020
1025
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@functionland/react-native-fula",
3
- "version": "1.1.7",
3
+ "version": "1.1.8",
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",