Skip to content

Commit 6cdbc99

Browse files
authored
merge master to firestore-api-changes (#868)
* Version bump for 4.8.1 Release Updated the version numbers of pods which are being released in 4.8.1 * Update from master Picking up a few last-minute changes to CHANGELOGs and tests for 4.8.1 release. * Update Core info for M21.1 Update missing version bump for M21.1 for FirebaseCore. * Remove over-aggressive assert. closeWithFinalState: assumes delegate != nil, but that is not true if when startWithdelegate: was called we entered backoff (performBackoffWithDelegate:) and so self.delegate did not get assigned yet. We could rework the code to make the assertion hold, but per offline discussion this assert doesn't represent an invariant that we care about and so I'm just removing it. * Remove over-aggressive closeWithFinalState: delegate assert. (#656) Fixes #596. closeWithFinalState: asserted delegate != nil, but that is not true if when startWithdelegate: was called we entered backoff (performBackoffWithDelegate:) and so self.delegate did not get assigned yet. We could rework the code to make the assertion hold, but per offline discussion this assert doesn't represent an invariant that we care about maintaining and so I'm just removing it. * Increase FirebaseAuth version for M21.1 This version was missed in the M21.1 version bump PR. * Fix import formatting (#660) * Fix issue @morganchen12 discovered where we weren't properly creating FIRQueryDocumentSnapshot instances. (#662) * Validate clang-format compliance in travis (#648) * Build gRPC for Firestore C++ (#652) * Clean up quoting and other minor issues * Reorganize CMake build output Make it clearer which parts of the output pertain to external projects. * Use a consistent ordering of ExternalProject arguments * Prevent the top-level build from running in parallel This prevents spurious failures when running make -j. * Actually parse arguments in the xcodebuild function * Use ExternalProject features when available * submodule limits from CMake 3.0 * shallow clones from CMake 3.6 * git progress output from CMake 3.8 * Only build the parts of leveldb we need Skip building the tools and other libraries * Avoid installing ExternalProjects Consume build output directly so that we can build just the targets we need. Installing causes all targets to be built. This doesn't matter as much for these targets but the gRPC build includes a ton of stuff we don't need so it's worth adopting this as a general strategy. * Define an external build for grpc * Test that grpc can link successfully. * Add a FindGRPC CMake module * Actually comment ExternalProjext_GitSource * Inject infoDictionary to fix flakey tests. (#664) * Inject infoDictionary to fix flakey tests. * Remove outdated comment, update format. * Fix issue @morganchen12 discovered where we weren't properly creating FIRQueryDocumentSnapshot instances. (#662) * Travis - run tests only for changed code (#665) * Add assert_test to the Xcode build (#671) * Exclude stdio-backed assert from the Xcode build * Add assert_test to the Xcode build * Enable warnings in the CMake build (#669) * Enable warnings when building with GCC or clang * Fix warnings * Fix C++ lint errors (#668) * Misc style.sh fixes * Allow test-only to use a revision; to check your changes since master: ./scripts/style.sh test-only master * Avoid diffing deleted files * 80 columns * Fix C++ lint errors * implement FieldValue for null, boolean, and array in C++. (#637) * implement FieldValue for null and boolean. * refactoring to use union type instead of poly * refactor using union design intead of poly * refactoring to use anonymous union and fix styles * small fix * add field_value_test to the project * fix warning of cmake and fix style * Simplify integration with googletest (#672) This makes it possible to build the Firestore subproject with CLion because it no longer needs to be told where googletest is. * Add a cc_library to the CMake build (#670) * Rewrite cc_test to take named arguments Cut down on build file verbosity by having cc_test take SOURCES and DEPENDS. The separate invocation of target_link_libraries is no longer necessary. * Add a cc_library rule to parallel cc_test This cuts down on build file verbosity. * Automatically add OBJC_FLAGS to cc_libraries if applicable * Exclude platform-specific libraries from 'all' This is makes it possible to declare this kind of library unconditionally. Usage within a test or as a dependency will actually trigger building. * Restore secure_random_test.cc; clean-up comments * Fix CMake build and lint warnings in field_value.cc (#677) Fixes these cpplint warnings: Firestore/core/src/firebase/firestore/model/field_value.cc:162: Semicolon defining empty statement. Use {} instead. [whitespace/semicolon] [5] Firestore/core/src/firebase/firestore/model/field_value.cc:170: Semicolon defining empty statement. Use {} instead. [whitespace/semicolon] [5] Firestore/core/src/firebase/firestore/model/field_value.cc:126: Add #include <utility> for swap [build/include_what_you_use] [4] * Listen sequence numbers (#675) * Generate and save sequence numbers for listens * Add documentation * Fix include path * Fix unavailable comment * Review feedback * Fix build warnings by making void parameter explicit (#681) * Add platform detection logic for SecureRandom (#676) * Add CMake platform detection logic for SecureRandom Now only builds secure_random_arc4random.cc if available. Remove firebase/firestore/base/port.h. Nothing else was in that directory. * Add a SecureRandom implementation that uses OpenSSL This is usable on Linux, Windows, and Android * Properly check return from RAND_bytes * Port comparison to C++ (#678) This reimplements our comparison functions as C++ Comparators and then provides compatibility shims for interoperating with existing Objective-C usage. A few specialized comparators aren't suitable for porting but only have a single usage (e.g. CompareBytes for comparing NSData * instances). In these cases I've moved them into the caller. * Use int32_t for typeof(ID) in FSTDocumentReference * Migrate callers of FSTComparison.h to Objective-C++ * Port comparison to C++ * Migrate usages of FSTComparison.h to C++ equivalents * Remove FSTComparison * Use Comparator in FieldValue. (#686) * style.sh - output unformatted files in test-only and ignore generated config.h (#690) * Cleanup imports and isEqual (#685) * Fix headers * Fix isEqual verbosity * Fix isEqual for nullable properties * Fix nullability on FSTTestDocSnapshot * Fixing spelling error in FIRStorageErrors * Update travis to use CocoaPods 1.4.0 (#692) * add FIRUser behavior to documentation * Disable Messaging build warnings (#697) * Update FirebaseMessaging protos (#696) * Adding enable/disable property to FCM token auto Initialization * revert unrelated changes * revert unrelated changes * revert unrelated changes * Adds explicit core graphics dependency to auth (#700) * Properly publish Abseil sources as a part of the podspec (#704) * Properly include abseil sources * Exclude abseil tests * Implement the rest of FieldValue types for C++ (#687) * implement FieldValue for null and boolean. * Implement number and string FieldValue. * Implement object FieldValue. * implement timestamp FieldValue. * Implement number and string FieldValue. * implement public type `Blob` and `GeoPoint` * implement Blob FieldValue * Implement GeoPoint FieldValue * refactoring `Blob` * README - FirebaseCore source pod must be included with all source pods (#705) * Fix incorrect deprecation message (#688) * Fix incorrect deprecation message for Obj-C and Swift * Update CHANGELOG for M21.1 release (#679) * normalize string_util (#708) * refactoring string_util * port string_util to iOS * implement `TargetIdGenerator` in C++ for Firestore (#701) * implement `TargetIdGenerator` * address changes * adding unit test for auto init enable function (#710) * port TargetIdGenerator to iOS (#709) * port TargetIdGenerator to iOS * fix style * move pointer property to instance variable * TriggerTravis * normalize and port the rest of Firebase/Port code (#713) * normalize bits * normalize ordered_code * Fix b/72502745: OnlineState changes cause limbo document crash. (#470) (#714) [PORT OF firebase/firebase-js-sdk#470] Context: I made a previous change to raise isFromCache=true events when the client goes offline. As part of this change I added an assert for "OnlineState should not affect limbo documents", which it turns out was not valid because: * When we go offline, we set the view to non-current and call View.applyChanges(). * View.applyChanges() calls applyTargetChange() even though there's no target change and it recalculates limbo documents. * When the view is not current, we consider no documents to be in limbo. * Therefore all limbo documents are removed and so applyChanges() ends up returning unexpected LimboDocumentChanges. Fix: I've modified the View logic so that we don't recalculate limbo documents (and generate LimboDocumentChanges) when the View is not current, so now my assert holds and there should be less spurious removal / re-adding of limbo documents. * travis: check for copyright in sources (#717) * Add the C++ linter to the repo (#720) * Fix a number of c++ build errors (#715) * Move -fvisibility-inlines-hidden from common_flags to cxx_flags This option isn't supported by C (and causes the build to fail under at least rodete). Manifested error was: ``` -- Looking for include file openssl/rand.h -- Looking for include file openssl/rand.h - not found CMake Error at core/src/firebase/firestore/util/CMakeLists.txt:94 (message): No implementation for SecureRandom available. -- Configuring incomplete, errors occurred! ``` which is completely misleading. :( * Fix exception include for std::logic_error Was causing compiler error on (at least) rodete. (http://en.cppreference.com/w/cpp/error/logic_error suggests that stdexcept is the correct header.) * Remove 'const' from vector contents. vectors cannot contain const objects as the contained objects are required to be assignable and copy constructable. (Not *quite* strictly true; since c++11, this requirement now depends on the operations performed on the container. But my compiler objects at any rate.) http://en.cppreference.com/w/cpp/container/vector https://stackoverflow.com/questions/8685257/why-cant-you-put-a-const-object-into-a-stl-container * Add brackets as suggested (required) by my compiler. * Add missing include For LLONG_MIN, etc. * Enable gnu extension to c++11 for firestore/util *test*. We disable them by default (in cmake/CompilerSetup.cmake) but our tests requires hexidecimal floating point, which is not supported in c++11 (though is supported in C++17, gnu++11, and others). http://en.cppreference.com/w/cpp/language/floating_literal https://bugzilla.redhat.com/show_bug.cgi?id=1321986 * Fix printf format for uint64_t http://en.cppreference.com/w/cpp/types/integer https://stackoverflow.com/questions/9225567/how-to-print-a-int64-t-type-in-c * Allow 0 length printf template strings in tests. * Get rid of a multi line comment. The backslash is apparently interpreted by the compiler cause the next line to be ignored too. In this case, the next line is (currently) a comment, and would be ignored anyways. (But that doesn't stop the compiler from yelling.) * Run ./scripts/style.sh * Version updates to 4.8.2 (#722) * Use fixed-sized types (#719) Should have caught this during review, but cpplint caught it * Import iterator_adaptors from google3 (#718) * Import iterator_adapters from google3 * Remove -Wconversion which is annoyingly hard to satisfy * Strip dependency on absl_container from iterator_adapters_test * Format and lint iterator_adaptors * More flexible copyright checking in Travis * Add changelog entry for my last PR (oops) and also add a few that we missed last release. (#724) * Add absl_strings to firebase_firestore_util_test dependencies (#725) Required to link the test on rodete. * Firestore DatabaseId in C++ (#727) * Implement DataBaseId in C++ * add database_id_test to project * fix project * address changes * fix style * Schema migrations for LevelDB (#728) * Implement schema versions * Style fixes * newlines, copyrights, assumptions * Fix nullability * Raw ptr -> shared_ptr * kVersionTableGlobal -> kVersionGlobalTable * Drop utils, move into static methods * Drop extra include * Add a few more comments * Move version constant into migrations file * formatting? * Fix comment * [FCM] Add completion handler to subscribe/unsubscribe topic actions Added functionality not exposed in public header yet. I would leave to next FCM SDK owner to expose this functionality (and follow any required review process). Bugs: 72701086 * Fix tests. * Move all Firestore Objective-C to Objective-C++ (#734) * Move all Firestore files to Objective-C++ * Update project file references * Don't use module imports from Objective-C++ * Use extern "C" for C-accessible globals * Work around more stringent type checking in Objective-C++ * NSMutableDictionary ivars aren't implicitly casted to NSDictionary * FSTMaybeDocument callback can't be passed a function that accepts FSTDocument * NSComparisonResult can't be multiplied by -1 without casting * Add a #include <inttypes.h> where needed * Avoid using C++ keywords as variables * Remove #if __cplusplus guards * Start on ArraySortedMap in C++ (#721) * Implement ArraySortedMap.remove * Implement ArraySortedMap.insert * Ensure ArraySortedMap.insert avoids copying on duplicates * Port more ArraySortedMapTests * Remove predecessorKey,Object,Document, etc (#735) This is dead code. I think it was probably useful in the RTDB because of the way it notified of changes, but we give changes with indexes in Firestore so I think we don't need it. * Align tests and integration test header search paths (#737) * fix (#739) * Increase expectation timeout to 25 seconds. (#744) I'm doing this to: 1) Experimentally see if it improves the flakiness we've been seeing in the Query Conformance Tests. 2) Insulate us from the fact that GRPC seems to take a /minimum/ of 10 seconds to reconnect (at least in some cases) after a connection failure. I've opened b/72864027 to revisit this in the future. * fix null block execution crash * Make sure Firestore/core/include is in the podspec (#748) * Skip 'update' step for external dependencies We check them out from a git tag, so this *should* be a noop. However, cmake seems to want to rebuild these dependencies every time you run make as it assumes the dependency *might* have been updated. (In practice, this isn't completely awful, as make notices the files haven't changed, so files don't actually get recompiled. But the configure step is still re-run and all the files still need to be rescanned.) Skipping the update step speeds up the build considerably. On my linux box, running: cmake .. && make -j && time make -j takes ~8.5s prior to this CL and ~6.5 afterwards. (6s is used by the test suite.) The upcoming protobuf addition would otherwise have made this much worse. (It takes a long time to ./configure.) * Add ability to build nanopb and protobuf * Add instructions for building nanopb protos Currently only supported on osx * Add generated nanopb protos. 100% machine generated (except adding of the license). * Import "well-known" protos (and generated nanopb files) For use by nanopb (which otherwise doesn't know what to do with these.) * Hook up nanopb to firestorep project Use remote/serializer placeholder class as a hook for the test to ensure nanopb headers can be found, and test can be linked. * style.sh now ignores generated nanopb files * ./style.sh * Eliminate sequencing dependencies We originally had this as it was thought that cmake would spawn n*m jobs (where n is the number of jobs it was instructed to create, ie. make -j8, and m is the number of external projects.) However, it isn't supposed to do that, and doesn't appear to be doing that right now. So we'll remove this. If the problem re-appears, we'll add these back in. (Symptom was being unable to spawn /bin/sh.) * Downgrade nanopb from 0.4.0-dev to 0.3.8. Also regenerate the protos * Minor refactoring * Ignore trailing whitespace in autogenerated nanopb files * Update abseil-cpp to a new upstream (#754) Update to bf7fc9986e20f664958fc227547fd8d2fdcf863e * Add StrCat, StrJoin and the rest of //strings from abseil-cpp (#756) From abseil-cpp version bf7fc9986e20f664958fc227547fd8d2fdcf863e * Fix xcode build errors re nanopb Involves adding PODS_ROOT/nanopb to include path (to allow include <pb.h>) and Firestore/Protos/nanopb to include path (to allow include "google/api/annotations.pb.h" and similar). In both cases, this is to allow auto-generated code to function properly. * Fix firebaes typo (#755) * Implement Firestore DatabaseInfo and port both Database{Id,Info} C++ to the iOS code (#738) * implement Firestore DatabaseInfo in C++ * temporary stash changes; blocking on the massive renaming of .m to .mm * add database_info_test to project * finish port DatabaseId and fix style, modular fixing DatabaseInfo * port DatabaseInfo * remove FSTDatabase{ID,Info} and their tests from project * fix unit test * use namespace alias * use namespace alias, leftover * address more changes * refactoring to use raw pointer instead of value for property * address changes * remove self-> * fix style * remove the name suffix Alloc * fix a bug * C++ port: port FSTFieldPath and FSTResourcePath to C++ (#749) Similar to Objective-C, FieldPath and ResourcePath share most of their interface (and implementation) by deriving from BasePath (using CRTP, so that factory methods in BasePath can return an instance of the derived class). * Creating CHANGELOG for FCM (#764) * add CHANGELOG for FCM * fix the typo * avoid using initWithSuiteName which does not support iOS 7 (#765) * Updates version of Firebase Auth in Changelog (#771) * Updates version of Firebase Auth in Changelog * addresses comments * Update CHANGELOG for Firestore v0.10.1 (#768) * Explicitly specify the default constructor to FieldPath (#773) Xcode prior to 8.3 does not accept an explicitly defaulted constructor (`= default`) for the purposes of default initializing a const object. This fixes a build failure under Xcode 8.2: ``` Firestore/core/src/firebase/firestore/model/field_path.cc:144:26: error: default initialization of an object of const type 'const firebase::firestore::model::FieldPath' without a user-provided default constructor static const FieldPath empty_path; ``` * Update deprecation message for Firestore. (#758) * Update FIRFirestore.h * Provide full command to enable debugging. * Version bumps for 4.9.0 (#774) * cmake build fixes (#770) * Fix nanopb (in cmake build) Look for binaries in the src dir (since that's where we build now.) This error would be masked if a previous build had completed prior to switching nanopb to build out of src. Also, don't patch the protoc path multiple times. This could be triggered by (eg) 'make && make clean && make'. * Add resource_path.{h,cc} to the cmake build * Fix signed/unsigned int comparison warnings * Ensure FieldValue tag_ is initialized during cp/mv ctor. Otherwise, the assignment operator attempts to deallocate based on the (uninitialized) tag_ variable, posssibly leading to segfaults. * Fix tests that throw exceptions. The (previous) tests checked to ensure that an abort() occurs, but if ABSL_HAVE_EXCEPTIONS is defined on non-macos (which is currently the default) then the assertions will throw a std::logic_error rather than abort()ing. On macos, an exception is thrown too, but the exception doesn't derrive from std::exception, so ASSERT_DEATH_* doesn't catch it (hence why ASSERT_DEATH_* actually works.) To resolve this, I've switched to ASSERT_ANY_THROW. * Let Travis run for `CMake` test and `lint.sh` (#769) * Fix nanopb (in cmake build) Look for binaries in the src dir (since that's where we build now.) This error would be masked if a previous build had completed prior to switching nanopb to build out of src. Also, don't patch the protoc path multiple times. This could be triggered by (eg) 'make && make clean && make'. * Add resource_path.{h,cc} to the cmake build * Fix signed/unsigned int comparison warnings * let Travis run for `CMake` test and `lint.sh` * Ensure FieldValue tag_ is initialized during cp/mv ctor. Otherwise, the assignment operator attempts to deallocate based on the (uninitialized) tag_ variable, posssibly leading to segfaults. * address change * fix trailing space * address change * moving Firestore checks closer together * Fix tests that throw exceptions. The (previous) tests checked to ensure that an abort() occurs, but if ABSL_HAVE_EXCEPTIONS is defined on non-macos (which is currently the default) then the assertions will throw a std::logic_error rather than abort()ing. On macos, an exception is thrown too, but the exception doesn't derrive from std::exception, so ASSERT_DEATH_* doesn't catch it (hence why ASSERT_DEATH_* actually works.) To resolve this, I've switched to ASSERT_ANY_THROW. * ./scripts/lint.sh * Move FieldValue::tag_ initializer to be in class. * check Travis ulimit * check travis limit * set make -j 200 instead of unlimited * use cpu core number instead of 200 * port Firestore Auth module in C++ (#733) * Implement firestore/auth/user * add user to project and some fixes * implement firestore/auth/{credentials_provider,empty_credentials_provider} * implement firestore/auth/firebase_credentials_provider * refactoring firebase_credentials_provider and add (disabled but working) unit test * add auth test to project * address changes * small fix to style and project * fix the firebase_credentials_provider_test * fix style * address changes * revert the change to static mutex_ * remove my custom plist path * fix style * address changes * refactoring FirebaseCredentialsProvider to fix the issue w.r.t. auth global dispatch queue * add /*force_refresh=*/ tag to bool literal for style purpose * Use a shared_ptr/weak_ptr handoff on FirebaseCredentialsProvider (#778) * Revert "refactoring FirebaseCredentialsProvider to fix the issue w.r.t. auth global dispatch queue" This reverts commit 87175a4. * Use a shared_ptr/weak_ptr handoff on FirebaseCredentialsProvider This avoids any problems with callsbacks retaining pointers to objects destroyed by a C++ destructor * port Firestore SnapshotVersion in C++ (#767) * implement SnapshotVersion and test * Fix Core CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF warnings (#779) * C++ port: add C++ equivalent of FSTDocumentKey. (#762) Also move kDocumentKeyPath to the only point of usage - make it a static member variable of FieldPath. * Strawman C++ API (#763) Incomplete, and what does exist in still slightly vague. It's expected that this will change. * Move to explicit nil check. (#782) * Update FieldValue of type Reference (#775) * update FieldValue of type Reference * address change * fix bad path string literal in test * use ReferenceValue and qualified name * Port Firestore Document to C++ (#777) * implement SnapshotVersion and test * update project * implement MaybeDocument and test * move snapshot-version from core to model * fix a bug * implement Document and test * implement NoDocument * adding type tag and fix style * fix a few bugs, discovered after merging and test run. * add assert to check FieldValue type and more test for comparision. * address changes * allow moving FieldValue to construct Document. * address changes * add document tests to project * use std::less convention * make Type::Unknown static initializer * Cleaning up implicit retain for the RTDB and Storage * Fix double parsing on 32 bit devices. (#787) * Keep track of number of queries in the query cache (#776) * Implement schema versions * Style fixes * newlines, copyrights, assumptions * Fix nullability * Raw ptr -> shared_ptr * kVersionTableGlobal -> kVersionGlobalTable * Drop utils, move into static methods * Drop extra include * Add a few more comments * Move version constant into migrations file * formatting? * Fix comment * Split add and update queryData * Work on adding targetCount * More work on count * Using shared_ptr * Implement count for query cache * use quotes * Add cast * Styling * Revert year bump in copyright * Add adversarial key to migration test * Add comment * Fix style * style fix * fix flaky test (#788) * Fix off-by-one error in Auth changelog (#789) * Serialize and deserialize null (#783) * Build (grpc's) nanopb with -DPB_FIELD_16BIT We require (at least) 16 bit fields. (By default, nanopb uses 8 bit fields, ie allowing up to 256 field tags.) Also note that this patch adds this to grpc's nanopb, rather than to our nanopb. We'll need to eventually either: a) we instruct grpc to use our nanopb b) we rely on grpc's nanopb instead of using our own. (^ marked as a TODO for now.) * Add some dependant protos Imported from protobuf. Nanopb requires these to be present (though anything using libprotobuf does not, as these are already built into that.) * Add generated nanopb protos based off of newly added proto definitions * Build the nanopb protos * Serialize and deserialize null * Actually ignore events on inactive streams, rather than just logging that we're going to. (#790) * Improve documentation on auto-init property in FCM. (#792) * Fixed capitalization of init in test function. (#797) * Update README.md with code markup (#800) Add code markup to a few paths for consistency. * replacing Auth/FSTUser by C++ auth implementation (#804) * replacing Auth/FSTUser by C++ auth implementation * address changes * DispatchQueue delayed callback improvements + testing (#784) Basically a port of firebase/firebase-js-sdk@a1e346f and firebase/firebase-js-sdk@fce4168 * Introduces a DelayedCallback helper class in FSTDispatchQueue to encapsulate delayed callback logic. * Adds cancellation support. * Updates the idle timer in FSTStream to use new cancellation support. * Adds a FSTTimerId enum for identifying delayed operations on the queue and uses it to identify our existing backoff and idle timers. * Added containsDelayedCallback: and runDelayedCallbacksUntil: methods to FSTDispatchQueue which can be used from tests to check for the presence of a callback or to schedule them to run early. * Removes FSTTestDispatchQueue and changes idle tests to use new test methods. * Enable -Wcomma for our build; disable it for abseil. (#799) In order to use different cflags for abseil, this patch splits it out into a subspec within the pod. The cmake side of things "just works" since Firestore/CMakeLists.txt includes abseil before setting our compiler flags. * Serialize (and deserialize) bool values (#791) * Require official 1.4.0 for min CocoaPods version (#806) * Disable -Wrange-loop-analysis for abseil (#807) absl includes code like this: ``` void fn(std::initializer_list<absl::string_view> pieces) { ... for (const absl::string_view piece : pieces) total_size += piece.size(); ``` clang objects, suggesting that a reference should be used instead, i.e.: ``` for (const absl::string_view& piece : pieces) total_size += piece.size(); ``` But: a) we don't want to touch absl code b) string_views are cheap to copy (and absl recommends copying string_views rather than taking references as it may result in smaller code) c) some brief, naive benchmarking suggests there's no significant different in this case (i.e. (b) is correct.) Note that -Wrange-loop-analysis is already exlicitly enabled in our cmake build. * Delete stale Firestore instances after FIRApp is deleted. (#809) * replacing FSTGetTokenResult by C++ Token implementation (#805) * replacing Auth/FSTUser by C++ auth implementation * address changes * replacing FSTGetTokenResult by C++ Token implementation * address changes * address changes * fix another const& v.s. dispatch bug * fix more const& v.s. dispatch bug zxu123 committed * fix * passing by value in callback * Fix two stream close issues (b/73167987, b/73382103). (#810) * Fix b/73167987: Upon receiving a permanent write error when we had additional pendingWrites to send, we were restarting the stream with a new delegate and then immediately setting the delegate to nil, causing the stream to ignore all GRPC events for the stream. * Fix b/73382103: We were attempting to gracefully teardown the write stream (i.e. send an empty WriteRequest) even when the stream was already failed due to an error. This caused no harm other than log pollution, but I fixed it. * Use -[GRPCCall setResponseDispatchQueue] to dispatch GRPC callbacks directly onto the Firestore worker queue. This saves a double-dispatch and simplifies our logic. * Add stricter assertions regarding stream state now that dispatch queue / callback filter race conditions are eliminated. * [En|De]codeUnsignedVarint -> [En|De]codeVarint (#817) * [En|De]codeUnsignedVarint -> [En|De]codeVarint The 'unsigned' portion was misleading, as these varints work with both signed and unsigned integers. (The 'signed' varints also work with both signed and unsigned integers, but use zig-zag encoding so that negative numbers are encoded more efficiently. Note that 'signed' varints aren't used in the Value proto, so won't appear in the serializer class for at least the short term.) Added some docstrings to help disambiguate this. * Make FSTTimestamp into a public Firestore class (#698) - FSTTimestamp is now FIRTimestamp, under Firestore/Source/{Public,API}. This is a temporary solution; eventually, FIRTimestamp is supposed to live somewhere under Firebase; - move most internal Timestamp methods to the public header (the only exception is ISOString). * Fix implicit retain self warnings (#808) Xcode has starting warning about us implicitly retaining self references within blocks. This commit fixes it by explicitly mentioning self. No real changes are introduced here; this is effectively just making implicit behaviour explicit. * Accept FIRTimestamp where NSDate is currently accepted as a parameter (#823) * Fix trivial mem leak in the test suite (#828) Reduces noise while running valgrind so that I can see the leaks that I'm introducing. :/ * Serialize (and deserialize) int64 values (#818) (#829) * Avoid wrapping and rewrapping NSStrings when constructing DatabaseId (#833) * Avoid wrapping and rewrapping NSStrings when constructing DatabaseId * Shorten DatabaseId::kDefaultDatabaseId * Fix Firestore tests for M22 (#834) * Add FIRFirestoreTests to the Firestore Xcode project * Avoid waitForExpectations:timeout: This API was added in Xcode 8.3, but we still build production releases with Xcode 8.2. waitForExpectationsWithTimeout:handler: is available from Xcode 7.2. * Add AppForUnitTesting Add a utility for constructing a Firebase App for testing. * Handle the nil UID from FIRAuth * Avoid running CMake tests twice * Only build app_testing on Apple platforms * Revise test.sh messages * Avoid warnings about failing to override a designated initializer (#832) * address PR comments * Refactor [En|De]codeVarint to be symetric wrt tags (#837) Since we can't decode a value before knowing it's type, I've pulled the tag handling out of these methods. More context over here: #829 * Fix lint warnings (#840) * Don't build firebase_firestore_testutil_apple on non-apple platforms. (#841) Was failing the cmake build on linux. * Initial Carthage distribution instructions (#821) I couldn't find a way to get the Carthage installer to install Resources, so withdrawing Firestore and Invites. The other 11 components passed testing. * Update CHANGELOG for release (#845) * improve the documentations on auto init property * adjust the comments * Add build infrastructure for Codable support in Firestore (#815) * Add Firestore_SwiftTests_iOS target to Xcode * Add FirebaseFirestoreSwift podspec * Add Firestore_SwiftTests_iOS to the Podfile * Add CodableGeoPoint and tests * Version FirebaseFirestoreSwift separately * Move -messageWasLogged to FIRTestCase This makes it accessible to other test classes. * Add third-party library version registration This will allow us to collect the version of platform libraries that developers use in conjunction with Firebase. * Fixes clang warnings for Auth (#848) * Fixes clang warnings for Auth * Addresses comments * Revert "Move -messageWasLogged to FIRTestCase" This reverts commit dfda142. * Add tests for useragent Tests a variety of simple use cases. * Auto-style swift sources (#847) * Fix bash style issues * Exclude additional build output directories * Format swift files with scripts/style.sh * Reformat swift sources * Allow swiftformat 0.32.0 on travis * PR feedback * Add FirebaseCore version reporting I've also added clearing of the library names for tests to avoid the auto found versions on load. * Deflake tests * Updating RTDB Changelog for v4.1..5 * Update CHANGELOG.md * Style fixes * Change library name * Update CHANGELOG.md * Update CHANGELOG.md * Add XCode and Apple SDK versions * Update CHANGELOG for Firestore v0.10.2 (#856) * Manually fix clang-format issues * Remove unnecessary nonnull annotations * Update changelog for release (#857) * Updates changelog in preparation for release * Adds another change. * Update Core CHANGELOG for 4.0.16 (#858) * Convert cmake build to (mostly) use urls rather than git clones (#852) Exception: grpc. Due to it's use of git submodules, it's not completely trivial to convert it (though probably wouldn't be too much more work.) This helps address our build being throttled. (Maybe. This assumes github allows more fetching of tgz's than clones.) It should also speed up our build times. The downloaded tarballs are placed into ${PROJECT_BINARY_DIR}/downloads. This allows for eventual caching in travis. * Eliminate TypedValue and serialize direct from FieldValue to bytes. (#860) This will likely only apply for proto messages that use 'oneof's. (Because we need to serialize these manually.) The problem was that as we were adding additional types, TypeValue was evolving into a parallel implementation of the FieldValue union. When serializing/deserializing oneofs we need to supply a custom value to serialize and a custom function to do the work. There's no value in translating from FieldValue to TypeValue just to store as this custom object. We might as well just store the FieldValue model directly and write the custom serializer/deserializer to use the model directly. * replacing Auth by C++ auth implementation (#802) * lazy replacing FST(Firebase)CredentialsProvider by (Firebase)CredentialsProvider * lazy replacing FSTUser by User * adding error-code parameter to TokenListener * actually use const user& instead of pointer; also add an error util * add HashUser and pass into the unordered_map * use User in test * use c++ CredentialsProvider and subclass in test * fix unit test * use explicit capture in lambda instead of capture all by reference * cache currentUser explicitly when reset sync engineer test driver * objc object should be captured by value in lambda * replacing Auth/FSTUser by C++ auth implementation * address changes * replacing FSTGetTokenResult by C++ Token implementation * address changes * fix unintentional change in merging * patch the change in objc Auth up-stream * somehow, the lambda-version of set-user-change-listener does not work... fallback to block * address changes * fix another const& v.s. dispatch bug * fix more const& v.s. dispatch bug zxu123 committed * fix a bad sync line * address changes * address change * address change * fix upstream change from merge * fix upstream changes * Suggested fixes for cpp/port_auth (#846) * Get rid of MockDatastore factory This avoids the need to statically allocate (and leak) a credentials provider * Use absl::make_unique std::make_unique technically does not exist until C++14. * #include <utility> for std::move * Use std::future for the initial user * fix style * Add FieldValue.boolean_value() (#862) * style.sh (for swift) * remove forward declarations for classes that no longer exist
1 parent 607fe11 commit 6cdbc99

File tree

555 files changed

+42653
-4595
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

555 files changed

+42653
-4595
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@ Pods/
5858
Podfile.lock
5959
*.xcworkspace
6060

61+
# Firestore's build configuration, as generated by CocoaPods
62+
Firestore/core/src/firebase/firestore/util/config.h
63+
6164
# CMake
6265
.downloads
6366
Debug

.travis.yml

Lines changed: 36 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,46 @@ before_install:
1212
- gem install xcpretty
1313
- bundle exec pod install --project-directory=Example --repo-update
1414
- bundle exec pod install --project-directory=Firestore/Example --no-repo-update
15+
- brew install clang-format
16+
- brew install swiftformat
17+
- brew install cmake
18+
- brew install go # Somehow the build for Abseil requires this.
19+
- echo "$TRAVIS_COMMIT_RANGE"
20+
- echo "$TRAVIS_PULL_REQUEST"
21+
- |
22+
if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then
23+
SKIP_FIREBASE=0
24+
SKIP_FIRESTORE=0
25+
else
26+
git diff --name-only $TRAVIS_COMMIT_RANGE | grep -Eq '^(Firebase|Example)'
27+
SKIP_FIREBASE="$?"
28+
git diff --name-only $TRAVIS_COMMIT_RANGE | grep -q Firestore
29+
SKIP_FIRESTORE="$?"
30+
fi
1531
1632
script:
17-
- "! git grep -I ' $'" # Fail on trailing whitespace in non-binary files
18-
- ./test.sh
33+
# Fail on trailing whitespace in non-binary, non-generated-nanopb files
34+
- "! git grep -I ' $' ':(exclude)Firestore/Protos/nanopb'"
35+
- "! git grep -EL --name-only 'Copyright [0-9]{4}.*Google' | grep -v third_party | egrep '\\.(m|h|cc|mm|c)$'"
36+
- ./scripts/style.sh test-only # Validate clang-format compliance
37+
- |
38+
if [ $SKIP_FIREBASE != 1 ]; then
39+
./test.sh
40+
fi
41+
- |
42+
if [ $SKIP_FIRESTORE != 1 ]; then
43+
./scripts/lint.sh # Google C++ style compliance
44+
fi
45+
- |
46+
if [ $SKIP_FIRESTORE != 1 ]; then
47+
./Firestore/test.sh
48+
fi
1949
2050
# TODO fix os_log deprecation warning in FIRLogger to remove --allow-warnings
21-
- bundle exec pod lib lint FirebaseCore.podspec --allow-warnings
51+
- |
52+
if [ $SKIP_FIREBASE != 1 ]; then
53+
bundle exec pod lib lint FirebaseCore.podspec --allow-warnings
54+
fi
2255
2356
# TODO - Uncomment subsequent lines once FirebaseCore source repo is in public Specs repo
2457
# - bundle exec pod lib lint FirebaseAuth.podspec

CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@ set(FIREBASE_INSTALL_DIR ${PROJECT_BINARY_DIR})
3737
enable_testing()
3838

3939
include(external/FirebaseCore)
40-
4140
include(external/googletest)
4241
include(external/leveldb)
42+
include(external/grpc)
43+
include(external/protobuf)
44+
include(external/nanopb)
4345
include(external/firestore)

Carthage.md

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# Firebase Carthage
2+
3+
## Context
4+
5+
This page introduces and provides instructions for an **experimental** Firebase
6+
[Carthage](https://github.com/Carthage/Carthage) implementation. Based on
7+
feedback and usage, the Firebase team may decide to make the Carthage
8+
distribution official.
9+
10+
FirebaseFirestore and FirebaseInvites are not yet supported from Carthage.
11+
Please [let us know](https://github.com/firebase/firebase-ios-sdk/issues) if you
12+
have suggestions about how best to distribute Carthage binaries that include
13+
resource bundles.
14+
15+
## Carthage Installation
16+
17+
[Homebrew](http://brew.sh/) is one way to install Carthage.
18+
19+
```bash
20+
$ brew update
21+
$ brew install carthage
22+
```
23+
24+
See the
25+
[Carthage page](https://github.com/Carthage/Carthage#installing-carthage) for
26+
more details and additional installation methods.
27+
28+
## Carthage Usage
29+
30+
- Create a Cartfile with a **subset** of the following components. Note that
31+
**FirebaseAnalytics** must always be included.
32+
```
33+
binary "https://dl.google.com/dl/firebase/ios/carthage/FirebaseABTestingBinary.json"
34+
binary "https://dl.google.com/dl/firebase/ios/carthage/FirebaseAdMobBinary.json"
35+
binary "https://dl.google.com/dl/firebase/ios/carthage/FirebaseAnalyticsBinary.json"
36+
binary "https://dl.google.com/dl/firebase/ios/carthage/FirebaseAuthBinary.json"
37+
binary "https://dl.google.com/dl/firebase/ios/carthage/FirebaseCrashBinary.json"
38+
binary "https://dl.google.com/dl/firebase/ios/carthage/FirebaseDatabaseBinary.json"
39+
binary "https://dl.google.com/dl/firebase/ios/carthage/FirebaseDynamicLinksBinary.json"
40+
binary "https://dl.google.com/dl/firebase/ios/carthage/FirebaseMessagingBinary.json"
41+
binary "https://dl.google.com/dl/firebase/ios/carthage/FirebasePerformanceBinary.json"
42+
binary "https://dl.google.com/dl/firebase/ios/carthage/FirebaseRemoteConfigBinary.json"
43+
binary "https://dl.google.com/dl/firebase/ios/carthage/FirebaseStorageBinary.json"
44+
```
45+
- Run `carthage update`
46+
- Use Finder to open `Carthage/Build/iOS`.
47+
- Copy the contents into the top level of your Xcode project and make sure
48+
they're added to the right build target(s).
49+
- Add the -ObjC flag to "Other Linker Flags".
50+
- Make sure that the build target(s) includes your project's `GoogleService-Info.plist`.
51+
52+
## Versioning
53+
54+
Unlike the CocoaPods distribution, the Carthage distribution is like the
55+
Firebase zip release in that all the Firebase components share the same version.
56+
Mixing and matching components with different versions may cause linker errors.
57+
58+
## Static Frameworks
59+
60+
Note that the Firebase frameworks in the distribution include static libraries.
61+
While it is fine to link these into apps, it will generally not work to depend
62+
on them from wrapper dynamic frameworks.
63+
64+
## Acknowledgements
65+
66+
Thanks to the Firebase community for encouraging this implementation including
67+
those who have made this the most updated
68+
[firebase-ios-sdk](https://github.com/firebase/firebase-ios-sdk)
69+
[issue](https://github.com/firebase/firebase-ios-sdk/issues/9).
70+
71+
Thanks also to those who have already done Firebase Carthage implementations,
72+
such as https://github.com/soheilbm/Firebase.

Example/Core/Tests/FIRAppAssociationRegistrationUnitTests.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
/** @var gCreateNewObject
3535
@brief A block that returns a new object everytime it is called.
3636
*/
37-
static id _Nullable (^gCreateNewObject)() = ^id _Nullable() {
37+
static id _Nullable (^gCreateNewObject)(void) = ^id _Nullable() {
3838
return [[NSObject alloc] init];
3939
};
4040

Example/Core/Tests/FIRAppTest.m

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -596,6 +596,27 @@ - (void)testIsAppConfigured {
596596
XCTAssertFalse([FIRApp isDefaultAppConfigured]);
597597
}
598598

599+
- (void)testIllegalLibraryName {
600+
[FIRApp registerLibrary:@"Oops>" withVersion:@"1.0.0"];
601+
XCTAssertTrue([[FIRApp firebaseUserAgent] isEqualToString:@""]);
602+
}
603+
604+
- (void)testIllegalLibraryVersion {
605+
[FIRApp registerLibrary:@"LegalName" withVersion:@"1.0.0+"];
606+
XCTAssertTrue([[FIRApp firebaseUserAgent] isEqualToString:@""]);
607+
}
608+
609+
- (void)testSingleLibrary {
610+
[FIRApp registerLibrary:@"LegalName" withVersion:@"1.0.0"];
611+
XCTAssertTrue([[FIRApp firebaseUserAgent] containsString:@"LegalName/1.0.0"]);
612+
}
613+
614+
- (void)testMultipleLibraries {
615+
[FIRApp registerLibrary:@"LegalName" withVersion:@"1.0.0"];
616+
[FIRApp registerLibrary:@"LegalName2" withVersion:@"2.0.0"];
617+
XCTAssertTrue([[FIRApp firebaseUserAgent] containsString:@"LegalName/1.0.0 LegalName2/2.0.0"]);
618+
}
619+
599620
#pragma mark - private
600621

601622
- (NSDictionary<NSString *, NSObject *> *)expectedUserInfoWithAppName:(NSString *)name

Example/Core/Tests/FIRLoggerTest.m

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,13 @@
2828

2929
extern const char *kFIRLoggerCustomASLMessageFormat;
3030

31-
extern void FIRResetLogger();
31+
extern void FIRResetLogger(void);
3232

33-
extern aslclient getFIRLoggerClient();
33+
extern aslclient getFIRLoggerClient(void);
3434

35-
extern dispatch_queue_t getFIRClientQueue();
35+
extern dispatch_queue_t getFIRClientQueue(void);
3636

37-
extern BOOL getFIRLoggerDebugMode();
37+
extern BOOL getFIRLoggerDebugMode(void);
3838

3939
// Define the message format again to make sure the format doesn't accidentally change.
4040
static NSString *const kCorrectASLMessageFormat =

Example/Core/Tests/FIROptionsTest.m

Lines changed: 27 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@
2525

2626
@interface FIROptions (Test)
2727

28-
@property(nonatomic, readonly) NSDictionary *analyticsOptionsDictionary;
28+
- (nullable NSDictionary *)analyticsOptionsDictionaryWithInfoDictionary:
29+
(nullable NSDictionary *)infoDictionary;
2930

3031
@end
3132

@@ -127,7 +128,7 @@ - (void)testInitCustomizedOptions {
127128
#pragma clang diagnostic pop
128129
}
129130

130-
- (void)testinitWithContentsOfFile {
131+
- (void)testInitWithContentsOfFile {
131132
NSString *filePath =
132133
[[NSBundle mainBundle] pathForResource:@"GoogleService-Info" ofType:@"plist"];
133134
FIROptions *options = [[FIROptions alloc] initWithContentsOfFile:filePath];
@@ -263,22 +264,20 @@ - (void)testAnalyticsConstants {
263264
}
264265

265266
- (void)testAnalyticsOptions {
266-
id mainBundleMock = OCMPartialMock([NSBundle mainBundle]);
267-
268267
// No keys anywhere.
269268
NSDictionary *optionsDictionary = nil;
270269
FIROptions *options = [[FIROptions alloc] initInternalWithOptionsDictionary:optionsDictionary];
271270
NSDictionary *mainDictionary = nil;
272-
OCMExpect([mainBundleMock infoDictionary]).andReturn(mainDictionary);
273271
NSDictionary *expectedAnalyticsOptions = @{};
274-
XCTAssertEqualObjects(options.analyticsOptionsDictionary, expectedAnalyticsOptions);
272+
NSDictionary *analyticsOptions = [options analyticsOptionsDictionaryWithInfoDictionary:nil];
273+
XCTAssertEqualObjects(analyticsOptions, expectedAnalyticsOptions);
275274

276275
optionsDictionary = @{};
277276
options = [[FIROptions alloc] initInternalWithOptionsDictionary:optionsDictionary];
278277
mainDictionary = @{};
279-
OCMExpect([mainBundleMock infoDictionary]).andReturn(mainDictionary);
280278
expectedAnalyticsOptions = @{};
281-
XCTAssertEqualObjects(options.analyticsOptionsDictionary, expectedAnalyticsOptions);
279+
analyticsOptions = [options analyticsOptionsDictionaryWithInfoDictionary:mainDictionary];
280+
XCTAssertEqualObjects(analyticsOptions, expectedAnalyticsOptions);
282281

283282
// Main has no keys.
284283
optionsDictionary = @{
@@ -288,9 +287,9 @@ - (void)testAnalyticsOptions {
288287
};
289288
options = [[FIROptions alloc] initInternalWithOptionsDictionary:optionsDictionary];
290289
mainDictionary = @{};
291-
OCMExpect([mainBundleMock infoDictionary]).andReturn(mainDictionary);
292290
expectedAnalyticsOptions = optionsDictionary;
293-
XCTAssertEqualObjects(options.analyticsOptionsDictionary, expectedAnalyticsOptions);
291+
analyticsOptions = [options analyticsOptionsDictionaryWithInfoDictionary:mainDictionary];
292+
XCTAssertEqualObjects(analyticsOptions, expectedAnalyticsOptions);
294293

295294
// Main overrides all the keys.
296295
optionsDictionary = @{
@@ -304,9 +303,9 @@ - (void)testAnalyticsOptions {
304303
kFIRIsAnalyticsCollectionEnabled : @NO,
305304
kFIRIsMeasurementEnabled : @NO
306305
};
307-
OCMExpect([mainBundleMock infoDictionary]).andReturn(mainDictionary);
308306
expectedAnalyticsOptions = mainDictionary;
309-
XCTAssertEqualObjects(options.analyticsOptionsDictionary, expectedAnalyticsOptions);
307+
analyticsOptions = [options analyticsOptionsDictionaryWithInfoDictionary:mainDictionary];
308+
XCTAssertEqualObjects(analyticsOptions, expectedAnalyticsOptions);
310309

311310
// Keys exist only in main.
312311
optionsDictionary = @{};
@@ -316,9 +315,9 @@ - (void)testAnalyticsOptions {
316315
kFIRIsAnalyticsCollectionEnabled : @YES,
317316
kFIRIsMeasurementEnabled : @YES
318317
};
319-
OCMExpect([mainBundleMock infoDictionary]).andReturn(mainDictionary);
320318
expectedAnalyticsOptions = mainDictionary;
321-
XCTAssertEqualObjects(options.analyticsOptionsDictionary, expectedAnalyticsOptions);
319+
analyticsOptions = [options analyticsOptionsDictionaryWithInfoDictionary:mainDictionary];
320+
XCTAssertEqualObjects(analyticsOptions, expectedAnalyticsOptions);
322321

323322
// Main overrides single keys.
324323
optionsDictionary = @{
@@ -328,13 +327,13 @@ - (void)testAnalyticsOptions {
328327
};
329328
options = [[FIROptions alloc] initInternalWithOptionsDictionary:optionsDictionary];
330329
mainDictionary = @{ kFIRIsAnalyticsCollectionDeactivated : @NO };
331-
OCMExpect([mainBundleMock infoDictionary]).andReturn(mainDictionary);
332330
expectedAnalyticsOptions = @{
333331
kFIRIsAnalyticsCollectionDeactivated : @NO, // override
334332
kFIRIsAnalyticsCollectionEnabled : @YES,
335333
kFIRIsMeasurementEnabled : @YES
336334
};
337-
XCTAssertEqualObjects(options.analyticsOptionsDictionary, expectedAnalyticsOptions);
335+
analyticsOptions = [options analyticsOptionsDictionaryWithInfoDictionary:mainDictionary];
336+
XCTAssertEqualObjects(analyticsOptions, expectedAnalyticsOptions);
338337

339338
optionsDictionary = @{
340339
kFIRIsAnalyticsCollectionDeactivated : @YES,
@@ -343,13 +342,13 @@ - (void)testAnalyticsOptions {
343342
};
344343
options = [[FIROptions alloc] initInternalWithOptionsDictionary:optionsDictionary];
345344
mainDictionary = @{ kFIRIsAnalyticsCollectionEnabled : @NO };
346-
OCMExpect([mainBundleMock infoDictionary]).andReturn(mainDictionary);
347345
expectedAnalyticsOptions = @{
348346
kFIRIsAnalyticsCollectionDeactivated : @YES,
349347
kFIRIsAnalyticsCollectionEnabled : @NO, // override
350348
kFIRIsMeasurementEnabled : @YES
351349
};
352-
XCTAssertEqualObjects(options.analyticsOptionsDictionary, expectedAnalyticsOptions);
350+
analyticsOptions = [options analyticsOptionsDictionaryWithInfoDictionary:mainDictionary];
351+
XCTAssertEqualObjects(analyticsOptions, expectedAnalyticsOptions);
353352

354353
optionsDictionary = @{
355354
kFIRIsAnalyticsCollectionDeactivated : @YES,
@@ -358,18 +357,18 @@ - (void)testAnalyticsOptions {
358357
};
359358
options = [[FIROptions alloc] initInternalWithOptionsDictionary:optionsDictionary];
360359
mainDictionary = @{ kFIRIsMeasurementEnabled : @NO };
361-
OCMExpect([mainBundleMock infoDictionary]).andReturn(mainDictionary);
362360
expectedAnalyticsOptions = @{
363361
kFIRIsAnalyticsCollectionDeactivated : @YES,
364362
kFIRIsAnalyticsCollectionEnabled : @YES,
365363
kFIRIsMeasurementEnabled : @NO // override
366364
};
367-
XCTAssertEqualObjects(options.analyticsOptionsDictionary, expectedAnalyticsOptions);
365+
analyticsOptions = [options analyticsOptionsDictionaryWithInfoDictionary:mainDictionary];
366+
XCTAssertEqualObjects(analyticsOptions, expectedAnalyticsOptions);
368367
}
369368

370369
- (void)testAnalyticsOptions_combinatorial {
371370
// Complete combinatorial test.
372-
id mainBundleMock = OCMPartialMock([NSBundle mainBundle]);
371+
373372
// Possible values for the flags in the plist, where NSNull means the flag is not present.
374373
NSArray *values = @[ [NSNull null], @NO, @YES ];
375374

@@ -398,6 +397,7 @@ - (void)testAnalyticsOptions_combinatorial {
398397
if (![optionsMeasurementEnabled isEqual:[NSNull null]]) {
399398
optionsDictionary[kFIRIsMeasurementEnabled] = optionsMeasurementEnabled;
400399
}
400+
401401
FIROptions *options =
402402
[[FIROptions alloc] initInternalWithOptionsDictionary:optionsDictionary];
403403
if (![uniqueOptionsCombinations containsObject:optionsDictionary]) {
@@ -415,7 +415,8 @@ - (void)testAnalyticsOptions_combinatorial {
415415
if (![mainMeasurementEnabled isEqual:[NSNull null]]) {
416416
mainDictionary[kFIRIsMeasurementEnabled] = mainMeasurementEnabled;
417417
}
418-
OCMExpect([mainBundleMock infoDictionary]).andReturn(mainDictionary);
418+
419+
// Add mainDictionary to uniqueMainCombinations if it isn't included yet.
419420
if (![uniqueMainCombinations containsObject:mainDictionary]) {
420421
[uniqueMainCombinations addObject:mainDictionary];
421422
}
@@ -427,7 +428,10 @@ - (void)testAnalyticsOptions_combinatorial {
427428
NSMutableDictionary *expectedAnalyticsOptions =
428429
[[NSMutableDictionary alloc] initWithDictionary:optionsDictionary];
429430
[expectedAnalyticsOptions addEntriesFromDictionary:mainDictionary];
430-
XCTAssertEqualObjects(options.analyticsOptionsDictionary, expectedAnalyticsOptions);
431+
432+
NSDictionary *analyticsOptions =
433+
[options analyticsOptionsDictionaryWithInfoDictionary:mainDictionary];
434+
XCTAssertEqualObjects(analyticsOptions, expectedAnalyticsOptions);
431435

432436
combinationCount++;
433437
}

Example/Database/Tests/Integration/FData.m

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -487,7 +487,7 @@ - (void) testLargeNumericKeysDontGetTurnedIntoArrays {
487487
[[ref child:@"100003354884401"] setValue:@"alpha"];
488488

489489
__block BOOL ready = NO;
490-
[ref observeEventType:FIRDataEventTypeValue withBlock:^(FIRDataSnapshot *snapshot) {
490+
[ref observeSingleEventOfType:FIRDataEventTypeValue withBlock:^(FIRDataSnapshot *snapshot) {
491491
id val = [snapshot value];
492492
XCTAssertTrue([val isKindOfClass:[NSDictionary class]], @"Expected a dictionary.");
493493
ready = YES;
@@ -678,6 +678,8 @@ - (void) testSetAndThenListenForValueEventsAreCorrect {
678678
[self waitUntil:^BOOL{
679679
return setDone && calls == 1;
680680
}];
681+
682+
[node removeAllObservers];
681683
}
682684

683685
- (void) testHasChildrenWorksCorrectly {
@@ -878,6 +880,7 @@ - (void) testListenForValueAndThenWriteOnANodeWithExistingData {
878880
[self waitUntil:^BOOL{
879881
return calls == 1;
880882
}];
883+
[reader removeAllObservers];
881884
}
882885

883886
- (void) testSetPriorityOnNonexistentNodeFails {
@@ -2208,6 +2211,7 @@ - (void) testParentDeleteShadowsChildListeners {
22082211
}];
22092212

22102213
WAIT_FOR(done);
2214+
[deleter removeAllObservers];
22112215
}
22122216

22132217
- (void) testParentDeleteShadowsChildListenersWithNonDefaultQuery {

0 commit comments

Comments
 (0)