Skip to content
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

feat!: BREAKING Overhauls to the pub/sub system #39

Merged
merged 7 commits into from May 1, 2023

Conversation

Steven0351
Copy link
Member

  • Breaks out a separate PortalsPubSub class from PortalsPlugin to separate the event bus logic from the implementation of the Plugin

  • Makes PortalsPlugin useable as an instance plugin to scope events to a specific instance of PortalsPubSub

  • Adds the ability to scope the pubSub instance in linkMessageReceivers on PortalFragment.

* Breaks out a separate PortalsPubSub class from PortalsPlugin to separate
the event bus logic from the implementation of the Plugin

* Makes PortalsPlugin useable as an instance plugin to scope events to a
specific instance of PortalsPubSub

* Adds the ability to scope the pubSub instance in `linkMessageReceivers` on PortalFragment.
@Steven0351
Copy link
Member Author

This PR is much in the same spirit of ionic-team/ionic-portals-ios#71, without the changes in how subscriptions are managed.

fun unsubscribe(topic: String, subscriptionRef: Int) {
subscriptions[topic]?.remove(subscriptionRef)
}
val shared = PortalsPubSub()
Copy link
Member Author

Choose a reason for hiding this comment

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

I don't really know if this is a very common convention in Android/Kotlin/JVM stuff when providing a base singleton to use.

Copy link
Member

Choose a reason for hiding this comment

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

I think so

@Steven0351
Copy link
Member Author

@carlpoole and I also discussed adding companion object shims back to PortalsPlugin that use PortalsPubSub.shared under the hood to avoid too much breaking. Those could then be marked as deprecated.

@giralte-ionic
Copy link

Added @IT-MikeS to review as I'm not comfortable commenting on the TS singleton comment

@IT-MikeS
Copy link

Did I miss something? There's no TS being worked on here it would seem @giralte-ionic

@Steven0351
Copy link
Member Author

Added @IT-MikeS to review as I'm not comfortable commenting on the TS singleton comment

The comment was regarding Kotlin and Java patterns

@giralte-ionic
Copy link

ok sorry I'm dumb

@IT-MikeS IT-MikeS removed their request for review April 19, 2023 19:18
@Steven0351 Steven0351 merged commit 8212d0e into main May 1, 2023
5 checks passed
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.

None yet

4 participants