-
Notifications
You must be signed in to change notification settings - Fork 8
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
[AN/USER] feat: fcm 푸시 알림 구현 (#522) #537
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
고생하셨습니다!
코멘트 몇개 달았습니다! 확인부탁드려요👍
val notificationManager = | ||
getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager | ||
val channel = NotificationChannel( | ||
FcmMessageType.ENTRY_ALERT.channelId, | ||
getString(R.string.entry_alert_channel_name), | ||
NotificationManager.IMPORTANCE_DEFAULT | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
val notificationManager = | |
getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager | |
val channel = NotificationChannel( | |
FcmMessageType.ENTRY_ALERT.channelId, | |
getString(R.string.entry_alert_channel_name), | |
NotificationManager.IMPORTANCE_DEFAULT | |
) | |
val channel = NotificationChannel( | |
FcmMessageType.ENTRY_ALERT.channelId, | |
getString(R.string.entry_alert_channel_name), | |
NotificationManager.IMPORTANCE_DEFAULT | |
) | |
val notificationManager = | |
getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager |
사용하기 직전에 꺼내오는 것이 어떨까요??
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
반영완료!
if (ActivityCompat.checkSelfPermission( | ||
context, | ||
android.Manifest.permission.POST_NOTIFICATIONS | ||
) == PackageManager.PERMISSION_GRANTED |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이부분도 PermissionUtil안에서 Activity.Compat.checkPermission
으로 빼내는 것이 어떨까요??
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
반영완료!
|
||
ENTRY_PROCESS.channelId -> { | ||
runBlocking { | ||
// TODO: 입장완료 로직인지 확인하는 로직 추가 필요 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ENTRY_PROCESS.channelId으로 입력받았을 때 이 TODO가 해결 됐다고 생각하는데 어떻게 보시나요??
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
주석 삭제했습니다
|
||
override fun onMessageReceived(remoteMessage: RemoteMessage) { | ||
when (remoteMessage.notification?.channelId) { | ||
ENTRY_ALERT.channelId -> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
processEntryAlert
나 handleEntryAlert
로 빼내는 것은 어떤가요??
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
반영완료!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
고생하셨습니다!👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
고생많으셨습니다! 코멘트 확인해주세요~
private val intent = HomeActivity.getIntent(context).apply { | ||
flags = Intent.FLAG_ACTIVITY_SINGLE_TOP or Intent.FLAG_ACTIVITY_CLEAR_TASK | ||
} | ||
|
||
private val pendingIntent = PendingIntent.getActivity( | ||
context, | ||
HOME_REQUEST_CODE, | ||
intent, | ||
PendingIntent.FLAG_IMMUTABLE or PendingIntent.FLAG_UPDATE_CURRENT | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
entryAlertNotificationBuilder 를 초기화하기 위해서만 필요한 것 같아요!
프로퍼티로 있는 이유가 있을까요?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
아까 논의한대로 프로퍼티로 가지고 있을 필요는 없지만 싱글톤으로 관리하기 위해서 이대로 둘게요!
|
||
class TicketEntryService : FirebaseMessagingService() { | ||
|
||
private val notificationManager by lazy { NotificationManager(this) } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Firebase Service 도 힐트로 주입할 수 있나요?
private val requestPermissionLauncher = registerForActivityResult( | ||
ActivityResultContracts.RequestPermission(), | ||
) { isGranted: Boolean -> | ||
if (!isGranted) { | ||
Toast.makeText( | ||
this, | ||
getString(R.string.home_notification_permission_denied), | ||
Toast.LENGTH_SHORT | ||
).show() | ||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이 부분도 함수로 분리할 수 있지 않을까요?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
함수로 분리해서 내부 프로퍼티 제거했습니다!
# Conflicts: # android/festago/app/src/main/java/com/festago/festago/presentation/ui/home/HomeActivity.kt
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
* feat: 공연 입장 푸시 알림 구현 * refactor: FcmMessageType 분리 * refactor: NotificationManager 분리 * refactor: application에서 채널 생성 * fix: 포그라운드 푸시 알림 버그 해결 * refactor: 알림 권한 거부 메시지 문자열 추출 * refactor: ktlintCheck * move: fcm 관련 파일 패키지 변경 * refactor: 알림 권한 메서드 분리 * refactor: ktlintcheck * refactor: notificationManager 코드 순서 변경 * refactor: 불필요한 주석 제거 * refactor: 메서드 분리 * refactor: 알림 권한 확인 메서드 분리 * refactor: 알림 권한 요청 메서드 분리 * refactor: ktlintcheck
* feat: 공연 입장 푸시 알림 구현 * refactor: FcmMessageType 분리 * refactor: NotificationManager 분리 * refactor: application에서 채널 생성 * fix: 포그라운드 푸시 알림 버그 해결 * refactor: 알림 권한 거부 메시지 문자열 추출 * refactor: ktlintCheck * move: fcm 관련 파일 패키지 변경 * refactor: 알림 권한 메서드 분리 * refactor: ktlintcheck * refactor: notificationManager 코드 순서 변경 * refactor: 불필요한 주석 제거 * refactor: 메서드 분리 * refactor: 알림 권한 확인 메서드 분리 * refactor: 알림 권한 요청 메서드 분리 * refactor: ktlintcheck
📌 관련 이슈
✨ PR 세부 내용