-
Notifications
You must be signed in to change notification settings - Fork 9.8k
[firebase_messaging] adding support for deleteInstanceId and setAutoInitEnabled #875
Conversation
Hi @kroikie , can you please take a look at this one? Note: the only way I could manage the Java |
test('setAutoInitEnabled', () { | ||
bool enabled = true; | ||
firebaseMessaging.setAutoInitEnabled(enabled); | ||
verify(mockChannel.invokeMethod('setAutoInitEnabled', enabled)); |
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.
Could you verify explicitly here that true
and false
are called here?
verify(mockChannel.invokeMethod('setAutoInitEnabled', 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.
Is that what you mean?
// assert that we havent called the method yet
verifyNever(firebaseMessaging.setAutoInitEnabled(true));
firebaseMessaging.setAutoInitEnabled(true);
// assert we called the method with enabled = true
verify(mockChannel.invokeMethod('setAutoInitEnabled', true));
// assert that enabled = false was not yet called
verifyNever(firebaseMessaging.setAutoInitEnabled(false));
firebaseMessaging.setAutoInitEnabled(false);
// assert call with enabled = false was properly done
verify(mockChannel.invokeMethod('setAutoInitEnabled', false));
What I really would like to do is to call autoInitEnabled()
to check its value after calling setAutoInitEnabled
, but as both method implementations lie on the plugin, we don't have access on testing time - I think.
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.
@kroikie do you think that's ok?
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.
Yes that look good to me.
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.
OK, it's done! 👍
Much appreciated! Thank you. |
…nitEnabled (flutter#875) * adding support for deleteInstanceId and setAutoInitEnabled
…setAutoInitEnabled (flutter#875)" This reverts commit 89c555d.
…nitEnabled (flutter#875) * adding support for deleteInstanceId and setAutoInitEnabled
fix flutter/flutter#20627
If an app has a basic flow with user login and logout AND receives notifications based on the logged user, the logout method needs to delete the current instanceID connected to Firebase Cloud Messaging. Otherwise, the unauthenticated app (after the user logs out) will still receive notifications from the previous logged user.
As
deleteInstanceId
might automatically recreate a new one,autoInitEnabled
andsetAutoInitEnabled
must be provided as well.Note: Firebase Java plugin uses
deleteInstanceId
("Id"), in this Dart implementationdeleteInstanceID
("ID") is being used.