Skip to content

Commit

Permalink
fix(android): device filtering case sensitivity
Browse files Browse the repository at this point in the history
As seen in GH-141, the S in soundcore can be lowercase, so the pattern
should be case insensitive.
  • Loading branch information
Oppzippy committed Dec 14, 2024
1 parent 2c4bd4f commit fc70ca6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog

## Unreleased

### Android

#### Fixes

- Fix devices with names containing "soundcore" (lowercase s) rather than "Soundcore" not showing up in the listing.

## v1.16.0

### General
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,10 @@ class DeviceSelectionViewModel @Inject constructor(
val pairingRequest = AssociationRequest.Builder()
.addDeviceFilter(
BluetoothDeviceFilter.Builder().apply {
this.setNamePattern(Pattern.compile("Soundcore"))
// case insensitive since sometimes the S in Soundcore is lowercase
// For some reason, when used with setNamePattern, Pattern.CASE_INSENSITIVE doesn't work.
// (?i) can be used as a workaround.
this.setNamePattern(Pattern.compile("(?i)soundcore"))
}.build(),
)
.build()
Expand Down

0 comments on commit fc70ca6

Please sign in to comment.