Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weโ€™ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

๐Ÿ”€ :: FCM ์•Œ๋ฆผ Push Type ๋ณ€๊ฒฝ #109

Merged
merged 6 commits into from
Apr 18, 2024
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class EnvironmentNotificationSendService(
deviceTokens = queryDeviceTokenPort.findAll().map { it.deviceToken },
notificationAlarm = NotificationAlarm(
title = NotificationType.ENVIRONMENT.title,
content = NotificationType.ENVIRONMENT.content,
body = NotificationType.ENVIRONMENT.body,
writer = "๋ฏธ์†Œ"
)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class InquiryNotificationSendService(
deviceToken = token,
notificationAlarm = NotificationAlarm(
title = notificationType.title,
content = notificationType.content,
body = notificationType.body,
writer = "๋ฏธ์†Œ"
)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ package andreas311.miso.domain.notification.domain

data class NotificationAlarm(
val title: String,
val content: String,
val body: String,
val writer: String
)
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,21 @@ package andreas311.miso.domain.notification.domain

enum class NotificationType(
val title: String,
val content: String
val body: String
) {

INQUIRY_WAIT(
title = "Miso ๋ฌธ์˜์‚ฌํ•ญ ๋“ฑ๋ก ์™„๋ฃŒ!",
content = "์ตœ๋Œ€ํ•œ ๋น ๋ฅด๊ฒŒ ๋‹ต๋ณ€ ๋“œ๋ฆดํ…Œ๋‹ˆ ๊ธฐ๋‹ค๋ ค์ฃผ์„ธ์š” :)"
body = "์ตœ๋Œ€ํ•œ ๋น ๋ฅด๊ฒŒ ๋‹ต๋ณ€ ๋“œ๋ฆดํ…Œ๋‹ˆ ๊ธฐ๋‹ค๋ ค์ฃผ์„ธ์š” :)"
),

INQUIRY_COMPLETE(
title = "Miso ๋ฌธ์˜์‚ฌํ•ญ ๋‹ต๋ณ€ ๋„์ฐฉ!",
content = "๋‚ด ๋ฌธ์˜ ๋‚ด์—ญ์—์„œ ๋‹ต๋ณ€์„ ํ™•์ธํ•ด์ฃผ์„ธ์š” :)"
body = "๋‚ด ๋ฌธ์˜ ๋‚ด์—ญ์—์„œ ๋‹ต๋ณ€์„ ํ™•์ธํ•ด์ฃผ์„ธ์š” :)"
),

ENVIRONMENT(
title = "์˜ค๋Š˜์˜ ํ™˜๊ฒฝ ์ง€์‹์„ ์•Œ๊ณ  ์‹ถ๋‹ค๋ฉด?",
content = "Miso ์—์„œ ์˜ค๋Š˜์˜ ํ™˜๊ฒฝ ์ง€์‹์„ ํ™•์ธํ•ด๋ณด์„ธ์š” :)"
body = "Miso ์—์„œ ์˜ค๋Š˜์˜ ํ™˜๊ฒฝ ์ง€์‹์„ ํ™•์ธํ•ด๋ณด์„ธ์š” :)"
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ class ProcessRecyclablesService(
private val webClient: WebClient,
private val queryRecyclablesPort: QueryRecyclablesPort
) : ProcessRecyclablesUseCase {

@Value("\${ai.url}")
private val url: String = ""

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import andreas311.miso.domain.notification.domain.NotificationAlarm
import com.google.firebase.messaging.FirebaseMessaging
import com.google.firebase.messaging.Message
import com.google.firebase.messaging.MulticastMessage
import com.google.firebase.messaging.Notification
import org.springframework.stereotype.Component

@Component
Expand All @@ -30,23 +29,14 @@ class FcmNotificationAdapter : FcmNotificationPort {
private fun getMassageBuilderByNotification(notificationAlarm: NotificationAlarm) =
with(notificationAlarm) {
Message.builder()
.setNotification(
Notification.builder()
.setTitle(title)
.setBody(content)
.build()
)
.putData("title", title)
.putData("body", body)
}

private fun getMulticastMassageBuilderByNotification(notificationAlarm: NotificationAlarm) =
with(notificationAlarm) {
MulticastMessage.builder()
.setNotification(
Notification.builder()
.setTitle(title)
.setBody(content)
.build()
)
.putData("title", title)
.putData("body", body)
}

}
Loading