Skip to content

Commit 6f02347

Browse files
committed
Only send new/changed email addresses
1 parent 97269ff commit 6f02347

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/main/java/com/mparticle/kits/AppboyKit.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ public class AppboyKit extends KitIntegration implements KitIntegration.Activity
3535
static final String APPBOY_KEY = "apiKey";
3636
public static final String PUSH_ENABLED = "push_enabled";
3737
private static final String PREF_KEY_HAS_SYNCED_ATTRIBUTES = "appboy::has_synced_attributes";
38+
private static final String PREF_KEY_CURRENT_EMAIL = "appboy::current_email";
3839
final Handler dataFlushHandler = new Handler();
3940
private Runnable dataFlushRunnable;
4041
final private static int FLUSH_DELAY = 5000;
@@ -234,11 +235,13 @@ public void setUserIdentity(MParticle.IdentityType identityType, String identity
234235
Appboy.getInstance(getContext()).changeUser(identity);
235236
queueDataFlush();
236237
}
237-
} else if (MParticle.IdentityType.Email.equals(identityType)) {
238+
} else if (MParticle.IdentityType.Email.equals(identityType)
239+
&& identity != null
240+
&& !identity.equals(getKitPreferences().getString(PREF_KEY_CURRENT_EMAIL, null))) {
238241
user.setEmail(identity);
239242
queueDataFlush();
243+
getKitPreferences().edit().putString(PREF_KEY_CURRENT_EMAIL, identity).apply();
240244
}
241-
242245
}
243246

244247
@Override

0 commit comments

Comments
 (0)