Skip to content

Commit b9c71a7

Browse files
fix: Correct ApnsConfig liveActivityToken JSON key
Corrects the `@Key` annotation for the `liveActivityToken` field in `ApnsConfig.java` from "live-activity-token" to "live_activity_token" to follow snake_case convention for JSON mapping. Unit tests in `MessageTest.java` have been updated to reflect this change in the expected JSON output.
1 parent a125f6c commit b9c71a7

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/main/java/com/google/firebase/messaging/ApnsConfig.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public class ApnsConfig {
4141
@Key("fcm_options")
4242
private final ApnsFcmOptions fcmOptions;
4343

44-
@Key("live-activity-token")
44+
@Key("live_activity_token")
4545
private final String liveActivityToken;
4646

4747
private ApnsConfig(Builder builder) {

src/test/java/com/google/firebase/messaging/MessageTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,7 @@ public void testApnsMessageWithPayload() throws IOException {
425425
Map<String, Object> data = ImmutableMap.<String, Object>builder()
426426
.put("headers", ImmutableMap.of("k1", "v1", "k2", "v2", "k3", "v3"))
427427
.put("payload", payload)
428-
.put("live-activity-token", "test-live-activity-token")
428+
.put("live_activity_token", "test-live-activity-token")
429429
.build();
430430
assertJsonEquals(ImmutableMap.of("topic", "test-topic", "apns", data), message);
431431
}
@@ -464,7 +464,7 @@ public void testApnsMessageWithPayloadAndAps() throws IOException {
464464
"topic", "test-topic",
465465
"apns", ImmutableMap.<String, Object>builder()
466466
.put("payload", payload)
467-
.put("live-activity-token", "test-live-activity-token-aps")
467+
.put("live_activity_token", "test-live-activity-token-aps")
468468
.build()),
469469
message);
470470

@@ -844,7 +844,7 @@ public void testImageInApnsNotification() throws IOException {
844844
ImmutableMap.<String, Object>builder()
845845
.put("fcm_options", ImmutableMap.of("image", TEST_IMAGE_URL_APNS))
846846
.put("payload", ImmutableMap.of("aps", ImmutableMap.of()))
847-
.put("live-activity-token", "test-live-activity-token-image")
847+
.put("live_activity_token", "test-live-activity-token-image")
848848
.build();
849849
ImmutableMap<String, Object> expected =
850850
ImmutableMap.<String, Object>builder()
@@ -865,7 +865,7 @@ public void testApnsMessageWithOnlyLiveActivityToken() throws IOException {
865865
.setTopic("test-topic")
866866
.build();
867867
Map<String, Object> expectedApns = ImmutableMap.<String, Object>builder()
868-
.put("live-activity-token", "only-live-activity")
868+
.put("live_activity_token", "only-live-activity")
869869
.put("payload", ImmutableMap.of("aps", ImmutableMap.of()))
870870
.build();
871871
assertJsonEquals(ImmutableMap.of("topic", "test-topic", "apns", expectedApns), message);

0 commit comments

Comments
 (0)