Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Moneymong 524 소속 검색 기능 #41

Merged
merged 21 commits into from
Nov 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
e9aeb82
소속 검색 Usecase, data layer 구현
jhg3410 Nov 19, 2024
2f74f6e
검색 아이콘 눌렀을 때, 대학 목록 사라지는 버그 해결
jhg3410 Nov 19, 2024
56e1f38
불필요한 코드 제거 및 네이밍 변경
jhg3410 Nov 19, 2024
efaf717
소속 검색 TextField 구현
jhg3410 Nov 23, 2024
1e10b20
소속 검색바 UI 구현
jhg3410 Nov 23, 2024
a08f03f
소속 찾기 검색 Icon 추가
jhg3410 Nov 23, 2024
ad4abad
소속 검색바 적용 및 clear 기능 적용
jhg3410 Nov 24, 2024
78cd887
소속 검색바 Visible 처리
jhg3410 Nov 24, 2024
b287e68
소속 TopBar Icon Animation 구현
jhg3410 Nov 24, 2024
7b3d220
소속 검색바 Animation 구현
jhg3410 Nov 24, 2024
a659eb1
소속 검색바 Visible에 따른 컨텐츠 Animation 구현
jhg3410 Nov 25, 2024
7ff0d60
소속 검색바 visible 일 때 포커스 처리
jhg3410 Nov 25, 2024
4a41331
소속 검색바 검색 시 focus clear
jhg3410 Nov 25, 2024
09eaf1b
소속 검색 기능 구현
jhg3410 Nov 25, 2024
393279c
강제 업데이트 dialog 업데이트 에러일 때만 적용
jhg3410 Nov 26, 2024
a09611b
소속 탭 Vertical Padding 수정
jhg3410 Nov 26, 2024
0076ad8
소속 ContentView, Screen 분리
jhg3410 Nov 26, 2024
5bce9af
소속 검색 Visible일 때 ContentView 최하단 잘리는 현상 해결
jhg3410 Nov 26, 2024
2c81e13
소속 검색 Visible 일 때 뒤로 가기하면 소속 검색 Invisible 처리
jhg3410 Nov 26, 2024
67852be
소속 검색을 했을 때만 검색된 소속 보이도록 수정
jhg3410 Nov 26, 2024
4658111
소속 검색 후 clear 했을 때 검색 포커스 되도록 변경
jhg3410 Nov 26, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions app/src/main/java/com/moneymong/moneymong/MainViewModel.kt
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,8 @@ class MainViewModel @Inject constructor(
) : BaseViewModel<MainState, MainSideEffect>(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) } }
}
}
Empty file.
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -33,6 +33,11 @@ interface AgencyApi {
@GET("api/v1/agencies/me")
suspend fun fetchMyAgencyList(): Result<List<MyAgencyResponse>>

@GET("api/v1/agencies/search")
suspend fun fetchAgencyByName(
@Query("keyword") name: String
): Result<List<AgencyGetResponse>>

// POST
@POST("/api/v1/agencies/{agencyId}/invitation-code")
suspend fun agencyCodeNumbers(
Expand All @@ -55,5 +60,5 @@ interface AgencyApi {
@DELETE("api/v1/agencies/{agencyId}")
suspend fun deleteAgency(
@Path("agencyId") agencyId: Int
) : Result<Unit>
): Result<Unit>
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
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

interface AgencyRemoteDataSource {
suspend fun registerAgency(request: AgencyRegisterRequest): Result<RegisterAgencyResponse>
suspend fun getAgencies(page: Int, size: Int): Result<AgenciesGetResponse>
suspend fun fetchMyAgencyList(): Result<List<MyAgencyResponse>>
suspend fun fetchAgencyByName(agencyName: String): Result<List<AgencyGetResponse>>
suspend fun agencyCodeNumbers(agencyId : Long, data: AgencyJoinRequest) : Result<AgencyJoinResponse>
}
Original file line number Diff line number Diff line change
@@ -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(
Expand All @@ -25,6 +26,10 @@ class AgencyRemoteDataSourceImpl @Inject constructor(
return agencyApi.fetchMyAgencyList()
}

override suspend fun fetchAgencyByName(agencyName: String): Result<List<AgencyGetResponse>> {
return agencyApi.fetchAgencyByName(name = agencyName)
}

override suspend fun agencyCodeNumbers(
agencyId: Long,
data: AgencyJoinRequest
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -24,6 +24,10 @@ class AgencyRemoteDataSourceMock : AgencyRemoteDataSource {
return Result.success(emptyList())
}

override suspend fun fetchAgencyByName(agencyName: String): Result<List<AgencyGetResponse>> {
return Result.success(emptyList())
}

override suspend fun agencyCodeNumbers(
agencyId: Long,
data: AgencyJoinRequest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ class AgencyRepositoryImpl @Inject constructor(
override suspend fun fetchMyAgencyList(): Result<List<MyAgencyResponse>> =
agencyRemoteDataSource.fetchMyAgencyList()

override suspend fun fetchAgencyByName(agencyName: String): Result<List<AgencyGetResponse>> =
agencyRemoteDataSource.fetchAgencyByName(agencyName)

override suspend fun agencyCodeNumbers(
agencyId: Long,
data: AgencyJoinRequest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,19 @@ class TokenRepositoryImpl @Inject constructor(
return loginLocalDataSource.getRefreshToken()
}

override suspend fun postAccessToken(type: LoginType, accessToken: String): Result<TokenResponse> {
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<TokenResponse> {
return tokenRemoteDataSource.postAccessToken(type = type, accessToken = accessToken)
.onSuccess {
loginLocalDataSource.setDataStore(
it.accessToken,
it.refreshToken,
it.loginSuccess,
it.schoolInfoProvided
)
}
}

override suspend fun getAccessToken(): Result<String> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ interface AgencyRepository {
suspend fun registerAgency(request: AgencyRegisterRequest): Result<RegisterAgencyResponse>
fun getAgencies(): Flow<PagingData<AgencyGetResponse>>
suspend fun fetchMyAgencyList(): Result<List<MyAgencyResponse>>
suspend fun fetchAgencyByName(agencyName: String): Result<List<AgencyGetResponse>>
suspend fun agencyCodeNumbers(agencyId: Long, data: AgencyJoinRequest): Result<AgencyJoinResponse>

suspend fun saveAgencyId(agencyId: Int)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<PagingData<AgencyGetResponse>> {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
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<List<AgencyGetResponse>> {
return agencyRepository.fetchAgencyByName(agencyName = agencyName)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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<UserResponse> {
Expand Down
Loading