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

Remove Messaging FIRApp Class Category #1666

Merged
merged 2 commits into from Aug 14, 2018
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 5 additions & 5 deletions Example/Firebase.xcodeproj/project.pbxproj
Expand Up @@ -6631,12 +6631,12 @@
BUNDLE_LOADER = "$(TEST_HOST)";
CLANG_ANALYZER_NONNULL = YES;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
DEBUG_INFORMATION_FORMAT = dwarf;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you revert the project file and do those in a separate commit? They should be changed but no reason to be part of this PR :)

DEVELOPMENT_TEAM = "";
HEADER_SEARCH_PATHS = (
"$(inherited)",
"${PODS_ROOT}/Headers/Private",
);
DEBUG_INFORMATION_FORMAT = dwarf;
DEVELOPMENT_TEAM = "";
INFOPLIST_FILE = "Core/Tests/Tests-Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 10.2;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
Expand All @@ -6653,13 +6653,13 @@
BUNDLE_LOADER = "$(TEST_HOST)";
CLANG_ANALYZER_NONNULL = YES;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEVELOPMENT_TEAM = "";
HEADER_SEARCH_PATHS = (
"$(inherited)",
"${PODS_ROOT}/Headers/Private",
);
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEVELOPMENT_TEAM = "";
INFOPLIST_FILE = "Core/Tests/Tests-Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 10.2;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
Expand Down
24 changes: 0 additions & 24 deletions Firebase/Messaging/FIRMessaging+FIRApp.h

This file was deleted.

102 changes: 0 additions & 102 deletions Firebase/Messaging/FIRMessaging+FIRApp.m

This file was deleted.

41 changes: 41 additions & 0 deletions Firebase/Messaging/FIRMessaging.m
Expand Up @@ -31,10 +31,12 @@
#import "FIRMessagingLogger.h"
#import "FIRMessagingPubSub.h"
#import "FIRMessagingReceiver.h"
#import "FIRMessagingRemoteNotificationsProxy.h"
#import "FIRMessagingRmqManager.h"
#import "FIRMessagingSyncMessageManager.h"
#import "FIRMessagingUtilities.h"
#import "FIRMessagingVersionUtilities.h"
#import "FIRMessaging_Private.h"

#import <FirebaseCore/FIRAppInternal.h>
#import <FirebaseInstanceID/FirebaseInstanceID.h>
Expand Down Expand Up @@ -190,6 +192,45 @@ - (void)dealloc {

#pragma mark - Config

+ (void)load {
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(didReceiveConfigureSDKNotification:)
name:kFIRAppReadyToConfigureSDKNotification
object:nil];
}

+ (void)didReceiveConfigureSDKNotification:(NSNotification *)notification {
NSDictionary *appInfoDict = notification.userInfo;
NSNumber *isDefaultApp = appInfoDict[kFIRAppIsDefaultAppKey];
if (![isDefaultApp boolValue]) {
// Only configure for the default FIRApp.
FIRMessagingLoggerDebug(kFIRMessagingMessageCodeFIRApp001,
@"Firebase Messaging only works with the default app.");
return;
}

NSString *appName = appInfoDict[kFIRAppNameKey];
FIRApp *app = [FIRApp appNamed:appName];
[[FIRMessaging messaging] configureMessaging:app];
}

- (void)configureMessaging:(FIRApp *)app {
// Swizzle remote-notification-related methods (app delegate and UNUserNotificationCenter)
if ([FIRMessagingRemoteNotificationsProxy canSwizzleMethods]) {
NSString *docsURLString = @"https://firebase.google.com/docs/cloud-messaging/ios/client"
@"#method_swizzling_in_firebase_messaging";
FIRMessagingLoggerNotice(kFIRMessagingMessageCodeFIRApp000,
@"FIRMessaging Remote Notifications proxy enabled, will swizzle "
@"remote notification receiver handlers. If you'd prefer to manually "
@"integrate Firebase Messaging, add \"%@\" to your Info.plist, "
@"and set it to NO. Follow the instructions at:\n%@\nto ensure "
@"proper integration.",
kFIRMessagingRemoteNotificationsProxyEnabledInfoPlistKey,
docsURLString);
[FIRMessagingRemoteNotificationsProxy swizzleMethods];
}
}

- (void)start {
// Print the library version for logging.
NSString *currentLibraryVersion = FIRMessagingCurrentLibraryVersion();
Expand Down