Skip to content

Commit

Permalink
[chore] : reformat
Browse files Browse the repository at this point in the history
  • Loading branch information
ham2174 committed Feb 27, 2024
1 parent ece04f8 commit b0074e9
Show file tree
Hide file tree
Showing 10 changed files with 15 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ package com.moya.funch.datasource.local
import com.moya.funch.datastore.UserDataStore
import com.moya.funch.entity.Mbti
import com.moya.funch.model.ProfileModel
import javax.inject.Inject
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.catch
import kotlinx.coroutines.flow.flow
import timber.log.Timber
import javax.inject.Inject

class LocalUserDataSourceImpl @Inject constructor(
private val userDataStore: UserDataStore
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ package com.moya.funch.repository

import com.moya.funch.datasource.local.LocalUserDataSource
import com.moya.funch.entity.Mbti
import kotlinx.coroutines.flow.Flow
import javax.inject.Inject
import kotlinx.coroutines.flow.Flow

class MbtiCollectionRepositoryImpl @Inject constructor(
private val localUserDataSource: LocalUserDataSource
Expand All @@ -16,5 +16,4 @@ class MbtiCollectionRepositoryImpl @Inject constructor(
override suspend fun loadMbtiCollection(): Flow<List<Mbti>> {
return localUserDataSource.fetchUserMbtiCollection()
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,13 @@ package com.moya.funch.datasource.local

import com.google.common.truth.Truth.assertThat
import com.moya.funch.datastore.UserDataStore
import com.moya.funch.entity.Mbti
import com.moya.funch.model.ProfileModel
import com.moya.funch.rule.CoroutinesTestExtension
import io.mockk.coEvery
import io.mockk.coVerify
import io.mockk.impl.annotations.RelaxedMockK
import io.mockk.junit5.MockKExtension
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.first
import kotlinx.coroutines.test.runTest
import org.junit.jupiter.api.Assertions.assertAll
Expand Down Expand Up @@ -118,7 +116,7 @@ internal class LocalUserDataSourceImplTest {
// then
assertAll(
{ coVerify(exactly = 1) { userDataStore.mbtiCollection } },
{ assertThat(actualResult).isEmpty() },
{ assertThat(actualResult).isEmpty() }
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ fun subwayLinePainter(value: String): Painter = when (value) {
}

@Composable
fun activeMbtiBadgePainter(value: String): Painter = when(value) {
fun activeMbtiBadgePainter(value: String): Painter = when (value) {
"ISTJ" -> painterResource(id = FunchIconAsset.MbtiBadge.istj_active)
"ISFJ" -> painterResource(id = FunchIconAsset.MbtiBadge.isfj_active)
"INFJ" -> painterResource(id = FunchIconAsset.MbtiBadge.infj_active)
Expand All @@ -70,7 +70,7 @@ fun activeMbtiBadgePainter(value: String): Painter = when(value) {
}

@Composable
fun inactiveMbtiBadgePainter(value: String): Painter = when(value) {
fun inactiveMbtiBadgePainter(value: String): Painter = when (value) {
"ISTJ" -> painterResource(id = FunchIconAsset.MbtiBadge.istj_inactive)
"ISFJ" -> painterResource(id = FunchIconAsset.MbtiBadge.isfj_inactive)
"INFJ" -> painterResource(id = FunchIconAsset.MbtiBadge.infj_inactive)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ object FunchIconAsset {
val esfp_active = R.drawable.ic_mbti_esfp_active_60
val estj_active = R.drawable.ic_mbti_estj_active_60
val estp_active = R.drawable.ic_mbti_estp_active_60

/* inactive */
val infj_inactive = R.drawable.ic_mbti_infj_inactive_60
val intj_inactive = R.drawable.ic_mbti_intj_inactive_60
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@ package com.moya.funch.usecase

import com.moya.funch.entity.Mbti
import com.moya.funch.repository.MbtiCollectionRepository
import kotlinx.coroutines.flow.Flow

import javax.inject.Inject
import kotlinx.coroutines.flow.Flow

class LoadMbtiCollectionUseCaseImpl @Inject constructor(
private val mbtiCollectionRepository: MbtiCollectionRepository
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,7 @@ import com.moya.funch.theme.LocalBackgroundTheme
import com.moya.funch.ui.FunchTopBar

@Composable
internal fun CollectionRoute(
viewModel: CollectionViewModel = hiltViewModel(),
onNavigateToHome: () -> Unit
) {
internal fun CollectionRoute(viewModel: CollectionViewModel = hiltViewModel(), onNavigateToHome: () -> Unit) {
val uiState by viewModel.uiState.collectAsStateWithLifecycle()

CollectionScreen(
Expand All @@ -54,11 +51,7 @@ internal fun CollectionRoute(
}

@Composable
internal fun CollectionScreen(
name: String,
mbtiCollection: List<Mbti>,
onNavigateToHome: () -> Unit
) {
internal fun CollectionScreen(name: String, mbtiCollection: List<Mbti>, onNavigateToHome: () -> Unit) {
Column(
modifier = Modifier.fillMaxSize()
) {
Expand Down Expand Up @@ -98,7 +91,6 @@ internal fun CollectionScreen(
Spacer(modifier = Modifier.height(12.dp))
MbtiCollection(mbtiCollection = mbtiCollection)
}

}
}

Expand Down Expand Up @@ -158,7 +150,8 @@ private fun Preview1() {
Mbti.INFJ,
Mbti.INTJ,
Mbti.INFP,
Mbti.INTP),
Mbti.INTP
),
onNavigateToHome = {}
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ import com.moya.funch.entity.Mbti
import com.moya.funch.usecase.LoadMbtiCollectionUseCase
import com.moya.funch.usecase.LoadUserProfileUseCase
import dagger.hilt.android.lifecycle.HiltViewModel
import javax.inject.Inject
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.asStateFlow
import kotlinx.coroutines.launch
import timber.log.Timber
import javax.inject.Inject

internal data class CollectionUiState(
val name: String = "",
Expand All @@ -21,7 +21,7 @@ internal data class CollectionUiState(
internal class CollectionViewModel @Inject constructor(
private val loadMbtiCollectionUseCase: LoadMbtiCollectionUseCase,
private val loadUserProfileUseCase: LoadUserProfileUseCase
): ViewModel() {
) : ViewModel() {

private val _uiState = MutableStateFlow(CollectionUiState())
val uiState = _uiState.asStateFlow()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ import com.moya.funch.collection.CollectionRoute

const val COLLECTION_ROUTE = "collection"

fun NavController.navigateToCollection(navOptions: NavOptions? = null) =
navigate(COLLECTION_ROUTE, navOptions)
fun NavController.navigateToCollection(navOptions: NavOptions? = null) = navigate(COLLECTION_ROUTE, navOptions)

fun NavGraphBuilder.collectionScreen(onNavigateToHome: () -> Unit) {
composable(route = COLLECTION_ROUTE) {
Expand Down
2 changes: 1 addition & 1 deletion feature/home/src/main/java/com/moya/funch/HomeScreen.kt
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ private fun HomeTopBar(onClickFeedBack: () -> Unit) {
FunchTopBar(
modifier = Modifier.padding(bottom = 8.dp),
leadingIcon = null,
onClickTrailingIcon = onClickFeedBack,
onClickTrailingIcon = onClickFeedBack
)
}

Expand Down

0 comments on commit b0074e9

Please sign in to comment.