Skip to content

Commit 7ecfa21

Browse files
authored
[Infra] Force link remaining categories after #13435 (#13491)
1 parent 962e3dd commit 7ecfa21

File tree

10 files changed

+72
-0
lines changed

10 files changed

+72
-0
lines changed

FirebaseInAppMessaging/Sources/FIRInAppMessaging.m

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,24 @@ - (void)triggerEvent:(NSString *)eventName {
138138
checkAndDisplayNextContextualMessageForAnalyticsEvent:eventName];
139139
}
140140

141+
#pragma mark - Force Category Linking
142+
143+
extern void FIRInclude_FIRInAppMessaging_Bootstrap_Category(void);
144+
extern void FIRInclude_UIApplication_FIRForegroundWindowScene_Category(void);
145+
extern void FIRInclude_NSString_InterlaceStrings_Category(void);
146+
extern void FIRInclude_UIColor_HexString_Category(void);
147+
148+
/// Does nothing when called, and not meant to be called.
149+
///
150+
/// This method forces the linker to include categories even if
151+
/// users do not include the '-ObjC' linker flag in their project.
152+
+ (void)noop {
153+
FIRInclude_FIRInAppMessaging_Bootstrap_Category();
154+
FIRInclude_UIApplication_FIRForegroundWindowScene_Category();
155+
FIRInclude_NSString_InterlaceStrings_Category();
156+
FIRInclude_UIColor_HexString_Category();
157+
}
158+
141159
@end
142160

143161
#endif // TARGET_OS_IOS || TARGET_OS_TV || TARGET_OS_VISION

FirebaseInAppMessaging/Sources/Runtime/FIRInAppMessaging+Bootstrap.m

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,4 +137,8 @@ + (void)exitAppWithFatalError:(NSError *)error {
137137

138138
@end
139139

140+
/// Stub used to force the linker to include the categories in this file.
141+
void FIRInclude_FIRInAppMessaging_Bootstrap_Category(void) {
142+
}
143+
140144
#endif // TARGET_OS_IOS || TARGET_OS_TV || TARGET_OS_VISION

FirebaseInAppMessaging/Sources/Util/NSString+FIRInterlaceStrings.m

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,8 @@ + (NSString *)fir_interlaceString:(NSString *)stringOne withString:(NSString *)s
4444

4545
@end
4646

47+
/// Stub used to force the linker to include the categories in this file.
48+
void FIRInclude_NSString_InterlaceStrings_Category(void) {
49+
}
50+
4751
#endif // TARGET_OS_IOS || TARGET_OS_TV || TARGET_OS_VISION

FirebaseInAppMessaging/Sources/Util/UIApplication+FIRForegroundWindowScene.m

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,8 @@ - (nullable UIWindowScene *)fir_foregroundWindowScene {
3737

3838
@end
3939

40+
/// Stub used to force the linker to include the categories in this file.
41+
void FIRInclude_UIApplication_FIRForegroundWindowScene_Category(void) {
42+
}
43+
4044
#endif // TARGET_OS_IOS || TARGET_OS_TV || TARGET_OS_VISION

FirebaseInAppMessaging/Sources/Util/UIColor+FIRIAMHexString.m

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,8 @@ + (UIColor *)firiam_colorWithHexString:(nullable NSString *)hexString {
4141
}
4242
@end
4343

44+
/// Stub used to force the linker to include the categories in this file.
45+
void FIRInclude_UIColor_HexString_Category(void) {
46+
}
47+
4448
#endif // TARGET_OS_IOS || TARGET_OS_TV || TARGET_OS_VISION

FirebaseInstallations/Source/Library/FIRInstallations.m

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,18 @@ + (BOOL)isIIDVersionCompatible {
267267
return isCompatibleVersion;
268268
}
269269

270+
#pragma mark - Force Category Linking
271+
272+
extern void FIRInclude_FIRInstallationsItem_RegisterInstallationAPI_Category(void);
273+
274+
/// Does nothing when called, and not meant to be called.
275+
///
276+
/// This method forces the linker to include categories even if
277+
/// users do not include the '-ObjC' linker flag in their project.
278+
+ (void)noop {
279+
FIRInclude_FIRInstallationsItem_RegisterInstallationAPI_Category();
280+
}
281+
270282
@end
271283

272284
NS_ASSUME_NONNULL_END

FirebaseInstallations/Source/Library/InstallationsAPI/FIRInstallationsItem+RegisterInstallationAPI.m

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,3 +140,7 @@ + (NSString *)validStringOrNilForKey:(NSString *)key fromDict:(NSDictionary *)di
140140
}
141141

142142
@end
143+
144+
/// Stub used to force the linker to include the categories in this file.
145+
void FIRInclude_FIRInstallationsItem_RegisterInstallationAPI_Category(void) {
146+
}

FirebaseMessaging/Sources/FIRMessaging.m

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1028,4 +1028,18 @@ + (NSString *)FIRMessagingSDKCurrentLocale {
10281028
return [self currentLocale];
10291029
}
10301030

1031+
#pragma mark - Force Category Linking
1032+
1033+
extern void FIRInclude_NSDictionary_FIRMessaging_Category(void);
1034+
extern void FIRInclude_NSError_FIRMessaging_Category(void);
1035+
1036+
/// Does nothing when called, and not meant to be called.
1037+
///
1038+
/// This method forces the linker to include categories even if
1039+
/// users do not include the '-ObjC' linker flag in their project.
1040+
+ (void)noop {
1041+
FIRInclude_NSDictionary_FIRMessaging_Category();
1042+
FIRInclude_NSError_FIRMessaging_Category();
1043+
}
1044+
10311045
@end

FirebaseMessaging/Sources/NSDictionary+FIRMessaging.m

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,3 +56,7 @@ - (NSDictionary *)fcm_trimNonStringValues {
5656
}
5757

5858
@end
59+
60+
/// Stub used to force the linker to include the categories in this file.
61+
void FIRInclude_NSDictionary_FIRMessaging_Category(void) {
62+
}

FirebaseMessaging/Sources/NSError+FIRMessaging.m

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,7 @@ + (NSError *)messagingErrorWithCode:(FIRMessagingErrorCode)errorCode
2727
}
2828

2929
@end
30+
31+
/// Stub used to force the linker to include the categories in this file.
32+
void FIRInclude_NSError_FIRMessaging_Category(void) {
33+
}

0 commit comments

Comments
 (0)