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

Added Event Listener system #212

Merged
merged 43 commits into from
Nov 21, 2023
Merged

Added Event Listener system #212

merged 43 commits into from
Nov 21, 2023

Conversation

nahid
Copy link
Contributor

@nahid nahid commented Sep 11, 2023

As I mentioned in @gnikyt PR 1220, I just added some events in the various cases for this package. These features help developers add more control over this package. Now developers can do anything based on the triggered event by registering their own listener/s, e.g.: send email/SMS/notification, run job, update DB, or anything else.
Also, this PR includes some refactoring with performance improvements.

By adding this feature will open up the opportunity to add more new features in the future

Events

  • AppInstalledEvent
  • ShopAuthenticatedEvent
  • ShopDeletedEvent
  • AppUninstalledEvent
  • PlanActivatedEvent

Backward compatibility: YES
Breaking change: NO
Deprecation: YES (AfterAuthenticationJob feature will be removed in the next major release)
Doc: Need to update the WIKI after merging this PR with the migration guide

nahid and others added 30 commits August 25, 2022 12:03
@nahid
Copy link
Contributor Author

nahid commented Sep 13, 2023

@Kyon147 thanks for your quick reply and queries. I just added all possible tests with this PR.

  • I have removed the code from the InstallShop class because I have seen that this issue has already been resolved.
  • Two events have been added to the Authentication feature to have more control over it.

@nahid
Copy link
Contributor Author

nahid commented Sep 16, 2023

Hey @Kyon147, is there any suggestions from?

@nahid nahid requested a review from asmshaon October 1, 2023 09:56
@nahid
Copy link
Contributor Author

nahid commented Oct 1, 2023

Hello @Kyon147, I hope everything is going well. It's been a while since this PR was submitted, what are your thoughts on it? Is there anything else that needs to be changed or improved?

@Kyon147
Copy link
Owner

Kyon147 commented Oct 2, 2023

Hey @nahid

I just need to check the event system in a blank app, so I can QA it to make sure as it is a big PR.

@nahid
Copy link
Contributor Author

nahid commented Oct 2, 2023

Hi @Kyon147 ,

I understand the need for a thorough test on this significant PR. It'll be great if you test before merge. Feel free to reach out if you encounter any issues or have questions.

Your feedback is much appreciated.

@nahid
Copy link
Contributor Author

nahid commented Oct 31, 2023

Hello @Kyon147,
I hope you're doing well. I understand you're very busy and finding it difficult to spare time. I'm a power user of this package, and this PR is very important to me. I hope it will also make life easier for others. If you have the time to test the PR in your free time and have any suggestions, or if everything looks good, merging it would be very helpful.

Thank you for your excellent work on this package and for your contributions to the community.

@Kyon147
Copy link
Owner

Kyon147 commented Oct 31, 2023

Hey @nahid

Thanks for the ping to remind me, I'll take a look at this later today and if it looks good will merge it into master and set up a new release for it.

Thank you for taking the time to work on the PR - I'm sure it will be super helpful for the rest of the community.

@nahid
Copy link
Contributor Author

nahid commented Nov 12, 2023

Hey @Kyon147 , Sorry for disturbing you. Any updates regarding this PR?

@Kyon147
Copy link
Owner

Kyon147 commented Nov 13, 2023

Hey @Kyon147 , Sorry for disturbing you. Any updates regarding this PR?

Hey @nahid I've got this on my local and just running some QA on it. Should be done shortly.

@nahid
Copy link
Contributor Author

nahid commented Nov 16, 2023

Hey @Kyon147 Thanks for your time 🙂

Copy link
Owner

@Kyon147 Kyon147 left a comment

Choose a reason for hiding this comment

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

This looks good @nahid .

The last thing to do before I merge is can you create a wiki article that outlines how to use the feature and the available events.

@nahid
Copy link
Contributor Author

nahid commented Nov 19, 2023

Awesome, sure! I'll get started on creating that wiki article ASAP and will keep you posted once it's done, @Kyon147

@nahid
Copy link
Contributor Author

nahid commented Nov 19, 2023

BTW @Kyon147, how can I contribute to this project's wiki?

@Kyon147
Copy link
Owner

Kyon147 commented Nov 20, 2023

Hi @nahid

You should just be able to edit the wiki but I have created a page for you here to start off. https://github.com/Kyon147/laravel-shopify/wiki/Event-System

@nahid
Copy link
Contributor Author

nahid commented Nov 21, 2023

@Kyon147, Thanks for your support, but unfortunately I can't edit this page in any way ☹️

@Kyon147
Copy link
Owner

Kyon147 commented Nov 21, 2023

@Kyon147, Thanks for your support, but unfortunately I can't edit this page in any way ☹️

Can you try again now @nahid had to change a setting in the repo.

@nahid
Copy link
Contributor Author

nahid commented Nov 21, 2023

Great, now it works fine @Kyon147

@nahid
Copy link
Contributor Author

nahid commented Nov 21, 2023

Hello @Kyon147, Hope you're doing well. I've just finished the Event Listener wiki. Kindly review it, and please don't hesitate to share any feedback or suggest changes if necessary.

wiki: https://github.com/Kyon147/laravel-shopify/wiki/Event-Listener-System

@Kyon147
Copy link
Owner

Kyon147 commented Nov 21, 2023

Hello @Kyon147, Hope you're doing well. I've just finished the Event Listener wiki. Kindly review it, and please don't hesitate to share any feedback or suggest changes if necessary.

wiki: https://github.com/Kyon147/laravel-shopify/wiki/Event-Listener-System

Amazing, thanks for taking the time to sort the PR and the wiki, its appreciated. I'll merge in the work and get a new release out this week 👍

@Kyon147 Kyon147 merged commit 0f24b0c into Kyon147:master Nov 21, 2023
6 checks passed
@faridmovsumov
Copy link
Sponsor

Hello @nahid, this is a great feature. Thanks a lot for adding this. 🙏
I noticed a small problem.

Context: This happens after uninstalling and installing the app again when the shop is in soft delete mode.

In this case, ShopAuthenticatedEvent is being fired when a shop is installed, not when authenticated and this is causing some problems.

This is how I defined the listener.

image

And this is the code inside my listener.

image

After uninstalling and installing the shop again, it is being fired before I actually see the permission screen on Shopify. So, at this point, my user has been soft-deleted from the DB.

And this is the log I see in the terminal.

image

cc: @Kyon147

@nahid
Copy link
Contributor Author

nahid commented Jan 2, 2024

Could you please share the $shop model dump with me @faridmovsumov

@faridmovsumov
Copy link
Sponsor

@nahid using the AppInstalled event solved my problem. I made the wrong assumption by naming.

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