Skip to content

Commit

Permalink
[Fix] iOS: scan filters were doing nothing (regression 1.31.0)
Browse files Browse the repository at this point in the history
  • Loading branch information
chipweinberger committed Dec 22, 2023
1 parent b493d9f commit 75568e4
Showing 1 changed file with 2 additions and 20 deletions.
22 changes: 2 additions & 20 deletions ios/Classes/FlutterBluePlusPlugin.m
Original file line number Diff line number Diff line change
Expand Up @@ -1069,12 +1069,12 @@ - (void)centralManager:(CBCentralManager *)central
if (isAnyFilterSet)
{
// filter services
if ([self filterServices:self.scanFilters[@"with_services"] target:advServices]) {
if (!allow && [self filterServices:self.scanFilters[@"with_services"] target:advServices]) {
allow = YES;
}

// filter remoteIds
if ([self filterRemoteIds:self.scanFilters[@"with_remote_ids"] target:remoteId]) {
if (!allow && [self filterRemoteIds:self.scanFilters[@"with_remote_ids"] target:remoteId]) {
allow = YES;
}

Expand Down Expand Up @@ -1850,9 +1850,6 @@ - (BOOL)hasFilter:(NSString *)key {
- (BOOL)filterServices:(NSArray<NSString *> *)services
target:(NSArray<CBUUID *> *)target
{
if (services.count == 0) {
return YES;
}
if (target == nil || target.count == 0) {
return NO;
}
Expand All @@ -1867,9 +1864,6 @@ - (BOOL)filterServices:(NSArray<NSString *> *)services
- (BOOL)filterKeywords:(NSArray<NSString *> *)keywords
target:(NSString *)target
{
if (keywords.count == 0) {
return YES;
}
if (target == nil) {
return NO;
}
Expand All @@ -1884,9 +1878,6 @@ - (BOOL)filterKeywords:(NSArray<NSString *> *)keywords
- (BOOL)filterNames:(NSArray<NSString *> *)names
target:(NSString *)target
{
if (names.count == 0) {
return YES;
}
if (target == nil) {
return NO;
}
Expand All @@ -1901,9 +1892,6 @@ - (BOOL)filterNames:(NSArray<NSString *> *)names
- (BOOL)filterRemoteIds:(NSArray<NSString *> *)remoteIds
target:(NSString *)target
{
if (remoteIds.count == 0) {
return YES;
}
if (target == nil) {
return NO;
}
Expand All @@ -1918,9 +1906,6 @@ - (BOOL)filterRemoteIds:(NSArray<NSString *> *)remoteIds
- (BOOL)filterServiceData:(NSArray<NSDictionary*>*)filters
sd:(NSDictionary *)sd
{
if (filters.count == 0) {
return YES;
}
if (sd == nil || sd.count == 0) {
return NO;
}
Expand Down Expand Up @@ -1951,9 +1936,6 @@ - (BOOL)filterServiceData:(NSArray<NSDictionary*>*)filters
- (BOOL)filterMsd:(NSArray<NSDictionary*>*)filters
msd:(NSData *)msd
{
if (filters.count == 0) {
return YES;
}
if (msd == nil || msd.length == 0) {
return NO;
}
Expand Down

0 comments on commit 75568e4

Please sign in to comment.