-
Notifications
You must be signed in to change notification settings - Fork 306
notif: Use live value for app ID on registering APNs token #1451
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?
Conversation
Thanks for the contribution! Before we can review this in detail, it will need tests. See the guidance in our README file about writing tests. |
Tests are added. |
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.
Thanks for working on this @AhmedTareek! Some comments below.
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.
Thanks for the revision @AhmedTareek! Some nits otherwise looks good, moving to integration review from Greg.
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.
Thanks @AhmedTareek for picking this up, and @rajveermalviya for the previous reviews! Comments below.
@@ -149,9 +149,10 @@ class NotificationService { | |||
await addFcmToken(connection, token: token); | |||
|
|||
case TargetPlatform.iOS: | |||
const appBundleId = 'com.zulip.flutter'; // TODO(#407) find actual value live |
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.
nit in commit message:
Fixes zulip#407
follow existing patterns for how to format this — use git log
(better, git log --grep Fixes
) to see examples
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.
notif: Use live value for app ID on registering APNs token
Fixes #407
Closer, but make it a complete sentence:
notif: Use live value for app ID on registering APNs token
Fixes #407.
f1ee1ef
to
09a1c01
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.
Thanks for the revision! This is close to merge — various small comments below.
@@ -149,9 +149,10 @@ class NotificationService { | |||
await addFcmToken(connection, token: token); | |||
|
|||
case TargetPlatform.iOS: | |||
const appBundleId = 'com.zulip.flutter'; // TODO(#407) find actual value live |
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.
notif: Use live value for app ID on registering APNs token
Fixes #407
Closer, but make it a complete sentence:
notif: Use live value for app ID on registering APNs token
Fixes #407.
Fixes zulip#407. `await ZulipBinding.instance.packageInfo` was added to get the packageName, making `registerToken` take longer to complete. Previously, in "token initially unknown" test in the UpdateMachine.registerNotificationToken `start()` and `_registerNotificationToken()` finished in sync with the test’s expectations. Now, `flushMicrotasks` is added to ensure that the listener callback `_registerNotificationToken()` finishes its async work before continuing the test. Added packageInfo function in `example_data.dart` and updated tests that implicitly relied on packageInfo data to explicitly set it.
Thanks @AhmedTareek for the revision! These changes all look good. Before merging, I'd like to manually test this end to end, to check that notifications still work as expected. I believe they should — but the changes this PR is making are the kind where an oversight could easily cause notifications to totally break, and without manual testing we likely wouldn't learn that until it went out in the next release. I tried doing that manual testing just now, but it seems like the instructions we've previously had for manually testing notification changes aren't currently working. So some debugging will be required to work out how to update them. (We'll need that sort of testing to be working again for other changes too, not only this PR.) I started a chat thread for that here: Once that's sorted out, I can do a round of manual testing on this PR; and provided that comes out clean as expected, we'll then be able to merge it. |
Fixes #407
Changes made:
packageInfo.packageName
.The first change caused the "token initially unknown" test in
store_test.dart
to fail due to the added asynchronous call toZulipBinding.instance.packageInfo
, which delayed the completion ofregisterToken
.To resolve this, a
flushMicrotasks
was added afterawait startFuture
in the test to ensure_registerNotificationToken
completes before the test checks for the request.