-
Notifications
You must be signed in to change notification settings - Fork 229
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
[User model] Rename Events #678
Conversation
bump iOS example pod version
There are now no getters for privacy consent. Instead we have 2 setters consentRequired(bool) and consentGiven(bool)
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, didn't personally test.
Reviewed 29 of 29 files at r1, all commit messages.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on @emawby)
e9f0440
to
c7945fa
Compare
the willShowInForegroundHandler is now the OneSsignalNotificationLifecycleListener which has the onWillDisplay function.
notification opened -> onClickNotification
c7945fa
to
6bef96b
Compare
In order to get preventDefault() and display() to work the bridge layer listener needs to call preventDefault() so that the notification does not display before the flutter listeners have had a chance to call preventDefault(). Once all of the flutter listeners have responded to the event, if none of them have called preventDefault then the bridge layer will call display().
6bef96b
to
679d712
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.
Instead of using classes for events for dart I was thinking it would be better if these were Functions
instead. This seems more of what Flutter developers would expect as this is they way their API mostly works too.
Example:
OneSignal.InAppMessages.addLifecycleListener(this);
Instead we have this in the dropbox paper:
OneSignal.InAppMessages.addWillDisplayListener((event) { });
OneSignal.InAppMessages.addDidDisplayListener((event) { });
OneSignal.InAppMessages.addWillDismissListener((event) { });
OneSignal.InAppMessages.addDidDismissListener((event) { });
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.
Gotcha I have updated all of our events to use functions instead of classes.
Reviewable status: 16 of 29 files reviewed, all discussions resolved (waiting on @fhboswell, @jennantilla, @nan-li, and @shepherd-l)
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.
The event changes look all good to me now!
Description
One Line Summary
This is a large PR that includes changes to events across multiple features in the SDK.
Details
Privacy Consent - the new method names are:
consentRequired(boolean required)
- set to require users to opt in to OneSignal dataconsentGiven(boolean given)
- set when the user has opted in/out to OneSignal dataTriggers
the
addTrigger(s)
methods now require values in the key value pair to be strings.permissionNative
This is a new method that allows you to get the exact permission status for iOS devices (ephemeral, provisional, etc)
Live Activities
The enter and exit liveactivities methods have been moved to their own namespace.
Notification Permission Observer
The
OneSignalPermissionObserver
permission changed function has been renamed and only a boolean is passed as a parameter.onNotificationPermissionDidChange(boolean permission)
In App Message Lifecycle Events
Instead of four separate listeners apps now implement
OneSignalInAppMessageLifecycleListener
which has the four methods corresponding to the In App Message lifecycle.Each event's parameter contains the OSInAppMessage corresponding to the event. (
event.message
)The implementing class should call
OneSignal.InAppMessages.addLifecycleListener(this);
In App Message Click Events
In App Message actions are now handled by implementing a
OneSignalInAppMessageClickListener
with the following function:void onClickInAppMessage(OSInAppMessageClickEvent event)
The click event parameter has an
OSInAppMessage
and anOSInAppMessageClickResult
.The
OSInAppMessageClickResult
contains click'sactionId
and theurl
, if any, that was launched.The implementing class should call
OneSignal.InAppMessages.addClickListener(this);
Notification Will Display Events
The
willShowInForegroundHandler
is now theOneSsignalNotificationLifecycleListener
which has theonWillDisplay
function.void onWillDisplayNotification(OSNotificationWillDisplayEvent event)
To prevent the notification from being displayed call
event.preventDefault();
To then later display the notification call
event.notification.display();
The implementing class should call
OneSignal.Notifications.addLifecycleListener(this);
Notification Click Events
setNotificationOpenedHandler
has been replaced with theOneSignalNotificationClickListener
void onClickNotification(OSNotificationClickEvent event)
The click event has the
OSNotification
that was clicked and aOSNotificationClickResult
The
OSNotificationClickResult
has theactionId
and theurl
if any that was opened from the click.The implementing class should call
OneSignal.Notifications.addClickListener(this);
Push Subscription Observer
The
OneSignalPushSubscriptionObserver
class's function is now namedonOSPushSubscriptionChange
void onOSPushSubscriptionChangedWithState(OSPushSubscriptionChangedState state)
The state parameter has a
previous
and acurrent
OSPushSubscriptionState
Motivation
Update naming for user model api
Scope
In App Messages, Notifications, Subscriptions, Permissions, Privacy Consent
Testing
Manual testing
Affected code checklist
Checklist
Overview
Testing
Final pass
This change is