Commit Graph
33 Commits
Author SHA1 Message Date
zxu a441190635 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
2018-02-06 13:51:11 -05:00
Gil 729b8d176c 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
2018-01-31 11:23:55 -08:00
Greg Soltis 70d401d483 Listen sequence numbers (#675)
* Generate and save sequence numbers for listens

* Add documentation

* Fix include path

* Fix unavailable comment

* Review feedback
2018-01-17 12:23:45 -08:00
Michael Lehenbauer a8f7e20050 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.
2018-01-11 17:13:00 -08:00
Greg Soltis 275b4e5a76 Log pending writes when we disable the network (#604)
* Log pending writes when we disable the network

* Fix formatting

* Formatting
2018-01-02 14:03:07 -08:00
Michael Lehenbauer faca4ea11b Rename all the onlineStateChanged methods to applyChangedOnlineState. (#574) 2017-12-19 16:05:20 -08:00
zxu 9ddf3637ac Firestore isEqual() on Public Types (#569)
* add bone code for new isEqual and unit test for old isEqual

*   add bone code for `FIRCollectionReference`, `FIRDocumentSnapshot`, `FIRFieldValue`, `FIRQuerySnapshot`, `FIRSnapshotMetadata`;
*   change inconsistenciness of `FIRFieldPath.isEqual` implementation;
*   add unit test (and file) for `FIRDocumentReferenceTest.m`, `FIRFieldPathTest.m`, `FIRQueryTests.testEquals`; `FIRGeoPoint` already has test and Blob is internal type.

* Implement isEqual for FIRCollectionReference

adding the working code and unit test.

* implement isEqual for FIRSnapshotMetadata

* Implement isEqual for FIRDocumentSnapshot

* Implement isEqual for FIRQuerySnapshot

* (un)implement `isEqual` for `FIRFieldValue`

Since `FIRFieldValue` both types are singleton, we do not need override `isEqual`. Add test to test the default `NSObject` `isEqual` works just fine.

* fix style with `scripts/style.sh`

* Implement hash for those with overridden isEqual without hash yet.

* refactor to use test helper functions -- FSTTestFirestore, FSTTestPath, FSTTestDocKey

* refactor using test helper `FSTTestDocSnapshot`, `FSTTestFieldPath`, `FSTTestQuery`, `FSTTestDoc`

* refactoring to use test helper method `FSTTestQuerySnapshot`,

* remove unneccessary nil-check, check isKindOfClass instead of isEqual

* refactoring: adding `FSTAPIHelpers.{h,m}`, `FSTTest{Collection,Document}Ref`,  better naming and style fix

* a file forgot in last commit

* mainly clean up import and some minor refactoring

* fix style via style.sh

* minor style fix

* add pragma ignored -Wnonnull
2017-12-19 13:47:04 -05:00
Greg Soltis 52c7329f2a Expose network management (#566)
* Expose network management in public API

* Clean up a few more references to the internal access of network management

* Move test

* Update comments

* Swap _Nullable for nullable

* Fix comment

* Add tests, including swift

* Styling
2017-12-18 18:50:08 -08:00
Michael Lehenbauer 8db0eb618d Test cleanup: Adds a helper for waiting for FSTVoidErrorBlock callbacks.
* Add helper for waiting for FSTVoidErrorBlock callbacks.
* Remove errorEventHandler from FSTEventAccumulator.h too.
* Add synchronous enableNetwork / disableNetwork helpers.
* Workaround for batch writes test flakiness.
2017-12-18 14:21:11 -08:00
Michael Lehenbauer d4de7a6e86 b/68276665: Raise isFromCache=true events when offline (#567)
* Plumbs FSTOnlineState changes through to views.
* View sets this.current to false on FSTOnlineStateFailed, triggering
	isFromCache=true events. It will automatically be returned to true
	once the listen is reestablished and we get a new CURRENT message.
* Updated tests (and added one new one) to verify behavior.
* Unifies setOnlineStateToUnknown, setOnlineStateToHealthy, and
	updateAndBroadcastOnlineState into a single updateOnlineState
	method.
* Split disableNetwork into (public) disableNetwork and
	(private) disableNetworkWithTargetOnlineState methods..
* Some miscellaneous comment cleanup.

* Add missing comment per CR feedback.
2017-12-15 14:56:03 -08:00
zxu 4daf75d372 Merge pull request #514 from firebase/zxu/logoffline
Warn user if we raise with empty while not online
2017-12-07 09:05:02 -05:00
zxu123 125cdc78c6 refactoring the condition when to warn offline 2017-12-06 16:16:22 -05:00
zxu123 ef2a0a2acf implement log warning for offline status
*   Move the logic from FSTEventManager to FSTRemoteStore. Pros: per query vs per stream.
*   Since state can go into unknown normally (e.g. no listener is registered and nobody care the status), we only warns when status is actually offline to avoid confusion.
2017-12-05 11:42:31 -05:00
Paul Beusterien ed3e4982f9 Standardize cross module imports with angle bracket syntax (#526)
Qualify all cross-pod imports of FirebaseCore headers
2017-12-04 08:52:11 -08:00
Sebastian Schmidt 4da1d25ac5 Merge pull request #522 from firebase/mrschmidt-crash
Ignoring stream messages for closed streams
2017-12-01 12:30:52 -08:00
Sebastian Schmidt 7db1fc5bee Ignoring stream messages for closed streams 2017-12-01 11:54:22 -08:00
Sebastian Schmidt 7c7da198ee Merge pull request #510 from firebase/mrschmidt-crash
Fixing race in FSTWriteStream
2017-12-01 11:26:01 -08:00
Sebastian Schmidt d200fe09ef Checking for stream close in handleStreamClose 2017-11-30 13:29:26 -08:00
Gil 530437ea7a Move sources into firebase::firestore and internal namespaces (#494)
* Move sources into firebase::firestore and internal namespaces

Combine support and core/util packages; this distinction wasn't really
paying its freight.
2017-11-30 12:26:16 -08:00
Sebastian Schmidt df76451b31 Fixing tests 2017-11-29 21:27:08 -08:00
Sebastian Schmidt e0dbc1240b Merge branch 'master' into mrschmidt-crash 2017-11-29 17:23:47 -08:00
Sebastian Schmidt 5db88f1661 Fixing race in FSTWriteStream 2017-11-29 17:23:07 -08:00
Gil 8c4cd9d541 Change FSTExponentialBackoff to use firestore::SecureRandom directly (#492)
* Migrate FSTExponentialBackoff to Objective-C++

* Change FSTExponentialBackoff to use firestore::SecureRandom directly
2017-11-27 12:05:23 -08:00
Gil 4fbc96904f Use fully qualified imports in Firestore (#467)
This simplifies the import process back into google3 and allows us to add additional directories to the project without needing to update the project files for each directory we add. This shows up most clearly in the change to Firestore/Example/Firestore.xcodeproj/project.pbxproj: this no longer needs to list essentially every directory in the project as a header search path.

* Clang-format configuration for C++ files
* Add support C++-only sources to the podspec
* Podspec support for fully qualified imports
* xcodeproj changes for fully-qualified imports
* Use fully-qualified imports in Firestore sources
2017-11-16 20:52:01 -08:00
Sebastian Schmidt 9044d2ce21 Sending an empty write request before tearing down the stream (#438) 2017-11-08 17:04:41 -08:00
Sebastian Schmidt f9b2f91da1 Moving the Stream class to their own file (#418) 2017-10-31 12:32:32 -07:00
Sebastian Schmidt 02ff6bbee9 Closing the write and watch stream after 60s of idleness (#388) 2017-10-30 18:17:16 -07:00
Michael Lehenbauer 838ee80218 b/67423356: Exponential backoff on writes should back off until the first successful write (#408)
Port the logic from Android / web to delay backoff reset until the first successful write on the stream.
2017-10-26 13:57:26 -07:00
Sebastian Schmidt 8bdce1dfa4 Moving the StreamTest to integration tests (#391) 2017-10-24 12:57:56 -07:00
Michael Lehenbauer aab276a2c8 Port of fix for b/67042460 (retry more often before considering client offline) (#403)
This ensures FSTRemoteStore always tries to connect at least twice before surfacing an FSTOnlineStateFailed
event to external code (which may trigger gets to fail, cached data to be surfaced, etc.).
2017-10-23 10:10:34 -07:00
Sebastian Schmidt ae171bb226 Adding goOnline/goOffline to the RemoteStore (#347) 2017-10-11 04:51:05 +02:00
Paul Beusterien b2a169f08a Fix warnings exposed by Xcode 9.1 in Firestore source (#354) 2017-10-09 13:41:39 -07:00
Gil bde743ed25 Release 4.3.0 (#327)
Initial release of Firestore at 0.8.0
Bump FirebaseCommunity to 0.1.3
2017-10-03 08:55:22 -07:00