Skip to content

Commit

Permalink
Analytics 10.17.0 (#11958)
Browse files Browse the repository at this point in the history
Co-authored-by: Nick Cooke <[email protected]>
  • Loading branch information
tsunghung and ncooke3 authored Oct 18, 2023
1 parent 579914e commit 84f3533
Show file tree
Hide file tree
Showing 13 changed files with 73 additions and 42 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/analytics.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
- name: FirebaseAnalytics
run: scripts/third_party/travis/retry.sh pod spec lint FirebaseAnalytics.podspec --platforms=${{ matrix.target }} --sources=https://github.com/firebase/SpecsDev.git,https://github.com/firebase/SpecsStaging.git,https://cdn.cocoapods.org/
- name: FirebaseAnalyticsSwift
run: scripts/third_party/travis/retry.sh scripts/pod_lib_lint.rb FirebaseAnalyticsSwift.podspec --platforms=${{ matrix.target }}
run: scripts/third_party/travis/retry.sh scripts/pod_lib_lint.rb FirebaseAnalyticsSwift.podspec --allow-warnings --platforms=${{ matrix.target }}
# The following steps are only run on `ios` due to product availability.
- name: GoogleAppMeasurementOnDeviceConversion
run: scripts/third_party/travis/retry.sh pod spec lint GoogleAppMeasurementOnDeviceConversion.podspec --platforms=ios --sources=https://github.com/firebase/SpecsDev.git,https://github.com/firebase/SpecsStaging.git,https://cdn.cocoapods.org/
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/client_app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,16 @@ on:
# Run every day at 12am (PST) - cron uses UTC times
- cron: "0 8 * * *"

env:
FIREBASECI_USE_LATEST_GOOGLEAPPMEASUREMENT: 1

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true

jobs:
client-app-spm:
if: (github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') || github.event_name == 'pull_request'
env:
FIREBASECI_USE_LATEST_GOOGLEAPPMEASUREMENT: 1
runs-on: macos-12
strategy:
matrix:
Expand Down
2 changes: 1 addition & 1 deletion FirebaseAnalytics.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Pod::Spec.new do |s|
s.authors = 'Google, Inc.'

s.source = {
:http => 'https://dl.google.com/firebase/ios/analytics/6b84dfc0fca41852/FirebaseAnalytics-10.16.0.tar.gz'
:http => 'https://dl.google.com/firebase/ios/analytics/85d9c07fe160aa17/FirebaseAnalytics-10.17.0.tar.gz'
}

s.cocoapods_version = '>= 1.10.0'
Expand Down
File renamed without changes.
2 changes: 2 additions & 0 deletions FirebaseAnalytics/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
This directory open sources select files from the Firebase Analytics SDK. Note
that there is no open source infastructure to build or package them.
2 changes: 1 addition & 1 deletion FirebaseAnalyticsSwift.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Firebase Analytics is a free, out-of-the-box analytics solution that inspires ac
'FirebaseAnalyticsSwift/Sources/*.swift',
]

s.dependency 'FirebaseAnalytics', '~> 10.0'
s.dependency 'FirebaseAnalytics', '~> 10.17'

s.test_spec 'swift-unit' do |swift_unit_tests|
swift_unit_tests.platforms = {
Expand Down
7 changes: 7 additions & 0 deletions FirebaseAnalyticsSwift/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# 10.17.0
- [deprecated] All of the public API from `FirebaseAnalyticsSwift` can now
be accessed through the `FirebaseAnalytics` module. Therefore,
`FirebaseAnalyticsSwift` has been deprecated, and will be removed in a
future release. See https://firebase.google.com/docs/ios/swift-migration for
migration instructions.

# 9.0.0
- [added] **Breaking change:** `FirebaseAnalyticsSwift` has exited beta and is
now generally available for use.
Expand Down
17 changes: 17 additions & 0 deletions FirebaseAnalyticsSwift/Sources/FirebaseAnalyticsSwift.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// Copyright 2023 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.

#warning(
"All of the public API from `FirebaseAnalyticsSwift` can now be accessed through the `FirebaseAnalytics` module. Therefore, the `FirebaseAnalyticsSwift` module is deprecated and will be removed in the future. See https://firebase.google.com/docs/ios/swift-migration for migration instructions."
)
66 changes: 35 additions & 31 deletions FirebaseAnalyticsSwift/Tests/SwiftUnit/AnalyticsAPITests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,28 +19,11 @@
import Foundation
import SwiftUI

@testable import FirebaseAnalyticsSwift
import FirebaseAnalyticsSwift
import SwiftUI
import FirebaseAnalytics

final class AnalyticsAPITests {
@available(iOS 13.0, *)
func loggedAnalyticsModifierUsage(viewModifier: LoggedAnalyticsModifier,
content: LoggedAnalyticsModifier.Content) {
let _: String = viewModifier.screenName
let _: String = viewModifier.screenClass
let _: [String: Any] = viewModifier.extraParameters
let _: any View = viewModifier.body(content: content)
}

@available(iOS 13.0, *)
func viewExtensionUsage(viewModifier: LoggedAnalyticsModifier, view: any View) {
let _: any View = view.analyticsScreen(
name: "name",
class: "class",
extraParameters: ["param": 1]
)
}

func usage() {
// MARK: - Analytics

Expand All @@ -54,24 +37,20 @@ final class AnalyticsAPITests {
Analytics.setDefaultEventParameters(["default": 100])

Analytics.sessionID { sessionID, error in }
#if compiler(>=5.5.2) && canImport(_Concurrency)
if #available(iOS 13.0, macOS 10.15, macCatalyst 13.0, tvOS 13.0, watchOS 7.0, *) {
Task {
let _: Int64? = try? await Analytics.sessionID()
}
if #available(iOS 13.0, macOS 10.15, macCatalyst 13.0, tvOS 13.0, watchOS 7.0, *) {
Task {
let _: Int64? = try? await Analytics.sessionID()
}
#endif // compiler(>=5.5.2) && canImport(_Concurrency)
}

// MARK: - AppDelegate

Analytics.handleEvents(forBackgroundURLSession: "session_id", completionHandler: {})
#if compiler(>=5.5.2) && canImport(_Concurrency)
if #available(iOS 13.0, macOS 10.15, macCatalyst 13.0, tvOS 13.0, watchOS 7.0, *) {
Task {
await Analytics.handleEvents(forBackgroundURLSession: "session_id")
}
if #available(iOS 13.0, macOS 10.15, macCatalyst 13.0, tvOS 13.0, watchOS 7.0, *) {
Task {
await Analytics.handleEvents(forBackgroundURLSession: "session_id")
}
#endif // compiler(>=5.5.2) && canImport(_Concurrency)
}
Analytics.handleOpen(URL(string: "https://google.com")!)
Analytics.handleUserActivity(NSUserActivity(activityType: "editing"))

Expand Down Expand Up @@ -203,5 +182,30 @@ final class AnalyticsAPITests {
AnalyticsUserPropertyAllowAdPersonalizationSignals,
AnalyticsUserPropertySignUpMethod,
]

// MARK: - Analytics + SwiftUI

@available(iOS 13.0, macOS 10.15, macCatalyst 13.0, tvOS 13.0, *)
@available(watchOS, unavailable)
struct MyView: View {
let name: String
let klass: String
let extraParameters: [String: Any]

var body: some View {
Text("Hello, world!")
.analyticsScreen(name: name,
class: klass,
extraParameters: extraParameters)
Text("Hello, world!")
.analyticsScreen(name: name,
extraParameters: extraParameters)
Text("Hello, world!")
.analyticsScreen(name: name,
class: klass)
Text("Hello, world!")
.analyticsScreen(name: name)
}
}
}
}
2 changes: 1 addition & 1 deletion GoogleAppMeasurement.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Pod::Spec.new do |s|
s.authors = 'Google, Inc.'

s.source = {
:http => 'https://dl.google.com/firebase/ios/analytics/39bfd299873250e2/GoogleAppMeasurement-10.16.0.tar.gz'
:http => 'https://dl.google.com/firebase/ios/analytics/3ba4027e4ed57a60/GoogleAppMeasurement-10.17.0.tar.gz'
}

s.cocoapods_version = '>= 1.10.2'
Expand Down
2 changes: 1 addition & 1 deletion GoogleAppMeasurementOnDeviceConversion.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Pod::Spec.new do |s|
s.authors = 'Google, Inc.'

s.source = {
:http => 'https://dl.google.com/firebase/ios/analytics/5db664d50f88e208/GoogleAppMeasurementOnDeviceConversion-10.13.0.tar.gz'
:http => 'https://dl.google.com/firebase/ios/analytics/8cd8d72af8f1a22b/GoogleAppMeasurementOnDeviceConversion-10.17.0.tar.gz'
}

s.cocoapods_version = '>= 1.10.2'
Expand Down
6 changes: 3 additions & 3 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -309,8 +309,8 @@ let package = Package(
),
.binaryTarget(
name: "FirebaseAnalytics",
url: "https://dl.google.com/firebase/ios/swiftpm/10.16.0/FirebaseAnalytics.zip",
checksum: "1321d2faa9c3b910758528a1540558c446b97cf9a4d3aad6067907156586d600"
url: "https://dl.google.com/firebase/ios/swiftpm/10.17.0/FirebaseAnalytics.zip",
checksum: "94a559d3801a445802c4bc6e6a50b283eff7dd25f8994e63a06589dbb6c18bdf"
),
.target(
name: "FirebaseAnalyticsSwiftTarget",
Expand Down Expand Up @@ -1337,7 +1337,7 @@ func googleAppMeasurementDependency() -> Package.Dependency {
return .package(url: appMeasurementURL, branch: "main")
}

return .package(url: appMeasurementURL, exact: "10.16.0")
return .package(url: appMeasurementURL, exact: "10.17.0")
}

func abseilDependency() -> Package.Dependency {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public let shared = Manifest(
Pod("GoogleAppMeasurementOnDeviceConversion", isClosedSource: true, platforms: ["ios"]),
Pod("FirebaseAnalytics", isClosedSource: true),
Pod("FirebaseAnalyticsOnDeviceConversion", platforms: ["ios"], zip: true),
Pod("FirebaseAnalyticsSwift", zip: true),
Pod("FirebaseAnalyticsSwift", allowWarnings: true, zip: true),
Pod("FirebaseABTesting", zip: true),
Pod("FirebaseAppCheck", zip: true),
Pod("FirebaseRemoteConfig"),
Expand Down

0 comments on commit 84f3533

Please sign in to comment.