Skip to content

Conversation

@kangyuri1114
Copy link
Member

@kangyuri1114 kangyuri1114 commented May 12, 2025

Summary

develop ~feat/set-bottom-navigation 브랜치까지의 작업 내용

  1. MainActivity 내부 3개의 bottomNavi 화면이 도입될 fragment를 넣는 구조로 수정

  2. 화면명 수정 및 새 화면 추가

  • CafeteriaFragment 추가
  • MapFragment
    • MapFragmentComposeView 컴포즈 뷰 추가
  • MyPageFragment 추가
  1. Fragment 토스트 유틸 함수 추가
  2. 바텀네비 관련 menu 및 ui xml 추가

feat/set-bottom-navigation 에서 중복 메뉴 호출 및 이전 메뉴 화면 누적되어 반환하던 오류 수정을 위한 브랜치인 feat/fix-bottom-navi-error 작업내용

  1. 기존 오류 해결 - 오류 원인 : 기존에는 observe()를 매번 날짜 변경 시마다 호출하며, 메뉴 항목(Section)이 중복으로 totalMenuList에 누적됨
항목 설명
문제 오늘 메뉴 섹션(학식, 도담, 기숙사)이 날짜 변경 시 누적됨
원인 collect 안에서 totalMenuList.add()만 하고 이전 데이터를 제거하지 않음
해결 totalMenuList.removeAll { it.cafeteria == XX } 추가해서 기존 데이터 제거 후 추가
Fixed 메뉴는 왜 괜찮았나? 고정 메뉴는 수집/호출 횟수가 제한적이라 누적되지 않았음
  1. 메뉴 데이터 수집 방식 (menuViewModel)에서 LiveData → StateFlow로 수정
  2. collectFixedMenuData, collectMealData 함수로 관심사 분리
  3. viewModel 주입 방식 수정 (수동 Factory 사용 방식 → Hilt DI 적용 방식)
  4. NetworkModule 과 serviceModule 분리
  5. 바텀 네비에서 지도 버튼 관련 코드 임시 주석
  6. MenuViewModelFactory , CalendarViewModel 삭제

Describe your changes

default.mp4

Issue

To reviewers

feat/set-bottom-navigation 브랜치 pr에서 오류가 나고 있기 때문에 해당 pr을 바로 develop으로 머지하는 게 좋을 것 같아 이전 작업 내용도 해당 pr에 같이 정리했습니다.

근데 원래 로딩 속도가 오래걸려 uistate를 넣었는데 서버 고친 후로 너무 빨라져서 uistate에 마땅히 할 로직이 없는데 어떻게 할까요?

kangyuri1114 and others added 30 commits March 18, 2025 17:26
… activityviewmodel 사용을 위한 라이브러리 추가 및 프래그먼트용 토스트 확장 함수 생성.
* add: bottomSheetDialogFragment

* refactor: ListAdapter로 변경

* change: bottomSheet clickListener

* chore: 전체 리뷰에서 삭제하면 리스트 재호출 안되는거 수정

* chore: 전체 리뷰에서 삭제하면 리스트 재호출 안되는거 수정

* chore: 왼쪽 정렬, 워딩 수정 "리뷰 설정"

* chore: 오탈자 수정

* chore: apply로 바로 받아서 쓰기
# Conflicts:
#	app/src/main/AndroidManifest.xml
#	app/src/main/res/values/strings.xml
@kangyuri1114 kangyuri1114 self-assigned this May 12, 2025
@kangyuri1114 kangyuri1114 added ✨ feature 기능 추가 ⭐️ refactor 코드를 개선시킵니다. labels May 12, 2025
@kangyuri1114 kangyuri1114 changed the base branch from feat/set-bottom-navigation to develop May 12, 2025 08:28
@jayn2u jayn2u moved this to Todo in 2025년 1학기 May 12, 2025
@kangyuri1114 kangyuri1114 changed the title Feat/fix bottom navi error [Feat] 바텀 네비게이션 도입 및 기존 캘린더 및 마이페이지 화면 fragment 로 전환 May 12, 2025
Copy link
Member Author

@kangyuri1114 kangyuri1114 left a comment

Choose a reason for hiding this comment

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

image

이전 pr에서 말씀주신대로 하면 이렇게 되는데
너무 패키지가 많아서 바텀 네비 안에 있는 기능들만 main으로 한번 더 감싸면 좋을 것 같다는 의견인데 생각해보고 말씀 주세요~

@HI-JIN2
Copy link
Member

HI-JIN2 commented May 14, 2025

이전 pr에서 말씀주신대로 하면 이렇게 되는데
너무 패키지가 많아서 바텀 네비 안에 있는 기능들만 main으로 한번 더 감싸면 좋을 것 같다는 의견인데 생각해보고 말씀 주세요~

아니면 리뷰 쪽 기능들을 cafeteria 안으로 패키징 해야할 것 같아요.
cafeteria 안에 review랑 Info랑 들어가게용

@HI-JIN2
Copy link
Member

HI-JIN2 commented May 14, 2025

conflict 한번 확인해주세용! @kangyuri1114

Copy link
Member

@HI-JIN2 HI-JIN2 left a comment

Choose a reason for hiding this comment

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

정말 정말 수고 많으셨습니다!! 마치 새차한 기분이에요.. 시원해요.

몇가지 코멘트 달아두었습니다! 확인해보시고 반영할만한거는 반영해주세용!


@Module
@InstallIn(SingletonComponent::class)
object ServiceModule {
Copy link
Member

Choose a reason for hiding this comment

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

아아 xxxService만 따로 뺀거군요. 뭔가 하고 한참 봤네요

Comment on lines 100 to 117
// override fun onCreateOptionsMenu(menu: Menu?): Boolean {
// menuInflater.inflate(R.menu.menu_main, menu)
// return true
// }

// override fun onOptionsItemSelected(item: MenuItem): Boolean {
// return when (item.itemId) {
// R.id.action_setting -> {
// val intent = Intent(this, MyPageActivity::class.java) // 인텐트를 생성해줌,
// startActivity(intent) // 화면 전환을 시켜줌
// true
// }
//
// else -> super.onOptionsItemSelected(item)
// }
// }

// Permission --
Copy link
Member

Choose a reason for hiding this comment

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

이거 안쓰는거면 지워도 될 것 같아용


_uiState.update {
it.copy(
toastMessage = "로그아웃 되었습니다.",
Copy link
Member

Choose a reason for hiding this comment

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

요거 R.string으로 바꿔주셍용

Comment on lines 94 to 106
private val data = MutableLiveData<LocalDate>()

fun setData(dataToSend: LocalDate) {
data.value = dataToSend

Log.d("setdata", dataToSend.toString())
}

fun getData(): LiveData<LocalDate> {
return data
}

}
Copy link
Member

Choose a reason for hiding this comment

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

이게 아마 오늘 날짜 받아오는것 같은데.. mainviewmodel에서 하긴 좀 애매해보이네요..

Copy link
Member Author

Choose a reason for hiding this comment

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

허허.. 저도 이 날짜 받아오는 부분은 리팩하고싶은데.. 다음 pr로 넘겨보겠슴다...

Comment on lines 38 to 40
private val mainViewModel by activityViewModels<MainViewModel>()
private val infoViewModel: InfoViewModel by activityViewModels()
private val menuViewModel by viewModels<MenuViewModel>()
Copy link
Member

Choose a reason for hiding this comment

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

요거 형식 통일하면 좋을 것 같아용~

menuViewModel.uiState.collect { state ->
when (state) {
is UiState.Init -> {
Log.d("Debug", "UI State: Init")
Copy link
Member

Choose a reason for hiding this comment

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

로그는 Timber로 바꿔주세용~ 의미 없는 로그면 지워주시고용


if (response.isSuccessful) {
Log.d("post", "onResponse 성공" + response.body())
Timber.tag("post").d("onResponse 성공" + response.body())
Copy link
Member

Choose a reason for hiding this comment

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

이거 제가 작성한 코드인것 같긴한데, Timber면은 tag 지워주세욥!

Comment on lines -103 to -139
fun loginOut() {
viewModelScope.launch {
logoutUseCase() //Todo 반환값이 쓰이는게 아니면 이렇게 해도 되나?

_uiState.update {
it.copy(
toastMessage = "로그아웃 되었습니다.",
isLoginOuted = true
)
}
}
}

fun signOut() {
viewModelScope.launch {
signOutUseCase().onStart {
_uiState.update { it.copy(loading = true) }
}.onCompletion {
_uiState.update { it.copy(loading = false, error = true) }
}.catch { e ->
_uiState.update { it.copy(error = true, toastMessage = "정보를 불러올 수 없습니다.") }
Timber.e(e.toString())
}.collectLatest { result ->
Timber.d(result.toString())
if (result.result == true) {
logoutUseCase()
_uiState.update {
it.copy(
isSignOuted = true,
toastMessage = "탈퇴가 완료되었습니다."
)
}
}
}
}
}

Copy link
Member

Choose a reason for hiding this comment

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

어??? 로그인이랑 로그아웃 코드는 어디갔어요??

Copy link
Member Author

Choose a reason for hiding this comment

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

회원탈퇴는 회원탈퇴뷰모델이 따로있어 여기 회원탈퇴 함수를 사용하지 않아 지웠습니다

Comment on lines 81 to 92
fun logOut() {
viewModelScope.launch {
logoutUseCase() //Todo 반환값이 쓰이는게 아니면 이렇게 해도 되나?

_uiState.update {
it.copy(
toastMessage = "로그아웃 되었습니다.",
isLoggedOut = true
)
}
}
}
Copy link
Member

Choose a reason for hiding this comment

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

로그아웃이 왜 여기있죠?!

Copy link
Member Author

Choose a reason for hiding this comment

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

아 로그아웃 하고 인텐트로 화면 이동하려면 메인 액티비티에서 로그아웃 함수 실행해야 해서 여기로 옮겼어욤
근데 로그아웃하고 로그인화면으로 인텐트하는거 여기서 까먹고 안 넣어서 추가해서 다시 푸시해놨어욤

@kangyuri1114
Copy link
Member Author

탑바에서 마이페이지 이미지 삭제 안했던거 같은데 그거 꼭 반영해야 합니다.. 제가 까먹을까봐 남겨두요

Copy link
Member

@HI-JIN2 HI-JIN2 left a comment

Choose a reason for hiding this comment

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

스크린샷 2025-05-19 오후 5 23 52

main.menu랑 cafeteria를 합치는게 어떠할까요?
결국 cafeteria가 menu에 속하는 개념인 거 같아서요!
모듈을 나눈다면 리뷰 관련이랑 지도 관련으로 크게 나눌 것 같아, 크게 피쳐 별로 잡아주시면 좋을 것 같습니다!! 그리고 멀티모듈 도입도 논의해보고 싶어요..!!

그리고 map도 main 하위로 가야할 것 같아요!

상단에 점 3개 꼭 지우고!!! 병합해주세요! 그리고 지효님한테 바텀네비 이렇게 해서 배포할거라고 확인? 받으면 좋을 것 같습니다!!

@kangyuri1114
Copy link
Member Author

kangyuri1114 commented May 21, 2025

image

main.menu 빈 패키지였어서 요렇게 바꿨습니당

Copy link
Member

@HI-JIN2 HI-JIN2 left a comment

Choose a reason for hiding this comment

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

굿굿입니다!

Comment on lines +170 to +187
// 아래 함수를 View 에서는 사용이 어려워 util 로 빼지 않음
private fun BottomNavigationView.setOnSingleItemSelectedListener(
minInterval: Long = 2000L,
onSingleItemSelected: (item: MenuItem) -> Boolean
) {
var lastClickTime = 0L

setOnItemSelectedListener { item ->
val currentClickTime = SystemClock.uptimeMillis()
if (currentClickTime - lastClickTime > minInterval) {
lastClickTime = currentClickTime
onSingleItemSelected(item)
} else {
false // 너무 빠른 클릭 무시
}
}
}

Copy link
Member

Choose a reason for hiding this comment

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

오호 이거 baseActivity에 할 줄 알았는데, mainActivity에 하셨군요!👍

근데 이제 compose로 짜면 base activity도 의미 없을 것 같아요 그죠?

@kangyuri1114 kangyuri1114 merged commit d487550 into develop May 26, 2025
1 check passed
@kangyuri1114 kangyuri1114 deleted the feat/fix-bottom-navi-error branch May 26, 2025 08:52
@github-project-automation github-project-automation bot moved this from Todo to Done in 2025년 1학기 May 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

✨ feature 기능 추가 ⭐️ refactor 코드를 개선시킵니다.

Projects

No open projects
Status: Done

Development

Successfully merging this pull request may close these issues.

[Feat] BottomNavigationBar 작업

3 participants