Skip to content

Commit a05ce1c

Browse files
authored
Reorganize FIAM's Resources for FIAM (#7788)
1 parent 633efca commit a05ce1c

File tree

15 files changed

+113
-27
lines changed

15 files changed

+113
-27
lines changed

.swiftpm/xcode/xcshareddata/xcschemes/Firebase-Package.xcscheme

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -818,6 +818,48 @@
818818
ReferencedContainer = "container:">
819819
</BuildableReference>
820820
</BuildActionEntry>
821+
<BuildActionEntry
822+
buildForTesting = "YES"
823+
buildForRunning = "YES"
824+
buildForProfiling = "YES"
825+
buildForArchiving = "YES"
826+
buildForAnalyzing = "YES">
827+
<BuildableReference
828+
BuildableIdentifier = "primary"
829+
BlueprintIdentifier = "Firebase_FirebaseInAppMessaging"
830+
BuildableName = "Firebase_FirebaseInAppMessaging"
831+
BlueprintName = "Firebase_FirebaseInAppMessaging"
832+
ReferencedContainer = "container:">
833+
</BuildableReference>
834+
</BuildActionEntry>
835+
<BuildActionEntry
836+
buildForTesting = "YES"
837+
buildForRunning = "YES"
838+
buildForProfiling = "YES"
839+
buildForArchiving = "YES"
840+
buildForAnalyzing = "YES">
841+
<BuildableReference
842+
BuildableIdentifier = "primary"
843+
BlueprintIdentifier = "Firebase_FirebaseInAppMessaging_iOS"
844+
BuildableName = "Firebase_FirebaseInAppMessaging_iOS"
845+
BlueprintName = "Firebase_FirebaseInAppMessaging_iOS"
846+
ReferencedContainer = "container:">
847+
</BuildableReference>
848+
</BuildActionEntry>
849+
<BuildActionEntry
850+
buildForTesting = "YES"
851+
buildForRunning = "YES"
852+
buildForProfiling = "YES"
853+
buildForArchiving = "YES"
854+
buildForAnalyzing = "YES">
855+
<BuildableReference
856+
BuildableIdentifier = "primary"
857+
BlueprintIdentifier = "FirebaseInAppMessaging_iOS"
858+
BuildableName = "FirebaseInAppMessaging_iOS"
859+
BlueprintName = "FirebaseInAppMessaging_iOS"
860+
ReferencedContainer = "container:">
861+
</BuildableReference>
862+
</BuildActionEntry>
821863
</BuildActionEntries>
822864
</BuildAction>
823865
<TestAction

FirebaseInAppMessaging.podspec

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -63,15 +63,8 @@ See more product details at https://firebase.google.com/products/in-app-messagin
6363

6464
s.ios.resource_bundles = {
6565
'InAppMessagingDisplayResources' => [
66-
base_dir + 'Resources/FIRInAppMessageDisplayStoryboard.storyboard',
67-
base_dir + 'Resources/*.png'
68-
]
69-
}
70-
71-
s.tvos.resource_bundles = {
72-
'InAppMessagingDisplayResources' => [
73-
base_dir + 'Resources/FIRInAppMessageDisplayStoryboardTV.storyboard',
74-
base_dir + 'Resources/*.png'
66+
base_dir + 'iOS/Resources/FIRInAppMessageDisplayStoryboard.storyboard',
67+
base_dir + 'Sources/Resources/Shared/*.png'
7568
]
7669
}
7770

FirebaseInAppMessaging/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# Unreleased
2+
- [fixed] Fixed SPM resource inclusion for in-app messages (#7715).
3+
14
# 2021-3 -- v.7.9.0
25
- [added] Added support for building custom in-app messages with SwiftUI (#7496).
36

FirebaseInAppMessaging/Resources/FIRInAppMessageDisplayStoryboardTV.storyboard

Lines changed: 0 additions & 7 deletions
This file was deleted.

FirebaseInAppMessaging/Sources/DefaultUI/FIRIAMDefaultDisplayImpl.m

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@
1717
#import <TargetConditionals.h>
1818
#if TARGET_OS_IOS
1919

20-
#import <Foundation/Foundation.h>
21-
2220
#import "FirebaseCore/Sources/Private/FirebaseCoreInternal.h"
2321

2422
#import "FirebaseInAppMessaging/Sources/DefaultUI/Banner/FIRIAMBannerViewController.h"
@@ -30,7 +28,6 @@
3028
#import "FirebaseInAppMessaging/Sources/DefaultUI/Modal/FIRIAMModalViewController.h"
3129
#import "FirebaseInAppMessaging/Sources/Private/Util/FIRIAMTimeFetcher.h"
3230
#import "FirebaseInAppMessaging/Sources/Public/FirebaseInAppMessaging/FIRInAppMessaging.h"
33-
#import "FirebaseInAppMessaging/Sources/Public/FirebaseInAppMessaging/FIRInAppMessagingRendering.h"
3431

3532
@implementation FIRIAMDefaultDisplayImpl
3633

@@ -56,14 +53,25 @@ + (NSBundle *)getViewResourceBundle {
5653
Class myClass = [self class];
5754

5855
dispatch_once(&onceToken, ^{
56+
NSString *bundledResource;
57+
58+
// When using SPM, Xcode scopes resources to a target, creating a bundle.
59+
#if SWIFT_PACKAGE
60+
// FIAM only provides default UIs for iOS. FIAM for tvOS will not attempt to provide a default
61+
// display.
62+
bundledResource = @"Firebase_FirebaseInAppMessaging_iOS";
63+
#else
64+
bundledResource = @"InAppMessagingDisplayResources";
65+
#endif // SWIFT_PACKAGE
66+
5967
NSBundle *containingBundle;
6068
NSURL *bundleURL;
6169
// The containing bundle is different whether FIAM is statically or dynamically linked.
6270
for (containingBundle in @[ [NSBundle mainBundle], [NSBundle bundleForClass:myClass] ]) {
63-
bundleURL = [containingBundle URLForResource:@"InAppMessagingDisplayResources"
64-
withExtension:@"bundle"];
71+
bundleURL = [containingBundle URLForResource:bundledResource withExtension:@"bundle"];
6572
if (bundleURL != nil) break;
6673
}
74+
6775
if (bundleURL == nil) {
6876
FIRLogWarning(kFIRLoggerInAppMessagingDisplay, @"I-FID100007",
6977
@"FIAM Display Resource bundle "
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// Copyright 2021 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 <TargetConditionals.h>
16+
#if !(TARGET_OS_IOS || TARGET_OS_TVOS)
17+
#warning "Firebase In App Messaging only supports the iOS and tvOS platforms."
18+
#endif
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// Copyright 2021 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+
// Prevent a missing umbrella header warning.

0 commit comments

Comments
 (0)