Update README.md

This commit is contained in:
Salvatore Giordano
2020-04-10 17:11:19 +02:00
committed by GitHub
parent 86e4e142c0
commit 793ae5f93a
+25 -1
View File
@@ -216,7 +216,31 @@ Update the `AndroidManifest.xml` file to set the application class:
Make sure you have correctly configured your app to support push notifications, and that you have generated certificate/token for sending pushes.
To enable offline notification support on iOS a guide will be released soon on our website.
##### Offline support for push notifications
- open the XCode project
- create a new target of type `Notification service extension`
- add `App Groups` capability to the `Runner` target and the just created one
- add the line ` pod 'StreamChatClient', :git => 'https://github.com/GetStream/stream-chat-swift.git', :branch => 'release/2.0'` to the Podfile
- run `pod install`
- substitute the code in the `Notification service` with [this one](https://gist.github.com/imtoori/d37611faefef036e1a6c017b1a09e91f) and substitute APPGROUP with the just created one
- do the same with `AppDelegate.swift` using [this template](https://gist.github.com/imtoori/f95b30f25b745c5f777bfff1085176ef)
- set the notification template on your GetStream dashboard to be like this:
```handlebars
template = {
"aps" : {
"alert" : {
"title" : "{{ sender.name }} @ {{ channel.name }}",
"body" : "{{ message.text }}"
},
"badge": {{ unread_count }},
"apns-priority": 10,
"mutable-content" : 1
},
"message_id": "{{ message.id }}"
}
```
Of course you can change the `alert` object as you want. Just make sure it has the last three lines.
## Contributing