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

Moving MParticle-specific messaging logic into a router for reusability #8

Merged
merged 5 commits into from
Jun 1, 2016
Merged

Moving MParticle-specific messaging logic into a router for reusability #8

merged 5 commits into from
Jun 1, 2016

Conversation

dallasgutauckis
Copy link
Contributor

Core changes:

  • PushAnalyticsReceiver#onNotification* methods are now part of an interface (PushAnalyticsReceiverCallback)
  • PushAnalyticsReceiver now delegates processing of the intent and calling of callbacks into MPMessagingRouter
  • MPMessagingRouter abides by a contract of only consuming what it should, and lets the caller know if the given Intent was consumed

@@ -0,0 +1,22 @@
package com.mparticle.messaging;

public interface PushAnalyticsReceiverCallback {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This might make more sense to share the MPMessagingRouter prefix instead of the Receiver implementation.

@samdozor
Copy link
Member

samdozor commented May 17, 2016

hey @dallasgutauckis - first of all, thanks again for the PR. The original intention that we had was for developers to optionally subclass PushAnalyticsReceiver and override onNotificationReceived and/or onNotificationTapped. I think that accomplishes the same thing, but maybe I'm missing something. Is there a reason why subclassing doesn't work for your setup?

@dallasgutauckis
Copy link
Contributor Author

I'm assuming you mean subclassing PushAnalyticsReceiver — didn't see the Callback you mentioned when I was looking the other day — and yeah I understand the suggested implementation.

Besides preferring not to depend on third party SDKs for our super classes (composition over inheritance), some other things:

  • Calling the super implementation doesn't let us know if the intent provided is handled by MParticle or not
  • Our existing GCM receiver implementation utilizes WakefulBroadcastReceiver, and with this implementation we'll still be sending our own messages

I think that accomplishes the same thing, but maybe I'm missing something

It's close, but not quite the same. I would say the main benefit is knowing if the result should be handled by MParticle

Sam Dozor and others added 5 commits May 31, 2016 17:50
A small percentage of devices are failing to create a valid Date header. This commit ensures that all devices use the US locale, which is guaranteed to be present.
@samdozor samdozor merged commit d8762a2 into mParticle:master Jun 1, 2016
@dallasgutauckis dallasgutauckis deleted the pr-messaging_router branch June 2, 2016 14:42
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.

2 participants