* Move the util::objc namespace to just objc
This removes all the namespace objc = firebase::firestore::util::objc
gunk to make it seem as if this was really the arrangement.
This is motivated by wanting to put additional things in this namespace
and use them in headers without having to use util::objc::Foo
* Add CMake support for header-only cc_library targets
* Have the linter allow #include <objc/objc.h>, a C header
use namespace aliases instead.
This makes the Objective-C code much more like what it's going to end up
being like when translated to C++: headers will include classes declared
in a namespace relative to firebase::firestore so everything else will
be named relative to firebase::firestore.
Meanwhile the using statements in the headers were causing us to miss
adding using statements in source files which was moving us away from
where we wanted to be.
* Test that shows a leak.
* Add EventListener to match Android.
* Use AsyncEventListener in FSTQueryListenerTests
* Remove FSTAsyncQueryListener
* Use EventListener throughout
Also eliminate most usages of `FSTDocumentKey`, remove most methods from the Objective-C class and make it just a wrapper over `DocumentKey`. The only usage that cannot be directly replaced by C++ `DocumentKey` is in `FSTFieldValue`.
* replace all references to `FSTDispatchQueue` and `FSTTimerID` with their C++ equivalents;
* remove `FSTDispatchQueue` class and related tests;
* in method argument names, replace `workerDispatchQueue` with just `workerQueue`, more similar to other platforms;
* move `Executor` and derived classes out of `internal` namespace.
* Revert "Revert "gRPC: replace Objective-C implementation with the new C++ implementation (#1968)" (#2030)"
This reverts commit ea567dca47.
* gRPC: fix bugs found during testing (#2039)
All in `GrpcStream`:
* make sure there are no pending completions when "finish" operation is enqueued;
* always finish gRPC calls;
* when connectivity changes, reset not just the calls, but the underlying channel as well.
* Revert "Partially revert "Update CHANGELOG for Firestore v0.14.0 (#2025)" (#2031)"
This reverts commit b2437b80f6.
* Update changelog for v0.15.0.
* gRPC: add gRPC wrapper classes to CMake build (#2015)
* add a C++ equivalent of `FIRFirestoreVersionString`. This eliminates the only Objective-C dependency of `grpc_connection.mm` and allows making it a pure C++ file;
* open-source `binary_to_array.py` script and use it in the build to embed `roots.pem` certificate file from gRPC into the Firestore binary. The embedded char array is then used to load certificate at runtime.
* Revert local change -- do not enable sanitizers by default
* add support for SSL disabled to `GrpcConnection` (unfortunately, there
currently is no way to verify this change actually works);
* make gRPC calls using the C++ implementation:
* make `FSTRemoteStore` create C++ streams instead of their Objective-C
counterparts;
* port https://github.com/firebase/firebase-js-sdk/pull/1041: streams
are now never recreated, only restarted;
* make `FSTDatastore` delegate server calls to the C++ implementation;
* port `MockWatchStream` and `MockWriteStream` to C++ (`FSTMockDatastore` is
still in place, because `Datastore` is not fully ported yet);
* no longer generate Objective-C gRPC service definitions from protos;
* remove all references to Objective-C gRPC client;
* check in gRPC root certificates file and load it at runtime (the check-in part
is temporary until gRPC-C++.podspec provides the certificate). This makes SSL
work.
[Port of https://github.com/firebase/firebase-js-sdk/pull/1120]
Fixes#1499.
This reworks our "user listener" into a "credential change listener" that
fires on any token change, even if the User did not change. This allows
us to restart our streams (but not switch mutation queues, etc.) on token
changes.
* Switch to reference delegates for garbage collection (#1410)
* Bump sequence number on resume token refresh
* Style
* Fix comment formatting
* Add FSTReferenceDelegate definition and documentation
* Add methods to return nil for delegates, wire up inMemoryPins
* Add hook for removing a reference
* Start work on reference delegates
* Fix up tests to support adding documents at a sequence number
* Implement removing references
* Remove from target when dropped from local view
* Fix warning
* Add hooks for removal from mutation queue
* Add hooks for limbo document updates
* Style
* Drop commented-out code
* Fixup after merging master
* Start importing delegate implementations
* Memory LRU tests pass
* Make memory lru work, start fixing up lru tests. All with hidden sequence numbers
* Most LRU tests passing w/ memory
* Big LRU test passes w/ memory
* Leveldb LRU tests pass
* All passing except local store tests
* All tests pass
* Fix localstore tests
* Revert removeQueryData change
* Remove collectGarbage calls
* Remove NoOp GC
* More cleanup
* Refactor FSTHelpers
* Cleanup and commenting
* Comments and cleanup
* Comments
* Drop nullable for reference delegates, and old persistence method on spec tests
* Fix missing sequence bump, remove unneeded targetID
* Style
* Drop commented-out code
* Satisfy the linters and copyrighters, etc.
* Drop more commented-out code
* Fix import -> include, NSUInteger -> int
* Start work on test comments
* FSTDocumentKey -> DocumentKey
* Sample of LRU test refactor (#1424)
* Sample of test refactor
* Drop errant 'struct' keyword
* More test refactoring
* Make gc a member variable too
* Tests refactored to use member variables
* Assign delegates procedurally, rather than passing in a block
* Fix up FSTLevelDB a little
* listens -> listenTargets
* Rename GCEnabled
* remove isSentinel
* reword comment
* Add case for non-eager GC to test
* Style
* Cleaning the lint trap
* Clean up LRU tests (#1433)
* Add copious helpers and some docs to lru tests
* Style
* Method name refactor, add comment
* Drop FSTGarbageCollector and FSTEagerGarbageCollector (#1440)
* Drop FSTGarbageCollector and FSTEagerGarbageCollector
* Drop unused containsKey from FSTLevelDBMutationQueue
* Style
* Include sequence number in FSTQueryData hash and isEqual (#1568)
* Include sequence number in FSTQueryData hash and isEqual methods
* Style
* Switch to util::Hash
* Fix preserving query cache metadata (#1569)
* Add failing test
* Move the restart tests to the leveldb test suite
* Style
* Add new persistence test helper
* Fix test failure
* Review feedback
* Style
* remove conversions in `Local` and `Remote`
* replace `FSTSnapshotVersion` in `Model`
* replace `FSTSnapshotVersion` in the rest
* let test check equal with C++ equal
* fix newly added code
* address changes
* lint.sh now lints Objective-C++ too
* cpplint checks system-style includes that should be user-style
This prevents it from recognizing project sources as if they were C
system headers and then complaining that they're in the wrong place.
* cpplint checks #imports and #includes
* cpplint checks that C++ system headers aren't #imported
* cpplint checks for C system headers that could be C++ system headers
* cpplint checks that Objective-C sources include their headers
[Port of https://github.com/firebase/firebase-js-sdk/commit/0fa319e5e019dd0d40ab441d2ff9f8f6d4724e43]
* Refactored FSTOnlineState tracking out of FSTRemoteStore and into new
FSTOnlineStateTracker component.
* Added a 10 second timeout to transition from OnlineState.Unknown to
OnlineState.Offline rather than waiting indefinitely for the stream to
succeed or fail.
* Removed hack to run SpecTests using an FSTDispatchQueue that wrapped
dispatch_get_main_queue(). This was incompatible with [FSTDispatchQueue
runDelayedCallbacksUntil:] since it queues work and blocks waiting for
it to complete. Now spec tests create / use a proper FSTDispatchQueue.
* Added a SpecTest to verify OnlineState timeout behavior.
* Misc cleanup:
* Renamed FSTOnlineState states: Failed => Offline, Healthy => Online
* Renamed FSTTimerIds (ListenStreamConnection => ListenStreamConnectionBackoff)
* Added ability to run timers from spec tests.
* 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
* 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