Address comments from copilot on PR 48#50
Merged
HaudinFlorence merged 10 commits intoimprove_bluetooth_manager_classfrom Apr 29, 2026
Merged
Address comments from copilot on PR 48#50HaudinFlorence merged 10 commits intoimprove_bluetooth_manager_classfrom
HaudinFlorence merged 10 commits intoimprove_bluetooth_manager_classfrom
Conversation
b76659d to
b4d7731
Compare
…undefined for cases where the device is device.connected is false.
7e9143e to
0878601
Compare
bdc1a5e
into
improve_bluetooth_manager_class
7 checks passed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
checkWebBluetoothSupportremoveAllDevicesremoveAllDevicesand emit signal only once, not at every device removal => it is still not okay after that see point 11._removeDeviceFromListnativeinconnectMethodBluetoothManager.Deviceclass, consider edge case where the GATT server is already disconnected,device.disposefrom:Indeed, in the current code, when a user calls
disconnect(device), this device is disposed: this triggers thegattserverdisconnectedevent, which emits the disconnected signal, which calls_removeDeviceFromListand then tries to dispose again.11. Fix multiple signal emissions in
removeAllDevices: In the current code, on each loop iteration,_removeDeviceFromList()is called and a signal emitted (deviceListChanged).12. Return undefined in
connect()inBluetoothManagerclass for cases wheredevice.connectedisfalse.13. Fix signal Emission Logic in
addDeviceToList: in the current code, the signal is emitted regardless of whether the device was actually added. The signal should only been emitted when the device is newly added.14. Prevent from double dispose() in
removeDeviceFromList: In the current code, inremoveDeviceFromList, you call device.dispose() after removal. It is better to first check it is not already disposed.15. Improve
requestDevicereturn logic to:In removeDeviceFromList, the identifier index lookup is fragile. Consider using a Map lookups instead of array indexOf: