Skip to content

Commit b962ad6

Browse files
authored
[InAppMessaging] Consolidate FIAM and FIAMSwift (#11800)
1 parent 1e0f294 commit b962ad6

File tree

11 files changed

+110
-31
lines changed

11 files changed

+110
-31
lines changed

.github/workflows/inappmessaging.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
runs-on: macos-12
2525
strategy:
2626
matrix:
27-
podspec: [FirebaseInAppMessaging.podspec, FirebaseInAppMessagingSwift.podspec]
27+
podspec: [FirebaseInAppMessaging.podspec, FirebaseInAppMessagingSwift.podspec --allow-warnings]
2828
steps:
2929
- uses: actions/checkout@v3
3030
- uses: ruby/setup-ruby@v1

FirebaseInAppMessaging.podspec

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,17 @@ See more product details at https://firebase.google.com/products/in-app-messagin
2828
base_dir = "FirebaseInAppMessaging/"
2929
s.ios.source_files = [
3030
base_dir + "Sources/*.[cmh]",
31-
base_dir + "Sources/Analytics/**/*.[cmh]",
32-
base_dir + "Sources/Data/**/*.[cmh]",
33-
base_dir + "Sources/DefaultUI/**/*.[cmh]",
34-
base_dir + "Sources/DisplayTrigger/**/*.[cmh]",
35-
base_dir + "Sources/Flows/**/*.[cmh]",
36-
base_dir + "Sources/Private/**/*.[cmh]",
37-
base_dir + "Sources/Public/**/*.[cmh]",
38-
base_dir + "Sources/RenderingObjects/**/*.[cmh]",
39-
base_dir + "Sources/Runtime/**/*.[cmh]",
40-
base_dir + "Sources/Util/**/*.[cmh]",
31+
base_dir + "Sources/Analytics/**/*.[cmh]",
32+
base_dir + "Sources/Data/**/*.[cmh]",
33+
base_dir + "Sources/DefaultUI/**/*.[cmh]",
34+
base_dir + "Sources/DisplayTrigger/**/*.[cmh]",
35+
base_dir + "Sources/Flows/**/*.[cmh]",
36+
base_dir + "Sources/Private/**/*.[cmh]",
37+
base_dir + "Sources/Public/**/*.[cmh]",
38+
base_dir + "Sources/RenderingObjects/**/*.[cmh]",
39+
base_dir + "Sources/Runtime/**/*.[cmh]",
40+
base_dir + "Sources/Util/**/*.[cmh]",
41+
base_dir + "Swift/Source/**/*.swift",
4142
'Interop/Analytics/Public/*.h',
4243
'FirebaseABTesting/Sources/Private/*.h',
4344
'FirebaseCore/Extension/*.h',
@@ -46,15 +47,16 @@ See more product details at https://firebase.google.com/products/in-app-messagin
4647

4748
s.tvos.source_files = [
4849
base_dir + "Sources/*.[cmh]",
49-
base_dir + "Sources/Analytics/**/*.[cmh]",
50-
base_dir + "Sources/Data/**/*.[cmh]",
51-
base_dir + "Sources/DisplayTrigger/**/*.[cmh]",
52-
base_dir + "Sources/Flows/**/*.[cmh]",
53-
base_dir + "Sources/Private/**/*.[cmh]",
54-
base_dir + "Sources/Public/**/*.[cmh]",
55-
base_dir + "Sources/RenderingObjects/**/*.[cmh]",
56-
base_dir + "Sources/Runtime/**/*.[cmh]",
57-
base_dir + "Sources/Util/**/*.[cmh]",
50+
base_dir + "Sources/Analytics/**/*.[cmh]",
51+
base_dir + "Sources/Data/**/*.[cmh]",
52+
base_dir + "Sources/DisplayTrigger/**/*.[cmh]",
53+
base_dir + "Sources/Flows/**/*.[cmh]",
54+
base_dir + "Sources/Private/**/*.[cmh]",
55+
base_dir + "Sources/Public/**/*.[cmh]",
56+
base_dir + "Sources/RenderingObjects/**/*.[cmh]",
57+
base_dir + "Sources/Runtime/**/*.[cmh]",
58+
base_dir + "Sources/Util/**/*.[cmh]",
59+
base_dir + "Swift/Source/**/*.swift",
5860
'Interop/Analytics/Public/*.h',
5961
'FirebaseABTesting/Sources/Private/*.h',
6062
'FirebaseCore/Extension/*.h',

FirebaseInAppMessaging/CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
# Unreleased
2+
- [deprecated] All of the public API from `FirebaseInAppMessagingSwift` can now
3+
be accessed through the `FirebaseInAppMessaging` module. Therefore,
4+
`FirebaseInAppMessagingSwift` has been deprecated, and will be removed in a
5+
future release. See https://firebase.google.com/docs/ios/swift-migration for
6+
migration instructions.
7+
18
# 10.13.0
29
- [fixed] Fix Firebase tvOS podspec dependency for In App Messaging. (#11569)
310

FirebaseInAppMessaging/Swift/Source/CustomInAppMessageDisplayViewModifier.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,12 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
import FirebaseInAppMessaging
1615
import SwiftUI
1716

17+
#if SWIFT_PACKAGE
18+
@_exported import FirebaseInAppMessagingInternal
19+
#endif // SWIFT_PACKAGE
20+
1821
// MARK: Image-only messages.
1922

2023
@available(iOS 13, tvOS 13, *)
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
// Copyright 2023 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+
#if SWIFT_PACKAGE
16+
@_exported import FirebaseInAppMessagingInternal
17+
18+
// This is a trick to force generate a `FirebaseInAppMessaging-Swift.h`
19+
// header that re-exports `FirebaseInAppMessagingInternal` for Objective-C
20+
// clients. It is important for the below code to reference a Remote
21+
// Config symbol defined in Objective-C as that will import the symbol's
22+
// module (`FirebaseInAppMessagingInternal`) in the generated header. This
23+
// allows Objective-C clients to import Remote Config's Objective-C API
24+
// using `@import FirebaseInAppMessaging;`. This API is not needed for Swift
25+
// clients and is therefore unavailable in a Swift context.
26+
@available(*, unavailable)
27+
@objc public extension InAppMessaging {
28+
static var __no_op: () -> Void { {} }
29+
}
30+
#endif // SWIFT_PACKAGE

FirebaseInAppMessaging/Swift/Source/SwiftUIPreviewHelpers.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@
1414

1515
import UIKit
1616

17-
import FirebaseInAppMessaging
17+
#if SWIFT_PACKAGE
18+
@_exported import FirebaseInAppMessagingInternal
19+
#endif // SWIFT_PACKAGE
1820

1921
@available(iOS 13.0, tvOS 13.0, *)
2022
@available(iOSApplicationExtension, unavailable)

FirebaseInAppMessagingSwift.podspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ See more product details at https://firebase.google.com/products/in-app-messagin
2424
s.prefix_header_file = false
2525

2626
s.source_files = [
27-
'FirebaseInAppMessaging/Swift/Source/**/*.swift',
27+
'FirebaseInAppMessagingSwift/Sources/**/*.swift',
2828
]
2929

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

3636
s.framework = 'UIKit'
3737

38-
s.dependency 'FirebaseInAppMessaging', '~> 10.0-beta'
38+
s.dependency 'FirebaseInAppMessaging', '~> 10.17-beta'
3939
end
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// Copyright 2023 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+
#warning(
16+
"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."
17+
)
18+
19+
// The `@_exported` is needed to prevent breaking clients that are using
20+
// types prefixed with the `FirebaseInAppMessaging` namespace.
21+
@_exported import enum FirebaseInAppMessaging.InAppMessagingPreviewHelpers

Package.swift

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -758,7 +758,7 @@ let package = Package(
758758
),
759759

760760
.target(
761-
name: "FirebaseInAppMessaging",
761+
name: "FirebaseInAppMessagingInternal",
762762
dependencies: [
763763
"FirebaseCore",
764764
"FirebaseInstallations",
@@ -787,10 +787,16 @@ let package = Package(
787787
resources: [.process("Resources")]
788788
),
789789

790+
.target(
791+
name: "FirebaseInAppMessaging",
792+
dependencies: ["FirebaseInAppMessagingInternal"],
793+
path: "FirebaseInAppMessaging/Swift/Source"
794+
),
795+
790796
.target(
791797
name: "FirebaseInAppMessagingSwift",
792798
dependencies: ["FirebaseInAppMessaging"],
793-
path: "FirebaseInAppMessaging/Swift/Source"
799+
path: "FirebaseInAppMessagingSwift/Sources"
794800
),
795801

796802
.target(
@@ -1156,7 +1162,8 @@ let package = Package(
11561162
"FirebaseFirestoreTarget",
11571163
"FirebaseFirestoreSwift",
11581164
"FirebaseFunctions",
1159-
"FirebaseInAppMessaging",
1165+
.target(name: "FirebaseInAppMessaging",
1166+
condition: .when(platforms: [.iOS, .tvOS])),
11601167
.target(name: "FirebaseInAppMessagingSwift",
11611168
condition: .when(platforms: [.iOS, .tvOS])),
11621169
"FirebaseInstallations",
@@ -1194,7 +1201,8 @@ let package = Package(
11941201
"FirebaseDynamicLinks",
11951202
"FirebaseFirestoreTarget",
11961203
"FirebaseFunctions",
1197-
"FirebaseInAppMessaging",
1204+
.target(name: "FirebaseInAppMessaging",
1205+
condition: .when(platforms: [.iOS, .tvOS])),
11981206
"FirebaseInstallations",
11991207
"FirebaseMessaging",
12001208
.target(name: "FirebasePerformance",

ReleaseTooling/Sources/FirebaseManifest/FirebaseManifest.swift

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,13 @@ public let shared = Manifest(
5151
Pod("FirebaseFirestoreSwift", zip: true),
5252
Pod("FirebaseFunctions", zip: true),
5353
Pod("FirebaseInAppMessaging", isBeta: true, platforms: ["ios"]),
54-
Pod("FirebaseInAppMessagingSwift", isBeta: true, platforms: ["ios"], zip: true),
54+
Pod(
55+
"FirebaseInAppMessagingSwift",
56+
isBeta: true,
57+
allowWarnings: true,
58+
platforms: ["ios"],
59+
zip: true
60+
),
5561
Pod("FirebaseMessaging", zip: true),
5662
Pod("FirebasePerformance", platforms: ["ios", "tvos"], zip: true),
5763
Pod("FirebaseStorage", zip: true),

0 commit comments

Comments
 (0)