@@ -170,14 +170,14 @@ public void checkConnection(Promise promise) {
170170 }
171171
172172 @ ReactMethod
173- public void newClient (String identityString , String storePath , String bloxAddr , String exchange , boolean autoFlush , boolean useRelay , Promise promise ) {
173+ public void newClient (String identityString , String storePath , String bloxAddr , String exchange , boolean autoFlush , boolean useRelay , boolean refresh , Promise promise ) {
174174 Log .d ("ReactNative" , "newClient started" );
175175 ThreadUtils .runOnExecutor (() -> {
176176 try {
177177 Log .d ("ReactNative" , "newClient storePath= " + storePath );
178178 byte [] identity = toByte (identityString );
179179 Log .d ("ReactNative" , "newClient identity= " + identityString );
180- this .newClientInternal (identity , storePath , bloxAddr , exchange , autoFlush , useRelay );
180+ this .newClientInternal (identity , storePath , bloxAddr , exchange , autoFlush , useRelay , refresh );
181181 //String objString = Arrays.toString(obj);
182182 String peerId = this .fula .id ();
183183 promise .resolve (peerId );
@@ -474,7 +474,7 @@ public fulamobile.Client getFulaClient() {
474474 }
475475
476476 @ NonNull
477- private byte [] newClientInternal (byte [] identity , String storePath , String bloxAddr , String exchange , boolean autoFlush , boolean useRelay ) throws Exception {
477+ private byte [] newClientInternal (byte [] identity , String storePath , String bloxAddr , String exchange , boolean autoFlush , boolean useRelay , boolean refresh ) throws Exception {
478478 try {
479479 fulaConfig = new Config ();
480480 if (storePath == null || storePath .trim ().isEmpty ()) {
@@ -495,7 +495,7 @@ private byte[] newClientInternal(byte[] identity, String storePath, String bloxA
495495 fulaConfig .setAllowTransientConnection (true );
496496 fulaConfig .setForceReachabilityPrivate (true );
497497 }
498- if (this .fula == null ) {
498+ if (this .fula == null || refresh ) {
499499 Log .d ("ReactNative" , "Creating a new Fula instance" );
500500 this .fula = Fulamobile .newClient (fulaConfig );
501501 }
@@ -513,7 +513,7 @@ private byte[] newClientInternal(byte[] identity, String storePath, String bloxA
513513 private String [] initInternal (byte [] identity , String storePath , String bloxAddr , String exchange , boolean autoFlush , String rootCid , boolean useRelay , boolean refresh ) throws Exception {
514514 try {
515515 if (this .fula == null || refresh ) {
516- this .newClientInternal (identity , storePath , bloxAddr , exchange , autoFlush , useRelay );
516+ this .newClientInternal (identity , storePath , bloxAddr , exchange , autoFlush , useRelay , refresh );
517517 }
518518 if (this .client == null || refresh ) {
519519 this .client = new Client (this .fula );
0 commit comments