Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions FirebaseDatabase/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# v8.12.0
- [fixed] **Breaking change:** Mark `getData()` snapshot as nullable to fix Swift API. (#9655)

# v8.11.0
- [fixed] Race condition crash in FUtilities.m. (#9096)
- [fixed] FNextPushId 'successor' crash. (#8790)
Expand Down
5 changes: 3 additions & 2 deletions FirebaseDatabase/Sources/Api/FIRDatabaseQuery.m
Original file line number Diff line number Diff line change
Expand Up @@ -663,8 +663,9 @@ - (void)keepSynced:(BOOL)keepSynced {
});
}

- (void)getDataWithCompletionBlock:(void (^)(NSError *__nullable error,
FIRDataSnapshot *snapshot))block {
- (void)getDataWithCompletionBlock:
(void (^)(NSError *__nullable error,
FIRDataSnapshot *__nullable snapshot))block {
dispatch_async([FIRDatabaseQuery sharedQueue], ^{
[self.repo getData:self withCompletionBlock:block];
});
Expand Down
5 changes: 2 additions & 3 deletions FirebaseDatabase/Sources/Core/FRepo.m
Original file line number Diff line number Diff line change
Expand Up @@ -519,9 +519,8 @@ - (void)purgeOutstandingWrites {
}

- (void)getData:(FIRDatabaseQuery *)query
withCompletionBlock:
(void (^_Nonnull)(NSError *__nullable error,
FIRDataSnapshot *__nullable snapshot))block {
withCompletionBlock:(void (^)(NSError *__nullable error,
FIRDataSnapshot *__nullable snapshot))block {
FQuerySpec *querySpec = [query querySpec];
id<FNode> node = [self.serverSyncTree getServerValue:[query querySpec]];
if (node != nil) {
Expand Down
2 changes: 1 addition & 1 deletion FirebaseDatabase/Sources/FIRDatabaseReference.m
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ - (void)observeSingleEventOfType:(FIRDataEventType)eventType

- (void)getDataWithCompletionBlock:
(void (^_Nonnull)(NSError *__nullable error,
FIRDataSnapshot *snapshot))block {
FIRDataSnapshot *__nullable snapshot))block {
[super getDataWithCompletionBlock:block];
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ NS_SWIFT_NAME(DatabaseQuery)
*/
- (void)getDataWithCompletionBlock:
(void (^_Nonnull)(NSError *__nullable error,
FIRDataSnapshot *snapshot))block
FIRDataSnapshot *__nullable snapshot))block
NS_SWIFT_NAME(getData(completion:));

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ priority is meant to be preserved, you should use setValue:andPriority: instead.
*/
- (void)getDataWithCompletionBlock:
(void (^_Nonnull)(NSError *__nullable error,
FIRDataSnapshot *snapshot))block
FIRDataSnapshot *__nullable snapshot))block
NS_SWIFT_NAME(getData(completion:));

#pragma mark - Detaching observers
Expand Down
4 changes: 2 additions & 2 deletions FirebaseDatabase/Tests/Unit/Swift/DatabaseAPITests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ final class DatabaseAPITests {
// getData(completion block:)
databaseQuery.getData { optionalError, dataSnapshot in
let /* optionalError */ _: Error? = optionalError
let /* dataSnapshot */ _: DataSnapshot = dataSnapshot
let /* dataSnapshot */ _: DataSnapshot? = dataSnapshot
}

#if compiler(>=5.5.2) && canImport(_Concurrency)
Expand Down Expand Up @@ -388,7 +388,7 @@ final class DatabaseAPITests {
// getData(completion block:)
databaseReference.getData { optionalError, dataSnapshot in
let /* optionalError */ _: Error? = optionalError
let /* dataSnapshot */ _: DataSnapshot = dataSnapshot
let /* dataSnapshot */ _: DataSnapshot? = dataSnapshot
}

#if compiler(>=5.5.2) && canImport(_Concurrency)
Expand Down