7
7
class Notification extends Message
8
8
{
9
9
private $ title ;
10
+ private $ subtitle ;
10
11
private $ body ;
11
12
private $ badge ;
12
13
private $ icon ;
13
14
private $ color ;
14
15
private $ sound ;
15
16
private $ clickAction ;
16
17
private $ tag ;
18
+ private $ contentAvailable ;
19
+ private $ bodyLocKey ;
20
+ private $ bodyLocArgs ;
21
+ private $ titleLocKey ;
22
+ private $ titleLocArgs ;
23
+ private $ androidChannelId ;
17
24
18
25
public function __construct ($ title = '' , $ body = '' )
19
26
{
@@ -90,14 +97,72 @@ public function setTag($tag)
90
97
return $ this ;
91
98
}
92
99
100
+ public function setContentAvailable ($ contentAvailable )
101
+ {
102
+ $ this ->contentAvailable = $ contentAvailable ;
103
+ return $ this ;
104
+ }
105
+
106
+ public function setSubtitle ($ subtitle )
107
+ {
108
+ $ this ->subtitle = $ subtitle ;
109
+ return $ this ;
110
+ }
111
+
112
+ public function setBodyLocKey ($ bodyLocKey )
113
+ {
114
+ $ this ->bodyLocKey = $ bodyLocKey ;
115
+ return $ this ;
116
+ }
117
+
118
+ public function setBodyLocArgs ($ bodyLocArgs )
119
+ {
120
+ $ this ->bodyLocArgs = $ bodyLocArgs ;
121
+ return $ this ;
122
+ }
123
+
124
+ public function setTitleLocKey ($ titleLocKey )
125
+ {
126
+ $ this ->titleLocKey = $ titleLocKey ;
127
+ return $ this ;
128
+ }
129
+
130
+ public function setTitleLocArgs ($ titleLocArgs )
131
+ {
132
+ $ this ->titleLocArgs = $ titleLocArgs ;
133
+ return $ this ;
134
+ }
135
+
136
+ public function setAndroidChannelId ($ androidChannelId )
137
+ {
138
+ $ this ->androidChannelId = $ androidChannelId ;
139
+ return $ this ;
140
+ }
141
+
93
142
public function hasNotificationData ()
94
143
{
95
- return $ this ->title || $ this ->body || $ this ->badge || $ this ->icon || $ this ->clickAction || $ this ->sound || $ this ->tag ;
144
+ return
145
+ $ this ->title ||
146
+ $ this ->body ||
147
+ $ this ->badge ||
148
+ $ this ->icon ||
149
+ $ this ->clickAction ||
150
+ $ this ->sound ||
151
+ $ this ->tag ||
152
+ $ this ->contentAvailable ||
153
+ $ this ->subtitle ||
154
+ $ this ->titleLocKey ||
155
+ $ this ->titleLocArgs ||
156
+ $ this ->bodyLocKey ||
157
+ $ this ->bodyLocArgs ||
158
+ $ this ->androidChannelId
159
+ ;
96
160
}
97
161
98
162
public function jsonSerialize ()
99
163
{
100
164
$ jsonData = [];
165
+
101
166
if ($ this ->title ) {
102
167
$ jsonData ['title ' ] = $ this ->title ;
103
168
}
@@ -122,6 +187,28 @@ public function jsonSerialize()
122
187
if ($ this ->tag ) {
123
188
$ jsonData ['tag ' ] = $ this ->tag ;
124
189
}
190
+ if ($ this ->contentAvailable ) {
191
+ $ jsonData ['content_available ' ] = $ this ->contentAvailable ;
192
+ }
193
+ if ($ this ->subtitle ) {
194
+ $ jsonData ['subtitle ' ] = $ this ->subtitle ;
195
+ }
196
+ if ($ this ->androidChannelId ) {
197
+ $ jsonData ['android_channel_id ' ] = $ this ->androidChannelId ;
198
+ }
199
+ if ($ this ->titleLocKey ) {
200
+ $ jsonData ['title_loc_key ' ] = $ this ->titleLocKey ;
201
+ }
202
+ if ($ this ->titleLocArgs ) {
203
+ $ jsonData ['title_loc_args ' ] = $ this ->titleLocArgs ;
204
+ }
205
+ if ($ this ->bodyLocKey ) {
206
+ $ jsonData ['body_loc_key ' ] = $ this ->bodyLocKey ;
207
+ }
208
+ if ($ this ->bodyLocArgs ) {
209
+ $ jsonData ['body_loc_args ' ] = $ this ->bodyLocArgs ;
210
+ }
211
+
125
212
return $ jsonData ;
126
213
}
127
214
}
0 commit comments