-
Notifications
You must be signed in to change notification settings - Fork 4
Play App - Push SDK Setup #574
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
Merged
Merged
Changes from all commits
Commits
Show all changes
38 commits
Select commit
Hold shift + click to select a range
c878b89
setup PushSDK
mbruegmann 2c798c8
Use standard UNUserNotificationCenter APIs to request push permission
mbruegmann b4c1451
Move push handling to AppDelegate and prepare for Airship removal
mbruegmann 7b63fc4
use URN as tag name
mbruegmann 804c997
Merge branch 'main' into push-sdk-setup
mbruegmann 013aa45
Add ruby platform to Gemfile.lock for CI compatibility
mbruegmann 745c65b
Merge branch 'main' of https://github.com/SRGSSR/playsrg-apple into p…
916be81
Fix linking
4d696af
Update Push SDK to 1.2.0
b33e912
Gate Airship calls using isFlying
c5b9f3e
Add more todos
93c3031
Update airshipIdentifier
9650bd0
Solve device token problem
1b61c93
Solve todos
5bcfeb1
Fix typos
50b332c
Update pods
2099c9f
Merge branch 'main' into push-sdk-setup
mbruegmann 8e6fa57
Fix show notification icon not updating after toggle
mbruegmann 9124e9a
Merge branch 'main' of https://github.com/SRGSSR/playsrg-apple into p…
63ca647
Lint
32aa03c
updated channel names
mbruegmann f9b92ca
Update gitignore
8932781
Add logging
ce5ff85
Revert "Add logging"
1508478
Fix compilation on tvOS
3ed5d51
Update tvOS targets
91b6337
Lower iOS deployment target to 15.0
mbruegmann d9c8445
Update CLAUDE.md minimum iOS to 15.0
mbruegmann fcdd165
Run make setup after a PodFile update
pyby 938a686
Fix Airship takeoff problem
50b7bf6
Fix setting enabled flag
c5973e5
Set badge number also in the Push SDK flow
dc7787c
Forward completion handler
08fd5be
Fix favorites optimistic toggle ordering
c6871db
Improve getting tags
6d83ba0
Fix formatting
122c2d9
Add a comment
7e4d042
Fix signing issues
Naxyoh File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -26,3 +26,4 @@ xcuserdata | |
| /vendor | ||
|
|
||
| .vscode | ||
| settings.local.json | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -23,6 +23,7 @@ | |
|
|
||
| @import AirshipCore; | ||
| @import AppCenter; | ||
| @import UserNotifications; | ||
| @import AppCenterCrashes; | ||
| @import AVFoundation; | ||
| @import CarPlay; | ||
|
|
@@ -38,7 +39,7 @@ | |
|
|
||
| static void *s_kvoContext = &s_kvoContext; | ||
|
|
||
| @interface AppDelegate() <SRGAnalyticsTrackerDataSource> | ||
| @interface AppDelegate() <SRGAnalyticsTrackerDataSource, UNUserNotificationCenterDelegate> | ||
|
|
||
| @end | ||
|
|
||
|
|
@@ -99,6 +100,7 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:( | |
| name:SRGLetterboxPlaybackDidContinueAutomaticallyNotification | ||
| object:nil]; | ||
|
|
||
| [UNUserNotificationCenter currentNotificationCenter].delegate = self; | ||
| [PushService.sharedService setupWithLaunchingWithOptions:launchOptions]; | ||
| [PushService.sharedService updateApplicationBadge]; | ||
|
|
||
|
|
@@ -324,6 +326,64 @@ - (void)productViewControllerDidFinish:(SKStoreProductViewController *)viewContr | |
| }]; | ||
| } | ||
|
|
||
| #pragma mark Push registration | ||
|
|
||
| - (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken | ||
| { | ||
| if ([UAirship isFlying]) { | ||
| [UAAppIntegration application:application didRegisterForRemoteNotificationsWithDeviceToken:deviceToken]; | ||
| } | ||
| [PushService.sharedService registerDeviceToken:deviceToken]; | ||
| } | ||
|
|
||
| - (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error | ||
| { | ||
| if ([UAirship isFlying]) { | ||
| [UAAppIntegration application:application didFailToRegisterForRemoteNotificationsWithError:error]; | ||
| } | ||
| } | ||
|
Comment on lines
+339
to
+344
Member
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. Not sure checking |
||
|
|
||
| - (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler | ||
| { | ||
| // Normal push (com.urbanairship) or silent push (_) | ||
| NSPredicate *airshipPredicate = [NSPredicate predicateWithBlock:^BOOL(id key, NSDictionary *bindings) { | ||
| return [key isKindOfClass:NSString.class] && ([key hasPrefix:@"com.urbanairship"] || [key isEqualToString:@"_"]); | ||
| }]; | ||
| BOOL isAirshipPayload = [[userInfo.allKeys filteredArrayUsingPredicate:airshipPredicate] count] > 0; | ||
| if (isAirshipPayload) { | ||
| if ([UAirship isFlying]) { | ||
| [UAAppIntegration application:application didReceiveRemoteNotification:userInfo fetchCompletionHandler:completionHandler]; | ||
| } | ||
| } else { | ||
| completionHandler(UIBackgroundFetchResultNewData); | ||
| } | ||
| } | ||
|
|
||
| #pragma mark UNUserNotificationCenterDelegate protocol | ||
|
|
||
| - (void)userNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(void (^)(void))completionHandler | ||
| { | ||
| [PushService.sharedService handleNotificationResponse:response]; | ||
| if ([UAirship isFlying]) { | ||
| [UAAppIntegration userNotificationCenter:center | ||
| didReceiveNotificationResponse:response | ||
| withCompletionHandler:completionHandler]; | ||
| } else { | ||
| completionHandler(); | ||
| } | ||
| } | ||
|
|
||
| - (void)userNotificationCenter:(UNUserNotificationCenter *)center willPresentNotification:(UNNotification *)notification withCompletionHandler:(void (^)(UNNotificationPresentationOptions))completionHandler | ||
| { | ||
| if ([UAirship isFlying]) { | ||
| [UAAppIntegration userNotificationCenter:center | ||
| willPresentNotification:notification | ||
| withCompletionHandler:completionHandler]; | ||
| } else { | ||
| completionHandler(UNNotificationPresentationOptionNone); | ||
| } | ||
| } | ||
|
|
||
| #pragma mark Notifications | ||
|
|
||
| - (void)playbackDidContinueAutomatically:(NSNotification *)notification | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.