diff --git a/ios/RNFirebase/RNFirebaseEvents.h b/ios/RNFirebase/RNFirebaseEvents.h index 76db8692..c7af4c05 100644 --- a/ios/RNFirebase/RNFirebaseEvents.h +++ b/ios/RNFirebase/RNFirebaseEvents.h @@ -8,8 +8,7 @@ static NSString *const AUTH_ERROR_EVENT = @"authError"; static NSString *const AUTH_ANONYMOUS_ERROR_EVENT = @"authAnonymousError"; // Database -static NSString *const DATABASE_ON_EVENT = @"database_on_event"; -static NSString *const DATABASE_CANCEL_EVENT = @"database_cancel_event"; +static NSString *const DATABASE_SYNC_EVENT = @"database_sync_event"; static NSString *const DATABASE_TRANSACTION_EVENT = @"database_transaction_event"; static NSString *const DATABASE_VALUE_EVENT = @"value"; diff --git a/ios/RNFirebase/database/RNFirebaseDatabase.m b/ios/RNFirebase/database/RNFirebaseDatabase.m index c1819c39..cd9f8de5 100644 --- a/ios/RNFirebase/database/RNFirebaseDatabase.m +++ b/ios/RNFirebase/database/RNFirebaseDatabase.m @@ -476,7 +476,7 @@ RCT_EXPORT_METHOD(off: - (NSArray *)supportedEvents { - return @[DATABASE_ON_EVENT, DATABASE_CANCEL_EVENT, DATABASE_TRANSACTION_EVENT]; + return @[DATABASE_SYNC_EVENT, DATABASE_TRANSACTION_EVENT]; } @end diff --git a/ios/RNFirebase/database/RNFirebaseDatabaseReference.m b/ios/RNFirebase/database/RNFirebaseDatabaseReference.m index 8f713e2f..64112be8 100644 --- a/ios/RNFirebase/database/RNFirebaseDatabaseReference.m +++ b/ios/RNFirebase/database/RNFirebaseDatabaseReference.m @@ -28,7 +28,7 @@ if (!_listeners[listenerId]) { id andPreviousSiblingKeyWithBlock = ^(FIRDataSnapshot *_Nonnull snapshot, NSString *_Nullable previousChildName) { NSDictionary *props = [RNFirebaseDatabaseReference snapshotToDict:snapshot]; - [self sendJSEvent:DATABASE_ON_EVENT title:eventName props:@{@"eventName": eventName, @"refId": _refId, @"listenerId": listenerId, @"path": _path, @"snapshot": props, @"previousChildName": previousChildName != nil ? previousChildName : [NSNull null]}]; + [self sendJSEvent:DATABASE_SYNC_EVENT title:eventName props:@{@"eventName": eventName, @"refId": _refId, @"listenerId": listenerId, @"path": _path, @"snapshot": props, @"previousChildName": previousChildName != nil ? previousChildName : [NSNull null]}]; }; id errorBlock = ^(NSError *_Nonnull error) { NSLog(@"Error onDBEvent: %@", [error debugDescription]); @@ -130,13 +130,13 @@ } - (NSDictionary *)getAndSendDatabaseError:(NSError *)error listenerId:(NSNumber *)listenerId { - NSDictionary *event = @{@"eventName": DATABASE_CANCEL_EVENT, @"path": _path, @"refId": _refId, @"listenerId": listenerId, @"code": @([error code]), @"details": [error debugDescription], @"message": [error localizedDescription], @"description": [error description]}; + NSDictionary *event = @{@"eventName": DATABASE_SYNC_EVENT, @"path": _path, @"refId": _refId, @"listenerId": listenerId, @"code": @([error code]), @"details": [error debugDescription], @"message": [error localizedDescription], @"description": [error description]}; @try { - [_emitter sendEventWithName:DATABASE_CANCEL_EVENT body:event]; + [_emitter sendEventWithName:DATABASE_SYNC_EVENT body:event]; } @catch (NSException *err) { NSLog(@"An error occurred in getAndSendDatabaseError: %@", [err debugDescription]); - NSLog(@"Tried to send: %@ with %@", DATABASE_CANCEL_EVENT, event); + NSLog(@"Tried to send: %@ with %@", DATABASE_SYNC_EVENT, event); } return event;