Skip to content

Commit 03acf33

Browse files
mandrade-digmapdon
authored andcommitted
Update to only remove the disconnected peripheral from notificationCallbacks (#674)
Remove the notification callback for only the disconnected peripheral instead of removing all of the peripherals
1 parent 53b82b2 commit 03acf33

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/ios/BLECentralPlugin.m

+8-1
Original file line numberDiff line numberDiff line change
@@ -893,7 +893,14 @@ -(void) cleanupOperationCallbacks: (CBPeripheral *)peripheral withResult:(CDVPlu
893893
NSLog(@"Cleared stop notification callback %@ for key %@", callbackId, key);
894894
}
895895
}
896-
[notificationCallbacks removeAllObjects];
896+
for(id key in notificationCallbacks.allKeys) {
897+
if([BLECentralPlugin isKey:key forPeripheral:peripheral]) {
898+
NSString *callbackId = [notificationCallbacks valueForKey:key];
899+
[self.commandDelegate sendPluginResult:result callbackId:callbackId];
900+
[notificationCallbacks removeObjectForKey:key];
901+
NSLog(@"Cleared notification callback %@ for key %@", callbackId, key);
902+
}
903+
}
897904
}
898905

899906
#pragma mark - util

0 commit comments

Comments
 (0)