James noted a while back that there can be a race where pushEnabled is read and sent to the backend at startup before the correct value can be determined.
To fix this, we want to make sure the initial request for the permission status will send a device updated event if the value is different than the one that was used. This initial request was the only place with a false argument like refreshPushStatus(publishChange: false).
So I've removed the publishChange parameter in favour of calculating a shouldPublish property that confirms that the value has changed AND (new) that there's an active session (this means that the previous value was used).
I've also added the same check to setPushToken so we're not triggering device update events with an unchanged push token value.
James noted a while back that there can be a race where
pushEnabled
is read and sent to the backend at startup before the correct value can be determined.To fix this, we want to make sure the initial request for the permission status will send a device updated event if the value is different than the one that was used. This initial request was the only place with a false argument like
refreshPushStatus(publishChange: false)
.So I've removed the
publishChange
parameter in favour of calculating ashouldPublish
property that confirms that the value has changed AND (new) that there's an active session (this means that the previous value was used).I've also added the same check to
setPushToken
so we're not triggering device update events with an unchanged push token value.