In 4.9.0
we made the decision to split the Firebase related code into a separate pod. The reason for this is that the Firebase we want to start slowly tranistioning the project over to Swift and the Firebase dependencies can't be included in dynamic libraries.
Going forward we will have the following libraries:
ChatSDK
- Dynamic library which contains core components and UI
ChatSDKFirebase
- Static library which contains Firebase network adapter and dependencies
ChatSDKSwift
- As we rewrite the project in Swift, code will be moved to this pod
To make your project compatible with 4.9.0
you will need to do the following:
Update your Podfile
:
pod ChatSDK/FirebaseAdapter
becomes pod ChatSDKFirebase/Adapter
pod ChatSDK/FirebasePush
becomes pod ChatSDKFirebase/Push
pod ChatSDK/FirebaseFileStorage
becomes pod ChatSDKFirebase/FileStorage
pod ChatSDK/FirebaseSocialLogin
becomes pod ChatSDKFirebase/SocialLogin
All Firebase pods have been moved to the new ChatSDKFirebase
pod.
Imports:
#import <ChatSDK/FirebaseNetworkAdapther.h>
becomes #import <ChatSDKFirebase/FirebaseNetworkAdapter.h>
Any Firebase imports should be updated to reflect the fact that they are now in the ChatSDKFirebase
module.
We have improved the way that push notifications are handled. To keep using the legacy system, you will need to set:
config.clientPushEnabled = true
During the configuration stage. Otherwise, you should do the following:
To handle push notifications, we use Firebase Cloud Functions. This service allows you to upload a script to Firebase hosting. This script monitors the realtime database and whenever a new messsage is detected, it sends a push notification to the recipient.
Below is a summary of the steps that are required to setup push using the FCF script. For further instructions you can look at the Firebase Documentation.
- Run
firebase login
and login using the browser - Make a new directory to store your push functions in. It can be called anything
- Navigate to that directory using the terminal
- Run
firebase init functions
- Choose the correct app from the list
- Choose
JavaScript
- Choose
y
for ESLint - Choose
Y
to install node dependencies - Find the
functions
directory you've just created and copy theindex.js
file from Github into the directory - Run
firebase deploy --only functions:pushListener
Now the script is active and push notifications will be set out automatically.