Skip to content

Commit

Permalink
feat: 백스택 오류 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
chws0508 committed Apr 7, 2024
1 parent 07d9b2d commit 8b4cab2
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions app/src/main/java/com/withpeace/withpeace/navigation/NavHost.kt
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,14 @@ import com.withpeace.withpeace.feature.login.navigation.navigateLogin
import com.withpeace.withpeace.feature.mypage.navigation.MY_PAGE_CHANGED_IMAGE_ARGUMENT
import com.withpeace.withpeace.feature.mypage.navigation.MY_PAGE_CHANGED_NICKNAME_ARGUMENT
import com.withpeace.withpeace.feature.mypage.navigation.myPageNavGraph
import com.withpeace.withpeace.feature.postdetail.navigation.POST_DETAIL_ROUTE
import com.withpeace.withpeace.feature.postdetail.navigation.navigateToPostDetail
import com.withpeace.withpeace.feature.postdetail.navigation.postDetailGraph
import com.withpeace.withpeace.feature.postlist.navigation.POST_LIST_ROUTE
import com.withpeace.withpeace.feature.postlist.navigation.postListGraph
import com.withpeace.withpeace.feature.registerpost.navigation.IMAGE_LIST_ARGUMENT
import com.withpeace.withpeace.feature.registerpost.navigation.REGISTER_POST_ARGUMENT
import com.withpeace.withpeace.feature.registerpost.navigation.REGISTER_POST_ROUTE
import com.withpeace.withpeace.feature.registerpost.navigation.navigateToRegisterPost
import com.withpeace.withpeace.feature.registerpost.navigation.registerPostNavGraph
import com.withpeace.withpeace.feature.signup.navigation.navigateSignUp
Expand Down Expand Up @@ -71,8 +73,16 @@ fun WithpeaceNavHost(
navController.navigateToPostDetail(
postId,
navOptions = navOptions {
popUpTo(POST_LIST_ROUTE) {
inclusive = false
// 수정일 경우 : 이전 화면이 상세화면이다
if(navController.previousBackStackEntry?.destination?.route == POST_DETAIL_ROUTE){
popUpTo(POST_LIST_ROUTE){
inclusive = false
}
} else {
// 새로 등록인 경우
popUpTo(REGISTER_POST_ROUTE){
inclusive = true
}
}
},
)
Expand Down

0 comments on commit 8b4cab2

Please sign in to comment.