Skip to content

Commit e04cb62

Browse files
authored
Initial commit of Firebase Sessions SDK (#10285)
1 parent a10bbca commit e04cb62

File tree

3 files changed

+101
-0
lines changed

3 files changed

+101
-0
lines changed

FirebaseCore/Sources/FIRApp.m

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -822,6 +822,7 @@ + (void)registerSwiftComponents {
822822
// Dictionary of class names that conform to `FIRLibrary` and their user agents. These should only
823823
// be SDKs that are written in Swift but still visible to ObjC.
824824
NSDictionary<NSString *, NSString *> *swiftComponents = @{
825+
@"FIRSessions" : @"fire-sessions",
825826
@"FIRFunctionsComponent" : @"fire-fun",
826827
@"FIRStorageComponent" : @"fire-str",
827828
};

FirebaseSessions.podspec

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
Pod::Spec.new do |s|
2+
s.name = 'FirebaseSessions'
3+
s.version = '10.0.0'
4+
s.summary = 'Firebase Sessions'
5+
6+
s.description = <<-DESC
7+
Not for public use.
8+
SDK for sending events for Firebase App Quality Sessions.
9+
DESC
10+
11+
s.homepage = 'https://firebase.google.com'
12+
s.license = { :type => 'Apache-2.0', :file => 'LICENSE' }
13+
s.authors = 'Google, Inc.'
14+
15+
s.source = {
16+
:git => 'https://github.com/firebase/firebase-ios-sdk.git',
17+
:tag => 'CocoaPods-' + s.version.to_s
18+
}
19+
s.social_media_url = 'https://twitter.com/Firebase'
20+
21+
ios_deployment_target = '11.0'
22+
osx_deployment_target = '10.13'
23+
tvos_deployment_target = '12.0'
24+
watchos_deployment_target = '6.0'
25+
26+
s.swift_version = '5.3'
27+
28+
s.ios.deployment_target = ios_deployment_target
29+
s.osx.deployment_target = osx_deployment_target
30+
s.tvos.deployment_target = tvos_deployment_target
31+
s.watchos.deployment_target = watchos_deployment_target
32+
33+
s.cocoapods_version = '>= 1.4.0'
34+
s.prefix_header_file = false
35+
36+
s.source_files = "FirebaseSessions/Sources/**/*.swift"
37+
38+
s.dependency 'FirebaseCore', '~> 10.0'
39+
s.dependency 'FirebaseCoreExtension', '~> 10.0'
40+
s.dependency 'FirebaseInstallations', '~> 10.0'
41+
42+
s.pod_target_xcconfig = {
43+
'GCC_C_LANGUAGE_STANDARD' => 'c99',
44+
'HEADER_SEARCH_PATHS' => '"${PODS_TARGET_SRCROOT}"'
45+
}
46+
end
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
// Copyright 2022 Google LLC
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
import Foundation
16+
import FirebaseCore
17+
18+
// Avoids exposing internal FirebaseCore APIs to Swift users.
19+
@_implementationOnly import FirebaseCoreExtension
20+
21+
@objc(FIRSessionsProvider)
22+
protocol SessionsProvider {
23+
@objc static func sessions() -> Void
24+
}
25+
26+
@objc(FIRSessions) class Sessions: NSObject, Library, SessionsProvider {
27+
// MARK: - Private Variables
28+
29+
/// The app associated with all sessions.
30+
private let googleAppID: String
31+
32+
// MARK: - Initializers
33+
34+
required init(app: FirebaseApp) {
35+
googleAppID = app.options.googleAppID
36+
}
37+
38+
// MARK: - Library conformance
39+
40+
static func componentsToRegister() -> [Component] {
41+
return [Component(SessionsProvider.self,
42+
instantiationTiming: .alwaysEager,
43+
dependencies: []) { container, isCacheable in
44+
// Sessions SDK only works for the default app
45+
guard let app = container.app, app.isDefaultApp else { return nil }
46+
isCacheable.pointee = true
47+
return self.init(app: app)
48+
}]
49+
}
50+
51+
// MARK: - SessionsProvider conformance
52+
53+
static func sessions() {}
54+
}

0 commit comments

Comments
 (0)