Skip to content

Commit

Permalink
Merge dd9992a into 1c605b2
Browse files Browse the repository at this point in the history
  • Loading branch information
ncooke3 authored May 8, 2024
2 parents 1c605b2 + dd9992a commit 7bd673c
Showing 1 changed file with 26 additions and 12 deletions.
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

0 comments on commit 7bd673c

Please sign in to comment.