Skip to content
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

[Infra] Force link remaining categories after #13435 #13491

Merged
merged 1 commit into from
Aug 13, 2024
Merged
Show file tree
Hide file tree
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
18 changes: 18 additions & 0 deletions FirebaseInAppMessaging/Sources/FIRInAppMessaging.m
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,24 @@ - (void)triggerEvent:(NSString *)eventName {
checkAndDisplayNextContextualMessageForAnalyticsEvent:eventName];
}

#pragma mark - Force Category Linking

extern void FIRInclude_FIRInAppMessaging_Bootstrap_Category(void);
extern void FIRInclude_UIApplication_FIRForegroundWindowScene_Category(void);
extern void FIRInclude_NSString_InterlaceStrings_Category(void);
extern void FIRInclude_UIColor_HexString_Category(void);

/// Does nothing when called, and not meant to be called.
///
/// This method forces the linker to include categories even if
/// users do not include the '-ObjC' linker flag in their project.
+ (void)noop {
FIRInclude_FIRInAppMessaging_Bootstrap_Category();
FIRInclude_UIApplication_FIRForegroundWindowScene_Category();
FIRInclude_NSString_InterlaceStrings_Category();
FIRInclude_UIColor_HexString_Category();
}

@end

#endif // TARGET_OS_IOS || TARGET_OS_TV || TARGET_OS_VISION
Original file line number Diff line number Diff line change
Expand Up @@ -137,4 +137,8 @@ + (void)exitAppWithFatalError:(NSError *)error {

@end

/// Stub used to force the linker to include the categories in this file.
void FIRInclude_FIRInAppMessaging_Bootstrap_Category(void) {
}

#endif // TARGET_OS_IOS || TARGET_OS_TV || TARGET_OS_VISION
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,8 @@ + (NSString *)fir_interlaceString:(NSString *)stringOne withString:(NSString *)s

@end

/// Stub used to force the linker to include the categories in this file.
void FIRInclude_NSString_InterlaceStrings_Category(void) {
}

#endif // TARGET_OS_IOS || TARGET_OS_TV || TARGET_OS_VISION
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,8 @@ - (nullable UIWindowScene *)fir_foregroundWindowScene {

@end

/// Stub used to force the linker to include the categories in this file.
void FIRInclude_UIApplication_FIRForegroundWindowScene_Category(void) {
}

#endif // TARGET_OS_IOS || TARGET_OS_TV || TARGET_OS_VISION
4 changes: 4 additions & 0 deletions FirebaseInAppMessaging/Sources/Util/UIColor+FIRIAMHexString.m
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,8 @@ + (UIColor *)firiam_colorWithHexString:(nullable NSString *)hexString {
}
@end

/// Stub used to force the linker to include the categories in this file.
void FIRInclude_UIColor_HexString_Category(void) {
}

#endif // TARGET_OS_IOS || TARGET_OS_TV || TARGET_OS_VISION
12 changes: 12 additions & 0 deletions FirebaseInstallations/Source/Library/FIRInstallations.m
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,18 @@ + (BOOL)isIIDVersionCompatible {
return isCompatibleVersion;
}

#pragma mark - Force Category Linking

extern void FIRInclude_FIRInstallationsItem_RegisterInstallationAPI_Category(void);

/// Does nothing when called, and not meant to be called.
///
/// This method forces the linker to include categories even if
/// users do not include the '-ObjC' linker flag in their project.
+ (void)noop {
FIRInclude_FIRInstallationsItem_RegisterInstallationAPI_Category();
}

@end

NS_ASSUME_NONNULL_END
Original file line number Diff line number Diff line change
Expand Up @@ -140,3 +140,7 @@ + (NSString *)validStringOrNilForKey:(NSString *)key fromDict:(NSDictionary *)di
}

@end

/// Stub used to force the linker to include the categories in this file.
void FIRInclude_FIRInstallationsItem_RegisterInstallationAPI_Category(void) {
}
14 changes: 14 additions & 0 deletions FirebaseMessaging/Sources/FIRMessaging.m
Original file line number Diff line number Diff line change
Expand Up @@ -1028,4 +1028,18 @@ + (NSString *)FIRMessagingSDKCurrentLocale {
return [self currentLocale];
}

#pragma mark - Force Category Linking

extern void FIRInclude_NSDictionary_FIRMessaging_Category(void);
extern void FIRInclude_NSError_FIRMessaging_Category(void);

/// Does nothing when called, and not meant to be called.
///
/// This method forces the linker to include categories even if
/// users do not include the '-ObjC' linker flag in their project.
+ (void)noop {
FIRInclude_NSDictionary_FIRMessaging_Category();
FIRInclude_NSError_FIRMessaging_Category();
}

@end
4 changes: 4 additions & 0 deletions FirebaseMessaging/Sources/NSDictionary+FIRMessaging.m
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,7 @@ - (NSDictionary *)fcm_trimNonStringValues {
}

@end

/// Stub used to force the linker to include the categories in this file.
void FIRInclude_NSDictionary_FIRMessaging_Category(void) {
}
4 changes: 4 additions & 0 deletions FirebaseMessaging/Sources/NSError+FIRMessaging.m
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,7 @@ + (NSError *)messagingErrorWithCode:(FIRMessagingErrorCode)errorCode
}

@end

/// Stub used to force the linker to include the categories in this file.
void FIRInclude_NSError_FIRMessaging_Category(void) {
}
Loading