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

Remove integrations code for braze and airship #770

Merged
merged 1 commit into from
Dec 13, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -358,9 +358,8 @@ public void reportResults(List<InAppNotification> newNotifications,
List<InAppNotification> newTriggeredNotifications,
JSONArray eventBindings,
JSONArray variants,
boolean automaticEvents,
JSONArray integrations) {
super.reportResults(newNotifications, newTriggeredNotifications, eventBindings, variants, automaticEvents, integrations);
boolean automaticEvents) {
super.reportResults(newNotifications, newTriggeredNotifications, eventBindings, variants, automaticEvents);
mExpectations.resolve();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,23 +106,23 @@ public void removeOnMixpanelTweaksUpdatedListener(OnMixpanelTweaksUpdatedListene

@Test
public void testTriggeredInapps() throws JSONException, BadDecideObjectException {
mDecideMessages.reportResults(new ArrayList<InAppNotification>(), mSomeTriggeredNotifications, mSomeBindings, mSomeVariants, mIsAutomaticEventsEnabled, null);
mDecideMessages.reportResults(new ArrayList<InAppNotification>(), mSomeTriggeredNotifications, mSomeBindings, mSomeVariants, mIsAutomaticEventsEnabled);
assertNull(mDecideMessages.getNotification(false));

final AnalyticsMessages.EventDescription testEvent1 = new AnalyticsMessages.EventDescription("test_event1", null, "");
final AnalyticsMessages.EventDescription testEvent2 = new AnalyticsMessages.EventDescription("test_event2", new JSONObject("{\"$device\": \"Android\"}"), "");
assertNotNull(mDecideMessages.getNotification(testEvent1, false));
assertNotNull(mDecideMessages.getNotification(testEvent2, false));

mDecideMessages.reportResults(new ArrayList<InAppNotification>(), mSomeTriggeredNotifications, mSomeBindings, mSomeVariants, mIsAutomaticEventsEnabled, null);
mDecideMessages.reportResults(new ArrayList<InAppNotification>(), mSomeTriggeredNotifications, mSomeBindings, mSomeVariants, mIsAutomaticEventsEnabled);
assertNull(mDecideMessages.getNotification(testEvent1, false));
assertNull(mDecideMessages.getNotification(testEvent2, false));
}

@Test
public void testDuplicateIds() throws JSONException, BadDecideObjectException {

mDecideMessages.reportResults(mSomeNotifications, mSomeTriggeredNotifications, mSomeBindings, mSomeVariants, mIsAutomaticEventsEnabled, null);
mDecideMessages.reportResults(mSomeNotifications, mSomeTriggeredNotifications, mSomeBindings, mSomeVariants, mIsAutomaticEventsEnabled);

final List<InAppNotification> fakeNotifications = new ArrayList<InAppNotification>(mSomeNotifications.size());
for (final InAppNotification real: mSomeNotifications) {
Expand All @@ -136,7 +136,7 @@ public void testDuplicateIds() throws JSONException, BadDecideObjectException {

assertNull(mDecideMessages.getNotification(false));

mDecideMessages.reportResults(fakeNotifications, mSomeTriggeredNotifications, mSomeBindings, mSomeVariants, mIsAutomaticEventsEnabled, null);
mDecideMessages.reportResults(fakeNotifications, mSomeTriggeredNotifications, mSomeBindings, mSomeVariants, mIsAutomaticEventsEnabled);

assertNull(mDecideMessages.getNotification(false));

Expand All @@ -146,7 +146,7 @@ public void testDuplicateIds() throws JSONException, BadDecideObjectException {
final InAppNotification unseenNotification = new MiniInAppNotification(notificationNewIdDesc);
fakeNotifications.add(unseenNotification);

mDecideMessages.reportResults(fakeNotifications, mSomeTriggeredNotifications, mSomeBindings, mSomeVariants, mIsAutomaticEventsEnabled, null);
mDecideMessages.reportResults(fakeNotifications, mSomeTriggeredNotifications, mSomeBindings, mSomeVariants, mIsAutomaticEventsEnabled);

assertEquals(mDecideMessages.getNotification(false), unseenNotification);

Expand All @@ -158,7 +158,7 @@ public void testPops() {
final InAppNotification nullBeforeNotification = mDecideMessages.getNotification(false);
assertNull(nullBeforeNotification);

mDecideMessages.reportResults(mSomeNotifications, mSomeTriggeredNotifications, mSomeBindings, mSomeVariants, mIsAutomaticEventsEnabled, null);
mDecideMessages.reportResults(mSomeNotifications, mSomeTriggeredNotifications, mSomeBindings, mSomeVariants, mIsAutomaticEventsEnabled);

final InAppNotification n1 = mDecideMessages.getNotification(false);
assertEquals(mSomeNotifications.get(0), n1);
Expand All @@ -173,12 +173,12 @@ public void testPops() {
@Test
public void testListenerCalls() throws JSONException, BadDecideObjectException {
assertNull(mListenerCalls.peek());
mDecideMessages.reportResults(mSomeNotifications, mSomeTriggeredNotifications, mSomeBindings, mSomeVariants, mIsAutomaticEventsEnabled, null);
mDecideMessages.reportResults(mSomeNotifications, mSomeTriggeredNotifications, mSomeBindings, mSomeVariants, mIsAutomaticEventsEnabled);
assertEquals(mListenerCalls.poll(), "CALLED");
assertNull(mListenerCalls.peek());

// No new info means no new calls
mDecideMessages.reportResults(mSomeNotifications, mSomeTriggeredNotifications, mSomeBindings, mSomeVariants, mIsAutomaticEventsEnabled, null);
mDecideMessages.reportResults(mSomeNotifications, mSomeTriggeredNotifications, mSomeBindings, mSomeVariants, mIsAutomaticEventsEnabled);
assertNull(mListenerCalls.peek());

// New info means new calls
Expand All @@ -189,7 +189,7 @@ public void testListenerCalls() throws JSONException, BadDecideObjectException {
final List<InAppNotification> newNotifications = new ArrayList<InAppNotification>();
newNotifications.add(unseenNotification);

mDecideMessages.reportResults(newNotifications, mSomeTriggeredNotifications, mSomeBindings, mSomeVariants, mIsAutomaticEventsEnabled, null);
mDecideMessages.reportResults(newNotifications, mSomeTriggeredNotifications, mSomeBindings, mSomeVariants, mIsAutomaticEventsEnabled);
assertEquals(mListenerCalls.poll(), "CALLED");
assertNull(mListenerCalls.peek());
}
Expand Down
120 changes: 0 additions & 120 deletions src/main/java/com/mixpanel/android/mpmetrics/ConnectIntegrations.java

This file was deleted.

12 changes: 1 addition & 11 deletions src/main/java/com/mixpanel/android/mpmetrics/DecideChecker.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
private static final String EVENT_BINDINGS = "event_bindings";
private static final String VARIANTS = "variants";
private static final String AUTOMATIC_EVENTS = "automatic_events";
private static final String INTEGRATIONS = "integrations";

/* package */ static class Result {
public Result() {
Expand All @@ -60,7 +59,6 @@ public Result() {
public JSONArray eventBindings;
public JSONArray variants;
public boolean automaticEvents;
public JSONArray integrations;
}

public DecideChecker(final Context context, final MPConfig config) {
Expand All @@ -86,7 +84,7 @@ public void runDecideCheck(final String token, final RemoteService poster) throw
try {
final Result result = runDecideCheck(updates.getToken(), distinctId, poster);
if (result != null) {
updates.reportResults(result.notifications, result.eventTriggeredNotifications, result.eventBindings, result.variants, result.automaticEvents, result.integrations);
updates.reportResults(result.notifications, result.eventTriggeredNotifications, result.eventBindings, result.variants, result.automaticEvents);
}
} catch (final UnintelligibleMessageException e) {
MPLog.e(LOGTAG, e.getMessage(), e);
Expand Down Expand Up @@ -227,14 +225,6 @@ private static List<InAppNotification> parseInAppNotifications(JSONObject respon
}
}

if (response.has(INTEGRATIONS)) {
try {
ret.integrations = response.getJSONArray(INTEGRATIONS);
} catch (final JSONException e) {
MPLog.e(LOGTAG, "Mixpanel endpoint returned a non-array JSON for integrations: " + response);
}
}

return ret;
}

Expand Down
21 changes: 1 addition & 20 deletions src/main/java/com/mixpanel/android/mpmetrics/DecideMessages.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ public DecideMessages(Context context, String token, OnNewResultsListener listen
mNotificationIds = new HashSet<>(notificationIds);
mUnseenEventTriggeredNotifications = new LinkedList<>();
mVariants = null;
mIntegrations = new HashSet<String>();
}

public String getToken() {
Expand All @@ -56,8 +55,7 @@ public synchronized void reportResults(List<InAppNotification> newNotifications,
List<InAppNotification> newTriggeredNotifications,
JSONArray eventBindings,
JSONArray variants,
boolean automaticEvents,
JSONArray integrations) {
boolean automaticEvents) {
boolean newContent = false;
int newVariantsLength = variants.length();
boolean hasNewVariants = false;
Expand Down Expand Up @@ -127,21 +125,6 @@ public synchronized void reportResults(List<InAppNotification> newNotifications,
}
mAutomaticEventsEnabled = automaticEvents;

if (integrations != null) {
try {
HashSet<String> integrationsSet = new HashSet<String>();
for (int i = 0; i < integrations.length(); i++) {
integrationsSet.add(integrations.getString(i));
}
if (!mIntegrations.equals(integrationsSet)) {
mIntegrations = integrationsSet;
newContent = true;
}
} catch(JSONException e) {
MPLog.e(LOGTAG, "Got an integration id from " + integrations.toString() + " that wasn't an int", e);
}
}

MPLog.v(LOGTAG, "New Decide content has become available. " +
newNotifications.size() + " notifications and " +
variants.length() + " experiments have been added.");
Expand Down Expand Up @@ -205,7 +188,6 @@ public synchronized InAppNotification getNotification(AnalyticsMessages.EventDes
return null;
}

public synchronized Set<String> getIntegrations() { return mIntegrations; }

// if a notification was failed to show, add it back to the unseen list so that we
// won't lose it
Expand Down Expand Up @@ -248,7 +230,6 @@ public boolean shouldTrackAutomaticEvent() {
private static final Set<Integer> mLoadedVariants = new HashSet<>();
private Boolean mAutomaticEventsEnabled;
private Context mContext;
private Set<String> mIntegrations;

@SuppressWarnings("unused")
private static final String LOGTAG = "MixpanelAPI.DecideUpdts";
Expand Down
12 changes: 2 additions & 10 deletions src/main/java/com/mixpanel/android/mpmetrics/MPConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,7 @@
*
* <dt>com.mixpanel.android.MPConfig.NotificationChannelImportance</dt>
* <dd>An integer number. Importance of the notification channel (see https://developer.android.com/reference/android/app/NotificationManager.html). Defaults to 3 (IMPORTANCE_DEFAULT). Applicable only for Android 26 and above.</dd>
*
* <dt>com.mixpanel.android.MPConfig.BrazeIntegrationForceAlias</dt>
* <dd>A boolean value. If true, the library will alias both the braze device and external IDs (if available) to the current distinct_id when the library is initialized and the Braze integration is enabled. Defaults to false</dd>
*
* </dl>
*
*/
Expand Down Expand Up @@ -254,7 +252,7 @@ public synchronized void setOfflineMode(OfflineMode offlineMode) {
mUseIpAddressForGeolocation = metaData.getBoolean("com.mixpanel.android.MPConfig.UseIpAddressForGeolocation", true);
mTestMode = metaData.getBoolean("com.mixpanel.android.MPConfig.TestMode", false);
mNotificationChannelImportance = metaData.getInt("com.mixpanel.android.MPConfig.NotificationChannelImportance", 3); // NotificationManger.IMPORTANCE_DEFAULT
mBrazeIntegrationForceAlias = metaData.getBoolean("com.mixpanel.android.MPConfig.BrazeIntegrationForceAlias", false);


Object dataExpirationMetaData = metaData.get("com.mixpanel.android.MPConfig.DataExpiration");
long dataExpirationLong = 1000 * 60 * 60 * 24 * 5; // 5 days default
Expand Down Expand Up @@ -373,10 +371,6 @@ public boolean getTestMode() {
return mTestMode;
}

public boolean getBrazeIntegrationForceAlias() {
return mBrazeIntegrationForceAlias;
}

// Preferred URL for tracking events
public String getEventsEndpoint() {
return mEventsEndpoint;
Expand Down Expand Up @@ -583,7 +577,6 @@ public String toString() {
" NotificationChannelName: " + getNotificationChannelName() + "\n" +
" NotificationChannelImportance: " + getNotificationChannelImportance() + "\n" +
" FlushOnBackground: " + getFlushOnBackground() + "\n" +
" BrazeIntegrationForceAlias " + getBrazeIntegrationForceAlias() + "\n" +
" UseIpAddressForGeolocation: " + getUseIpAddressForGeolocation();
}

Expand Down Expand Up @@ -616,7 +609,6 @@ public String toString() {
private final int mNotificationChannelImportance;
private final String mNotificationChannelId;
private final String mNotificationChannelName;
private final boolean mBrazeIntegrationForceAlias;

// Mutable, with synchronized accessor and mutator
private SSLSocketFactory mSSLSocketFactory;
Expand Down
Loading