# Push Notifications
```mermaid
sequenceDiagram
participant EU as End User
participant I as Issuer
participant V as Verifier
participant M as Mediator
participant H as Mobile App (holder)
participant PNG as Push Notification Gateway (Firebase)
participant PNS as Push Notification Service (OS)
H -->> M: Connects
rect rgb(255, 165, 0)
M -->>+ EU: Proactive Disclosure Screen
end
M -->> EU: Request Permission to Send/receive Notifications
EU -->>-M: Accept/Reject
rect rgb(255, 165, 0)
H -->>+ M: Send: Enable Push Notification (title, message, lang)
M -->>- H: Send: Enable Push Notification Response()
end
rect rgb(255, 165, 0)
H -->>+ M: Support Push Notification feature?
M -->>- H: Yes/No
end
M -->> M: Generate Firebase Token()
Note right of M: in iOS, Missing enable push notification capability at build time
H -->>+ M: Send: Set Device Info (Firebase Generated Token)
M -->>- H: Send: Set Device Info Response()
alt Message from Issuer
I -->>M: Send DIComm Message
else Message from Verifier
V -->>M: Send DIComm Message
end
M -->>M: Check if connection keys has push notification enabled
M -->>M: Has a message been sent recently (5min)?
M -->>PNG: Send Push Notification (title, message)
PNG -->>M: Accepted? Yes/No
rect rgb(255, 165, 0)
H -->>+ M: Send: Disable Push Notification (title, message, lang)
M -->>- H: Send: Disable Push Notification Response()
end
PNS --> M: Send Notification
M --> M: Process Notification (as Background or Foreground)
alt if background
M -->>M: Emit OS push notificaiton
EU -->> M: Open Notification
M -->> M: Open the Wallet
rect rgb(255, 165, 0)
M -->> M: Go to home scrreen
end
else if foreground
M -->>M: Do Nothing
Note right of M: What if user is NOT in the home screen?
end
```
## References
- https://github.com/hyperledger/aries-rfcs/blob/main/features/0699-push-notifications-apns/README.md
- https://github.com/hyperledger/aries-mediator-service/pull/93
- https://github.com/bcgov/bc-wallet-mobile/pull/1389
- https://github.com/hyperledger/aries-mobile-agent-react-native/pull/924
-