-
Notifications
You must be signed in to change notification settings - Fork 40
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
Push Activation State Machine: validate an already-registered device on activation #543
Conversation
41392bc
to
8f9dfb3
Compare
@@ -1017,6 +1017,11 @@ private static final String hmac(String text, String key) { | |||
* @throws AblyException | |||
*/ | |||
public void setClientId(String clientId) throws AblyException { | |||
if(clientId == null) { | |||
/* do nothing - we received a token without a clientId */ |
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.
If this is possible, shouldn't it be in the spec and thus have an associated test?
android/src/androidTest/java/io/ably/lib/test/android/AndroidPushTest.java
Show resolved
Hide resolved
This implements ably/docs@1b775f3 (Tests to follow.) |
I just want to link to ably/docs#786 for cross-reference in the GitHub UI. |
9e339d7
to
af708fc
Compare
af708fc
to
dac720c
Compare
To-do:
|
While talking to @QuintinWillison I noticed that now that we've renamed |
@paddybyers PTAL This should be easier to review on a per-commit basis. |
Co-Authored-By: Toni Cárdenas <toni@tcardenas.me>
Conform to the spec as to which callbacks should be called from WaitingForRegistrationSync.
This isn't in the spec (yet). The previous behavior causes the activation callback to be called right away with no error, while a previous activation is ongoing. The correct behavior is to serialize the calls, so that the second call is processed after the first has finished. At the same time, remove the CalledActivate enqueue from NotActivated, which relied on the old behavior but wasn't doing anything really useful. (This needs to be removed from the spec too.)
Realtime seems to expect it, even if we set the device token header.
Also, fix a test that relied on broken behavior.
So that we can mock it in tests. OnCompleteListeners can only be fired by Android. So now, we need to brigde Android's native OnCompleteListener to our Callback.
It was defined but unused.
This provides more flexibility for further tests, and supersedes the need for TestActivationStateMachine.ignoreRegistrationTokenRequest.
Otherwise, we're resetting it each time, which then breaks client ID updates detection.
For a broken test, take blocks indefinitely.
Will be needed to test RSH8i.
e8b7108
to
5f65aa4
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.
I can't approve this because I was the original author, but LGTM. Thanks @tcard , good work. Rescued my half-baked implementation :)
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 @paddybyers. Approving on your behalf so that this thing lets me merge.
🥳 |
Implements ably/docs#786