-
Notifications
You must be signed in to change notification settings - Fork 0
[feat] #94 이용약관 API 연동 #96
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
Merged
Merged
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
cf6f160
[chore] #94 TermRepository 인터페이스 작성
Ojongseok a727935
[chore] #94 이용약관 관련 enum 상수 제거
Ojongseok 300cee9
[chore] #94 이용약관 조회 API 토큰 인증 예외 추가
Ojongseok faba8ec
[chore] #94 이용약관 관련 model 정의
Ojongseok 02530c6
[chore] #94 로그인 화면과 이용약관 화면 ViewModel 분리
Ojongseok 4827cfa
[chore] #94 약관 관련 UI primitive 파라미터 타입 Term 타입으로 변경
Ojongseok f45187c
[feat] #94 이용약관 API 연동 및 UI 구성
Ojongseok c52b6ad
[chore] #94 TermViewModel 분리에 따른 Contract 참조 변경
Ojongseok fb319f3
[chore] #94 kakaoIdToken @AssistedInject 패턴으로 전달하도록 변경
Ojongseok db982d9
[chore] #94 이용약관 동의 API 인터페이스 작성
Ojongseok f7263ad
[chore] #94 이용약관 동의 Request model 작성
Ojongseok 1e482a6
[chore] #94 서비스 가입 및 이용약관 동의 로직 구성
Ojongseok 00b3a57
[feat] #94 서비스 가입 시점 변경
Ojongseok a7383bf
[chore] #94 UserInfo data class @Immutable 키워드 추가
Ojongseok 905c26a
[chore] #94 사용자 정보 조회 약관동의 여부 필드 추가
Ojongseok 49fea33
[feat] #94 유저 약관 동의 상태에 따른 화면전환 로직 분리
Ojongseok a57fb5b
[chore] #94 온보딩 노출 여부 플래그 변경 시점 수정
Ojongseok 5566bb4
[chore] #94 온보딩 디자인 리소스 교체
Ojongseok 3a935a7
[chore] #94 변수명 변경
Ojongseok 8c5aff3
[chore] #94 TermRepositoryImpl 반환 타입 .data 추가
Ojongseok 5d96715
[fix] #96 필수 약관 동의 필드 변수명 변경
Ojongseok File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
8 changes: 8 additions & 0 deletions
8
core/data-api/src/main/java/com/neki/android/core/dataapi/repository/TermRepository.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| package com.neki.android.core.dataapi.repository | ||
|
|
||
| import com.neki.android.core.model.Term | ||
|
|
||
| interface TermRepository { | ||
| suspend fun getTerms(): Result<List<Term>> | ||
| suspend fun agreeTerms(termIds: List<Long>): Result<Unit> | ||
| } |
26 changes: 26 additions & 0 deletions
26
core/data/src/main/java/com/neki/android/core/data/remote/api/TermService.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| package com.neki.android.core.data.remote.api | ||
|
|
||
| import com.neki.android.core.data.remote.model.request.TermAgreementsRequest | ||
| import com.neki.android.core.data.remote.model.response.BasicNullableResponse | ||
| import com.neki.android.core.data.remote.model.response.BasicResponse | ||
| import com.neki.android.core.data.remote.model.response.TermsResponse | ||
| import io.ktor.client.HttpClient | ||
| import io.ktor.client.call.body | ||
| import io.ktor.client.request.get | ||
| import io.ktor.client.request.post | ||
| import io.ktor.client.request.setBody | ||
| import javax.inject.Inject | ||
|
|
||
| class TermService @Inject constructor( | ||
| private val client: HttpClient, | ||
| ) { | ||
| suspend fun getTerms(): BasicResponse<TermsResponse> { | ||
| return client.get("/api/terms").body() | ||
| } | ||
|
|
||
| suspend fun agreeTerms(request: TermAgreementsRequest): BasicNullableResponse<Unit> { | ||
| return client.post("/api/terms/agreements") { | ||
| setBody(request) | ||
| }.body() | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
...ta/src/main/java/com/neki/android/core/data/remote/model/request/TermAgreementsRequest.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| package com.neki.android.core.data.remote.model.request | ||
|
|
||
| import kotlinx.serialization.SerialName | ||
| import kotlinx.serialization.Serializable | ||
|
|
||
| @Serializable | ||
| data class TermAgreementsRequest( | ||
| @SerialName("agreements") val agreements: List<Agreement>, | ||
| ) { | ||
| @Serializable | ||
| data class Agreement( | ||
| @SerialName("termId") val termId: Long, | ||
| @SerialName("agreed") val agreed: Boolean, | ||
| ) | ||
| } | ||
28 changes: 28 additions & 0 deletions
28
core/data/src/main/java/com/neki/android/core/data/remote/model/response/TermResponse.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| package com.neki.android.core.data.remote.model.response | ||
|
|
||
| import com.neki.android.core.model.Term | ||
| import kotlinx.serialization.SerialName | ||
| import kotlinx.serialization.Serializable | ||
|
|
||
| @Serializable | ||
| data class TermsResponse( | ||
| @SerialName("terms") val terms: List<TermResponse> = emptyList(), | ||
| ) { | ||
| @Serializable | ||
| data class TermResponse( | ||
| @SerialName("id") val id: Long = 0L, | ||
| @SerialName("termType") val termType: String = "", | ||
| @SerialName("title") val title: String = "", | ||
| @SerialName("url") val url: String = "", | ||
| @SerialName("isRequired") val isRequired: Boolean = false, | ||
| ) { | ||
| internal fun toModel(): Term = Term( | ||
| id = id, | ||
| title = title, | ||
| url = url, | ||
| isRequired = isRequired, | ||
| ) | ||
| } | ||
|
|
||
| fun toModels(): List<Term> = terms.map { it.toModel() } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
core/data/src/main/java/com/neki/android/core/data/repository/impl/TermRepositoryImpl.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| package com.neki.android.core.data.repository.impl | ||
|
|
||
| import com.neki.android.core.data.remote.api.TermService | ||
| import com.neki.android.core.data.remote.model.request.TermAgreementsRequest | ||
| import com.neki.android.core.data.util.runSuspendCatching | ||
| import com.neki.android.core.dataapi.repository.TermRepository | ||
| import com.neki.android.core.model.Term | ||
| import javax.inject.Inject | ||
|
|
||
| class TermRepositoryImpl @Inject constructor( | ||
| private val termService: TermService, | ||
| ) : TermRepository { | ||
| override suspend fun getTerms(): Result<List<Term>> = runSuspendCatching { | ||
| termService.getTerms().data.toModels() | ||
| } | ||
|
|
||
| override suspend fun agreeTerms(termIds: List<Long>): Result<Unit> = runSuspendCatching { | ||
| val request = TermAgreementsRequest( | ||
| agreements = termIds.map { termId -> | ||
| TermAgreementsRequest.Agreement(termId = termId, agreed = true) | ||
| }, | ||
| ) | ||
| termService.agreeTerms(request).data | ||
|
Ojongseok marked this conversation as resolved.
|
||
| } | ||
|
Ojongseok marked this conversation as resolved.
|
||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.