Commit e26e797b authored by Vladislav Bogdashkin's avatar Vladislav Bogdashkin 🎣

fix noty type

parent fa3948b2
package com.biganto.visual.roompark.data
import com.biganto.visual.roompark.base.RoomParkApplication
import com.biganto.visual.roompark.data.service.notification.INotificationCenter
import com.google.firebase.messaging.FirebaseMessagingService
import com.google.firebase.messaging.RemoteMessage
......@@ -12,6 +13,11 @@ class RoomParkMessageService : FirebaseMessagingService() {
@Inject
lateinit var notyCenter: INotificationCenter
init {
notyCenter = RoomParkApplication.component.provideNotifivations()
}
override fun onNewToken(p0: String) {
super.onNewToken(p0)
Timber.d("NEW TOKEN REGISTERED: ${p0}")
......@@ -24,7 +30,7 @@ class RoomParkMessageService : FirebaseMessagingService() {
// Check if message contains a data payload.
if (remoteMessage.data.size > 0) {
Timber.d("Message data payload: %s", remoteMessage.data)
notyCenter.showPushNotifyMessage(remoteMessage.notification?.body?:"Уведомление")
if ( /* Check if data needs to be processed by long running job */true) { // For long-running tasks (10 seconds or more) use Firebase Job Dispatcher.
// scheduleJob()
} else { // Handle message within 10 seconds
......@@ -33,7 +39,8 @@ class RoomParkMessageService : FirebaseMessagingService() {
}
// Check if message contains a notification payload.
if (remoteMessage.notification != null) {
Timber.d("Message Notification Body: %s", remoteMessage.notification!!.body)
Timber.d("Message Notification Body: %s", remoteMessage.notification?.body)
notyCenter.showPushNotifyMessage(remoteMessage.notification?.body?:"Уведомление")
}
// Also if you intend on generating your own notifications as a result of a received FCM
// message, here is where that should be initiated. See sendNotification method below.
......
......@@ -131,12 +131,28 @@ class NotificationCenter @Inject constructor(val context: Application) : INotif
override fun showPushNotifyMessage(message: String){
val pendingIntent = PendingIntent.getActivity(context
, PENDING_REQUEST_CODE
, toDownloadsIntent
, PendingIntent.FLAG_ONE_SHOT
)
val noty = pushNotyBuilder
.setContentTitle(context.getString(R.string.notification_content_title))//getString(R.string.app_name))
.setPriority(NotificationCompat.PRIORITY_HIGH)
.setSmallIcon(R.mipmap.ic_launcher)
.setContentText(message)
.setColor(notificationSystemColor)
.setContentTitle(context.getString(R.string.notification_content_title))
.setContentIntent(pendingIntent)
.setContentText(message)
.setStyle(NotificationCompat.BigTextStyle()
.setBigContentTitle(context.getString(R.string.notification_content_title))
.bigText(
message
))
.setAutoCancel(true)
.build()
actualNotifyManager.notify(
......@@ -168,7 +184,7 @@ class NotificationCenter @Inject constructor(val context: Application) : INotif
.setColor(notificationSystemColor)
.setLargeIcon(icon)
.setContentIntent(pendingIntent)
.setAutoCancel(false)
.setAutoCancel(true)
.build()
actualNotifyManager.notify(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment