Skip to content

Commit

Permalink
release: SDK 2.1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
arnaud-roland committed Dec 10, 2024
1 parent 8f829be commit ad82723
Show file tree
Hide file tree
Showing 8 changed files with 11,790 additions and 16 deletions.
4 changes: 2 additions & 2 deletions Sources/buildSrc/src/main/java/Consts.kt
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ object ProjectConsts {
}

object SDKConsts {
const val VERSION = "2.1.0"
const val API_LEVEL = 210
const val VERSION = "2.1.1"
const val API_LEVEL = 211
const val MESSAGING_API_LEVEL = 12

const val MIN_SDK = 21
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,6 @@ public JSONObject getArgs() {
}

public boolean isDismissAction() {
return action == null;
return action == null || "batch.dismiss".equals(action);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -695,16 +695,15 @@ private InboxNotificationContentInternal parseNotification(Cursor cursor) {
identifiers
);

c.body = payload.reallyOptString(Batch.Push.BODY_KEY, null);
c.title = payload.reallyOptString(Batch.Push.TITLE_KEY, null);
String title = cursor.getString(cursor.getColumnIndexOrThrow(InboxDatabaseHelper.COLUMN_TITLE));
String body = cursor.getString(cursor.getColumnIndexOrThrow(InboxDatabaseHelper.COLUMN_BODY));
c.title = title.isEmpty() ? null : title;
c.body = body.isEmpty() ? null : body;
c.isUnread = cursor.getInt(cursor.getColumnIndexOrThrow(InboxDatabaseHelper.COLUMN_UNREAD)) != 0;

return c;
} catch (JSONException e) {
Logger.internal(TAG, "Could not parse notification from DB", e);
}

// JSON IN DB IS INVALID -- TODO DELETE LINE
return null;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,14 +156,7 @@ protected static InboxNotificationContentInternal parseNotification(JSONObject j
// If so we're probably doing useless work
final Map<String, String> convertedPayload = new HashMap<>();
for (String payloadKey : payload.keySet()) {
try {
convertedPayload.put(payloadKey, payload.getString(payloadKey));
} catch (JSONException ignored) {
Logger.internal(
TAG,
"Could not coalesce payload value to string for key \"" + payloadKey + "\". Ignoring."
);
}
convertedPayload.put(payloadKey, payload.reallyOptString(payloadKey, null));
}

final NotificationIdentifiers identifiers = new NotificationIdentifiers(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,8 @@ public void testGetNotifications() {
);
assertEquals(2, notifications.size());
assertEquals("test-id", notifications.get(0).identifiers.identifier);
assertEquals("test title", notifications.get(0).title);
assertEquals("test body", notifications.get(0).body);
assertEquals("test-id-2", notifications.get(1).identifiers.identifier);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
package com.batch.android.messaging.model;

import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;

import androidx.test.ext.junit.runners.AndroidJUnit4;
import androidx.test.filters.MediumTest;
import com.batch.android.BatchMessageAction;
import com.batch.android.di.DITest;
import com.batch.android.json.JSONException;
import com.batch.android.json.JSONObject;
import org.junit.Test;
import org.junit.runner.RunWith;

@RunWith(AndroidJUnit4.class)
@MediumTest
public class BatchMessageActionTest extends DITest {

@Test
public void testIsDismissibleAction() throws JSONException {
Action isCallback = new Action("callback", new JSONObject());
BatchMessageAction isCallbackAction = new BatchMessageAction(isCallback);

Action isDismissibleActionWithNil = new Action(null, new JSONObject());
BatchMessageAction isDismissibleActionWithNilAction = new BatchMessageAction(isDismissibleActionWithNil);

Action isDismissibleActionWithDismiss = new Action("batch.dismiss", new JSONObject());
BatchMessageAction isDismissibleActionWithDismissAction = new BatchMessageAction(
isDismissibleActionWithDismiss
);

assertFalse("Should not be a dismissible action because it is a callback", isCallback.isDismissAction());
assertFalse("Should not be a dismissible action because it is a callback", isCallbackAction.isDismissAction());

assertTrue(
"Should be a dismissible action because it is a null action",
isDismissibleActionWithNil.isDismissAction()
);
assertTrue(
"Should be a dismissible action because it is a null action",
isDismissibleActionWithNilAction.isDismissAction()
);
assertTrue(
"Should be a dismissible action because it is Batch dismiss action",
isDismissibleActionWithDismiss.isDismissAction()
);
assertTrue(
"Should be a dismissible action because it is Batch dismiss action",
isDismissibleActionWithDismissAction.isDismissAction()
);
}
}
1 change: 1 addition & 0 deletions proguard-mappings/2.1.1/checksum.sha
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
908e111c033e92d786a3c6b8b785553d50f91875 public-sdk/Batch.aar
Loading

0 comments on commit ad82723

Please sign in to comment.