Commit Graph
27 Commits
Author SHA1 Message Date
Gil 73fcb194d8 Add conditional conformance to Hashable to Firestore property wrapper types (#6249)
* Remove the extension that makes NSDate ServerTimestampWrappable.

This turns out not to actually work because NSDate does not conform to
Codable. Users can supply their own extensions that make NSDate conform
to Codable and also supply an extension like this one to make NSDate
conform to ServerTimestampWrappable.

Add a test that verifies ServerTimestamps of Dates actually work. The
equivalent test for NSDate does not compile.

* Fix minimum Swift version for FirebaseFirestoreSwift

FirebaseFirestoreSwift was already using synthesized Equatable and
Hashable conformance which requires Swift 4.1.

* Add conditional conformance to Hashable to Firestore property wrapper types

Mark these types as conforming to Hashable if the underlying type itself
conforms to hashable. This implementation relies on synthesized
Equatable and Hashable conformance that shipped as a part of Swift 4.1.

* Fix lint/style

* Changelog
2020-08-12 10:26:57 -04:00
Gil c04334ae0a Remove the extension that makes NSDate ServerTimestampWrappable. (#6247)
This turns out not to actually work because NSDate does not conform to
Codable. Users can supply their own extensions that make NSDate conform
to Codable and also supply an extension like this one to make NSDate
conform to ServerTimestampWrappable.

Add a test that verifies ServerTimestamps of Dates actually work. The
equivalent test for NSDate does not compile.
2020-08-10 15:42:50 -07:00
Paul Beusterien eabe8d46a0 Update and apply swiftformat fix (#6239) 2020-08-09 14:48:00 -07:00
Paul Beusterien 01bf549253 Update formatters (#5933) 2020-06-26 14:34:27 -07:00
Lorenzo Fiamingo 9f17a76e82 Spelling error in FirestoreDecodingError (#5520) 2020-05-12 13:53:48 -07:00
Paul Beusterien b90ddf1339 Limit Swift line lengths to 100 (#5315) 2020-04-08 10:48:24 -07:00
Gil 53e91860e0 Rewrite SelfDocumentID as a property wrapper (#4031)
* Rewrite SelfDocumentID as a property wrapper

Make wrapped types conform to DocumentReferenceConvertible and use that
protocol to implement the conversion.

* Change DocumentReferenceConvertible to DocumentIDWrappable

* Make ServerTimestampWrappable use static functions

Use the same form as DocumentIDWrappable.

* Update extension String: ServerTimestampWrappable

* Use #if compiler, not #if swift

The FirebaseFirestoreSwift module is declared as conforming to Swift
4.0 so #if swift is still false, even when compiling with Swift 5.1.
Using #if compiler will see the actual compiler version. Property
wrappers don't depend on runtime features, so this works.

Also, allow Wrappable protocols to throw during conversions.
2019-10-15 12:59:36 -07:00
Gil 0733736c5e Rewrite ServerTimestamp as a property wrapper (#4003)
* Move ServerTimestamp into its own file

* Rewrite ServerTimestamp as a property wrapper

Add Swift4ServerTimestamp that behaves as before.

* Make ServerTimestampWrappable dictate timestamp conversion.

This makes the @ServerTimestamp property wrapper completely open to
extension by end users too.
2019-10-08 10:11:28 -07:00
Gil 847d72759d Fix formatting that was somehow ignored (#4002)
* Fix formatting that somehow was ignored.

* Minor tweaks to style.sh

... reflecting updated source layout.
2019-10-07 09:10:47 -07:00
Gil 7235f8f6f6 Rewrite ExplicitNull as a propertyWrapper (#3954)
Add Swift4ExplicitNull that behaves as before.
2019-10-02 16:47:49 -07:00
Gil 228537cb66 Provide better error messages when encoding is not available (#3953)
* Rewrite FirestoreEncoderTests using assertThat

* Throw invalidValue for use of invalid top-level values

* Provide an message for not supported errors
2019-10-01 10:04:52 -07:00
Marek Gilbert 16885d21f4 Migrate to encoders in third_party/FirestoreEncoder 2019-09-26 12:02:04 -07:00
wu-hui b45bd79ec3 Add @DocumentId equivalent to Swift Codable (#3762)
* Commit with failed optional test case.

* Integration Test and cleanup

* swiftformat

* better doc formatting

* addressing comments

* rename to SelfDocumentID

* Addressing Comments

* fix comment
2019-09-26 12:02:04 -07:00
Hui-Wu d709b9f2b5 Allow firestore api to work with Codable objects + ExplicitNull + Integration tests (#3261)
* Convinience api for codables

* Integration Tests

* ExplicitNull implementation
2019-09-26 12:02:04 -07:00
Morgan Chen 390966620a Fix token fetch not invoking callback for unchanged token (#3251) 2019-09-26 12:02:04 -07:00
Hui-Wu 34023c30ea FieldValue and DocumentReference codable support. (#3231)
* working serverTimestamp

* working FieldValue. Still need: document ref and ability to Eq of FieldValue

* DocumentReference implemented and testing works

* clean up header search path

* improving FieldValue enum comments

* run through formatting

* addressing comments

* formatted with swiftformat 0.35.7

* add missing bool->BOOL change

* undo unintended swift version change

* remove unwanted proj file change
2019-09-26 12:02:03 -07:00
Hui-Wu 5fdfc9d413 Firestore swift Codable support (#3198)
FirestoreEncoder/Decoder and Timestamp/GeoPoint codable support.
2019-09-26 12:02:03 -07:00
wu-hui 9b0d5a3b1a Add @DocumentId equivalent to Swift Codable (#3762)
* Commit with failed optional test case.

* Integration Test and cleanup

* swiftformat

* better doc formatting

* addressing comments

* rename to SelfDocumentID

* Addressing Comments

* fix comment
2019-09-06 09:26:59 -04:00
wu-hui c8c2c21d7b Add optional value to ExplicitNull and ServerTimestamp (#3784)
* Add optional value to ExplicitNull and ServerTimestamp

* Fixing comments

* another comment fix
2019-09-06 07:49:28 -04:00
Gil 3a2077f1e4 Fixes for the Codable API (#3734)
* Annotate Transaction and WriteBatch methods as discardable

These methods exist to allow chaining if that's useful but chaining
isn't expected or required.

Note that Objective-C methods in these types are implicitly
@discardableResult and don't need any extra help.

* No need to explicitly discard results

* Fix typos in FIRCollectionReference docs

* Add support for CollectionReference.addDocument(from:)
2019-09-02 16:40:21 -07:00
Greg Ennis ee88e5c8a1 Allow decoding Timestamp as a Date (#3588)
* Allow decoding Timestamp as a Date

* Added comment from PR feedback
2019-08-14 17:00:52 -04:00
Hui-Wu 13671fda27 Allow firestore api to work with Codable objects + ExplicitNull + Integration tests (#3261)
* Convinience api for codables

* Integration Tests

* ExplicitNull implementation
2019-06-28 15:07:52 -04:00
Morgan Chen d6af8615e2 Fix token fetch not invoking callback for unchanged token (#3251) 2019-06-25 10:47:59 -07:00
Hui-Wu d723fc49f2 FieldValue and DocumentReference codable support. (#3231)
* working serverTimestamp

* working FieldValue. Still need: document ref and ability to Eq of FieldValue

* DocumentReference implemented and testing works

* clean up header search path

* improving FieldValue enum comments

* run through formatting

* addressing comments

* formatted with swiftformat 0.35.7

* add missing bool->BOOL change

* undo unintended swift version change

* remove unwanted proj file change
2019-06-24 16:18:30 -04:00
Hui-Wu 1de21a845f Firestore swift Codable support (#3198)
FirestoreEncoder/Decoder and Timestamp/GeoPoint codable support.
2019-06-19 10:00:17 -04:00
christibbs c8899e294d Firebase In-app messaging callbacks (#2354)
* FIRInAppMessagingDisplayMessage and FIRInAppMessagingDisplayDelegate refactor + downstream changes

* More downstream changes from FIRInAppMessagingDisplayDelegate, calling through to app-side delegate from default display executor

* Add delegate property on FIRInAppMessaging

* Display SDK changes to pass through in app message with callbacks

* Headless SDK unit test refactoring

* Display test app downstream changes

* Pull in headless SDK in display app, no need to have this come in as a framework anymore

* Run scripts/style.sh

* Remove WIP test

* Refactor FIRIAMDIsplayExecutor to take an InAppMessaging object for testing

* Depend on FirebaseAnalyticsInterop in UI test app

* File imports for FIRInAppMessaging files

* Remove FirebaseInAppMessaging imports
2019-02-08 14:20:27 -08:00
Gil 13e3667384 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
2018-02-26 08:09:28 -08:00