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

Expose register method to manually subscribe new user #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

nico2che
Copy link

@nico2che nico2che commented Jan 26, 2022

Thank you for this plugin!

What do you think about this? I would like to design my own dialog so I exposed three methods:

PerfectyPush.register(): Promise<boolean> ask for permission, return promise fulfilled by user action
PerfectyPush.unregister(): Promise<boolean>
PerfectyPush.isRegister(): boolean check if this browser have permission and is registered

@nico2che nico2che force-pushed the master branch 4 times, most recently from 1bfeb22 to f478e9b Compare January 28, 2022 06:00
Copy link
Collaborator

@rwngallego rwngallego left a comment

Choose a reason for hiding this comment

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

Hi @nico2che thanks a lot for your PR! The idea is great and thanks for the webpack exports changes. The only small change is the name of the isRegister export.

I will need to do some extra refactoring of the current SDK code after this merge in order to better support this new feature. Thanks a lot!

start,
register,
unregister,
isRegister
Copy link
Collaborator

Choose a reason for hiding this comment

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

isRegistered maybe?

@@ -112,8 +116,35 @@ const PerfectyPush = (() => {
await Registration.check(Storage.userId(), Storage.optedOut())
}

const register = async () => {
Options.askPermissionsDirectly = true
Copy link
Collaborator

Choose a reason for hiding this comment

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

We should not alter user options but instead adjust the existing code to support explicit registrations called from JS. I will refactor the current code in Perfecty in order to support what you intend to do in a separate PR.

@rwngallego
Copy link
Collaborator

Please check the failing CI job, I've allowed it to run

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