Skip to content

Commit ad82723

Browse files
committed
release: SDK 2.1.1
1 parent 8f829be commit ad82723

File tree

8 files changed

+11790
-16
lines changed

8 files changed

+11790
-16
lines changed

Sources/buildSrc/src/main/java/Consts.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ object ProjectConsts {
1111
}
1212

1313
object SDKConsts {
14-
const val VERSION = "2.1.0"
15-
const val API_LEVEL = 210
14+
const val VERSION = "2.1.1"
15+
const val API_LEVEL = 211
1616
const val MESSAGING_API_LEVEL = 12
1717

1818
const val MIN_SDK = 21

Sources/sdk/src/main/java/com/batch/android/BatchMessageAction.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,6 @@ public JSONObject getArgs() {
4343
}
4444

4545
public boolean isDismissAction() {
46-
return action == null;
46+
return action == null || "batch.dismiss".equals(action);
4747
}
4848
}

Sources/sdk/src/main/java/com/batch/android/inbox/InboxDatasource.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -695,16 +695,15 @@ private InboxNotificationContentInternal parseNotification(Cursor cursor) {
695695
identifiers
696696
);
697697

698-
c.body = payload.reallyOptString(Batch.Push.BODY_KEY, null);
699-
c.title = payload.reallyOptString(Batch.Push.TITLE_KEY, null);
698+
String title = cursor.getString(cursor.getColumnIndexOrThrow(InboxDatabaseHelper.COLUMN_TITLE));
699+
String body = cursor.getString(cursor.getColumnIndexOrThrow(InboxDatabaseHelper.COLUMN_BODY));
700+
c.title = title.isEmpty() ? null : title;
701+
c.body = body.isEmpty() ? null : body;
700702
c.isUnread = cursor.getInt(cursor.getColumnIndexOrThrow(InboxDatabaseHelper.COLUMN_UNREAD)) != 0;
701-
702703
return c;
703704
} catch (JSONException e) {
704705
Logger.internal(TAG, "Could not parse notification from DB", e);
705706
}
706-
707-
// JSON IN DB IS INVALID -- TODO DELETE LINE
708707
return null;
709708
}
710709

Sources/sdk/src/main/java/com/batch/android/inbox/InboxFetchWebserviceClient.java

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -156,14 +156,7 @@ protected static InboxNotificationContentInternal parseNotification(JSONObject j
156156
// If so we're probably doing useless work
157157
final Map<String, String> convertedPayload = new HashMap<>();
158158
for (String payloadKey : payload.keySet()) {
159-
try {
160-
convertedPayload.put(payloadKey, payload.getString(payloadKey));
161-
} catch (JSONException ignored) {
162-
Logger.internal(
163-
TAG,
164-
"Could not coalesce payload value to string for key \"" + payloadKey + "\". Ignoring."
165-
);
166-
}
159+
convertedPayload.put(payloadKey, payload.reallyOptString(payloadKey, null));
167160
}
168161

169162
final NotificationIdentifiers identifiers = new NotificationIdentifiers(

Sources/sdk/src/test/java/com/batch/android/inbox/DatasourceTest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,8 @@ public void testGetNotifications() {
192192
);
193193
assertEquals(2, notifications.size());
194194
assertEquals("test-id", notifications.get(0).identifiers.identifier);
195+
assertEquals("test title", notifications.get(0).title);
196+
assertEquals("test body", notifications.get(0).body);
195197
assertEquals("test-id-2", notifications.get(1).identifiers.identifier);
196198
}
197199

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
package com.batch.android.messaging.model;
2+
3+
import static org.junit.Assert.assertFalse;
4+
import static org.junit.Assert.assertTrue;
5+
6+
import androidx.test.ext.junit.runners.AndroidJUnit4;
7+
import androidx.test.filters.MediumTest;
8+
import com.batch.android.BatchMessageAction;
9+
import com.batch.android.di.DITest;
10+
import com.batch.android.json.JSONException;
11+
import com.batch.android.json.JSONObject;
12+
import org.junit.Test;
13+
import org.junit.runner.RunWith;
14+
15+
@RunWith(AndroidJUnit4.class)
16+
@MediumTest
17+
public class BatchMessageActionTest extends DITest {
18+
19+
@Test
20+
public void testIsDismissibleAction() throws JSONException {
21+
Action isCallback = new Action("callback", new JSONObject());
22+
BatchMessageAction isCallbackAction = new BatchMessageAction(isCallback);
23+
24+
Action isDismissibleActionWithNil = new Action(null, new JSONObject());
25+
BatchMessageAction isDismissibleActionWithNilAction = new BatchMessageAction(isDismissibleActionWithNil);
26+
27+
Action isDismissibleActionWithDismiss = new Action("batch.dismiss", new JSONObject());
28+
BatchMessageAction isDismissibleActionWithDismissAction = new BatchMessageAction(
29+
isDismissibleActionWithDismiss
30+
);
31+
32+
assertFalse("Should not be a dismissible action because it is a callback", isCallback.isDismissAction());
33+
assertFalse("Should not be a dismissible action because it is a callback", isCallbackAction.isDismissAction());
34+
35+
assertTrue(
36+
"Should be a dismissible action because it is a null action",
37+
isDismissibleActionWithNil.isDismissAction()
38+
);
39+
assertTrue(
40+
"Should be a dismissible action because it is a null action",
41+
isDismissibleActionWithNilAction.isDismissAction()
42+
);
43+
assertTrue(
44+
"Should be a dismissible action because it is Batch dismiss action",
45+
isDismissibleActionWithDismiss.isDismissAction()
46+
);
47+
assertTrue(
48+
"Should be a dismissible action because it is Batch dismiss action",
49+
isDismissibleActionWithDismissAction.isDismissAction()
50+
);
51+
}
52+
}

proguard-mappings/2.1.1/checksum.sha

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
908e111c033e92d786a3c6b8b785553d50f91875 public-sdk/Batch.aar

0 commit comments

Comments
 (0)