braze-inc / braze-segment-android Goto Github PK
View Code? Open in Web Editor NEWHome Page: https://www.braze.com
License: Other
Home Page: https://www.braze.com
License: Other
I think an SDK must reduce the dependencies with another dependencies. It is a good idea to avoid usage of RemoteMessage
in braze functions inside BrazeFirebaseMessagingService
. I mean is better to just pass what you are going to use.
In my case, I'm using this library as a component that belong to my background message layer. My problem is the way that you use a firebase model force me to include firebase in my Braze component.
fun isBrazePushNotification(remoteMessage: RemoteMessage): Boolean {
val remoteMessageData = remoteMessage.data
return "true" == remoteMessageData[Constants.BRAZE_PUSH_BRAZE_KEY]
}
๐ก Suggestion:
fun isBrazePushNotification(data: Map<String, String>): Boolean {
return "true" == data[Constants.BRAZE_PUSH_BRAZE_KEY]
}
fun handleBrazeRemoteMessage(context: Context, remoteMessage: RemoteMessage): Boolean {
if (!isBrazePushNotification(remoteMessage)) {
brazelog(I) { "Remote message did not originate from Braze. Not consuming remote message: $remoteMessage" }
return false
}
val remoteMessageData = remoteMessage.data
brazelog(I) { "Got remote message from FCM: $remoteMessageData" }
val pushIntent = Intent(BrazePushReceiver.FIREBASE_MESSAGING_SERVICE_ROUTING_ACTION)
val bundle = Bundle()
for ((key, value) in remoteMessageData) {
brazelog(V) { "Adding bundle item from FCM remote data with key: $key and value: $value" }
bundle.putString(key, value)
}
pushIntent.putExtras(bundle)
BrazePushReceiver.handleReceivedIntent(context, pushIntent)
return true
}
๐ก Suggestion:
fun handleBrazeRemoteMessage(context: Context, data: Map<String, String>): Boolean {
if (!isBrazePushNotification(data)) {
brazelog(I) { "Remote message did not originate from Braze. Not consuming remote message: $remoteMessage" }
return false
}
brazelog(I) { "Got remote message from FCM: $data" }
val pushIntent = Intent(BrazePushReceiver.FIREBASE_MESSAGING_SERVICE_ROUTING_ACTION)
val bundle = Bundle()
for ((key, value) in data) {
brazelog(V) { "Adding bundle item from FCM remote data with key: $key and value: $value" }
bundle.putString(key, value)
}
pushIntent.putExtras(bundle)
BrazePushReceiver.handleReceivedIntent(context, pushIntent)
return true
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.