Commit Graph
103 Commits
Author SHA1 Message Date
Sebastian Schmidt d13a51abac Allowing field deletes using merge fields (#1389) 2018-06-07 13:57:01 -07:00
Michael Lehenbauer 0ec836f9ca b/79432277: Limit Queries to only a single array-contains clause. (#1286) 2018-05-16 17:05:33 -07:00
Michael Lehenbauer 8409f21830 Backport array contains / transform improvements from Web. (#1242) 2018-05-08 15:33:10 -07:00
Michael Lehenbauer e91de9258a b/78539022: Fix test at risk of range violation errors depending on time-of-day. (#1213)
micros could underflow or overflow if the test was run at the wrong time... Replaced with hardcoded timestamps as I don't think making it time-dependent gains us interesting additional coverage.
2018-05-02 14:54:51 -07:00
Sebastian Schmidt 542d81ac68 Adding mergeFields support (#1141) 2018-05-02 11:10:19 -07:00
Michael Lehenbauer e4384c3e80 Array Contains Queries (not added to public headers yet). (#1138) 2018-04-23 10:03:55 -07:00
Michael Lehenbauer 7dca635039 Move array transforms to internal header pending backend support. (#1139) 2018-04-20 14:48:59 -07:00
zxu 5d3c76f543 fix integration test (#1134) 2018-04-18 15:59:08 -04:00
rsgowman a5b3185ed3 Add GetOptions for controlling offline get behaviour (#655)
Add option to allow the user to control where DocumentReference.getDocument() and CollectionReference.getDocuments() fetches from. By default, it fetches from the server (if possible) and falls back to the local cache. It's now possible to alternatively fetch from the local cache only, or to fetch from the server only (though in the server only case, latency compensation is still enabled).
2018-04-18 10:30:37 -04:00
Michael Lehenbauer e36cc9610b Integration tests, changelog, and minor fixes for array transforms. (#1108) 2018-04-17 15:55:29 -07:00
Gil a25d054874 Replace the SnapshotOptions object with the behavior enum. (#1109)
Instead of calling

  `get(field, SnapshotOptions.serverTimestampBehavior(.estimate))`

call

  `get(field, serverTimestampBehavior: .estimate)`
2018-04-16 13:50:11 -07:00
Gil 4de2d80e43 Replace QueryListenOptions with simple booleans (#1106)
* Replace `QueryListenOptions` with simple booleans

Instead of calling

  addSnapshotListener(
      options:QueryListenOptions.includeQueryMetadataChanges()
                                .includeDocumentMetadataChanges())

call

  addSnapshotListener(includeMetadataChanges:true)

Also change `QuerySnapshot.documentChanges()` into a method which
optionally takes `includeMetadataChanges:true`. By default even when
listening to a query with `inlcudeMetadataChanges:true` metadata-only
document changes are suppressed because they're confusing.

* Revert QuerySnapshot.documentChanges back to a property

Add usage.
2018-04-15 16:56:43 -07:00
Gil 5368c9e22f Replace the SetOptions object with a simple boolean. (#1098)
Instead of calling

  `setData(["a": "b"], options: SetOptions.merge())`

call

  `setData(["a": "b"], merge: true)`
2018-04-15 13:06:06 -07:00
Gil 33b12f6c70 Replace DocumentListenOptions with a simple boolean. (#1099)
* Replace `DocumentListenOptions` with a simple boolean.

Instead of calling

  `addSnapshotListener(options: DocumentListenOptions.includeMetadataChanges(true))`

call

  `addSnapshotListener(includeMetadataChanges:true)`

* Style
2018-04-14 17:19:06 -07:00
Michael Lehenbauer c2d4d3a9cf Small cleanup to UserDataConverter / FieldValue sentinel code to make adding more FieldValue sentinels easier. (#1077)
Port of https://github.com/firebase/firebase-js-sdk/commit/b14678002bf6e8cc9ebd7561efbafe29315ceb8e and https://github.com/firebase/firebase-js-sdk/commit/b14678002bf6e8cc9ebd7561efbafe29315ceb8e.
2018-04-12 13:50:02 -07:00
Konstantin Varlamov a17740e914 Add a flag to control whether DocumentSnapshots return Dates or Timestamps for timestamp fields (#831)
* add a new property `timestampsInSnapshotsEnabled` to `FirestoreSettings`, `false` by default;
* add a verbose warning message urging users to opt into the new behavior;
* set `timestampsInSnapshotsEnabled` to true in the integration tests to reduce the verbose console
spam during the test run and make sure the flag won't break anything once it's flipped.
2018-03-30 14:50:15 -04:00
zxu 9e815620e9 grand PR to port the remaining paths (FieldPath and ResourcePath). (#865)
* naively remove FSTPath import and source/test files.

* port FieldPath, part I

* port FieldPath, part II

* port ResourcePath, part I

* port ResourcePath, part II

* the grand commit to fix build errors

* use testutil:: helper instead of those from FSTHelpers

* fix test and lint

* use c_str in errmsg directly

* fix

* fix

* make code clean

* fix integration test I missed

* fix to avoid naming collision in preprocessor

* address changes

* address changes

* address changes

* fix: fieldMask are actually shared with different context.

* address changes

* address changes
2018-03-14 08:57:31 -04:00
Konstantin Varlamov 50f9df9240 Accept FIRTimestamp where NSDate is currently accepted as a parameter (#823) 2018-02-21 15:36:23 -05:00
Konstantin Varlamov 14ea068f5f 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).
2018-02-20 17:33:57 -05:00
Michael Lehenbauer 81ee594e32 DispatchQueue delayed callback improvements + testing (#784)
Basically a port of https://github.com/firebase/firebase-js-sdk/commit/a1e346ff93c6cbcc0a1b3b33f0fbc3a7b66e7e12 and https://github.com/firebase/firebase-js-sdk/commit/fce4168309f42aa038125f39818fbf654b65b05f

* 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.
2018-02-15 16:17:44 -08: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
Michael Lehenbauer da506b86bc Fix issue @morganchen12 discovered where we weren't properly creating FIRQueryDocumentSnapshot instances. (#662) 2018-01-12 15:54:42 -08:00
rsgowman 1bafdb4ce5 Fix FSTLocalDocumentsView to allow multiple mutations while offline (#644)
* Fix FSTLocalDocumentsView to allow multiple mutations while offline.

Previously, only the last mutation would actually be visible.
2018-01-11 08:50:49 -08:00
Michael Lehenbauer dc0b29e9cf Run style.sh (#636)
Run style.sh (w/ clang-format version 6)
2018-01-10 09:28:44 -08:00
Sebastian Schmidt ed6c6f9fea Fixing potential race in ServerTimestamp tests 2018-01-05 10:34:38 -08:00
Gil 52cdf0b25a Clean up warnings (#578)
* Clean up warnings
* Remove optional parens around ifs
2017-12-18 21:05:07 -08: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
Sebastian Schmidt 31b90e6ea8 Fixing return type of verifySnapshotWithResolvedTimestamps
This should address a crash that happens when a debugger is attached
2017-12-18 14:07:30 -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
Sebastian Schmidt e006383cda Merge 2017-12-12 08:15:20 +08:00
Sebastian Schmidt e019a9461a Merge branch 'firestore-api-changes' into mrschmidt-timestamps 2017-12-12 08:03:59 +08:00
Sebastian Schmidt fe4783838e Addressing comments 2017-12-12 07:59:44 +08:00
Sebastian Schmidt 5b1ca51e72 Addressing comments 2017-12-12 07:11:39 +08:00
zxu 54ba423c87 Revisit commit method in FIRWriteBatch (#541)
* revisit FIRWriteBatch commit

*   make commitWithCompletion completion nullable;
*   add commit;
*   add unit test;
*   add swift build test for commit;
*   update CHANGELOG.
2017-12-11 15:37:01 -05:00
Sebastian Schmidt 23ee2aaf46 Clang format 2017-12-10 23:51:45 -08:00
Sebastian Schmidt bc179ea4ea Making DocumentSnapshot nullable 2017-12-10 14:40:22 -08:00
Sebastian Schmidt a2f9591f60 Fixing comment 2017-12-08 14:11:19 -08:00
Sebastian Schmidt 84e7f27a3f Adding default option 2017-12-08 14:02:23 -08:00
Sebastian Schmidt bf48b0abc1 Method renames 2017-12-07 19:54:08 -08:00
Sebastian Schmidt 904a141217 Addressing all review comments 2017-12-07 16:03:40 -08:00
zxu 5da88e4b9b Implement NSPredicate-based query (#531)
*   implement queryFilteredUsingPredicate in FIRQuery;
*   add unit test and integration test for queryFilteredUsingPredicate;
*   project change of adding the FIRQueryTests.m file;
*   refactoring queryFilteredUsingPredicate to split logic into two helpers;
2017-12-07 15:36:15 -05:00
Sebastian Schmidt a8948ced26 Adding SnapshotOptions to deal with pending ServerTimestamps 2017-12-05 23:22:16 -08:00
Paul Beusterien 3e592526ec Buildable and interoperable source pods (#444) 2017-11-21 17:02:22 -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 02ff6bbee9 Closing the write and watch stream after 60s of idleness (#388) 2017-10-30 18:17:16 -07:00
Sebastian Schmidt 642d304e23 Allowing field deletes with merge-enabled sets (#404) 2017-10-23 11:32:25 -07:00
Michael Lehenbauer 024788e38a Add isEqual() and port DocumentReference array test. (#380)
* Ports the test for the fix I made for Android for DocumentReference objects in arrays (bug not present in iOS).
* Implements isEqual on FIRQuery and FIRDocumentReference.
2017-10-19 08:23:25 -07:00
Gil a64495a33b Fix validation of nested arrays to allow indirect nesting (#377) 2017-10-16 15:56:19 -07:00
Sebastian Schmidt ae171bb226 Adding goOnline/goOffline to the RemoteStore (#347) 2017-10-11 04:51:05 +02:00