修改pods
This commit is contained in:
@@ -14,6 +14,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
@_exported import class FirebaseCore.Timestamp
|
||||
|
||||
import FirebaseSharedSwift
|
||||
import Foundation
|
||||
|
||||
@@ -29,6 +31,7 @@ struct FirestorePassthroughTypes: StructureCodingPassthroughTypeResolver {
|
||||
t is GeoPoint ||
|
||||
t is Timestamp ||
|
||||
t is FieldValue ||
|
||||
t is DocumentReference
|
||||
t is DocumentReference ||
|
||||
t is VectorValue
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
@_exported import FirebaseFirestoreInternal
|
||||
#endif // SWIFT_PACKAGE
|
||||
|
||||
@_implementationOnly import FirebaseCoreExtension
|
||||
internal import FirebaseCoreExtension
|
||||
import FirebaseSharedSwift
|
||||
|
||||
extension CodingUserInfoKey {
|
||||
@@ -113,7 +113,7 @@ public struct DocumentID<Value: DocumentIDWrappable & Codable>:
|
||||
private var value: Value? = nil
|
||||
|
||||
public init(wrappedValue value: Value?) {
|
||||
if let value = value {
|
||||
if let value {
|
||||
logIgnoredValueWarning(value: value)
|
||||
}
|
||||
self.value = value
|
||||
@@ -121,18 +121,13 @@ public struct DocumentID<Value: DocumentIDWrappable & Codable>:
|
||||
|
||||
public var wrappedValue: Value? {
|
||||
get { value }
|
||||
set {
|
||||
if let someNewValue = newValue {
|
||||
logIgnoredValueWarning(value: someNewValue)
|
||||
}
|
||||
value = newValue
|
||||
}
|
||||
set { value = newValue }
|
||||
}
|
||||
|
||||
private func logIgnoredValueWarning(value: Value) {
|
||||
FirebaseLogger.log(
|
||||
level: .warning,
|
||||
service: "[FirebaseFirestoreSwift]",
|
||||
service: "[FirebaseFirestore]",
|
||||
code: "I-FST000002",
|
||||
message: """
|
||||
Attempting to initialize or set a @DocumentID property with a non-nil \
|
||||
@@ -146,7 +141,7 @@ public struct DocumentID<Value: DocumentIDWrappable & Codable>:
|
||||
|
||||
extension DocumentID: DocumentIDProtocol {
|
||||
init(from documentReference: DocumentReference?) throws {
|
||||
if let documentReference = documentReference {
|
||||
if let documentReference {
|
||||
value = try Value.wrap(documentReference)
|
||||
} else {
|
||||
value = nil
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
private protocol CodableDocumentReference: Codable {}
|
||||
|
||||
/**
|
||||
* DocumentReference's codable implmentation will just throw for most
|
||||
* DocumentReference's codable implementation will just throw for most
|
||||
* encoder/decoder however. It is only meant to be encoded by Firestore.Encoder/Firestore.Decoder.
|
||||
*/
|
||||
extension CodableDocumentReference {
|
||||
@@ -50,4 +50,4 @@ extension CodableDocumentReference {
|
||||
}
|
||||
}
|
||||
|
||||
extension DocumentReference: CodableDocumentReference {}
|
||||
extension FirebaseFirestore.DocumentReference: FirebaseFirestore.CodableDocumentReference {}
|
||||
|
||||
@@ -93,7 +93,7 @@ public extension Firestore {
|
||||
|
||||
public func decode<T: Decodable>(_ t: T.Type, from data: Any,
|
||||
in reference: DocumentReference?) throws -> T {
|
||||
if let reference = reference {
|
||||
if let reference {
|
||||
userInfo[CodingUserInfoKey.documentRefUserInfoKey] = reference
|
||||
}
|
||||
return try decode(T.self, from: data)
|
||||
|
||||
@@ -47,7 +47,7 @@ extension ExplicitNull: Hashable where Value: Hashable {}
|
||||
extension ExplicitNull: Encodable where Value: Encodable {
|
||||
public func encode(to encoder: Encoder) throws {
|
||||
var container = encoder.singleValueContainer()
|
||||
if let value = value {
|
||||
if let value {
|
||||
try container.encode(value)
|
||||
} else {
|
||||
try container.encodeNil()
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
#endif // SWIFT_PACKAGE
|
||||
|
||||
/** Extends FieldValue to conform to Encodable. */
|
||||
extension FieldValue: Encodable {
|
||||
extension FirebaseFirestore.FieldValue: Swift.Encodable {
|
||||
/// Encoding a FieldValue will throw by default unless the encoder implementation
|
||||
/// explicitly handles it, which is what Firestore.Encoder does.
|
||||
public func encode(to encoder: Encoder) throws {
|
||||
|
||||
@@ -63,4 +63,4 @@ extension CodableGeoPoint {
|
||||
}
|
||||
|
||||
/** Extends GeoPoint to conform to Codable. */
|
||||
extension GeoPoint: CodableGeoPoint {}
|
||||
extension FirebaseFirestore.GeoPoint: FirebaseFirestore.CodableGeoPoint {}
|
||||
|
||||
@@ -14,11 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#if SWIFT_PACKAGE
|
||||
@_exported import FirebaseFirestoreInternalWrapper
|
||||
#else
|
||||
@_exported import FirebaseFirestoreInternal
|
||||
#endif // SWIFT_PACKAGE
|
||||
@_exported import class FirebaseCore.Timestamp
|
||||
|
||||
/// A type that can initialize itself from a Firestore Timestamp, which makes
|
||||
/// it suitable for use with the `@ServerTimestamp` property wrapper.
|
||||
@@ -98,7 +94,7 @@ public struct ServerTimestamp<Value>: Codable
|
||||
|
||||
public func encode(to encoder: Encoder) throws {
|
||||
var container = encoder.singleValueContainer()
|
||||
if let value = value {
|
||||
if let value {
|
||||
try container.encode(Value.unwrap(value))
|
||||
} else {
|
||||
try container.encode(FieldValue.serverTimestamp())
|
||||
@@ -109,3 +105,5 @@ public struct ServerTimestamp<Value>: Codable
|
||||
extension ServerTimestamp: Equatable where Value: Equatable {}
|
||||
|
||||
extension ServerTimestamp: Hashable where Value: Hashable {}
|
||||
|
||||
extension ServerTimestamp: Sendable where Value: Sendable {}
|
||||
|
||||
@@ -14,11 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#if SWIFT_PACKAGE
|
||||
@_exported import FirebaseFirestoreInternalWrapper
|
||||
#else
|
||||
@_exported import FirebaseFirestoreInternal
|
||||
#endif // SWIFT_PACKAGE
|
||||
@_exported import class FirebaseCore.Timestamp
|
||||
|
||||
/**
|
||||
* A protocol describing the encodable properties of a Timestamp.
|
||||
@@ -63,4 +59,4 @@ extension CodableTimestamp {
|
||||
}
|
||||
|
||||
/** Extends Timestamp to conform to Codable. */
|
||||
extension Timestamp: CodableTimestamp {}
|
||||
extension FirebaseCore.Timestamp: FirebaseFirestore.CodableTimestamp {}
|
||||
|
||||
@@ -14,12 +14,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import Foundation
|
||||
#if SWIFT_PACKAGE
|
||||
@_exported import FirebaseFirestoreInternalWrapper
|
||||
#else
|
||||
@_exported import FirebaseFirestoreInternal
|
||||
#endif // SWIFT_PACKAGE
|
||||
@_exported import class FirebaseCore.Timestamp
|
||||
|
||||
import FirebaseSharedSwift
|
||||
|
||||
public extension FirebaseDataDecoder.DateDecodingStrategy {
|
||||
|
||||
@@ -14,11 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#if SWIFT_PACKAGE
|
||||
@_exported import FirebaseFirestoreInternalWrapper
|
||||
#else
|
||||
@_exported import FirebaseFirestoreInternal
|
||||
#endif // SWIFT_PACKAGE
|
||||
@_exported import class FirebaseCore.Timestamp
|
||||
|
||||
import FirebaseSharedSwift
|
||||
import Foundation
|
||||
|
||||
61
Pods/FirebaseFirestore/Firestore/Swift/Source/Codable/VectorValue+Codable.swift
generated
Normal file
61
Pods/FirebaseFirestore/Firestore/Swift/Source/Codable/VectorValue+Codable.swift
generated
Normal file
@@ -0,0 +1,61 @@
|
||||
/*
|
||||
* Copyright 2024 Google LLC
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#if SWIFT_PACKAGE
|
||||
@_exported import FirebaseFirestoreInternalWrapper
|
||||
#else
|
||||
@_exported import FirebaseFirestoreInternal
|
||||
#endif // SWIFT_PACKAGE
|
||||
|
||||
/**
|
||||
* A protocol describing the encodable properties of a VectorValue.
|
||||
*/
|
||||
private protocol CodableVectorValue: Codable {
|
||||
var array: [Double] { get }
|
||||
|
||||
init(__array: [NSNumber])
|
||||
}
|
||||
|
||||
/** The keys in a Timestamp. Must match the properties of CodableTimestamp. */
|
||||
private enum VectorValueKeys: String, CodingKey {
|
||||
case array
|
||||
}
|
||||
|
||||
/**
|
||||
* An extension of VectorValue that implements the behavior of the Codable protocol.
|
||||
*
|
||||
* Note: this is implemented manually here because the Swift compiler can't synthesize these methods
|
||||
* when declaring an extension to conform to Codable.
|
||||
*/
|
||||
extension CodableVectorValue {
|
||||
public init(from decoder: Decoder) throws {
|
||||
let container = try decoder.container(keyedBy: VectorValueKeys.self)
|
||||
let data = try container.decode([Double].self, forKey: .array)
|
||||
|
||||
let array = data.map { double in
|
||||
NSNumber(value: double)
|
||||
}
|
||||
self.init(__array: array)
|
||||
}
|
||||
|
||||
public func encode(to encoder: Encoder) throws {
|
||||
var container = encoder.container(keyedBy: VectorValueKeys.self)
|
||||
try container.encode(array, forKey: .array)
|
||||
}
|
||||
}
|
||||
|
||||
/** Extends VectorValue to conform to Codable. */
|
||||
extension FirebaseFirestore.VectorValue: FirebaseFirestore.CodableVectorValue {}
|
||||
Reference in New Issue
Block a user