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

알림함에서 강의상세 진입 시 강의평 조회실패 수정 #390

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ fun InstallInAppDeeplinkExecutor() {

homePageLectureDetailViewModel.initializeEditingLectureDetail(
lectureToShow,
ModeType.Viewing,
Copy link
Collaborator Author

@plgafhd plgafhd Jan 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

논의점이 되는 포인트는 여기 하나..! (뭔가 마우스 잘못 찍어서 안나오는데 ModeType.Viewing에서 ModeType.Normal로 바꿨어)
알림함에서 진입한 강의 상세를 ModeType.Normal로 열어도 되느냐 아니냐를 봐야할 것 같아
즉, 알림함에서 진입해서 바로 강의 편집이 가능한데, 이게 괜찮은건지 여부

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

일단 이렇게 한 이유부터...
에러가 났던 이유는 이 코드 때문

private suspend fun getLectureReview(): LectureReviewDto? {
    val originalLectureId =
        if (modeType.value == ModeType.Viewing) {
            editingLectureDetail.value.id
        } else {
            editingLectureDetail.value.lecture_id
        }
    return originalLectureId?.let { lectureId ->
        currentTableRepository.getLectureReviewSummary(lectureId)
    }
}

알림함에서 진입한 시점에서, ev에 GET 요청을 보내기 위해 필요한 강의의 id는 lecture_id인데, Viewing으로 열면 id를 보내게 됨
그래서 서버에서는 그런 강의는 없기 때문에 404를 응답으로 보내는 것

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

여기서 의문점이 하나 있었는데... 그럼 검색 결과에서 자세히를 눌러 강의 상세를 열 때는 왜 같은 문제가 생기지 않았는가?를 보면...

알림함 -> 강의 상세의 경우

  • 알림함에서 누른 그 강의에 대해, 사용자의 시간표에서 찾아서, 찾은 lecture를 쓰게 됨 그래서 여기에는 review 정보가 없고, 새로 위의 getLectureReview()를 호출해서 ev를 받아야 함

검색 결과 -> 자세히의 경우

  • 그냥 서버에서 준 lecture를 그대로 쓰게 됨 그래서 여기에는 review 정보가 있고, getLectureReview()를 아예 호출하지 않음

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

그리고 문제점 두가지...

backstack 처리

  • Viewing이면 그냥 뒤로가기 판정이 되는데 Normal이면 그렇지 않음... 그래서 backstack 관련 처리에서 한 것 처럼 처리가 필요했어

플로팅 버튼

  • 원래 알림함에서 열면 '해당 시간표로 이동' 이라는 플로팅 버튼이 떠다니는데, 만약 사용자가 강의 편집을 하고 싶다면 이 버튼이 좀 거슬릴 수 있음
  • 요거는 지금 고친 방법이 괜찮다!라는 결론이 나오면 고칠 예정

ModeType.Normal,
)
withContext(Dispatchers.Main) {
navController.navigate("${NavigationDestination.TimetableLecture}?tableId=$timetableId")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,8 @@ fun LectureDetailPage(
ModeType.Normal -> {
if (navController.currentDestination?.route == NavigationDestination.LectureDetail) {
navController.popBackStack()
} else if (navController.currentDestination?.route?.contains(NavigationDestination.TimetableLecture) == true) {
onCloseViewMode(scope) // 알림함에서 진입하는 경우 다시 알림함으로 돌아가야 함
}
Comment on lines 116 to 120
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

navController.currentDestination?.route == NavigationDestination.LectureDetail 분기의 정체)
뒤로가기 연타하면 흰 화면 보이는? 버그를 막기 위한 코드
요 분기때문에 이 작업에서 TimetableLecture 분기도 추가되어 코드를 이해하기 어려워짐

-> 지금은 발생하지 않는 버그거나 발생하더라도 사소한 수준이라면
요 분기 없애고
Normal, Viewing 통일하고
onCloseViewMode를 항상 넣어줄 수 있도록 코드상에서 강제해본다

}
is ModeType.Editing -> {
Expand Down
Loading