Skip to content
Merged
Show file tree
Hide file tree
Changes from 30 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
8ec05d6
Remove instanceID dependency from Messaging (#6103)
charlotteliang Jul 22, 2020
8ba1a1c
merge conflict
charlotteliang Jul 23, 2020
3d8e2c7
fix conflicts again
charlotteliang Jul 23, 2020
012bc14
fix conficts
charlotteliang Aug 13, 2020
1561602
merge conflicts from master
charlotteliang Aug 13, 2020
42ac674
Add both IID and FCM APIs in test app to test compatibility (#6285)
charlotteliang Aug 20, 2020
141b582
merge conflict
charlotteliang Oct 26, 2020
eda686b
merging master
charlotteliang Dec 1, 2020
dd085db
Merge branch 'master' of github.com:firebase/firebase-ios-sdk into ch…
charlotteliang Dec 22, 2020
cea68ec
Merge branch 'master' of github.com:firebase/firebase-ios-sdk into ch…
charlotteliang Dec 30, 2020
ded8291
Merge branch 'master' of github.com:firebase/firebase-ios-sdk into ch…
charlotteliang Jan 5, 2021
0582395
Should only have only one local cache of token (#7233)
charlotteliang Jan 11, 2021
8356e85
Merge branch 'master' of github.com:firebase/firebase-ios-sdk into ch…
charlotteliang Jan 12, 2021
3090073
Merge branch 'master' of github.com:firebase/firebase-ios-sdk into ch…
charlotteliang Jan 12, 2021
e1fbde9
[Remove IID] Move some token unit tests from IID to Messaging (#7294)
charlotteliang Feb 17, 2021
482d039
merge with master
charlotteliang Feb 17, 2021
5df1836
Merge remote-tracking branch 'origin/master' into chen/fm-master
charlotteliang Feb 24, 2021
41877bd
[IID removal]Move Checkin unit tests from InstanceID to Messaging (#7…
charlotteliang Mar 1, 2021
4f33b0e
Merge remote-tracking branch 'origin/master' into chen/fm-master
charlotteliang Mar 9, 2021
30335a3
merge from master
charlotteliang Mar 24, 2021
162e754
Add more token tests (#7776)
charlotteliang Mar 25, 2021
2471cd8
Merge remote-tracking branch 'origin/master' into chen/fm-master
charlotteliang Mar 30, 2021
0092172
merge conflict
charlotteliang Mar 30, 2021
f8fdf7f
fix conflicts
charlotteliang Mar 30, 2021
bb1230c
merge conflicts
charlotteliang Mar 30, 2021
a379ce2
fix conflicts
charlotteliang Mar 30, 2021
3f18619
revert removing iid dependency in podspec file
charlotteliang Mar 30, 2021
f74aef6
add Installations dependency in podspec
charlotteliang Mar 30, 2021
55579f1
run clangformat
charlotteliang Mar 30, 2021
7570b14
update changelog
charlotteliang Mar 30, 2021
3293bd7
fix a few podspec settings
charlotteliang Mar 31, 2021
f8ca45f
set release version to 7.11.0
charlotteliang Mar 31, 2021
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
10 changes: 7 additions & 3 deletions FirebaseMessaging.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ device, and it is completely free.
'Firebase/InstanceID/Public/*.h',
'FirebaseInstallations/Source/Library/Private/*.h',
]
s.requires_arc = base_dir + 'Sources/*.m'
s.requires_arc = base_dir + 'Sources/**/*.m'
Copy link
Member

Choose a reason for hiding this comment

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

Now that protobuf's non-arc files are gone, this line could be deleted since requires_arc is the default

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

s.public_header_files = base_dir + 'Sources/Public/FirebaseMessaging/*.h'
s.library = 'sqlite3'
s.pod_target_xcconfig = {
Expand All @@ -54,8 +54,9 @@ device, and it is completely free.
s.tvos.framework = 'SystemConfiguration'
s.osx.framework = 'SystemConfiguration'
s.weak_framework = 'UserNotifications'
s.dependency 'FirebaseCore', '~> 7.0'
s.dependency 'FirebaseInstanceID', '~> 7.0'
s.dependency 'FirebaseInstallations', '~> 7.0'
s.dependency 'FirebaseCore', '~> 7.0'
Copy link
Member

Choose a reason for hiding this comment

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

nit: alphabetize dependencies

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

s.dependency 'GoogleUtilities/AppDelegateSwizzler', '~> 7.0'
s.dependency 'GoogleUtilities/Reachability', '~> 7.0'
s.dependency 'GoogleUtilities/Environment', '~> 7.0'
Expand All @@ -68,7 +69,10 @@ device, and it is completely free.
:osx => osx_deployment_target,
:tvos => tvos_deployment_target
}
unit_tests.source_files = 'FirebaseMessaging/Tests/UnitTests*/*.{m,h,swift}'
unit_tests.source_files = [
'FirebaseMessaging/Tests/UnitTests*/*.{m,h,swift}',
'SharedTestUtilities/URLSession/*.[mh]',
]
unit_tests.requires_app_host = true
unit_tests.pod_target_xcconfig = {
'CLANG_ENABLE_OBJC_WEAK' => 'YES'
Expand Down
4 changes: 2 additions & 2 deletions FirebaseMessaging/Apps/Shared/ContentView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,6 @@ struct ContentView: View {
.multilineTextAlignment(.leading)
}
.navigationBarTitle("Firebase Messaging")

}.buttonStyle(IdentityButtonStyle())
}
}
Expand Down Expand Up @@ -338,8 +337,9 @@ struct IdentityButtonStyle: ButtonStyle {
.padding()
.foregroundColor(.white)
.background(Color.yellow)
.cornerRadius(40)
.cornerRadius(20)
// Push the button down a bit when it's pressed.
.scaleEffect(configuration.isPressed ? 0.9 : 1)
.font(.footnote)
}
}
1 change: 0 additions & 1 deletion FirebaseMessaging/Apps/Shared/SceneDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
import Combine
import UIKit
import SwiftUI
import FirebaseInstanceID
import FirebaseMessaging
import FirebaseInstallations

Expand Down
3 changes: 3 additions & 0 deletions FirebaseMessaging/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#unreleased
Copy link
Member

Choose a reason for hiding this comment

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

Will be 7.11.0

- [changed] Refactor Messaging to internally not depending on InstanceID, but can co-exist. Will remove InstanceID dependency in the next Firebase breaking change. (#7814)

# 2021-02 -- v7.7.0
- [fixed] Fixed an issue in which, when checking storage size before writing to disk, the client was checking document folders that were no longer used. (#7480)

Expand Down
391 changes: 241 additions & 150 deletions FirebaseMessaging/Sources/FIRMessaging.m

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ typedef NS_ENUM(NSInteger, FIRMessagingMessageCode) {
kFIRMessagingMessageCodeMessaging012 = 2012, // I-FCM002012
kFIRMessagingMessageCodeMessaging013 = 2013, // I-FCM002013
kFIRMessagingMessageCodeMessaging014 = 2014, // I-FCM002014
kFIRMessagingMessageCodeMessaging015 = 2015, // I-FCM002015
kFIRMessagingMessageCodeMessaging016 = 2016, // I-FCM002016 - no longer used
kFIRMessagingMessageCodeMessaging017 = 2017, // I-FCM002017
kFIRMessagingMessageCodeMessaging018 = 2018, // I-FCM002018
kFIRMessagingMessageCodeMessaging015 = 2015,
kFIRMessagingMessageCodeMessaging016 = 2016, // I-FCM002016 - no longer used
kFIRMessagingMessageCodeMessaging017 = 2017, // I-FCM002017
kFIRMessagingMessageCodeMessaging018 = 2018, // I-FCM002018
kFIRMessagingMessageCodeRemoteMessageDelegateMethodNotImplemented = 2019, // I-FCM002019
kFIRMessagingMessageCodeSenderIDNotSuppliedForTokenFetch = 2020, // I-FCM002020
kFIRMessagingMessageCodeSenderIDNotSuppliedForTokenDelete = 2021, // I-FCM002021
Expand Down Expand Up @@ -137,4 +137,121 @@ typedef NS_ENUM(NSInteger, FIRMessagingMessageCode) {
kFIRMessagingServiceExtensionLocalFileNotCreated = 20002,
kFIRMessagingServiceExtensionImageNotAttached = 20003,

kFIRMessagingMessageCodeFIRApp002 = 22002,
kFIRMessagingMessageCodeInternal001 = 22001,
kFIRMessagingMessageCodeInternal002 = 22002,
// FIRMessaging.m
// DO NOT USE 4000.
kFIRMessagingMessageCodeInstanceID000 = 23000,
kFIRMessagingMessageCodeInstanceID001 = 23001,
kFIRMessagingMessageCodeInstanceID002 = 23002,
kFIRMessagingMessageCodeInstanceID003 = 23003,
kFIRMessagingMessageCodeInstanceID004 = 23004,
kFIRMessagingMessageCodeInstanceID005 = 23005,
kFIRMessagingMessageCodeInstanceID006 = 23006,
kFIRMessagingMessageCodeInstanceID007 = 23007,
kFIRMessagingMessageCodeInstanceID008 = 23008,
kFIRMessagingMessageCodeInstanceID009 = 23009,
kFIRMessagingMessageCodeInstanceID010 = 23010,
kFIRMessagingMessageCodeInstanceID011 = 23011,
kFIRMessagingMessageCodeInstanceID012 = 23012,
kFIRMessagingMessageCodeInstanceID013 = 23013,
kFIRMessagingMessageCodeInstanceID014 = 23014,
kFIRMessagingMessageCodeInstanceID015 = 23015,
kFIRMessagingMessageCodeRefetchingTokenForAPNS = 23016,
kFIRMessagingMessageCodeInstanceID017 = 23017,
kFIRMessagingMessageCodeInstanceID018 = 23018,
// FIRMessagingAuthService.m
kFIRMessagingMessageCodeAuthService000 = 25000,
kFIRMessagingMessageCodeAuthService001 = 25001,
kFIRMessagingMessageCodeAuthService002 = 25002,
kFIRMessagingMessageCodeAuthService003 = 25003,
kFIRMessagingMessageCodeAuthService004 = 25004,
kFIRMessagingMessageCodeAuthServiceCheckinInProgress = 25004,

// FIRMessagingBackupExcludedPlist.m
// Do NOT USE 6003
kFIRMessagingMessageCodeBackupExcludedPlist000 = 26000,
kFIRMessagingMessageCodeBackupExcludedPlist001 = 26001,
kFIRMessagingMessageCodeBackupExcludedPlist002 = 26002,
// FIRMessagingCheckinService.m
kFIRMessagingMessageCodeService000 = 27000,
kFIRMessagingMessageCodeService001 = 27001,
kFIRMessagingMessageCodeService002 = 27002,
kFIRMessagingMessageCodeService003 = 27003,
kFIRMessagingMessageCodeService004 = 27004,
kFIRMessagingMessageCodeService005 = 27005,
kFIRMessagingMessageCodeService006 = 27006,
kFIRMessagingInvalidSettingResponse = 27008,
// FIRMessagingCheckinStore.m
// DO NOT USE 8002, 8004 - 8008
kFIRMessagingMessageCodeCheckinStore000 = 28000,
kFIRMessagingMessageCodeCheckinStore001 = 28001,
kFIRMessagingMessageCodeCheckinStore003 = 28003,
kFIRMessagingMessageCodeCheckinStoreCheckinPlistDeleted = 28009,
kFIRMessagingMessageCodeCheckinStoreCheckinPlistSaved = 28010,

// DO NOT USE 9000 - 9006

// DO NOT USE 10000 - 10009

// DO NOT USE 11000 - 11002

// DO NOT USE 12000 - 12014

// DO NOT USE 13004, 13005, 13007, 13008, 13010, 13011, 13013, 13014
kFIRMessagingMessageCodeStore000 = 33000,
kFIRMessagingMessageCodeStore002 = 33002,
kFIRMessagingMessageCodeStore003 = 33003,
kFIRMessagingMessageCodeStore006 = 33006,
kFIRMessagingMessageCodeStore009 = 33009,
kFIRMessagingMessageCodeStore012 = 33012,
// FIRMessagingTokenManager.m
// DO NOT USE 14002, 14005
kFIRMessagingMessageCodeTokenManager000 = 34000,
kFIRMessagingMessageCodeTokenManager001 = 34001,
kFIRMessagingMessageCodeTokenManager003 = 34003,
kFIRMessagingMessageCodeTokenManager004 = 34004,
kFIRMessagingMessageCodeTokenManagerErrorDeletingFCMTokensOnAppReset = 34006,
kFIRMessagingMessageCodeTokenManagerDeletedFCMTokensOnAppReset = 34007,
kFIRMessagingMessageCodeTokenManagerSavedAppVersion = 34008,
kFIRMessagingMessageCodeTokenManagerErrorInvalidatingAllTokens = 34009,
kFIRMessagingMessageCodeTokenManagerAPNSChanged = 34010,
kFIRMessagingMessageCodeTokenManagerAPNSChangedTokenInvalidated = 34011,
kFIRMessagingMessageCodeTokenManagerInvalidateStaleToken = 34012,
// FIRMessagingTokenStore.m
// DO NOT USE 15002 - 15013
kFIRMessagingMessageCodeTokenStore000 = 35000,
kFIRMessagingMessageCodeTokenStore001 = 35001,
kFIRMessagingMessageCodeTokenStoreExceptionUnarchivingTokenInfo = 35015,

// DO NOT USE 16000, 18004

// FIRMessagingUtilities.m
kFIRMessagingMessageCodeUtilitiesMissingBundleIdentifier = 38000,
kFIRMessagingMessageCodeUtilitiesAppEnvironmentUtilNotAvailable = 38001,
kFIRMessagingMessageCodeUtilitiesCannotGetHardwareModel = 38002,
kFIRMessagingMessageCodeUtilitiesCannotGetSystemVersion = 38003,
// FIRMessagingTokenOperation.m
kFIRMessagingMessageCodeTokenOperationFailedToSignParams = 39000,
// FIRMessagingTokenFetchOperation.m
// DO NOT USE 40004, 40005
kFIRMessagingMessageCodeTokenFetchOperationFetchRequest = 40000,
kFIRMessagingMessageCodeTokenFetchOperationRequestError = 40001,
kFIRMessagingMessageCodeTokenFetchOperationBadResponse = 40002,
kFIRMessagingMessageCodeTokenFetchOperationBadTokenStructure = 40003,
// FIRMessagingTokenDeleteOperation.m
kFIRMessagingMessageCodeTokenDeleteOperationFetchRequest = 41000,
kFIRMessagingMessageCodeTokenDeleteOperationRequestError = 41001,
kFIRMessagingMessageCodeTokenDeleteOperationBadResponse = 41002,
// FIRMessagingTokenInfo.m
kFIRMessagingMessageCodeTokenInfoBadAPNSInfo = 42000,
kFIRMessagingMessageCodeTokenInfoFirebaseAppIDChanged = 42001,
kFIRMessagingMessageCodeTokenInfoLocaleChanged = 42002,
// FIRMessagingKeychain.m
kFIRMessagingKeychainReadItemError = 43000,
kFIRMessagingKeychainAddItemError = 43001,
kFIRMessagingKeychainDeleteItemError = 43002,
kFIRMessagingKeychainCreateKeyPairError = 43003,
kFIRMessagingKeychainUpdateItemError = 43004,
};
45 changes: 44 additions & 1 deletion FirebaseMessaging/Sources/FIRMessagingConstants.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,52 @@ FOUNDATION_EXPORT NSString *const kFIRMessagingMessageLinkKey;
FOUNDATION_EXPORT NSString *const kFIRMessagingRemoteNotificationsProxyEnabledInfoPlistKey;
FOUNDATION_EXPORT NSString *const kFIRMessagingSubDirectoryName;

// Notifications
#pragma mark - Notifications

FOUNDATION_EXPORT NSString *const kFIRMessagingCheckinFetchedNotification;
FOUNDATION_EXPORT NSString *const kFIRMessagingAPNSTokenNotification;
FOUNDATION_EXPORT NSString *const kFIRMessagingDefaultGCMTokenFailNotification;
FOUNDATION_EXPORT NSString *const kFIRMessagingRegistrationTokenRefreshNotification;

FOUNDATION_EXPORT const int kFIRMessagingSendTtlDefault; // 24 hours

/**
* Value included in a structured response or GCM message from IID, indicating
Copy link
Member

Choose a reason for hiding this comment

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

Is it still called IID when it's integrated in FCM?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The description doesn't make sense. I updated. But yeah FM code-wise should not depend on IID. But might still handle some signals sending from IID in case users still use IID.

* an identity reset.
*/
FOUNDATION_EXPORT NSString *const kFIRMessaging_CMD_RST;

#pragma mark - Miscellaneous

/// The scope used to save the IID "*" scope token. This is used for saving the
/// IID auth token that we receive from the server. This feature was never
/// implemented on the server side.
FOUNDATION_EXPORT NSString *const kFIRMessagingAllScopeIdentifier;
/// The scope used to save the IID "*" scope token.
FOUNDATION_EXPORT NSString *const kFIRMessagingDefaultTokenScope;

/// Subdirectory in search path directory to store InstanceID preferences.
FOUNDATION_EXPORT NSString *const kFIRMessagingInstanceIDSubDirectoryName;

/// The key for APNS token in options dictionary.
FOUNDATION_EXPORT NSString *const kFIRMessagingTokenOptionsAPNSKey;

/// The key for APNS token environment type in options dictionary.
FOUNDATION_EXPORT NSString *const kFIRMessagingTokenOptionsAPNSIsSandboxKey;

/// The key for GMP AppID sent in registration requests.
FOUNDATION_EXPORT NSString *const kFIRMessagingTokenOptionsFirebaseAppIDKey;

FOUNDATION_EXPORT NSString *const kFIRMessagingAPNSTokenType;

/// The key to enable auto-register by swizzling AppDelegate's methods.
FOUNDATION_EXPORT NSString *const kFIRMessagingAppDelegateProxyEnabledInfoPlistKey;

/// Error code for missing entitlements in Keychain. iOS Keychain error
/// https://forums.developer.apple.com/thread/4743
FOUNDATION_EXPORT const int kFIRMessagingSecMissingEntitlementErrorCode;

/// The key for InstallationID or InstanceID in token request.
FOUNDATION_EXPORT NSString *const kFIRMessagingParamInstanceID;

#endif
30 changes: 30 additions & 0 deletions FirebaseMessaging/Sources/FIRMessagingConstants.m
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,33 @@
NSString *const kFIRMessagingAPNSTokenNotification = @"com.firebase.iid.notif.apns-token";
NSString *const kFIRMessagingRegistrationTokenRefreshNotification =
@"com.firebase.iid.notif.refresh-token";

const int kFIRMessagingSendTtlDefault = 24 * 60 * 60; // 24 hours

// Commands
NSString *const kFIRMessaging_CMD_RST = @"RST";

// NOTIFICATIONS
NSString *const kFIRMessagingDefaultGCMTokenFailNotification =
@"com.firebase.iid.notif.fcm-token-fail";

// Miscellaneous
NSString *const kFIRMessagingAllScopeIdentifier = @"iid-all";
NSString *const kFIRMessagingDefaultTokenScope = @"*";
NSString *const kFIRMessagingInstanceIDSubDirectoryName = @"Google/FirebaseInstanceID";

// Registration Options
NSString *const kFIRMessagingTokenOptionsAPNSKey = @"apns_token";
NSString *const kFIRMessagingTokenOptionsAPNSIsSandboxKey = @"apns_sandbox";
NSString *const kFIRMessagingTokenOptionsFirebaseAppIDKey = @"gmp_app_id";
NSString *const kFIRMessagingParamInstanceID = @"appid";

NSString *const kFIRMessagingAPNSTokenType =
@"APNSTokenType"; // APNS Token type key stored in user info.

NSString *const kFIRMessagingAppDelegateProxyEnabledInfoPlistKey =
@"FirebaseAppDelegateProxyEnabled";

// iOS Keychain error https://forums.developer.apple.com/thread/4743
// An undocumented error code hence need to be redeclared.
const int kFIRMessagingSecMissingEntitlementErrorCode = -34018;
2 changes: 1 addition & 1 deletion FirebaseMessaging/Sources/FIRMessagingExtensionHelper.m
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

#import "FirebaseMessaging/Sources/Public/FirebaseMessaging/FIRMessagingExtensionHelper.h"

#import "FirebaseMessaging/Sources/FIRMMessageCode.h"
#import "FirebaseMessaging/Sources/FIRMessagingCode.h"
#import "FirebaseMessaging/Sources/FIRMessagingLogger.h"

static NSString *const kPayloadOptionsName = @"fcm_options";
Expand Down
2 changes: 1 addition & 1 deletion FirebaseMessaging/Sources/FIRMessagingLogger.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

#import "FirebaseMessaging/Sources/FIRMMessageCode.h"
#import "FirebaseMessaging/Sources/FIRMessagingCode.h"

// The convenience macros are only defined if they haven't already been defined.
#ifndef FIRMessagingLoggerInfo
Expand Down
4 changes: 2 additions & 2 deletions FirebaseMessaging/Sources/FIRMessagingPubSub.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

NS_ASSUME_NONNULL_BEGIN

@class FIRMessagingPubSubCache;
@class FIRMessagingTokenManager;

/**
* FIRMessagingPubSub provides a publish-subscribe model for sending FIRMessaging topic messages.
Expand All @@ -37,7 +37,7 @@ NS_ASSUME_NONNULL_BEGIN
*/
@interface FIRMessagingPubSub : NSObject

@property(nonatomic, readonly, strong) FIRMessagingPubSubCache *cache;
- (instancetype)initWithTokenManager:(FIRMessagingTokenManager *)tokenManager;

/**
* Subscribes an app instance to a topic, enabling it to receive messages
Expand Down
Loading