Skip to content

Commit

Permalink
fix: adjust ios sensor event name to match android (#408)
Browse files Browse the repository at this point in the history
Closes #407
  • Loading branch information
DanielMSchmidt committed Aug 19, 2021
1 parent 61c1d12 commit 741e59e
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 18 deletions.
6 changes: 3 additions & 3 deletions ios/RNSensorsAccelerometer.m
Expand Up @@ -14,7 +14,7 @@ @implementation RNSensorsAccelerometer

- (id) init {
self = [super init];
NSLog(@"Accelerometer");
NSLog(@"RNSensorsAccelerometer");

if (self) {
self->_motionManager = [[CMMotionManager alloc] init];
Expand All @@ -30,7 +30,7 @@ + (BOOL)requiresMainQueueSetup

- (NSArray<NSString *> *)supportedEvents
{
return @[@"Accelerometer"];
return @[@"RNSensorsAccelerometer"];
}

RCT_REMAP_METHOD(isAvailable,
Expand Down Expand Up @@ -125,7 +125,7 @@ - (void) isAvailableWithResolver:(RCTPromiseResolveBlock) resolve
NSLog(@"Updated accelerometer values: %f, %f, %f, %f", x, y, z, timestamp);
}

[self sendEventWithName:@"Accelerometer" body:@{
[self sendEventWithName:@"RNSensorsAccelerometer" body:@{
@"x" : [NSNumber numberWithDouble:x],
@"y" : [NSNumber numberWithDouble:y],
@"z" : [NSNumber numberWithDouble:z],
Expand Down
6 changes: 3 additions & 3 deletions ios/RNSensorsBarometer.m
Expand Up @@ -15,7 +15,7 @@ @implementation RNSensorsBarometer

- (id) init {
self = [super init];
NSLog(@"Barometer");
NSLog(@"RNSensorsBarometer");

if (self) {
self->_altimeter = [[CMAltimeter alloc] init];
Expand All @@ -26,7 +26,7 @@ - (id) init {

- (NSArray<NSString *> *)supportedEvents
{
return @[@"Barometer"];
return @[@"RNSensorsBarometer"];
}

+ (BOOL)requiresMainQueueSetup
Expand Down Expand Up @@ -105,7 +105,7 @@ - (void) isAvailableWithResolver:(RCTPromiseResolveBlock) resolve
NSLog(@"Updated altitue value: %f, %f, %f", altitudeData.pressure.doubleValue, altitudeData.timestamp, [RNSensorsUtils sensorTimestampToEpochMilliseconds:altitudeData.timestamp]);
}

[self sendEventWithName:@"Barometer" body:@{
[self sendEventWithName:@"RNSensorsBarometer" body:@{
@"pressure" : @(altitudeData.pressure.doubleValue * 10.0),
@"timestamp" : [NSNumber numberWithDouble:[RNSensorsUtils sensorTimestampToEpochMilliseconds:altitudeData.timestamp]]
}];
Expand Down
6 changes: 3 additions & 3 deletions ios/RNSensorsGravity.m
Expand Up @@ -15,7 +15,7 @@ @implementation RNSensorsGravity

- (id) init {
self = [super init];
NSLog(@"Gravity");
NSLog(@"RNSensorsGravity");

if (self) {
self->_motionManager = [[CMMotionManager alloc] init];
Expand All @@ -26,7 +26,7 @@ - (id) init {

- (NSArray<NSString *> *)supportedEvents
{
return @[@"Gravity"];
return @[@"RNSensorsGravity"];
}

+ (BOOL)requiresMainQueueSetup
Expand Down Expand Up @@ -128,7 +128,7 @@ - (void) isAvailableWithResolver:(RCTPromiseResolveBlock) resolve
NSLog(@"Updated gravity values: %f, %f, %f, %f", x, y, z, timestamp);
}

[self sendEventWithName:@"Gravity" body:@{
[self sendEventWithName:@"RNSensorsGravity" body:@{
@"x" : [NSNumber numberWithDouble:x],
@"y" : [NSNumber numberWithDouble:y],
@"z" : [NSNumber numberWithDouble:z],
Expand Down
6 changes: 3 additions & 3 deletions ios/RNSensorsGyroscope.m
Expand Up @@ -12,7 +12,7 @@ @implementation RNSensorsGyroscope

- (id) init {
self = [super init];
NSLog(@"Gyroscope");
NSLog(@"RNSensorsGyroscope");

if (self) {
self->_motionManager = [[CMMotionManager alloc] init];
Expand All @@ -23,7 +23,7 @@ - (id) init {

- (NSArray<NSString *> *)supportedEvents
{
return @[@"Gyroscope"];
return @[@"RNSensorsGyroscope"];
}

+ (BOOL)requiresMainQueueSetup
Expand Down Expand Up @@ -123,7 +123,7 @@ - (void) isAvailableWithResolver:(RCTPromiseResolveBlock) resolve
NSLog(@"Updated gyro values: %f, %f, %f, %f", x, y, z, timestamp);
}

[self sendEventWithName:@"Gyroscope" body:@{
[self sendEventWithName:@"RNSensorsGyroscope" body:@{
@"x" : [NSNumber numberWithDouble:x],
@"y" : [NSNumber numberWithDouble:y],
@"z" : [NSNumber numberWithDouble:z],
Expand Down
6 changes: 3 additions & 3 deletions ios/RNSensorsMagnetometer.m
Expand Up @@ -15,7 +15,7 @@ @implementation RNSensorsMagnetometer

- (id) init {
self = [super init];
NSLog(@"Magnetometer");
NSLog(@"RNSensorsMagnetometer");

if (self) {
self->_motionManager = [[CMMotionManager alloc] init];
Expand All @@ -26,7 +26,7 @@ - (id) init {

- (NSArray<NSString *> *)supportedEvents
{
return @[@"Magnetometer"];
return @[@"RNSensorsMagnetometer"];
}

+ (BOOL)requiresMainQueueSetup
Expand Down Expand Up @@ -126,7 +126,7 @@ - (void) isAvailableWithResolver:(RCTPromiseResolveBlock) resolve
NSLog(@"Updated magnetometer values: %f, %f, %f, %f", x, y, z, timestamp);
}

[self sendEventWithName:@"Magnetometer" body:@{
[self sendEventWithName:@"RNSensorsMagnetometer" body:@{
@"x" : [NSNumber numberWithDouble:x],
@"y" : [NSNumber numberWithDouble:y],
@"z" : [NSNumber numberWithDouble:z],
Expand Down
6 changes: 3 additions & 3 deletions ios/RNSensorsOrientation.m
Expand Up @@ -15,7 +15,7 @@ @implementation RNSensorsOrientation

- (id) init {
self = [super init];
NSLog(@"Orientation");
NSLog(@"RNSensorsOrientation");

if (self) {
self->_motionManager = [[CMMotionManager alloc] init];
Expand All @@ -26,7 +26,7 @@ - (id) init {

- (NSArray<NSString *> *)supportedEvents
{
return @[@"Orientation"];
return @[@"RNSensorsOrientation"];
}

+ (BOOL)requiresMainQueueSetup
Expand Down Expand Up @@ -149,7 +149,7 @@ - (void) isAvailableWithResolver:(RCTPromiseResolveBlock) resolve
NSLog(@"Updated device motion quaternion: %f, %f, %f, %f %f", qx, qy, qz, qw, timestamp);
}

[self sendEventWithName:@"Orientation" body:@{
[self sendEventWithName:@"RNSensorsOrientation" body:@{
@"pitch" : [NSNumber numberWithDouble:pitch],
@"roll" : [NSNumber numberWithDouble:roll],
@"yaw" : [NSNumber numberWithDouble:yaw],
Expand Down

0 comments on commit 741e59e

Please sign in to comment.