Skip to content

[InAppMessaging] Follow-up to #12910 #12917

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 26 additions & 12 deletions FirebaseInAppMessaging/Sources/DefaultUI/FIRIAMDefaultDisplayImpl.m
Original file line number Diff line number Diff line change
Expand Up @@ -64,21 +64,35 @@ + (NSBundle *)getViewResourceBundle {
bundledResource = @"InAppMessagingDisplayResources";
#endif // SWIFT_PACKAGE

NSMutableArray *bundles = [NSMutableArray array];

// Resources may be in main bundle when statically linked.
NSBundle *mainBundle = [NSBundle mainBundle];
if (mainBundle) {
[bundles addObject:mainBundle];
}
// Resources may be in the bundle associated with this class when
// dynamically linked.
NSBundle *bundleForClass = [NSBundle bundleForClass:myClass];
if (bundleForClass) {
[bundles addObject:bundleForClass];
}
// When embedding static frameworks from the zip distribution, the Xcode
// will copy the resources into the framework's directory.
// TODO(Firebase 11): Remove when Firebase.zip is composed of dynamic
// frameworks.
NSBundle *frameworkBundle = [NSBundle
bundleWithURL:
[NSBundle.mainBundle.bundleURL
URLByAppendingPathComponent:@"Frameworks/FirebaseInAppMessaging.framework"]];
if (frameworkBundle) {
[bundles addObject:frameworkBundle];
}

NSBundle *containingBundle;
NSURL *bundleURL;
// The containing bundle is different whether FIAM is statically or dynamically linked.
for (containingBundle in @[
// Statically linked.
[NSBundle mainBundle],
// Dynamically linked.
[NSBundle bundleForClass:myClass],
#if FIREBASE_BUILD_ZIP_FILE
// Embedded static framework (zip distribution).
[NSBundle bundleWithURL:[NSBundle.mainBundle.bundleURL
URLByAppendingPathComponent:
@"Frameworks/FirebaseInAppMessaging.framework"]]
#endif // FIREBASE_BUILD_ZIP_FILE
]) {
for (containingBundle in bundles) {
bundleURL = [containingBundle URLForResource:bundledResource withExtension:@"bundle"];
if (bundleURL != nil) break;
}
Expand Down
Loading