diff --git a/core/designsystem/src/main/java/com/susu/core/designsystem/component/appbar/icon/RegisterText.kt b/core/designsystem/src/main/java/com/susu/core/designsystem/component/appbar/icon/RegisterText.kt index 8a7b4993..cee6a205 100644 --- a/core/designsystem/src/main/java/com/susu/core/designsystem/component/appbar/icon/RegisterText.kt +++ b/core/designsystem/src/main/java/com/susu/core/designsystem/component/appbar/icon/RegisterText.kt @@ -9,7 +9,6 @@ import androidx.compose.ui.tooling.preview.Preview import com.susu.core.designsystem.R import com.susu.core.designsystem.theme.Gray100 import com.susu.core.designsystem.theme.SusuTheme -import com.susu.core.ui.extension.susuClickable @Composable fun RegisterText( diff --git a/core/designsystem/src/main/java/com/susu/core/designsystem/component/button/ClearIconButton.kt b/core/designsystem/src/main/java/com/susu/core/designsystem/component/button/ClearIconButton.kt index 41bd19dd..fecbcee7 100644 --- a/core/designsystem/src/main/java/com/susu/core/designsystem/component/button/ClearIconButton.kt +++ b/core/designsystem/src/main/java/com/susu/core/designsystem/component/button/ClearIconButton.kt @@ -1,6 +1,5 @@ package com.susu.core.designsystem.component.button -import androidx.compose.foundation.Image import androidx.compose.foundation.layout.size import androidx.compose.foundation.shape.CircleShape import androidx.compose.material3.Icon diff --git a/core/designsystem/src/main/java/com/susu/core/designsystem/component/textfieldbutton/TextFieldButtonColor.kt b/core/designsystem/src/main/java/com/susu/core/designsystem/component/textfieldbutton/TextFieldButtonColor.kt index 576cc581..260c0116 100644 --- a/core/designsystem/src/main/java/com/susu/core/designsystem/component/textfieldbutton/TextFieldButtonColor.kt +++ b/core/designsystem/src/main/java/com/susu/core/designsystem/component/textfieldbutton/TextFieldButtonColor.kt @@ -50,7 +50,7 @@ enum class TextFieldButtonColor( editTextColor = Gray100, savedTextColor = Gray100, placeholderColor = Gray40, - ) + ), } enum class TextButtonInnerButtonColor( diff --git a/core/model/src/main/java/com/susu/core/model/Vote.kt b/core/model/src/main/java/com/susu/core/model/Vote.kt index 12a6dd4a..30a1d535 100644 --- a/core/model/src/main/java/com/susu/core/model/Vote.kt +++ b/core/model/src/main/java/com/susu/core/model/Vote.kt @@ -5,5 +5,5 @@ data class Vote( val category: String, val content: String, val isModified: Boolean, - val optionList: List + val optionList: List, ) diff --git a/data/src/main/java/com/susu/data/data/repository/VoteRepositoryImpl.kt b/data/src/main/java/com/susu/data/data/repository/VoteRepositoryImpl.kt index ccb8d574..e55d2cda 100644 --- a/data/src/main/java/com/susu/data/data/repository/VoteRepositoryImpl.kt +++ b/data/src/main/java/com/susu/data/data/repository/VoteRepositoryImpl.kt @@ -1,21 +1,12 @@ package com.susu.data.data.repository -import com.susu.core.android.Dispatcher -import com.susu.core.android.SusuDispatchers -import com.susu.core.model.Category import com.susu.core.model.Vote -import com.susu.data.local.dao.CategoryConfigDao -import com.susu.data.local.model.toEntity import com.susu.data.local.model.toModel -import com.susu.data.remote.api.CategoryService import com.susu.data.remote.api.VoteService import com.susu.data.remote.model.request.CreateVoteRequest import com.susu.data.remote.model.request.VoteOption import com.susu.data.remote.model.response.toModel -import com.susu.domain.repository.CategoryConfigRepository import com.susu.domain.repository.VoteRepository -import kotlinx.coroutines.CoroutineDispatcher -import kotlinx.coroutines.withContext import javax.inject.Inject class VoteRepositoryImpl @Inject constructor( diff --git a/data/src/main/java/com/susu/data/remote/api/VoteService.kt b/data/src/main/java/com/susu/data/remote/api/VoteService.kt index 58c11a2c..174e096b 100644 --- a/data/src/main/java/com/susu/data/remote/api/VoteService.kt +++ b/data/src/main/java/com/susu/data/remote/api/VoteService.kt @@ -10,6 +10,6 @@ interface VoteService { @POST("/api/v1/votes") suspend fun createVote( - @Body createVoteRequest: CreateVoteRequest + @Body createVoteRequest: CreateVoteRequest, ): ApiResult } diff --git a/data/src/main/java/com/susu/data/remote/model/request/CreateVoteRequest.kt b/data/src/main/java/com/susu/data/remote/model/request/CreateVoteRequest.kt index cc7713c9..b1cb0332 100644 --- a/data/src/main/java/com/susu/data/remote/model/request/CreateVoteRequest.kt +++ b/data/src/main/java/com/susu/data/remote/model/request/CreateVoteRequest.kt @@ -9,11 +9,11 @@ data class CreateVoteRequest( @SerialName("options") val optionList: List, @SerialName("postCategoryId") - val categoryId: Int + val categoryId: Int, ) @Serializable data class VoteOption( val content: String, - val seq: Int + val seq: Int, ) diff --git a/data/src/main/java/com/susu/data/remote/model/response/VoteResponse.kt b/data/src/main/java/com/susu/data/remote/model/response/VoteResponse.kt index f5485f9a..a7d64361 100644 --- a/data/src/main/java/com/susu/data/remote/model/response/VoteResponse.kt +++ b/data/src/main/java/com/susu/data/remote/model/response/VoteResponse.kt @@ -12,7 +12,7 @@ data class VoteResponse( val content: String, val isModified: Boolean, @SerialName("options") - val optionList: List + val optionList: List, ) internal fun VoteResponse.toModel() = Vote( diff --git a/domain/src/main/java/com/susu/domain/repository/VoteRepository.kt b/domain/src/main/java/com/susu/domain/repository/VoteRepository.kt index 9de94913..c1289413 100644 --- a/domain/src/main/java/com/susu/domain/repository/VoteRepository.kt +++ b/domain/src/main/java/com/susu/domain/repository/VoteRepository.kt @@ -4,8 +4,8 @@ import com.susu.core.model.Vote interface VoteRepository { suspend fun createVote( - content: String, - optionList: List, - categoryId: Int + content: String, + optionList: List, + categoryId: Int, ): Vote } diff --git a/domain/src/main/java/com/susu/domain/usecase/vote/CreateVoteUseCase.kt b/domain/src/main/java/com/susu/domain/usecase/vote/CreateVoteUseCase.kt index 6e5efebe..efc742b3 100644 --- a/domain/src/main/java/com/susu/domain/usecase/vote/CreateVoteUseCase.kt +++ b/domain/src/main/java/com/susu/domain/usecase/vote/CreateVoteUseCase.kt @@ -1,7 +1,6 @@ package com.susu.domain.usecase.vote import com.susu.core.common.runCatchingIgnoreCancelled -import com.susu.domain.repository.CategoryConfigRepository import com.susu.domain.repository.VoteRepository import javax.inject.Inject diff --git a/feature/community/src/main/java/com/susu/feature/community/navigation/CommunityNavigation.kt b/feature/community/src/main/java/com/susu/feature/community/navigation/CommunityNavigation.kt index 9822cf6d..ec263286 100644 --- a/feature/community/src/main/java/com/susu/feature/community/navigation/CommunityNavigation.kt +++ b/feature/community/src/main/java/com/susu/feature/community/navigation/CommunityNavigation.kt @@ -22,7 +22,9 @@ fun NavGraphBuilder.communityNavGraph( padding: PaddingValues, navigateVoteAdd: () -> Unit, popBackStack: () -> Unit, + @Suppress("detekt:UnusedParameter") onShowSnackbar: (SnackbarToken) -> Unit, + @Suppress("detekt:UnusedParameter") onShowDialog: (DialogToken) -> Unit, handleException: (Throwable, () -> Unit) -> Unit, ) { diff --git a/feature/community/src/main/java/com/susu/feature/community/voteadd/VoteAddContract.kt b/feature/community/src/main/java/com/susu/feature/community/voteadd/VoteAddContract.kt index 51450600..8bc72bfe 100644 --- a/feature/community/src/main/java/com/susu/feature/community/voteadd/VoteAddContract.kt +++ b/feature/community/src/main/java/com/susu/feature/community/voteadd/VoteAddContract.kt @@ -5,7 +5,6 @@ import com.susu.core.ui.base.SideEffect import com.susu.core.ui.base.UiState import kotlinx.collections.immutable.PersistentList import kotlinx.collections.immutable.persistentListOf -import java.util.UUID data class VoteAddState( val categoryConfigList: PersistentList = persistentListOf(), @@ -14,8 +13,8 @@ data class VoteAddState( val content: String = "", val isLoading: Boolean = false, ) : UiState { - val buttonEnabled = content.length in 1 .. 50 && - voteOptionStateList.all { it.content.length in 1 ..10 } + val buttonEnabled = content.length in 1..50 && + voteOptionStateList.all { it.content.length in 1..10 } } data class VoteOptionState( diff --git a/feature/community/src/main/java/com/susu/feature/community/voteadd/VoteAddScreen.kt b/feature/community/src/main/java/com/susu/feature/community/voteadd/VoteAddScreen.kt index f21e8662..e8051d12 100644 --- a/feature/community/src/main/java/com/susu/feature/community/voteadd/VoteAddScreen.kt +++ b/feature/community/src/main/java/com/susu/feature/community/voteadd/VoteAddScreen.kt @@ -1,9 +1,7 @@ package com.susu.feature.community.voteadd -import androidx.compose.foundation.Image import androidx.compose.foundation.background import androidx.compose.foundation.layout.Arrangement -import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Spacer @@ -14,10 +12,8 @@ import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.size import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.shape.CircleShape -import androidx.compose.foundation.text.BasicTextField import androidx.compose.foundation.verticalScroll import androidx.compose.material3.Icon -import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.runtime.LaunchedEffect import androidx.compose.ui.Alignment @@ -26,13 +22,10 @@ import androidx.compose.ui.draw.clip import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.stringResource import androidx.compose.ui.tooling.preview.Preview -import androidx.compose.ui.unit.dp import androidx.hilt.navigation.compose.hiltViewModel import androidx.lifecycle.compose.collectAsStateWithLifecycle import com.susu.core.designsystem.component.appbar.SusuDefaultAppBar import com.susu.core.designsystem.component.appbar.icon.BackIcon -import com.susu.core.designsystem.component.appbar.icon.DeleteText -import com.susu.core.designsystem.component.appbar.icon.EditText import com.susu.core.designsystem.component.appbar.icon.RegisterText import com.susu.core.designsystem.component.button.FilledButtonColor import com.susu.core.designsystem.component.button.SusuFilledButton @@ -41,7 +34,6 @@ import com.susu.core.designsystem.component.textfield.SusuBasicTextField import com.susu.core.designsystem.component.textfieldbutton.SusuTextFieldFillMaxButton import com.susu.core.designsystem.component.textfieldbutton.TextFieldButtonColor import com.susu.core.designsystem.component.textfieldbutton.style.MediumTextFieldButtonStyle -import com.susu.core.designsystem.component.textfieldbutton.style.TextFieldButtonStyle import com.susu.core.designsystem.theme.Gray10 import com.susu.core.designsystem.theme.Gray100 import com.susu.core.designsystem.theme.Gray40 @@ -116,9 +108,9 @@ fun VoteAddScreen( .susuClickable( rippleEnabled = false, runIf = uiState.buttonEnabled, - onClick = onClickRegister + onClick = onClickRegister, ), - color = if (uiState.buttonEnabled) Gray100 else Gray40 + color = if (uiState.buttonEnabled) Gray100 else Gray40, ) }, ) @@ -130,7 +122,7 @@ fun VoteAddScreen( .verticalScroll(rememberScrollState()), ) { Row( - horizontalArrangement = Arrangement.spacedBy(SusuTheme.spacing.spacing_xxxxs) + horizontalArrangement = Arrangement.spacedBy(SusuTheme.spacing.spacing_xxxxs), ) { uiState.categoryConfigList.dropLast(1).forEach { SusuFilledButton( @@ -167,7 +159,7 @@ fun VoteAddScreen( Spacer(modifier = Modifier.size(SusuTheme.spacing.spacing_xl)) Column( - verticalArrangement = Arrangement.spacedBy(SusuTheme.spacing.spacing_xxs) + verticalArrangement = Arrangement.spacedBy(SusuTheme.spacing.spacing_xxs), ) { uiState.voteOptionStateList.forEachIndexed { index, option -> SusuTextFieldFillMaxButton( diff --git a/feature/community/src/main/java/com/susu/feature/community/voteadd/VoteAddViewModel.kt b/feature/community/src/main/java/com/susu/feature/community/voteadd/VoteAddViewModel.kt index 96d077bc..4d4c24b4 100644 --- a/feature/community/src/main/java/com/susu/feature/community/voteadd/VoteAddViewModel.kt +++ b/feature/community/src/main/java/com/susu/feature/community/voteadd/VoteAddViewModel.kt @@ -64,8 +64,11 @@ class VoteAddViewModel @Inject constructor( fun updateOptionContent(index: Int, content: String) = intent { copy( voteOptionStateList = voteOptionStateList.mapIndexed { voteIndex, voteOptionState -> - if (index == voteIndex) voteOptionState.copy(content = content) - else voteOptionState + if (index == voteIndex) { + voteOptionState.copy(content = content) + } else { + voteOptionState + } }.toPersistentList(), ) } @@ -73,8 +76,11 @@ class VoteAddViewModel @Inject constructor( fun toggleOptionSavedState(index: Int) = intent { copy( voteOptionStateList = voteOptionStateList.mapIndexed { voteIndex, voteOptionState -> - if (index == voteIndex) voteOptionState.copy(isSaved = voteOptionState.isSaved.not()) - else voteOptionState + if (index == voteIndex) { + voteOptionState.copy(isSaved = voteOptionState.isSaved.not()) + } else { + voteOptionState + } }.toPersistentList(), ) }