Skip to content

Conversation

sjchmiela
Copy link
Contributor

Why

Follow up to #6773 (comment).

How

Split addNotificationListener into three: addNotificationReceivedListener, addNotificationsDroppedListener, addNotificationResponseReceivedListener.

Test Plan

Added a test case to test-suite, verifying that notificationReceivedListener is called when a notification is received.

@sjchmiela sjchmiela requested a review from esamelson February 11, 2020 10:47
@sjchmiela sjchmiela requested a review from mczernek as a code owner February 11, 2020 10:47
} else {
emitter.removeSubscription(subscription);
}
export function removeSubscription(subscription: Subscription) {
Copy link
Contributor

Choose a reason for hiding this comment

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

is there any difference between calling this and subscription.remove()? if not, this seems redundant.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

True, I agree! This is also what James pointed out in #6577 (comment)

removeTokenSubscription removePushTokenSubscription
(although, is this function needed if developers can just call subscription.remove()?)

, to which I responded with #6779 (comment)

I agree developers can just call subscription.remove(), but eg. EventEmitter.ts and other event emitters (like MediaLibrary) implement this method anyway.

Maybe if we decide to remove this method from all event emitters it should be in a separate PR?

which has been approved of. Do you think we should remove this method now, or should we remove all of them immediately, or postpone the change until… some day?

Copy link
Contributor

Choose a reason for hiding this comment

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

Gotcha. Sorry to make you justify this twice!! Let's leave it for now for consistency.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This only proves that the review process is consistently good and thorough! 😃

@sjchmiela sjchmiela force-pushed the @sjchmiela/expo-notifications-splitemitter branch from 5263e4c to 0cc6a0f Compare February 13, 2020 09:58
@sjchmiela sjchmiela merged commit 119ca74 into master Feb 13, 2020
@sjchmiela sjchmiela deleted the @sjchmiela/expo-notifications-splitemitter branch February 13, 2020 10:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants