-
Notifications
You must be signed in to change notification settings - Fork 2
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
#111 Home 진입 이후 플로우 Compose Navigation 마이그레이션 작업 #127
Merged
JaesungLeee
merged 114 commits into
mash-up-kr:develop
from
JaesungLeee:feature/navigation-migration
Jul 11, 2023
Merged
Changes from all commits
Commits
Show all changes
114 commits
Select commit
Hold shift + click to select a range
5e0b851
[chore] #111 navigation-copmose 의존성 추가
JaesungLeee 1778dea
[feat] #111 TopLevelDestination 정의
JaesungLeee a069330
[style] #111 feature 패키지 생성 및 이동
JaesungLeee a1f8a6d
[feat] #111 KeyLinkApp 및 KeyLinkAppState 추가
JaesungLeee 5ebede5
[feat] #111 Home화면 route 및 graph 생성
JaesungLeee 8f27f30
[feat] #111 Signal 보내기 화면 route 및 graph 생성
JaesungLeee 7995215
[feat] #111 최상단 route로 돌아가는 메서드 추가
JaesungLeee 7608279
[feat] #111 채팅 화면 route 및 graph 연결
JaesungLeee 306413b
[style] #111 네이밍 수정
JaesungLeee 68d3051
[fix] #111 feature 패키지 이동에 따른 수정
JaesungLeee 2584d0f
[feat] #111 네비게이션바 구현
JaesungLeee 757e073
[feat] #111 TopLevelDestination 수정 및 Navigation Bar Icon 변경
JaesungLeee fd333a1
[feat] #111 App에 BottomBar 연결
JaesungLeee adc4a7c
[feat] #111 HomeRoute 연결 및 기존 XML HomeFragment 제거
JaesungLeee 4a9a0cc
[feat] #111 GuideRoute 연결 및 기존 XML GuideFragment 제거
JaesungLeee f1d8954
[style] #111 사용되지 않는 Fragment, XML 삭제
JaesungLeee 7f4c7f2
[style] #111 HomeActivity 네이밍 변경 -> MainActivity
JaesungLeee 98e8533
[style] #111 GuideScreen 패키지 분리
JaesungLeee 206ad2c
[feat] #111 SubscribeRoute 연결
JaesungLeee 61b88cf
[feat] #111 BottomBar Visibility 수정
JaesungLeee 44c980c
[style] #111 툴바 클릭 함수명 수정
JaesungLeee d52901f
[feat] #111 SignalContentRoute 연결 및 기존 Fragment 제거
JaesungLeee e922c2a
[feat] #111 SignalViewModel 생성
JaesungLeee c06d243
[feat] #111 BottomBar에 시그널 보내기 Graph 연결 및 Multiple BackStack 유지
JaesungLeee e43ea6e
[feat] #111 SignalKeywordRoute 연결 및 기존 Fragment 제거
JaesungLeee 8fc70b8
[feat] #111 SignalCompleteRoute 연결 및 기존 Fragment 제거
JaesungLeee 4421ab3
[refactor] #111 기존 시그널 보내기 XML Navigation Graph 삭제 및 SignalActivity 삭제
JaesungLeee 734d6af
[chore] #111 navigation-copmose 의존성 추가
JaesungLeee 08bbb27
[feat] #111 TopLevelDestination 정의
JaesungLeee 44085ca
[style] #111 feature 패키지 생성 및 이동
JaesungLeee 76dba42
[feat] #111 KeyLinkApp 및 KeyLinkAppState 추가
JaesungLeee 16f0ab2
[feat] #111 Home화면 route 및 graph 생성
JaesungLeee c43249f
[feat] #111 Signal 보내기 화면 route 및 graph 생성
JaesungLeee d64a4c4
[feat] #111 최상단 route로 돌아가는 메서드 추가
JaesungLeee cf7b505
[feat] #111 채팅 화면 route 및 graph 연결
JaesungLeee 65dfa61
[style] #111 네이밍 수정
JaesungLeee 7cbe82a
[fix] #111 feature 패키지 이동에 따른 수정
JaesungLeee ca90f0e
[feat] #111 네비게이션바 구현
JaesungLeee efe9a1e
[feat] #111 TopLevelDestination 수정 및 Navigation Bar Icon 변경
JaesungLeee f3e30e0
[feat] #111 App에 BottomBar 연결
JaesungLeee 735d06f
[feat] #111 HomeRoute 연결 및 기존 XML HomeFragment 제거
JaesungLeee 32a1b83
[feat] #111 GuideRoute 연결 및 기존 XML GuideFragment 제거
JaesungLeee ebc0213
[style] #111 사용되지 않는 Fragment, XML 삭제
JaesungLeee 38383c1
[style] #111 HomeActivity 네이밍 변경 -> MainActivity
JaesungLeee 1a0b01c
[style] #111 GuideScreen 패키지 분리
JaesungLeee f774e02
[feat] #111 SubscribeRoute 연결
JaesungLeee b871ff7
[feat] #111 BottomBar Visibility 수정
JaesungLeee e4ce35d
[style] #111 툴바 클릭 함수명 수정
JaesungLeee 6c07e34
[feat] #111 SignalContentRoute 연결 및 기존 Fragment 제거
JaesungLeee 9db43ca
[feat] #111 SignalViewModel 생성
JaesungLeee 668bdb8
[feat] #111 BottomBar에 시그널 보내기 Graph 연결 및 Multiple BackStack 유지
JaesungLeee ea69019
[feat] #111 SignalKeywordRoute 연결 및 기존 Fragment 제거
JaesungLeee d5595c2
[feat] #111 SignalCompleteRoute 연결 및 기존 Fragment 제거
JaesungLeee 8e5ee2b
[refactor] #111 기존 시그널 보내기 XML Navigation Graph 삭제 및 SignalActivity 삭제
JaesungLeee 81eebf4
Merge remote-tracking branch 'origin/feature/navigation-migration' in…
JaesungLeee fccf6c7
[fix] #111 Binding 에러 수정
JaesungLeee 546aef6
[feat] #111 BottomBar에 채팅 Graph 연결 및 Multiple BackStack 유지
JaesungLeee 8bccc0e
[feat] #111 ChatDetailRoute 연결 및 기존 Fragment 제거
JaesungLeee 0989d6d
[feat] #111 MessageDetailRoute 연결 및 기존 Fragment 제거
JaesungLeee 7d045fc
[refactor] #111 기존 채팅 XML Navigation Graph 삭제
JaesungLeee ac7d15e
[feat] #111 ReportRoute 연결
JaesungLeee 5c372a3
[fix] #111 시그널 보내기 후 홈 돌아올때 백스택 제거
JaesungLeee 92816ce
[style] #111 Home에서 NavController 함수 패키지 분리
JaesungLeee 6558080
[feat] #111 더보기 클릭 시 SignalGraph 연결
JaesungLeee 99d52e5
[chore] #111 navigation-copmose 의존성 추가
JaesungLeee 8390142
[feat] #111 TopLevelDestination 정의
JaesungLeee 244b0cb
[style] #111 feature 패키지 생성 및 이동
JaesungLeee 0d3dc3a
[feat] #111 KeyLinkApp 및 KeyLinkAppState 추가
JaesungLeee c11f717
[feat] #111 Home화면 route 및 graph 생성
JaesungLeee 610cad0
[feat] #111 Signal 보내기 화면 route 및 graph 생성
JaesungLeee 6ebf628
[feat] #111 최상단 route로 돌아가는 메서드 추가
JaesungLeee a3461da
[feat] #111 채팅 화면 route 및 graph 연결
JaesungLeee 3396660
[style] #111 네이밍 수정
JaesungLeee d92875b
[fix] #111 feature 패키지 이동에 따른 수정
JaesungLeee 930b084
[feat] #111 네비게이션바 구현
JaesungLeee 9072585
[feat] #111 TopLevelDestination 수정 및 Navigation Bar Icon 변경
JaesungLeee 024f9bb
[feat] #111 App에 BottomBar 연결
JaesungLeee 98ee043
[feat] #111 HomeRoute 연결 및 기존 XML HomeFragment 제거
JaesungLeee e8867ba
[feat] #111 GuideRoute 연결 및 기존 XML GuideFragment 제거
JaesungLeee 49bdb56
[style] #111 사용되지 않는 Fragment, XML 삭제
JaesungLeee 465cab1
[style] #111 HomeActivity 네이밍 변경 -> MainActivity
JaesungLeee 1b04515
[style] #111 GuideScreen 패키지 분리
JaesungLeee 6dfded9
[feat] #111 SubscribeRoute 연결
JaesungLeee 13e12a8
[feat] #111 BottomBar Visibility 수정
JaesungLeee 492d645
[style] #111 툴바 클릭 함수명 수정
JaesungLeee 9043f9b
[feat] #111 SignalContentRoute 연결 및 기존 Fragment 제거
JaesungLeee f900ec2
[feat] #111 SignalViewModel 생성
JaesungLeee aa70691
[feat] #111 BottomBar에 시그널 보내기 Graph 연결 및 Multiple BackStack 유지
JaesungLeee 86e5685
[feat] #111 SignalKeywordRoute 연결 및 기존 Fragment 제거
JaesungLeee a1ff256
[feat] #111 SignalCompleteRoute 연결 및 기존 Fragment 제거
JaesungLeee f3accec
[refactor] #111 기존 시그널 보내기 XML Navigation Graph 삭제 및 SignalActivity 삭제
JaesungLeee d726de6
[feat] #111 TopLevelDestination 정의
JaesungLeee 4fce167
[feat] #111 KeyLinkApp 및 KeyLinkAppState 추가
JaesungLeee 28691c3
[feat] #111 최상단 route로 돌아가는 메서드 추가
JaesungLeee e35bd67
[style] #111 네이밍 수정
JaesungLeee e9f9d25
[feat] #111 App에 BottomBar 연결
JaesungLeee ffccf1c
[feat] #111 HomeRoute 연결 및 기존 XML HomeFragment 제거
JaesungLeee 7df1846
[feat] #111 GuideRoute 연결 및 기존 XML GuideFragment 제거
JaesungLeee cdd82c6
[style] #111 HomeActivity 네이밍 변경 -> MainActivity
JaesungLeee cbd8c69
[style] #111 GuideScreen 패키지 분리
JaesungLeee 5f2f888
[feat] #111 SubscribeRoute 연결
JaesungLeee b221ebf
[feat] #111 SignalContentRoute 연결 및 기존 Fragment 제거
JaesungLeee f5b7730
[feat] #111 SignalKeywordRoute 연결 및 기존 Fragment 제거
JaesungLeee abbde12
[fix] #111 Binding 에러 수정
JaesungLeee eb33bda
[feat] #111 BottomBar에 채팅 Graph 연결 및 Multiple BackStack 유지
JaesungLeee c14884f
[feat] #111 ChatDetailRoute 연결 및 기존 Fragment 제거
JaesungLeee 72e038e
[feat] #111 MessageDetailRoute 연결 및 기존 Fragment 제거
JaesungLeee d427d04
[refactor] #111 기존 채팅 XML Navigation Graph 삭제
JaesungLeee 8184351
[feat] #111 ReportRoute 연결
JaesungLeee 7e923d3
[fix] #111 시그널 보내기 후 홈 돌아올때 백스택 제거
JaesungLeee e8d9fa5
[style] #111 Home에서 NavController 함수 패키지 분리
JaesungLeee 8094783
[feat] #111 더보기 클릭 시 SignalGraph 연결
JaesungLeee 732573d
Merge remote-tracking branch 'origin/feature/navigation-migration' in…
JaesungLeee 5f88a34
[fix] #111 Rebase Conflict 수정
JaesungLeee File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
presentation/src/main/java/com/mashup/presentation/KeyLinkApp.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
package com.mashup.presentation | ||
|
||
import androidx.compose.foundation.layout.padding | ||
import androidx.compose.material.Scaffold | ||
import androidx.compose.material.SnackbarDuration | ||
import androidx.compose.material.SnackbarHostState | ||
import androidx.compose.material.SnackbarResult | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.runtime.remember | ||
import androidx.compose.ui.Modifier | ||
import com.mashup.presentation.navigation.KeyLinkNavHost | ||
import com.mashup.presentation.ui.common.KeyLinkBottomBar | ||
import com.mashup.presentation.ui.common.KeyLinkSnackBar | ||
import com.mashup.presentation.ui.theme.Black | ||
|
||
/** | ||
* Ssam_D_Android | ||
* @author jaesung | ||
* @created 2023/07/04 | ||
*/ | ||
@Composable | ||
fun KeyLinkApp( | ||
appState: KeyLinkAppState = rememberKeyLinkAppState() | ||
) { | ||
val snackbarHostState = remember { SnackbarHostState() } | ||
|
||
Scaffold( | ||
bottomBar = { | ||
if (appState.isBottomBarVisible()) { | ||
KeyLinkBottomBar( | ||
destinations = appState.topLevelDestinations, | ||
onNavigateToDestination = appState::navigateToTopLevelDestination, | ||
currentDestination = appState.currentDestination, | ||
modifier = Modifier | ||
) | ||
} | ||
}, | ||
backgroundColor = Black, | ||
snackbarHost = { KeyLinkSnackBar(snackBarHostState = snackbarHostState) } | ||
) { innerPadding -> | ||
KeyLinkNavHost( | ||
appState = appState, | ||
modifier = Modifier.padding(innerPadding), | ||
onShowSnackbar = { message, action -> | ||
snackbarHostState.showSnackbar( | ||
message = message, | ||
actionLabel = action, | ||
duration = SnackbarDuration.Short | ||
) == SnackbarResult.ActionPerformed | ||
} | ||
) | ||
} | ||
} |
77 changes: 77 additions & 0 deletions
77
presentation/src/main/java/com/mashup/presentation/KeyLinkAppState.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
package com.mashup.presentation | ||
|
||
import androidx.compose.runtime.Composable | ||
import androidx.compose.runtime.Stable | ||
import androidx.compose.runtime.remember | ||
import androidx.navigation.NavDestination | ||
import androidx.navigation.NavGraph.Companion.findStartDestination | ||
import androidx.navigation.NavHostController | ||
import androidx.navigation.compose.currentBackStackEntryAsState | ||
import androidx.navigation.compose.rememberNavController | ||
import androidx.navigation.navOptions | ||
import com.mashup.presentation.feature.chat.navigation.navigateToChat | ||
import com.mashup.presentation.feature.home.navigation.navigateToHome | ||
import com.mashup.presentation.feature.signal.navigation.navigateToSignal | ||
import com.mashup.presentation.navigation.KeyLinkNavigationRoute | ||
import com.mashup.presentation.navigation.TopLevelDestination | ||
|
||
/** | ||
* Ssam_D_Android | ||
* @author jaesung | ||
* @created 2023/07/04 | ||
*/ | ||
|
||
@Composable | ||
fun rememberKeyLinkAppState( | ||
navController: NavHostController = rememberNavController() | ||
): KeyLinkAppState { | ||
return remember(navController) { | ||
KeyLinkAppState(navController) | ||
} | ||
} | ||
|
||
/** | ||
* KeyLinkAppState에는 전반적인 어플리케이션 자체의 상태가 포함됩니다. | ||
* 1. Navigation Destination | ||
* 2. Multiple BackStack | ||
* 3. BottomNavigation Visibility | ||
* 4. NetworkMonitor(isOffline / isOnline) | ||
* 5. ... | ||
*/ | ||
@Stable | ||
class KeyLinkAppState( | ||
val navController: NavHostController | ||
) { | ||
val currentDestination: NavDestination? | ||
@Composable get() = navController.currentBackStackEntryAsState().value?.destination | ||
|
||
val topLevelDestinations: List<TopLevelDestination> = TopLevelDestination.values().toList() | ||
|
||
@Composable | ||
fun isBottomBarVisible(): Boolean { | ||
return when (currentDestination?.route) { | ||
KeyLinkNavigationRoute.HomeGraph.HomeRoute.route, | ||
KeyLinkNavigationRoute.ChatGraph.ChatRoute.route -> true | ||
else -> false | ||
} | ||
} | ||
|
||
/** | ||
* Home, Chat Route로 다시 돌아와야 하는 경우 호출하는 메서드 | ||
* singleTop으로 동작 및 backstack 유지 | ||
*/ | ||
fun navigateToTopLevelDestination(topLevelDestination: TopLevelDestination) { | ||
JaesungLeee marked this conversation as resolved.
Show resolved
Hide resolved
|
||
val topLevelNavOptions = navOptions { | ||
popUpTo(id = navController.graph.findStartDestination().id) { | ||
saveState = true | ||
} | ||
launchSingleTop = true | ||
restoreState = true | ||
} | ||
when (topLevelDestination) { | ||
TopLevelDestination.HOME -> navController.navigateToHome(topLevelNavOptions) | ||
TopLevelDestination.SIGNAL -> navController.navigateToSignal(topLevelNavOptions) | ||
TopLevelDestination.CHAT -> navController.navigateToChat(topLevelNavOptions) | ||
} | ||
} | ||
} |
27 changes: 0 additions & 27 deletions
27
presentation/src/main/java/com/mashup/presentation/chat/ChatFragment.kt
This file was deleted.
Oops, something went wrong.
25 changes: 0 additions & 25 deletions
25
presentation/src/main/java/com/mashup/presentation/detail/chat/ChatDetailFragment.kt
This file was deleted.
Oops, something went wrong.
27 changes: 0 additions & 27 deletions
27
presentation/src/main/java/com/mashup/presentation/detail/message/MessageDetailFragment.kt
This file was deleted.
Oops, something went wrong.
14 changes: 14 additions & 0 deletions
14
presentation/src/main/java/com/mashup/presentation/feature/chat/ChatViewModel.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package com.mashup.presentation.feature.chat | ||
|
||
import androidx.lifecycle.ViewModel | ||
import dagger.hilt.android.lifecycle.HiltViewModel | ||
import javax.inject.Inject | ||
|
||
/** | ||
* Ssam_D_Android | ||
* @author jaesung | ||
* @created 2023/07/09 | ||
*/ | ||
@HiltViewModel | ||
class ChatViewModel @Inject constructor() : ViewModel() { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
stable..사용하셧네요 결국 크크👏
어떤게 좋다고 합니까?
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.
리컴포지션이 일어나는 대표적인 조건이 전달되는 파라미터 값이 변경될 때인데, KeyLinkAppState를 KeyLinkApp에 전달할 때 @stable을 통해 컴포저블 함수를 다시 그리지 않고 Skippable하게 유지할 수 있습니당
KeyLinkAppState는 일반 클래스이기 때문에 컴파일러가 Stable함을 추론할 수 없고 명시적으로 skip할 수 있도록 @stable을 붙이구용