From e69dcb05140bc28ef018d559d925ba1f0539d27e Mon Sep 17 00:00:00 2001 From: Akanksha Jaiswal <91569909+akankshaJaiswal8@users.noreply.github.com> Date: Mon, 21 Oct 2024 10:23:14 -0700 Subject: [PATCH] feat(fcm): enable direct_boot_ok as bool in Android config (#638) * enable direct boot ok in Android config * remove .idea --- messaging/messaging.go | 1 + messaging/messaging_test.go | 29 +++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/messaging/messaging.go b/messaging/messaging.go index 858e75ff..2b362db8 100644 --- a/messaging/messaging.go +++ b/messaging/messaging.go @@ -121,6 +121,7 @@ type AndroidConfig struct { Data map[string]string `json:"data,omitempty"` // if specified, overrides the Data field on Message type Notification *AndroidNotification `json:"notification,omitempty"` FCMOptions *AndroidFCMOptions `json:"fcm_options,omitempty"` + DirectBootOk bool `json:"direct_boot_ok,omitempty"` } // MarshalJSON marshals an AndroidConfig into JSON (for internal use only). diff --git a/messaging/messaging_test.go b/messaging/messaging_test.go index 388154b0..0603b6c0 100644 --- a/messaging/messaging_test.go +++ b/messaging/messaging_test.go @@ -144,6 +144,35 @@ var validMessages = []struct { "topic": "test-topic", }, }, + { + name: "AndroidDataMessage", + req: &Message{ + Android: &AndroidConfig{ + DirectBootOk: true, + CollapseKey: "ck", + Data: map[string]string{ + "k1": "v1", + "k2": "v2", + }, + Priority: "normal", + TTL: &ttl, + }, + Topic: "test-topic", + }, + want: map[string]interface{}{ + "android": map[string]interface{}{ + "direct_boot_ok": true, + "collapse_key": "ck", + "data": map[string]interface{}{ + "k1": "v1", + "k2": "v2", + }, + "priority": "normal", + "ttl": "10s", + }, + "topic": "test-topic", + }, + }, { name: "AndroidNotificationMessage", req: &Message{