Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
4 changes: 1 addition & 3 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@
import class Foundation.ProcessInfo
import PackageDescription

// let firebaseVersion = "10.25.0"

let package = Package(
name: "FirebaseDataConnect",
platforms: [.iOS(.v12), .macCatalyst(.v13), .macOS(.v10_15), .tvOS(.v13), .watchOS(.v7)],
Expand All @@ -32,7 +30,7 @@ let package = Package(
],
dependencies: [
.package(url: "https://github.com/firebase/firebase-ios-sdk",
from: "11.0.0"),
branch: "nc/demo-reg"),
.package(
url: "https://github.com/grpc/grpc-swift.git",
from: "1.19.1" // TODO: Constrain to a range at time of release
Expand Down
1 change: 1 addition & 0 deletions Sources/DataConnectSettings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import Foundation

@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
public struct DataConnectSettings: Hashable, Equatable {
static let version = "11.3.0-beta"
public private(set) var host: String
public private(set) var port: Int
public private(set) var sslEnabled: Bool
Expand Down
23 changes: 23 additions & 0 deletions Sources/Internal/Component.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// 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.

import Foundation

/// Class for registration with the Firebase component system, including userAgent functionality.
@available(macOS 10.15, iOS 13, tvOS 13, watchOS 6, *)
@objc(FIRDataConnectComponent) class DataConnectComponent: NSObject {
@objc class func sdkVersion() -> String {
return DataConnectSettings.version
}
}
43 changes: 43 additions & 0 deletions Tests/Unit/UserAgentTests.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
// 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.

import Foundation
import XCTest

import FirebaseCore
@testable import FirebaseDataConnect

final class UserAgentTests: XCTestCase {
static var defaultApp: FirebaseApp?

static var options: FirebaseOptions = {
let options = FirebaseOptions(googleAppID: "0:0000000000000:ios:0000000000000000",
gcmSenderID: "00000000000000000-00000000000-000000000")
options.projectID = "fdc-test"
options.apiKey = "testDummyApiKey"
return options
}()

override class func setUp() {
FirebaseApp.configure(options: options)
defaultApp = FirebaseApp.app()
}

/// Confirm that Data Connect gets added to the user agent.
func testUserAgent() {
let userAgent = FirebaseApp.firebaseUserAgent()
let version = DataConnectSettings.version
XCTAssertTrue(userAgent.contains("fire-dc/\(version)"))
}
}