Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import PackageDescription

let package = Package(
name: "FirebaseDataConnect",
platforms: [.iOS(.v15), .macOS(.v11), .tvOS(.v15), .watchOS(.v8)],
platforms: [.iOS(.v15), .macOS(.v12), .tvOS(.v15), .watchOS(.v8)],
products: [
.library(
name: "FirebaseDataConnect",
Expand Down
8 changes: 4 additions & 4 deletions Sources/BaseOperationRef.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,23 @@

import Foundation

@available(iOS 15.0, macOS 11.0, tvOS 15.0, watchOS 8.0, *)
@available(iOS 15.0, macOS 12.0, tvOS 15.0, watchOS 8.0, *)
public struct OperationResult<ResultData: Decodable> {
public var data: ResultData
}

// notional protocol that denotes a variable.
@available(iOS 15.0, macOS 11.0, tvOS 15.0, watchOS 8.0, *)
@available(iOS 15.0, macOS 12.0, tvOS 15.0, watchOS 8.0, *)
public protocol OperationVariable: Encodable, Hashable, Equatable {}

@available(iOS 15.0, macOS 11.0, tvOS 15.0, watchOS 8.0, *)
@available(iOS 15.0, macOS 12.0, tvOS 15.0, watchOS 8.0, *)
protocol OperationRequest: Hashable, Equatable {
associatedtype Variable: OperationVariable
var operationName: String { get } // Name within Connector definition
var variables: Variable? { get }
}

@available(iOS 15.0, macOS 11.0, tvOS 15.0, watchOS 8.0, *)
@available(iOS 15.0, macOS 12.0, tvOS 15.0, watchOS 8.0, *)
public protocol OperationRef {
associatedtype ResultData: Decodable

Expand Down
2 changes: 1 addition & 1 deletion Sources/CodecHelper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import Foundation
It is only for internal use by Data Connect generated code.

*/
@available(iOS 15.0, macOS 11.0, tvOS 15.0, watchOS 8.0, *)
@available(iOS 15.0, macOS 12.0, tvOS 15.0, watchOS 8.0, *)
public class CodecHelper<K: CodingKey> {
// MARK: Encoding

Expand Down
2 changes: 1 addition & 1 deletion Sources/ConnectorConfig.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

import Foundation

@available(iOS 15.0, macOS 11.0, tvOS 15.0, watchOS 8.0, *)
@available(iOS 15.0, macOS 12.0, tvOS 15.0, watchOS 8.0, *)
public struct ConnectorConfig: Hashable, Equatable {
public private(set) var serviceId: String
public private(set) var location: String
Expand Down
8 changes: 4 additions & 4 deletions Sources/DataConnect.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import FirebaseAppCheck
import FirebaseAuth
import FirebaseCore

@available(iOS 15.0, macOS 11.0, tvOS 15.0, watchOS 8.0, *)
@available(iOS 15.0, macOS 12.0, tvOS 15.0, watchOS 8.0, *)
public class DataConnect {
private var connectorConfig: ConnectorConfig
private var app: FirebaseApp
Expand Down Expand Up @@ -132,7 +132,7 @@ public class DataConnect {
}

// This enum is public so the gen sdk can access it
@available(iOS 15.0, macOS 11.0, tvOS 15.0, watchOS 8.0, *)
@available(iOS 15.0, macOS 12.0, tvOS 15.0, watchOS 8.0, *)
public enum CallerSDKType {
case base // base sdk is directly used
case generated // generated sdk is calling the base
Expand All @@ -142,7 +142,7 @@ public enum CallerSDKType {

// Support for creating or reusing DataConnect instances.
// Instances are keyed by ConnectorConfig and FirebaseApp (projectID)
@available(iOS 15.0, macOS 11.0, tvOS 15.0, watchOS 8.0, *)
@available(iOS 15.0, macOS 12.0, tvOS 15.0, watchOS 8.0, *)
private struct InstanceKey: Hashable, Equatable {
let config: ConnectorConfig
let app: FirebaseApp
Expand All @@ -159,7 +159,7 @@ private struct InstanceKey: Hashable, Equatable {
}
}

@available(iOS 15.0, macOS 11.0, tvOS 15.0, watchOS 8.0, *)
@available(iOS 15.0, macOS 12.0, tvOS 15.0, watchOS 8.0, *)
private class InstanceStore {
let accessQ = DispatchQueue(
label: "firebase.dataconnect.instanceQ",
Expand Down
2 changes: 1 addition & 1 deletion Sources/DataConnectError.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

import Foundation

@available(iOS 15.0, macOS 11.0, tvOS 15.0, watchOS 8.0, *)
@available(iOS 15.0, macOS 12.0, tvOS 15.0, watchOS 8.0, *)
public enum DataConnectError: Error {
// no firebase app specified. configure not complete
case appNotConfigured
Expand Down
2 changes: 1 addition & 1 deletion Sources/DataConnectSettings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

import Foundation

@available(iOS 15.0, macOS 11.0, tvOS 15.0, watchOS 8.0, *)
@available(iOS 15.0, macOS 12.0, tvOS 15.0, watchOS 8.0, *)
public struct DataConnectSettings: Hashable, Equatable {
public private(set) var host: String
public private(set) var port: Int
Expand Down
6 changes: 3 additions & 3 deletions Sources/Internal/CodableHelpers.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

import Foundation

@available(iOS 15.0, macOS 11.0, tvOS 15.0, watchOS 8.0, *)
@available(iOS 15.0, macOS 12.0, tvOS 15.0, watchOS 8.0, *)
protocol CodableConverter {
associatedtype E: Encodable
associatedtype D: Decodable
Expand All @@ -23,7 +23,7 @@ protocol CodableConverter {
func decode(input: D) throws -> E
}

@available(iOS 15.0, macOS 11.0, tvOS 15.0, watchOS 8.0, *)
@available(iOS 15.0, macOS 12.0, tvOS 15.0, watchOS 8.0, *)
class Int64CodableConverter: CodableConverter {
func encode(input: Int64?) throws -> String? {
guard let input else {
Expand All @@ -46,7 +46,7 @@ class Int64CodableConverter: CodableConverter {
}
}

@available(iOS 15.0, macOS 11.0, tvOS 15.0, watchOS 8.0, *)
@available(iOS 15.0, macOS 12.0, tvOS 15.0, watchOS 8.0, *)
class UUIDCodableConverter: CodableConverter {
func encode(input: UUID?) throws -> String? {
guard let input else {
Expand Down
4 changes: 2 additions & 2 deletions Sources/Internal/CodableTimestamp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ private enum TimestampKeys: String, CodingKey {
* Note: this is implemented manually here because the Swift compiler can't synthesize these methods
* when declaring an extension to conform to Codable.
*/
@available(iOS 15.0, macOS 11.0, tvOS 15.0, watchOS 8.0, *)
@available(iOS 15.0, macOS 12.0, tvOS 15.0, watchOS 8.0, *)
extension CodableTimestamp {
public init(from decoder: any Swift.Decoder) throws {
let container = try decoder.singleValueContainer()
Expand Down Expand Up @@ -75,7 +75,7 @@ extension CodableTimestamp {
}

/** Extends Timestamp to conform to Codable. */
@available(iOS 15.0, macOS 11.0, tvOS 15.0, watchOS 8.0, *)
@available(iOS 15.0, macOS 12.0, tvOS 15.0, watchOS 8.0, *)
extension Timestamp: CodableTimestamp {}

class CodableTimestampHelper {
Expand Down
4 changes: 2 additions & 2 deletions Sources/Internal/Codec.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ import Foundation

import SwiftProtobuf

@available(iOS 15.0, macOS 11.0, tvOS 15.0, watchOS 8.0, *)
@available(iOS 15.0, macOS 12.0, tvOS 15.0, watchOS 8.0, *)
typealias FirebaseDataConnectExecuteMutationRequest =
Google_Firebase_Dataconnect_V1beta_ExecuteMutationRequest
typealias FirebaseDataConnectExecuteQueryRequest =
Google_Firebase_Dataconnect_V1beta_ExecuteQueryRequest

@available(iOS 15.0, macOS 11.0, tvOS 15.0, watchOS 8.0, *)
@available(iOS 15.0, macOS 12.0, tvOS 15.0, watchOS 8.0, *)
class Codec {
// Encode Codable to Protos
func encode(args: any Encodable) throws -> Google_Protobuf_Struct {
Expand Down
2 changes: 1 addition & 1 deletion Sources/Internal/Component.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import Foundation

/// Class for registration with the Firebase component system, including userAgent functionality.
@available(iOS 15.0, macOS 11.0, tvOS 15.0, watchOS 8.0, *)
@available(iOS 15.0, macOS 12.0, tvOS 15.0, watchOS 8.0, *)
@objc(FIRDataConnectComponent) class DataConnectComponent: NSObject {
@objc class func sdkVersion() -> String {
return Version.sdkVersion
Expand Down
2 changes: 1 addition & 1 deletion Sources/Internal/FirebaseLogger/DataConnectLogger.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

@available(iOS 15.0, macOS 11.0, tvOS 15.0, watchOS 8.0, *)
@available(iOS 15.0, macOS 12.0, tvOS 15.0, watchOS 8.0, *)
extension FirebaseLogger {
static let dataConnect = FirebaseLogger(category: "data_connect")
}
2 changes: 1 addition & 1 deletion Sources/Internal/FirebaseLogger/FirebaseLogger.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import Foundation
import OSLog

@available(iOS 15.0, macOS 11.0, tvOS 15.0, watchOS 8.0, *)
@available(iOS 15.0, macOS 12.0, tvOS 15.0, watchOS 8.0, *)
public class FirebaseLogger {
let subsystem: String = "com.google.firebase"

Expand Down
4 changes: 2 additions & 2 deletions Sources/Internal/GrpcClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ import NIOPosix
import OSLog
import SwiftProtobuf

@available(iOS 15.0, macOS 11.0, tvOS 15.0, watchOS 8.0, *)
@available(iOS 15.0, macOS 12.0, tvOS 15.0, watchOS 8.0, *)
typealias FirebaseDataConnectAsyncClient =
Google_Firebase_Dataconnect_V1beta_ConnectorServiceAsyncClient

@available(iOS 15.0, macOS 11.0, tvOS 15.0, watchOS 8.0, *)
@available(iOS 15.0, macOS 12.0, tvOS 15.0, watchOS 8.0, *)
actor GrpcClient: CustomStringConvertible {
nonisolated let description: String

Expand Down
2 changes: 1 addition & 1 deletion Sources/Internal/OperationsManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

import Foundation

@available(iOS 15.0, macOS 11.0, tvOS 15.0, watchOS 8.0, *)
@available(iOS 15.0, macOS 12.0, tvOS 15.0, watchOS 8.0, *)
class OperationsManager {
private var grpcClient: GrpcClient

Expand Down
2 changes: 1 addition & 1 deletion Sources/Internal/Version.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import Foundation

import GoogleUtilities_Environment

@available(iOS 15.0, macOS 11.0, tvOS 15.0, watchOS 8.0, *)
@available(iOS 15.0, macOS 12.0, tvOS 15.0, watchOS 8.0, *)
struct Version {
static let sdkVersion = "11.3.0-beta"

Expand Down
4 changes: 2 additions & 2 deletions Sources/MutationRef.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

import Foundation

@available(iOS 15.0, macOS 11.0, tvOS 15.0, watchOS 8.0, *)
@available(iOS 15.0, macOS 12.0, tvOS 15.0, watchOS 8.0, *)
struct MutationRequest<Variable: OperationVariable>: OperationRequest {
private(set) var operationName: String
private(set) var variables: Variable?
Expand All @@ -25,7 +25,7 @@ struct MutationRequest<Variable: OperationVariable>: OperationRequest {
}
}

@available(iOS 15.0, macOS 11.0, tvOS 15.0, watchOS 8.0, *)
@available(iOS 15.0, macOS 12.0, tvOS 15.0, watchOS 8.0, *)
public class MutationRef<ResultData: Decodable, Variable: OperationVariable>: OperationRef {
private var request: any OperationRequest

Expand Down
4 changes: 2 additions & 2 deletions Sources/OptionalVarWrapper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

import Foundation

@available(iOS 15.0, macOS 11.0, tvOS 15.0, watchOS 8.0, *)
@available(iOS 15.0, macOS 12.0, tvOS 15.0, watchOS 8.0, *)
@propertyWrapper
public struct OptionalVariable<Value> where Value: Encodable {
public private(set) var isSet = false
Expand Down Expand Up @@ -44,7 +44,7 @@ public struct OptionalVariable<Value> where Value: Encodable {
}
}

@available(iOS 15.0, macOS 11.0, tvOS 15.0, watchOS 8.0, *)
@available(iOS 15.0, macOS 12.0, tvOS 15.0, watchOS 8.0, *)
extension OptionalVariable: Encodable {
public func encode(to encoder: Encoder) throws {
if isSet {
Expand Down
12 changes: 6 additions & 6 deletions Sources/QueryRef.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ import Foundation
import Combine
import Observation

@available(iOS 15.0, macOS 11.0, tvOS 15.0, watchOS 8.0, *)
@available(iOS 15.0, macOS 12.0, tvOS 15.0, watchOS 8.0, *)
public enum ResultsPublisherType {
case auto // automatically determine ObservableQueryRef
case observableObject // pre-iOS 17 ObservableObject
case observableMacro // iOS 17+ Observation framework
}

@available(iOS 15.0, macOS 11.0, tvOS 15.0, watchOS 8.0, *)
@available(iOS 15.0, macOS 12.0, tvOS 15.0, watchOS 8.0, *)
struct QueryRequest<Variable: OperationVariable>: OperationRequest, Hashable, Equatable {
private(set) var operationName: String
private(set) var variables: Variable?
Expand Down Expand Up @@ -61,13 +61,13 @@ struct QueryRequest<Variable: OperationVariable>: OperationRequest, Hashable, Eq
}
}

@available(iOS 15.0, macOS 11.0, tvOS 15.0, watchOS 8.0, *)
@available(iOS 15.0, macOS 12.0, tvOS 15.0, watchOS 8.0, *)
public protocol QueryRef: OperationRef {
// This call starts query execution and publishes data
func subscribe() async throws -> AnyPublisher<Result<ResultData, DataConnectError>, Never>
}

@available(iOS 15.0, macOS 11.0, tvOS 15.0, watchOS 8.0, *)
@available(iOS 15.0, macOS 12.0, tvOS 15.0, watchOS 8.0, *)
actor GenericQueryRef<ResultData: Decodable, Variable: OperationVariable>: QueryRef {
private var resultsPublisher = PassthroughSubject<Result<ResultData, DataConnectError>,
Never>()
Expand Down Expand Up @@ -113,7 +113,7 @@ actor GenericQueryRef<ResultData: Decodable, Variable: OperationVariable>: Query
}
}

@available(iOS 15.0, macOS 11.0, tvOS 15.0, watchOS 8.0, *)
@available(iOS 15.0, macOS 12.0, tvOS 15.0, watchOS 8.0, *)
public protocol ObservableQueryRef: QueryRef {
// results of fetch.
var data: ResultData? { get }
Expand All @@ -126,7 +126,7 @@ public protocol ObservableQueryRef: QueryRef {
// data: Published variable that contains bindable results of the query.
// lastError: Published variable that contains DataConnectError if last fetch had error.
// If last fetch was successful, this variable is cleared
@available(iOS 15.0, macOS 11.0, tvOS 15.0, watchOS 8.0, *)
@available(iOS 15.0, macOS 12.0, tvOS 15.0, watchOS 8.0, *)
public class QueryRefObservableObject<
ResultData: Decodable,
Variable: OperationVariable
Expand Down
8 changes: 4 additions & 4 deletions Sources/Scalars/AnyValue.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import Foundation

/// AnyValue represents the Any graphql scalar, which represents Codable data - scalar data (Int,
/// Double, String, Bool,...) or a JSON object
@available(iOS 15.0, macOS 11.0, tvOS 15.0, watchOS 8.0, *)
@available(iOS 15.0, macOS 12.0, tvOS 15.0, watchOS 8.0, *)
public struct AnyValue {
public private(set) var value: Data

Expand All @@ -36,7 +36,7 @@ public struct AnyValue {
}
}

@available(iOS 15.0, macOS 11.0, tvOS 15.0, watchOS 8.0, *)
@available(iOS 15.0, macOS 12.0, tvOS 15.0, watchOS 8.0, *)
extension AnyValue: Codable {
public init(from decoder: any Decoder) throws {
let singleValueContainer = try decoder.singleValueContainer()
Expand All @@ -49,14 +49,14 @@ extension AnyValue: Codable {
}
}

@available(iOS 15.0, macOS 11.0, tvOS 15.0, watchOS 8.0, *)
@available(iOS 15.0, macOS 12.0, tvOS 15.0, watchOS 8.0, *)
extension AnyValue: Equatable {
public static func == (lhs: Self, rhs: Self) -> Bool {
return lhs.value == rhs.value
}
}

@available(iOS 15.0, macOS 11.0, tvOS 15.0, watchOS 8.0, *)
@available(iOS 15.0, macOS 12.0, tvOS 15.0, watchOS 8.0, *)
extension AnyValue: Hashable {
public func hash(into hasher: inout Hasher) {
hasher.combine(value)
Expand Down
8 changes: 4 additions & 4 deletions Sources/Scalars/LocalDate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import Foundation

Essentially represents: https://the-guild.dev/graphql/scalars/docs/scalars/local-date
*/
@available(iOS 15.0, macOS 11.0, tvOS 15.0, watchOS 8.0, *)
@available(iOS 15.0, macOS 12.0, tvOS 15.0, watchOS 8.0, *)
public struct LocalDate: Codable, Equatable, Comparable, CustomStringConvertible {
private var calendar = Calendar(identifier: .gregorian)
private var dateFormatter = DateFormatter()
Expand Down Expand Up @@ -76,7 +76,7 @@ public struct LocalDate: Codable, Equatable, Comparable, CustomStringConvertible
}
}

@available(iOS 15.0, macOS 11.0, tvOS 15.0, watchOS 8.0, *)
@available(iOS 15.0, macOS 12.0, tvOS 15.0, watchOS 8.0, *)
public extension LocalDate {
init(from decoder: any Decoder) throws {
let container = try decoder.singleValueContainer()
Expand All @@ -96,7 +96,7 @@ public extension LocalDate {

// MARK: Equatable, Comparable

@available(iOS 15.0, macOS 11.0, tvOS 15.0, watchOS 8.0, *)
@available(iOS 15.0, macOS 12.0, tvOS 15.0, watchOS 8.0, *)
public extension LocalDate {
static func < (lhs: LocalDate, rhs: LocalDate) -> Bool {
return lhs.date < rhs.date
Expand All @@ -109,7 +109,7 @@ public extension LocalDate {

// MARK: Hashable

@available(iOS 15.0, macOS 11.0, tvOS 15.0, watchOS 8.0, *)
@available(iOS 15.0, macOS 12.0, tvOS 15.0, watchOS 8.0, *)
extension LocalDate: Hashable {
public func hash(into hasher: inout Hasher) {
hasher.combine(date)
Expand Down
2 changes: 1 addition & 1 deletion Tests/Integration/AnyScalarTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import XCTest
import FirebaseCore
@testable import FirebaseDataConnect

@available(iOS 15.0, macOS 11.0, tvOS 15.0, watchOS 8.0, *)
@available(iOS 15.0, macOS 12.0, tvOS 15.0, watchOS 8.0, *)
final class AnyScalarTests: IntegrationTestBase {
override func setUp(completion: @escaping ((any Error)?) -> Void) {
Task {
Expand Down
Loading