Skip to content

Commit

Permalink
#139 feat: 알림 수신 여부 체크 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
psyeon1120 committed Aug 26, 2023
1 parent 72218e7 commit acab8fd
Showing 1 changed file with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class NotificationService(
NotificationType.NEW_ORDER
))

if (orderReceiver.deviceToken != null) {
if (isPushNotiAvailable(orderReceiver)) {
val message: FcmMessage = notiAssembler.makeMessage(
orderReceiver.deviceToken!!,
productName,
Expand All @@ -67,7 +67,7 @@ class NotificationService(
NotificationType.CHANGED_ORDER_STATUS
))

if (orderer.deviceToken != null) {
if (isPushNotiAvailable(orderer)) {
val message: FcmMessage = notiAssembler.makeMessage(
orderer.deviceToken!!,
productName,
Expand All @@ -90,7 +90,7 @@ class NotificationService(
NotificationType.TWO_MONTH_ORDER
))

if (orderer.deviceToken != null) {
if (isPushNotiAvailable(orderer)) {
val message: FcmMessage = notiAssembler.makeMessage(
orderer.deviceToken!!,
productName,
Expand All @@ -102,6 +102,11 @@ class NotificationService(
}
}

// 알림 수신 상태 체크
fun isPushNotiAvailable(user: User): Boolean {
return user.deviceToken != null && user.notification
}

// firebase accessToken 발급
private fun getAccessToken(): String? {
val firebaseConfigPath = "firebase-service-key.json"
Expand Down

0 comments on commit acab8fd

Please sign in to comment.