Archived
Configured colours and added additional images to ready app for iOS 13 dark mode
This commit is contained in:
@@ -47,6 +47,7 @@ typedef NS_ENUM(NSInteger, FIRMessagingMessageCode) {
|
||||
kFIRMessagingMessageCodeTokenDelegateMethodsNotImplemented = 2023, // I-FCM002023
|
||||
kFIRMessagingMessageCodeTopicFormatIsDeprecated = 2024,
|
||||
kFIRMessagingMessageCodeDirectChannelConnectionFailed = 2025,
|
||||
kFIRMessagingMessageCodeInvalidClient = 2026,
|
||||
// FIRMessagingClient.m
|
||||
kFIRMessagingMessageCodeClient000 = 4000, // I-FCM004000
|
||||
kFIRMessagingMessageCodeClient001 = 4001, // I-FCM004001
|
||||
@@ -60,6 +61,9 @@ typedef NS_ENUM(NSInteger, FIRMessagingMessageCode) {
|
||||
kFIRMessagingMessageCodeClient009 = 4009, // I-FCM004009
|
||||
kFIRMessagingMessageCodeClient010 = 4010, // I-FCM004010
|
||||
kFIRMessagingMessageCodeClient011 = 4011, // I-FCM004011
|
||||
kFIRMessagingMessageCodeClientInvalidState = 4012,
|
||||
kFIRMessagingMessageCodeClientInvalidStateTimeout = 4013,
|
||||
|
||||
// FIRMessagingConnection.m
|
||||
kFIRMessagingMessageCodeConnection000 = 5000, // I-FCM005000
|
||||
kFIRMessagingMessageCodeConnection001 = 5001, // I-FCM005001
|
||||
@@ -106,6 +110,8 @@ typedef NS_ENUM(NSInteger, FIRMessagingMessageCode) {
|
||||
kFIRMessagingMessageCodeDataMessageManager010 = 7010, // I-FCM007010
|
||||
kFIRMessagingMessageCodeDataMessageManager011 = 7011, // I-FCM007011
|
||||
kFIRMessagingMessageCodeDataMessageManager012 = 7012, // I-FCM007012
|
||||
kFIRMessagingMessageCodeDataMessageManager013 = 7013,
|
||||
|
||||
// FIRMessagingPendingTopicsList.m
|
||||
kFIRMessagingMessageCodePendingTopicsList000 = 8000, // I-FCM008000
|
||||
// FIRMessagingPubSub.m
|
||||
@@ -196,4 +202,7 @@ typedef NS_ENUM(NSInteger, FIRMessagingMessageCode) {
|
||||
kFIRMessagingServiceExtensionLocalFileNotCreated = 20002,
|
||||
kFIRMessagingServiceExtensionImageNotAttached = 20003,
|
||||
|
||||
// FIRMessagingCodedInputStream.m
|
||||
kFIRMessagingCodeInputStreamInvalidParameters = 21000,
|
||||
|
||||
};
|
||||
|
||||
+60
-58
@@ -18,26 +18,6 @@
|
||||
#error FIRMessagingLib should be compiled with ARC.
|
||||
#endif
|
||||
|
||||
#import "FIRMessaging.h"
|
||||
#import "FIRMessaging_Private.h"
|
||||
|
||||
#import "FIRMessagingAnalytics.h"
|
||||
#import "FIRMessagingClient.h"
|
||||
#import "FIRMessagingConstants.h"
|
||||
#import "FIRMessagingContextManagerService.h"
|
||||
#import "FIRMessagingDataMessageManager.h"
|
||||
#import "FIRMessagingDefines.h"
|
||||
#import "FIRMessagingExtensionHelper.h"
|
||||
#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 <FirebaseAnalyticsInterop/FIRAnalyticsInterop.h>
|
||||
#import <FirebaseCore/FIRAppInternal.h>
|
||||
#import <FirebaseCore/FIRComponent.h>
|
||||
@@ -46,11 +26,28 @@
|
||||
#import <FirebaseCore/FIRLibrary.h>
|
||||
#import <FirebaseInstanceID/FirebaseInstanceID.h>
|
||||
#import <FirebaseInstanceID/FIRInstanceID_Private.h>
|
||||
#import <FirebaseMessaging/FIRMessaging.h>
|
||||
#import <FirebaseMessaging/FIRMessagingExtensionHelper.h>
|
||||
#import <GoogleUtilities/GULReachabilityChecker.h>
|
||||
#import <GoogleUtilities/GULUserDefaults.h>
|
||||
#import <GoogleUtilities/GULAppDelegateSwizzler.h>
|
||||
|
||||
#import "NSError+FIRMessaging.h"
|
||||
#import "Firebase/Messaging/FIRMessagingAnalytics.h"
|
||||
#import "Firebase/Messaging/FIRMessagingClient.h"
|
||||
#import "Firebase/Messaging/FIRMessagingConstants.h"
|
||||
#import "Firebase/Messaging/FIRMessagingContextManagerService.h"
|
||||
#import "Firebase/Messaging/FIRMessagingDataMessageManager.h"
|
||||
#import "Firebase/Messaging/FIRMessagingDefines.h"
|
||||
#import "Firebase/Messaging/FIRMessagingLogger.h"
|
||||
#import "Firebase/Messaging/FIRMessagingPubSub.h"
|
||||
#import "Firebase/Messaging/FIRMessagingReceiver.h"
|
||||
#import "Firebase/Messaging/FIRMessagingRemoteNotificationsProxy.h"
|
||||
#import "Firebase/Messaging/FIRMessagingRmqManager.h"
|
||||
#import "Firebase/Messaging/FIRMessagingSyncMessageManager.h"
|
||||
#import "Firebase/Messaging/FIRMessagingUtilities.h"
|
||||
#import "Firebase/Messaging/FIRMessagingVersionUtilities.h"
|
||||
#import "Firebase/Messaging/FIRMessaging_Private.h"
|
||||
#import "Firebase/Messaging/NSError+FIRMessaging.h"
|
||||
|
||||
static NSString *const kFIRMessagingMessageViaAPNSRootKey = @"aps";
|
||||
static NSString *const kFIRMessagingReachabilityHostname = @"www.google.com";
|
||||
@@ -89,6 +86,20 @@ NSString *const kFIRMessagingAPNSTokenType = @"APNSTokenType"; // APNS Token typ
|
||||
NSString *const kFIRMessagingPlistAutoInitEnabled =
|
||||
@"FirebaseMessagingAutoInitEnabled"; // Auto Init Enabled key stored in Info.plist
|
||||
|
||||
const BOOL FIRMessagingIsAPNSSyncMessage(NSDictionary *message) {
|
||||
if ([message[kFIRMessagingMessageViaAPNSRootKey] isKindOfClass:[NSDictionary class]]) {
|
||||
NSDictionary *aps = message[kFIRMessagingMessageViaAPNSRootKey];
|
||||
if (aps && [aps isKindOfClass:[NSDictionary class]]) {
|
||||
return [aps[kFIRMessagingMessageAPNSContentAvailableKey] boolValue];
|
||||
}
|
||||
}
|
||||
return NO;
|
||||
}
|
||||
|
||||
BOOL FIRMessagingIsContextManagerMessage(NSDictionary *message) {
|
||||
return [FIRMessagingContextManagerService isContextManagerMessage:message];
|
||||
}
|
||||
|
||||
@interface FIRMessagingMessageInfo ()
|
||||
|
||||
@property(nonatomic, readwrite, assign) FIRMessagingMessageStatus status;
|
||||
@@ -170,13 +181,7 @@ NSString *const kFIRMessagingPlistAutoInitEnabled =
|
||||
FIR_COMPONENT(FIRMessagingInstanceProvider, defaultApp.container);
|
||||
|
||||
// We know the instance coming from the container is a FIRMessaging instance, cast it and move on.
|
||||
FIRMessaging *messaging = (FIRMessaging *)instance;
|
||||
|
||||
static dispatch_once_t onceToken;
|
||||
dispatch_once(&onceToken, ^{
|
||||
[messaging start];
|
||||
});
|
||||
return messaging;
|
||||
return (FIRMessaging *)instance;
|
||||
}
|
||||
|
||||
+ (FIRMessagingExtensionHelper *)extensionHelper {
|
||||
@@ -223,9 +228,12 @@ NSString *const kFIRMessagingPlistAutoInitEnabled =
|
||||
// Ensure it's cached so it returns the same instance every time messaging is called.
|
||||
*isCacheable = YES;
|
||||
id<FIRAnalyticsInterop> analytics = FIR_COMPONENT(FIRAnalyticsInterop, container);
|
||||
return [[FIRMessaging alloc] initWithAnalytics:analytics
|
||||
withInstanceID:[FIRInstanceID instanceID]
|
||||
withUserDefaults:[GULUserDefaults standardUserDefaults]];
|
||||
FIRMessaging *messaging =
|
||||
[[FIRMessaging alloc] initWithAnalytics:analytics
|
||||
withInstanceID:[FIRInstanceID instanceID]
|
||||
withUserDefaults:[GULUserDefaults standardUserDefaults]];
|
||||
[messaging start];
|
||||
return messaging;
|
||||
};
|
||||
FIRComponent *messagingProvider =
|
||||
[FIRComponent componentWithProtocol:@protocol(FIRMessagingInstanceProvider)
|
||||
@@ -348,7 +356,9 @@ NSString *const kFIRMessagingPlistAutoInitEnabled =
|
||||
}
|
||||
|
||||
- (void)setupTopics {
|
||||
_FIRMessagingDevAssert(self.client, @"Invalid nil client before init pubsub.");
|
||||
if (!self.client) {
|
||||
FIRMessagingLoggerWarn(kFIRMessagingMessageCodeInvalidClient, @"Invalid nil client before init pubsub.");
|
||||
}
|
||||
self.pubsub = [[FIRMessagingPubSub alloc] initWithClient:self.client];
|
||||
}
|
||||
|
||||
@@ -367,8 +377,6 @@ NSString *const kFIRMessagingPlistAutoInitEnabled =
|
||||
}
|
||||
|
||||
- (void)teardown {
|
||||
_FIRMessagingDevAssert([NSThread isMainThread],
|
||||
@"FIRMessaging should be called from main thread only.");
|
||||
[self.client teardown];
|
||||
self.pubsub = nil;
|
||||
self.syncMessageManager = nil;
|
||||
@@ -390,21 +398,25 @@ NSString *const kFIRMessagingPlistAutoInitEnabled =
|
||||
// the message to the device.
|
||||
BOOL isOldMessage = NO;
|
||||
NSString *messageID = message[kFIRMessagingMessageIDKey];
|
||||
if ([messageID length]) {
|
||||
if (messageID.length) {
|
||||
[self.rmq2Manager saveS2dMessageWithRmqId:messageID];
|
||||
|
||||
BOOL isSyncMessage = [[self class] isAPNSSyncMessage:message];
|
||||
BOOL isSyncMessage = FIRMessagingIsAPNSSyncMessage(message);
|
||||
if (isSyncMessage) {
|
||||
isOldMessage = [self.syncMessageManager didReceiveAPNSSyncMessage:message];
|
||||
}
|
||||
}
|
||||
// Prevent duplicates by keeping a cache of all the logged messages during each session.
|
||||
// The duplicates only happen when the 3P app calls `appDidReceiveMessage:` along with
|
||||
// us swizzling their implementation to call the same method implicitly.
|
||||
if (!isOldMessage && messageID.length) {
|
||||
isOldMessage = [self.loggedMessageIDs containsObject:messageID];
|
||||
if (!isOldMessage) {
|
||||
[self.loggedMessageIDs addObject:messageID];
|
||||
|
||||
// Prevent duplicates by keeping a cache of all the logged messages during each session.
|
||||
// The duplicates only happen when the 3P app calls `appDidReceiveMessage:` along with
|
||||
// us swizzling their implementation to call the same method implicitly.
|
||||
// We need to rule out the contextual message because it shares the same message ID
|
||||
// as the local notification it will schedule. And because it is also a APNSSync message
|
||||
// its duplication is already checked previously.
|
||||
if (!isOldMessage && !FIRMessagingIsContextManagerMessage(message)) {
|
||||
isOldMessage = [self.loggedMessageIDs containsObject:messageID];
|
||||
if (!isOldMessage) {
|
||||
[self.loggedMessageIDs addObject:messageID];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -417,20 +429,12 @@ NSString *const kFIRMessagingPlistAutoInitEnabled =
|
||||
}
|
||||
|
||||
- (BOOL)handleContextManagerMessage:(NSDictionary *)message {
|
||||
if ([FIRMessagingContextManagerService isContextManagerMessage:message]) {
|
||||
if (FIRMessagingIsContextManagerMessage(message)) {
|
||||
return [FIRMessagingContextManagerService handleContextManagerMessage:message];
|
||||
}
|
||||
return NO;
|
||||
}
|
||||
|
||||
+ (BOOL)isAPNSSyncMessage:(NSDictionary *)message {
|
||||
if ([message[kFIRMessagingMessageViaAPNSRootKey] isKindOfClass:[NSDictionary class]]) {
|
||||
NSDictionary *aps = message[kFIRMessagingMessageViaAPNSRootKey];
|
||||
return [aps[kFIRMessagingMessageAPNSContentAvailableKey] boolValue];
|
||||
}
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (void)handleIncomingLinkIfNeededFromMessage:(NSDictionary *)message {
|
||||
#if TARGET_OS_IOS || TARGET_OS_TV
|
||||
NSURL *url = [self linkURLFromMessage:message];
|
||||
@@ -826,15 +830,13 @@ NSString *const kFIRMessagingPlistAutoInitEnabled =
|
||||
to:(NSString *)to
|
||||
withMessageID:(NSString *)messageID
|
||||
timeToLive:(int64_t)ttl {
|
||||
_FIRMessagingDevAssert([to length] != 0, @"Invalid receiver id for FIRMessaging-message");
|
||||
|
||||
NSMutableDictionary *fcmMessage = [[self class] createFIRMessagingMessageWithMessage:message
|
||||
to:to
|
||||
withID:messageID
|
||||
timeToLive:ttl
|
||||
delay:0];
|
||||
FIRMessagingLoggerInfo(kFIRMessagingMessageCodeMessaging013, @"Sending message: %@ with id: %@",
|
||||
message, messageID);
|
||||
FIRMessagingLoggerInfo(kFIRMessagingMessageCodeMessaging013, @"Sending message: %@ with id: %@ to %@.",
|
||||
message, messageID, to);
|
||||
[self.dataMessageManager sendDataMessageStanza:fcmMessage];
|
||||
}
|
||||
|
||||
@@ -872,7 +874,7 @@ NSString *const kFIRMessagingPlistAutoInitEnabled =
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wunguarded-availability"
|
||||
[self.delegate messaging:self didReceiveMessage:remoteMessage];
|
||||
#pragma pop
|
||||
#pragma clang diagnostic pop
|
||||
} else {
|
||||
// Delegate methods weren't implemented, so messages are being dropped, log a warning
|
||||
FIRMessagingLoggerWarn(kFIRMessagingMessageCodeRemoteMessageDelegateMethodNotImplemented,
|
||||
|
||||
@@ -14,14 +14,16 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#import "FIRMessagingAnalytics.h"
|
||||
#import "FIRMessagingLogger.h"
|
||||
#import "Firebase/Messaging/FIRMessagingAnalytics.h"
|
||||
|
||||
#import <FirebaseAnalyticsInterop/FIRInteropEventNames.h>
|
||||
#import <FirebaseAnalyticsInterop/FIRInteropParameterNames.h>
|
||||
#import <GoogleUtilities/GULAppEnvironmentUtil.h>
|
||||
#import <GoogleUtilities/GULAppDelegateSwizzler.h>
|
||||
|
||||
#import "Firebase/Messaging/FIRMessagingLogger.h"
|
||||
|
||||
|
||||
static NSString *const kLogTag = @"FIRMessagingAnalytics";
|
||||
|
||||
// aps Key
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#import "FIRMessaging.h"
|
||||
#import <FirebaseMessaging/FIRMessaging.h>
|
||||
|
||||
@class GULReachabilityChecker;
|
||||
@class GPBMessage;
|
||||
|
||||
+32
-33
@@ -14,22 +14,22 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#import "FIRMessagingClient.h"
|
||||
#import "Firebase/Messaging/FIRMessagingClient.h"
|
||||
|
||||
#import <FirebaseInstanceID/FIRInstanceID_Private.h>
|
||||
#import <FirebaseMessaging/FIRMessaging.h>
|
||||
#import <GoogleUtilities/GULReachabilityChecker.h>
|
||||
|
||||
#import "FIRMessaging.h"
|
||||
#import "FIRMessagingConnection.h"
|
||||
#import "FIRMessagingConstants.h"
|
||||
#import "FIRMessagingDataMessageManager.h"
|
||||
#import "FIRMessagingDefines.h"
|
||||
#import "FIRMessagingLogger.h"
|
||||
#import "FIRMessagingRmqManager.h"
|
||||
#import "FIRMessagingTopicsCommon.h"
|
||||
#import "FIRMessagingUtilities.h"
|
||||
#import "NSError+FIRMessaging.h"
|
||||
#import "FIRMessagingPubSubRegistrar.h"
|
||||
#import "Firebase/Messaging/FIRMessagingConnection.h"
|
||||
#import "Firebase/Messaging/FIRMessagingConstants.h"
|
||||
#import "Firebase/Messaging/FIRMessagingDataMessageManager.h"
|
||||
#import "Firebase/Messaging/FIRMessagingDefines.h"
|
||||
#import "Firebase/Messaging/FIRMessagingLogger.h"
|
||||
#import "Firebase/Messaging/FIRMessagingRmqManager.h"
|
||||
#import "Firebase/Messaging/FIRMessagingTopicsCommon.h"
|
||||
#import "Firebase/Messaging/FIRMessagingUtilities.h"
|
||||
#import "Firebase/Messaging/NSError+FIRMessaging.h"
|
||||
#import "Firebase/Messaging/FIRMessagingPubSubRegistrar.h"
|
||||
|
||||
static const NSTimeInterval kConnectTimeoutInterval = 40.0;
|
||||
static const NSTimeInterval kReconnectDelayInSeconds = 2 * 60; // 2 minutes
|
||||
@@ -131,7 +131,9 @@ static NSUInteger FIRMessagingServerPort() {
|
||||
}
|
||||
|
||||
- (void)teardown {
|
||||
FIRMessagingLoggerDebug(kFIRMessagingMessageCodeClient000, @"");
|
||||
if (![NSThread isMainThread]) {
|
||||
FIRMessagingLoggerDebug(kFIRMessagingMessageCodeClient000, @"FIRMessagingClient should be called from main thread only.");
|
||||
}
|
||||
self.stayConnected = NO;
|
||||
|
||||
// Clear all the handlers
|
||||
@@ -140,9 +142,8 @@ static NSUInteger FIRMessagingServerPort() {
|
||||
[self.connection teardown];
|
||||
|
||||
// Stop all subscription requests
|
||||
[self.registrar stopAllSubscriptionRequests];
|
||||
[self.registrar stopAllSubscriptionRequests];
|
||||
|
||||
_FIRMessagingDevAssert(self.connection.state == kFIRMessagingConnectionNotConnected, @"Did not disconnect");
|
||||
[NSObject cancelPreviousPerformRequestsWithTarget:self];
|
||||
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
||||
@@ -166,10 +167,7 @@ static NSUInteger FIRMessagingServerPort() {
|
||||
options:(NSDictionary *)options
|
||||
shouldDelete:(BOOL)shouldDelete
|
||||
handler:(FIRMessagingTopicOperationCompletion)handler {
|
||||
|
||||
_FIRMessagingDevAssert(handler != nil, @"Invalid handler to FIRMessaging subscribe");
|
||||
|
||||
FIRMessagingTopicOperationCompletion completion = ^void(NSError *error) {
|
||||
FIRMessagingTopicOperationCompletion completion = ^void(NSError *error) {
|
||||
if (error) {
|
||||
FIRMessagingLoggerError(kFIRMessagingMessageCodeClient001, @"Failed to subscribe to topic %@",
|
||||
error);
|
||||
@@ -182,7 +180,9 @@ static NSUInteger FIRMessagingServerPort() {
|
||||
@"Successfully subscribed to topic %@", topic);
|
||||
}
|
||||
}
|
||||
handler(error);
|
||||
if (handler) {
|
||||
handler(error);
|
||||
}
|
||||
};
|
||||
|
||||
if ([[FIRInstanceID instanceID] tryToLoadValidCheckinInfo]) {
|
||||
@@ -316,8 +316,6 @@ static NSUInteger FIRMessagingServerPort() {
|
||||
|
||||
self.stayConnected = tryToConnectLater;
|
||||
[self.connection signOut];
|
||||
_FIRMessagingDevAssert(self.connection.state == kFIRMessagingConnectionNotConnected,
|
||||
@"FIRMessaging connection did not disconnect");
|
||||
|
||||
// since we can disconnect while still trying to establish the connection it's required to
|
||||
// cancel all performSelectors else the object might be retained
|
||||
@@ -421,8 +419,6 @@ static NSUInteger FIRMessagingServerPort() {
|
||||
- (void)setupConnection {
|
||||
NSString *host = FIRMessagingServerHost();
|
||||
NSUInteger port = FIRMessagingServerPort();
|
||||
_FIRMessagingDevAssert([host length] > 0 && port != 0, @"Invalid port or host");
|
||||
|
||||
if (self.connection != nil) {
|
||||
// if there is an old connection, explicitly sign it off.
|
||||
[self.connection signOut];
|
||||
@@ -447,17 +443,20 @@ static NSUInteger FIRMessagingServerPort() {
|
||||
[NSObject cancelPreviousPerformRequestsWithTarget:self
|
||||
selector:@selector(tryToConnect)
|
||||
object:nil];
|
||||
|
||||
NSString *deviceAuthID = [FIRInstanceID instanceID].deviceAuthID;
|
||||
NSString *secretToken = [FIRInstanceID instanceID].secretToken;
|
||||
if (deviceAuthID.length == 0 || secretToken.length == 0 ||
|
||||
!self.connection) {
|
||||
FIRMessagingLoggerWarn(kFIRMessagingMessageCodeClientInvalidState,
|
||||
@"Invalid state to connect, deviceAuthID: %@, secretToken: %@, connection state: %ld",
|
||||
deviceAuthID, secretToken, (long)self.connection.state);
|
||||
return;
|
||||
}
|
||||
// Do not re-sign in if there is already a connection in progress.
|
||||
if (self.connection.state != kFIRMessagingConnectionNotConnected) {
|
||||
return;
|
||||
}
|
||||
|
||||
_FIRMessagingDevAssert([FIRInstanceID instanceID].deviceAuthID.length > 0 &&
|
||||
[FIRInstanceID instanceID].secretToken.length > 0 &&
|
||||
self.connection != nil,
|
||||
@"Invalid state cannot connect");
|
||||
|
||||
self.connectRetryCount = MIN(kMaxRetryExponent, self.connectRetryCount + 1);
|
||||
[self performSelector:@selector(didConnectTimeout)
|
||||
withObject:nil
|
||||
@@ -466,9 +465,9 @@ static NSUInteger FIRMessagingServerPort() {
|
||||
}
|
||||
|
||||
- (void)didConnectTimeout {
|
||||
_FIRMessagingDevAssert(self.connection.state != kFIRMessagingConnectionSignedIn,
|
||||
@"Invalid state for MCS connection");
|
||||
|
||||
if (self.connection.state == kFIRMessagingConnectionSignedIn) {
|
||||
FIRMessagingLoggerWarn(kFIRMessagingMessageCodeClientInvalidStateTimeout, @"Invalid state for connection timeout.");
|
||||
}
|
||||
if (self.stayConnected) {
|
||||
[self.connection signOut];
|
||||
[self scheduleConnectRetry];
|
||||
|
||||
@@ -14,8 +14,10 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#import "FIRMessagingCodedInputStream.h"
|
||||
#import "FIRMessagingDefines.h"
|
||||
#import "Firebase/Messaging/FIRMessagingCodedInputStream.h"
|
||||
|
||||
#import "Firebase/Messaging/FIRMMessageCode.h"
|
||||
#import "Firebase/Messaging/FIRMessagingLogger.h"
|
||||
|
||||
typedef struct {
|
||||
const void *bytes;
|
||||
@@ -32,9 +34,10 @@ static BOOL CheckSize(BufferState *state, size_t size) {
|
||||
}
|
||||
|
||||
static BOOL ReadRawByte(BufferState *state, int8_t *output) {
|
||||
_FIRMessagingDevAssert(output != NULL && state != NULL, @"Invalid parameters");
|
||||
|
||||
if (CheckSize(state, sizeof(int8_t))) {
|
||||
if (state == NULL || output == NULL) {
|
||||
FIRMessagingLoggerDebug(kFIRMessagingCodeInputStreamInvalidParameters, @"Invalid parameters.");
|
||||
}
|
||||
if (output != nil && CheckSize(state, sizeof(int8_t))) {
|
||||
*output = ((int8_t *)state->bytes)[state->bufferPos++];
|
||||
return YES;
|
||||
}
|
||||
@@ -42,8 +45,10 @@ static BOOL ReadRawByte(BufferState *state, int8_t *output) {
|
||||
}
|
||||
|
||||
static BOOL ReadRawVarInt32(BufferState *state, int32_t *output) {
|
||||
_FIRMessagingDevAssert(output != NULL && state != NULL, @"Invalid parameters");
|
||||
|
||||
if (state == NULL || output == NULL) {
|
||||
FIRMessagingLoggerDebug(kFIRMessagingCodeInputStreamInvalidParameters, @"Invalid parameters.");
|
||||
return NO;
|
||||
}
|
||||
int8_t tmp = 0;
|
||||
if (!ReadRawByte(state, &tmp)) {
|
||||
return NO;
|
||||
|
||||
+14
-23
@@ -14,20 +14,21 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#import "FIRMessagingConnection.h"
|
||||
#import "Firebase/Messaging/FIRMessagingConnection.h"
|
||||
|
||||
#import "Protos/GtalkCore.pbobjc.h"
|
||||
#import "Protos/GtalkExtensions.pbobjc.h"
|
||||
#import <FirebaseMessaging/FIRMessaging.h>
|
||||
|
||||
#import "FIRMessaging.h"
|
||||
#import "FIRMessagingDataMessageManager.h"
|
||||
#import "FIRMessagingDefines.h"
|
||||
#import "FIRMessagingLogger.h"
|
||||
#import "FIRMessagingRmqManager.h"
|
||||
#import "FIRMessagingSecureSocket.h"
|
||||
#import "FIRMessagingUtilities.h"
|
||||
#import "FIRMessagingVersionUtilities.h"
|
||||
#import "FIRMessaging_Private.h"
|
||||
#import "Firebase/Messaging/Protos/GtalkCore.pbobjc.h"
|
||||
#import "Firebase/Messaging/Protos/GtalkExtensions.pbobjc.h"
|
||||
|
||||
#import "Firebase/Messaging/FIRMessagingDataMessageManager.h"
|
||||
#import "Firebase/Messaging/FIRMessagingDefines.h"
|
||||
#import "Firebase/Messaging/FIRMessagingLogger.h"
|
||||
#import "Firebase/Messaging/FIRMessagingRmqManager.h"
|
||||
#import "Firebase/Messaging/FIRMessagingSecureSocket.h"
|
||||
#import "Firebase/Messaging/FIRMessagingUtilities.h"
|
||||
#import "Firebase/Messaging/FIRMessagingVersionUtilities.h"
|
||||
#import "Firebase/Messaging/FIRMessaging_Private.h"
|
||||
|
||||
static NSInteger const kIqSelectiveAck = 12;
|
||||
static NSInteger const kIqStreamAck = 13;
|
||||
@@ -144,7 +145,6 @@ static NSString *const kRemoteFromAddress = @"from";
|
||||
}
|
||||
|
||||
- (void)signIn {
|
||||
_FIRMessagingDevAssert(self.state == kFIRMessagingConnectionNotConnected, @"Invalid connection state.");
|
||||
if (self.state != kFIRMessagingConnectionNotConnected) {
|
||||
return;
|
||||
}
|
||||
@@ -200,11 +200,8 @@ static NSString *const kRemoteFromAddress = @"from";
|
||||
}
|
||||
|
||||
- (void)didDisconnectWithSecureSocket:(FIRMessagingSecureSocket *)socket {
|
||||
_FIRMessagingDevAssert(self.socket == socket, @"Invalid socket");
|
||||
_FIRMessagingDevAssert(self.socket.state == kFIRMessagingSecureSocketClosed, @"Socket already closed");
|
||||
|
||||
FIRMessagingLoggerDebug(kFIRMessagingMessageCodeConnection002,
|
||||
@"Secure socket disconnected from FIRMessaging service.");
|
||||
@"Secure socket disconnected from FIRMessaging service. %ld", (long)self.socket.state);
|
||||
[self disconnect];
|
||||
[self.delegate connection:self didCloseForReason:kFIRMessagingConnectionCloseReasonSocketDisconnected];
|
||||
}
|
||||
@@ -294,7 +291,6 @@ static NSString *const kRemoteFromAddress = @"from";
|
||||
return;
|
||||
}
|
||||
|
||||
_FIRMessagingDevAssert(self.socket != nil, @"Socket shouldn't be nil");
|
||||
if (self.socket == nil) {
|
||||
return;
|
||||
}
|
||||
@@ -438,10 +434,6 @@ static NSString *const kRemoteFromAddress = @"from";
|
||||
return;
|
||||
}
|
||||
FIRMessagingLoggerDebug(kFIRMessagingMessageCodeConnection012, @"Logged onto MCS service.");
|
||||
// We sent the persisted list of unack'd messages with login so we can assume they have been ack'd
|
||||
// by the server.
|
||||
_FIRMessagingDevAssert(self.unackedS2dIds.count == 0, @"No ids present");
|
||||
_FIRMessagingDevAssert(self.outStreamId == 1, @"Login should be the first stream id");
|
||||
|
||||
self.state = kFIRMessagingConnectionSignedIn;
|
||||
self.lastLoginServerTimestamp = loginResponse.serverTimestamp;
|
||||
@@ -659,7 +651,6 @@ static NSString *const kRemoteFromAddress = @"from";
|
||||
}
|
||||
|
||||
- (void)disconnect {
|
||||
_FIRMessagingDevAssert(self.state != kFIRMessagingConnectionNotConnected, @"Connection already not connected");
|
||||
// cancel pending timeout tasks.
|
||||
[self cancelConnectionTimeoutTask];
|
||||
// cancel pending heartbeat.
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#import "FIRMessagingConstants.h"
|
||||
#import "Firebase/Messaging/FIRMessagingConstants.h"
|
||||
|
||||
NSString *const kFIRMessagingRawDataKey = @"rawData";
|
||||
NSString *const kFIRMessagingCollapseKey = @"collapse_key";
|
||||
|
||||
+20
-16
@@ -14,11 +14,11 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#import "FIRMessagingContextManagerService.h"
|
||||
#import "Firebase/Messaging/FIRMessagingContextManagerService.h"
|
||||
|
||||
#import "FIRMessagingDefines.h"
|
||||
#import "FIRMessagingLogger.h"
|
||||
#import "FIRMessagingUtilities.h"
|
||||
#import "Firebase/Messaging/FIRMessagingDefines.h"
|
||||
#import "Firebase/Messaging/FIRMessagingLogger.h"
|
||||
#import "Firebase/Messaging/FIRMessagingUtilities.h"
|
||||
|
||||
#import <GoogleUtilities/GULAppDelegateSwizzler.h>
|
||||
|
||||
@@ -44,6 +44,7 @@ NSString *const kFIRMessagingContextManagerCategoryKey =
|
||||
NSString *const kFIRMessagingContextManagerSoundKey = kFIRMessagingContextManagerNotificationKeyPrefix @"sound";
|
||||
NSString *const kFIRMessagingContextManagerContentAvailableKey =
|
||||
kFIRMessagingContextManagerNotificationKeyPrefix @"content-available";
|
||||
static NSString *const kFIRMessagingAPNSPayloadKey = @"aps";
|
||||
|
||||
typedef NS_ENUM(NSUInteger, FIRMessagingContextManagerMessageType) {
|
||||
FIRMessagingContextManagerMessageTypeNone,
|
||||
@@ -77,19 +78,16 @@ typedef NS_ENUM(NSUInteger, FIRMessagingContextManagerMessageType) {
|
||||
|
||||
+ (BOOL)handleContextManagerLocalTimeMessage:(NSDictionary *)message {
|
||||
NSString *startTimeString = message[kFIRMessagingContextManagerLocalTimeStart];
|
||||
if (!startTimeString) {
|
||||
FIRMessagingLoggerError(kFIRMessagingMessageCodeContextManagerService002,
|
||||
@"Invalid local start date format %@. Message dropped",
|
||||
startTimeString);
|
||||
return NO;
|
||||
}
|
||||
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
|
||||
dateFormatter.locale = [NSLocale localeWithLocaleIdentifier:@"en_US_POSIX"];
|
||||
[dateFormatter setDateFormat:kLocalTimeFormatString];
|
||||
NSDate *startDate = [dateFormatter dateFromString:startTimeString];
|
||||
|
||||
_FIRMessagingDevAssert(startDate, @"Invalid local start date format %@", startTimeString);
|
||||
if (!startTimeString) {
|
||||
FIRMessagingLoggerError(kFIRMessagingMessageCodeContextManagerService002,
|
||||
@"Invalid local start date format %@. Message dropped",
|
||||
startTimeString);
|
||||
return NO;
|
||||
}
|
||||
|
||||
NSDate *currentDate = [NSDate date];
|
||||
|
||||
if ([currentDate compare:startDate] == NSOrderedAscending) {
|
||||
@@ -106,8 +104,6 @@ typedef NS_ENUM(NSUInteger, FIRMessagingContextManagerMessageType) {
|
||||
}
|
||||
|
||||
NSDate *endDate = [dateFormatter dateFromString:endTimeString];
|
||||
|
||||
_FIRMessagingDevAssert(endDate, @"Invalid local end date format %@", endTimeString);
|
||||
if (!endTimeString) {
|
||||
FIRMessagingLoggerError(kFIRMessagingMessageCodeContextManagerService004,
|
||||
@"Invalid local end date format %@. Message dropped", endTimeString);
|
||||
@@ -153,7 +149,7 @@ typedef NS_ENUM(NSUInteger, FIRMessagingContextManagerMessageType) {
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wunguarded-availability"
|
||||
notification.alertTitle = apsDictionary[kFIRMessagingContextManagerTitleKey];
|
||||
#pragma pop
|
||||
#pragma clang diagnostic pop
|
||||
}
|
||||
}
|
||||
|
||||
@@ -179,7 +175,10 @@ typedef NS_ENUM(NSUInteger, FIRMessagingContextManagerMessageType) {
|
||||
if (!application) {
|
||||
return;
|
||||
}
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||
[application scheduleLocalNotification:notification];
|
||||
#pragma clang diagnostic pop
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -192,6 +191,11 @@ typedef NS_ENUM(NSUInteger, FIRMessagingContextManagerMessageType) {
|
||||
continue;
|
||||
} else if ([keyString hasPrefix:kContextManagerPrefixKey]) {
|
||||
continue;
|
||||
} else if ([keyString isEqualToString:kFIRMessagingAPNSPayloadKey]) {
|
||||
// Local timezone message is scheduled with FCM payload. APNS payload with
|
||||
// content_available should be ignored and not passed to the scheduled
|
||||
// messages.
|
||||
continue;
|
||||
}
|
||||
}
|
||||
data[[key copy]] = message[key];
|
||||
|
||||
+21
-23
@@ -14,22 +14,22 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#import "FIRMessagingDataMessageManager.h"
|
||||
#import "Firebase/Messaging/FIRMessagingDataMessageManager.h"
|
||||
|
||||
#import "Protos/GtalkCore.pbobjc.h"
|
||||
#import "Firebase/Messaging/Protos/GtalkCore.pbobjc.h"
|
||||
|
||||
#import "FIRMessagingClient.h"
|
||||
#import "FIRMessagingConnection.h"
|
||||
#import "FIRMessagingConstants.h"
|
||||
#import "FIRMessagingDefines.h"
|
||||
#import "FIRMessagingDelayedMessageQueue.h"
|
||||
#import "FIRMessagingLogger.h"
|
||||
#import "FIRMessagingReceiver.h"
|
||||
#import "FIRMessagingRmqManager.h"
|
||||
#import "FIRMessaging_Private.h"
|
||||
#import "FIRMessagingSyncMessageManager.h"
|
||||
#import "FIRMessagingUtilities.h"
|
||||
#import "NSError+FIRMessaging.h"
|
||||
#import "Firebase/Messaging/FIRMessagingClient.h"
|
||||
#import "Firebase/Messaging/FIRMessagingConnection.h"
|
||||
#import "Firebase/Messaging/FIRMessagingConstants.h"
|
||||
#import "Firebase/Messaging/FIRMessagingDefines.h"
|
||||
#import "Firebase/Messaging/FIRMessagingDelayedMessageQueue.h"
|
||||
#import "Firebase/Messaging/FIRMessagingLogger.h"
|
||||
#import "Firebase/Messaging/FIRMessagingReceiver.h"
|
||||
#import "Firebase/Messaging/FIRMessagingRmqManager.h"
|
||||
#import "Firebase/Messaging/FIRMessaging_Private.h"
|
||||
#import "Firebase/Messaging/FIRMessagingSyncMessageManager.h"
|
||||
#import "Firebase/Messaging/FIRMessagingUtilities.h"
|
||||
#import "Firebase/Messaging/NSError+FIRMessaging.h"
|
||||
|
||||
static const int kMaxAppDataSizeDefault = 4 * 1024; // 4k
|
||||
static const int kMinDelaySeconds = 1; // 1 second
|
||||
@@ -96,8 +96,9 @@ typedef NS_ENUM(int8_t, UpstreamForceReconnect) {
|
||||
}
|
||||
|
||||
- (void)setDeviceAuthID:(NSString *)deviceAuthID secretToken:(NSString *)secretToken {
|
||||
_FIRMessagingDevAssert([deviceAuthID length] && [secretToken length],
|
||||
@"Invalid credentials for FIRMessaging");
|
||||
if (deviceAuthID.length == 0 || secretToken.length == 0) {
|
||||
FIRMessagingLoggerWarn(kFIRMessagingMessageCodeDataMessageManager013, @"Invalid credentials: deviceAuthID: %@, secrectToken: %@", deviceAuthID, secretToken);
|
||||
}
|
||||
self.deviceAuthID = deviceAuthID;
|
||||
self.secretToken = secretToken;
|
||||
}
|
||||
@@ -135,31 +136,29 @@ typedef NS_ENUM(int8_t, UpstreamForceReconnect) {
|
||||
- (NSDictionary *)parseDataMessage:(GtalkDataMessageStanza *)dataMessage {
|
||||
NSMutableDictionary *message = [NSMutableDictionary dictionary];
|
||||
NSString *from = [dataMessage from];
|
||||
if ([from length]) {
|
||||
if (from.length) {
|
||||
message[kFIRMessagingFromKey] = from;
|
||||
}
|
||||
|
||||
// raw data
|
||||
NSData *rawData = [dataMessage rawData];
|
||||
if ([rawData length]) {
|
||||
if (rawData.length) {
|
||||
message[kFIRMessagingRawDataKey] = rawData;
|
||||
}
|
||||
|
||||
NSString *token = [dataMessage token];
|
||||
if ([token length]) {
|
||||
if (token.length) {
|
||||
message[kFIRMessagingCollapseKey] = token;
|
||||
}
|
||||
|
||||
// Add the persistent_id. This would be removed later before sending the message to the device.
|
||||
NSString *persistentID = [dataMessage persistentId];
|
||||
_FIRMessagingDevAssert([persistentID length], @"Invalid MCS message without persistentID");
|
||||
if ([persistentID length]) {
|
||||
if (persistentID.length) {
|
||||
message[kFIRMessagingMessageIDKey] = persistentID;
|
||||
}
|
||||
|
||||
// third-party data
|
||||
for (GtalkAppData *item in dataMessage.appDataArray) {
|
||||
_FIRMessagingDevAssert(item.hasKey && item.hasValue, @"Invalid AppData");
|
||||
|
||||
// do not process the "from" key -- is not useful
|
||||
if ([kFIRMessagingFromKey isEqualToString:item.key]) {
|
||||
@@ -175,7 +174,6 @@ typedef NS_ENUM(int8_t, UpstreamForceReconnect) {
|
||||
}
|
||||
message[kDataMessageNotificationKey][key] = item.value;
|
||||
} else {
|
||||
_FIRMessagingDevAssert([key length], @"Invalid key in MCS message: %@", key);
|
||||
FIRMessagingLoggerError(kFIRMessagingMessageCodeDataMessageManager001,
|
||||
@"Invalid key in MCS message: %@", key);
|
||||
}
|
||||
|
||||
+1
-38
@@ -17,16 +17,6 @@
|
||||
#ifndef FIRMessaging_xcodeproj_FIRMessagingDefines_h
|
||||
#define FIRMessaging_xcodeproj_FIRMessagingDefines_h
|
||||
|
||||
#define _FIRMessaging_VERBOSE_LOGGING 1
|
||||
|
||||
// Verbose Logging
|
||||
#if (_FIRMessaging_VERBOSE_LOGGING)
|
||||
#define FIRMessaging_DEV_VERBOSE_LOG(...) NSLog(__VA_ARGS__)
|
||||
#else
|
||||
#define FIRMessaging_DEV_VERBOSE_LOG(...) do { } while (0)
|
||||
#endif // FIRMessaging_VERBOSE_LOGGING
|
||||
|
||||
|
||||
// WEAKIFY & STRONGIFY
|
||||
// Helper macro.
|
||||
#define _FIRMessaging_WEAKNAME(VAR) VAR ## _weak_
|
||||
@@ -40,45 +30,18 @@ __strong __typeof__(VAR) VAR = _FIRMessaging_WEAKNAME(VAR); \
|
||||
_Pragma("clang diagnostic pop")
|
||||
|
||||
|
||||
// Type Conversions (used for NSInteger etc)
|
||||
#ifndef _FIRMessaging_L
|
||||
#define _FIRMessaging_L(v) (long)(v)
|
||||
#endif
|
||||
|
||||
#ifndef _FIRMessaging_UL
|
||||
#define _FIRMessaging_UL(v) (unsigned long)(v)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
// Debug Assert
|
||||
#ifndef _FIRMessagingDevAssert
|
||||
// we directly invoke the NSAssert handler so we can pass on the varargs
|
||||
// (NSAssert doesn't have a macro we can use that takes varargs)
|
||||
#ifdef DEBUG
|
||||
#define _FIRMessagingDevAssert(condition, ...) \
|
||||
do { \
|
||||
if (!(condition)) { \
|
||||
[[NSAssertionHandler currentHandler] \
|
||||
handleFailureInFunction:(NSString *) \
|
||||
[NSString stringWithUTF8String:__PRETTY_FUNCTION__] \
|
||||
file:(NSString *)[NSString stringWithUTF8String:__FILE__] \
|
||||
lineNumber:__LINE__ \
|
||||
description:__VA_ARGS__]; \
|
||||
} \
|
||||
} while(0)
|
||||
#else // !defined(DEBUG)
|
||||
#define _FIRMessagingDevAssert(condition, ...) do { } while (0)
|
||||
#endif // !defined(DEBUG)
|
||||
|
||||
#endif // _FIRMessagingDevAssert
|
||||
|
||||
// Invalidates the initializer from which it's called.
|
||||
#ifndef FIRMessagingInvalidateInitializer
|
||||
#define FIRMessagingInvalidateInitializer() \
|
||||
do { \
|
||||
[self class]; /* Avoid warning of dead store to |self|. */ \
|
||||
_FIRMessagingDevAssert(NO, @"Invalid initializer."); \
|
||||
NSAssert(NO, @"Invalid initializer."); \
|
||||
return nil; \
|
||||
} while (0)
|
||||
#endif
|
||||
|
||||
+5
-6
@@ -14,13 +14,13 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#import "FIRMessagingDelayedMessageQueue.h"
|
||||
#import "Firebase/Messaging/FIRMessagingDelayedMessageQueue.h"
|
||||
|
||||
#import "Protos/GtalkCore.pbobjc.h"
|
||||
#import "Firebase/Messaging/Protos/GtalkCore.pbobjc.h"
|
||||
|
||||
#import "FIRMessagingDefines.h"
|
||||
#import "FIRMessagingRmqManager.h"
|
||||
#import "FIRMessagingUtilities.h"
|
||||
#import "Firebase/Messaging/FIRMessagingDefines.h"
|
||||
#import "Firebase/Messaging/FIRMessagingRmqManager.h"
|
||||
#import "Firebase/Messaging/FIRMessagingUtilities.h"
|
||||
|
||||
static const int kMaxQueuedMessageCount = 10;
|
||||
|
||||
@@ -49,7 +49,6 @@ static const int kMaxQueuedMessageCount = 10;
|
||||
|
||||
- (instancetype)initWithRmqScanner:(id<FIRMessagingRmqScanner>)rmqScanner
|
||||
sendDelayedMessagesHandler:(FIRMessagingSendDelayedMessagesHandler)sendDelayedMessagesHandler {
|
||||
_FIRMessagingDevAssert(sendDelayedMessagesHandler, @"Invalid nil callback for delayed messages");
|
||||
self = [super init];
|
||||
if (self) {
|
||||
_rmqScanner = rmqScanner;
|
||||
|
||||
@@ -14,10 +14,10 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#import "FIRMessagingExtensionHelper.h"
|
||||
#import <FirebaseMessaging/FIRMessagingExtensionHelper.h>
|
||||
|
||||
#import "FIRMMessageCode.h"
|
||||
#import "FIRMessagingLogger.h"
|
||||
#import "Firebase/Messaging/FIRMMessageCode.h"
|
||||
#import "Firebase/Messaging/FIRMessagingLogger.h"
|
||||
|
||||
static NSString *const kPayloadOptionsName = @"fcm_options";
|
||||
static NSString *const kPayloadOptionsImageURLName = @"image";
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#import "FIRMessagingLogger.h"
|
||||
#import "Firebase/Messaging/FIRMessagingLogger.h"
|
||||
|
||||
#import <FirebaseCore/FIRLogger.h>
|
||||
|
||||
|
||||
@@ -14,9 +14,9 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#import "FIRMessagingPacketQueue.h"
|
||||
#import "Firebase/Messaging/FIRMessagingPacketQueue.h"
|
||||
|
||||
#import "FIRMessagingDefines.h"
|
||||
#import "Firebase/Messaging/FIRMessagingDefines.h"
|
||||
|
||||
@interface FIRMessagingPacket ()
|
||||
|
||||
|
||||
@@ -16,8 +16,9 @@
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import "FIRMessaging.h"
|
||||
#import "FIRMessagingTopicsCommon.h"
|
||||
#import <FirebaseMessaging/FIRMessaging.h>
|
||||
|
||||
#import "Firebase/Messaging/FIRMessagingTopicsCommon.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
|
||||
@@ -14,13 +14,13 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#import "FIRMessagingPendingTopicsList.h"
|
||||
#import "Firebase/Messaging/FIRMessagingPendingTopicsList.h"
|
||||
|
||||
#import "FIRMessaging_Private.h"
|
||||
#import "FIRMessagingLogger.h"
|
||||
#import "FIRMessagingPubSub.h"
|
||||
#import "Firebase/Messaging/FIRMessaging_Private.h"
|
||||
#import "Firebase/Messaging/FIRMessagingLogger.h"
|
||||
#import "Firebase/Messaging/FIRMessagingPubSub.h"
|
||||
|
||||
#import "FIRMessagingDefines.h"
|
||||
#import "Firebase/Messaging/FIRMessagingDefines.h"
|
||||
|
||||
NSString *const kPendingTopicBatchActionKey = @"action";
|
||||
NSString *const kPendingTopicBatchTopicsKey = @"topics";
|
||||
|
||||
+2
-2
@@ -14,9 +14,9 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#import "FIRMessagingPersistentSyncMessage.h"
|
||||
#import "Firebase/Messaging/FIRMessagingPersistentSyncMessage.h"
|
||||
|
||||
#import "FIRMessagingDefines.h"
|
||||
#import "Firebase/Messaging/FIRMessagingDefines.h"
|
||||
|
||||
@interface FIRMessagingPersistentSyncMessage ()
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#import "FIRMessaging.h"
|
||||
#import <FirebaseMessaging/FIRMessaging.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
|
||||
+10
-16
@@ -14,19 +14,19 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#import "FIRMessagingPubSub.h"
|
||||
#import "Firebase/Messaging/FIRMessagingPubSub.h"
|
||||
|
||||
#import <GoogleUtilities/GULUserDefaults.h>
|
||||
#import <FirebaseMessaging/FIRMessaging.h>
|
||||
|
||||
#import "FIRMessaging.h"
|
||||
#import "FIRMessagingClient.h"
|
||||
#import "FIRMessagingDefines.h"
|
||||
#import "FIRMessagingLogger.h"
|
||||
#import "FIRMessagingPendingTopicsList.h"
|
||||
#import "FIRMessagingUtilities.h"
|
||||
#import "FIRMessaging_Private.h"
|
||||
#import "NSDictionary+FIRMessaging.h"
|
||||
#import "NSError+FIRMessaging.h"
|
||||
#import "Firebase/Messaging/FIRMessagingClient.h"
|
||||
#import "Firebase/Messaging/FIRMessagingDefines.h"
|
||||
#import "Firebase/Messaging/FIRMessagingLogger.h"
|
||||
#import "Firebase/Messaging/FIRMessagingPendingTopicsList.h"
|
||||
#import "Firebase/Messaging/FIRMessagingUtilities.h"
|
||||
#import "Firebase/Messaging/FIRMessaging_Private.h"
|
||||
#import "Firebase/Messaging/NSDictionary+FIRMessaging.h"
|
||||
#import "Firebase/Messaging/NSError+FIRMessaging.h"
|
||||
|
||||
static NSString *const kPendingSubscriptionsListKey =
|
||||
@"com.firebase.messaging.pending-subscriptions";
|
||||
@@ -59,8 +59,6 @@ static NSString *const kPendingSubscriptionsListKey =
|
||||
topic:(NSString *)topic
|
||||
options:(NSDictionary *)options
|
||||
handler:(FIRMessagingTopicOperationCompletion)handler {
|
||||
_FIRMessagingDevAssert([token length], @"FIRMessaging error no token specified");
|
||||
_FIRMessagingDevAssert([topic length], @"FIRMessaging error Invalid empty topic specified");
|
||||
if (!self.client) {
|
||||
handler([NSError errorWithFCMErrorCode:kFIRMessagingErrorCodePubSubFIRMessagingNotSetup]);
|
||||
return;
|
||||
@@ -102,14 +100,10 @@ static NSString *const kPendingSubscriptionsListKey =
|
||||
topic:(NSString *)topic
|
||||
options:(NSDictionary *)options
|
||||
handler:(FIRMessagingTopicOperationCompletion)handler {
|
||||
_FIRMessagingDevAssert([token length], @"FIRMessaging error no token specified");
|
||||
_FIRMessagingDevAssert([topic length], @"FIRMessaging error Invalid empty topic specified");
|
||||
|
||||
if (!self.client) {
|
||||
handler([NSError errorWithFCMErrorCode:kFIRMessagingErrorCodePubSubFIRMessagingNotSetup]);
|
||||
return;
|
||||
}
|
||||
|
||||
token = [token copy];
|
||||
topic = [topic copy];
|
||||
if (![options count]) {
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#import "FIRMessagingTopicOperation.h"
|
||||
#import "Firebase/Messaging/FIRMessagingTopicOperation.h"
|
||||
|
||||
@interface FIRMessagingPubSubRegistrar : NSObject
|
||||
|
||||
|
||||
@@ -14,12 +14,12 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#import "FIRMessagingPubSubRegistrar.h"
|
||||
#import "Firebase/Messaging/FIRMessagingPubSubRegistrar.h"
|
||||
|
||||
#import "FIRMessagingDefines.h"
|
||||
#import "FIRMessagingPubSubRegistrar.h"
|
||||
#import "FIRMessagingTopicsCommon.h"
|
||||
#import "NSError+FIRMessaging.h"
|
||||
#import "Firebase/Messaging/FIRMessagingDefines.h"
|
||||
#import "Firebase/Messaging/FIRMessagingPubSubRegistrar.h"
|
||||
#import "Firebase/Messaging/FIRMessagingTopicsCommon.h"
|
||||
#import "Firebase/Messaging/NSError+FIRMessaging.h"
|
||||
|
||||
@interface FIRMessagingPubSubRegistrar ()
|
||||
|
||||
|
||||
@@ -14,8 +14,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#import "FIRMessagingDataMessageManager.h"
|
||||
#import "FIRMessaging.h"
|
||||
#import <FirebaseMessaging/FIRMessaging.h>
|
||||
#import "Firebase/Messaging/FIRMessagingDataMessageManager.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
|
||||
@@ -14,12 +14,13 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#import "FIRMessagingReceiver.h"
|
||||
#import "Firebase/Messaging/FIRMessagingReceiver.h"
|
||||
|
||||
#import "FIRMessaging.h"
|
||||
#import "FIRMessagingLogger.h"
|
||||
#import "FIRMessagingUtilities.h"
|
||||
#import "FIRMessaging_Private.h"
|
||||
#import <FirebaseMessaging/FIRMessaging.h>
|
||||
|
||||
#import "Firebase/Messaging/FIRMessagingLogger.h"
|
||||
#import "Firebase/Messaging/FIRMessagingUtilities.h"
|
||||
#import "Firebase/Messaging/FIRMessaging_Private.h"
|
||||
|
||||
static NSString *const kUpstreamMessageIDUserInfoKey = @"messageID";
|
||||
static NSString *const kUpstreamErrorUserInfoKey = @"error";
|
||||
|
||||
+49
-49
@@ -14,14 +14,14 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#import "FIRMessagingRemoteNotificationsProxy.h"
|
||||
#import "Firebase/Messaging/FIRMessagingRemoteNotificationsProxy.h"
|
||||
|
||||
#import <objc/runtime.h>
|
||||
|
||||
#import "FIRMessagingConstants.h"
|
||||
#import "FIRMessagingLogger.h"
|
||||
#import "FIRMessagingUtilities.h"
|
||||
#import "FIRMessaging_Private.h"
|
||||
#import "Firebase/Messaging/FIRMessagingConstants.h"
|
||||
#import "Firebase/Messaging/FIRMessagingLogger.h"
|
||||
#import "Firebase/Messaging/FIRMessagingUtilities.h"
|
||||
#import "Firebase/Messaging/FIRMessaging_Private.h"
|
||||
#import <GoogleUtilities/GULAppDelegateSwizzler.h>
|
||||
|
||||
static void * UserNotificationObserverContext = &UserNotificationObserverContext;
|
||||
@@ -93,9 +93,9 @@ static NSString *kUserNotificationDidReceiveResponseSelectorString =
|
||||
Class notificationCenterClass = NSClassFromString(@"UNUserNotificationCenter");
|
||||
if (notificationCenterClass) {
|
||||
// We are linked against iOS 10 SDK or above
|
||||
id notificationCenter = getNamedPropertyFromObject(notificationCenterClass,
|
||||
@"currentNotificationCenter",
|
||||
notificationCenterClass);
|
||||
id notificationCenter = FIRMessagingPropertyNameFromObject(notificationCenterClass,
|
||||
@"currentNotificationCenter",
|
||||
notificationCenterClass);
|
||||
if (notificationCenter) {
|
||||
[self listenForDelegateChangesInUserNotificationCenter:notificationCenter];
|
||||
}
|
||||
@@ -125,7 +125,7 @@ static NSString *kUserNotificationDidReceiveResponseSelectorString =
|
||||
if (![notificationCenter isKindOfClass:notificationCenterClass]) {
|
||||
return;
|
||||
}
|
||||
id delegate = getNamedPropertyFromObject(notificationCenter, @"delegate", nil);
|
||||
id delegate = FIRMessagingPropertyNameFromObject(notificationCenter, @"delegate", nil);
|
||||
Protocol *delegateProtocol = NSProtocolFromString(@"UNUserNotificationCenterDelegate");
|
||||
if ([delegate conformsToProtocol:delegateProtocol]) {
|
||||
// Swizzle this object now, if available
|
||||
@@ -156,7 +156,7 @@ static NSString *kUserNotificationDidReceiveResponseSelectorString =
|
||||
if ([delegate respondsToSelector:willPresentNotificationSelector]) {
|
||||
[self swizzleSelector:willPresentNotificationSelector
|
||||
inClass:[delegate class]
|
||||
withImplementation:(IMP)FCM_swizzle_willPresentNotificationWithHandler
|
||||
withImplementation:(IMP)FCMSwizzleWillPresentNotificationWithHandler
|
||||
inProtocol:userNotificationCenterProtocol];
|
||||
}
|
||||
SEL didReceiveNotificationResponseSelector =
|
||||
@@ -164,7 +164,7 @@ static NSString *kUserNotificationDidReceiveResponseSelectorString =
|
||||
if ([delegate respondsToSelector:didReceiveNotificationResponseSelector]) {
|
||||
[self swizzleSelector:didReceiveNotificationResponseSelector
|
||||
inClass:[delegate class]
|
||||
withImplementation:(IMP)FCM_swizzle_didReceiveNotificationResponseWithHandler
|
||||
withImplementation:(IMP)FCMSwizzleDidReceiveNotificationResponseWithHandler
|
||||
inProtocol:userNotificationCenterProtocol];
|
||||
}
|
||||
self.currentUserNotificationCenterDelegate = delegate;
|
||||
@@ -263,13 +263,13 @@ static NSString *kUserNotificationDidReceiveResponseSelectorString =
|
||||
|
||||
- (IMP)originalImplementationForSelector:(SEL)selector {
|
||||
NSString *selectorString = NSStringFromSelector(selector);
|
||||
NSValue *implementation_value = self.originalAppDelegateImps[selectorString];
|
||||
if (!implementation_value) {
|
||||
NSValue *implementationValue = self.originalAppDelegateImps[selectorString];
|
||||
if (!implementationValue) {
|
||||
return nil;
|
||||
}
|
||||
|
||||
IMP imp;
|
||||
[implementation_value getValue:&imp];
|
||||
[implementationValue getValue:&imp];
|
||||
return imp;
|
||||
}
|
||||
|
||||
@@ -300,27 +300,27 @@ static NSString *kUserNotificationDidReceiveResponseSelectorString =
|
||||
// This class implements this method, so replace the original implementation
|
||||
// with our new implementation and save the old implementation.
|
||||
|
||||
IMP __original_method_implementation =
|
||||
IMP originalMethodImplementation =
|
||||
method_setImplementation(originalMethod, swizzledImplementation);
|
||||
|
||||
IMP __nonexistant_method_implementation = [self nonExistantMethodImplementationForClass:klass];
|
||||
IMP nonexistantMethodImplementation = [self nonExistantMethodImplementationForClass:klass];
|
||||
|
||||
if (__original_method_implementation &&
|
||||
__original_method_implementation != __nonexistant_method_implementation &&
|
||||
__original_method_implementation != swizzledImplementation) {
|
||||
[self saveOriginalImplementation:__original_method_implementation
|
||||
if (originalMethodImplementation &&
|
||||
originalMethodImplementation != nonexistantMethodImplementation &&
|
||||
originalMethodImplementation != swizzledImplementation) {
|
||||
[self saveOriginalImplementation:originalMethodImplementation
|
||||
forSelector:originalSelector];
|
||||
}
|
||||
} else {
|
||||
// The class doesn't have this method, so add our swizzled implementation as the
|
||||
// original implementation of the original method.
|
||||
struct objc_method_description method_description =
|
||||
struct objc_method_description methodDescription =
|
||||
protocol_getMethodDescription(protocol, originalSelector, NO, YES);
|
||||
|
||||
BOOL methodAdded = class_addMethod(klass,
|
||||
originalSelector,
|
||||
swizzledImplementation,
|
||||
method_description.types);
|
||||
methodDescription.types);
|
||||
if (!methodAdded) {
|
||||
FIRMessagingLoggerError(kFIRMessagingMessageCodeRemoteNotificationsProxyMethodNotAdded,
|
||||
@"Could not add method for %@ to class %@",
|
||||
@@ -339,10 +339,10 @@ static NSString *kUserNotificationDidReceiveResponseSelectorString =
|
||||
return;
|
||||
}
|
||||
|
||||
IMP original_imp = [self originalImplementationForSelector:selector];
|
||||
if (original_imp) {
|
||||
IMP originalImp = [self originalImplementationForSelector:selector];
|
||||
if (originalImp) {
|
||||
// Restore the original implementation as the current implementation
|
||||
method_setImplementation(swizzledMethod, original_imp);
|
||||
method_setImplementation(swizzledMethod, originalImp);
|
||||
[self removeImplementationForSelector:selector];
|
||||
} else {
|
||||
// This class originally did not have an implementation for this selector.
|
||||
@@ -369,7 +369,7 @@ static NSString *kUserNotificationDidReceiveResponseSelectorString =
|
||||
}
|
||||
|
||||
// A safe, non-leaky way return a property object by its name
|
||||
id getNamedPropertyFromObject(id object, NSString *propertyName, Class klass) {
|
||||
id FIRMessagingPropertyNameFromObject(id object, NSString *propertyName, Class klass) {
|
||||
SEL selector = NSSelectorFromString(propertyName);
|
||||
if (![object respondsToSelector:selector]) {
|
||||
return nil;
|
||||
@@ -433,16 +433,16 @@ didFailToRegisterForRemoteNotificationsWithError:(NSError *)error {
|
||||
* In order to make FCM SDK compile and compatible with iOS SDKs before iOS 10, hide the
|
||||
* parameter types from the swizzling implementation.
|
||||
*/
|
||||
void FCM_swizzle_willPresentNotificationWithHandler(
|
||||
id self, SEL _cmd, id center, id notification, void (^handler)(NSUInteger)) {
|
||||
static void FCMSwizzleWillPresentNotificationWithHandler(
|
||||
id self, SEL cmd, id center, id notification, void (^handler)(NSUInteger)) {
|
||||
|
||||
FIRMessagingRemoteNotificationsProxy *proxy = [FIRMessagingRemoteNotificationsProxy sharedProxy];
|
||||
IMP original_imp = [proxy originalImplementationForSelector:_cmd];
|
||||
IMP originalImp = [proxy originalImplementationForSelector:cmd];
|
||||
|
||||
void (^callOriginalMethodIfAvailable)(void) = ^{
|
||||
if (original_imp) {
|
||||
((void (*)(id, SEL, id, id, void (^)(NSUInteger)))original_imp)(
|
||||
self, _cmd, center, notification, handler);
|
||||
if (originalImp) {
|
||||
((void (*)(id, SEL, id, id, void (^)(NSUInteger)))originalImp)(
|
||||
self, cmd, center, notification, handler);
|
||||
}
|
||||
return;
|
||||
};
|
||||
@@ -476,7 +476,7 @@ void FCM_swizzle_willPresentNotificationWithHandler(
|
||||
}
|
||||
|
||||
// Attempt to access the user info
|
||||
id notificationUserInfo = userInfoFromNotification(notification);
|
||||
id notificationUserInfo = FIRMessagingUserInfoFromNotification(notification);
|
||||
|
||||
if (!notificationUserInfo) {
|
||||
// Could not access notification.request.content.userInfo.
|
||||
@@ -498,16 +498,16 @@ void FCM_swizzle_willPresentNotificationWithHandler(
|
||||
* In order to make FCM SDK compile and compatible with iOS SDKs before iOS 10, hide the
|
||||
* parameter types from the swizzling implementation.
|
||||
*/
|
||||
void FCM_swizzle_didReceiveNotificationResponseWithHandler(
|
||||
id self, SEL _cmd, id center, id response, void (^handler)(void)) {
|
||||
static void FCMSwizzleDidReceiveNotificationResponseWithHandler(
|
||||
id self, SEL cmd, id center, id response, void (^handler)(void)) {
|
||||
|
||||
FIRMessagingRemoteNotificationsProxy *proxy = [FIRMessagingRemoteNotificationsProxy sharedProxy];
|
||||
IMP original_imp = [proxy originalImplementationForSelector:_cmd];
|
||||
IMP originalImp = [proxy originalImplementationForSelector:cmd];
|
||||
|
||||
void (^callOriginalMethodIfAvailable)(void) = ^{
|
||||
if (original_imp) {
|
||||
((void (*)(id, SEL, id, id, void (^)(void)))original_imp)(
|
||||
self, _cmd, center, response, handler);
|
||||
if (originalImp) {
|
||||
((void (*)(id, SEL, id, id, void (^)(void)))originalImp)(
|
||||
self, cmd, center, response, handler);
|
||||
}
|
||||
return;
|
||||
};
|
||||
@@ -543,11 +543,11 @@ void FCM_swizzle_didReceiveNotificationResponseWithHandler(
|
||||
return;
|
||||
}
|
||||
id notificationClass = NSClassFromString(@"UNNotification");
|
||||
id notification = getNamedPropertyFromObject(response, @"notification", notificationClass);
|
||||
id notification = FIRMessagingPropertyNameFromObject(response, @"notification", notificationClass);
|
||||
|
||||
// With a notification object, use the common code to reach deep into notification
|
||||
// (notification.request.content.userInfo)
|
||||
id notificationUserInfo = userInfoFromNotification(notification);
|
||||
id notificationUserInfo = FIRMessagingUserInfoFromNotification(notification);
|
||||
if (!notificationUserInfo) {
|
||||
// Could not access notification.request.content.userInfo.
|
||||
callOriginalMethodIfAvailable();
|
||||
@@ -559,7 +559,7 @@ void FCM_swizzle_didReceiveNotificationResponseWithHandler(
|
||||
callOriginalMethodIfAvailable();
|
||||
}
|
||||
|
||||
id userInfoFromNotification(id notification) {
|
||||
static id FIRMessagingUserInfoFromNotification(id notification) {
|
||||
|
||||
// Select the userInfo field from UNNotification.request.content.userInfo.
|
||||
SEL requestSelector = NSSelectorFromString(@"request");
|
||||
@@ -568,7 +568,7 @@ id userInfoFromNotification(id notification) {
|
||||
return nil;
|
||||
}
|
||||
Class requestClass = NSClassFromString(@"UNNotificationRequest");
|
||||
id notificationRequest = getNamedPropertyFromObject(notification, @"request", requestClass);
|
||||
id notificationRequest = FIRMessagingPropertyNameFromObject(notification, @"request", requestClass);
|
||||
|
||||
SEL notificationContentSelector = NSSelectorFromString(@"content");
|
||||
if (!notificationRequest
|
||||
@@ -577,9 +577,9 @@ id userInfoFromNotification(id notification) {
|
||||
return nil;
|
||||
}
|
||||
Class contentClass = NSClassFromString(@"UNNotificationContent");
|
||||
id notificationContent = getNamedPropertyFromObject(notificationRequest,
|
||||
@"content",
|
||||
contentClass);
|
||||
id notificationContent = FIRMessagingPropertyNameFromObject(notificationRequest,
|
||||
@"content",
|
||||
contentClass);
|
||||
|
||||
SEL notificationUserInfoSelector = NSSelectorFromString(@"userInfo");
|
||||
if (!notificationContent
|
||||
@@ -587,9 +587,9 @@ id userInfoFromNotification(id notification) {
|
||||
// Cannot access the userInfo property.
|
||||
return nil;
|
||||
}
|
||||
id notificationUserInfo = getNamedPropertyFromObject(notificationContent,
|
||||
@"userInfo",
|
||||
[NSDictionary class]);
|
||||
id notificationUserInfo = FIRMessagingPropertyNameFromObject(notificationContent,
|
||||
@"userInfo",
|
||||
[NSDictionary class]);
|
||||
|
||||
if (!notificationUserInfo) {
|
||||
// This is not the expected notification handler.
|
||||
|
||||
+10
-27
@@ -14,17 +14,17 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#import "FIRMessagingRmq2PersistentStore.h"
|
||||
#import "Firebase/Messaging/FIRMessagingRmq2PersistentStore.h"
|
||||
|
||||
#import <sqlite3.h>
|
||||
|
||||
#import "FIRMessagingConstants.h"
|
||||
#import "FIRMessagingDefines.h"
|
||||
#import "FIRMessagingLogger.h"
|
||||
#import "FIRMessagingPersistentSyncMessage.h"
|
||||
#import "FIRMessagingUtilities.h"
|
||||
#import "NSError+FIRMessaging.h"
|
||||
#import "Protos/GtalkCore.pbobjc.h"
|
||||
#import "Firebase/Messaging/FIRMessagingConstants.h"
|
||||
#import "Firebase/Messaging/FIRMessagingDefines.h"
|
||||
#import "Firebase/Messaging/FIRMessagingLogger.h"
|
||||
#import "Firebase/Messaging/FIRMessagingPersistentSyncMessage.h"
|
||||
#import "Firebase/Messaging/FIRMessagingUtilities.h"
|
||||
#import "Firebase/Messaging/NSError+FIRMessaging.h"
|
||||
#import "Firebase/Messaging/Protos/GtalkCore.pbobjc.h"
|
||||
|
||||
#ifndef _FIRMessagingRmqLogAndExit
|
||||
#define _FIRMessagingRmqLogAndExit(stmt, return_value) \
|
||||
@@ -106,7 +106,7 @@ NSString * _Nonnull FIRMessagingStringFromSQLiteResult(int result) {
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wunguarded-availability"
|
||||
const char *errorStr = sqlite3_errstr(result);
|
||||
#pragma pop
|
||||
#pragma clang diagnostic pop
|
||||
NSString *errorString = [NSString stringWithFormat:@"%d - %s", result, errorStr];
|
||||
return errorString;
|
||||
}
|
||||
@@ -395,12 +395,6 @@ NSString * _Nonnull FIRMessagingStringFromSQLiteResult(int result) {
|
||||
|
||||
- (int)deleteMessagesFromTable:(NSString *)tableName
|
||||
withRmqIds:(NSArray *)rmqIds {
|
||||
_FIRMessagingDevAssert([tableName isEqualToString:kTableOutgoingRmqMessages] ||
|
||||
[tableName isEqualToString:kTableLastRmqId] ||
|
||||
[tableName isEqualToString:kTableS2DRmqIds] ||
|
||||
[tableName isEqualToString:kTableSyncMessages],
|
||||
@"%@: Invalid Table Name %@", kFCMRmqStoreTag, tableName);
|
||||
|
||||
BOOL isRmqIDString = NO;
|
||||
// RmqID is a string only for outgoing messages
|
||||
if ([tableName isEqualToString:kTableS2DRmqIds] ||
|
||||
@@ -592,9 +586,7 @@ NSString * _Nonnull FIRMessagingStringFromSQLiteResult(int result) {
|
||||
int8_t type = sqlite3_column_int(statement, typeColumnNumber);
|
||||
const void *bytes = sqlite3_column_blob(statement, dataColumnNumber);
|
||||
int length = sqlite3_column_bytes(statement, dataColumnNumber);
|
||||
_FIRMessagingDevAssert(bytes != NULL,
|
||||
@"%@ Message with no data being stored in Rmq",
|
||||
kFCMRmqStoreTag);
|
||||
|
||||
NSData *data = [NSData dataWithBytes:bytes length:length];
|
||||
handler(rmqId, type, data);
|
||||
}
|
||||
@@ -604,8 +596,6 @@ NSString * _Nonnull FIRMessagingStringFromSQLiteResult(int result) {
|
||||
#pragma mark - Sync Messages
|
||||
|
||||
- (FIRMessagingPersistentSyncMessage *)querySyncMessageWithRmqID:(NSString *)rmqID {
|
||||
_FIRMessagingDevAssert([rmqID length], @"Invalid rmqID key %@ to search in SYNC_RMQ", rmqID);
|
||||
|
||||
NSString *queryFormat = @"SELECT %@ FROM %@ WHERE %@ = '%@'";
|
||||
NSString *query = [NSString stringWithFormat:queryFormat,
|
||||
kSyncMessagesColumns, // SELECT (rmq_id, expiration_ts, apns_recv, mcs_recv)
|
||||
@@ -645,12 +635,10 @@ NSString * _Nonnull FIRMessagingStringFromSQLiteResult(int result) {
|
||||
}
|
||||
sqlite3_finalize(stmt);
|
||||
|
||||
_FIRMessagingDevAssert(count <= 1, @"Found multiple messages in %@ with same RMQ ID", kTableSyncMessages);
|
||||
return persistentMessage;
|
||||
}
|
||||
|
||||
- (BOOL)deleteSyncMessageWithRmqID:(NSString *)rmqID {
|
||||
_FIRMessagingDevAssert([rmqID length], @"Invalid rmqID key %@ to delete in SYNC_RMQ", rmqID);
|
||||
return [self deleteMessagesFromTable:kTableSyncMessages withRmqIds:@[rmqID]] > 0;
|
||||
}
|
||||
|
||||
@@ -695,8 +683,6 @@ NSString * _Nonnull FIRMessagingStringFromSQLiteResult(int result) {
|
||||
apnsReceived:(BOOL)apnsReceived
|
||||
mcsReceived:(BOOL)mcsReceived
|
||||
error:(NSError **)error {
|
||||
_FIRMessagingDevAssert([rmqID length], @"Invalid nil message to persist to SYNC_RMQ");
|
||||
|
||||
NSString *insertFormat = @"INSERT INTO %@ (%@, %@, %@, %@) VALUES (?, ?, ?, ?)";
|
||||
NSString *insertSQL = [NSString stringWithFormat:insertFormat,
|
||||
kTableSyncMessages, // Table name
|
||||
@@ -759,9 +745,6 @@ NSString * _Nonnull FIRMessagingStringFromSQLiteResult(int result) {
|
||||
column:(NSString *)column
|
||||
value:(BOOL)value
|
||||
error:(NSError **)error {
|
||||
_FIRMessagingDevAssert([column isEqualToString:kSyncMessageAPNSReceivedColumn] ||
|
||||
[column isEqualToString:kSyncMessageMCSReceivedColumn],
|
||||
@"Invalid column name %@ for SYNC_RMQ", column);
|
||||
NSString *queryFormat = @"UPDATE %@ " // Table name
|
||||
@"SET %@ = %d " // column=value
|
||||
@"WHERE %@ = ?"; // condition
|
||||
|
||||
@@ -14,15 +14,15 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#import "FIRMessagingRmqManager.h"
|
||||
#import "Firebase/Messaging/FIRMessagingRmqManager.h"
|
||||
|
||||
#import <sqlite3.h>
|
||||
|
||||
#import "FIRMessagingDefines.h"
|
||||
#import "FIRMessagingLogger.h"
|
||||
#import "FIRMessagingRmq2PersistentStore.h"
|
||||
#import "FIRMessagingUtilities.h"
|
||||
#import "Protos/GtalkCore.pbobjc.h"
|
||||
#import "Firebase/Messaging/FIRMessagingDefines.h"
|
||||
#import "Firebase/Messaging/FIRMessagingLogger.h"
|
||||
#import "Firebase/Messaging/FIRMessagingRmq2PersistentStore.h"
|
||||
#import "Firebase/Messaging/FIRMessagingUtilities.h"
|
||||
#import "Firebase/Messaging/Protos/GtalkCore.pbobjc.h"
|
||||
|
||||
#ifndef _FIRMessagingRmqLogAndExit
|
||||
#define _FIRMessagingRmqLogAndExit(stmt, return_value) \
|
||||
@@ -51,7 +51,6 @@ static NSString *const kFCMRmqTag = @"FIRMessagingRmq:";
|
||||
- (instancetype)initWithDatabaseName:(NSString *)databaseName {
|
||||
self = [super init];
|
||||
if (self) {
|
||||
_FIRMessagingDevAssert([databaseName length] > 0, @"RMQ: Invalid rmq db name");
|
||||
_rmq2Store = [[FIRMessagingRmq2PersistentStore alloc] initWithDatabaseName:databaseName];
|
||||
_outstandingMessages = [NSMutableDictionary dictionaryWithCapacity:2];
|
||||
_rmqId = -1;
|
||||
|
||||
@@ -14,16 +14,16 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#import "FIRMessagingSecureSocket.h"
|
||||
#import "Firebase/Messaging/FIRMessagingSecureSocket.h"
|
||||
|
||||
#import <Protobuf/GPBMessage.h>
|
||||
#import <Protobuf/GPBCodedOutputStream.h>
|
||||
#import <Protobuf/GPBUtilities.h>
|
||||
|
||||
#import "FIRMessagingCodedInputStream.h"
|
||||
#import "FIRMessagingDefines.h"
|
||||
#import "FIRMessagingLogger.h"
|
||||
#import "FIRMessagingPacketQueue.h"
|
||||
#import "Firebase/Messaging/FIRMessagingCodedInputStream.h"
|
||||
#import "Firebase/Messaging/FIRMessagingDefines.h"
|
||||
#import "Firebase/Messaging/FIRMessagingLogger.h"
|
||||
#import "Firebase/Messaging/FIRMessagingPacketQueue.h"
|
||||
|
||||
static const NSUInteger kMaxBufferLength = 1024 * 1024; // 1M
|
||||
static const NSUInteger kBufferLengthIncrement = 16 * 1024; // 16k
|
||||
@@ -97,10 +97,6 @@ static NSUInteger SerializedSize(int32_t value) {
|
||||
- (void)connectToHost:(NSString *)host
|
||||
port:(NSUInteger)port
|
||||
onRunLoop:(NSRunLoop *)runLoop {
|
||||
_FIRMessagingDevAssert(host != nil, @"Invalid host");
|
||||
_FIRMessagingDevAssert(runLoop != nil, @"Invalid runloop");
|
||||
_FIRMessagingDevAssert(self.state == kFIRMessagingSecureSocketNotOpen, @"Socket is already connected");
|
||||
|
||||
if (!host || self.state != kFIRMessagingSecureSocketNotOpen) {
|
||||
return;
|
||||
}
|
||||
@@ -140,8 +136,6 @@ static NSUInteger SerializedSize(int32_t value) {
|
||||
if (!self.inStream && !self.outStream) {
|
||||
FIRMessagingLoggerDebug(kFIRMessagingMessageCodeSecureSocket002,
|
||||
@"The socket is not open or already closed.");
|
||||
_FIRMessagingDevAssert(self.state == kFIRMessagingSecureSocketClosed || self.state == kFIRMessagingSecureSocketNotOpen,
|
||||
@"Socket is already disconnected.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -175,7 +169,6 @@ static NSUInteger SerializedSize(int32_t value) {
|
||||
@"Try to read from socket that is not opened");
|
||||
return;
|
||||
}
|
||||
_FIRMessagingDevAssert(stream == self.inStream, @"Incorrect stream");
|
||||
if (![self performRead]) {
|
||||
FIRMessagingLoggerDebug(kFIRMessagingMessageCodeSecureSocket004,
|
||||
@"Error occurred when reading incoming stream");
|
||||
@@ -218,7 +211,6 @@ static NSUInteger SerializedSize(int32_t value) {
|
||||
@"Try to write to socket that is not opened");
|
||||
return;
|
||||
}
|
||||
_FIRMessagingDevAssert(stream == self.outStream, @"Incorrect stream");
|
||||
[self performWrite];
|
||||
break;
|
||||
default:
|
||||
@@ -229,11 +221,7 @@ static NSUInteger SerializedSize(int32_t value) {
|
||||
#pragma mark - Private
|
||||
|
||||
- (void)openStream:(NSStream *)stream isVOIPStream:(BOOL)isVOIPStream {
|
||||
_FIRMessagingDevAssert(stream != nil, @"Invalid stream");
|
||||
_FIRMessagingDevAssert(self.runLoop != nil, @"Invalid runloop");
|
||||
|
||||
if (stream) {
|
||||
_FIRMessagingDevAssert([stream streamStatus] == NSStreamStatusNotOpen, @"Stream already open");
|
||||
if ([stream streamStatus] != NSStreamStatusNotOpen) {
|
||||
FIRMessagingLoggerDebug(kFIRMessagingMessageCodeSecureSocket009,
|
||||
@"stream should not be open.");
|
||||
@@ -252,9 +240,6 @@ static NSUInteger SerializedSize(int32_t value) {
|
||||
}
|
||||
|
||||
- (void)closeStream:(NSStream *)stream {
|
||||
_FIRMessagingDevAssert(stream != nil, @"Invalid stream");
|
||||
_FIRMessagingDevAssert(self.runLoop != nil, @"Invalid runloop");
|
||||
|
||||
if (stream) {
|
||||
[stream close];
|
||||
[stream removeFromRunLoop:self.runLoop forMode:NSDefaultRunLoopMode];
|
||||
@@ -263,8 +248,6 @@ static NSUInteger SerializedSize(int32_t value) {
|
||||
}
|
||||
|
||||
- (BOOL)performRead {
|
||||
_FIRMessagingDevAssert(self.state == kFIRMessagingSecureSocketOpen, @"Socket should be open");
|
||||
|
||||
if (!self.isVersionReceived) {
|
||||
self.isVersionReceived = YES;
|
||||
uint8_t versionByte = 0;
|
||||
@@ -279,11 +262,6 @@ static NSUInteger SerializedSize(int32_t value) {
|
||||
|
||||
while (YES) {
|
||||
BOOL isInputBufferValid = [self.inputBuffer length] > 0;
|
||||
_FIRMessagingDevAssert(isInputBufferValid,
|
||||
@"Invalid input buffer size %lu. Used bytes length %lu, buffer content: %@",
|
||||
_FIRMessaging_UL([self.inputBuffer length]),
|
||||
_FIRMessaging_UL(self.inputBufferLength),
|
||||
self.inputBuffer);
|
||||
if (!isInputBufferValid) {
|
||||
FIRMessagingLoggerDebug(kFIRMessagingMessageCodeSecureSocket011,
|
||||
@"Input buffer is not valid.");
|
||||
@@ -323,12 +301,9 @@ static NSUInteger SerializedSize(int32_t value) {
|
||||
_FIRMessaging_UL(self.inputBufferLength),
|
||||
_FIRMessaging_UL([self.inputBuffer length]));
|
||||
[self.inputBuffer increaseLengthBy:kBufferLengthIncrement];
|
||||
_FIRMessagingDevAssert([self.inputBuffer length] > self.inputBufferLength, @"Invalid buffer size");
|
||||
}
|
||||
|
||||
while (self.inputBufferLength > 0 && [self.inputBuffer length] > 0) {
|
||||
_FIRMessagingDevAssert([self.inputBuffer length] >= self.inputBufferLength,
|
||||
@"Buffer longer than length");
|
||||
NSRange inputRange = NSMakeRange(0, self.inputBufferLength);
|
||||
size_t protoBytes = 0;
|
||||
// read the actual proto data coming in
|
||||
@@ -342,7 +317,6 @@ static NSUInteger SerializedSize(int32_t value) {
|
||||
} else if (readResult == kFIRMessagingSecureSocketReadResultIncomplete) {
|
||||
break;
|
||||
}
|
||||
_FIRMessagingDevAssert(self.inputBufferLength >= protoBytes, @"More bytes than buffer can handle");
|
||||
// we have read (0, protoBytes) of data in the inputBuffer
|
||||
if (protoBytes == self.inputBufferLength) {
|
||||
// did completely read the buffer data can be reset for further processing
|
||||
@@ -354,12 +328,6 @@ static NSUInteger SerializedSize(int32_t value) {
|
||||
[self.inputBuffer replaceBytesInRange:NSMakeRange(0, protoBytes) withBytes:NULL length:0];
|
||||
// reallocate more data
|
||||
[self.inputBuffer increaseLengthBy:protoBytes];
|
||||
_FIRMessagingDevAssert([self.inputBuffer length] == prevLength,
|
||||
@"Invalid input buffer size %lu. Used bytes length %lu, "
|
||||
@"buffer content: %@",
|
||||
_FIRMessaging_UL([self.inputBuffer length]),
|
||||
_FIRMessaging_UL(self.inputBufferLength),
|
||||
self.inputBuffer);
|
||||
self.inputBufferLength -= protoBytes;
|
||||
}
|
||||
}
|
||||
@@ -381,7 +349,6 @@ static NSUInteger SerializedSize(int32_t value) {
|
||||
return kFIRMessagingSecureSocketReadResultIncomplete;
|
||||
}
|
||||
// NOTE tag can be zero for |HeartbeatPing|, and length can be zero for |Close| proto
|
||||
_FIRMessagingDevAssert(rawTag >= 0 && length >= 0, @"Invalid tag or length");
|
||||
if (rawTag < 0 || length < 0) {
|
||||
FIRMessagingLoggerDebug(kFIRMessagingMessageCodeSecureSocket015, @"Buffer data corrupted.");
|
||||
return kFIRMessagingSecureSocketReadResultCorrupt;
|
||||
@@ -399,8 +366,6 @@ static NSUInteger SerializedSize(int32_t value) {
|
||||
}
|
||||
|
||||
- (void)performWrite {
|
||||
_FIRMessagingDevAssert(self.state == kFIRMessagingSecureSocketOpen, @"Invalid socket state");
|
||||
|
||||
if (!self.isVersionSent) {
|
||||
self.isVersionSent = YES;
|
||||
uint8_t versionByte = kVersion;
|
||||
|
||||
+7
-9
@@ -14,14 +14,14 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#import "FIRMessagingSyncMessageManager.h"
|
||||
#import "Firebase/Messaging/FIRMessagingSyncMessageManager.h"
|
||||
|
||||
#import "FIRMessagingConstants.h"
|
||||
#import "FIRMessagingDefines.h"
|
||||
#import "FIRMessagingLogger.h"
|
||||
#import "FIRMessagingPersistentSyncMessage.h"
|
||||
#import "FIRMessagingRmqManager.h"
|
||||
#import "FIRMessagingUtilities.h"
|
||||
#import "Firebase/Messaging/FIRMessagingConstants.h"
|
||||
#import "Firebase/Messaging/FIRMessagingDefines.h"
|
||||
#import "Firebase/Messaging/FIRMessagingLogger.h"
|
||||
#import "Firebase/Messaging/FIRMessagingPersistentSyncMessage.h"
|
||||
#import "Firebase/Messaging/FIRMessagingRmqManager.h"
|
||||
#import "Firebase/Messaging/FIRMessagingUtilities.h"
|
||||
|
||||
static const int64_t kDefaultSyncMessageTTL = 4 * 7 * 24 * 60 * 60; // 4 weeks
|
||||
// 4 MB of free space is required to persist Sync messages
|
||||
@@ -40,7 +40,6 @@ static const uint64_t kMinFreeDiskSpaceInMB = 1;
|
||||
}
|
||||
|
||||
- (instancetype)initWithRmqManager:(FIRMessagingRmqManager *)rmqManager {
|
||||
_FIRMessagingDevAssert(rmqManager, @"Invalid nil rmq manager while initalizing sync message manager");
|
||||
self = [super init];
|
||||
if (self) {
|
||||
_rmqManager = rmqManager;
|
||||
@@ -72,7 +71,6 @@ static const uint64_t kMinFreeDiskSpaceInMB = 1;
|
||||
viaAPNS:(BOOL)viaAPNS
|
||||
viaMCS:(BOOL)viaMCS {
|
||||
NSString *rmqID = message[kFIRMessagingMessageIDKey];
|
||||
_FIRMessagingDevAssert([rmqID length], @"Invalid nil rmqID for message");
|
||||
if (![rmqID length]) {
|
||||
FIRMessagingLoggerError(kFIRMessagingMessageCodeSyncMessageManager002,
|
||||
@"Invalid nil rmqID for sync message.");
|
||||
|
||||
@@ -16,8 +16,9 @@
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import "FIRMessaging.h"
|
||||
#import "FIRMessagingTopicsCommon.h"
|
||||
#import <FirebaseMessaging/FIRMessaging.h>
|
||||
|
||||
#import "Firebase/Messaging/FIRMessagingTopicsCommon.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
|
||||
@@ -14,14 +14,14 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#import "FIRMessagingTopicOperation.h"
|
||||
#import "Firebase/Messaging/FIRMessagingTopicOperation.h"
|
||||
|
||||
#import <FirebaseInstanceID/FIRInstanceID_Private.h>
|
||||
|
||||
#import "FIRMessagingDefines.h"
|
||||
#import "FIRMessagingLogger.h"
|
||||
#import "FIRMessagingUtilities.h"
|
||||
#import "NSError+FIRMessaging.h"
|
||||
#import "Firebase/Messaging/FIRMessagingDefines.h"
|
||||
#import "Firebase/Messaging/FIRMessagingLogger.h"
|
||||
#import "Firebase/Messaging/FIRMessagingUtilities.h"
|
||||
#import "Firebase/Messaging/NSError+FIRMessaging.h"
|
||||
|
||||
#define DEBUG_LOG_SUBSCRIPTION_OPERATION_DURATIONS 0
|
||||
|
||||
@@ -217,7 +217,7 @@ NSString *FIRMessagingSubscriptionsServer() {
|
||||
}
|
||||
FIRMessagingLoggerDebug(kFIRMessagingMessageCodeTopicOption001,
|
||||
@"Device registration HTTP fetch error. Error Code: %ld",
|
||||
_FIRMessaging_L(error.code));
|
||||
(long)error.code);
|
||||
[self finishWithError:error];
|
||||
return;
|
||||
}
|
||||
@@ -229,7 +229,6 @@ NSString *FIRMessagingSubscriptionsServer() {
|
||||
return;
|
||||
}
|
||||
NSArray *parts = [response componentsSeparatedByString:@"="];
|
||||
_FIRMessagingDevAssert(parts.count, @"Invalid registration response");
|
||||
if (![parts[0] isEqualToString:@"token"] || parts.count <= 1) {
|
||||
FIRMessagingLoggerDebug(kFIRMessagingMessageCodeTopicOption002,
|
||||
@"Invalid registration response %@", response);
|
||||
|
||||
@@ -14,11 +14,11 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#import "FIRMessagingUtilities.h"
|
||||
#import "Firebase/Messaging/FIRMessagingUtilities.h"
|
||||
|
||||
#import "Protos/GtalkCore.pbobjc.h"
|
||||
#import "Firebase/Messaging/Protos/GtalkCore.pbobjc.h"
|
||||
|
||||
#import "FIRMessagingLogger.h"
|
||||
#import "Firebase/Messaging/FIRMessagingLogger.h"
|
||||
|
||||
#import <GoogleUtilities/GULAppEnvironmentUtil.h>
|
||||
|
||||
|
||||
@@ -14,9 +14,9 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#import "FIRMessagingVersionUtilities.h"
|
||||
#import "Firebase/Messaging/FIRMessagingVersionUtilities.h"
|
||||
|
||||
#import "FIRMessagingDefines.h"
|
||||
#import "Firebase/Messaging/FIRMessagingDefines.h"
|
||||
|
||||
// Convert the macro to a string
|
||||
#define STR_EXPAND(x) #x
|
||||
@@ -39,7 +39,6 @@ void FIRMessagingParseCurrentLibraryVersion(void) {
|
||||
// Parse versions
|
||||
// major, minor, patch[-beta#]
|
||||
allVersions = [daylightVersion componentsSeparatedByString:kSemanticVersioningSeparator];
|
||||
_FIRMessagingDevAssert(allVersions.count == 3, @"Invalid versioning of FIRMessaging library");
|
||||
if (allVersions.count == 3) {
|
||||
majorVersion = [allVersions[0] intValue];
|
||||
minorVersion = [allVersions[1] intValue];
|
||||
@@ -47,7 +46,6 @@ void FIRMessagingParseCurrentLibraryVersion(void) {
|
||||
// Parse patch and beta versions
|
||||
NSArray *patchAndBetaVersion =
|
||||
[allVersions[2] componentsSeparatedByString:kBetaVersionPrefix];
|
||||
_FIRMessagingDevAssert(patchAndBetaVersion.count <= 2, @"Invalid versioning of FIRMessaging library");
|
||||
if (patchAndBetaVersion.count == 2) {
|
||||
patchVersion = [patchAndBetaVersion[0] intValue];
|
||||
betaVersion = [patchAndBetaVersion[1] intValue];
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#import "FIRMessaging.h"
|
||||
#import <FirebaseMessaging/FIRMessaging.h>
|
||||
|
||||
@class FIRMessagingClient;
|
||||
@class FIRMessagingPubSub;
|
||||
|
||||
@@ -14,4 +14,4 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#import "FIRMessaging.h"
|
||||
#import <FirebaseMessaging/FIRMessaging.h>
|
||||
|
||||
-30
@@ -1,30 +0,0 @@
|
||||
/*
|
||||
* Copyright 2017 Google
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/// @file FIRMessagingInternalUtilities.h
|
||||
///
|
||||
/// Internal Class Names and Methods that other libs can query at runtime.
|
||||
|
||||
/// FIRMessaging Class that responds to the FIRMessaging SDK version selector.
|
||||
/// Verify at runtime if the class exists and implements the
|
||||
/// required method.
|
||||
static NSString *const kFIRMessagingSDKClassString = @"FIRMessaging";
|
||||
|
||||
/// FIRMessaging selector that returns the current FIRMessaging library version.
|
||||
static NSString *const kFIRMessagingSDKVersionSelectorString = @"FIRMessagingSDKVersion";
|
||||
|
||||
/// FIRMessaging selector that returns the current device locale.
|
||||
static NSString *const kFIRMessagingSDKLocaleSelectorString = @"FIRMessagingSDKCurrentLocale";
|
||||
+4
@@ -21,6 +21,10 @@
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/// This class is used to automatically populate a notification with an image if it is
|
||||
/// specified in the notification body via the `image` parameter. Images and other
|
||||
/// rich content can be populated manually without the use of this class. See the
|
||||
/// `UNNotificationServiceExtension` type for more details.
|
||||
__IOS_AVAILABLE(10.0) __OSX_AVAILABLE(10.14)
|
||||
@interface FIRMessagingExtensionHelper : NSObject
|
||||
|
||||
|
||||
@@ -14,5 +14,5 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#import "FIRMessaging.h"
|
||||
#import "FIRMessagingExtensionHelper.h"
|
||||
#import <FirebaseMessaging/FIRMessaging.h>
|
||||
#import <FirebaseMessaging/FIRMessagingExtensionHelper.h>
|
||||
|
||||
Generated
+17
-10
@@ -1,9 +1,10 @@
|
||||
# Firebase iOS Open Source Development [](https://travis-ci.org/firebase/firebase-ios-sdk)
|
||||
|
||||
This repository contains a subset of the Firebase iOS SDK source. It currently
|
||||
includes FirebaseCore, FirebaseAuth, FirebaseDatabase, FirebaseFirestore,
|
||||
FirebaseFunctions, FirebaseInstanceID, FirebaseInAppMessaging,
|
||||
FirebaseInAppMessagingDisplay, FirebaseMessaging and FirebaseStorage.
|
||||
includes FirebaseCore, FirebaseABTesting, FirebaseAuth, FirebaseDatabase,
|
||||
FirebaseFirestore, FirebaseFunctions, FirebaseInstanceID, FirebaseInAppMessaging,
|
||||
FirebaseInAppMessagingDisplay, FirebaseMessaging, FirebaseRemoteConfig, and
|
||||
FirebaseStorage.
|
||||
|
||||
The repository also includes GoogleUtilities source. The
|
||||
[GoogleUtilities](GoogleUtilities/README.md) pod is
|
||||
@@ -80,9 +81,8 @@ For the pod that you want to develop:
|
||||
|
||||
`pod gen Firebase{name here}.podspec --local-sources=./ --auto-open`
|
||||
|
||||
Firestore and Functions have self contained Xcode projects. See
|
||||
[Firestore/README.md](Firestore/README.md) and
|
||||
[Functions/README.md](Functions/README.md).
|
||||
Firestore has a self contained Xcode project. See
|
||||
[Firestore/README.md](Firestore/README.md).
|
||||
|
||||
### Adding a New Firebase Pod
|
||||
|
||||
@@ -99,13 +99,17 @@ Travis will verify that any code changes are done in a style compliant way. Inst
|
||||
These commands will get the right versions:
|
||||
|
||||
```
|
||||
brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/773cb75d360b58f32048f5964038d09825a507c8/Formula/clang-format.rb
|
||||
brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/3dfea1004e0736754bbf49673cca8aaed8a94089/Formula/swiftformat.rb
|
||||
brew upgrade https://raw.githubusercontent.com/Homebrew/homebrew-core/e3496d9/Formula/clang-format.rb
|
||||
brew upgrade https://raw.githubusercontent.com/Homebrew/homebrew-core/7963c3d/Formula/swiftformat.rb
|
||||
```
|
||||
|
||||
Note: if you already have a newer version of these installed you may need to
|
||||
`brew switch` to this version.
|
||||
|
||||
To update this section, find the versions of clang-format and swiftformat.rb to
|
||||
match the versions in the CI failure logs
|
||||
[here](https://github.com/Homebrew/homebrew-core/tree/master/Formula).
|
||||
|
||||
### Running Unit Tests
|
||||
|
||||
Select a scheme and press Command-u to build a component and run its unit tests.
|
||||
@@ -179,8 +183,9 @@ very grateful! We'd like to empower as many developers as we can to be able to
|
||||
participate in the Firebase community.
|
||||
|
||||
### macOS and tvOS
|
||||
Thanks to contributions from the community, FirebaseAuth, FirebaseCore, FirebaseDatabase, FirebaseMessaging,
|
||||
FirebaseFirestore, FirebaseFunctions and FirebaseStorage now compile, run unit tests, and work on
|
||||
Thanks to contributions from the community, FirebaseABTesting, FirebaseAuth, FirebaseCore,
|
||||
FirebaseDatabase, FirebaseMessaging, FirebaseFirestore,
|
||||
FirebaseFunctions, FirebaseRemoteConfig, and FirebaseStorage now compile, run unit tests, and work on
|
||||
macOS and tvOS.
|
||||
|
||||
For tvOS, checkout the [Sample](Example/tvOSSample).
|
||||
@@ -195,12 +200,14 @@ Note that the Firebase pod is not available for macOS and tvOS.
|
||||
To install, add a subset of the following to the Podfile:
|
||||
|
||||
```
|
||||
pod 'FirebaseABTesting'
|
||||
pod 'FirebaseAuth'
|
||||
pod 'FirebaseCore'
|
||||
pod 'FirebaseDatabase'
|
||||
pod 'FirebaseFirestore'
|
||||
pod 'FirebaseFunctions'
|
||||
pod 'FirebaseMessaging'
|
||||
pod 'FirebaseRemoteConfig'
|
||||
pod 'FirebaseStorage'
|
||||
```
|
||||
|
||||
|
||||
Reference in New Issue
Block a user