-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Enables Firebase Messaging push notification function on watch only and independent watch app #4016
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
d96955d
1e841e2
d288358
8262f55
8bb8583
b303e69
eb85c84
79a3737
b2ca455
e190be2
b05f6a0
b834615
c1b7405
51dbf68
b3ff2fe
c565015
ecb1de4
ec86598
0474155
322f651
2fe1f54
3ef0144
8e37bd3
abccbea
d9f13c8
f711c12
3883653
1f079c8
e278e8e
4ad2fe9
92db615
de191d3
2469a4f
ef6c930
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -60,12 +60,12 @@ | |
| // change. | ||
| NSInteger const kMaxRetryCountForDefaultToken = 5; | ||
|
|
||
| #if TARGET_OS_IOS || TARGET_OS_TV | ||
| #if TARGET_OS_IOS || TARGET_OS_TV || TARGET_OS_WATCH | ||
| static NSString *const kEntitlementsAPSEnvironmentKey = @"Entitlements.aps-environment"; | ||
| #else | ||
| static NSString *const kEntitlementsAPSEnvironmentKey = @"com.apple.developer.aps-environment"; | ||
| static NSString *const kEntitlementsAPSEnvironmentKey = | ||
| @"Entitlements.com.apple.developer.aps-environment"; | ||
| #endif | ||
| static NSString *const kEntitlementsKeyForMac = @"Entitlements"; | ||
| static NSString *const kAPSEnvironmentDevelopmentValue = @"development"; | ||
| /// FIRMessaging selector that returns the current FIRMessaging auto init | ||
| /// enabled flag. | ||
|
|
@@ -617,10 +617,14 @@ - (void)configureInstanceIDWithOptions:(FIROptions *)options { | |
| [self updateFirebaseInstallationID]; | ||
|
|
||
| // FCM generates a FCM token during app start for sending push notification to device. | ||
| // This is not needed for app extension. | ||
| // This is not needed for app extension except for watch. | ||
| #if TARGET_OS_WATCH | ||
| [self didCompleteConfigure]; | ||
| #else | ||
| if (![GULAppEnvironmentUtil isAppExtension]) { | ||
| [self didCompleteConfigure]; | ||
| } | ||
| #endif | ||
| } | ||
|
|
||
| // This is used to start any operations when we receive FirebaseSDK setup notification | ||
|
|
@@ -978,7 +982,7 @@ - (BOOL)isProductionApp { | |
| // Apps distributed via AppStore or TestFlight use the Production APNS certificates. | ||
| return defaultAppTypeProd; | ||
| } | ||
| #if TARGET_OS_IOS || TARGET_OS_TV | ||
| #if TARGET_OS_IOS || TARGET_OS_TV || TARGET_OS_WATCH | ||
| NSString *path = [[[NSBundle mainBundle] bundlePath] | ||
| stringByAppendingPathComponent:@"embedded.mobileprovision"]; | ||
| #elif TARGET_OS_OSX | ||
|
|
@@ -1061,13 +1065,7 @@ - (BOOL)isProductionApp { | |
| @"most likely a Dev profile."); | ||
| } | ||
|
|
||
| #if TARGET_OS_IOS || TARGET_OS_TV | ||
| NSString *apsEnvironment = [plistMap valueForKeyPath:kEntitlementsAPSEnvironmentKey]; | ||
| #elif TARGET_OS_OSX | ||
| NSDictionary *entitlements = [plistMap valueForKey:kEntitlementsKeyForMac]; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just wanted to confirm that There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, we redefined this key at line 60 for macOS #if TARGET_OS_IOS || TARGET_OS_TV || TARGET_OS_WATCH |
||
| NSString *apsEnvironment = [entitlements valueForKey:kEntitlementsAPSEnvironmentKey]; | ||
| #endif | ||
|
|
||
| NSString *debugString __unused = | ||
| [NSString stringWithFormat:@"APNS Environment in profile: %@", apsEnvironment]; | ||
| FIRInstanceIDLoggerDebug(kFIRInstanceIDMessageCodeInstanceID013, @"%@", debugString); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Please make the same change for the GoogleUtilitiesCron job below.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. There are two cmds under GoogleUtilitiesCron so I split each of them to 3 platforms.