From be69a916592b6dfd86d8553c2bc20cb198be2276 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=95=88=EB=B3=91=ED=97=8C?= <64366488+Heonbyeong@users.noreply.github.com> Date: Sun, 29 Sep 2024 22:47:51 +0900 Subject: [PATCH 01/30] Update pull_request_template.md --- .github/pull_request_template.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 7fd25940..3392eed9 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -1,5 +1,13 @@ ## 요약 ## 작업내용 +- [ ] 기능개발 +- [ ] 버그개선 +- [ ] 리팩토링 +- [ ] 핫픽스 +- [ ] 빌드 파일 수정 +- [ ] 기타 + +## 스크린샷 ## 기타 From e9aeb82375d13002e1b77e4c6c6989a039a1d484 Mon Sep 17 00:00:00 2001 From: jhg3410 Date: Tue, 19 Nov 2024 14:29:39 +0900 Subject: [PATCH 02/30] =?UTF-8?q?=EC=86=8C=EC=86=8D=20=EA=B2=80=EC=83=89?= =?UTF-8?q?=20Usecase,=20data=20layer=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../moneymong/network/api/AgencyApi.kt | 13 ++++-- .../agency/AgencyRemoteDataSource.kt | 6 ++- .../agency/AgencyRemoteDataSourceImpl.kt | 11 +++-- .../agency/AgencyRemoteDataSourceMock.kt | 8 +++- .../repository/agency/AgencyRepositoryImpl.kt | 3 ++ .../repository/agency/AgencyRepository.kt | 1 + .../agency/FetchAgencyByNameUseCase.kt | 42 +++++++++++++++++++ 7 files changed, 73 insertions(+), 11 deletions(-) create mode 100644 domain/src/main/java/com/moneymong/moneymong/domain/usecase/agency/FetchAgencyByNameUseCase.kt diff --git a/core/network/src/main/java/com/moneymong/moneymong/network/api/AgencyApi.kt b/core/network/src/main/java/com/moneymong/moneymong/network/api/AgencyApi.kt index c03d0c1f..c664b584 100644 --- a/core/network/src/main/java/com/moneymong/moneymong/network/api/AgencyApi.kt +++ b/core/network/src/main/java/com/moneymong/moneymong/network/api/AgencyApi.kt @@ -1,16 +1,16 @@ package com.moneymong.moneymong.network.api -import com.moneymong.moneymong.model.agency.AgencyJoinRequest -import com.moneymong.moneymong.model.agency.AgencyRegisterRequest import com.moneymong.moneymong.model.agency.AgenciesGetResponse +import com.moneymong.moneymong.model.agency.AgencyGetResponse +import com.moneymong.moneymong.model.agency.AgencyJoinRequest import com.moneymong.moneymong.model.agency.AgencyJoinResponse +import com.moneymong.moneymong.model.agency.AgencyRegisterRequest import com.moneymong.moneymong.model.agency.MyAgencyResponse import com.moneymong.moneymong.model.agency.RegisterAgencyResponse import com.moneymong.moneymong.model.member.InvitationCodeResponse import retrofit2.http.Body import retrofit2.http.DELETE import retrofit2.http.GET -import retrofit2.http.Header import retrofit2.http.PATCH import retrofit2.http.POST import retrofit2.http.Path @@ -33,6 +33,11 @@ interface AgencyApi { @GET("api/v1/agencies/me") suspend fun fetchMyAgencyList(): Result> + @GET("api/v1/agencies/search") + suspend fun fetchAgencyByName( + @Query("keyword") name: String + ): Result> + // POST @POST("/api/v1/agencies/{agencyId}/invitation-code") suspend fun agencyCodeNumbers( @@ -55,5 +60,5 @@ interface AgencyApi { @DELETE("api/v1/agencies/{agencyId}") suspend fun deleteAgency( @Path("agencyId") agencyId: Int - ) : Result + ): Result } \ No newline at end of file diff --git a/data/src/main/java/com/moneymong/moneymong/data/datasource/agency/AgencyRemoteDataSource.kt b/data/src/main/java/com/moneymong/moneymong/data/datasource/agency/AgencyRemoteDataSource.kt index 5ce29b85..10832478 100644 --- a/data/src/main/java/com/moneymong/moneymong/data/datasource/agency/AgencyRemoteDataSource.kt +++ b/data/src/main/java/com/moneymong/moneymong/data/datasource/agency/AgencyRemoteDataSource.kt @@ -1,9 +1,10 @@ package com.moneymong.moneymong.data.datasource.agency +import com.moneymong.moneymong.model.agency.AgenciesGetResponse +import com.moneymong.moneymong.model.agency.AgencyGetResponse import com.moneymong.moneymong.model.agency.AgencyJoinRequest -import com.moneymong.moneymong.model.agency.AgencyRegisterRequest import com.moneymong.moneymong.model.agency.AgencyJoinResponse -import com.moneymong.moneymong.model.agency.AgenciesGetResponse +import com.moneymong.moneymong.model.agency.AgencyRegisterRequest import com.moneymong.moneymong.model.agency.MyAgencyResponse import com.moneymong.moneymong.model.agency.RegisterAgencyResponse @@ -11,5 +12,6 @@ interface AgencyRemoteDataSource { suspend fun registerAgency(request: AgencyRegisterRequest): Result suspend fun getAgencies(page: Int, size: Int): Result suspend fun fetchMyAgencyList(): Result> + suspend fun fetchAgencyByName(agencyName: String): Result> suspend fun agencyCodeNumbers(agencyId : Long, data: AgencyJoinRequest) : Result } \ No newline at end of file diff --git a/data/src/main/java/com/moneymong/moneymong/data/datasource/agency/AgencyRemoteDataSourceImpl.kt b/data/src/main/java/com/moneymong/moneymong/data/datasource/agency/AgencyRemoteDataSourceImpl.kt index 68c8a6a6..6643d480 100644 --- a/data/src/main/java/com/moneymong/moneymong/data/datasource/agency/AgencyRemoteDataSourceImpl.kt +++ b/data/src/main/java/com/moneymong/moneymong/data/datasource/agency/AgencyRemoteDataSourceImpl.kt @@ -1,12 +1,13 @@ package com.moneymong.moneymong.data.datasource.agency -import com.moneymong.moneymong.network.api.AgencyApi -import com.moneymong.moneymong.model.agency.AgencyJoinRequest -import com.moneymong.moneymong.model.agency.AgencyRegisterRequest import com.moneymong.moneymong.model.agency.AgenciesGetResponse +import com.moneymong.moneymong.model.agency.AgencyGetResponse +import com.moneymong.moneymong.model.agency.AgencyJoinRequest import com.moneymong.moneymong.model.agency.AgencyJoinResponse +import com.moneymong.moneymong.model.agency.AgencyRegisterRequest import com.moneymong.moneymong.model.agency.MyAgencyResponse import com.moneymong.moneymong.model.agency.RegisterAgencyResponse +import com.moneymong.moneymong.network.api.AgencyApi import javax.inject.Inject class AgencyRemoteDataSourceImpl @Inject constructor( @@ -25,6 +26,10 @@ class AgencyRemoteDataSourceImpl @Inject constructor( return agencyApi.fetchMyAgencyList() } + override suspend fun fetchAgencyByName(agencyName: String): Result> { + return agencyApi.fetchAgencyByName(name = agencyName) + } + override suspend fun agencyCodeNumbers( agencyId: Long, data: AgencyJoinRequest diff --git a/data/src/main/java/com/moneymong/moneymong/data/datasource/agency/AgencyRemoteDataSourceMock.kt b/data/src/main/java/com/moneymong/moneymong/data/datasource/agency/AgencyRemoteDataSourceMock.kt index fe6be889..1c14125b 100644 --- a/data/src/main/java/com/moneymong/moneymong/data/datasource/agency/AgencyRemoteDataSourceMock.kt +++ b/data/src/main/java/com/moneymong/moneymong/data/datasource/agency/AgencyRemoteDataSourceMock.kt @@ -1,10 +1,10 @@ package com.moneymong.moneymong.data.datasource.agency -import com.moneymong.moneymong.model.agency.AgencyJoinRequest -import com.moneymong.moneymong.model.agency.AgencyRegisterRequest import com.moneymong.moneymong.model.agency.AgenciesGetResponse import com.moneymong.moneymong.model.agency.AgencyGetResponse +import com.moneymong.moneymong.model.agency.AgencyJoinRequest import com.moneymong.moneymong.model.agency.AgencyJoinResponse +import com.moneymong.moneymong.model.agency.AgencyRegisterRequest import com.moneymong.moneymong.model.agency.MyAgencyResponse import com.moneymong.moneymong.model.agency.RegisterAgencyResponse import kotlinx.coroutines.delay @@ -24,6 +24,10 @@ class AgencyRemoteDataSourceMock : AgencyRemoteDataSource { return Result.success(emptyList()) } + override suspend fun fetchAgencyByName(agencyName: String): Result> { + return Result.success(emptyList()) + } + override suspend fun agencyCodeNumbers( agencyId: Long, data: AgencyJoinRequest diff --git a/data/src/main/java/com/moneymong/moneymong/data/repository/agency/AgencyRepositoryImpl.kt b/data/src/main/java/com/moneymong/moneymong/data/repository/agency/AgencyRepositoryImpl.kt index 225ea34b..3d8445a3 100644 --- a/data/src/main/java/com/moneymong/moneymong/data/repository/agency/AgencyRepositoryImpl.kt +++ b/data/src/main/java/com/moneymong/moneymong/data/repository/agency/AgencyRepositoryImpl.kt @@ -35,6 +35,9 @@ class AgencyRepositoryImpl @Inject constructor( override suspend fun fetchMyAgencyList(): Result> = agencyRemoteDataSource.fetchMyAgencyList() + override suspend fun fetchAgencyByName(agencyName: String): Result> = + agencyRemoteDataSource.fetchAgencyByName(agencyName) + override suspend fun agencyCodeNumbers( agencyId: Long, data: AgencyJoinRequest diff --git a/domain/src/main/java/com/moneymong/moneymong/domain/repository/agency/AgencyRepository.kt b/domain/src/main/java/com/moneymong/moneymong/domain/repository/agency/AgencyRepository.kt index 1515676b..a8cabcc1 100644 --- a/domain/src/main/java/com/moneymong/moneymong/domain/repository/agency/AgencyRepository.kt +++ b/domain/src/main/java/com/moneymong/moneymong/domain/repository/agency/AgencyRepository.kt @@ -13,6 +13,7 @@ interface AgencyRepository { suspend fun registerAgency(request: AgencyRegisterRequest): Result fun getAgencies(): Flow> suspend fun fetchMyAgencyList(): Result> + suspend fun fetchAgencyByName(agencyName: String): Result> suspend fun agencyCodeNumbers(agencyId: Long, data: AgencyJoinRequest): Result suspend fun saveAgencyId(agencyId: Int) diff --git a/domain/src/main/java/com/moneymong/moneymong/domain/usecase/agency/FetchAgencyByNameUseCase.kt b/domain/src/main/java/com/moneymong/moneymong/domain/usecase/agency/FetchAgencyByNameUseCase.kt new file mode 100644 index 00000000..343d684b --- /dev/null +++ b/domain/src/main/java/com/moneymong/moneymong/domain/usecase/agency/FetchAgencyByNameUseCase.kt @@ -0,0 +1,42 @@ +package com.moneymong.moneymong.domain.usecase.agency + +import com.moneymong.moneymong.domain.repository.agency.AgencyRepository +import com.moneymong.moneymong.model.agency.AgencyGetResponse +import javax.inject.Inject + +class FetchAgencyByNameUseCase @Inject constructor( + private val agencyRepository: AgencyRepository, +) { + + suspend operator fun invoke(agencyName: String): Result> { +// return agencyRepository.fetchAgencyBySearch() + return Result.success( + listOf( + AgencyGetResponse( + id = 1, + name = "Agency 1", + headCount = 10, + type = "STUDENT_COUNCIL" + ), + AgencyGetResponse( + id = 2, + name = "Agency 2", + headCount = 20, + type = "IN_SCHOOL_CLUB" + ), + AgencyGetResponse( + id = 3, + name = "Agency 3", + headCount = 30, + type = "STUDENT_COUNCIL" + ), + AgencyGetResponse( + id = 4, + name = "Agency 4", + headCount = 40, + type = "IN_SCHOOL_CLUB" + ), + ) + ) + } +} \ No newline at end of file From 2f74f6e6afed90cf36afee34b271aed98ec99df9 Mon Sep 17 00:00:00 2001 From: jhg3410 Date: Tue, 19 Nov 2024 14:29:55 +0900 Subject: [PATCH 03/30] =?UTF-8?q?=EA=B2=80=EC=83=89=20=EC=95=84=EC=9D=B4?= =?UTF-8?q?=EC=BD=98=20=EB=88=8C=EB=A0=80=EC=9D=84=20=EB=95=8C,=20?= =?UTF-8?q?=EB=8C=80=ED=95=99=20=EB=AA=A9=EB=A1=9D=20=EC=82=AC=EB=9D=BC?= =?UTF-8?q?=EC=A7=80=EB=8A=94=20=EB=B2=84=EA=B7=B8=20=ED=95=B4=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../moneymong/feature/sign/view/SearchUnivView.kt | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/feature/sign/src/main/java/com/moneymong/moneymong/feature/sign/view/SearchUnivView.kt b/feature/sign/src/main/java/com/moneymong/moneymong/feature/sign/view/SearchUnivView.kt index f08c941c..4d478a8a 100644 --- a/feature/sign/src/main/java/com/moneymong/moneymong/feature/sign/view/SearchUnivView.kt +++ b/feature/sign/src/main/java/com/moneymong/moneymong/feature/sign/view/SearchUnivView.kt @@ -13,7 +13,6 @@ import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.remember -import androidx.compose.ui.ExperimentalComposeUiApi import androidx.compose.ui.Modifier import androidx.compose.ui.focus.onFocusChanged import androidx.compose.ui.platform.LocalSoftwareKeyboardController @@ -25,14 +24,15 @@ import com.moneymong.moneymong.design_system.component.textfield.util.MDSTextFie import com.moneymong.moneymong.design_system.theme.Body4 import com.moneymong.moneymong.design_system.theme.Gray05 import com.moneymong.moneymong.design_system.theme.White -import com.moneymong.moneymong.model.sign.University import com.moneymong.moneymong.feature.sign.item.UnivItem import com.moneymong.moneymong.model.sign.UniversitiesResponse +import com.moneymong.moneymong.model.sign.University import kotlinx.coroutines.FlowPreview import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.debounce -@OptIn(ExperimentalComposeUiApi::class, FlowPreview::class) + +@OptIn(FlowPreview::class) @Composable fun SearchUnivView( modifier: Modifier = Modifier, @@ -61,10 +61,9 @@ fun SearchUnivView( .debounce(debouncePeriod) .collect { query -> Log.d("query", query) - if(query.isEmpty() && value.text.isNotEmpty()){ + if (query.isEmpty() && value.text.isNotEmpty()) { onSearchIconClicked(value.text) - } - else{ + } else { onSearchIconClicked(query) } isFilledChanged(false) @@ -100,7 +99,7 @@ fun SearchUnivView( if (value.text.isEmpty()) { isListVisibleChanged(false) } else { - onSearchIconClicked(textValue.toString()) + onSearchIconClicked(textValue.text) isFilledChanged(true) isListVisibleChanged(true) } From 56e1f38f72efdc782635c50358b19f8d1abd62e4 Mon Sep 17 00:00:00 2001 From: jhg3410 Date: Tue, 19 Nov 2024 14:35:18 +0900 Subject: [PATCH 04/30] =?UTF-8?q?=EB=B6=88=ED=95=84=EC=9A=94=ED=95=9C=20?= =?UTF-8?q?=EC=BD=94=EB=93=9C=20=EC=A0=9C=EA=B1=B0=20=EB=B0=8F=20=EB=84=A4?= =?UTF-8?q?=EC=9D=B4=EB=B0=8D=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../moneymong/navigation/MoneyMongNavHost.kt | 0 .../util/MoneyMongTokenAuthenticator.kt | 8 ++----- .../repository/token/TokenRepositoryImpl.kt | 22 +++++++++++-------- ...ciesUseCase.kt => FetchAgenciesUseCase.kt} | 2 +- ...MyInfoUseCase.kt => FetchMyInfoUseCase.kt} | 2 +- .../agency/search/AgencySearchViewModel.kt | 10 +++++---- .../com/example/member/MemberViewModel.kt | 6 ++--- .../feature/mymong/main/MyMongViewModel.kt | 6 ++--- .../feature/sign/viewmodel/SignUpViewModel.kt | 5 +---- 9 files changed, 30 insertions(+), 31 deletions(-) delete mode 100644 app/src/main/java/com/moneymong/moneymong/navigation/MoneyMongNavHost.kt rename domain/src/main/java/com/moneymong/moneymong/domain/usecase/agency/{GetAgenciesUseCase.kt => FetchAgenciesUseCase.kt} (90%) rename domain/src/main/java/com/moneymong/moneymong/domain/usecase/user/{GetMyInfoUseCase.kt => FetchMyInfoUseCase.kt} (88%) diff --git a/app/src/main/java/com/moneymong/moneymong/navigation/MoneyMongNavHost.kt b/app/src/main/java/com/moneymong/moneymong/navigation/MoneyMongNavHost.kt deleted file mode 100644 index e69de29b..00000000 diff --git a/core/network/src/main/java/com/moneymong/moneymong/network/util/MoneyMongTokenAuthenticator.kt b/core/network/src/main/java/com/moneymong/moneymong/network/util/MoneyMongTokenAuthenticator.kt index 24123b6e..1a599a89 100644 --- a/core/network/src/main/java/com/moneymong/moneymong/network/util/MoneyMongTokenAuthenticator.kt +++ b/core/network/src/main/java/com/moneymong/moneymong/network/util/MoneyMongTokenAuthenticator.kt @@ -37,14 +37,10 @@ class MoneyMongTokenAuthenticator @Inject constructor( } } .onFailure { - runBlocking { - tokenRepository.notifyTokenUpdateFailed(true) - } + tokenRepository.notifyTokenUpdateFailed(true) } }.onFailure { - runBlocking { - tokenRepository.notifyTokenUpdateFailed(true) - } + tokenRepository.notifyTokenUpdateFailed(true) } newRequest } diff --git a/data/src/main/java/com/moneymong/moneymong/data/repository/token/TokenRepositoryImpl.kt b/data/src/main/java/com/moneymong/moneymong/data/repository/token/TokenRepositoryImpl.kt index 56f222ff..a6784c7c 100644 --- a/data/src/main/java/com/moneymong/moneymong/data/repository/token/TokenRepositoryImpl.kt +++ b/data/src/main/java/com/moneymong/moneymong/data/repository/token/TokenRepositoryImpl.kt @@ -25,15 +25,19 @@ class TokenRepositoryImpl @Inject constructor( return loginLocalDataSource.getRefreshToken() } - override suspend fun postAccessToken(type: LoginType, accessToken: String): Result { - return tokenRemoteDataSource.postAccessToken(type = type, accessToken = accessToken).onSuccess { - loginLocalDataSource.setDataStore( - it.accessToken, - it.refreshToken, - it.loginSuccess, - it.schoolInfoProvided - ) - } + override suspend fun postAccessToken( + type: LoginType, + accessToken: String + ): Result { + return tokenRemoteDataSource.postAccessToken(type = type, accessToken = accessToken) + .onSuccess { + loginLocalDataSource.setDataStore( + it.accessToken, + it.refreshToken, + it.loginSuccess, + it.schoolInfoProvided + ) + } } override suspend fun getAccessToken(): Result { diff --git a/domain/src/main/java/com/moneymong/moneymong/domain/usecase/agency/GetAgenciesUseCase.kt b/domain/src/main/java/com/moneymong/moneymong/domain/usecase/agency/FetchAgenciesUseCase.kt similarity index 90% rename from domain/src/main/java/com/moneymong/moneymong/domain/usecase/agency/GetAgenciesUseCase.kt rename to domain/src/main/java/com/moneymong/moneymong/domain/usecase/agency/FetchAgenciesUseCase.kt index ef420be5..07ca5c99 100644 --- a/domain/src/main/java/com/moneymong/moneymong/domain/usecase/agency/GetAgenciesUseCase.kt +++ b/domain/src/main/java/com/moneymong/moneymong/domain/usecase/agency/FetchAgenciesUseCase.kt @@ -6,7 +6,7 @@ import com.moneymong.moneymong.model.agency.AgencyGetResponse import kotlinx.coroutines.flow.Flow import javax.inject.Inject -class GetAgenciesUseCase @Inject constructor( +class FetchAgenciesUseCase @Inject constructor( private val agencyRepository: AgencyRepository ) { operator fun invoke(): Flow> { diff --git a/domain/src/main/java/com/moneymong/moneymong/domain/usecase/user/GetMyInfoUseCase.kt b/domain/src/main/java/com/moneymong/moneymong/domain/usecase/user/FetchMyInfoUseCase.kt similarity index 88% rename from domain/src/main/java/com/moneymong/moneymong/domain/usecase/user/GetMyInfoUseCase.kt rename to domain/src/main/java/com/moneymong/moneymong/domain/usecase/user/FetchMyInfoUseCase.kt index 1a0c6d80..0ec28b5d 100644 --- a/domain/src/main/java/com/moneymong/moneymong/domain/usecase/user/GetMyInfoUseCase.kt +++ b/domain/src/main/java/com/moneymong/moneymong/domain/usecase/user/FetchMyInfoUseCase.kt @@ -4,7 +4,7 @@ import com.moneymong.moneymong.domain.repository.user.UserRepository import com.moneymong.moneymong.model.user.UserResponse import javax.inject.Inject -class GetMyInfoUseCase @Inject constructor( +class FetchMyInfoUseCase @Inject constructor( private val userRepository: UserRepository ) { suspend operator fun invoke(): Result { diff --git a/feature/agency/src/main/java/com/moneymong/moneymong/feature/agency/search/AgencySearchViewModel.kt b/feature/agency/src/main/java/com/moneymong/moneymong/feature/agency/search/AgencySearchViewModel.kt index 323d3b74..888ec65b 100644 --- a/feature/agency/src/main/java/com/moneymong/moneymong/feature/agency/search/AgencySearchViewModel.kt +++ b/feature/agency/src/main/java/com/moneymong/moneymong/feature/agency/search/AgencySearchViewModel.kt @@ -5,8 +5,9 @@ import androidx.paging.cachedIn import androidx.paging.map import com.moneymong.moneymong.common.base.BaseViewModel import com.moneymong.moneymong.common.error.MoneyMongError +import com.moneymong.moneymong.domain.usecase.agency.FetchAgenciesUseCase +import com.moneymong.moneymong.domain.usecase.agency.FetchAgencyByNameUseCase import com.moneymong.moneymong.domain.usecase.agency.FetchMyAgencyListUseCase -import com.moneymong.moneymong.domain.usecase.agency.GetAgenciesUseCase import com.moneymong.moneymong.domain.usecase.university.FetchMyUniversityUseCase import dagger.hilt.android.lifecycle.HiltViewModel import kotlinx.coroutines.async @@ -19,9 +20,10 @@ import javax.inject.Inject @HiltViewModel class AgencySearchViewModel @Inject constructor( - getAgenciesUseCase: GetAgenciesUseCase, + fetchAgenciesUseCase: FetchAgenciesUseCase, private val fetchMyAgencyListUseCase: FetchMyAgencyListUseCase, - private val fetchMyUniversityUseCase: FetchMyUniversityUseCase + private val fetchMyUniversityUseCase: FetchMyUniversityUseCase, + private val fetchAgencyByNameUseCase: FetchAgencyByNameUseCase, ) : BaseViewModel(AgencySearchState()) { fun navigateToRegister() = intent { @@ -31,7 +33,7 @@ class AgencySearchViewModel @Inject constructor( fun navigateToJoin(agencyId: Long) = eventEmit(sideEffect = AgencySearchSideEffect.NavigateToAgencyJoin(agencyId)) - val agencies = getAgenciesUseCase().map { pagingData -> + val agencies = fetchAgenciesUseCase().map { pagingData -> pagingData.map { it.toAgency() } diff --git a/feature/member/src/main/java/com/example/member/MemberViewModel.kt b/feature/member/src/main/java/com/example/member/MemberViewModel.kt index 460f31b7..49ab1ec2 100644 --- a/feature/member/src/main/java/com/example/member/MemberViewModel.kt +++ b/feature/member/src/main/java/com/example/member/MemberViewModel.kt @@ -9,7 +9,7 @@ import com.moneymong.moneymong.domain.usecase.member.MemberInvitationCodeUseCase import com.moneymong.moneymong.domain.usecase.member.MemberListUseCase import com.moneymong.moneymong.domain.usecase.member.MemberReInvitationCodeUseCase import com.moneymong.moneymong.domain.usecase.member.UpdateMemberAuthorUseCase -import com.moneymong.moneymong.domain.usecase.user.GetMyInfoUseCase +import com.moneymong.moneymong.domain.usecase.user.FetchMyInfoUseCase import com.moneymong.moneymong.model.agency.MyAgencyResponse import com.moneymong.moneymong.model.member.AgencyUser import com.moneymong.moneymong.model.member.MemberBlockRequest @@ -26,7 +26,7 @@ class MemberViewModel @Inject constructor( private val memberInvitationCodeUseCase: MemberInvitationCodeUseCase, private val memberReInvitationCodeUseCase: MemberReInvitationCodeUseCase, private val memberListUseCase: MemberListUseCase, - private val getMyInfoUseCase: GetMyInfoUseCase, + private val fetchMyInfoUseCase: FetchMyInfoUseCase, private val updateMemberAuthorUseCase: UpdateMemberAuthorUseCase, private val memberBlockUseCase: MemberBlockUseCase, private val fetchAgencyIdUseCase: FetchAgencyIdUseCase, @@ -224,7 +224,7 @@ class MemberViewModel @Inject constructor( } fun getMyInfo() = intent { - getMyInfoUseCase.invoke() + fetchMyInfoUseCase.invoke() .onSuccess { reduce { state.copy( diff --git a/feature/mymong/src/main/java/com/moneymong/moneymong/feature/mymong/main/MyMongViewModel.kt b/feature/mymong/src/main/java/com/moneymong/moneymong/feature/mymong/main/MyMongViewModel.kt index a93db28e..3f865650 100644 --- a/feature/mymong/src/main/java/com/moneymong/moneymong/feature/mymong/main/MyMongViewModel.kt +++ b/feature/mymong/src/main/java/com/moneymong/moneymong/feature/mymong/main/MyMongViewModel.kt @@ -3,7 +3,7 @@ package com.moneymong.moneymong.feature.mymong.main import com.moneymong.moneymong.common.base.BaseViewModel import com.moneymong.moneymong.common.error.MoneyMongError import com.moneymong.moneymong.domain.usecase.agency.SaveAgencyIdUseCase -import com.moneymong.moneymong.domain.usecase.user.GetMyInfoUseCase +import com.moneymong.moneymong.domain.usecase.user.FetchMyInfoUseCase import com.moneymong.moneymong.domain.usecase.user.LogoutUseCase import com.moneymong.moneymong.domain.usecase.user.SaveDeniedCameraPermissionUseCase import com.moneymong.moneymong.domain.usecase.user.SaveUserIdUseCase @@ -15,7 +15,7 @@ import javax.inject.Inject @HiltViewModel class MyMongViewModel @Inject constructor( - private val getMyInfoUseCase: GetMyInfoUseCase, + private val fetchMyInfoUseCase: FetchMyInfoUseCase, private val logoutUseCase: LogoutUseCase, private val saveAgencyIdUseCase: SaveAgencyIdUseCase, private val saveUserIdUseCase: SaveUserIdUseCase, @@ -42,7 +42,7 @@ class MyMongViewModel @Inject constructor( isInfoError = false, ) } - getMyInfoUseCase() + fetchMyInfoUseCase() .also { reduce { state.copy(isInfoLoading = false) diff --git a/feature/sign/src/main/java/com/moneymong/moneymong/feature/sign/viewmodel/SignUpViewModel.kt b/feature/sign/src/main/java/com/moneymong/moneymong/feature/sign/viewmodel/SignUpViewModel.kt index 85fe8a43..591453f2 100644 --- a/feature/sign/src/main/java/com/moneymong/moneymong/feature/sign/viewmodel/SignUpViewModel.kt +++ b/feature/sign/src/main/java/com/moneymong/moneymong/feature/sign/viewmodel/SignUpViewModel.kt @@ -11,8 +11,6 @@ import com.moneymong.moneymong.feature.sign.state.SignUpState import com.moneymong.moneymong.feature.sign.util.Grade import com.moneymong.moneymong.model.sign.UnivRequest import dagger.hilt.android.lifecycle.HiltViewModel -import kotlinx.coroutines.CoroutineScope -import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.launch import org.orbitmvi.orbit.annotation.OrbitExperimental import org.orbitmvi.orbit.syntax.simple.blockingIntent @@ -65,7 +63,7 @@ class SignUpViewModel @Inject constructor( } } - fun storeSchoolInfoProvided(infoExist : Boolean ){ + fun storeSchoolInfoProvided(infoExist: Boolean) { viewModelScope.launch { schoolInfoUseCase.invoke(infoExist) } @@ -177,5 +175,4 @@ class SignUpViewModel @Inject constructor( ) } } - } \ No newline at end of file From efaf717366b873a0b1b16a92ed8d65da8e060545 Mon Sep 17 00:00:00 2001 From: jhg3410 Date: Sat, 23 Nov 2024 21:48:15 +0900 Subject: [PATCH 05/30] =?UTF-8?q?=EC=86=8C=EC=86=8D=20=EA=B2=80=EC=83=89?= =?UTF-8?q?=20TextField=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../searchbar/AgencySearchTextField.kt | 93 +++++++++++++++++++ 1 file changed, 93 insertions(+) create mode 100644 feature/agency/src/main/java/com/moneymong/moneymong/feature/agency/search/component/searchbar/AgencySearchTextField.kt diff --git a/feature/agency/src/main/java/com/moneymong/moneymong/feature/agency/search/component/searchbar/AgencySearchTextField.kt b/feature/agency/src/main/java/com/moneymong/moneymong/feature/agency/search/component/searchbar/AgencySearchTextField.kt new file mode 100644 index 00000000..d35e352b --- /dev/null +++ b/feature/agency/src/main/java/com/moneymong/moneymong/feature/agency/search/component/searchbar/AgencySearchTextField.kt @@ -0,0 +1,93 @@ +package com.moneymong.moneymong.feature.agency.search.component.searchbar + +import androidx.compose.foundation.background +import androidx.compose.foundation.border +import androidx.compose.foundation.layout.Box +import androidx.compose.foundation.layout.Row +import androidx.compose.foundation.layout.Spacer +import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.size +import androidx.compose.foundation.shape.RoundedCornerShape +import androidx.compose.foundation.text.BasicTextField +import androidx.compose.foundation.text.KeyboardOptions +import androidx.compose.foundation.text.input.TextFieldState +import androidx.compose.foundation.text.input.rememberTextFieldState +import androidx.compose.material3.Icon +import androidx.compose.material3.Text +import androidx.compose.runtime.Composable +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.draw.clip +import androidx.compose.ui.graphics.vector.ImageVector +import androidx.compose.ui.res.vectorResource +import androidx.compose.ui.text.input.ImeAction +import androidx.compose.ui.tooling.preview.Preview +import androidx.compose.ui.unit.dp +import com.moneymong.moneymong.common.ui.noRippleClickable +import com.moneymong.moneymong.design_system.theme.Blue04 +import com.moneymong.moneymong.design_system.theme.Body2 +import com.moneymong.moneymong.design_system.theme.Gray04 +import com.moneymong.moneymong.design_system.theme.Gray05 +import com.moneymong.moneymong.design_system.theme.Gray09 +import com.moneymong.moneymong.design_system.theme.MMTheme +import com.moneymong.moneymong.design_system.theme.White +import com.moneymong.moneymong.design_system.R as MDSR + +@Composable +internal fun AgencySearchTextField( + modifier: Modifier = Modifier, + state: TextFieldState, + onSearch: () -> Unit, + onClear: () -> Unit, +) { + + BasicTextField( + modifier = modifier, + state = state, + keyboardOptions = KeyboardOptions.Default.copy(imeAction = ImeAction.Search), + onKeyboardAction = { onSearch() }, + decorator = { innerTextField -> + Row( + modifier = Modifier + .clip(RoundedCornerShape(8.dp)) + .background(color = White) + .border(width = 1.dp, color = Blue04, shape = RoundedCornerShape(8.dp)) + .padding(vertical = 10.dp, horizontal = 12.dp), + verticalAlignment = Alignment.CenterVertically, + ) { + Box { + innerTextField() + if (state.text.isEmpty()) { + Text( + text = "소속을 검색해 보세요", + color = Gray05, + style = Body2 + ) + } + } + Spacer(modifier = Modifier.weight(1f)) + Icon( + modifier = Modifier + .size(20.dp) + .noRippleClickable { onClear() }, + imageVector = ImageVector.vectorResource(id = MDSR.drawable.ic_close_default), + contentDescription = "Clear Search Text", + tint = Gray04, + ) + } + }, + textStyle = Body2.copy(color = Gray09) + ) +} + +@Preview +@Composable +private fun SearchTextFieldPreview() { + MMTheme { + AgencySearchTextField( + state = rememberTextFieldState(), + onSearch = { }, + onClear = { } + ) + } +} \ No newline at end of file From 1e10b20cd4c295e349bc3ca7dc086b2979867635 Mon Sep 17 00:00:00 2001 From: jhg3410 Date: Sat, 23 Nov 2024 21:49:05 +0900 Subject: [PATCH 06/30] =?UTF-8?q?=EC=86=8C=EC=86=8D=20=EA=B2=80=EC=83=89?= =?UTF-8?q?=EB=B0=94=20UI=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../component/searchbar/AgencySearchBar.kt | 58 +++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 feature/agency/src/main/java/com/moneymong/moneymong/feature/agency/search/component/searchbar/AgencySearchBar.kt diff --git a/feature/agency/src/main/java/com/moneymong/moneymong/feature/agency/search/component/searchbar/AgencySearchBar.kt b/feature/agency/src/main/java/com/moneymong/moneymong/feature/agency/search/component/searchbar/AgencySearchBar.kt new file mode 100644 index 00000000..d2a2160d --- /dev/null +++ b/feature/agency/src/main/java/com/moneymong/moneymong/feature/agency/search/component/searchbar/AgencySearchBar.kt @@ -0,0 +1,58 @@ +package com.moneymong.moneymong.feature.agency.search.component.searchbar + +import androidx.compose.foundation.layout.Row +import androidx.compose.foundation.layout.Spacer +import androidx.compose.foundation.layout.width +import androidx.compose.foundation.text.input.TextFieldState +import androidx.compose.foundation.text.input.rememberTextFieldState +import androidx.compose.material3.Text +import androidx.compose.runtime.Composable +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.tooling.preview.Preview +import androidx.compose.ui.unit.dp +import com.moneymong.moneymong.common.ui.noRippleClickable +import com.moneymong.moneymong.design_system.theme.Body2 +import com.moneymong.moneymong.design_system.theme.Gray08 +import com.moneymong.moneymong.design_system.theme.MMTheme + +@Composable +internal fun AgencySearchBar( + modifier: Modifier = Modifier, + state: TextFieldState, + onSearch: () -> Unit, + onCancel: () -> Unit, + onClear: () -> Unit +) { + Row( + modifier = modifier, + verticalAlignment = Alignment.CenterVertically + ) { + AgencySearchTextField( + modifier = Modifier.weight(1f), + state = state, + onSearch = onSearch, + onClear = onClear + ) + Spacer(modifier = Modifier.width(10.dp)) + Text( + modifier = Modifier.noRippleClickable { onCancel() }, + text = "취소", + style = Body2, + color = Gray08 + ) + } +} + +@Preview +@Composable +private fun SearchBarPreview() { + MMTheme { + AgencySearchBar( + state = rememberTextFieldState(), + onSearch = {}, + onClear = {}, + onCancel = {}, + ) + } +} \ No newline at end of file From a08f03fb6ebd87dccae12f6a5b49b3ac1ae49039 Mon Sep 17 00:00:00 2001 From: jhg3410 Date: Sat, 23 Nov 2024 22:33:01 +0900 Subject: [PATCH 07/30] =?UTF-8?q?=EC=86=8C=EC=86=8D=20=EC=B0=BE=EA=B8=B0?= =?UTF-8?q?=20=EA=B2=80=EC=83=89=20Icon=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../agency/search/AgencySearchScreen.kt | 4 +- .../search/component/AgencySearchTopBar.kt | 43 ++++++++++++++++--- 2 files changed, 39 insertions(+), 8 deletions(-) diff --git a/feature/agency/src/main/java/com/moneymong/moneymong/feature/agency/search/AgencySearchScreen.kt b/feature/agency/src/main/java/com/moneymong/moneymong/feature/agency/search/AgencySearchScreen.kt index 8e3592d9..bc6cebb1 100644 --- a/feature/agency/src/main/java/com/moneymong/moneymong/feature/agency/search/AgencySearchScreen.kt +++ b/feature/agency/src/main/java/com/moneymong/moneymong/feature/agency/search/AgencySearchScreen.kt @@ -98,7 +98,9 @@ fun AgencySearchScreen( modifier = Modifier.fillMaxSize(), horizontalAlignment = Alignment.CenterHorizontally ) { - AgencySearchTopBar() + AgencySearchTopBar( + onSearchIconClick = {} + ) AgencySearchContentView( modifier = Modifier.weight(1f), pagingItems = pagingItems, diff --git a/feature/agency/src/main/java/com/moneymong/moneymong/feature/agency/search/component/AgencySearchTopBar.kt b/feature/agency/src/main/java/com/moneymong/moneymong/feature/agency/search/component/AgencySearchTopBar.kt index 10aa1c30..9bbe55ef 100644 --- a/feature/agency/src/main/java/com/moneymong/moneymong/feature/agency/search/component/AgencySearchTopBar.kt +++ b/feature/agency/src/main/java/com/moneymong/moneymong/feature/agency/search/component/AgencySearchTopBar.kt @@ -1,21 +1,50 @@ package com.moneymong.moneymong.feature.agency.search.component +import androidx.compose.foundation.layout.Box +import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.size +import androidx.compose.material3.Icon import androidx.compose.material3.Text import androidx.compose.runtime.Composable +import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier +import androidx.compose.ui.graphics.vector.ImageVector +import androidx.compose.ui.res.vectorResource +import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp import com.moneymong.moneymong.design_system.theme.Gray10 import com.moneymong.moneymong.design_system.theme.Heading1 +import com.moneymong.moneymong.design_system.R as MDSR @Composable -fun AgencySearchTopBar( +internal fun AgencySearchTopBar( modifier: Modifier = Modifier, + onSearchIconClick: () -> Unit ) { - Text( - modifier = modifier.padding(vertical = 16.dp), - text = "소속 찾기", - color = Gray10, - style = Heading1 - ) + Box( + modifier = modifier + .fillMaxWidth() + .padding(vertical = 16.dp), + ) { + Text( + modifier = Modifier.align(Alignment.Center), + text = "소속 찾기", + color = Gray10, + style = Heading1 + ) + Icon( + modifier = Modifier + .size(24.dp) + .align(Alignment.CenterEnd), + imageVector = ImageVector.vectorResource(id = MDSR.drawable.ic_search), + contentDescription = "검색", + ) + } +} + +@Preview +@Composable +private fun AgencySearchTopBarPreview() { + AgencySearchTopBar(onSearchIconClick = {}) } \ No newline at end of file From ad4abadf1554370d38975070ce5f94801e3fcee3 Mon Sep 17 00:00:00 2001 From: jhg3410 Date: Sun, 24 Nov 2024 11:52:30 +0900 Subject: [PATCH 08/30] =?UTF-8?q?=EC=86=8C=EC=86=8D=20=EA=B2=80=EC=83=89?= =?UTF-8?q?=EB=B0=94=20=EC=A0=81=EC=9A=A9=20=EB=B0=8F=20clear=20=EA=B8=B0?= =?UTF-8?q?=EB=8A=A5=20=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../moneymong/feature/agency/search/AgencySearchScreen.kt | 8 ++++++++ .../moneymong/feature/agency/search/AgencySearchState.kt | 4 +++- .../feature/agency/search/AgencySearchViewModel.kt | 5 +++++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/feature/agency/src/main/java/com/moneymong/moneymong/feature/agency/search/AgencySearchScreen.kt b/feature/agency/src/main/java/com/moneymong/moneymong/feature/agency/search/AgencySearchScreen.kt index bc6cebb1..9559f76b 100644 --- a/feature/agency/src/main/java/com/moneymong/moneymong/feature/agency/search/AgencySearchScreen.kt +++ b/feature/agency/src/main/java/com/moneymong/moneymong/feature/agency/search/AgencySearchScreen.kt @@ -45,6 +45,7 @@ import com.moneymong.moneymong.design_system.theme.Gray07 import com.moneymong.moneymong.design_system.theme.MMHorizontalSpacing import com.moneymong.moneymong.design_system.theme.Red03 import com.moneymong.moneymong.feature.agency.search.component.AgencySearchTopBar +import com.moneymong.moneymong.feature.agency.search.component.searchbar.AgencySearchBar import com.moneymong.moneymong.feature.agency.search.item.AgencyFeedbackItem import com.moneymong.moneymong.feature.agency.search.item.AgencyItem import org.orbitmvi.orbit.compose.collectAsState @@ -101,6 +102,13 @@ fun AgencySearchScreen( AgencySearchTopBar( onSearchIconClick = {} ) + AgencySearchBar( + state = state.searchTextFieldState, + onSearch = {}, + onClear = viewModel::clearSearchTextField, + onCancel = {}, + ) + Spacer(modifier = Modifier.height(16.dp)) AgencySearchContentView( modifier = Modifier.weight(1f), pagingItems = pagingItems, diff --git a/feature/agency/src/main/java/com/moneymong/moneymong/feature/agency/search/AgencySearchState.kt b/feature/agency/src/main/java/com/moneymong/moneymong/feature/agency/search/AgencySearchState.kt index 2feee998..ed60dd03 100644 --- a/feature/agency/src/main/java/com/moneymong/moneymong/feature/agency/search/AgencySearchState.kt +++ b/feature/agency/src/main/java/com/moneymong/moneymong/feature/agency/search/AgencySearchState.kt @@ -1,5 +1,6 @@ package com.moneymong.moneymong.feature.agency.search +import androidx.compose.foundation.text.input.TextFieldState import com.moneymong.moneymong.common.base.State data class AgencySearchState( @@ -8,7 +9,8 @@ data class AgencySearchState( val isError: Boolean = false, val errorMessage: String = "", val visibleWarningDialog: Boolean = false, - val isUniversityStudent: Boolean = false + val isUniversityStudent: Boolean = false, + val searchTextFieldState: TextFieldState = TextFieldState() ) : State { val joinedAgenciesIds: List diff --git a/feature/agency/src/main/java/com/moneymong/moneymong/feature/agency/search/AgencySearchViewModel.kt b/feature/agency/src/main/java/com/moneymong/moneymong/feature/agency/search/AgencySearchViewModel.kt index 888ec65b..9ef54886 100644 --- a/feature/agency/src/main/java/com/moneymong/moneymong/feature/agency/search/AgencySearchViewModel.kt +++ b/feature/agency/src/main/java/com/moneymong/moneymong/feature/agency/search/AgencySearchViewModel.kt @@ -1,5 +1,6 @@ package com.moneymong.moneymong.feature.agency.search +import androidx.compose.foundation.text.input.clearText import androidx.lifecycle.viewModelScope import androidx.paging.cachedIn import androidx.paging.map @@ -84,6 +85,10 @@ class AgencySearchViewModel @Inject constructor( } } + fun clearSearchTextField() = intent { + state.searchTextFieldState.clearText() + } + fun changeVisibleWarningDialog(visible: Boolean) = intent { reduce { state.copy(visibleWarningDialog = visible) From 78cd8876795002650a8a5d2bfb4d6da7df0448f6 Mon Sep 17 00:00:00 2001 From: jhg3410 Date: Sun, 24 Nov 2024 12:04:56 +0900 Subject: [PATCH 09/30] =?UTF-8?q?=EC=86=8C=EC=86=8D=20=EA=B2=80=EC=83=89?= =?UTF-8?q?=EB=B0=94=20Visible=20=EC=B2=98=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../feature/agency/search/AgencySearchScreen.kt | 16 +++++++++------- .../feature/agency/search/AgencySearchState.kt | 3 ++- .../agency/search/AgencySearchViewModel.kt | 6 ++++++ .../search/component/AgencySearchTopBar.kt | 4 +++- 4 files changed, 20 insertions(+), 9 deletions(-) diff --git a/feature/agency/src/main/java/com/moneymong/moneymong/feature/agency/search/AgencySearchScreen.kt b/feature/agency/src/main/java/com/moneymong/moneymong/feature/agency/search/AgencySearchScreen.kt index 9559f76b..2560dcc2 100644 --- a/feature/agency/src/main/java/com/moneymong/moneymong/feature/agency/search/AgencySearchScreen.kt +++ b/feature/agency/src/main/java/com/moneymong/moneymong/feature/agency/search/AgencySearchScreen.kt @@ -100,14 +100,16 @@ fun AgencySearchScreen( horizontalAlignment = Alignment.CenterHorizontally ) { AgencySearchTopBar( - onSearchIconClick = {} - ) - AgencySearchBar( - state = state.searchTextFieldState, - onSearch = {}, - onClear = viewModel::clearSearchTextField, - onCancel = {}, + onSearchIconClick = viewModel::toggleVisibilitySearchBar ) + if (state.visibleSearchBar) { + AgencySearchBar( + state = state.searchTextFieldState, + onSearch = {}, + onClear = viewModel::clearSearchTextField, + onCancel = viewModel::toggleVisibilitySearchBar, + ) + } Spacer(modifier = Modifier.height(16.dp)) AgencySearchContentView( modifier = Modifier.weight(1f), diff --git a/feature/agency/src/main/java/com/moneymong/moneymong/feature/agency/search/AgencySearchState.kt b/feature/agency/src/main/java/com/moneymong/moneymong/feature/agency/search/AgencySearchState.kt index ed60dd03..8d20e4c3 100644 --- a/feature/agency/src/main/java/com/moneymong/moneymong/feature/agency/search/AgencySearchState.kt +++ b/feature/agency/src/main/java/com/moneymong/moneymong/feature/agency/search/AgencySearchState.kt @@ -10,7 +10,8 @@ data class AgencySearchState( val errorMessage: String = "", val visibleWarningDialog: Boolean = false, val isUniversityStudent: Boolean = false, - val searchTextFieldState: TextFieldState = TextFieldState() + val visibleSearchBar: Boolean = false, + val searchTextFieldState: TextFieldState = TextFieldState(), ) : State { val joinedAgenciesIds: List diff --git a/feature/agency/src/main/java/com/moneymong/moneymong/feature/agency/search/AgencySearchViewModel.kt b/feature/agency/src/main/java/com/moneymong/moneymong/feature/agency/search/AgencySearchViewModel.kt index 9ef54886..778b5ae2 100644 --- a/feature/agency/src/main/java/com/moneymong/moneymong/feature/agency/search/AgencySearchViewModel.kt +++ b/feature/agency/src/main/java/com/moneymong/moneymong/feature/agency/search/AgencySearchViewModel.kt @@ -85,6 +85,12 @@ class AgencySearchViewModel @Inject constructor( } } + fun toggleVisibilitySearchBar() = intent { + reduce { + state.copy(visibleSearchBar = state.visibleSearchBar.not()) + } + } + fun clearSearchTextField() = intent { state.searchTextFieldState.clearText() } diff --git a/feature/agency/src/main/java/com/moneymong/moneymong/feature/agency/search/component/AgencySearchTopBar.kt b/feature/agency/src/main/java/com/moneymong/moneymong/feature/agency/search/component/AgencySearchTopBar.kt index 9bbe55ef..48f5dc7c 100644 --- a/feature/agency/src/main/java/com/moneymong/moneymong/feature/agency/search/component/AgencySearchTopBar.kt +++ b/feature/agency/src/main/java/com/moneymong/moneymong/feature/agency/search/component/AgencySearchTopBar.kt @@ -13,6 +13,7 @@ import androidx.compose.ui.graphics.vector.ImageVector import androidx.compose.ui.res.vectorResource import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp +import com.moneymong.moneymong.common.ui.noRippleClickable import com.moneymong.moneymong.design_system.theme.Gray10 import com.moneymong.moneymong.design_system.theme.Heading1 import com.moneymong.moneymong.design_system.R as MDSR @@ -36,7 +37,8 @@ internal fun AgencySearchTopBar( Icon( modifier = Modifier .size(24.dp) - .align(Alignment.CenterEnd), + .align(Alignment.CenterEnd) + .noRippleClickable { onSearchIconClick() }, imageVector = ImageVector.vectorResource(id = MDSR.drawable.ic_search), contentDescription = "검색", ) From b287e68377d474fbf6eb61dd00d24a359cb81665 Mon Sep 17 00:00:00 2001 From: jhg3410 Date: Sun, 24 Nov 2024 12:49:29 +0900 Subject: [PATCH 10/30] =?UTF-8?q?=EC=86=8C=EC=86=8D=20TopBar=20Icon=20Anim?= =?UTF-8?q?ation=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../agency/search/AgencySearchScreen.kt | 3 +- .../search/component/AgencySearchTopBar.kt | 53 ++++++++++++++----- 2 files changed, 41 insertions(+), 15 deletions(-) diff --git a/feature/agency/src/main/java/com/moneymong/moneymong/feature/agency/search/AgencySearchScreen.kt b/feature/agency/src/main/java/com/moneymong/moneymong/feature/agency/search/AgencySearchScreen.kt index 2560dcc2..b506e029 100644 --- a/feature/agency/src/main/java/com/moneymong/moneymong/feature/agency/search/AgencySearchScreen.kt +++ b/feature/agency/src/main/java/com/moneymong/moneymong/feature/agency/search/AgencySearchScreen.kt @@ -100,7 +100,8 @@ fun AgencySearchScreen( horizontalAlignment = Alignment.CenterHorizontally ) { AgencySearchTopBar( - onSearchIconClick = viewModel::toggleVisibilitySearchBar + onSearchIconClick = viewModel::toggleVisibilitySearchBar, + visibleSearchIcon = state.visibleSearchBar.not() ) if (state.visibleSearchBar) { AgencySearchBar( diff --git a/feature/agency/src/main/java/com/moneymong/moneymong/feature/agency/search/component/AgencySearchTopBar.kt b/feature/agency/src/main/java/com/moneymong/moneymong/feature/agency/search/component/AgencySearchTopBar.kt index 48f5dc7c..8c6d059d 100644 --- a/feature/agency/src/main/java/com/moneymong/moneymong/feature/agency/search/component/AgencySearchTopBar.kt +++ b/feature/agency/src/main/java/com/moneymong/moneymong/feature/agency/search/component/AgencySearchTopBar.kt @@ -1,5 +1,10 @@ package com.moneymong.moneymong.feature.agency.search.component +import androidx.compose.animation.AnimatedVisibility +import androidx.compose.animation.core.FastOutSlowInEasing +import androidx.compose.animation.core.tween +import androidx.compose.animation.fadeIn +import androidx.compose.animation.fadeOut import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding @@ -21,32 +26,52 @@ import com.moneymong.moneymong.design_system.R as MDSR @Composable internal fun AgencySearchTopBar( modifier: Modifier = Modifier, - onSearchIconClick: () -> Unit + onSearchIconClick: () -> Unit, + visibleSearchIcon: Boolean, ) { Box( - modifier = modifier - .fillMaxWidth() - .padding(vertical = 16.dp), + modifier = modifier.fillMaxWidth() ) { Text( - modifier = Modifier.align(Alignment.Center), + modifier = Modifier + .align(Alignment.Center) + .padding(vertical = 16.dp), text = "소속 찾기", color = Gray10, style = Heading1 ) - Icon( - modifier = Modifier - .size(24.dp) - .align(Alignment.CenterEnd) - .noRippleClickable { onSearchIconClick() }, - imageVector = ImageVector.vectorResource(id = MDSR.drawable.ic_search), - contentDescription = "검색", - ) + AnimatedVisibility( + modifier = Modifier.align(Alignment.CenterEnd), + visible = visibleSearchIcon, + enter = fadeIn( + animationSpec = tween( + durationMillis = 300, + easing = FastOutSlowInEasing + ) + ), + exit = fadeOut( + animationSpec = tween( + durationMillis = 300, + easing = FastOutSlowInEasing + ) + ) + ) { + Icon( + modifier = Modifier + .size(24.dp) + .noRippleClickable { onSearchIconClick() }, + imageVector = ImageVector.vectorResource(id = MDSR.drawable.ic_search), + contentDescription = "검색", + ) + } } } @Preview @Composable private fun AgencySearchTopBarPreview() { - AgencySearchTopBar(onSearchIconClick = {}) + AgencySearchTopBar( + onSearchIconClick = {}, + visibleSearchIcon = true + ) } \ No newline at end of file From 7b3d220be14ddf7898ea4ac2a4d949314a3f011b Mon Sep 17 00:00:00 2001 From: jhg3410 Date: Sun, 24 Nov 2024 12:52:23 +0900 Subject: [PATCH 11/30] =?UTF-8?q?=EC=86=8C=EC=86=8D=20=EA=B2=80=EC=83=89?= =?UTF-8?q?=EB=B0=94=20Animation=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../agency/search/AgencySearchScreen.kt | 15 +++--- .../search/component/AgencySearchTopBar.kt | 17 ++----- .../component/searchbar/AgencySearchBar.kt | 47 +++++++++++++------ 3 files changed, 44 insertions(+), 35 deletions(-) diff --git a/feature/agency/src/main/java/com/moneymong/moneymong/feature/agency/search/AgencySearchScreen.kt b/feature/agency/src/main/java/com/moneymong/moneymong/feature/agency/search/AgencySearchScreen.kt index b506e029..90456661 100644 --- a/feature/agency/src/main/java/com/moneymong/moneymong/feature/agency/search/AgencySearchScreen.kt +++ b/feature/agency/src/main/java/com/moneymong/moneymong/feature/agency/search/AgencySearchScreen.kt @@ -103,14 +103,13 @@ fun AgencySearchScreen( onSearchIconClick = viewModel::toggleVisibilitySearchBar, visibleSearchIcon = state.visibleSearchBar.not() ) - if (state.visibleSearchBar) { - AgencySearchBar( - state = state.searchTextFieldState, - onSearch = {}, - onClear = viewModel::clearSearchTextField, - onCancel = viewModel::toggleVisibilitySearchBar, - ) - } + AgencySearchBar( + state = state.searchTextFieldState, + visible = state.visibleSearchBar, + onSearch = {}, + onClear = viewModel::clearSearchTextField, + onCancel = viewModel::toggleVisibilitySearchBar, + ) Spacer(modifier = Modifier.height(16.dp)) AgencySearchContentView( modifier = Modifier.weight(1f), diff --git a/feature/agency/src/main/java/com/moneymong/moneymong/feature/agency/search/component/AgencySearchTopBar.kt b/feature/agency/src/main/java/com/moneymong/moneymong/feature/agency/search/component/AgencySearchTopBar.kt index 8c6d059d..7ef1ac89 100644 --- a/feature/agency/src/main/java/com/moneymong/moneymong/feature/agency/search/component/AgencySearchTopBar.kt +++ b/feature/agency/src/main/java/com/moneymong/moneymong/feature/agency/search/component/AgencySearchTopBar.kt @@ -29,6 +29,9 @@ internal fun AgencySearchTopBar( onSearchIconClick: () -> Unit, visibleSearchIcon: Boolean, ) { + val animationSpec = tween( + durationMillis = 300, easing = FastOutSlowInEasing + ) Box( modifier = modifier.fillMaxWidth() ) { @@ -43,18 +46,8 @@ internal fun AgencySearchTopBar( AnimatedVisibility( modifier = Modifier.align(Alignment.CenterEnd), visible = visibleSearchIcon, - enter = fadeIn( - animationSpec = tween( - durationMillis = 300, - easing = FastOutSlowInEasing - ) - ), - exit = fadeOut( - animationSpec = tween( - durationMillis = 300, - easing = FastOutSlowInEasing - ) - ) + enter = fadeIn(animationSpec = animationSpec), + exit = fadeOut(animationSpec = animationSpec) ) { Icon( modifier = Modifier diff --git a/feature/agency/src/main/java/com/moneymong/moneymong/feature/agency/search/component/searchbar/AgencySearchBar.kt b/feature/agency/src/main/java/com/moneymong/moneymong/feature/agency/search/component/searchbar/AgencySearchBar.kt index d2a2160d..81af424c 100644 --- a/feature/agency/src/main/java/com/moneymong/moneymong/feature/agency/search/component/searchbar/AgencySearchBar.kt +++ b/feature/agency/src/main/java/com/moneymong/moneymong/feature/agency/search/component/searchbar/AgencySearchBar.kt @@ -1,5 +1,10 @@ package com.moneymong.moneymong.feature.agency.search.component.searchbar +import androidx.compose.animation.AnimatedVisibility +import androidx.compose.animation.core.FastOutSlowInEasing +import androidx.compose.animation.core.tween +import androidx.compose.animation.fadeIn +import androidx.compose.animation.fadeOut import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.width @@ -20,27 +25,38 @@ import com.moneymong.moneymong.design_system.theme.MMTheme internal fun AgencySearchBar( modifier: Modifier = Modifier, state: TextFieldState, + visible: Boolean, onSearch: () -> Unit, onCancel: () -> Unit, onClear: () -> Unit ) { - Row( + val animationSpec = tween( + durationMillis = 300, + easing = FastOutSlowInEasing + ) + AnimatedVisibility( modifier = modifier, - verticalAlignment = Alignment.CenterVertically + visible = visible, + enter = fadeIn(animationSpec = animationSpec), + exit = fadeOut(animationSpec = animationSpec) ) { - AgencySearchTextField( - modifier = Modifier.weight(1f), - state = state, - onSearch = onSearch, - onClear = onClear - ) - Spacer(modifier = Modifier.width(10.dp)) - Text( - modifier = Modifier.noRippleClickable { onCancel() }, - text = "취소", - style = Body2, - color = Gray08 - ) + Row( + verticalAlignment = Alignment.CenterVertically + ) { + AgencySearchTextField( + modifier = Modifier.weight(1f), + state = state, + onSearch = onSearch, + onClear = onClear + ) + Spacer(modifier = Modifier.width(10.dp)) + Text( + modifier = Modifier.noRippleClickable { onCancel() }, + text = "취소", + style = Body2, + color = Gray08 + ) + } } } @@ -50,6 +66,7 @@ private fun SearchBarPreview() { MMTheme { AgencySearchBar( state = rememberTextFieldState(), + visible = true, onSearch = {}, onClear = {}, onCancel = {}, From a659eb15ab25182b5b8ff08e75d2eb2ff4636f7b Mon Sep 17 00:00:00 2001 From: jhg3410 Date: Mon, 25 Nov 2024 13:42:15 +0900 Subject: [PATCH 12/30] =?UTF-8?q?=EC=86=8C=EC=86=8D=20=EA=B2=80=EC=83=89?= =?UTF-8?q?=EB=B0=94=20Visible=EC=97=90=20=EB=94=B0=EB=A5=B8=20=EC=BB=A8?= =?UTF-8?q?=ED=85=90=EC=B8=A0=20Animation=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../agency/search/AgencySearchScreen.kt | 72 ++++++++++++------- .../component/searchbar/AgencySearchBar.kt | 35 ++++----- 2 files changed, 66 insertions(+), 41 deletions(-) diff --git a/feature/agency/src/main/java/com/moneymong/moneymong/feature/agency/search/AgencySearchScreen.kt b/feature/agency/src/main/java/com/moneymong/moneymong/feature/agency/search/AgencySearchScreen.kt index 90456661..78fc4343 100644 --- a/feature/agency/src/main/java/com/moneymong/moneymong/feature/agency/search/AgencySearchScreen.kt +++ b/feature/agency/src/main/java/com/moneymong/moneymong/feature/agency/search/AgencySearchScreen.kt @@ -2,6 +2,9 @@ package com.moneymong.moneymong.feature.agency.search import android.content.Intent import android.net.Uri +import androidx.compose.animation.core.LinearEasing +import androidx.compose.animation.core.animateIntAsState +import androidx.compose.animation.core.tween import androidx.compose.foundation.Image import androidx.compose.foundation.background import androidx.compose.foundation.layout.Arrangement @@ -12,17 +15,23 @@ import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height +import androidx.compose.foundation.layout.offset import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.size import androidx.compose.foundation.lazy.LazyColumn import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue +import androidx.compose.runtime.mutableIntStateOf +import androidx.compose.runtime.remember +import androidx.compose.runtime.setValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier +import androidx.compose.ui.layout.onSizeChanged import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.res.painterResource import androidx.compose.ui.text.style.TextAlign +import androidx.compose.ui.unit.IntOffset import androidx.compose.ui.unit.dp import androidx.hilt.navigation.compose.hiltViewModel import androidx.paging.LoadState @@ -89,6 +98,16 @@ fun AgencySearchScreen( ) } + var searchBarHeight by remember { mutableIntStateOf(0) } + val offsetY by animateIntAsState( + targetValue = if (state.visibleSearchBar) searchBarHeight else 0, + animationSpec = tween( + durationMillis = 300, + easing = LinearEasing + ), + label = "Content Offset Y" + ) + Box( modifier = modifier .fillMaxSize() @@ -103,30 +122,33 @@ fun AgencySearchScreen( onSearchIconClick = viewModel::toggleVisibilitySearchBar, visibleSearchIcon = state.visibleSearchBar.not() ) - AgencySearchBar( - state = state.searchTextFieldState, - visible = state.visibleSearchBar, - onSearch = {}, - onClear = viewModel::clearSearchTextField, - onCancel = viewModel::toggleVisibilitySearchBar, - ) - Spacer(modifier = Modifier.height(16.dp)) - AgencySearchContentView( - modifier = Modifier.weight(1f), - pagingItems = pagingItems, - onClickItem = { agencyId -> - if (agencyId in state.joinedAgenciesIds) { - viewModel.changeVisibleWarningDialog(true) - } else { - viewModel.navigateToJoin(agencyId) - } - }, - onClickFeedbackItem = viewModel::onClickAskFeedback, - isLoading = state.isLoading, - isError = state.isError, - errorMessage = state.errorMessage, - onRetry = viewModel::getInitialData, - ) + Spacer(modifier = Modifier.height(4.dp)) + Box(modifier = Modifier.fillMaxSize()) { + AgencySearchBar( + modifier = Modifier.onSizeChanged { searchBarHeight = it.height }, + state = state.searchTextFieldState, + visible = state.visibleSearchBar, + onSearch = {}, + onClear = viewModel::clearSearchTextField, + onCancel = viewModel::toggleVisibilitySearchBar, + ) + AgencySearchContentView( + modifier = Modifier.offset { IntOffset(x = 0, y = offsetY) }, + pagingItems = pagingItems, + onClickItem = { agencyId -> + if (agencyId in state.joinedAgenciesIds) { + viewModel.changeVisibleWarningDialog(true) + } else { + viewModel.navigateToJoin(agencyId) + } + }, + onClickFeedbackItem = viewModel::onClickAskFeedback, + isLoading = state.isLoading, + isError = state.isError, + errorMessage = state.errorMessage, + onRetry = viewModel::getInitialData, + ) + } } Column( modifier = Modifier @@ -208,7 +230,7 @@ private fun ContentViewWithAgencies( LazyColumn( modifier = modifier, verticalArrangement = Arrangement.spacedBy(12.dp), - contentPadding = PaddingValues(vertical = 4.dp) + contentPadding = PaddingValues(bottom = 4.dp) ) { item { AgencyFeedbackItem( diff --git a/feature/agency/src/main/java/com/moneymong/moneymong/feature/agency/search/component/searchbar/AgencySearchBar.kt b/feature/agency/src/main/java/com/moneymong/moneymong/feature/agency/search/component/searchbar/AgencySearchBar.kt index 81af424c..e81910cd 100644 --- a/feature/agency/src/main/java/com/moneymong/moneymong/feature/agency/search/component/searchbar/AgencySearchBar.kt +++ b/feature/agency/src/main/java/com/moneymong/moneymong/feature/agency/search/component/searchbar/AgencySearchBar.kt @@ -5,8 +5,10 @@ import androidx.compose.animation.core.FastOutSlowInEasing import androidx.compose.animation.core.tween import androidx.compose.animation.fadeIn import androidx.compose.animation.fadeOut +import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Spacer +import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.width import androidx.compose.foundation.text.input.TextFieldState import androidx.compose.foundation.text.input.rememberTextFieldState @@ -40,22 +42,23 @@ internal fun AgencySearchBar( enter = fadeIn(animationSpec = animationSpec), exit = fadeOut(animationSpec = animationSpec) ) { - Row( - verticalAlignment = Alignment.CenterVertically - ) { - AgencySearchTextField( - modifier = Modifier.weight(1f), - state = state, - onSearch = onSearch, - onClear = onClear - ) - Spacer(modifier = Modifier.width(10.dp)) - Text( - modifier = Modifier.noRippleClickable { onCancel() }, - text = "취소", - style = Body2, - color = Gray08 - ) + Column { + Row(verticalAlignment = Alignment.CenterVertically) { + AgencySearchTextField( + modifier = Modifier.weight(1f), + state = state, + onSearch = onSearch, + onClear = onClear + ) + Spacer(modifier = Modifier.width(10.dp)) + Text( + modifier = Modifier.noRippleClickable { onCancel() }, + text = "취소", + style = Body2, + color = Gray08 + ) + } + Spacer(modifier = Modifier.height(16.dp)) } } } From 7ff0d60261c4b911c0a9e3947fb097be42e2dc84 Mon Sep 17 00:00:00 2001 From: jhg3410 Date: Mon, 25 Nov 2024 14:05:25 +0900 Subject: [PATCH 13/30] =?UTF-8?q?=EC=86=8C=EC=86=8D=20=EA=B2=80=EC=83=89?= =?UTF-8?q?=EB=B0=94=20visible=20=EC=9D=BC=20=EB=95=8C=20=ED=8F=AC?= =?UTF-8?q?=EC=BB=A4=EC=8A=A4=20=EC=B2=98=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../search/component/searchbar/AgencySearchBar.kt | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/feature/agency/src/main/java/com/moneymong/moneymong/feature/agency/search/component/searchbar/AgencySearchBar.kt b/feature/agency/src/main/java/com/moneymong/moneymong/feature/agency/search/component/searchbar/AgencySearchBar.kt index e81910cd..12cb27ef 100644 --- a/feature/agency/src/main/java/com/moneymong/moneymong/feature/agency/search/component/searchbar/AgencySearchBar.kt +++ b/feature/agency/src/main/java/com/moneymong/moneymong/feature/agency/search/component/searchbar/AgencySearchBar.kt @@ -14,8 +14,12 @@ import androidx.compose.foundation.text.input.TextFieldState import androidx.compose.foundation.text.input.rememberTextFieldState import androidx.compose.material3.Text import androidx.compose.runtime.Composable +import androidx.compose.runtime.LaunchedEffect +import androidx.compose.runtime.remember import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier +import androidx.compose.ui.focus.FocusRequester +import androidx.compose.ui.focus.focusRequester import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp import com.moneymong.moneymong.common.ui.noRippleClickable @@ -32,12 +36,20 @@ internal fun AgencySearchBar( onCancel: () -> Unit, onClear: () -> Unit ) { + val focusRequester = remember { FocusRequester() } val animationSpec = tween( durationMillis = 300, easing = FastOutSlowInEasing ) + + LaunchedEffect(key1 = visible) { + if (visible) { + focusRequester.requestFocus() + } + } + AnimatedVisibility( - modifier = modifier, + modifier = modifier.focusRequester(focusRequester), visible = visible, enter = fadeIn(animationSpec = animationSpec), exit = fadeOut(animationSpec = animationSpec) From 4a4133122293ebc50cbc13b5fde5b5213d33ef4a Mon Sep 17 00:00:00 2001 From: jhg3410 Date: Mon, 25 Nov 2024 14:55:37 +0900 Subject: [PATCH 14/30] =?UTF-8?q?=EC=86=8C=EC=86=8D=20=EA=B2=80=EC=83=89?= =?UTF-8?q?=EB=B0=94=20=EA=B2=80=EC=83=89=20=EC=8B=9C=20focus=20clear?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../search/component/searchbar/AgencySearchBar.kt | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/feature/agency/src/main/java/com/moneymong/moneymong/feature/agency/search/component/searchbar/AgencySearchBar.kt b/feature/agency/src/main/java/com/moneymong/moneymong/feature/agency/search/component/searchbar/AgencySearchBar.kt index 12cb27ef..7036a45a 100644 --- a/feature/agency/src/main/java/com/moneymong/moneymong/feature/agency/search/component/searchbar/AgencySearchBar.kt +++ b/feature/agency/src/main/java/com/moneymong/moneymong/feature/agency/search/component/searchbar/AgencySearchBar.kt @@ -20,6 +20,7 @@ import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.focus.FocusRequester import androidx.compose.ui.focus.focusRequester +import androidx.compose.ui.platform.LocalFocusManager import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp import com.moneymong.moneymong.common.ui.noRippleClickable @@ -37,6 +38,7 @@ internal fun AgencySearchBar( onClear: () -> Unit ) { val focusRequester = remember { FocusRequester() } + val focusManager = LocalFocusManager.current val animationSpec = tween( durationMillis = 300, easing = FastOutSlowInEasing @@ -49,7 +51,7 @@ internal fun AgencySearchBar( } AnimatedVisibility( - modifier = modifier.focusRequester(focusRequester), + modifier = modifier, visible = visible, enter = fadeIn(animationSpec = animationSpec), exit = fadeOut(animationSpec = animationSpec) @@ -57,9 +59,14 @@ internal fun AgencySearchBar( Column { Row(verticalAlignment = Alignment.CenterVertically) { AgencySearchTextField( - modifier = Modifier.weight(1f), + modifier = Modifier + .weight(1f) + .focusRequester(focusRequester), state = state, - onSearch = onSearch, + onSearch = { + onSearch() + focusManager.clearFocus() + }, onClear = onClear ) Spacer(modifier = Modifier.width(10.dp)) From 09eaf1b94c6df730a60fde1b73767a1d7c2c955b Mon Sep 17 00:00:00 2001 From: jhg3410 Date: Mon, 25 Nov 2024 15:15:06 +0900 Subject: [PATCH 15/30] =?UTF-8?q?=EC=86=8C=EC=86=8D=20=EA=B2=80=EC=83=89?= =?UTF-8?q?=20=EA=B8=B0=EB=8A=A5=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../agency/FetchAgencyByNameUseCase.kt | 30 +------- .../agency/search/AgencySearchScreen.kt | 68 ++++++++++++++----- .../agency/search/AgencySearchState.kt | 1 + .../agency/search/AgencySearchViewModel.kt | 41 ++++++++++- 4 files changed, 93 insertions(+), 47 deletions(-) diff --git a/domain/src/main/java/com/moneymong/moneymong/domain/usecase/agency/FetchAgencyByNameUseCase.kt b/domain/src/main/java/com/moneymong/moneymong/domain/usecase/agency/FetchAgencyByNameUseCase.kt index 343d684b..0555ec0d 100644 --- a/domain/src/main/java/com/moneymong/moneymong/domain/usecase/agency/FetchAgencyByNameUseCase.kt +++ b/domain/src/main/java/com/moneymong/moneymong/domain/usecase/agency/FetchAgencyByNameUseCase.kt @@ -9,34 +9,6 @@ class FetchAgencyByNameUseCase @Inject constructor( ) { suspend operator fun invoke(agencyName: String): Result> { -// return agencyRepository.fetchAgencyBySearch() - return Result.success( - listOf( - AgencyGetResponse( - id = 1, - name = "Agency 1", - headCount = 10, - type = "STUDENT_COUNCIL" - ), - AgencyGetResponse( - id = 2, - name = "Agency 2", - headCount = 20, - type = "IN_SCHOOL_CLUB" - ), - AgencyGetResponse( - id = 3, - name = "Agency 3", - headCount = 30, - type = "STUDENT_COUNCIL" - ), - AgencyGetResponse( - id = 4, - name = "Agency 4", - headCount = 40, - type = "IN_SCHOOL_CLUB" - ), - ) - ) + return agencyRepository.fetchAgencyByName(agencyName = agencyName) } } \ No newline at end of file diff --git a/feature/agency/src/main/java/com/moneymong/moneymong/feature/agency/search/AgencySearchScreen.kt b/feature/agency/src/main/java/com/moneymong/moneymong/feature/agency/search/AgencySearchScreen.kt index 78fc4343..f82718a6 100644 --- a/feature/agency/src/main/java/com/moneymong/moneymong/feature/agency/search/AgencySearchScreen.kt +++ b/feature/agency/src/main/java/com/moneymong/moneymong/feature/agency/search/AgencySearchScreen.kt @@ -128,13 +128,14 @@ fun AgencySearchScreen( modifier = Modifier.onSizeChanged { searchBarHeight = it.height }, state = state.searchTextFieldState, visible = state.visibleSearchBar, - onSearch = {}, + onSearch = viewModel::searchAgency, onClear = viewModel::clearSearchTextField, onCancel = viewModel::toggleVisibilitySearchBar, ) AgencySearchContentView( modifier = Modifier.offset { IntOffset(x = 0, y = offsetY) }, pagingItems = pagingItems, + searchedAgencies = state.searchedAgencies, onClickItem = { agencyId -> if (agencyId in state.joinedAgenciesIds) { viewModel.changeVisibleWarningDialog(true) @@ -176,6 +177,7 @@ fun AgencySearchScreen( private fun AgencySearchContentView( modifier: Modifier = Modifier, pagingItems: LazyPagingItems, + searchedAgencies: List, onClickItem: (agencyId: Long) -> Unit, onClickFeedbackItem: () -> Unit, isLoading: Boolean, @@ -190,36 +192,70 @@ private fun AgencySearchContentView( ?: MoneyMongError.UnExpectedError.message } - if (contentLoading) { - LoadingScreen(modifier = modifier.fillMaxSize()) - } else if (contentError) { - ErrorScreen( - modifier = modifier.fillMaxSize(), - message = contentErrorMessage, - onRetry = { - pagingItems.retry() - onRetry() - }, - ) - } else { - if (pagingItems.itemCount == 0) { + when { + contentLoading -> LoadingScreen(modifier = modifier.fillMaxSize()) + + contentError -> + ErrorScreen( + modifier = modifier.fillMaxSize(), + message = contentErrorMessage, + onRetry = { + pagingItems.retry() + onRetry() + }, + ) + + searchedAgencies.isNotEmpty() -> + ContentViewWithAgencies( + modifier = modifier, + agencies = searchedAgencies, + onClickItem = onClickItem, + onClickFeedbackItem = onClickFeedbackItem + ) + + pagingItems.itemCount == 0 -> ContentViewWithoutAgencies( modifier = modifier, pagingItems = pagingItems, onClickFeedbackItem = onClickFeedbackItem ) - } else { + + + else -> ContentViewWithAgencies( modifier = modifier, pagingItems = pagingItems, onClickItem = onClickItem, onClickFeedbackItem = onClickFeedbackItem ) - } } } +@Composable +private fun ContentViewWithAgencies( + modifier: Modifier = Modifier, + agencies: List, + onClickItem: (agencyId: Long) -> Unit, + onClickFeedbackItem: () -> Unit +) { + LazyColumn( + modifier = modifier, + verticalArrangement = Arrangement.spacedBy(12.dp), + contentPadding = PaddingValues(bottom = 4.dp) + ) { + item { + AgencyFeedbackItem(onClick = onClickFeedbackItem) + } + items(count = agencies.size, key = { agencies[it].id }) { + AgencyItem( + agency = agencies[it], + onClick = { onClickItem(agencies[it].id) } + ) + } + } +} + @Composable private fun ContentViewWithAgencies( modifier: Modifier = Modifier, diff --git a/feature/agency/src/main/java/com/moneymong/moneymong/feature/agency/search/AgencySearchState.kt b/feature/agency/src/main/java/com/moneymong/moneymong/feature/agency/search/AgencySearchState.kt index 8d20e4c3..d016fb6e 100644 --- a/feature/agency/src/main/java/com/moneymong/moneymong/feature/agency/search/AgencySearchState.kt +++ b/feature/agency/src/main/java/com/moneymong/moneymong/feature/agency/search/AgencySearchState.kt @@ -5,6 +5,7 @@ import com.moneymong.moneymong.common.base.State data class AgencySearchState( val joinedAgencies: List = emptyList(), + val searchedAgencies: List = emptyList(), val isLoading: Boolean = false, val isError: Boolean = false, val errorMessage: String = "", diff --git a/feature/agency/src/main/java/com/moneymong/moneymong/feature/agency/search/AgencySearchViewModel.kt b/feature/agency/src/main/java/com/moneymong/moneymong/feature/agency/search/AgencySearchViewModel.kt index 778b5ae2..df24e16a 100644 --- a/feature/agency/src/main/java/com/moneymong/moneymong/feature/agency/search/AgencySearchViewModel.kt +++ b/feature/agency/src/main/java/com/moneymong/moneymong/feature/agency/search/AgencySearchViewModel.kt @@ -85,9 +85,46 @@ class AgencySearchViewModel @Inject constructor( } } - fun toggleVisibilitySearchBar() = intent { + fun searchAgency() = intent { reduce { - state.copy(visibleSearchBar = state.visibleSearchBar.not()) + state.copy( + isLoading = true, + isError = false + ) + } + fetchAgencyByNameUseCase(agencyName = state.searchTextFieldState.text.toString()) + .onSuccess { agencies -> + reduce { + state.copy( + isLoading = false, + searchedAgencies = agencies.map { agencyResponse -> agencyResponse.toAgency() } + ) + } + }.onFailure { + reduce { + state.copy( + isLoading = false, + isError = true, + errorMessage = it.message ?: MoneyMongError.UnExpectedError.message + ) + } + } + } + + fun toggleVisibilitySearchBar() = intent { + if (state.visibleSearchBar) { + reduce { + state.copy( + visibleSearchBar = state.visibleSearchBar.not(), + searchedAgencies = emptyList() + ).also { + clearSearchTextField() + } + } + } else { + reduce { + state.copy(visibleSearchBar = state.visibleSearchBar.not()) + } } } From 393279c3f5c6b9149c37c9af146bc4e65d6a0e75 Mon Sep 17 00:00:00 2001 From: jhg3410 Date: Tue, 26 Nov 2024 15:42:11 +0900 Subject: [PATCH 16/30] =?UTF-8?q?=EA=B0=95=EC=A0=9C=20=EC=97=85=EB=8D=B0?= =?UTF-8?q?=EC=9D=B4=ED=8A=B8=20dialog=20=EC=97=85=EB=8D=B0=EC=9D=B4?= =?UTF-8?q?=ED=8A=B8=20=EC=97=90=EB=9F=AC=EC=9D=BC=20=EB=95=8C=EB=A7=8C=20?= =?UTF-8?q?=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/moneymong/moneymong/MainViewModel.kt | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/com/moneymong/moneymong/MainViewModel.kt b/app/src/main/java/com/moneymong/moneymong/MainViewModel.kt index 98c163c6..191ab18b 100644 --- a/app/src/main/java/com/moneymong/moneymong/MainViewModel.kt +++ b/app/src/main/java/com/moneymong/moneymong/MainViewModel.kt @@ -13,10 +13,8 @@ class MainViewModel @Inject constructor( ) : BaseViewModel(MainState()) { fun checkShouldUpdate(version: String) = intent { - val shouldUpdate = - checkVersionUpdateUseCase(version = version).isFailure - reduce { - state.copy(shouldUpdate = shouldUpdate) - } + checkVersionUpdateUseCase(version = version) + .onSuccess { reduce { state.copy(shouldUpdate = false) } } + .onFailure { reduce { state.copy(shouldUpdate = it.message?.contains("업데이트") == true) } } } } \ No newline at end of file From a09611b41e461a2a86f751204dc843ba19ca1390 Mon Sep 17 00:00:00 2001 From: jhg3410 Date: Tue, 26 Nov 2024 15:58:01 +0900 Subject: [PATCH 17/30] =?UTF-8?q?=EC=86=8C=EC=86=8D=20=ED=83=AD=20Vertical?= =?UTF-8?q?=20Padding=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../agency/search/AgencySearchScreen.kt | 3 +- .../component/searchbar/AgencySearchBar.kt | 47 +++++++++---------- 2 files changed, 24 insertions(+), 26 deletions(-) diff --git a/feature/agency/src/main/java/com/moneymong/moneymong/feature/agency/search/AgencySearchScreen.kt b/feature/agency/src/main/java/com/moneymong/moneymong/feature/agency/search/AgencySearchScreen.kt index f82718a6..8386d3ab 100644 --- a/feature/agency/src/main/java/com/moneymong/moneymong/feature/agency/search/AgencySearchScreen.kt +++ b/feature/agency/src/main/java/com/moneymong/moneymong/feature/agency/search/AgencySearchScreen.kt @@ -122,7 +122,6 @@ fun AgencySearchScreen( onSearchIconClick = viewModel::toggleVisibilitySearchBar, visibleSearchIcon = state.visibleSearchBar.not() ) - Spacer(modifier = Modifier.height(4.dp)) Box(modifier = Modifier.fillMaxSize()) { AgencySearchBar( modifier = Modifier.onSizeChanged { searchBarHeight = it.height }, @@ -242,7 +241,7 @@ private fun ContentViewWithAgencies( LazyColumn( modifier = modifier, verticalArrangement = Arrangement.spacedBy(12.dp), - contentPadding = PaddingValues(bottom = 4.dp) + contentPadding = PaddingValues(vertical = 6.dp) ) { item { AgencyFeedbackItem(onClick = onClickFeedbackItem) diff --git a/feature/agency/src/main/java/com/moneymong/moneymong/feature/agency/search/component/searchbar/AgencySearchBar.kt b/feature/agency/src/main/java/com/moneymong/moneymong/feature/agency/search/component/searchbar/AgencySearchBar.kt index 7036a45a..fa4a2a14 100644 --- a/feature/agency/src/main/java/com/moneymong/moneymong/feature/agency/search/component/searchbar/AgencySearchBar.kt +++ b/feature/agency/src/main/java/com/moneymong/moneymong/feature/agency/search/component/searchbar/AgencySearchBar.kt @@ -5,10 +5,9 @@ import androidx.compose.animation.core.FastOutSlowInEasing import androidx.compose.animation.core.tween import androidx.compose.animation.fadeIn import androidx.compose.animation.fadeOut -import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Spacer -import androidx.compose.foundation.layout.height +import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.width import androidx.compose.foundation.text.input.TextFieldState import androidx.compose.foundation.text.input.rememberTextFieldState @@ -56,28 +55,28 @@ internal fun AgencySearchBar( enter = fadeIn(animationSpec = animationSpec), exit = fadeOut(animationSpec = animationSpec) ) { - Column { - Row(verticalAlignment = Alignment.CenterVertically) { - AgencySearchTextField( - modifier = Modifier - .weight(1f) - .focusRequester(focusRequester), - state = state, - onSearch = { - onSearch() - focusManager.clearFocus() - }, - onClear = onClear - ) - Spacer(modifier = Modifier.width(10.dp)) - Text( - modifier = Modifier.noRippleClickable { onCancel() }, - text = "취소", - style = Body2, - color = Gray08 - ) - } - Spacer(modifier = Modifier.height(16.dp)) + Row( + modifier = Modifier.padding(vertical = 10.dp), + verticalAlignment = Alignment.CenterVertically + ) { + AgencySearchTextField( + modifier = Modifier + .weight(1f) + .focusRequester(focusRequester), + state = state, + onSearch = { + onSearch() + focusManager.clearFocus() + }, + onClear = onClear + ) + Spacer(modifier = Modifier.width(10.dp)) + Text( + modifier = Modifier.noRippleClickable { onCancel() }, + text = "취소", + style = Body2, + color = Gray08 + ) } } } From 0076ad8b0daefd268d82b36021912811fff2ccd4 Mon Sep 17 00:00:00 2001 From: jhg3410 Date: Tue, 26 Nov 2024 16:08:10 +0900 Subject: [PATCH 18/30] =?UTF-8?q?=EC=86=8C=EC=86=8D=20ContentView,=20Scree?= =?UTF-8?q?n=20=EB=B6=84=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../agency/search/AgencySearchContentView.kt | 220 ++++++++++++++++++ .../agency/search/AgencySearchScreen.kt | 208 ----------------- 2 files changed, 220 insertions(+), 208 deletions(-) create mode 100644 feature/agency/src/main/java/com/moneymong/moneymong/feature/agency/search/AgencySearchContentView.kt diff --git a/feature/agency/src/main/java/com/moneymong/moneymong/feature/agency/search/AgencySearchContentView.kt b/feature/agency/src/main/java/com/moneymong/moneymong/feature/agency/search/AgencySearchContentView.kt new file mode 100644 index 00000000..31887fd5 --- /dev/null +++ b/feature/agency/src/main/java/com/moneymong/moneymong/feature/agency/search/AgencySearchContentView.kt @@ -0,0 +1,220 @@ +package com.moneymong.moneymong.feature.agency.search + +import androidx.compose.foundation.Image +import androidx.compose.foundation.layout.Arrangement +import androidx.compose.foundation.layout.Box +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.PaddingValues +import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.size +import androidx.compose.foundation.lazy.LazyColumn +import androidx.compose.material3.Text +import androidx.compose.runtime.Composable +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.res.painterResource +import androidx.compose.ui.text.style.TextAlign +import androidx.compose.ui.unit.dp +import androidx.paging.LoadState +import androidx.paging.compose.LazyPagingItems +import androidx.paging.compose.itemKey +import com.moneymong.moneymong.common.error.MoneyMongError +import com.moneymong.moneymong.design_system.R +import com.moneymong.moneymong.design_system.component.indicator.LoadingItem +import com.moneymong.moneymong.design_system.component.indicator.LoadingScreen +import com.moneymong.moneymong.design_system.error.ErrorItem +import com.moneymong.moneymong.design_system.error.ErrorScreen +import com.moneymong.moneymong.design_system.theme.Body3 +import com.moneymong.moneymong.design_system.theme.Gray07 +import com.moneymong.moneymong.feature.agency.search.item.AgencyFeedbackItem +import com.moneymong.moneymong.feature.agency.search.item.AgencyItem + +@Composable +internal fun AgencySearchContentView( + modifier: Modifier = Modifier, + pagingItems: LazyPagingItems, + searchedAgencies: List, + onClickItem: (agencyId: Long) -> Unit, + onClickFeedbackItem: () -> Unit, + isLoading: Boolean, + isError: Boolean, + errorMessage: String, + onRetry: () -> Unit, +) { + val contentLoading = pagingItems.loadState.refresh is LoadState.Loading || isLoading + val contentError = pagingItems.loadState.refresh is LoadState.Error || isError + val contentErrorMessage = errorMessage.ifEmpty { + (pagingItems.loadState.refresh as? LoadState.Error)?.error?.message + ?: MoneyMongError.UnExpectedError.message + } + + when { + contentLoading -> LoadingScreen(modifier = modifier.fillMaxSize()) + + contentError -> + ErrorScreen( + modifier = modifier.fillMaxSize(), + message = contentErrorMessage, + onRetry = { + pagingItems.retry() + onRetry() + }, + ) + + searchedAgencies.isNotEmpty() -> + ContentViewWithAgencies( + modifier = modifier, + agencies = searchedAgencies, + onClickItem = onClickItem, + onClickFeedbackItem = onClickFeedbackItem + ) + + pagingItems.itemCount == 0 -> + ContentViewWithoutAgencies( + modifier = modifier, + pagingItems = pagingItems, + onClickFeedbackItem = onClickFeedbackItem + ) + + + else -> + ContentViewWithAgencies( + modifier = modifier, + pagingItems = pagingItems, + onClickItem = onClickItem, + onClickFeedbackItem = onClickFeedbackItem + ) + } +} + + +@Composable +private fun ContentViewWithAgencies( + modifier: Modifier = Modifier, + agencies: List, + onClickItem: (agencyId: Long) -> Unit, + onClickFeedbackItem: () -> Unit +) { + LazyColumn( + modifier = modifier, + verticalArrangement = Arrangement.spacedBy(12.dp), + contentPadding = PaddingValues(vertical = 6.dp) + ) { + item { + AgencyFeedbackItem(onClick = onClickFeedbackItem) + } + items(count = agencies.size, key = { agencies[it].id }) { + AgencyItem( + agency = agencies[it], + onClick = { onClickItem(agencies[it].id) } + ) + } + } +} + +@Composable +private fun ContentViewWithAgencies( + modifier: Modifier = Modifier, + pagingItems: LazyPagingItems, + onClickItem: (agencyId: Long) -> Unit, + onClickFeedbackItem: () -> Unit +) { + LazyColumn( + modifier = modifier, + verticalArrangement = Arrangement.spacedBy(12.dp), + contentPadding = PaddingValues(bottom = 4.dp) + ) { + item { + AgencyFeedbackItem( + onClick = onClickFeedbackItem + ) + } + items( + count = pagingItems.itemCount, key = pagingItems.itemKey { it.id } + ) { + pagingItems[it]?.let { agency -> + AgencyItem( + agency = agency, + onClick = { onClickItem(agency.id) } + ) + } + } + + when (pagingItems.loadState.source.append) { + is LoadState.Loading -> { + item { + LoadingItem(modifier = Modifier.fillMaxWidth()) + } + } + + is LoadState.Error -> { + val e = pagingItems.loadState.source.append as LoadState.Error + item { + ErrorItem( + modifier = Modifier.fillMaxWidth(), + message = "${e.error.message}", + onRetry = pagingItems::retry + ) + } + } + + is LoadState.NotLoading -> Unit + } + } +} + +@Composable +private fun ContentViewWithoutAgencies( + modifier: Modifier = Modifier, + pagingItems: LazyPagingItems, + onClickFeedbackItem: () -> Unit +) { + + when (pagingItems.loadState.refresh) { + is LoadState.Loading -> { + LoadingScreen(modifier = modifier.fillMaxSize()) + } + + is LoadState.Error -> { + val e = pagingItems.loadState.refresh as LoadState.Error + ErrorScreen( + modifier = modifier.fillMaxSize(), + message = "${e.error.message}", + onRetry = pagingItems::retry + ) + } + + is LoadState.NotLoading -> { + Box(modifier = Modifier.fillMaxSize()) { + AgencyFeedbackItem( + modifier = Modifier + .align(Alignment.TopCenter) + .padding(top = 10.dp), + onClick = onClickFeedbackItem + ) + Column( + modifier = modifier.fillMaxSize(), + verticalArrangement = Arrangement.spacedBy( + space = 4.dp, + alignment = Alignment.CenterVertically + ), + horizontalAlignment = Alignment.CenterHorizontally + ) { + Image( + modifier = Modifier.size(size = 80.dp), + painter = painterResource(id = R.drawable.img_agency), + contentDescription = "agency image", + ) + Text( + text = "아직 등록된 소속이 없어요\n하단 버튼을 통해 등록해보세요", + textAlign = TextAlign.Center, + color = Gray07, + style = Body3 + ) + } + } + } + } +} \ No newline at end of file diff --git a/feature/agency/src/main/java/com/moneymong/moneymong/feature/agency/search/AgencySearchScreen.kt b/feature/agency/src/main/java/com/moneymong/moneymong/feature/agency/search/AgencySearchScreen.kt index 8386d3ab..80d8dbdf 100644 --- a/feature/agency/src/main/java/com/moneymong/moneymong/feature/agency/search/AgencySearchScreen.kt +++ b/feature/agency/src/main/java/com/moneymong/moneymong/feature/agency/search/AgencySearchScreen.kt @@ -5,21 +5,14 @@ import android.net.Uri import androidx.compose.animation.core.LinearEasing import androidx.compose.animation.core.animateIntAsState import androidx.compose.animation.core.tween -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.PaddingValues import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.fillMaxSize -import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.offset import androidx.compose.foundation.layout.padding -import androidx.compose.foundation.layout.size -import androidx.compose.foundation.lazy.LazyColumn -import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableIntStateOf @@ -29,34 +22,21 @@ import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.layout.onSizeChanged import androidx.compose.ui.platform.LocalContext -import androidx.compose.ui.res.painterResource -import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.unit.IntOffset import androidx.compose.ui.unit.dp import androidx.hilt.navigation.compose.hiltViewModel import androidx.paging.LoadState -import androidx.paging.compose.LazyPagingItems import androidx.paging.compose.collectAsLazyPagingItems -import androidx.paging.compose.itemKey -import com.moneymong.moneymong.common.error.MoneyMongError import com.moneymong.moneymong.design_system.R import com.moneymong.moneymong.design_system.component.button.MDSFloatingActionButton -import com.moneymong.moneymong.design_system.component.indicator.LoadingItem -import com.moneymong.moneymong.design_system.component.indicator.LoadingScreen import com.moneymong.moneymong.design_system.component.tooltip.MDSToolTip import com.moneymong.moneymong.design_system.component.tooltip.MDSToolTipPosition import com.moneymong.moneymong.design_system.error.ErrorDialog -import com.moneymong.moneymong.design_system.error.ErrorItem -import com.moneymong.moneymong.design_system.error.ErrorScreen -import com.moneymong.moneymong.design_system.theme.Body3 import com.moneymong.moneymong.design_system.theme.Gray01 -import com.moneymong.moneymong.design_system.theme.Gray07 import com.moneymong.moneymong.design_system.theme.MMHorizontalSpacing import com.moneymong.moneymong.design_system.theme.Red03 import com.moneymong.moneymong.feature.agency.search.component.AgencySearchTopBar import com.moneymong.moneymong.feature.agency.search.component.searchbar.AgencySearchBar -import com.moneymong.moneymong.feature.agency.search.item.AgencyFeedbackItem -import com.moneymong.moneymong.feature.agency.search.item.AgencyItem import org.orbitmvi.orbit.compose.collectAsState import org.orbitmvi.orbit.compose.collectSideEffect @@ -171,191 +151,3 @@ fun AgencySearchScreen( } } } - -@Composable -private fun AgencySearchContentView( - modifier: Modifier = Modifier, - pagingItems: LazyPagingItems, - searchedAgencies: List, - onClickItem: (agencyId: Long) -> Unit, - onClickFeedbackItem: () -> Unit, - isLoading: Boolean, - isError: Boolean, - errorMessage: String, - onRetry: () -> Unit, -) { - val contentLoading = pagingItems.loadState.refresh is LoadState.Loading || isLoading - val contentError = pagingItems.loadState.refresh is LoadState.Error || isError - val contentErrorMessage = errorMessage.ifEmpty { - (pagingItems.loadState.refresh as? LoadState.Error)?.error?.message - ?: MoneyMongError.UnExpectedError.message - } - - when { - contentLoading -> LoadingScreen(modifier = modifier.fillMaxSize()) - - contentError -> - ErrorScreen( - modifier = modifier.fillMaxSize(), - message = contentErrorMessage, - onRetry = { - pagingItems.retry() - onRetry() - }, - ) - - searchedAgencies.isNotEmpty() -> - ContentViewWithAgencies( - modifier = modifier, - agencies = searchedAgencies, - onClickItem = onClickItem, - onClickFeedbackItem = onClickFeedbackItem - ) - - pagingItems.itemCount == 0 -> - ContentViewWithoutAgencies( - modifier = modifier, - pagingItems = pagingItems, - onClickFeedbackItem = onClickFeedbackItem - ) - - - else -> - ContentViewWithAgencies( - modifier = modifier, - pagingItems = pagingItems, - onClickItem = onClickItem, - onClickFeedbackItem = onClickFeedbackItem - ) - } -} - - -@Composable -private fun ContentViewWithAgencies( - modifier: Modifier = Modifier, - agencies: List, - onClickItem: (agencyId: Long) -> Unit, - onClickFeedbackItem: () -> Unit -) { - LazyColumn( - modifier = modifier, - verticalArrangement = Arrangement.spacedBy(12.dp), - contentPadding = PaddingValues(vertical = 6.dp) - ) { - item { - AgencyFeedbackItem(onClick = onClickFeedbackItem) - } - items(count = agencies.size, key = { agencies[it].id }) { - AgencyItem( - agency = agencies[it], - onClick = { onClickItem(agencies[it].id) } - ) - } - } -} - -@Composable -private fun ContentViewWithAgencies( - modifier: Modifier = Modifier, - pagingItems: LazyPagingItems, - onClickItem: (agencyId: Long) -> Unit, - onClickFeedbackItem: () -> Unit -) { - LazyColumn( - modifier = modifier, - verticalArrangement = Arrangement.spacedBy(12.dp), - contentPadding = PaddingValues(bottom = 4.dp) - ) { - item { - AgencyFeedbackItem( - onClick = onClickFeedbackItem - ) - } - items( - count = pagingItems.itemCount, key = pagingItems.itemKey { it.id } - ) { - pagingItems[it]?.let { agency -> - AgencyItem( - agency = agency, - onClick = { onClickItem(agency.id) } - ) - } - } - - when (pagingItems.loadState.source.append) { - is LoadState.Loading -> { - item { - LoadingItem(modifier = Modifier.fillMaxWidth()) - } - } - - is LoadState.Error -> { - val e = pagingItems.loadState.source.append as LoadState.Error - item { - ErrorItem( - modifier = Modifier.fillMaxWidth(), - message = "${e.error.message}", - onRetry = pagingItems::retry - ) - } - } - - is LoadState.NotLoading -> Unit - } - } -} - -@Composable -private fun ContentViewWithoutAgencies( - modifier: Modifier = Modifier, - pagingItems: LazyPagingItems, - onClickFeedbackItem: () -> Unit -) { - - when (pagingItems.loadState.refresh) { - is LoadState.Loading -> { - LoadingScreen(modifier = modifier.fillMaxSize()) - } - - is LoadState.Error -> { - val e = pagingItems.loadState.refresh as LoadState.Error - ErrorScreen( - modifier = modifier.fillMaxSize(), - message = "${e.error.message}", - onRetry = pagingItems::retry - ) - } - - is LoadState.NotLoading -> { - Box(modifier = Modifier.fillMaxSize()) { - AgencyFeedbackItem( - modifier = Modifier - .align(Alignment.TopCenter) - .padding(top = 10.dp), - onClick = onClickFeedbackItem - ) - Column( - modifier = modifier.fillMaxSize(), - verticalArrangement = Arrangement.spacedBy( - space = 4.dp, - alignment = Alignment.CenterVertically - ), - horizontalAlignment = Alignment.CenterHorizontally - ) { - Image( - modifier = Modifier.size(size = 80.dp), - painter = painterResource(id = R.drawable.img_agency), - contentDescription = "agency image", - ) - Text( - text = "아직 등록된 소속이 없어요\n하단 버튼을 통해 등록해보세요", - textAlign = TextAlign.Center, - color = Gray07, - style = Body3 - ) - } - } - } - } -} \ No newline at end of file From 5bce9aff03dda483969598103ca915d437caf727 Mon Sep 17 00:00:00 2001 From: jhg3410 Date: Tue, 26 Nov 2024 16:08:30 +0900 Subject: [PATCH 19/30] =?UTF-8?q?=20=EC=86=8C=EC=86=8D=20=EA=B2=80?= =?UTF-8?q?=EC=83=89=20Visible=EC=9D=BC=20=EB=95=8C=20ContentView=20?= =?UTF-8?q?=EC=B5=9C=ED=95=98=EB=8B=A8=20=EC=9E=98=EB=A6=AC=EB=8A=94=20?= =?UTF-8?q?=ED=98=84=EC=83=81=20=ED=95=B4=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../moneymong/feature/agency/search/AgencySearchScreen.kt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/feature/agency/src/main/java/com/moneymong/moneymong/feature/agency/search/AgencySearchScreen.kt b/feature/agency/src/main/java/com/moneymong/moneymong/feature/agency/search/AgencySearchScreen.kt index 80d8dbdf..091974ef 100644 --- a/feature/agency/src/main/java/com/moneymong/moneymong/feature/agency/search/AgencySearchScreen.kt +++ b/feature/agency/src/main/java/com/moneymong/moneymong/feature/agency/search/AgencySearchScreen.kt @@ -37,6 +37,7 @@ import com.moneymong.moneymong.design_system.theme.MMHorizontalSpacing import com.moneymong.moneymong.design_system.theme.Red03 import com.moneymong.moneymong.feature.agency.search.component.AgencySearchTopBar import com.moneymong.moneymong.feature.agency.search.component.searchbar.AgencySearchBar +import com.moneymong.moneymong.ui.pxToDp import org.orbitmvi.orbit.compose.collectAsState import org.orbitmvi.orbit.compose.collectSideEffect @@ -112,7 +113,9 @@ fun AgencySearchScreen( onCancel = viewModel::toggleVisibilitySearchBar, ) AgencySearchContentView( - modifier = Modifier.offset { IntOffset(x = 0, y = offsetY) }, + modifier = Modifier + .offset { IntOffset(x = 0, y = offsetY) } + .padding(bottom = offsetY.pxToDp), pagingItems = pagingItems, searchedAgencies = state.searchedAgencies, onClickItem = { agencyId -> From 2c81e134c74bd3bab5b3ab9ff46525e7f5d9e97b Mon Sep 17 00:00:00 2001 From: jhg3410 Date: Wed, 27 Nov 2024 00:27:59 +0900 Subject: [PATCH 20/30] =?UTF-8?q?=20=EC=86=8C=EC=86=8D=20=EA=B2=80?= =?UTF-8?q?=EC=83=89=20Visible=20=EC=9D=BC=20=EB=95=8C=20=EB=92=A4?= =?UTF-8?q?=EB=A1=9C=20=EA=B0=80=EA=B8=B0=ED=95=98=EB=A9=B4=20=EC=86=8C?= =?UTF-8?q?=EC=86=8D=20=EA=B2=80=EC=83=89=20Invisible=20=EC=B2=98=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../moneymong/feature/agency/search/AgencySearchScreen.kt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/feature/agency/src/main/java/com/moneymong/moneymong/feature/agency/search/AgencySearchScreen.kt b/feature/agency/src/main/java/com/moneymong/moneymong/feature/agency/search/AgencySearchScreen.kt index 091974ef..7205f814 100644 --- a/feature/agency/src/main/java/com/moneymong/moneymong/feature/agency/search/AgencySearchScreen.kt +++ b/feature/agency/src/main/java/com/moneymong/moneymong/feature/agency/search/AgencySearchScreen.kt @@ -2,6 +2,7 @@ package com.moneymong.moneymong.feature.agency.search import android.content.Intent import android.net.Uri +import androidx.activity.compose.BackHandler import androidx.compose.animation.core.LinearEasing import androidx.compose.animation.core.animateIntAsState import androidx.compose.animation.core.tween @@ -52,6 +53,10 @@ fun AgencySearchScreen( val context = LocalContext.current val pagingItems = viewModel.agencies.collectAsLazyPagingItems() + BackHandler(enabled = state.visibleSearchBar) { + viewModel.toggleVisibilitySearchBar() + } + viewModel.collectSideEffect { when (it) { is AgencySearchSideEffect.NavigateToRegister -> { From 67852be125dce2b08aeb0fabe56bd9407429057b Mon Sep 17 00:00:00 2001 From: jhg3410 Date: Wed, 27 Nov 2024 00:47:31 +0900 Subject: [PATCH 21/30] =?UTF-8?q?=EC=86=8C=EC=86=8D=20=EA=B2=80=EC=83=89?= =?UTF-8?q?=EC=9D=84=20=ED=96=88=EC=9D=84=20=EB=95=8C=EB=A7=8C=20=EA=B2=80?= =?UTF-8?q?=EC=83=89=EB=90=9C=20=EC=86=8C=EC=86=8D=20=EB=B3=B4=EC=9D=B4?= =?UTF-8?q?=EB=8F=84=EB=A1=9D=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../feature/agency/search/AgencySearchContentView.kt | 5 +++-- .../feature/agency/search/AgencySearchScreen.kt | 1 + .../feature/agency/search/AgencySearchState.kt | 1 + .../feature/agency/search/AgencySearchViewModel.kt | 11 ++++++++--- 4 files changed, 13 insertions(+), 5 deletions(-) diff --git a/feature/agency/src/main/java/com/moneymong/moneymong/feature/agency/search/AgencySearchContentView.kt b/feature/agency/src/main/java/com/moneymong/moneymong/feature/agency/search/AgencySearchContentView.kt index 31887fd5..e7381280 100644 --- a/feature/agency/src/main/java/com/moneymong/moneymong/feature/agency/search/AgencySearchContentView.kt +++ b/feature/agency/src/main/java/com/moneymong/moneymong/feature/agency/search/AgencySearchContentView.kt @@ -38,6 +38,7 @@ internal fun AgencySearchContentView( searchedAgencies: List, onClickItem: (agencyId: Long) -> Unit, onClickFeedbackItem: () -> Unit, + isSearched: Boolean, isLoading: Boolean, isError: Boolean, errorMessage: String, @@ -63,7 +64,7 @@ internal fun AgencySearchContentView( }, ) - searchedAgencies.isNotEmpty() -> + isSearched -> ContentViewWithAgencies( modifier = modifier, agencies = searchedAgencies, @@ -124,7 +125,7 @@ private fun ContentViewWithAgencies( LazyColumn( modifier = modifier, verticalArrangement = Arrangement.spacedBy(12.dp), - contentPadding = PaddingValues(bottom = 4.dp) + contentPadding = PaddingValues(vertical = 6.dp) ) { item { AgencyFeedbackItem( diff --git a/feature/agency/src/main/java/com/moneymong/moneymong/feature/agency/search/AgencySearchScreen.kt b/feature/agency/src/main/java/com/moneymong/moneymong/feature/agency/search/AgencySearchScreen.kt index 7205f814..25c84600 100644 --- a/feature/agency/src/main/java/com/moneymong/moneymong/feature/agency/search/AgencySearchScreen.kt +++ b/feature/agency/src/main/java/com/moneymong/moneymong/feature/agency/search/AgencySearchScreen.kt @@ -131,6 +131,7 @@ fun AgencySearchScreen( } }, onClickFeedbackItem = viewModel::onClickAskFeedback, + isSearched = state.isSearched, isLoading = state.isLoading, isError = state.isError, errorMessage = state.errorMessage, diff --git a/feature/agency/src/main/java/com/moneymong/moneymong/feature/agency/search/AgencySearchState.kt b/feature/agency/src/main/java/com/moneymong/moneymong/feature/agency/search/AgencySearchState.kt index d016fb6e..ecb9cdf7 100644 --- a/feature/agency/src/main/java/com/moneymong/moneymong/feature/agency/search/AgencySearchState.kt +++ b/feature/agency/src/main/java/com/moneymong/moneymong/feature/agency/search/AgencySearchState.kt @@ -6,6 +6,7 @@ import com.moneymong.moneymong.common.base.State data class AgencySearchState( val joinedAgencies: List = emptyList(), val searchedAgencies: List = emptyList(), + val isSearched: Boolean = false, val isLoading: Boolean = false, val isError: Boolean = false, val errorMessage: String = "", diff --git a/feature/agency/src/main/java/com/moneymong/moneymong/feature/agency/search/AgencySearchViewModel.kt b/feature/agency/src/main/java/com/moneymong/moneymong/feature/agency/search/AgencySearchViewModel.kt index df24e16a..3013be14 100644 --- a/feature/agency/src/main/java/com/moneymong/moneymong/feature/agency/search/AgencySearchViewModel.kt +++ b/feature/agency/src/main/java/com/moneymong/moneymong/feature/agency/search/AgencySearchViewModel.kt @@ -108,6 +108,10 @@ class AgencySearchViewModel @Inject constructor( errorMessage = it.message ?: MoneyMongError.UnExpectedError.message ) } + }.also { + reduce { + state.copy(isSearched = true) + } } } @@ -115,15 +119,16 @@ class AgencySearchViewModel @Inject constructor( if (state.visibleSearchBar) { reduce { state.copy( - visibleSearchBar = state.visibleSearchBar.not(), - searchedAgencies = emptyList() + visibleSearchBar = false, + searchedAgencies = emptyList(), + isSearched = false ).also { clearSearchTextField() } } } else { reduce { - state.copy(visibleSearchBar = state.visibleSearchBar.not()) + state.copy(visibleSearchBar = true) } } } From 4658111a8d32af7b3d54190ecf5870398b7b8e7e Mon Sep 17 00:00:00 2001 From: jhg3410 Date: Wed, 27 Nov 2024 01:42:30 +0900 Subject: [PATCH 22/30] =?UTF-8?q?=EC=86=8C=EC=86=8D=20=EA=B2=80=EC=83=89?= =?UTF-8?q?=20=ED=9B=84=20clear=20=ED=96=88=EC=9D=84=20=EB=95=8C=20?= =?UTF-8?q?=EA=B2=80=EC=83=89=20=ED=8F=AC=EC=BB=A4=EC=8A=A4=20=EB=90=98?= =?UTF-8?q?=EB=8F=84=EB=A1=9D=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../agency/search/component/searchbar/AgencySearchBar.kt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/feature/agency/src/main/java/com/moneymong/moneymong/feature/agency/search/component/searchbar/AgencySearchBar.kt b/feature/agency/src/main/java/com/moneymong/moneymong/feature/agency/search/component/searchbar/AgencySearchBar.kt index fa4a2a14..9fbb230d 100644 --- a/feature/agency/src/main/java/com/moneymong/moneymong/feature/agency/search/component/searchbar/AgencySearchBar.kt +++ b/feature/agency/src/main/java/com/moneymong/moneymong/feature/agency/search/component/searchbar/AgencySearchBar.kt @@ -68,7 +68,10 @@ internal fun AgencySearchBar( onSearch() focusManager.clearFocus() }, - onClear = onClear + onClear = { + onClear() + focusRequester.requestFocus() + } ) Spacer(modifier = Modifier.width(10.dp)) Text( From 8bf6db66dfd2ea2fbed68f1409b4af0ad688707a Mon Sep 17 00:00:00 2001 From: eunseo Date: Mon, 9 Dec 2024 20:58:32 +0900 Subject: [PATCH 23/30] =?UTF-8?q?moneymong-520=20feat:=20=ED=9A=8C?= =?UTF-8?q?=EC=9B=90=EA=B0=80=EC=9E=85=20=ED=94=8C=EB=A1=9C=EC=9A=B0=20?= =?UTF-8?q?=EA=B0=9C=EC=84=A0=20=EC=9E=91=EC=97=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../moneymong/model/sign/UnivResponse.kt | 4 +- .../agency/search/AgencySearchViewModel.kt | 2 +- .../moneymong/moneymong/home/HomeScreen.kt | 12 +- .../moneymong/feature/sign/SignUpScreen.kt | 268 +++++++++++------- .../moneymong/feature/sign/item/UnivItem.kt | 7 +- .../sign/navigation/SignUpNavigation.kt | 9 +- .../navigation/SignUpUniversityNavigation.kt | 35 +++ .../sign/sideeffect/SignUpSideEffect.kt | 1 - .../sideeffect/SignUpUniversitySideEffect.kt | 6 + .../feature/sign/state/SignUpState.kt | 10 +- .../sign/state/SignUpUniversityState.kt | 31 ++ .../moneymong/feature/sign/util/AgencyType.kt | 8 + .../feature/sign/view/SearchUnivView.kt | 10 +- .../feature/sign/view/SignUpButtonView.kt | 27 +- .../feature/sign/view/SignUpTitleView.kt | 11 +- .../feature/sign/view/SignUpUniversity.kt | 223 +++++++++++++++ .../viewmodel/SignUpUniversityViewModel.kt | 171 +++++++++++ .../feature/sign/viewmodel/SignUpViewModel.kt | 115 ++------ 18 files changed, 725 insertions(+), 225 deletions(-) create mode 100644 feature/sign/src/main/java/com/moneymong/moneymong/feature/sign/navigation/SignUpUniversityNavigation.kt create mode 100644 feature/sign/src/main/java/com/moneymong/moneymong/feature/sign/sideeffect/SignUpUniversitySideEffect.kt create mode 100644 feature/sign/src/main/java/com/moneymong/moneymong/feature/sign/state/SignUpUniversityState.kt create mode 100644 feature/sign/src/main/java/com/moneymong/moneymong/feature/sign/util/AgencyType.kt create mode 100644 feature/sign/src/main/java/com/moneymong/moneymong/feature/sign/view/SignUpUniversity.kt create mode 100644 feature/sign/src/main/java/com/moneymong/moneymong/feature/sign/viewmodel/SignUpUniversityViewModel.kt diff --git a/core/model/src/main/java/com/moneymong/moneymong/model/sign/UnivResponse.kt b/core/model/src/main/java/com/moneymong/moneymong/model/sign/UnivResponse.kt index 46dbf79f..6fb08df1 100644 --- a/core/model/src/main/java/com/moneymong/moneymong/model/sign/UnivResponse.kt +++ b/core/model/src/main/java/com/moneymong/moneymong/model/sign/UnivResponse.kt @@ -1,6 +1,6 @@ package com.moneymong.moneymong.model.sign data class UnivResponse( - val universityName: String, - val grade: Int + val universityName: String?, + val grade: Int? ) \ No newline at end of file diff --git a/feature/agency/src/main/java/com/moneymong/moneymong/feature/agency/search/AgencySearchViewModel.kt b/feature/agency/src/main/java/com/moneymong/moneymong/feature/agency/search/AgencySearchViewModel.kt index 323d3b74..37d057ed 100644 --- a/feature/agency/src/main/java/com/moneymong/moneymong/feature/agency/search/AgencySearchViewModel.kt +++ b/feature/agency/src/main/java/com/moneymong/moneymong/feature/agency/search/AgencySearchViewModel.kt @@ -65,7 +65,7 @@ class AgencySearchViewModel @Inject constructor( isLoading = false, joinedAgencies = fetchMyAgenciesResult.getOrThrow() .map { myAgencyResponse -> myAgencyResponse.toAgency() }, - isUniversityStudent = fetchMyUniversityResult.getOrThrow().universityName.isNotBlank(), + isUniversityStudent = fetchMyUniversityResult.getOrThrow().universityName?.isNotBlank() ?: false , ) } } else { diff --git a/feature/home/src/main/java/com/moneymong/moneymong/home/HomeScreen.kt b/feature/home/src/main/java/com/moneymong/moneymong/home/HomeScreen.kt index a0752ac0..2f690615 100644 --- a/feature/home/src/main/java/com/moneymong/moneymong/home/HomeScreen.kt +++ b/feature/home/src/main/java/com/moneymong/moneymong/home/HomeScreen.kt @@ -29,8 +29,10 @@ import com.moneymong.moneymong.feature.sign.navigation.loginScreen import com.moneymong.moneymong.feature.sign.navigation.navigateLogin import com.moneymong.moneymong.feature.sign.navigation.navigateSignComplete import com.moneymong.moneymong.feature.sign.navigation.navigateSignUp +import com.moneymong.moneymong.feature.sign.navigation.navigateSignUpUniversity import com.moneymong.moneymong.feature.sign.navigation.signCompleteScreen import com.moneymong.moneymong.feature.sign.navigation.signUpScreen +import com.moneymong.moneymong.feature.sign.navigation.signUpUniversity import com.moneymong.moneymong.feature.sign.navigation.splashRoute import com.moneymong.moneymong.feature.sign.navigation.splashScreen import com.moneymong.moneymong.home.navigation.rememberHomeNavigator @@ -99,7 +101,15 @@ fun HomeScreen( ) signUpScreen( - navigateToSignComplete = homeNavController::navigateSignComplete, + navigateToLedger = homeNavController::navigateLedger, + navigateToSignUniversity = homeNavController::navigateSignUpUniversity, + navigateToAgency = homeNavController::navigateAgency, + navigateUp = homeNavController::navigateUp + ) + + signUpUniversity( + navigateToLedger = homeNavController::navigateLedger, + navigateToAgency = homeNavController::navigateAgency, navigateUp = homeNavController::navigateUp ) diff --git a/feature/sign/src/main/java/com/moneymong/moneymong/feature/sign/SignUpScreen.kt b/feature/sign/src/main/java/com/moneymong/moneymong/feature/sign/SignUpScreen.kt index b3e98d26..b722b8d3 100644 --- a/feature/sign/src/main/java/com/moneymong/moneymong/feature/sign/SignUpScreen.kt +++ b/feature/sign/src/main/java/com/moneymong/moneymong/feature/sign/SignUpScreen.kt @@ -1,47 +1,66 @@ package com.moneymong.moneymong.feature.sign +import android.annotation.SuppressLint import androidx.activity.compose.BackHandler +import androidx.compose.animation.AnimatedVisibility 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 import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.size +import androidx.compose.foundation.text.KeyboardActions +import androidx.compose.foundation.text.KeyboardOptions import androidx.compose.material3.Icon import androidx.compose.material3.Scaffold +import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.runtime.LaunchedEffect import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier +import androidx.compose.ui.focus.onFocusChanged +import androidx.compose.ui.graphics.Color +import androidx.compose.ui.platform.LocalFocusManager import androidx.compose.ui.res.painterResource +import androidx.compose.ui.text.input.KeyboardType +import androidx.compose.ui.text.input.TextFieldValue +import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp import androidx.hilt.navigation.compose.hiltViewModel import com.moneymong.moneymong.common.ui.noRippleClickable import com.moneymong.moneymong.design_system.R +import com.moneymong.moneymong.design_system.component.selection.MDSSelection +import com.moneymong.moneymong.design_system.component.textfield.MDSTextField +import com.moneymong.moneymong.design_system.component.textfield.util.MDSTextFieldIcons import com.moneymong.moneymong.design_system.error.ErrorDialog import com.moneymong.moneymong.design_system.error.ErrorScreen +import com.moneymong.moneymong.design_system.theme.Blue04 +import com.moneymong.moneymong.design_system.theme.Body2 +import com.moneymong.moneymong.design_system.theme.Body3 import com.moneymong.moneymong.design_system.theme.Gray07 import com.moneymong.moneymong.design_system.theme.MMHorizontalSpacing import com.moneymong.moneymong.design_system.theme.White import com.moneymong.moneymong.feature.sign.sideeffect.SignUpSideEffect import com.moneymong.moneymong.feature.sign.state.SignUpState -import com.moneymong.moneymong.feature.sign.view.SearchUnivView -import com.moneymong.moneymong.feature.sign.view.SignCompleteCheckedView +import com.moneymong.moneymong.feature.sign.util.AgencyType import com.moneymong.moneymong.feature.sign.view.SignUpButtonView -import com.moneymong.moneymong.feature.sign.view.SignUpGradeView import com.moneymong.moneymong.feature.sign.view.SignUpTitleView import com.moneymong.moneymong.feature.sign.viewmodel.SignUpViewModel import org.orbitmvi.orbit.compose.collectAsState import org.orbitmvi.orbit.compose.collectSideEffect +@SuppressLint("UnusedMaterial3ScaffoldPaddingParameter") @Composable fun SignUpScreen( - navigateToSignComplete: () -> Unit, + navigateToLedger: () -> Unit, + navigateToSignUpUniversity : (String, AgencyType?) -> Unit, + navigateToAgency : () -> Unit, navigateUp: () -> Unit, viewModel: SignUpViewModel = hiltViewModel() ) { @@ -72,14 +91,14 @@ fun SignUpScreen( Scaffold( modifier = Modifier .fillMaxSize() - .background(White) - .padding(horizontal = MMHorizontalSpacing), + .background(White), topBar = { Row( modifier = Modifier .fillMaxWidth() .height(44.dp) - .background(White), + .background(White) + .padding(horizontal = MMHorizontalSpacing), verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.Start ) { @@ -96,10 +115,11 @@ fun SignUpScreen( ) } }, - content = { innerPadding -> + content = { SignUpContent( - modifier = Modifier.padding(innerPadding), - navigateToSignComplete = navigateToSignComplete, + navigateToLedger = navigateToLedger, + navigateToSignUpUniversity = navigateToSignUpUniversity, + navigateToAgency = navigateToAgency, viewModel = viewModel, state = state ) @@ -111,137 +131,193 @@ fun SignUpScreen( @Composable fun SignUpContent( - modifier: Modifier = Modifier, - navigateToSignComplete: () -> Unit, + navigateToLedger: () -> Unit, + navigateToSignUpUniversity : (String, AgencyType?) -> Unit, + navigateToAgency : () -> Unit, viewModel: SignUpViewModel, state: SignUpState ) { + val focusManager = LocalFocusManager.current + LaunchedEffect(key1 = state.isUnivCreated) { if (state.isUnivCreated) { - navigateToSignComplete() + viewModel.registerAgency() + } + } + + LaunchedEffect(key1 = state.isAgencyCreated) { + if (state.isAgencyCreated) { + navigateToLedger() } } viewModel.collectSideEffect { when (it) { - is SignUpSideEffect.UniversitiesApi -> { - viewModel.searchUniv(it.univ) - } - is SignUpSideEffect.CreateUniversityApi -> { viewModel.createUniv(it.universityName, it.grade) } + else -> {} } } Box( - modifier = modifier + modifier = Modifier .fillMaxSize() .background(color = White) ) { Column( - modifier = Modifier.fillMaxSize(), + modifier = Modifier.fillMaxSize() + .padding(horizontal = MMHorizontalSpacing), horizontalAlignment = Alignment.Start ) { SignUpTitleView( modifier = Modifier .fillMaxWidth() - .padding(top = 8.dp), - subTitleState = state.subTitleState + .height(89.dp) + .padding(top = 12.dp, bottom = 12.dp), ) - Box( + Column( modifier = Modifier - .padding(top = 40.dp) + .padding(top = 28.dp, end = 28.dp) .fillMaxWidth() ) { - if (!state.isSelected) { - SearchUnivView( - isFilled = state.isFilled, - isFilledChanged = { isFilled -> viewModel.isFilledChanged(isFilled) }, - isListVisible = state.isListVisible, - isListVisibleChanged = { isListVisible -> - viewModel.isListVisibleChanged( - isListVisible - ) - }, - isItemSelectedChanged = { isItemSelected -> - viewModel.isItemSelectedChanged( - isItemSelected - ) - }, - isItemSelected = state.isItemSelected, - textValue = state.textValue, - universityResponse = state.universityResponse, - onClick = { - viewModel.isSelectedChanged(true) - viewModel.selectedUnivChanged(it) - }, - onChange = { viewModel.textValueChanged(it) }, - onSearchIconClicked = { - viewModel.eventEmit(SignUpSideEffect.UniversitiesApi(it)) - }, - value = state.textValue, - isButtonVisibleChanged = { isButtonVisible -> viewModel.isButtonVisibleChanged(isButtonVisible)} + Text( + text = "소속 유형", + style = Body2, + color = Color.Black + ) + Row( + modifier = Modifier + .fillMaxWidth() + .padding(top = 8.dp), + horizontalArrangement = Arrangement.spacedBy(10.dp) + ) { + MDSSelection( + modifier = Modifier.weight(1f), + text = "기타 모임", + enabled = true, + isSelected = state.agencyType == AgencyType.GENERAL, + onClick = { viewModel.onChangeAgencyType(AgencyType.GENERAL) } + ) + MDSSelection( + modifier = Modifier.weight(1f), + text = "동아리", + enabled = true, + isSelected = state.agencyType == AgencyType.CLUB, + onClick = { viewModel.onChangeAgencyType(AgencyType.CLUB) } + ) + MDSSelection( + modifier = Modifier.weight(1f), + text = "학생회", + enabled = true, + isSelected = state.agencyType == AgencyType.STUDENT_COUNCIL, + onClick = { viewModel.onChangeAgencyType(AgencyType.STUDENT_COUNCIL) } + ) + } + } + AnimatedVisibility(visible = state.MDSSelected) { + Column( + modifier = Modifier + .padding(top = 28.dp), + ) { + Text( + text = "소속 이름", + style = Body2, + color = Blue04 ) - } else { - Column(modifier = Modifier.fillMaxSize()) { - SignCompleteCheckedView( - modifier = Modifier.fillMaxWidth(), - text = state.selectedUniv, - onChanged = { - viewModel.isSelectedChanged(false) + MDSTextField( + modifier = Modifier + .fillMaxWidth() + .onFocusChanged { focusState -> + if (focusState.isFocused) { + viewModel.updateEdittextFocused(true) + } else { + viewModel.updateEdittextFocused(false) + } }, - onSelectedGrade = { viewModel.selectedGradeChange(null) }, - onItemSelectedChanged = { viewModel.isItemSelectedChanged(it) }, - isEnableChanged = { viewModel.isEnabledChanged(it) } - ) - SignUpGradeView( - modifier = Modifier.fillMaxWidth(), - selectedGrade = state.selectedGrade, - selectedGradeChange = {selectedGrade -> viewModel.selectedGradeChange(selectedGrade)}, - onClick = { viewModel.isEnabledChanged(true) }, - changeGradeInfor = { viewModel.gradeInforChanged(it) } - ) - } + value = state.agencyName, + onValueChange = viewModel::updateAgencyName, + title = "", + isFilled = false, + singleLine = true, + maxCount = 50, + placeholder = "", + icon = MDSTextFieldIcons.Clear, + onIconClick = { viewModel.updateAgencyName(TextFieldValue()) }, + keyboardActions = KeyboardActions(onDone = { focusManager.clearFocus() }), + keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Text) + ) } } } - Box( + Column( modifier = Modifier .fillMaxWidth() .align(Alignment.BottomCenter) ) { - if(state.isButtonVisible){ - SignUpButtonView( - modifier = Modifier.fillMaxWidth(), - isEnabled = state.isEnabled, - visiblePopUpError = state.visiblePopUpError, - popUpErrorMessage = state.popUpErrorMessage, - visiblePopUpErrorChanged = { visiblePopUpError -> - viewModel.visiblePopUpErrorChanged(visiblePopUpError) - }, - onCreateUniversity = { - viewModel.eventEmit( - SignUpSideEffect.CreateUniversityApi( - state.selectedUniv, - state.gradeInfor - ) + SignUpButtonView( + modifier = Modifier.fillMaxWidth() + .padding(horizontal = if (state.editTextFocused) 0.dp else MMHorizontalSpacing), + isEnabled = state.isButtonVisible, + visiblePopUpError = state.visiblePopUpError, + popUpErrorMessage = state.popUpErrorMessage, + visiblePopUpErrorChanged = { visiblePopUpError -> + viewModel.visiblePopUpErrorChanged(visiblePopUpError) + }, + onCreateUniversity = { + viewModel.eventEmit( + SignUpSideEffect.CreateUniversityApi( + state.selectedUniv, + state.gradeInfor ) - }, + ) + }, + navigateToSignUpUniversity = { agencyName, agencyType -> + navigateToSignUpUniversity(agencyName, agencyType) + }, + agencyName = state.agencyName.text, + agencyType = state.agencyType, + pageType = 1 + ) + + if (!state.editTextFocused){ + Spacer(modifier = Modifier.height(60.dp)) + } + + } + + if (!state.editTextFocused) { + Column( + modifier = Modifier + .fillMaxWidth() + .align(Alignment.BottomCenter) + ) { + Spacer(modifier = Modifier.height(16.dp)) + + Text( + modifier = Modifier + .fillMaxWidth() + .noRippleClickable { + viewModel.eventEmit( + SignUpSideEffect.CreateUniversityApi( + state.selectedUniv, + state.gradeInfor + ) + ) + navigateToAgency() + }, + textAlign = TextAlign.Center, + text = "총무에게 초대받았어요", + style = Body3, + color = Blue04 ) + + Spacer(modifier = Modifier.height(24.dp)) + } } } } - -@Preview -@Composable -fun Preview(){ - SignUpScreen( - navigateUp = {}, - navigateToSignComplete = {} - ) -} \ No newline at end of file diff --git a/feature/sign/src/main/java/com/moneymong/moneymong/feature/sign/item/UnivItem.kt b/feature/sign/src/main/java/com/moneymong/moneymong/feature/sign/item/UnivItem.kt index 80dfb41a..615b7ee3 100644 --- a/feature/sign/src/main/java/com/moneymong/moneymong/feature/sign/item/UnivItem.kt +++ b/feature/sign/src/main/java/com/moneymong/moneymong/feature/sign/item/UnivItem.kt @@ -29,7 +29,8 @@ fun UnivItem( isItemSelectedChanged: (Boolean) -> Unit, univs: University, onClick: (String) -> Unit, - isButtonVisibleChanged : (Boolean) -> Unit + isButtonVisibleChanged : (Boolean) -> Unit, + selectedUniv : String ) { Row( modifier = Modifier @@ -50,7 +51,7 @@ fun UnivItem( ) Text( text = univs.schoolName, - color = if (isItemSelected) Blue04 else Black, + color = if (selectedUniv == univs.schoolName) Blue04 else Black, style = Body4, modifier = Modifier .weight(1f) @@ -62,7 +63,7 @@ fun UnivItem( painter = painterResource(id = R.drawable.ic_check), contentDescription = null, modifier = Modifier.size(24.dp), - tint = if (isItemSelected) Blue04 else Gray03 + tint = if (selectedUniv == univs.schoolName) Blue04 else Gray03 ) } } \ No newline at end of file diff --git a/feature/sign/src/main/java/com/moneymong/moneymong/feature/sign/navigation/SignUpNavigation.kt b/feature/sign/src/main/java/com/moneymong/moneymong/feature/sign/navigation/SignUpNavigation.kt index 82bf301a..f7fed170 100644 --- a/feature/sign/src/main/java/com/moneymong/moneymong/feature/sign/navigation/SignUpNavigation.kt +++ b/feature/sign/src/main/java/com/moneymong/moneymong/feature/sign/navigation/SignUpNavigation.kt @@ -5,6 +5,7 @@ import androidx.navigation.NavGraphBuilder import androidx.navigation.NavOptions import androidx.navigation.compose.composable import com.moneymong.moneymong.feature.sign.SignUpScreen +import com.moneymong.moneymong.feature.sign.util.AgencyType const val signUpRoute = "signup_route" @@ -13,12 +14,16 @@ fun NavController.navigateSignUp(navOptions: NavOptions? = null) { } fun NavGraphBuilder.signUpScreen( - navigateToSignComplete: () -> Unit, + navigateToLedger: () -> Unit, + navigateToSignUniversity : (String, AgencyType?) -> Unit, + navigateToAgency : () -> Unit, navigateUp: () -> Unit ) { composable(route = signUpRoute) { SignUpScreen( - navigateToSignComplete = navigateToSignComplete, + navigateToLedger = navigateToLedger, + navigateToSignUpUniversity = navigateToSignUniversity, + navigateToAgency = navigateToAgency, navigateUp = navigateUp ) } diff --git a/feature/sign/src/main/java/com/moneymong/moneymong/feature/sign/navigation/SignUpUniversityNavigation.kt b/feature/sign/src/main/java/com/moneymong/moneymong/feature/sign/navigation/SignUpUniversityNavigation.kt new file mode 100644 index 00000000..65f8df38 --- /dev/null +++ b/feature/sign/src/main/java/com/moneymong/moneymong/feature/sign/navigation/SignUpUniversityNavigation.kt @@ -0,0 +1,35 @@ +package com.moneymong.moneymong.feature.sign.navigation + +import androidx.navigation.NavController +import androidx.navigation.NavGraphBuilder +import androidx.navigation.NavOptions +import androidx.navigation.compose.composable +import com.moneymong.moneymong.feature.sign.util.AgencyType +import com.moneymong.moneymong.feature.sign.view.SignUpUniversity + +const val signUpUniversityRoute = "signup_university_route" + +fun NavController.navigateSignUpUniversity(agencyName: String, agencyType: AgencyType?, navOptions: NavOptions? = null) { + val routeWithParams = "signup_university_route?agencyName=$agencyName&agencyType=${agencyType?.name}" + navigate(route = routeWithParams, navOptions = navOptions) +} + +fun NavGraphBuilder.signUpUniversity( + navigateToLedger: () -> Unit, + navigateToAgency : () -> Unit, + navigateUp: () -> Unit, +) { + + composable(route = "$signUpUniversityRoute?agencyName={agencyName}&agencyType={agencyType}") { navBackStackEntry -> + val agencyName = navBackStackEntry.arguments?.getString("agencyName") ?: "" + val agencyType = navBackStackEntry.arguments?.getString("agencyType")?.let { AgencyType.valueOf(it) }.run { AgencyType.CLUB } + + SignUpUniversity( + navigateToLedger = navigateToLedger, + navigateToAgency = navigateToAgency, + navigateUp = navigateUp, + agencyName = agencyName, + agencyType = agencyType + ) + } +} diff --git a/feature/sign/src/main/java/com/moneymong/moneymong/feature/sign/sideeffect/SignUpSideEffect.kt b/feature/sign/src/main/java/com/moneymong/moneymong/feature/sign/sideeffect/SignUpSideEffect.kt index e553a26e..30ef0232 100644 --- a/feature/sign/src/main/java/com/moneymong/moneymong/feature/sign/sideeffect/SignUpSideEffect.kt +++ b/feature/sign/src/main/java/com/moneymong/moneymong/feature/sign/sideeffect/SignUpSideEffect.kt @@ -3,7 +3,6 @@ package com.moneymong.moneymong.feature.sign.sideeffect import com.moneymong.moneymong.common.base.SideEffect sealed class SignUpSideEffect : SideEffect { - data class UniversitiesApi(val univ: String) : SignUpSideEffect() data class CreateUniversityApi( val universityName : String, val grade: Int diff --git a/feature/sign/src/main/java/com/moneymong/moneymong/feature/sign/sideeffect/SignUpUniversitySideEffect.kt b/feature/sign/src/main/java/com/moneymong/moneymong/feature/sign/sideeffect/SignUpUniversitySideEffect.kt new file mode 100644 index 00000000..4de12bf2 --- /dev/null +++ b/feature/sign/src/main/java/com/moneymong/moneymong/feature/sign/sideeffect/SignUpUniversitySideEffect.kt @@ -0,0 +1,6 @@ +package com.moneymong.moneymong.feature.sign.sideeffect + +import com.moneymong.moneymong.common.base.SideEffect + +sealed class SignUpUniversitySideEffect : SideEffect { +} \ No newline at end of file diff --git a/feature/sign/src/main/java/com/moneymong/moneymong/feature/sign/state/SignUpState.kt b/feature/sign/src/main/java/com/moneymong/moneymong/feature/sign/state/SignUpState.kt index d2dd3200..aa781cd3 100644 --- a/feature/sign/src/main/java/com/moneymong/moneymong/feature/sign/state/SignUpState.kt +++ b/feature/sign/src/main/java/com/moneymong/moneymong/feature/sign/state/SignUpState.kt @@ -2,12 +2,13 @@ package com.moneymong.moneymong.feature.sign.state import androidx.compose.ui.text.input.TextFieldValue import com.moneymong.moneymong.common.base.State +import com.moneymong.moneymong.feature.sign.util.AgencyType import com.moneymong.moneymong.feature.sign.util.Grade import com.moneymong.moneymong.model.sign.UniversitiesResponse data class SignUpState( //screen - val isSelected: Boolean = false, + val isSelected: Boolean? = null, val selectedUniv: String = "", val textValue: TextFieldValue = TextFieldValue(), val isEnabled: Boolean = false, @@ -18,15 +19,20 @@ data class SignUpState( val isFilled: Boolean = false, val universityResponse: UniversitiesResponse? = null, val isUnivCreated : Boolean = false, + val isAgencyCreated : Boolean = false, + val editTextFocused : Boolean = false, + val MDSSelected : Boolean = false, //item val isItemSelected : Boolean = false, val selectedGrade : Grade? = null, + val agencyType : AgencyType? = null, + val agencyName : TextFieldValue = TextFieldValue(), //error val visibleError : Boolean = false, val errorMessage : String = "", val visiblePopUpError : Boolean = false, val popUpErrorMessage : String = "", - val isButtonVisible : Boolean = true, + val isButtonVisible : Boolean = false, ) : State \ No newline at end of file diff --git a/feature/sign/src/main/java/com/moneymong/moneymong/feature/sign/state/SignUpUniversityState.kt b/feature/sign/src/main/java/com/moneymong/moneymong/feature/sign/state/SignUpUniversityState.kt new file mode 100644 index 00000000..94a8c051 --- /dev/null +++ b/feature/sign/src/main/java/com/moneymong/moneymong/feature/sign/state/SignUpUniversityState.kt @@ -0,0 +1,31 @@ +package com.moneymong.moneymong.feature.sign.state + +import androidx.compose.ui.text.input.TextFieldValue +import com.moneymong.moneymong.common.base.State +import com.moneymong.moneymong.feature.sign.util.AgencyType +import com.moneymong.moneymong.model.sign.UniversitiesResponse + +data class SignUpUniversityState ( + //screen + val isSelected: Boolean? = null, + val selectedUniv: String = "", + val textValue: TextFieldValue = TextFieldValue(), + val isEnabled: Boolean = false, + val gradeInfor: Int = 0, + //view + val isListVisible: Boolean = false, + val isFilled: Boolean = false, + val universityResponse: UniversitiesResponse? = null, + //item + val isItemSelected : Boolean = false, + val agencyType : AgencyType? = null, + //error + val visibleError : Boolean = false, + val errorMessage : String = "", + val visiblePopUpError : Boolean = false, + val popUpErrorMessage : String = "", + val isButtonVisible : Boolean = true, + + val isUnivCreated : Boolean = false, + val isAgencyCreated : Boolean = false, +): State \ No newline at end of file diff --git a/feature/sign/src/main/java/com/moneymong/moneymong/feature/sign/util/AgencyType.kt b/feature/sign/src/main/java/com/moneymong/moneymong/feature/sign/util/AgencyType.kt new file mode 100644 index 00000000..0d561f2c --- /dev/null +++ b/feature/sign/src/main/java/com/moneymong/moneymong/feature/sign/util/AgencyType.kt @@ -0,0 +1,8 @@ +package com.moneymong.moneymong.feature.sign.util + +enum class AgencyType(val text: String) { + GENERAL("GENERAL"), + CLUB("CLUB"), + STUDENT_COUNCIL("STUDENT_COUNCIL"), + NONE("NONE") +} diff --git a/feature/sign/src/main/java/com/moneymong/moneymong/feature/sign/view/SearchUnivView.kt b/feature/sign/src/main/java/com/moneymong/moneymong/feature/sign/view/SearchUnivView.kt index f08c941c..283502ef 100644 --- a/feature/sign/src/main/java/com/moneymong/moneymong/feature/sign/view/SearchUnivView.kt +++ b/feature/sign/src/main/java/com/moneymong/moneymong/feature/sign/view/SearchUnivView.kt @@ -49,6 +49,7 @@ fun SearchUnivView( universityResponse: UniversitiesResponse?, value: TextFieldValue, isButtonVisibleChanged: (Boolean) -> Unit, + selectedUniv : String ) { val keyboardController = LocalSoftwareKeyboardController.current @@ -122,7 +123,8 @@ fun SearchUnivView( isItemSelectedChanged = isItemSelectedChanged, univs = universityResponse.universities, onClick = onClick, - isButtonVisibleChanged = isButtonVisibleChanged + isButtonVisibleChanged = isButtonVisibleChanged, + selectedUniv = selectedUniv ) } else { Column( @@ -148,7 +150,8 @@ fun UnivList( isItemSelectedChanged: (Boolean) -> Unit, univs: List, onClick: (String) -> Unit, - isButtonVisibleChanged: (Boolean) -> Unit + isButtonVisibleChanged: (Boolean) -> Unit, + selectedUniv: String ) { LazyColumn { items(univs) { univ -> @@ -157,7 +160,8 @@ fun UnivList( isItemSelectedChanged = isItemSelectedChanged, univs = univ, onClick = onClick, - isButtonVisibleChanged = isButtonVisibleChanged + isButtonVisibleChanged = isButtonVisibleChanged, + selectedUniv = selectedUniv ) } } diff --git a/feature/sign/src/main/java/com/moneymong/moneymong/feature/sign/view/SignUpButtonView.kt b/feature/sign/src/main/java/com/moneymong/moneymong/feature/sign/view/SignUpButtonView.kt index 6b83058b..919d17ae 100644 --- a/feature/sign/src/main/java/com/moneymong/moneymong/feature/sign/view/SignUpButtonView.kt +++ b/feature/sign/src/main/java/com/moneymong/moneymong/feature/sign/view/SignUpButtonView.kt @@ -16,6 +16,7 @@ import com.moneymong.moneymong.design_system.component.button.MDSButtonType import com.moneymong.moneymong.design_system.error.ErrorDialog import com.moneymong.moneymong.design_system.theme.Blue04 import com.moneymong.moneymong.design_system.theme.Body3 +import com.moneymong.moneymong.feature.sign.util.AgencyType @Composable fun SignUpButtonView( @@ -25,6 +26,10 @@ fun SignUpButtonView( popUpErrorMessage: String, visiblePopUpErrorChanged: (Boolean) -> Unit, onCreateUniversity: () -> Unit, + navigateToSignUpUniversity : (String, AgencyType?) -> Unit, + agencyName: String, + agencyType: AgencyType?, + pageType : Int ) { if (visiblePopUpError) { ErrorDialog( @@ -38,30 +43,16 @@ fun SignUpButtonView( modifier = modifier ) { MDSButton( - modifier = Modifier.fillMaxWidth(), + modifier = Modifier.fillMaxWidth() + .height(56.dp), onClick = { - onCreateUniversity() + if(agencyType == AgencyType.GENERAL || pageType == 2) onCreateUniversity() else if (agencyType != AgencyType.GENERAL && pageType == 1) navigateToSignUpUniversity(agencyName, agencyType) }, - text = "가입하기", + text = if(agencyType == AgencyType.GENERAL || pageType == 2) "등록하기" else "다음으로", type = MDSButtonType.PRIMARY, size = MDSButtonSize.LARGE, enabled = isEnabled ) - Spacer(modifier = Modifier.height(16.dp)) - Text( - modifier = Modifier - .fillMaxWidth() - .noRippleClickable { - onCreateUniversity() - }, - textAlign = TextAlign.Center, - text = "입력할 대학 정보가 없어요", - color = Blue04, - style = Body3 - ) - - Spacer(modifier = Modifier.height(28.dp)) - } } diff --git a/feature/sign/src/main/java/com/moneymong/moneymong/feature/sign/view/SignUpTitleView.kt b/feature/sign/src/main/java/com/moneymong/moneymong/feature/sign/view/SignUpTitleView.kt index dad5d7e5..476e3f85 100644 --- a/feature/sign/src/main/java/com/moneymong/moneymong/feature/sign/view/SignUpTitleView.kt +++ b/feature/sign/src/main/java/com/moneymong/moneymong/feature/sign/view/SignUpTitleView.kt @@ -15,23 +15,16 @@ import com.moneymong.moneymong.design_system.theme.Heading2 import com.moneymong.moneymong.design_system.theme.White @Composable -fun SignUpTitleView(modifier: Modifier = Modifier, subTitleState: Boolean) { +fun SignUpTitleView(modifier: Modifier = Modifier, /*subTitleState: Boolean*/) { Column( modifier = modifier.background(White), horizontalAlignment = Alignment.Start ) { Text( - text = "대학정보를 알려주세요!", + text = "회비관리가 필요한\n소속정보를 알려주세요!", style = Heading2, color = Black ) - Text( - modifier = Modifier.padding(top= 8.dp), - text = "학교 이름과 학년을 선택해주세요.", - style = Body3, - color = if (!subTitleState) Gray06.copy(alpha = 0.4f) else Gray06 - - ) } } \ No newline at end of file diff --git a/feature/sign/src/main/java/com/moneymong/moneymong/feature/sign/view/SignUpUniversity.kt b/feature/sign/src/main/java/com/moneymong/moneymong/feature/sign/view/SignUpUniversity.kt new file mode 100644 index 00000000..ce80745b --- /dev/null +++ b/feature/sign/src/main/java/com/moneymong/moneymong/feature/sign/view/SignUpUniversity.kt @@ -0,0 +1,223 @@ +package com.moneymong.moneymong.feature.sign.view + +import android.annotation.SuppressLint +import androidx.activity.compose.BackHandler +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.fillMaxSize +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.height +import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.size +import androidx.compose.material3.Icon +import androidx.compose.material3.Scaffold +import androidx.compose.material3.Text +import androidx.compose.runtime.Composable +import androidx.compose.runtime.LaunchedEffect +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.graphics.Color +import androidx.compose.ui.res.painterResource +import androidx.compose.ui.unit.dp +import androidx.hilt.navigation.compose.hiltViewModel +import com.moneymong.moneymong.common.ui.noRippleClickable +import com.moneymong.moneymong.design_system.R +import com.moneymong.moneymong.design_system.error.ErrorDialog +import com.moneymong.moneymong.design_system.error.ErrorScreen +import com.moneymong.moneymong.design_system.theme.Black +import com.moneymong.moneymong.design_system.theme.Body3 +import com.moneymong.moneymong.design_system.theme.Gray06 +import com.moneymong.moneymong.design_system.theme.Gray07 +import com.moneymong.moneymong.design_system.theme.Gray08 +import com.moneymong.moneymong.design_system.theme.Heading2 +import com.moneymong.moneymong.design_system.theme.MMHorizontalSpacing +import com.moneymong.moneymong.design_system.theme.White +import com.moneymong.moneymong.feature.sign.SignUpContent +import com.moneymong.moneymong.feature.sign.sideeffect.SignUpSideEffect +import com.moneymong.moneymong.feature.sign.sideeffect.SignUpUniversitySideEffect +import com.moneymong.moneymong.feature.sign.state.SignUpUniversityState +import com.moneymong.moneymong.feature.sign.util.AgencyType +import com.moneymong.moneymong.feature.sign.viewmodel.SignUpUniversityViewModel +import com.moneymong.moneymong.feature.sign.viewmodel.SignUpViewModel +import org.orbitmvi.orbit.compose.collectAsState +import org.orbitmvi.orbit.compose.collectSideEffect + +@SuppressLint("UnusedMaterial3ScaffoldPaddingParameter") +@Composable +fun SignUpUniversity( + navigateToLedger : () -> Unit, + navigateToAgency : () -> Unit, + navigateUp : () -> Unit, + agencyName : String, + agencyType: AgencyType, + viewModel: SignUpUniversityViewModel = hiltViewModel() +){ + val state = viewModel.collectAsState().value + + BackHandler { + navigateUp() + } + + if(state.visibleError){ + ErrorScreen( + modifier = Modifier.fillMaxSize(), + message = state.errorMessage, + onRetry = { + viewModel.visibleErrorChanged(false) + } + ) + } + else if(state.visiblePopUpError){ + ErrorDialog( + message = state.popUpErrorMessage, + onConfirm = { + viewModel.visiblePopUpErrorChanged(false) + } + ) + } + else { + Scaffold( + modifier = Modifier + .fillMaxSize() + .background(White) + .padding(horizontal = MMHorizontalSpacing), + topBar = { + Row( + modifier = Modifier + .fillMaxWidth() + .height(44.dp) + .background(White), + verticalAlignment = Alignment.CenterVertically, + horizontalArrangement = Arrangement.Start + ) { + Icon( + painter = painterResource(id = R.drawable.ic_chevron_left), + contentDescription = null, + modifier = Modifier + .size(24.dp) + .background(White) + .noRippleClickable { + navigateUp() + }, + tint = Gray07 + ) + } + }, + content = { + SignUpUniversityContent( + navigateToLedger = navigateToLedger, + agencyName = agencyName, + agencyType = agencyType, + viewModel = viewModel, + state = state + ) + } + ) + } +} + +@Composable +fun SignUpUniversityContent ( + navigateToLedger: () -> Unit, + agencyName: String, + agencyType: AgencyType, + viewModel: SignUpUniversityViewModel, + state: SignUpUniversityState + +) { + + LaunchedEffect(key1 = state.isUnivCreated) { + if (state.isUnivCreated) { + viewModel.registerAgency(agencyName, agencyType) + } + } + + LaunchedEffect(key1 = state.isAgencyCreated) { + if (state.isAgencyCreated) { + navigateToLedger() + } + } + + Column( + modifier = Modifier.background(White) + ) { + Text( + modifier = Modifier.padding(top = 12.dp, bottom = 8.dp), + text = "어디 학교 교내 동아리인가요?", + style = Heading2, + color = Black + ) + Text( + modifier = Modifier.padding(bottom = 12.dp), + text = "소속 대학교를 알려주세요", + style = Body3, + color = Gray06 + ) + + SearchUnivView( + modifier = Modifier + .padding(top = 28.dp, bottom = 28.dp,) + .fillMaxWidth() + .height(0.dp) + .weight(1.0F), + isFilled = state.isFilled, + isFilledChanged = { isFilled -> viewModel.isFilledChanged(isFilled) }, + isListVisible = state.isListVisible, + isListVisibleChanged = { isListVisible -> + viewModel.isListVisibleChanged( + isListVisible + ) + }, + isItemSelectedChanged = { isItemSelected -> + viewModel.isItemSelectedChanged( + isItemSelected + ) + }, + isItemSelected = state.isItemSelected, + textValue = state.textValue, + universityResponse = state.universityResponse, + onClick = { + viewModel.isSelectedChanged(true) + viewModel.selectedUnivChanged(it) + }, + onChange = { viewModel.textValueChanged(it) }, + onSearchIconClicked = { + viewModel.searchUniv(it) + }, + value = state.textValue, + isButtonVisibleChanged = { isButtonVisible -> + viewModel.isButtonVisibleChanged( + isButtonVisible + ) + }, + selectedUniv = state.selectedUniv + ) + + Column( + modifier = Modifier + .fillMaxWidth() + .align(Alignment.CenterHorizontally), + verticalArrangement = Arrangement.Bottom + ) { + SignUpButtonView( + modifier = Modifier.fillMaxWidth(), + isEnabled = state.isItemSelected, + visiblePopUpError = state.visiblePopUpError, + popUpErrorMessage = state.popUpErrorMessage, + visiblePopUpErrorChanged = { visiblePopUpError -> + viewModel.visiblePopUpErrorChanged(visiblePopUpError) + }, + onCreateUniversity = { + viewModel.createUniv(state.selectedUniv, state.gradeInfor) + }, + navigateToSignUpUniversity = { agencyName, agencyType -> }, + agencyName = agencyName, + agencyType = agencyType, + pageType = 2 + ) + } + } +} diff --git a/feature/sign/src/main/java/com/moneymong/moneymong/feature/sign/viewmodel/SignUpUniversityViewModel.kt b/feature/sign/src/main/java/com/moneymong/moneymong/feature/sign/viewmodel/SignUpUniversityViewModel.kt new file mode 100644 index 00000000..b16f9d07 --- /dev/null +++ b/feature/sign/src/main/java/com/moneymong/moneymong/feature/sign/viewmodel/SignUpUniversityViewModel.kt @@ -0,0 +1,171 @@ +package com.moneymong.moneymong.feature.sign.viewmodel + +import android.view.View +import androidx.compose.ui.text.input.TextFieldValue +import androidx.lifecycle.ViewModel +import androidx.lifecycle.viewModelScope +import com.moneymong.moneymong.common.base.BaseViewModel +import com.moneymong.moneymong.domain.usecase.agency.RegisterAgencyUseCase +import com.moneymong.moneymong.domain.usecase.signup.SchoolInfoUseCase +import com.moneymong.moneymong.domain.usecase.university.CreateUniversityUseCase +import com.moneymong.moneymong.domain.usecase.university.SearchUniversityUseCase +import com.moneymong.moneymong.feature.sign.sideeffect.SignUpUniversitySideEffect +import com.moneymong.moneymong.feature.sign.state.SignUpUniversityState +import com.moneymong.moneymong.feature.sign.util.AgencyType +import com.moneymong.moneymong.model.agency.AgencyRegisterRequest +import com.moneymong.moneymong.model.sign.UnivRequest +import dagger.hilt.android.lifecycle.HiltViewModel +import kotlinx.coroutines.launch +import org.orbitmvi.orbit.annotation.OrbitExperimental +import org.orbitmvi.orbit.syntax.simple.blockingIntent +import org.orbitmvi.orbit.syntax.simple.intent +import org.orbitmvi.orbit.syntax.simple.reduce +import javax.inject.Inject + +@HiltViewModel +class SignUpUniversityViewModel @Inject constructor( + private val createUniversityUseCase: CreateUniversityUseCase, + private val registerAgencyUseCase : RegisterAgencyUseCase, + private val schoolInfoUseCase : SchoolInfoUseCase, + private val searchUniversityUseCase: SearchUniversityUseCase +) : BaseViewModel(SignUpUniversityState()){ + + fun searchUniv(searchQuery: String) = intent { + searchUniversityUseCase(searchQuery) + .onSuccess { + reduce { + state.copy( + universityResponse = it + ) + } + }.onFailure { + reduce { + state.copy( + visibleError = true, + errorMessage = it.message.toString() + ) + } + } + } + + + fun createUniv(universityName: String?, grade: Int?) = intent { + val body = UnivRequest(universityName, grade) + createUniversityUseCase(body) + .onSuccess { + storeSchoolInfoProvided(true) + reduce { + state.copy( + isUnivCreated = true + ) + } + } + .onFailure { + reduce { + state.copy( + visiblePopUpError = true, + popUpErrorMessage = it.message.toString() + ) + } + } + } + + fun registerAgency(agencyName: String, agencyType: AgencyType) = intent{ + registerAgencyUseCase(AgencyRegisterRequest(agencyName, agencyType.text)) + .onSuccess { + reduce { + state.copy( + isAgencyCreated = true + ) + } + } + .onFailure { + reduce { + state.copy( + visiblePopUpError = true, + popUpErrorMessage = it.message.toString() + ) + } + } + + } + + private fun storeSchoolInfoProvided(infoExist : Boolean ){ + viewModelScope.launch { + schoolInfoUseCase.invoke(infoExist) + } + } + + fun isSelectedChanged(isSelected: Boolean) = intent { + reduce { + state.copy( + isSelected = isSelected + ) + } + } + + fun selectedUnivChanged(selectedUniv: String) = intent { + reduce { + state.copy( + selectedUniv = selectedUniv + ) + } + } + + @OptIn(OrbitExperimental::class) + fun textValueChanged(textValue: TextFieldValue) = blockingIntent { + reduce { + state.copy( + textValue = textValue + ) + } + } + + fun isFilledChanged(isFilled: Boolean) = intent { + reduce { + state.copy( + isFilled = isFilled + ) + } + } + + fun isListVisibleChanged(isListVisible: Boolean) = intent { + reduce { + state.copy( + isListVisible = isListVisible + ) + } + } + + fun isItemSelectedChanged(isItemSelected: Boolean) = intent { + reduce { + state.copy( + isItemSelected = isItemSelected + ) + } + } + + fun isButtonVisibleChanged(isButtonVisible: Boolean) = intent { + reduce { + state.copy( + isButtonVisible = isButtonVisible + ) + } + } + + fun visiblePopUpErrorChanged(visiblePopUpError: Boolean) = intent { + reduce { + state.copy( + visiblePopUpError = visiblePopUpError, + ) + } + } + + fun visibleErrorChanged(visibleError: Boolean) = intent { + reduce { + state.copy( + visibleError = visibleError, + ) + } + } +} \ No newline at end of file diff --git a/feature/sign/src/main/java/com/moneymong/moneymong/feature/sign/viewmodel/SignUpViewModel.kt b/feature/sign/src/main/java/com/moneymong/moneymong/feature/sign/viewmodel/SignUpViewModel.kt index 85fe8a43..2b3a61f8 100644 --- a/feature/sign/src/main/java/com/moneymong/moneymong/feature/sign/viewmodel/SignUpViewModel.kt +++ b/feature/sign/src/main/java/com/moneymong/moneymong/feature/sign/viewmodel/SignUpViewModel.kt @@ -3,12 +3,16 @@ package com.moneymong.moneymong.feature.sign.viewmodel import androidx.compose.ui.text.input.TextFieldValue import androidx.lifecycle.viewModelScope import com.moneymong.moneymong.common.base.BaseViewModel +import com.moneymong.moneymong.domain.usecase.agency.AgencyJoinUseCase +import com.moneymong.moneymong.domain.usecase.agency.RegisterAgencyUseCase import com.moneymong.moneymong.domain.usecase.signup.SchoolInfoUseCase import com.moneymong.moneymong.domain.usecase.university.CreateUniversityUseCase import com.moneymong.moneymong.domain.usecase.university.SearchUniversityUseCase import com.moneymong.moneymong.feature.sign.sideeffect.SignUpSideEffect import com.moneymong.moneymong.feature.sign.state.SignUpState +import com.moneymong.moneymong.feature.sign.util.AgencyType import com.moneymong.moneymong.feature.sign.util.Grade +import com.moneymong.moneymong.model.agency.AgencyRegisterRequest import com.moneymong.moneymong.model.sign.UnivRequest import dagger.hilt.android.lifecycle.HiltViewModel import kotlinx.coroutines.CoroutineScope @@ -23,10 +27,10 @@ import javax.inject.Inject @HiltViewModel class SignUpViewModel @Inject constructor( private val createUniversityUseCase: CreateUniversityUseCase, - private val searchUniversityUseCase: SearchUniversityUseCase, + private val registerAgencyUseCase: RegisterAgencyUseCase, private val schoolInfoUseCase: SchoolInfoUseCase, ) : BaseViewModel(SignUpState()) { - fun createUniv(universityName: String?, grade: Int?) = intent { + fun createUniv(universityName: String, grade: Int) = intent { val body = UnivRequest(universityName, grade) createUniversityUseCase(body) .onSuccess { @@ -47,133 +51,70 @@ class SignUpViewModel @Inject constructor( } } - fun searchUniv(searchQuery: String) = intent { - searchUniversityUseCase(searchQuery) + fun registerAgency() = intent{ + registerAgencyUseCase(AgencyRegisterRequest(state.agencyName.text, AgencyType.GENERAL.text)) .onSuccess { reduce { state.copy( - universityResponse = it + isAgencyCreated = true ) } - }.onFailure { + } + .onFailure { reduce { state.copy( - visibleError = true, - errorMessage = it.message.toString() + visiblePopUpError = true, + popUpErrorMessage = it.message.toString() ) } } + } - fun storeSchoolInfoProvided(infoExist : Boolean ){ + private fun storeSchoolInfoProvided(infoExist : Boolean ){ viewModelScope.launch { schoolInfoUseCase.invoke(infoExist) } } - fun isSelectedChanged(isSelected: Boolean) = intent { - reduce { - state.copy( - isSelected = isSelected - ) - } - } - - fun selectedUnivChanged(selectedUniv: String) = intent { - reduce { - state.copy( - selectedUniv = selectedUniv - ) - } - } - - @OptIn(OrbitExperimental::class) - fun textValueChanged(textValue: TextFieldValue) = blockingIntent { - reduce { - state.copy( - textValue = textValue - ) - } - } - - fun isEnabledChanged(isEnable: Boolean) = intent { - reduce { - state.copy( - isEnabled = isEnable - ) - } - } - - fun subTitleStateChanged(subTitleState: Boolean) = intent { - reduce { - state.copy( - subTitleState = subTitleState - ) - } - } - - fun gradeInforChanged(gradeInfor: Int) = intent { - reduce { - state.copy( - gradeInfor = gradeInfor - ) - } - } - - - fun isFilledChanged(isFilled: Boolean) = intent { - reduce { - state.copy( - isFilled = isFilled - ) - } - } - - fun isListVisibleChanged(isListVisible: Boolean) = intent { - reduce { - state.copy( - isListVisible = isListVisible - ) - } - } - - fun isItemSelectedChanged(isItemSelected: Boolean) = intent { + fun visiblePopUpErrorChanged(visiblePopUpError: Boolean) = intent { reduce { state.copy( - isItemSelected = isItemSelected + visiblePopUpError = visiblePopUpError, ) } } - fun selectedGradeChange(selectedGrade: Grade?) = intent { + fun visibleErrorChanged(visibleError: Boolean) = intent { reduce { state.copy( - selectedGrade = selectedGrade + visibleError = visibleError, ) } } - fun visiblePopUpErrorChanged(visiblePopUpError: Boolean) = intent { - reduce { + fun onChangeAgencyType(agencyType: AgencyType) = intent{ + reduce{ state.copy( - visiblePopUpError = visiblePopUpError, + agencyType = agencyType, + MDSSelected = true, ) } } - fun visibleErrorChanged(visibleError: Boolean) = intent { + fun updateAgencyName(agencyName: TextFieldValue)= intent{ reduce { state.copy( - visibleError = visibleError, + agencyName = agencyName, + isButtonVisible = agencyName.text != "" && state.agencyType != null ) } } - - fun isButtonVisibleChanged(isButtonVisible: Boolean) = intent { + fun updateEdittextFocused(focusState : Boolean) = intent { reduce { state.copy( - isButtonVisible = isButtonVisible + editTextFocused = focusState ) } } From 674211f41525b73719e0660320adeeacb666deed Mon Sep 17 00:00:00 2001 From: eunseo Date: Sun, 29 Dec 2024 00:16:38 +0900 Subject: [PATCH 24/30] =?UTF-8?q?moneymong-520=20Fix:=20=ED=9D=AC=EC=A7=81?= =?UTF-8?q?=EB=8B=98=20=EB=A6=AC=EB=B7=B0=20=EB=B0=98=EC=98=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design_system/component/button/Button.kt | 5 +- .../moneymong/feature/sign/SignUpScreen.kt | 38 +++++++--- .../feature/sign/state/SignUpState.kt | 4 ++ .../sign/state/SignUpUniversityState.kt | 4 ++ .../moneymong/feature/sign/util/AgencyType.kt | 2 +- .../feature/sign/view/SearchUnivView.kt | 11 ++- .../feature/sign/view/SignUpButtonView.kt | 18 ++--- .../feature/sign/view/SignUpUniversity.kt | 71 +++++++++++-------- .../viewmodel/SignUpUniversityViewModel.kt | 17 +++++ 9 files changed, 117 insertions(+), 53 deletions(-) diff --git a/core/design-system/src/main/java/com/moneymong/moneymong/design_system/component/button/Button.kt b/core/design-system/src/main/java/com/moneymong/moneymong/design_system/component/button/Button.kt index 732bd0f1..b9a158ed 100644 --- a/core/design-system/src/main/java/com/moneymong/moneymong/design_system/component/button/Button.kt +++ b/core/design-system/src/main/java/com/moneymong/moneymong/design_system/component/button/Button.kt @@ -30,6 +30,7 @@ fun MDSButton( @DrawableRes iconResource: Int? = null, enabled: Boolean = true, contentHorizontalPadding: Dp = 0.dp, + cornerShape : Dp = 10.dp, ) { val backgroundColor = if (enabled) type.backgroundColor else disabledBackgroundColor val contentColor = if (enabled) type.contentColor else disabledContentColor @@ -38,10 +39,10 @@ fun MDSButton( modifier = modifier .background( color = backgroundColor, - shape = RoundedCornerShape(10.dp) + shape = RoundedCornerShape(cornerShape) ) .clip( - RoundedCornerShape(10.dp) + RoundedCornerShape(cornerShape) ) .clickable( onClick = onClick, diff --git a/feature/sign/src/main/java/com/moneymong/moneymong/feature/sign/SignUpScreen.kt b/feature/sign/src/main/java/com/moneymong/moneymong/feature/sign/SignUpScreen.kt index b722b8d3..c90673b3 100644 --- a/feature/sign/src/main/java/com/moneymong/moneymong/feature/sign/SignUpScreen.kt +++ b/feature/sign/src/main/java/com/moneymong/moneymong/feature/sign/SignUpScreen.kt @@ -116,7 +116,9 @@ fun SignUpScreen( } }, content = { + paddingValues -> SignUpContent( + modifier = Modifier.padding(paddingValues), navigateToLedger = navigateToLedger, navigateToSignUpUniversity = navigateToSignUpUniversity, navigateToAgency = navigateToAgency, @@ -131,6 +133,7 @@ fun SignUpScreen( @Composable fun SignUpContent( + modifier: Modifier, navigateToLedger: () -> Unit, navigateToSignUpUniversity : (String, AgencyType?) -> Unit, navigateToAgency : () -> Unit, @@ -142,7 +145,11 @@ fun SignUpContent( LaunchedEffect(key1 = state.isUnivCreated) { if (state.isUnivCreated) { - viewModel.registerAgency() + if(state.isInvited){ + navigateToAgency() + }else { + viewModel.registerAgency() + } } } @@ -152,6 +159,10 @@ fun SignUpContent( } } + LaunchedEffect(key1 = state.isUnivCreated) { + + } + viewModel.collectSideEffect { when (it) { is SignUpSideEffect.CreateUniversityApi -> { @@ -162,12 +173,13 @@ fun SignUpContent( } Box( - modifier = Modifier + modifier = modifier .fillMaxSize() .background(color = White) ) { Column( - modifier = Modifier.fillMaxSize() + modifier = Modifier + .fillMaxSize() .padding(horizontal = MMHorizontalSpacing), horizontalAlignment = Alignment.Start ) { @@ -180,7 +192,8 @@ fun SignUpContent( Column( modifier = Modifier - .padding(top = 28.dp, end = 28.dp) + .padding(vertical = 28.dp) +// .padding(top = 28.dp, end = 28.dp) .fillMaxWidth() ) { Text( @@ -233,6 +246,7 @@ fun SignUpContent( .onFocusChanged { focusState -> if (focusState.isFocused) { viewModel.updateEdittextFocused(true) + viewModel.changeButtonCornerShape(0.dp) } else { viewModel.updateEdittextFocused(false) } @@ -246,7 +260,12 @@ fun SignUpContent( placeholder = "", icon = MDSTextFieldIcons.Clear, onIconClick = { viewModel.updateAgencyName(TextFieldValue()) }, - keyboardActions = KeyboardActions(onDone = { focusManager.clearFocus() }), + keyboardActions = KeyboardActions( + onDone = { + focusManager.clearFocus() + viewModel.changeButtonCornerShape(10.dp) + } + ), keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Text) ) } @@ -259,7 +278,8 @@ fun SignUpContent( .align(Alignment.BottomCenter) ) { SignUpButtonView( - modifier = Modifier.fillMaxWidth() + modifier = Modifier + .fillMaxWidth() .padding(horizontal = if (state.editTextFocused) 0.dp else MMHorizontalSpacing), isEnabled = state.isButtonVisible, visiblePopUpError = state.visiblePopUpError, @@ -280,7 +300,8 @@ fun SignUpContent( }, agencyName = state.agencyName.text, agencyType = state.agencyType, - pageType = 1 + pageType = 1, + cornerShape = state.buttonCornerShape ) if (!state.editTextFocused){ @@ -307,7 +328,8 @@ fun SignUpContent( state.gradeInfor ) ) - navigateToAgency() + viewModel.changeInvitedType(true) +// navigateToAgency() }, textAlign = TextAlign.Center, text = "총무에게 초대받았어요", diff --git a/feature/sign/src/main/java/com/moneymong/moneymong/feature/sign/state/SignUpState.kt b/feature/sign/src/main/java/com/moneymong/moneymong/feature/sign/state/SignUpState.kt index aa781cd3..1145e682 100644 --- a/feature/sign/src/main/java/com/moneymong/moneymong/feature/sign/state/SignUpState.kt +++ b/feature/sign/src/main/java/com/moneymong/moneymong/feature/sign/state/SignUpState.kt @@ -1,6 +1,8 @@ package com.moneymong.moneymong.feature.sign.state import androidx.compose.ui.text.input.TextFieldValue +import androidx.compose.ui.unit.Dp +import androidx.compose.ui.unit.dp import com.moneymong.moneymong.common.base.State import com.moneymong.moneymong.feature.sign.util.AgencyType import com.moneymong.moneymong.feature.sign.util.Grade @@ -14,6 +16,8 @@ data class SignUpState( val isEnabled: Boolean = false, val subTitleState: Boolean = false, val gradeInfor: Int = 0, + val isInvited : Boolean = false, + val buttonCornerShape : Dp = 10.dp, //view val isListVisible: Boolean = false, val isFilled: Boolean = false, diff --git a/feature/sign/src/main/java/com/moneymong/moneymong/feature/sign/state/SignUpUniversityState.kt b/feature/sign/src/main/java/com/moneymong/moneymong/feature/sign/state/SignUpUniversityState.kt index 94a8c051..d5f2053c 100644 --- a/feature/sign/src/main/java/com/moneymong/moneymong/feature/sign/state/SignUpUniversityState.kt +++ b/feature/sign/src/main/java/com/moneymong/moneymong/feature/sign/state/SignUpUniversityState.kt @@ -1,6 +1,8 @@ package com.moneymong.moneymong.feature.sign.state import androidx.compose.ui.text.input.TextFieldValue +import androidx.compose.ui.unit.Dp +import androidx.compose.ui.unit.dp import com.moneymong.moneymong.common.base.State import com.moneymong.moneymong.feature.sign.util.AgencyType import com.moneymong.moneymong.model.sign.UniversitiesResponse @@ -12,6 +14,8 @@ data class SignUpUniversityState ( val textValue: TextFieldValue = TextFieldValue(), val isEnabled: Boolean = false, val gradeInfor: Int = 0, + val buttonCornerShape : Dp = 10.dp, + val editTextFocused : Boolean = false, //view val isListVisible: Boolean = false, val isFilled: Boolean = false, diff --git a/feature/sign/src/main/java/com/moneymong/moneymong/feature/sign/util/AgencyType.kt b/feature/sign/src/main/java/com/moneymong/moneymong/feature/sign/util/AgencyType.kt index 0d561f2c..78b9ae70 100644 --- a/feature/sign/src/main/java/com/moneymong/moneymong/feature/sign/util/AgencyType.kt +++ b/feature/sign/src/main/java/com/moneymong/moneymong/feature/sign/util/AgencyType.kt @@ -2,7 +2,7 @@ package com.moneymong.moneymong.feature.sign.util enum class AgencyType(val text: String) { GENERAL("GENERAL"), - CLUB("CLUB"), + CLUB("IN_SCHOOL_CLUB"), STUDENT_COUNCIL("STUDENT_COUNCIL"), NONE("NONE") } diff --git a/feature/sign/src/main/java/com/moneymong/moneymong/feature/sign/view/SearchUnivView.kt b/feature/sign/src/main/java/com/moneymong/moneymong/feature/sign/view/SearchUnivView.kt index 283502ef..002bcf47 100644 --- a/feature/sign/src/main/java/com/moneymong/moneymong/feature/sign/view/SearchUnivView.kt +++ b/feature/sign/src/main/java/com/moneymong/moneymong/feature/sign/view/SearchUnivView.kt @@ -19,6 +19,7 @@ import androidx.compose.ui.focus.onFocusChanged import androidx.compose.ui.platform.LocalSoftwareKeyboardController import androidx.compose.ui.text.input.KeyboardType import androidx.compose.ui.text.input.TextFieldValue +import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.dp import com.moneymong.moneymong.design_system.component.textfield.MDSTextField import com.moneymong.moneymong.design_system.component.textfield.util.MDSTextFieldIcons @@ -49,7 +50,9 @@ fun SearchUnivView( universityResponse: UniversitiesResponse?, value: TextFieldValue, isButtonVisibleChanged: (Boolean) -> Unit, - selectedUniv : String + selectedUniv : String, + changeButtonCornerShape : (Dp) -> Unit, + changeEditTextFocus : (Boolean) -> Unit ) { val keyboardController = LocalSoftwareKeyboardController.current @@ -82,6 +85,10 @@ fun SearchUnivView( .onFocusChanged { focusState -> if (focusState.isFocused) { isButtonVisibleChanged(false) + changeButtonCornerShape(0.dp) + changeEditTextFocus(true) + }else{ + changeEditTextFocus(false) } }, value = value, @@ -111,6 +118,8 @@ fun SearchUnivView( onDone = { isFilledChanged(true) keyboardController?.hide() + changeButtonCornerShape(10.dp) + changeEditTextFocus(false) } ) ) diff --git a/feature/sign/src/main/java/com/moneymong/moneymong/feature/sign/view/SignUpButtonView.kt b/feature/sign/src/main/java/com/moneymong/moneymong/feature/sign/view/SignUpButtonView.kt index 919d17ae..65ae16c9 100644 --- a/feature/sign/src/main/java/com/moneymong/moneymong/feature/sign/view/SignUpButtonView.kt +++ b/feature/sign/src/main/java/com/moneymong/moneymong/feature/sign/view/SignUpButtonView.kt @@ -1,21 +1,15 @@ package com.moneymong.moneymong.feature.sign.view import androidx.compose.foundation.layout.Column -import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.fillMaxWidth -import androidx.compose.foundation.layout.height -import androidx.compose.material.Text import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier -import androidx.compose.ui.text.style.TextAlign +import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.dp -import com.moneymong.moneymong.common.ui.noRippleClickable import com.moneymong.moneymong.design_system.component.button.MDSButton import com.moneymong.moneymong.design_system.component.button.MDSButtonSize import com.moneymong.moneymong.design_system.component.button.MDSButtonType import com.moneymong.moneymong.design_system.error.ErrorDialog -import com.moneymong.moneymong.design_system.theme.Blue04 -import com.moneymong.moneymong.design_system.theme.Body3 import com.moneymong.moneymong.feature.sign.util.AgencyType @Composable @@ -29,7 +23,8 @@ fun SignUpButtonView( navigateToSignUpUniversity : (String, AgencyType?) -> Unit, agencyName: String, agencyType: AgencyType?, - pageType : Int + pageType : Int, + cornerShape : Dp = 10.dp ) { if (visiblePopUpError) { ErrorDialog( @@ -43,15 +38,16 @@ fun SignUpButtonView( modifier = modifier ) { MDSButton( - modifier = Modifier.fillMaxWidth() - .height(56.dp), + modifier = Modifier.fillMaxWidth(), +// .height(56.dp), onClick = { if(agencyType == AgencyType.GENERAL || pageType == 2) onCreateUniversity() else if (agencyType != AgencyType.GENERAL && pageType == 1) navigateToSignUpUniversity(agencyName, agencyType) }, text = if(agencyType == AgencyType.GENERAL || pageType == 2) "등록하기" else "다음으로", type = MDSButtonType.PRIMARY, size = MDSButtonSize.LARGE, - enabled = isEnabled + enabled = isEnabled, + cornerShape = cornerShape ) } diff --git a/feature/sign/src/main/java/com/moneymong/moneymong/feature/sign/view/SignUpUniversity.kt b/feature/sign/src/main/java/com/moneymong/moneymong/feature/sign/view/SignUpUniversity.kt index ce80745b..7160a958 100644 --- a/feature/sign/src/main/java/com/moneymong/moneymong/feature/sign/view/SignUpUniversity.kt +++ b/feature/sign/src/main/java/com/moneymong/moneymong/feature/sign/view/SignUpUniversity.kt @@ -19,7 +19,6 @@ import androidx.compose.runtime.Composable import androidx.compose.runtime.LaunchedEffect import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier -import androidx.compose.ui.graphics.Color import androidx.compose.ui.res.painterResource import androidx.compose.ui.unit.dp import androidx.hilt.navigation.compose.hiltViewModel @@ -31,19 +30,13 @@ import com.moneymong.moneymong.design_system.theme.Black import com.moneymong.moneymong.design_system.theme.Body3 import com.moneymong.moneymong.design_system.theme.Gray06 import com.moneymong.moneymong.design_system.theme.Gray07 -import com.moneymong.moneymong.design_system.theme.Gray08 import com.moneymong.moneymong.design_system.theme.Heading2 import com.moneymong.moneymong.design_system.theme.MMHorizontalSpacing import com.moneymong.moneymong.design_system.theme.White -import com.moneymong.moneymong.feature.sign.SignUpContent -import com.moneymong.moneymong.feature.sign.sideeffect.SignUpSideEffect -import com.moneymong.moneymong.feature.sign.sideeffect.SignUpUniversitySideEffect import com.moneymong.moneymong.feature.sign.state.SignUpUniversityState import com.moneymong.moneymong.feature.sign.util.AgencyType import com.moneymong.moneymong.feature.sign.viewmodel.SignUpUniversityViewModel -import com.moneymong.moneymong.feature.sign.viewmodel.SignUpViewModel import org.orbitmvi.orbit.compose.collectAsState -import org.orbitmvi.orbit.compose.collectSideEffect @SuppressLint("UnusedMaterial3ScaffoldPaddingParameter") @Composable @@ -82,14 +75,14 @@ fun SignUpUniversity( Scaffold( modifier = Modifier .fillMaxSize() - .background(White) - .padding(horizontal = MMHorizontalSpacing), + .background(White), topBar = { Row( modifier = Modifier .fillMaxWidth() .height(44.dp) - .background(White), + .background(White) + .padding(horizontal = MMHorizontalSpacing), verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.Start ) { @@ -107,7 +100,9 @@ fun SignUpUniversity( } }, content = { + paddingValues -> SignUpUniversityContent( + modifier = Modifier.padding(paddingValues), navigateToLedger = navigateToLedger, agencyName = agencyName, agencyType = agencyType, @@ -121,6 +116,7 @@ fun SignUpUniversity( @Composable fun SignUpUniversityContent ( + modifier : Modifier, navigateToLedger: () -> Unit, agencyName: String, agencyType: AgencyType, @@ -141,21 +137,26 @@ fun SignUpUniversityContent ( } } - Column( - modifier = Modifier.background(White) - ) { - Text( - modifier = Modifier.padding(top = 12.dp, bottom = 8.dp), - text = "어디 학교 교내 동아리인가요?", - style = Heading2, - color = Black - ) - Text( - modifier = Modifier.padding(bottom = 12.dp), - text = "소속 대학교를 알려주세요", - style = Body3, - color = Gray06 - ) + Box(modifier = Modifier.fillMaxSize()) { + + Column( + modifier = modifier + .background(White) + .padding(horizontal = MMHorizontalSpacing), + + ) { + Text( + modifier = Modifier.padding(top = 12.dp, bottom = 8.dp), + text = "어디 학교 교내 동아리인가요?", + style = Heading2, + color = Black + ) + Text( + modifier = Modifier.padding(bottom = 12.dp), + text = "소속 대학교를 알려주세요", + style = Body3, + color = Gray06 + ) SearchUnivView( modifier = Modifier @@ -193,17 +194,26 @@ fun SignUpUniversityContent ( isButtonVisible ) }, - selectedUniv = state.selectedUniv + selectedUniv = state.selectedUniv, + changeButtonCornerShape = { cornerShape -> + viewModel.changeButtonCornerShape( + cornerShape + ) + }, + changeEditTextFocus = { editTextFocused -> viewModel.changeEditTextFocus(editTextFocused) } ) + } + Column( modifier = Modifier .fillMaxWidth() - .align(Alignment.CenterHorizontally), + .align(Alignment.BottomCenter) , verticalArrangement = Arrangement.Bottom ) { SignUpButtonView( - modifier = Modifier.fillMaxWidth(), + modifier = Modifier.fillMaxWidth() + .padding(horizontal = if (state.editTextFocused) 0.dp else MMHorizontalSpacing), isEnabled = state.isItemSelected, visiblePopUpError = state.visiblePopUpError, popUpErrorMessage = state.popUpErrorMessage, @@ -213,10 +223,11 @@ fun SignUpUniversityContent ( onCreateUniversity = { viewModel.createUniv(state.selectedUniv, state.gradeInfor) }, - navigateToSignUpUniversity = { agencyName, agencyType -> }, + navigateToSignUpUniversity = { agencyName, agencyType -> }, agencyName = agencyName, agencyType = agencyType, - pageType = 2 + pageType = 2, + cornerShape = state.buttonCornerShape ) } } diff --git a/feature/sign/src/main/java/com/moneymong/moneymong/feature/sign/viewmodel/SignUpUniversityViewModel.kt b/feature/sign/src/main/java/com/moneymong/moneymong/feature/sign/viewmodel/SignUpUniversityViewModel.kt index b16f9d07..fe034780 100644 --- a/feature/sign/src/main/java/com/moneymong/moneymong/feature/sign/viewmodel/SignUpUniversityViewModel.kt +++ b/feature/sign/src/main/java/com/moneymong/moneymong/feature/sign/viewmodel/SignUpUniversityViewModel.kt @@ -2,6 +2,7 @@ package com.moneymong.moneymong.feature.sign.viewmodel import android.view.View import androidx.compose.ui.text.input.TextFieldValue +import androidx.compose.ui.unit.Dp import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope import com.moneymong.moneymong.common.base.BaseViewModel @@ -168,4 +169,20 @@ class SignUpUniversityViewModel @Inject constructor( ) } } + + fun changeButtonCornerShape(cornerShape : Dp) = intent{ + reduce{ + state.copy( + buttonCornerShape = cornerShape + ) + } + } + + fun changeEditTextFocus(isFocused : Boolean) = intent { + reduce { + state.copy( + editTextFocused = isFocused + ) + } + } } \ No newline at end of file From 6b219d1fd1eabd3ff70e5d349ae9a3a8394a9ee1 Mon Sep 17 00:00:00 2001 From: eunseo Date: Sun, 29 Dec 2024 00:17:08 +0900 Subject: [PATCH 25/30] =?UTF-8?q?moneymong-520=20Fix:=20=ED=9D=AC=EC=A7=81?= =?UTF-8?q?=EB=8B=98=20=EB=A6=AC=EB=B7=B0=20=EB=B0=98=EC=98=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../moneymong/feature/sign/item/UnivItem.kt | 2 +- .../feature/sign/viewmodel/SignUpViewModel.kt | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/feature/sign/src/main/java/com/moneymong/moneymong/feature/sign/item/UnivItem.kt b/feature/sign/src/main/java/com/moneymong/moneymong/feature/sign/item/UnivItem.kt index 615b7ee3..2a59d3b6 100644 --- a/feature/sign/src/main/java/com/moneymong/moneymong/feature/sign/item/UnivItem.kt +++ b/feature/sign/src/main/java/com/moneymong/moneymong/feature/sign/item/UnivItem.kt @@ -37,7 +37,7 @@ fun UnivItem( .background(White) .fillMaxWidth() .noRippleClickable { - isItemSelectedChanged(!isItemSelected) + isItemSelectedChanged(true) onClick(univs.schoolName) isButtonVisibleChanged(true) } diff --git a/feature/sign/src/main/java/com/moneymong/moneymong/feature/sign/viewmodel/SignUpViewModel.kt b/feature/sign/src/main/java/com/moneymong/moneymong/feature/sign/viewmodel/SignUpViewModel.kt index 2b3a61f8..282e5e87 100644 --- a/feature/sign/src/main/java/com/moneymong/moneymong/feature/sign/viewmodel/SignUpViewModel.kt +++ b/feature/sign/src/main/java/com/moneymong/moneymong/feature/sign/viewmodel/SignUpViewModel.kt @@ -1,6 +1,7 @@ package com.moneymong.moneymong.feature.sign.viewmodel import androidx.compose.ui.text.input.TextFieldValue +import androidx.compose.ui.unit.Dp import androidx.lifecycle.viewModelScope import com.moneymong.moneymong.common.base.BaseViewModel import com.moneymong.moneymong.domain.usecase.agency.AgencyJoinUseCase @@ -119,4 +120,20 @@ class SignUpViewModel @Inject constructor( } } + fun changeInvitedType(invited : Boolean) = intent { + reduce { + state.copy( + isInvited = invited + ) + } + } + + fun changeButtonCornerShape (cornerShape: Dp) = intent { + reduce { + state.copy( + buttonCornerShape = cornerShape + ) + } + } + } \ No newline at end of file From 084136c501a32482ac64b61113ad7e6685ec59ce Mon Sep 17 00:00:00 2001 From: jhg3410 Date: Sun, 29 Dec 2024 13:56:38 +0900 Subject: [PATCH 26/30] =?UTF-8?q?=EB=A7=88=EC=9D=B4=EB=AA=BD=20=ED=95=99?= =?UTF-8?q?=EB=85=84=20=EC=A0=95=EB=B3=B4=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../feature/mymong/main/MyMongScreen.kt | 1 - .../feature/mymong/main/MyMongState.kt | 1 - .../feature/mymong/main/MyMongViewModel.kt | 1 - .../mymong/main/view/MyMongInfoView.kt | 16 ++------ .../moneymong/feature/sign/SignUpScreen.kt | 40 ++++++++----------- .../feature/sign/view/SignUpButtonView.kt | 13 +++--- .../feature/sign/view/SignUpUniversity.kt | 38 +++++++++--------- .../feature/sign/viewmodel/SignUpViewModel.kt | 23 ++++------- 8 files changed, 57 insertions(+), 76 deletions(-) diff --git a/feature/mymong/src/main/java/com/moneymong/moneymong/feature/mymong/main/MyMongScreen.kt b/feature/mymong/src/main/java/com/moneymong/moneymong/feature/mymong/main/MyMongScreen.kt index 74d1a373..7eecaeb5 100644 --- a/feature/mymong/src/main/java/com/moneymong/moneymong/feature/mymong/main/MyMongScreen.kt +++ b/feature/mymong/src/main/java/com/moneymong/moneymong/feature/mymong/main/MyMongScreen.kt @@ -101,7 +101,6 @@ fun MyMongScreen( name = state.name, email = state.email, university = state.university, - grade = state.grade, getInfo = viewModel::getInfo ) Spacer(modifier = Modifier.height(16.dp)) diff --git a/feature/mymong/src/main/java/com/moneymong/moneymong/feature/mymong/main/MyMongState.kt b/feature/mymong/src/main/java/com/moneymong/moneymong/feature/mymong/main/MyMongState.kt index 8973dcb4..5c0e37e1 100644 --- a/feature/mymong/src/main/java/com/moneymong/moneymong/feature/mymong/main/MyMongState.kt +++ b/feature/mymong/src/main/java/com/moneymong/moneymong/feature/mymong/main/MyMongState.kt @@ -6,7 +6,6 @@ data class MyMongState( val name: String = "", val email: String = "", val university: String = "", - val grade: Int = 0, val infoErrorMessage: String = "", val logoutErrorMessage: String = "", val isInfoLoading: Boolean = true, diff --git a/feature/mymong/src/main/java/com/moneymong/moneymong/feature/mymong/main/MyMongViewModel.kt b/feature/mymong/src/main/java/com/moneymong/moneymong/feature/mymong/main/MyMongViewModel.kt index a93db28e..28ba3dbc 100644 --- a/feature/mymong/src/main/java/com/moneymong/moneymong/feature/mymong/main/MyMongViewModel.kt +++ b/feature/mymong/src/main/java/com/moneymong/moneymong/feature/mymong/main/MyMongViewModel.kt @@ -53,7 +53,6 @@ class MyMongViewModel @Inject constructor( name = it.name, email = it.email, university = it.university.orEmpty(), - grade = it.grade ) } }.onFailure { diff --git a/feature/mymong/src/main/java/com/moneymong/moneymong/feature/mymong/main/view/MyMongInfoView.kt b/feature/mymong/src/main/java/com/moneymong/moneymong/feature/mymong/main/view/MyMongInfoView.kt index e0e4e7c2..01721d10 100644 --- a/feature/mymong/src/main/java/com/moneymong/moneymong/feature/mymong/main/view/MyMongInfoView.kt +++ b/feature/mymong/src/main/java/com/moneymong/moneymong/feature/mymong/main/view/MyMongInfoView.kt @@ -43,7 +43,6 @@ internal fun MyMongInfoView( name: String, email: String, university: String, - grade: Int, getInfo: () -> Unit ) { Box( @@ -66,10 +65,7 @@ internal fun MyMongInfoView( email = email ) Spacer(modifier = Modifier.height(20.dp)) - UniversityInfo( - university = university, - grade = grade - ) + UniversityInfo(university = university) } } } @@ -123,14 +119,10 @@ private fun Profile( @Composable fun UniversityInfo( - university: String, - grade: Int + university: String ) { - val universityInfoText = when { - university.isEmpty() -> "정보 없음" - grade == 5 -> "$university ${grade}학년 이상" - else -> "$university ${grade}학년" - } + + val universityInfoText = university.ifEmpty { "정보 없음" } Box( modifier = Modifier diff --git a/feature/sign/src/main/java/com/moneymong/moneymong/feature/sign/SignUpScreen.kt b/feature/sign/src/main/java/com/moneymong/moneymong/feature/sign/SignUpScreen.kt index c90673b3..9035a178 100644 --- a/feature/sign/src/main/java/com/moneymong/moneymong/feature/sign/SignUpScreen.kt +++ b/feature/sign/src/main/java/com/moneymong/moneymong/feature/sign/SignUpScreen.kt @@ -30,7 +30,6 @@ import androidx.compose.ui.res.painterResource import androidx.compose.ui.text.input.KeyboardType import androidx.compose.ui.text.input.TextFieldValue import androidx.compose.ui.text.style.TextAlign -import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp import androidx.hilt.navigation.compose.hiltViewModel import com.moneymong.moneymong.common.ui.noRippleClickable @@ -59,8 +58,8 @@ import org.orbitmvi.orbit.compose.collectSideEffect @Composable fun SignUpScreen( navigateToLedger: () -> Unit, - navigateToSignUpUniversity : (String, AgencyType?) -> Unit, - navigateToAgency : () -> Unit, + navigateToSignUpUniversity: (String, AgencyType?) -> Unit, + navigateToAgency: () -> Unit, navigateUp: () -> Unit, viewModel: SignUpViewModel = hiltViewModel() ) { @@ -70,7 +69,7 @@ fun SignUpScreen( navigateUp() } - if(state.visibleError){ + if (state.visibleError) { ErrorScreen( modifier = Modifier.fillMaxSize(), message = state.errorMessage, @@ -78,16 +77,14 @@ fun SignUpScreen( viewModel.visibleErrorChanged(false) } ) - } - else if(state.visiblePopUpError){ + } else if (state.visiblePopUpError) { ErrorDialog( message = state.popUpErrorMessage, onConfirm = { viewModel.visiblePopUpErrorChanged(false) } ) - } - else{ + } else { Scaffold( modifier = Modifier .fillMaxSize() @@ -115,8 +112,7 @@ fun SignUpScreen( ) } }, - content = { - paddingValues -> + content = { paddingValues -> SignUpContent( modifier = Modifier.padding(paddingValues), navigateToLedger = navigateToLedger, @@ -135,8 +131,8 @@ fun SignUpScreen( fun SignUpContent( modifier: Modifier, navigateToLedger: () -> Unit, - navigateToSignUpUniversity : (String, AgencyType?) -> Unit, - navigateToAgency : () -> Unit, + navigateToSignUpUniversity: (String, AgencyType?) -> Unit, + navigateToAgency: () -> Unit, viewModel: SignUpViewModel, state: SignUpState ) { @@ -145,9 +141,9 @@ fun SignUpContent( LaunchedEffect(key1 = state.isUnivCreated) { if (state.isUnivCreated) { - if(state.isInvited){ + if (state.isInvited) { navigateToAgency() - }else { + } else { viewModel.registerAgency() } } @@ -168,7 +164,6 @@ fun SignUpContent( is SignUpSideEffect.CreateUniversityApi -> { viewModel.createUniv(it.universityName, it.grade) } - else -> {} } } @@ -186,8 +181,7 @@ fun SignUpContent( SignUpTitleView( modifier = Modifier .fillMaxWidth() - .height(89.dp) - .padding(top = 12.dp, bottom = 12.dp), + .padding(vertical = 12.dp), ) Column( @@ -233,8 +227,8 @@ fun SignUpContent( AnimatedVisibility(visible = state.MDSSelected) { Column( modifier = Modifier - .padding(top = 28.dp), - ) { + .padding(top = 28.dp), + ) { Text( text = "소속 이름", style = Body2, @@ -262,9 +256,9 @@ fun SignUpContent( onIconClick = { viewModel.updateAgencyName(TextFieldValue()) }, keyboardActions = KeyboardActions( onDone = { - focusManager.clearFocus() - viewModel.changeButtonCornerShape(10.dp) - } + focusManager.clearFocus() + viewModel.changeButtonCornerShape(10.dp) + } ), keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Text) ) @@ -304,7 +298,7 @@ fun SignUpContent( cornerShape = state.buttonCornerShape ) - if (!state.editTextFocused){ + if (!state.editTextFocused) { Spacer(modifier = Modifier.height(60.dp)) } diff --git a/feature/sign/src/main/java/com/moneymong/moneymong/feature/sign/view/SignUpButtonView.kt b/feature/sign/src/main/java/com/moneymong/moneymong/feature/sign/view/SignUpButtonView.kt index 65ae16c9..b53eba20 100644 --- a/feature/sign/src/main/java/com/moneymong/moneymong/feature/sign/view/SignUpButtonView.kt +++ b/feature/sign/src/main/java/com/moneymong/moneymong/feature/sign/view/SignUpButtonView.kt @@ -20,11 +20,11 @@ fun SignUpButtonView( popUpErrorMessage: String, visiblePopUpErrorChanged: (Boolean) -> Unit, onCreateUniversity: () -> Unit, - navigateToSignUpUniversity : (String, AgencyType?) -> Unit, + navigateToSignUpUniversity: (String, AgencyType?) -> Unit, agencyName: String, agencyType: AgencyType?, - pageType : Int, - cornerShape : Dp = 10.dp + pageType: Int, + cornerShape: Dp = 10.dp ) { if (visiblePopUpError) { ErrorDialog( @@ -41,9 +41,12 @@ fun SignUpButtonView( modifier = Modifier.fillMaxWidth(), // .height(56.dp), onClick = { - if(agencyType == AgencyType.GENERAL || pageType == 2) onCreateUniversity() else if (agencyType != AgencyType.GENERAL && pageType == 1) navigateToSignUpUniversity(agencyName, agencyType) + if (agencyType == AgencyType.GENERAL || pageType == 2) onCreateUniversity() else if (agencyType != AgencyType.GENERAL && pageType == 1) navigateToSignUpUniversity( + agencyName, + agencyType + ) }, - text = if(agencyType == AgencyType.GENERAL || pageType == 2) "등록하기" else "다음으로", + text = if (agencyType == AgencyType.GENERAL || pageType == 2) "등록하기" else "다음으로", type = MDSButtonType.PRIMARY, size = MDSButtonSize.LARGE, enabled = isEnabled, diff --git a/feature/sign/src/main/java/com/moneymong/moneymong/feature/sign/view/SignUpUniversity.kt b/feature/sign/src/main/java/com/moneymong/moneymong/feature/sign/view/SignUpUniversity.kt index 7160a958..91f0829c 100644 --- a/feature/sign/src/main/java/com/moneymong/moneymong/feature/sign/view/SignUpUniversity.kt +++ b/feature/sign/src/main/java/com/moneymong/moneymong/feature/sign/view/SignUpUniversity.kt @@ -41,20 +41,20 @@ import org.orbitmvi.orbit.compose.collectAsState @SuppressLint("UnusedMaterial3ScaffoldPaddingParameter") @Composable fun SignUpUniversity( - navigateToLedger : () -> Unit, - navigateToAgency : () -> Unit, - navigateUp : () -> Unit, - agencyName : String, + navigateToLedger: () -> Unit, + navigateToAgency: () -> Unit, + navigateUp: () -> Unit, + agencyName: String, agencyType: AgencyType, viewModel: SignUpUniversityViewModel = hiltViewModel() -){ +) { val state = viewModel.collectAsState().value BackHandler { navigateUp() } - if(state.visibleError){ + if (state.visibleError) { ErrorScreen( modifier = Modifier.fillMaxSize(), message = state.errorMessage, @@ -62,16 +62,14 @@ fun SignUpUniversity( viewModel.visibleErrorChanged(false) } ) - } - else if(state.visiblePopUpError){ + } else if (state.visiblePopUpError) { ErrorDialog( message = state.popUpErrorMessage, onConfirm = { viewModel.visiblePopUpErrorChanged(false) } ) - } - else { + } else { Scaffold( modifier = Modifier .fillMaxSize() @@ -99,8 +97,7 @@ fun SignUpUniversity( ) } }, - content = { - paddingValues -> + content = { paddingValues -> SignUpUniversityContent( modifier = Modifier.padding(paddingValues), navigateToLedger = navigateToLedger, @@ -115,8 +112,8 @@ fun SignUpUniversity( } @Composable -fun SignUpUniversityContent ( - modifier : Modifier, +fun SignUpUniversityContent( + modifier: Modifier, navigateToLedger: () -> Unit, agencyName: String, agencyType: AgencyType, @@ -160,7 +157,7 @@ fun SignUpUniversityContent ( SearchUnivView( modifier = Modifier - .padding(top = 28.dp, bottom = 28.dp,) + .padding(top = 28.dp, bottom = 28.dp) .fillMaxWidth() .height(0.dp) .weight(1.0F), @@ -200,7 +197,11 @@ fun SignUpUniversityContent ( cornerShape ) }, - changeEditTextFocus = { editTextFocused -> viewModel.changeEditTextFocus(editTextFocused) } + changeEditTextFocus = { editTextFocused -> + viewModel.changeEditTextFocus( + editTextFocused + ) + } ) } @@ -208,11 +209,12 @@ fun SignUpUniversityContent ( Column( modifier = Modifier .fillMaxWidth() - .align(Alignment.BottomCenter) , + .align(Alignment.BottomCenter), verticalArrangement = Arrangement.Bottom ) { SignUpButtonView( - modifier = Modifier.fillMaxWidth() + modifier = Modifier + .fillMaxWidth() .padding(horizontal = if (state.editTextFocused) 0.dp else MMHorizontalSpacing), isEnabled = state.isItemSelected, visiblePopUpError = state.visiblePopUpError, diff --git a/feature/sign/src/main/java/com/moneymong/moneymong/feature/sign/viewmodel/SignUpViewModel.kt b/feature/sign/src/main/java/com/moneymong/moneymong/feature/sign/viewmodel/SignUpViewModel.kt index 282e5e87..8d5c463d 100644 --- a/feature/sign/src/main/java/com/moneymong/moneymong/feature/sign/viewmodel/SignUpViewModel.kt +++ b/feature/sign/src/main/java/com/moneymong/moneymong/feature/sign/viewmodel/SignUpViewModel.kt @@ -4,23 +4,16 @@ import androidx.compose.ui.text.input.TextFieldValue import androidx.compose.ui.unit.Dp import androidx.lifecycle.viewModelScope import com.moneymong.moneymong.common.base.BaseViewModel -import com.moneymong.moneymong.domain.usecase.agency.AgencyJoinUseCase import com.moneymong.moneymong.domain.usecase.agency.RegisterAgencyUseCase import com.moneymong.moneymong.domain.usecase.signup.SchoolInfoUseCase import com.moneymong.moneymong.domain.usecase.university.CreateUniversityUseCase -import com.moneymong.moneymong.domain.usecase.university.SearchUniversityUseCase import com.moneymong.moneymong.feature.sign.sideeffect.SignUpSideEffect import com.moneymong.moneymong.feature.sign.state.SignUpState import com.moneymong.moneymong.feature.sign.util.AgencyType -import com.moneymong.moneymong.feature.sign.util.Grade import com.moneymong.moneymong.model.agency.AgencyRegisterRequest import com.moneymong.moneymong.model.sign.UnivRequest import dagger.hilt.android.lifecycle.HiltViewModel -import kotlinx.coroutines.CoroutineScope -import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.launch -import org.orbitmvi.orbit.annotation.OrbitExperimental -import org.orbitmvi.orbit.syntax.simple.blockingIntent import org.orbitmvi.orbit.syntax.simple.intent import org.orbitmvi.orbit.syntax.simple.reduce import javax.inject.Inject @@ -52,7 +45,7 @@ class SignUpViewModel @Inject constructor( } } - fun registerAgency() = intent{ + fun registerAgency() = intent { registerAgencyUseCase(AgencyRegisterRequest(state.agencyName.text, AgencyType.GENERAL.text)) .onSuccess { reduce { @@ -72,7 +65,7 @@ class SignUpViewModel @Inject constructor( } - private fun storeSchoolInfoProvided(infoExist : Boolean ){ + private fun storeSchoolInfoProvided(infoExist: Boolean) { viewModelScope.launch { schoolInfoUseCase.invoke(infoExist) } @@ -94,8 +87,8 @@ class SignUpViewModel @Inject constructor( } } - fun onChangeAgencyType(agencyType: AgencyType) = intent{ - reduce{ + fun onChangeAgencyType(agencyType: AgencyType) = intent { + reduce { state.copy( agencyType = agencyType, MDSSelected = true, @@ -103,7 +96,7 @@ class SignUpViewModel @Inject constructor( } } - fun updateAgencyName(agencyName: TextFieldValue)= intent{ + fun updateAgencyName(agencyName: TextFieldValue) = intent { reduce { state.copy( agencyName = agencyName, @@ -112,7 +105,7 @@ class SignUpViewModel @Inject constructor( } } - fun updateEdittextFocused(focusState : Boolean) = intent { + fun updateEdittextFocused(focusState: Boolean) = intent { reduce { state.copy( editTextFocused = focusState @@ -120,7 +113,7 @@ class SignUpViewModel @Inject constructor( } } - fun changeInvitedType(invited : Boolean) = intent { + fun changeInvitedType(invited: Boolean) = intent { reduce { state.copy( isInvited = invited @@ -128,7 +121,7 @@ class SignUpViewModel @Inject constructor( } } - fun changeButtonCornerShape (cornerShape: Dp) = intent { + fun changeButtonCornerShape(cornerShape: Dp) = intent { reduce { state.copy( buttonCornerShape = cornerShape From d8bfa5630b5f085751d64e67be79a808345e0dc5 Mon Sep 17 00:00:00 2001 From: jhg3410 Date: Sun, 29 Dec 2024 14:17:24 +0900 Subject: [PATCH 27/30] =?UTF-8?q?=EB=8C=80=ED=95=99=20=EA=B2=80=EC=83=89?= =?UTF-8?q?=20=ED=99=94=EB=A9=B4=20"=EC=B4=9D=EB=AC=B4=EC=97=90=EA=B2=8C?= =?UTF-8?q?=20=EC=B4=88=EB=8C=80=20=EB=B0=9B=EC=95=98=EC=96=B4=EC=9A=94"?= =?UTF-8?q?=20=EB=B3=B4=EC=9D=B4=EB=8F=84=EB=A1=9D=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../feature/sign/view/SignUpUniversity.kt | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/feature/sign/src/main/java/com/moneymong/moneymong/feature/sign/view/SignUpUniversity.kt b/feature/sign/src/main/java/com/moneymong/moneymong/feature/sign/view/SignUpUniversity.kt index 91f0829c..d7eb9f7d 100644 --- a/feature/sign/src/main/java/com/moneymong/moneymong/feature/sign/view/SignUpUniversity.kt +++ b/feature/sign/src/main/java/com/moneymong/moneymong/feature/sign/view/SignUpUniversity.kt @@ -7,6 +7,7 @@ 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 import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height @@ -20,6 +21,7 @@ import androidx.compose.runtime.LaunchedEffect import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.res.painterResource +import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.unit.dp import androidx.hilt.navigation.compose.hiltViewModel import com.moneymong.moneymong.common.ui.noRippleClickable @@ -27,6 +29,7 @@ import com.moneymong.moneymong.design_system.R import com.moneymong.moneymong.design_system.error.ErrorDialog import com.moneymong.moneymong.design_system.error.ErrorScreen import com.moneymong.moneymong.design_system.theme.Black +import com.moneymong.moneymong.design_system.theme.Blue04 import com.moneymong.moneymong.design_system.theme.Body3 import com.moneymong.moneymong.design_system.theme.Gray06 import com.moneymong.moneymong.design_system.theme.Gray07 @@ -231,6 +234,21 @@ fun SignUpUniversityContent( pageType = 2, cornerShape = state.buttonCornerShape ) + if (!state.editTextFocused) { + Spacer(modifier = Modifier.height(16.dp)) + Text( + modifier = Modifier + .fillMaxWidth() + .noRippleClickable { + viewModel.createUniv(state.selectedUniv, state.gradeInfor) + }, + textAlign = TextAlign.Center, + text = "총무에게 초대받았어요", + style = Body3, + color = Blue04 + ) + Spacer(modifier = Modifier.height(24.dp)) + } } } -} +} \ No newline at end of file From 0c3dac02704fd641b586b5a430e10bbd414a6300 Mon Sep 17 00:00:00 2001 From: jhg3410 Date: Sun, 29 Dec 2024 14:27:26 +0900 Subject: [PATCH 28/30] =?UTF-8?q?[=EB=8C=80=ED=95=99=20=EA=B2=80=EC=83=89?= =?UTF-8?q?=20=ED=99=94=EB=A9=B4]=20=EB=93=B1=EB=A1=9D=ED=95=98=EA=B8=B0?= =?UTF-8?q?=20=EB=B2=84=ED=8A=BC=20editText=20=ED=8F=AC=EC=BB=A4=EC=8A=A4?= =?UTF-8?q?=EC=97=90=20=EB=94=B0=EB=9D=BC=20=EB=B3=80=ED=99=94=EB=8F=84?= =?UTF-8?q?=EB=A1=9D=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../feature/sign/view/SearchUnivView.kt | 26 ++++++++----------- .../feature/sign/view/SignUpUniversity.kt | 3 +-- 2 files changed, 12 insertions(+), 17 deletions(-) diff --git a/feature/sign/src/main/java/com/moneymong/moneymong/feature/sign/view/SearchUnivView.kt b/feature/sign/src/main/java/com/moneymong/moneymong/feature/sign/view/SearchUnivView.kt index 002bcf47..084f9bff 100644 --- a/feature/sign/src/main/java/com/moneymong/moneymong/feature/sign/view/SearchUnivView.kt +++ b/feature/sign/src/main/java/com/moneymong/moneymong/feature/sign/view/SearchUnivView.kt @@ -13,10 +13,9 @@ import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.remember -import androidx.compose.ui.ExperimentalComposeUiApi import androidx.compose.ui.Modifier import androidx.compose.ui.focus.onFocusChanged -import androidx.compose.ui.platform.LocalSoftwareKeyboardController +import androidx.compose.ui.platform.LocalFocusManager import androidx.compose.ui.text.input.KeyboardType import androidx.compose.ui.text.input.TextFieldValue import androidx.compose.ui.unit.Dp @@ -26,14 +25,14 @@ import com.moneymong.moneymong.design_system.component.textfield.util.MDSTextFie import com.moneymong.moneymong.design_system.theme.Body4 import com.moneymong.moneymong.design_system.theme.Gray05 import com.moneymong.moneymong.design_system.theme.White -import com.moneymong.moneymong.model.sign.University import com.moneymong.moneymong.feature.sign.item.UnivItem import com.moneymong.moneymong.model.sign.UniversitiesResponse +import com.moneymong.moneymong.model.sign.University import kotlinx.coroutines.FlowPreview import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.debounce -@OptIn(ExperimentalComposeUiApi::class, FlowPreview::class) +@OptIn(FlowPreview::class) @Composable fun SearchUnivView( modifier: Modifier = Modifier, @@ -50,12 +49,12 @@ fun SearchUnivView( universityResponse: UniversitiesResponse?, value: TextFieldValue, isButtonVisibleChanged: (Boolean) -> Unit, - selectedUniv : String, - changeButtonCornerShape : (Dp) -> Unit, - changeEditTextFocus : (Boolean) -> Unit + selectedUniv: String, + changeButtonCornerShape: (Dp) -> Unit, + changeEditTextFocus: (Boolean) -> Unit ) { - val keyboardController = LocalSoftwareKeyboardController.current + val focusManager = LocalFocusManager.current val debouncePeriod = 300L val queryState = remember { MutableStateFlow("") } @@ -65,10 +64,9 @@ fun SearchUnivView( .debounce(debouncePeriod) .collect { query -> Log.d("query", query) - if(query.isEmpty() && value.text.isNotEmpty()){ + if (query.isEmpty() && value.text.isNotEmpty()) { onSearchIconClicked(value.text) - } - else{ + } else { onSearchIconClicked(query) } isFilledChanged(false) @@ -83,12 +81,10 @@ fun SearchUnivView( modifier = Modifier .fillMaxWidth() .onFocusChanged { focusState -> + changeEditTextFocus(focusState.isFocused) if (focusState.isFocused) { isButtonVisibleChanged(false) changeButtonCornerShape(0.dp) - changeEditTextFocus(true) - }else{ - changeEditTextFocus(false) } }, value = value, @@ -117,8 +113,8 @@ fun SearchUnivView( keyboardActions = KeyboardActions( onDone = { isFilledChanged(true) - keyboardController?.hide() changeButtonCornerShape(10.dp) + focusManager.clearFocus() changeEditTextFocus(false) } ) diff --git a/feature/sign/src/main/java/com/moneymong/moneymong/feature/sign/view/SignUpUniversity.kt b/feature/sign/src/main/java/com/moneymong/moneymong/feature/sign/view/SignUpUniversity.kt index d7eb9f7d..3e779de5 100644 --- a/feature/sign/src/main/java/com/moneymong/moneymong/feature/sign/view/SignUpUniversity.kt +++ b/feature/sign/src/main/java/com/moneymong/moneymong/feature/sign/view/SignUpUniversity.kt @@ -143,8 +143,7 @@ fun SignUpUniversityContent( modifier = modifier .background(White) .padding(horizontal = MMHorizontalSpacing), - - ) { + ) { Text( modifier = Modifier.padding(top = 12.dp, bottom = 8.dp), text = "어디 학교 교내 동아리인가요?", From b66242914e139048f2ef78cdb041d1037177769f Mon Sep 17 00:00:00 2001 From: jhg3410 Date: Sun, 29 Dec 2024 14:37:36 +0900 Subject: [PATCH 29/30] =?UTF-8?q?[=ED=9A=8C=EC=9B=90=EA=B0=80=EC=9E=85=20?= =?UTF-8?q?=ED=99=94=EB=A9=B4]=20=EC=A4=91=EB=B3=B5=EB=90=9C=20padding=20?= =?UTF-8?q?=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/moneymong/moneymong/feature/sign/SignUpScreen.kt | 5 +---- .../moneymong/feature/sign/view/SignUpUniversity.kt | 3 +-- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/feature/sign/src/main/java/com/moneymong/moneymong/feature/sign/SignUpScreen.kt b/feature/sign/src/main/java/com/moneymong/moneymong/feature/sign/SignUpScreen.kt index 9035a178..c6b97c11 100644 --- a/feature/sign/src/main/java/com/moneymong/moneymong/feature/sign/SignUpScreen.kt +++ b/feature/sign/src/main/java/com/moneymong/moneymong/feature/sign/SignUpScreen.kt @@ -225,10 +225,7 @@ fun SignUpContent( } } AnimatedVisibility(visible = state.MDSSelected) { - Column( - modifier = Modifier - .padding(top = 28.dp), - ) { + Column { Text( text = "소속 이름", style = Body2, diff --git a/feature/sign/src/main/java/com/moneymong/moneymong/feature/sign/view/SignUpUniversity.kt b/feature/sign/src/main/java/com/moneymong/moneymong/feature/sign/view/SignUpUniversity.kt index 3e779de5..3e6ea7c9 100644 --- a/feature/sign/src/main/java/com/moneymong/moneymong/feature/sign/view/SignUpUniversity.kt +++ b/feature/sign/src/main/java/com/moneymong/moneymong/feature/sign/view/SignUpUniversity.kt @@ -159,9 +159,8 @@ fun SignUpUniversityContent( SearchUnivView( modifier = Modifier - .padding(top = 28.dp, bottom = 28.dp) .fillMaxWidth() - .height(0.dp) + .padding(top = 28.dp, bottom = 28.dp) .weight(1.0F), isFilled = state.isFilled, isFilledChanged = { isFilled -> viewModel.isFilledChanged(isFilled) }, From 6f5dfd74a250172a5958ba756f10ac1760ce38ef Mon Sep 17 00:00:00 2001 From: Anka Date: Mon, 30 Dec 2024 13:12:45 +0000 Subject: [PATCH 30/30] INCREMENT VERSION CODE --- app/build.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 1e6d1bc9..7aa5d118 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -19,7 +19,7 @@ android { applicationId = "com.moneymong.moneymong" minSdk = 24 targetSdk = 34 - versionCode = 27 + versionCode = 28 versionName = "1.2.2" testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"