@@ -147,8 +147,27 @@ class InputComponent extends React.Component {
147147 notification . collapseId = collapseId
148148 }
149149
150+ // New iOS 13+ mandatory header, `apns-push-type`. Can be either `alert` or `background`.
151+ // The value of this header must accurately reflect the contents of the notification's payload.
152+ // More here: https://github.com/node-apn/node-apn/pull/656/commits/cd44a3e2604eebdd5db04235daf035cf353f544a
153+ notification . pushType = "alert"
154+
150155 try {
151- notification . rawPayload = JSON . parse ( input . message )
156+ const json = JSON . parse ( input . message )
157+ notification . rawPayload = json
158+
159+ // If `content-available` equals 1 and `aps` dictionary doesn't contain any other keys, the notification is silent.
160+ // `apns-push-type` must be set to `background` for iOS 13+.
161+ const aps = json [ "aps" ]
162+ if ( aps && aps [ "content-available" ] === 1 ) {
163+ let size = 0 , key
164+ for ( key in aps ) {
165+ size ++
166+ }
167+ if ( size === 1 ) {
168+ notification . pushType = "background"
169+ }
170+ }
152171 } catch ( e ) {
153172 this . props . updateOutput ( {
154173 loading : false ,
@@ -162,6 +181,11 @@ class InputComponent extends React.Component {
162181 // provider
163182 const provider = new APN . Provider ( options )
164183
184+ this . props . updateOutput ( {
185+ loading : true ,
186+ text : "Sending " . concat ( notification . pushType , " notification" )
187+ } )
188+
165189 provider . send ( notification , input . deviceToken ) . then ( ( result ) => {
166190 if ( result . failed . length > 0 ) {
167191 this . props . updateOutput ( {
0 commit comments