Skip to content

Commit

Permalink
fix(database, apple): ensure platform channel is invoked on main thre…
Browse files Browse the repository at this point in the history
…ad (#11650)
  • Loading branch information
russellwheatley committed Oct 3, 2023
1 parent 9e395af commit d713399
Showing 1 changed file with 10 additions and 8 deletions.
Expand Up @@ -248,15 +248,17 @@ - (void)databaseRunTransaction:(id)arguments
dispatch_semaphore_signal(semaphore);
};

[strongSelf->_channel invokeMethod:@"FirebaseDatabase#callTransactionHandler"
arguments:@{
@"transactionKey" : @(transactionKey),
@"snapshot" : @{
@"key" : currentData.key ?: [NSNull null],
@"value" : currentData.value ?: [NSNull null],
dispatch_async(dispatch_get_main_queue(), ^{
[strongSelf->_channel invokeMethod:@"FirebaseDatabase#callTransactionHandler"
arguments:@{
@"transactionKey" : @(transactionKey),
@"snapshot" : @{
@"key" : currentData.key ?: [NSNull null],
@"value" : currentData.value ?: [NSNull null],
}
}
}
result:methodCallResultHandler];
result:methodCallResultHandler];
});
// Wait while Dart side updates the value.
dispatch_semaphore_wait(semaphore, DISPATCH_TIME_FOREVER);

Expand Down

0 comments on commit d713399

Please sign in to comment.