From 0e120e9e0adecec077705dc16daf63e6160cf518 Mon Sep 17 00:00:00 2001 From: Will Dent Date: Wed, 9 Sep 2015 06:53:42 -0400 Subject: [PATCH] Fixed issue #40 --- Classes/OrgBeuckmanTibeaconsModule.m | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/Classes/OrgBeuckmanTibeaconsModule.m b/Classes/OrgBeuckmanTibeaconsModule.m index 23f47ea..03e29e4 100644 --- a/Classes/OrgBeuckmanTibeaconsModule.m +++ b/Classes/OrgBeuckmanTibeaconsModule.m @@ -187,8 +187,9 @@ - (void) locationManager:(CLLocationManager *)manager didStartMonitoringForRegio { NSLog(@"[INFO] Did start monitoring region: %@", region.identifier); [self.locationManager requestStateForRegion:region]; - + if([region isKindOfClass: [CLBeaconRegion class]]) { [self fireEvent:@"didStartMonitoringForRegion" withObject:[self detailsForBeaconRegion:(CLBeaconRegion *)region]]; + } } @@ -206,26 +207,38 @@ -(void)locationManager:(CLLocationManager *)manager didDetermineState:(CLRegionS NSLog(@"[INFO] State UNKNOWN region: %@", region.identifier); } + if([region isKindOfClass: [CLBeaconRegion class]]) { NSMutableDictionary *event = [NSMutableDictionary dictionaryWithDictionary:[self detailsForBeaconRegion:(CLBeaconRegion *)region]]; [event setObject:[self decodeRegionState:state] forKey:@"regionState"]; [self fireEvent:@"determinedRegionState" withObject:event]; + } } - (void)locationManager:(CLLocationManager *)manager didEnterRegion:(CLRegion *)region { NSLog(@"[INFO] Entered region %@", region.identifier); - - [self fireEvent:@"enteredRegion" withObject:[self detailsForBeaconRegion:(CLBeaconRegion *)region]]; + + if([region isKindOfClass: [CLBeaconRegion class]]) { + NSLog(@"[INFO] Entered region and determined region type is beacon"); + [self fireEvent:@"enteredRegion" withObject:[self detailsForBeaconRegion:(CLBeaconRegion *)region]]; + + } + + } -(void)locationManager:(CLLocationManager *)manager didExitRegion:(CLRegion *)region { NSLog(@"[INFO] exited region %@", region.identifier); - - [self fireEvent:@"exitedRegion" withObject:[self detailsForBeaconRegion:(CLBeaconRegion *)region]]; + if([region isKindOfClass: [CLBeaconRegion class]]) { + NSLog(@"[INFO] Entered region and determined region type is beacon"); + [self fireEvent:@"exitedRegion" withObject:[self detailsForBeaconRegion:(CLBeaconRegion *)region]]; + + } + }