Merge pull request #41 from lihenggui/compose_multiplatform

Merge latest NIA updates
pull/1323/head
Mercury Li 2 years ago committed by GitHub
commit b6cdcd4860
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -8,7 +8,7 @@ androidx.appcompat:appcompat-resources:1.6.1
androidx.arch.core:core-common:2.2.0
androidx.arch.core:core-runtime:2.2.0
androidx.autofill:autofill:1.0.0
androidx.browser:browser:1.7.0
androidx.browser:browser:1.8.0
androidx.collection:collection-jvm:1.4.0
androidx.collection:collection-ktx:1.4.0
androidx.collection:collection:1.4.0

@ -9,7 +9,7 @@ androidx.appcompat:appcompat:1.6.1
androidx.arch.core:core-common:2.2.0
androidx.arch.core:core-runtime:2.2.0
androidx.autofill:autofill:1.0.0
androidx.browser:browser:1.7.0
androidx.browser:browser:1.8.0
androidx.collection:collection-jvm:1.4.0
androidx.collection:collection-ktx:1.4.0
androidx.collection:collection:1.4.0
@ -68,8 +68,8 @@ androidx.emoji2:emoji2:1.3.0
androidx.exifinterface:exifinterface:1.3.7
androidx.fragment:fragment:1.5.1
androidx.hilt:hilt-common:1.1.0
androidx.hilt:hilt-navigation-compose:1.0.0
androidx.hilt:hilt-navigation:1.0.0
androidx.hilt:hilt-navigation-compose:1.2.0
androidx.hilt:hilt-navigation:1.2.0
androidx.hilt:hilt-work:1.1.0
androidx.interpolator:interpolator:1.0.0
androidx.legacy:legacy-support-core-utils:1.0.0

@ -167,7 +167,7 @@ class NiaAppStateTest {
}
@Test
fun stateIsOfflineWhenNetworkMonitorIsOffline() = runTest(UnconfinedTestDispatcher()) {
fun niaAppState_whenNetworkMonitorIsOffline_StateIsOffline() = runTest(UnconfinedTestDispatcher()) {
composeTestRule.setContent {
state = NiaAppState(
navController = NavHostController(LocalContext.current),
@ -214,7 +214,7 @@ class NiaAppStateTest {
@Composable
private fun rememberTestNavController(): TestNavHostController {
val context = LocalContext.current
return remember<TestNavHostController> {
return remember {
TestNavHostController(context).apply {
navigatorProvider.addNavigator(ComposeNavigator())
graph = createGraph(startDestination = "a") {

@ -79,7 +79,7 @@ internal fun TopicRoute(
viewModel: TopicViewModel = hiltViewModel(),
) {
val topicUiState: TopicUiState by viewModel.topicUiState.collectAsStateWithLifecycle()
val newsUiState: NewsUiState by viewModel.newUiState.collectAsStateWithLifecycle()
val newsUiState: NewsUiState by viewModel.newsUiState.collectAsStateWithLifecycle()
TrackScreenViewEvent(screenName = "Topic: ${viewModel.topicId}")
TopicScreen(

@ -62,7 +62,7 @@ class TopicViewModel @Inject constructor(
initialValue = TopicUiState.Loading,
)
val newUiState: StateFlow<NewsUiState> = newsUiState(
val newsUiState: StateFlow<NewsUiState> = newsUiState(
topicId = topicArgs.topicId,
userDataRepository = userDataRepository,
userNewsResourceRepository = userNewsResourceRepository,

@ -91,7 +91,7 @@ class TopicViewModelTest {
@Test
fun uiStateNews_whenInitialized_thenShowLoading() = runTest {
assertEquals(NewsUiState.Loading, viewModel.newUiState.value)
assertEquals(NewsUiState.Loading, viewModel.newsUiState.value)
}
@Test
@ -117,7 +117,7 @@ class TopicViewModelTest {
topicsRepository.sendTopics(testInputTopics.map { it.topic })
userDataRepository.setFollowedTopicIds(setOf(testInputTopics[1].topic.id))
val topicUiState = viewModel.topicUiState.value
val newsUiState = viewModel.newUiState.value
val newsUiState = viewModel.newsUiState.value
assertIs<TopicUiState.Success>(topicUiState)
assertIs<NewsUiState.Loading>(newsUiState)
@ -131,7 +131,7 @@ class TopicViewModelTest {
val collectJob = launch(UnconfinedTestDispatcher()) {
combine(
viewModel.topicUiState,
viewModel.newUiState,
viewModel.newsUiState,
::Pair,
).collect()
}
@ -139,7 +139,7 @@ class TopicViewModelTest {
userDataRepository.setFollowedTopicIds(setOf(testInputTopics[1].topic.id))
newsRepository.sendNewsResources(sampleNewsResources)
val topicUiState = viewModel.topicUiState.value
val newsUiState = viewModel.newUiState.value
val newsUiState = viewModel.newsUiState.value
assertIs<TopicUiState.Success>(topicUiState)
assertIs<NewsUiState.Success>(newsUiState)

@ -6,7 +6,7 @@ androidGradlePlugin = "8.3.0"
androidTools = "31.3.0"
androidxActivity = "1.8.0"
androidxAppCompat = "1.6.1"
androidxBrowser = "1.6.0"
androidxBrowser = "1.8.0"
androidxComposeBom = "2024.02.01"
androidxComposeCompiler = "1.5.10"
androidxComposeMaterial3Adaptive = "1.0.0-alpha06"
@ -15,7 +15,7 @@ androidxCore = "1.12.0"
androidxCoreSplashscreen = "1.0.1"
androidxDataStore = "1.0.0"
androidxEspresso = "3.5.1"
androidxHiltNavigationCompose = "1.0.0"
androidxHiltNavigationCompose = "1.2.0"
androidxLifecycle = "2.7.0"
androidxMacroBenchmark = "1.2.3"
androidxMetrics = "1.0.0-alpha04"

Loading…
Cancel
Save