Skip to content

Commit

Permalink
Clear refreshCallback when a new connect attempt is made
Browse files Browse the repository at this point in the history
This ensures the refresh callback can't get stuck permanently preventing
the connect callback from firing.
  • Loading branch information
peitschie committed Oct 18, 2022
1 parent 216fe2e commit 299d1db
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/android/Peripheral.java
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,10 @@ public void connect(CallbackContext callbackContext, Activity activity, boolean
currentActivity = activity;
autoconnect = auto;
connectCallback = callbackContext;
if (refreshCallback != null) {
refreshCallback.error(this.asJSONObject("refreshDeviceCache aborted due to new connect call"));
refreshCallback = null;
}

gattConnect();

Expand Down

0 comments on commit 299d1db

Please sign in to comment.