-
Notifications
You must be signed in to change notification settings - Fork 4
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
base: master
Are you sure you want to change the base?
Conversation
1bfeb22
to
f478e9b
Compare
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.
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 |
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.
isRegistered
maybe?
@@ -112,8 +116,35 @@ const PerfectyPush = (() => { | |||
await Registration.check(Storage.userId(), Storage.optedOut()) | |||
} | |||
|
|||
const register = async () => { | |||
Options.askPermissionsDirectly = true |
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.
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.
Please check the failing CI job, I've allowed it to run |
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 actionPerfectyPush.unregister(): Promise<boolean>
PerfectyPush.isRegister(): boolean
check if this browser have permission and is registered