- Notifications
You must be signed in to change notification settings - Fork 140
Subscription count event #331
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
Closed
Closed
Changes from all commits
Commits
Show all changes
12 commits Select commit Hold shift + click to select a range
75b958b Event listner
singhashmeet 9aaa239 Update readme
singhashmeet f97b594 Update ecample apps
singhashmeet 4b8d7f5 Change listner name
singhashmeet 4014c9c Store count in a variable and expose through a public method
singhashmeet 95d8d3e Integer class to handle null situation
singhashmeet 61fae04 CHANGELOG update
singhashmeet 6842c09 Refactor code
singhashmeet 1fe2479 getName from current class
singhashmeet 1b8b6b4 Update Readme and build.gradle
singhashmeet 80782a6 Update version
singhashmeet 5b2f9e3 Update version
singhashmeet 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
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
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
12 changes: 12 additions & 0 deletions 12 src/main/java/com/pusher/client/channel/impl/message/SubscriptionCountData.java
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 |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| package com.pusher.client.channel.impl.message; | ||
| | ||
| import com.google.gson.annotations.SerializedName; | ||
| | ||
| public class SubscriptionCountData { | ||
| @SerializedName("subscription_count") | ||
| public Integer count; | ||
| | ||
| public int getCount(){ | ||
| return count; | ||
| } | ||
| } |
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
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.
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.
I can't bring myself to let it go like this. This makes it harder for anyone who wants to upgrade, even if they don't want to use the feature.
I know the way it's currently designed is annoying to work with. But let's create a new interface that extends this.
e.g.
ChannelWithSubscriptionCountEventListenerYou probably have to add two more interfaces that extend that for private channels too.
PrivateChannelWithSubscriptionCountEventListener,PrivateEncryptedChannelWithSubscriptionCountEventListenerIt's pretty ugly but at least it doesn't force everyone to change their implementation.
Sorry for the late feedback.
We will need to rethink and redesign how these event listeners are added in the next major release.
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 SDK is not designed for this to happen elegantly and will complicate the integration process a lot for subscription count.
If not breaking the older implementations is a non-negotiable then I would suggest removing this event listener entirely and renaming the event to
pusher:subscription_countso it can be handled with the.bind()function like in JS SDKWhat do you think ?