-
Notifications
You must be signed in to change notification settings - Fork 262
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
iOS 15 Feature Notification action icons #991
Conversation
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.
Reviewable status: 0 of 4 files reviewed, 1 unresolved discussion (waiting on @emawby, @Jeasmine, and @nan-li)
iOS_SDK/OneSignalSDK/Source/OneSignalHelper.m, line 577 at r1 (raw file):
icon = [UNNotificationActionIcon iconWithTemplateImageName:button[@"templateIcon"]]; } return [UNNotificationAction actionWithIdentifier:button[@"id"]
The selector actionWithIdentifier:title:options:icon:
is new in the beta version of Xcode:
https://developer.apple.com/documentation/usernotifications/unnotificationaction/3747237-actionwithidentifier?language=objc
We will need to use reflection to call this so it can compile with Xcode 11.0 as we do so to keep bit code compatibility for the release build.
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.
Reviewable status: 0 of 4 files reviewed, 2 unresolved discussions (waiting on @emawby, @Jeasmine, and @nan-li)
iOS_SDK/OneSignalSDK/Source/OneSignalHelper.m, line 580 at r1 (raw file):
title:button[@"text"] options:UNNotificationActionOptionForeground icon:icon];
icon
might be nil
here, not sure if the iOS API is ok with that.
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.
Reviewable status: 0 of 4 files reviewed, 2 unresolved discussions (waiting on @emawby, @Jeasmine, @jkasten2, and @nan-li)
iOS_SDK/OneSignalSDK/Source/OneSignalHelper.m, line 580 at r1 (raw file):
Previously, jkasten2 (Josh Kasten) wrote…
icon
might benil
here, not sure if the iOS API is ok with that.
the icon parameter is marked nullable so this should be fine
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.
Reviewable status: 0 of 4 files reviewed, 2 unresolved discussions (waiting on @Jeasmine, @jkasten2, and @nan-li)
iOS_SDK/OneSignalSDK/Source/OneSignalHelper.m, line 577 at r1 (raw file):
Previously, jkasten2 (Josh Kasten) wrote…
The selector
actionWithIdentifier:title:options:icon:
is new in the beta version of Xcode:
https://developer.apple.com/documentation/usernotifications/unnotificationaction/3747237-actionwithidentifier?language=objcWe will need to use reflection to call this so it can compile with Xcode 11.0 as we do so to keep bit code compatibility for the release build.
Done but its a bit ugly since we cannot use performSelector
This is pretty ugly because we cannot use performSelector withObject. That method only allows up to 2 arguments so we must use NSInvocation.
87b19ef
to
dda1993
Compare
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.
Reviewed 1 of 4 files at r1, 3 of 3 files at r2, all commit messages.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @Jeasmine and @nan-li)
iOS_SDK/OneSignalSDK/Source/OneSignalHelper.m, line 577 at r1 (raw file):
Previously, emawby (Elliot Mawby) wrote…
Done but its a bit ugly since we cannot use performSelector
no problem, if you think of a better way in the future we can clean it up.
This is branched off of main which currently has some broken IAM unit tests (already fixed in another PR).
iOS 15 introduced UNNotificationActionIcons (read about them here). This PR supports adding action icons from OneSignal notification payloads.
There are 2 types of icons:
Icons can be added to notification actions through a new initializer method, and can themselves be initialized as either system or template icons.
This change is