Commit Graph
53 Commits
Author SHA1 Message Date
cherylEnkidu 315221fe5b Export FirebaseCore.Timestamp in Firestore files to reduce the breakage of moving Timestamp (#13292) 2024-07-16 19:44:08 -04:00
cherylEnkidu 3de44b7ab7 Move Timestamp class from Firestore to Firebase Core (#13221) 2024-07-12 16:19:35 -04:00
Nick Cooke cf1b9419ea [Firestore] Remove FirestoreSwift (#13085) 2024-06-06 17:16:04 -04:00
Sheikh Bayazid e8a12e04c2 Improve/use shorthand syntax for unwrapping optionals and fix typos (#12369) 2024-05-03 08:50:20 -07:00
Andrew Heard 9af2a9d0d1 [Firestore] Remove DocumentID setter warning (#12756) 2024-04-17 10:30:46 -04:00
Evan Cooper d264312411 Add FirebaseSource to ReadDecodable extensions of DocumentReference (#12401) 2024-02-22 10:55:58 -08:00
Paul Beusterien 0fe8385fe6 Remove unnecessary compiler checks for Concurrency support (#12232) 2024-01-03 07:04:02 -08:00
Paul Beusterien 4d2b60dc75 Updated to SwiftFormat 0.52.10 (#12125) 2023-11-21 12:12:05 -08:00
Nick Cooke 992dd55adc [Firestore] Consolidate Firestore and FirestoreSwift (Post-Rollback) (#11954) 2023-10-19 19:52:20 -04:00
Nick Cooke 0c8d1433b8 Revert "[Firestore] Consolidate Firestore and FirestoreSwift (#11806)" (#11939) 2023-10-13 22:01:34 +00:00
Nick Cooke a7e3720e9e [Firestore] Consolidate Firestore and FirestoreSwift (#11806) 2023-10-13 14:52:29 -04:00
ae871b9dc1 Update to swiftformat 0.51.12 (#11531)
Co-authored-by: Andrew Heard <andrewheard@google.com>
Co-authored-by: Nick Cooke <nickcooke@google.com>
2023-07-11 15:54:51 -07:00
Eskil Gjerde Sviggum dbdd950b40 Add @discardableResult to addDocument (#10661) 2023-01-13 13:45:12 -05:00
Paul Beusterien a2ea36c317 Restore 9.x Firestore Data Codable behavior (#10598) 2022-12-21 07:53:21 -08:00
Peter Friese dc34af68f9 DocumentId property wrapper: Emit error message on a single line (#10289)
* Emit error message on a single line

* Wrap value in quotes
2022-09-29 13:34:08 -04:00
Nick Cooke 71972ab0e8 [Firebase 10] Revamp FIRLogger for Swift use (#10286)
* [Firebase 10] Revamp FIRLogger for Swift use

* Fix test impl and only run firebasepod.yml

* re-enable actions

* Implement logger

* Global TAP

* Revert .pbxproj

* Call directly to GULs

* Review

* Undo API breaks

* [skip ci] Avoid NS_SWIFT_NAME due to macro collisions
This fixes the warning that broke the Auth x watchOS job.

* [skip ci] Revert Gemfile
2022-09-28 22:13:47 -04:00
8866b22f89 Firestore: Make @DocumentID value setter private (#10167)
* Firestore: Make @DocumentID value setter private

Updated the `DocumentID` Swift property wrapper's `value` property to be private(set) since it is ignored in the methods that write to Firestore.

* Make initializer private

* Fix formatting

* Fix tests

Made the setter internally accessible and imported FirebaseFirestoreSwift with @testable.

* Add a changelog entry and formatting fixes

* Documentation fixes

* [skip ci] Add runtime warnings to `@DocumentID` setter and initializer (#10275)

* [Firestore] Mark `@DocumentID` setter deprecated and add log statement in init

* Fix typo in import

* Update CHANGELOG

* Review and remove deprecation

* Review and add FIRLogWarningSwift

* Add FirebaseCorExtension to Firestore's Podfile

* [skip ci] Fix merged comment

Co-authored-by: Nick Cooke <36927374+ncooke3@users.noreply.github.com>
Co-authored-by: Nick Cooke <nickcooke@google.com>
2022-09-28 01:42:30 -04:00
Morgan Chen faa4488c63 Address PR feedback for Firestore Codable (#10270)
* Address PR feedback for Firestore Codable

* revert error message change
2022-09-28 01:14:58 -04:00
Andrew Heard 79f9cba743 [Firestore] Remove encoding/decoding strategy type aliases (#10273)
Removed the `Firestore.Encoder` and `Firestore.Decoder` encoding/decoding strategy type aliases and directly used the types from `FirebaseDataEncoder` and `FirebaseDataDecoder`.

Note: This requires the `TimestampEncoding/DecodingStrategy` extension to be added to `FirebaseDataEncoder/Decoder` instead of `Firestore.Encoder` and `Firestore.Decoder`. This will make the `timestamp` strategy visible to all users of the `FirebaseDataEncoder/Decoder` (that have FirestoreSwift installed), even though `Timestamp` is a Firestore-specific type.
2022-09-27 22:29:50 -04:00
Morten Bek Ditlevsen 65f6cfa0bf Make Firestore use FirebaseDataEncoder and FirebaseDataDecoder (re-implementation of #8858) (#9465) 2022-09-23 09:09:39 -07:00
Ryan Wilson 73279db127 Enable async/await APIs for iOS 13, etc. (#9540)
* Enable async/await APIs for iOS 13, etc.

This bumps the required compiler version to 5.5.2 which was included in
Xcode 13.2, where backporting was first introduced.

This breaks less developers and enables developers who aren't using
these APIs to still compile using Xcode 13.0 and 13.1.

As far as I can tell, the only breakage this includes now is developers
who are using Xcode 13.0 or 13.1, targeting iOS 15 and using one of
these 7 APIs. It will result in a compiler error and they'll have to
either use the completion handler version or upgrade to Xcode 13.2+ to
fix the compilation error.

* Missed checks, CHANGELOG

* Fixed avialability, added watchOS for RTDB

* Moved to watchOS 7 for all async/await APIs to match platform support
2022-04-01 09:56:33 -04:00
Morten Bek Ditlevsen 7cf4247faf Renamed variable to avoid symbol resolution ambiguity with Xcode 12.4 (#9438) 2022-03-10 06:50:15 -08:00
Morten Bek Ditlevsen a1dde8ee68 Require explicit typing for DocumentSnapshot decoding. DocumentReference decoding. (#9101) 2022-02-22 17:39:58 -07:00
Paul Beusterien 5e8790d78a Update to SwiftFormat 0.49.2 (#9239) 2022-01-21 13:03:15 -08:00
Paul Beusterien a08cf2c5fb FirestoreSwift: swift version update and pod lib lint testing (#8752) 2021-10-07 13:13:01 -07:00
Gil 8d9243454b Add DocumentSnapshot.data(as:with:decoder:) (#6334)
This adds support for specifying alternative server timestamp behaviors
when decoding snapshots.

Fixes #6328.
2021-02-04 16:03:00 -08:00
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