瀏覽代碼

Add #include for config.h to get the value for HAVE_LIBDISPATCH (#6041)

Denver Coneybeare 5 年之前
父節點
當前提交
ffe23884da

+ 4 - 0
Firestore/CHANGELOG.md

@@ -1,5 +1,9 @@
 # Unreleased
 
+# v1.16.2
+- [fixed] Fixed a configuration issue where listeners were no longer being
+  called back on the main thread by default.
+
 # v1.16.1
 - [fixed] Removed a delay that may have prevented Firestore from immediately
   establishing a network connection if a connectivity change occurred while

+ 9 - 0
Firestore/Example/Tests/Integration/API/FIRDatabaseTests.mm

@@ -1493,6 +1493,15 @@ using firebase::firestore::util::TimerId;
   // `ListenerRegistration::Remove()` and expect to be able to immediately delete that state. The
   // trouble is that there may be a callback in progress against that listener so the implementation
   // now blocks the remove call until the callback is complete.
+  //
+  // To make this work, user callbacks can't be on the main thread because the main thread is
+  // blocked waiting for the test to complete (that is, you can't await expectations on the main
+  // thread and then have the user callback additionally await expectations).
+  dispatch_queue_t userQueue = dispatch_queue_create("firestore.test.user", DISPATCH_QUEUE_SERIAL);
+  FIRFirestoreSettings *settings = self.db.settings;
+  settings.dispatchQueue = userQueue;
+  self.db.settings = settings;
+
   XCTestExpectation *running = [self expectationWithDescription:@"listener running"];
   XCTestExpectation *allowCompletion =
       [self expectationWithDescription:@"allow listener to complete"];

+ 1 - 0
Firestore/Source/API/FIRFirestore.mm

@@ -42,6 +42,7 @@
 #include "Firestore/core/src/core/transaction.h"
 #include "Firestore/core/src/model/database_id.h"
 #include "Firestore/core/src/util/async_queue.h"
+#include "Firestore/core/src/util/config.h"
 #include "Firestore/core/src/util/empty.h"
 #include "Firestore/core/src/util/error_apple.h"
 #include "Firestore/core/src/util/exception.h"