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

Fix/bug navigation : Navigation 관련 에러 해결 #121

Merged
merged 24 commits into from
Aug 19, 2022
Merged

Conversation

mjkim1019
Copy link
Collaborator

@mjkim1019 mjkim1019 commented Aug 18, 2022

문제상황

https://www.notion.so/ba85f01273f14ac3b3aeaeb991d7aa59
다음 화면으로 이동하는 button 두 번이상 클릭했을 때 앱 죽는 현상

에러

[Error] java.lang.IllegalArgumentException: Navigation action/destination

원인

Navigation 기능에 대한 연속적인 호출이 원인

해결

  • button 한번만 클릭 가능케 함 (IsNextBtnClickable 변수로)
  • NavigationUtil 만들어 navigateSafe 함수를 통해 navigation 이동하도록 구현

onemask and others added 21 commits June 6, 2022 22:56
Release 0.0.5
* remove header

* update header

* add AuthCode

* remove requestLogin authCode

* add setAuthCode
� Conflicts:
�	app/proguard-rules.pro
�	app/src/main/java/com/depromeet/housekeeper/LoginFragment.kt
�	app/src/main/java/com/depromeet/housekeeper/LoginFragmentViewModel.kt
�	app/src/main/java/com/depromeet/housekeeper/data/RetrofitBuilder.kt
�	app/src/main/java/com/depromeet/housekeeper/local/PrefsManager.kt
�	app/src/main/java/com/depromeet/housekeeper/network/remote/api/ApiService.kt
�	app/src/main/java/com/depromeet/housekeeper/network/remote/api/RemoteDataSource.kt
�	app/src/main/java/com/depromeet/housekeeper/network/remote/repository/Repository.kt
�	app/src/main/java/com/depromeet/housekeeper/ui/addDirectTodo/AddDirectTodoViewModel.kt
�	keystore
navigateSafe가 필요하지 않을 것 같은 부분은 그냥 그대로 두었습니다..!
Copy link
Member

@sujin-kk sujin-kk left a comment

Choose a reason for hiding this comment

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

수고하셨어요!

@@ -178,7 +179,7 @@ class AddDirectTodoFragment : Fragment() {
setOnClickListener {
updateChore()
viewModel.createHouseWorks()
it.findNavController().navigate(R.id.action_addDirectTodoFragment_to_mainFragment)
it.findNavController().navigateSafe(R.id.action_addDirectTodoFragment_to_mainFragment)
Copy link
Member

Choose a reason for hiding this comment

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

[Q] navigateSafe를 하게 되면 어떻게 달라지나요?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

[A] navigateSafe 함수에서 A->B위치로 이동하는 action이 있는지 확인 후 navigate 합니다.
따라서 중복 호출되어 이미 B위치로 넘어갔을 땐 B->B이므로 navigate가 호출되지 않아 error가 발생하지 않습니다.

Comment on lines +46 to +57
val bundle = Bundle().apply {
putSerializable(NAVIGATION_VIEW_TYPE, SignViewType.GroupName)
putString(NAVIGATION_CODE, null)
}
findNavController().navigateSafe(R.id.action_joinGroupFragment_to_signNameFragment, bundle)
}
binding.joinGroupJoinSpaceButton.setOnClickListener {
findNavController().navigate(JoinGroupFragmentDirections.actionJoinGroupFragmentToSignNameFragment(SignViewType.InviteCode,null))
val bundle = Bundle().apply {
putSerializable(NAVIGATION_VIEW_TYPE, SignViewType.InviteCode)
putString(NAVIGATION_CODE, null)
}
findNavController().navigateSafe(R.id.action_joinGroupFragment_to_signNameFragment, bundle)
Copy link
Member

Choose a reason for hiding this comment

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

VIEW_TYPE으로 분기한거 좋습니당

@wjdwns wjdwns added the fix fix view or function label Aug 19, 2022
@wjdwns wjdwns merged commit 4dd786f into develop Aug 19, 2022
@wjdwns wjdwns deleted the bug_navigation branch August 19, 2022 10:18
mjkim1019 added a commit that referenced this pull request Aug 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fix fix view or function
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants