Open abishekrsrikaanth opened 1 year ago
Hi @abishekrsrikaanth
Thanks for submitting a PR. Could you let me know how you would use this differently to the AfterAuthenticate
job that already exists in the package which can be used for the same thing.
Thanks!
Also, need to add the AppUninstalled
, PlanPurchased
, and PlanChanged
events.
@osiset and @Kyon147
@nahid I think Kyron147 was asking how does it differ from AfterAuthenticate
, are you saying we should deprecate AfterAuthenticate
in favor of these events? If so, let us know :) and if thats the case, we would have to update documentation and make a major release for these events as it would break existing apps depending on if they use AfterAuthenticate
.
@osiset Thanks, got it. I think the AfterAuthenticate
job feature should be deprecated in the next version but legacy support is required up to a certain version. It can be configurable. If someone wants to use the legacy feature he/she didn't need to configure anything but if someone is want to use the Event Listener feature they need to configure it.
In my previous comment I meant that we need to add
AppUninstalled
,PlanPurchased
, andPlanChanged
events besides theAppInstalled
event. Because sometimes App owners need to notify the shop owners of these events.
@nahid Sounds fine to me, if you would like to add those additional events and some jotnotes on how to use the events so we can form a wiki entry for people, that would be great. We can then review and merge in for a major release.
Thank you @osiset, I'll make a PR with these changes ASAP.
@nahid One thing to note for appinstalled, is that there will need to be an option to run it "inline" and not later somehow. Some people require changes to be made before the shop user sees the app (example, set some flag in the database).
@nahid One thing to note for appinstalled, is that there will need to be an option to run it "inline" and not later somehow. Some people require changes to be made before the shop user sees the app (example, set some flag in the database).
@osiset Given that this is not a job being dispatch but an event, then note that events are always synchronous. The listeners one might register for these events on the other hand can be either queued or synchronous. So "inline" is essentially build into the implementation using events, making it a really nice solution for any use case š
@bilfeldt exactly, if someone wants to run Listener
immediately, just ignore the ShouldQueue
implementation
The
AppInstalled
event will be triggered after the installation of App on the store. This can be used to run jobs after successful installation. For example, fetching data from the store that is needed by the application.Here is an example of how to set up a Listener and subscribe to it on the project's EventServiceProvider.
Once your listener has been defined, you may register it within your application's
EventServiceProvider
:@Kyon147, I am resending this PR again as the last PR (#1058) had additional code that was already merged in to the repo.