-
Notifications
You must be signed in to change notification settings - Fork 12
Add possibility to provide a locale when registering push token, make sure to not miss the last notification interaction and get expo push token if has permissions on boot #808
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,6 +12,7 @@ export interface KnockPushNotificationContextType { | |
| registerPushTokenToChannel( | ||
| token: string, | ||
| channelId: string, | ||
| locale?: string, | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the locale in our app can be overridden (not system wide) and at the moment there is no way to tell knock about the custom user's locale
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looks reasonable.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. let me know if you want me to split this pr into multiple |
||
| ): Promise<ChannelData | void>; | ||
| unregisterPushTokenFromChannel( | ||
| token: string, | ||
|
|
@@ -44,10 +45,14 @@ export const KnockPushNotificationProvider: React.FC< | |
|
|
||
| // Acts like an upsert. Inserts or updates | ||
| const registerPushTokenToChannel = useCallback( | ||
| async (token: string, channelId: string): Promise<ChannelData | void> => { | ||
| async ( | ||
| token: string, | ||
| channelId: string, | ||
| locale: string = Intl.DateTimeFormat().resolvedOptions().locale, | ||
| ): Promise<ChannelData | void> => { | ||
| const newDevice: Device = { | ||
| token, | ||
| locale: Intl.DateTimeFormat().resolvedOptions().locale, | ||
| locale, | ||
| timezone: Intl.DateTimeFormat().resolvedOptions().timeZone, | ||
| }; | ||
|
|
||
|
|
||
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.
it's probably a breaking change