Skip to content

Commit

Permalink
[InAppMessaging] Consolidate FIAM and FIAMSwift (#11800)
Browse files Browse the repository at this point in the history
  • Loading branch information
ncooke3 authored Oct 13, 2023
1 parent 1e0f294 commit b962ad6
Show file tree
Hide file tree
Showing 11 changed files with 110 additions and 31 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/inappmessaging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
runs-on: macos-12
strategy:
matrix:
podspec: [FirebaseInAppMessaging.podspec, FirebaseInAppMessagingSwift.podspec]
podspec: [FirebaseInAppMessaging.podspec, FirebaseInAppMessagingSwift.podspec --allow-warnings]
steps:
- uses: actions/checkout@v3
- uses: ruby/setup-ruby@v1
Expand Down
40 changes: 21 additions & 19 deletions FirebaseInAppMessaging.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,17 @@ See more product details at https://firebase.google.com/products/in-app-messagin
base_dir = "FirebaseInAppMessaging/"
s.ios.source_files = [
base_dir + "Sources/*.[cmh]",
base_dir + "Sources/Analytics/**/*.[cmh]",
base_dir + "Sources/Data/**/*.[cmh]",
base_dir + "Sources/DefaultUI/**/*.[cmh]",
base_dir + "Sources/DisplayTrigger/**/*.[cmh]",
base_dir + "Sources/Flows/**/*.[cmh]",
base_dir + "Sources/Private/**/*.[cmh]",
base_dir + "Sources/Public/**/*.[cmh]",
base_dir + "Sources/RenderingObjects/**/*.[cmh]",
base_dir + "Sources/Runtime/**/*.[cmh]",
base_dir + "Sources/Util/**/*.[cmh]",
base_dir + "Sources/Analytics/**/*.[cmh]",
base_dir + "Sources/Data/**/*.[cmh]",
base_dir + "Sources/DefaultUI/**/*.[cmh]",
base_dir + "Sources/DisplayTrigger/**/*.[cmh]",
base_dir + "Sources/Flows/**/*.[cmh]",
base_dir + "Sources/Private/**/*.[cmh]",
base_dir + "Sources/Public/**/*.[cmh]",
base_dir + "Sources/RenderingObjects/**/*.[cmh]",
base_dir + "Sources/Runtime/**/*.[cmh]",
base_dir + "Sources/Util/**/*.[cmh]",
base_dir + "Swift/Source/**/*.swift",
'Interop/Analytics/Public/*.h',
'FirebaseABTesting/Sources/Private/*.h',
'FirebaseCore/Extension/*.h',
Expand All @@ -46,15 +47,16 @@ See more product details at https://firebase.google.com/products/in-app-messagin

s.tvos.source_files = [
base_dir + "Sources/*.[cmh]",
base_dir + "Sources/Analytics/**/*.[cmh]",
base_dir + "Sources/Data/**/*.[cmh]",
base_dir + "Sources/DisplayTrigger/**/*.[cmh]",
base_dir + "Sources/Flows/**/*.[cmh]",
base_dir + "Sources/Private/**/*.[cmh]",
base_dir + "Sources/Public/**/*.[cmh]",
base_dir + "Sources/RenderingObjects/**/*.[cmh]",
base_dir + "Sources/Runtime/**/*.[cmh]",
base_dir + "Sources/Util/**/*.[cmh]",
base_dir + "Sources/Analytics/**/*.[cmh]",
base_dir + "Sources/Data/**/*.[cmh]",
base_dir + "Sources/DisplayTrigger/**/*.[cmh]",
base_dir + "Sources/Flows/**/*.[cmh]",
base_dir + "Sources/Private/**/*.[cmh]",
base_dir + "Sources/Public/**/*.[cmh]",
base_dir + "Sources/RenderingObjects/**/*.[cmh]",
base_dir + "Sources/Runtime/**/*.[cmh]",
base_dir + "Sources/Util/**/*.[cmh]",
base_dir + "Swift/Source/**/*.swift",
'Interop/Analytics/Public/*.h',
'FirebaseABTesting/Sources/Private/*.h',
'FirebaseCore/Extension/*.h',
Expand Down
7 changes: 7 additions & 0 deletions FirebaseInAppMessaging/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# Unreleased
- [deprecated] All of the public API from `FirebaseInAppMessagingSwift` can now
be accessed through the `FirebaseInAppMessaging` module. Therefore,
`FirebaseInAppMessagingSwift` has been deprecated, and will be removed in a
future release. See https://firebase.google.com/docs/ios/swift-migration for
migration instructions.

# 10.13.0
- [fixed] Fix Firebase tvOS podspec dependency for In App Messaging. (#11569)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,12 @@
// See the License for the specific language governing permissions and
// limitations under the License.

import FirebaseInAppMessaging
import SwiftUI

#if SWIFT_PACKAGE
@_exported import FirebaseInAppMessagingInternal
#endif // SWIFT_PACKAGE

// MARK: Image-only messages.

@available(iOS 13, tvOS 13, *)
Expand Down
30 changes: 30 additions & 0 deletions FirebaseInAppMessaging/Swift/Source/SPMSwiftHeaderWorkaround.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// 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.

#if SWIFT_PACKAGE
@_exported import FirebaseInAppMessagingInternal

// This is a trick to force generate a `FirebaseInAppMessaging-Swift.h`
// header that re-exports `FirebaseInAppMessagingInternal` for Objective-C
// clients. It is important for the below code to reference a Remote
// Config symbol defined in Objective-C as that will import the symbol's
// module (`FirebaseInAppMessagingInternal`) in the generated header. This
// allows Objective-C clients to import Remote Config's Objective-C API
// using `@import FirebaseInAppMessaging;`. This API is not needed for Swift
// clients and is therefore unavailable in a Swift context.
@available(*, unavailable)
@objc public extension InAppMessaging {
static var __no_op: () -> Void { {} }
}
#endif // SWIFT_PACKAGE
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@

import UIKit

import FirebaseInAppMessaging
#if SWIFT_PACKAGE
@_exported import FirebaseInAppMessagingInternal
#endif // SWIFT_PACKAGE

@available(iOS 13.0, tvOS 13.0, *)
@available(iOSApplicationExtension, unavailable)
Expand Down
4 changes: 2 additions & 2 deletions FirebaseInAppMessagingSwift.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ See more product details at https://firebase.google.com/products/in-app-messagin
s.prefix_header_file = false

s.source_files = [
'FirebaseInAppMessaging/Swift/Source/**/*.swift',
'FirebaseInAppMessagingSwift/Sources/**/*.swift',
]

s.test_spec 'unit' do |unit_tests|
Expand All @@ -35,5 +35,5 @@ See more product details at https://firebase.google.com/products/in-app-messagin

s.framework = 'UIKit'

s.dependency 'FirebaseInAppMessaging', '~> 10.0-beta'
s.dependency 'FirebaseInAppMessaging', '~> 10.17-beta'
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// 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 `FirebaseInAppMessagingSwift` can now be accessed through the `FirebaseInAppMessaging` module. Therefore, the `FirebaseInAppMessagingSwift` module is deprecated and will be removed in the future. See https://firebase.google.com/docs/ios/swift-migration for migration instructions."
)

// The `@_exported` is needed to prevent breaking clients that are using
// types prefixed with the `FirebaseInAppMessaging` namespace.
@_exported import enum FirebaseInAppMessaging.InAppMessagingPreviewHelpers
16 changes: 12 additions & 4 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -758,7 +758,7 @@ let package = Package(
),

.target(
name: "FirebaseInAppMessaging",
name: "FirebaseInAppMessagingInternal",
dependencies: [
"FirebaseCore",
"FirebaseInstallations",
Expand Down Expand Up @@ -787,10 +787,16 @@ let package = Package(
resources: [.process("Resources")]
),

.target(
name: "FirebaseInAppMessaging",
dependencies: ["FirebaseInAppMessagingInternal"],
path: "FirebaseInAppMessaging/Swift/Source"
),

.target(
name: "FirebaseInAppMessagingSwift",
dependencies: ["FirebaseInAppMessaging"],
path: "FirebaseInAppMessaging/Swift/Source"
path: "FirebaseInAppMessagingSwift/Sources"
),

.target(
Expand Down Expand Up @@ -1156,7 +1162,8 @@ let package = Package(
"FirebaseFirestoreTarget",
"FirebaseFirestoreSwift",
"FirebaseFunctions",
"FirebaseInAppMessaging",
.target(name: "FirebaseInAppMessaging",
condition: .when(platforms: [.iOS, .tvOS])),
.target(name: "FirebaseInAppMessagingSwift",
condition: .when(platforms: [.iOS, .tvOS])),
"FirebaseInstallations",
Expand Down Expand Up @@ -1194,7 +1201,8 @@ let package = Package(
"FirebaseDynamicLinks",
"FirebaseFirestoreTarget",
"FirebaseFunctions",
"FirebaseInAppMessaging",
.target(name: "FirebaseInAppMessaging",
condition: .when(platforms: [.iOS, .tvOS])),
"FirebaseInstallations",
"FirebaseMessaging",
.target(name: "FirebasePerformance",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,13 @@ public let shared = Manifest(
Pod("FirebaseFirestoreSwift", zip: true),
Pod("FirebaseFunctions", zip: true),
Pod("FirebaseInAppMessaging", isBeta: true, platforms: ["ios"]),
Pod("FirebaseInAppMessagingSwift", isBeta: true, platforms: ["ios"], zip: true),
Pod(
"FirebaseInAppMessagingSwift",
isBeta: true,
allowWarnings: true,
platforms: ["ios"],
zip: true
),
Pod("FirebaseMessaging", zip: true),
Pod("FirebasePerformance", platforms: ["ios", "tvos"], zip: true),
Pod("FirebaseStorage", zip: true),
Expand Down
4 changes: 2 additions & 2 deletions SwiftPMTests/swift-test/all-imports.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ import FirebaseMessaging
#if (os(iOS) && !targetEnvironment(macCatalyst)) || os(tvOS)
import FirebasePerformance

import FirebaseInAppMessaging
@testable import FirebaseInAppMessagingSwift
@testable import FirebaseInAppMessaging
import FirebaseInAppMessagingSwift
import SwiftUI
#endif
import FirebaseRemoteConfig
Expand Down

0 comments on commit b962ad6

Please sign in to comment.