Skip to content

Commit

Permalink
[MERGE] : #166 -> �main
Browse files Browse the repository at this point in the history
[�FIX/#166] 푸시알림 동작 방식 변경
  • Loading branch information
kkk5474096 authored Feb 16, 2024
2 parents 1ef82be + 424c805 commit f1673a6
Showing 1 changed file with 15 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,28 +54,25 @@ class TeumMessagingService : FirebaseMessagingService() {
}
}

override fun onMessageReceived(message: RemoteMessage) {
super.onMessageReceived(message)
override fun handleIntent(intent: Intent?) {
super.handleIntent(intent)

if (dataStore.onNotification) {
if (dataStore.isLogin) {
val alertMessage = Message("", "", "")
if (message.data.isNotEmpty()) {
alertMessage.title = message.notification?.title.toString()
alertMessage.body = message.notification?.body.toString()
alertMessage.type = message.data["type"].toString()
intent?.let {
val alertMessage = Message("", "", "")
alertMessage.title = intent.getStringExtra("title").toString()
alertMessage.body = intent.getStringExtra("body").toString()
alertMessage.type = intent.getStringExtra("type").toString()
if (alertMessage.type == END_MEETING) {
alertMessage.meetingId = intent.getStringExtra("meetingId")?.toLong()
alertMessage.participants =
intent.getStringExtra("participants")?.split(",")?.map { it.toInt() }
val userId = userRepository.getUserInfo()?.id?.toInt()
if (alertMessage.participants?.contains(userId) == true && alertMessage.participants?.size!! > 2)
sendNotificationAlarm(alertMessage)
} else if (alertMessage.title.isNotEmpty()) sendNotificationAlarm(alertMessage)
}
if (alertMessage.type == END_MEETING) {
alertMessage.meetingId = message.data["meetingId"]?.toLong()
// Timber.tag("teum-alerts").d("data: ${message.data}")
// Timber.tag("teum-alerts").d("participants string: ${message.data["participants"]?.split(",").toString()}")
// Timber.tag("teum-alerts").d("participants size: ${message.data["participants"]?.split(",")?.size}")
alertMessage.participants = message.data["participants"]?.split(",")?.map { it.toInt() }
val userId = userRepository.getUserInfo()?.id?.toInt()
if (alertMessage.participants?.contains(userId) == true && alertMessage.participants?.size!! > 2)
sendNotificationAlarm(alertMessage)
}
else if (alertMessage.title.isNotEmpty()) sendNotificationAlarm(alertMessage)
}
}
}
Expand Down

0 comments on commit f1673a6

Please sign in to comment.