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

localize follows notification #1446 #1483

Merged
merged 4 commits into from
Sep 12, 2024
Merged

Conversation

bryanmontz
Copy link
Contributor

@bryanmontz bryanmontz commented Sep 10, 2024

Issues covered

#1446

Description

Adds new localized strings to support localization of the follows push notifications. This change is only part of what's required to achieve the desired result, because the notifications will also need to be updated on the server side. I discussed this with @dcadenas, and he will be making the required server-side changes.

Unfortunately this can't truly be tested until the server-side changes are made, and these changes have no effect in the app until they are made.

Thanks to @mplorentz and @dcadenas for helping me test this!

Note: I wasn't able to use plural variants with the "You have x new followers!" string as I'd hoped. I tried initially and had "%i" for the wildcard, but when I tested it, the notification said only "@value@". The documentation for the "loc-args" key implies that you can only use strings:

An array of strings containing replacement values for variables in your message text. Each %@ character in the string specified by loc-key is replaced by a value from this array. The first item in the array replaces the first instance of the %@ character in the string, the second item replaces the second instance, and so on.
https://developer.apple.com/documentation/usernotifications/generating-a-remote-notification

Screenshots:

one - no name one with name many
IMG_8381 IMG_8379 IMG_8380

Copy link
Contributor

@joshuatbrown joshuatbrown left a comment

Choose a reason for hiding this comment

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

Looks good from a code perspective, but as you said, no way to test.

@joshuatbrown joshuatbrown self-assigned this Sep 11, 2024
@joshuatbrown
Copy link
Contributor

joshuatbrown commented Sep 11, 2024

Here's what I did to test this (since I don't see the steps documented anywhere):

  1. Build and run the app on device
  2. Set a breakpoint in application(_:didRegisterForRemoteNotificationsWithDeviceToken:)
  3. printed deviceToken.toHexString() to the console
  4. pasted that device token into the Push Notifications test tool
  5. Downloaded the JSON payload from one of Bryan's tests for localization
  6. Put the app in the background
  7. Send the notification from the Push Notifications console
  8. Observe the notification on my device

Copy link
Contributor

@joshuatbrown joshuatbrown left a comment

Choose a reason for hiding this comment

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

Works for me!

@bryanmontz
Copy link
Contributor Author

Here's what I did to test this (since I don't see the steps documented anywhere):

  1. Build and run the app on device
  2. Set a breakpoint in application(_:didRegisterForRemoteNotificationsWithDeviceToken:)
  3. printed deviceToken.toHexString() to the console
  4. pasted that device token into the Push Notifications test tool
  5. Downloaded the JSON payload from one of Bryan's tests for localization
  6. Put the app in the background
  7. Send the notification from the Push Notifications console
  8. Observe the notification on my device

Thanks for this, @joshuatbrown! I should've put this together. Sorry about that. I added these steps to a new documentation in Notion called How to Test Push Notifications.

@bryanmontz bryanmontz added this pull request to the merge queue Sep 12, 2024
Merged via the queue into main with commit b5c8357 Sep 12, 2024
4 checks passed
@bryanmontz bryanmontz deleted the bdm/1446-localize-follows branch September 12, 2024 11:44
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.

3 participants