Skip to content

Commit e69dcb0

Browse files
feat(fcm): enable direct_boot_ok as bool in Android config (firebase#638)
* enable direct boot ok in Android config * remove .idea
1 parent 911c7e8 commit e69dcb0

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

‎messaging/messaging.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ type AndroidConfig struct {
121121
Data map[string]string `json:"data,omitempty"` // if specified, overrides the Data field on Message type
122122
Notification *AndroidNotification `json:"notification,omitempty"`
123123
FCMOptions *AndroidFCMOptions `json:"fcm_options,omitempty"`
124+
DirectBootOk bool `json:"direct_boot_ok,omitempty"`
124125
}
125126

126127
// MarshalJSON marshals an AndroidConfig into JSON (for internal use only).

‎messaging/messaging_test.go

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,35 @@ var validMessages = []struct {
144144
"topic": "test-topic",
145145
},
146146
},
147+
{
148+
name: "AndroidDataMessage",
149+
req: &Message{
150+
Android: &AndroidConfig{
151+
DirectBootOk: true,
152+
CollapseKey: "ck",
153+
Data: map[string]string{
154+
"k1": "v1",
155+
"k2": "v2",
156+
},
157+
Priority: "normal",
158+
TTL: &ttl,
159+
},
160+
Topic: "test-topic",
161+
},
162+
want: map[string]interface{}{
163+
"android": map[string]interface{}{
164+
"direct_boot_ok": true,
165+
"collapse_key": "ck",
166+
"data": map[string]interface{}{
167+
"k1": "v1",
168+
"k2": "v2",
169+
},
170+
"priority": "normal",
171+
"ttl": "10s",
172+
},
173+
"topic": "test-topic",
174+
},
175+
},
147176
{
148177
name: "AndroidNotificationMessage",
149178
req: &Message{

0 commit comments

Comments
 (0)