Skip to content

Commit d54aa72

Browse files
authored
Merge pull request #39 from Nexters/feature/create-proposal-v2
모임 제안 화면을 구현합니다.
2 parents b6aca34 + 681a553 commit d54aa72

File tree

36 files changed

+646
-88
lines changed

36 files changed

+646
-88
lines changed

.github/workflows/ci-for-test.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ jobs:
2929
echo "TUK_SENT_PROPOSAL_URL=KEY" >> local.properties
3030
echo "TUK_PROPOSALS_URL" >> local.properties
3131
echo "TUK_INVITE_GATHERING_URL" >> local.properties
32+
echo "TUK_COMPLETE_PROPOSAL_URL" >> local.properties
3233
3334
- name: Set up JDK 21
3435
uses: actions/setup-java@v3

app/src/main/java/com/plottwist/tuk/config/WebUrlConfigImpl.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,6 @@ class WebUrlConfigImpl @Inject constructor() : WebUrlConfig {
1111
get() = BuildConfig.TUK_PROPOSALS_URL
1212
override val inviteGatheringUrl: String
1313
get() = BuildConfig.TUK_INVITE_GATHERING_URL
14+
override val completeProposalUrl: String
15+
get() = BuildConfig.TUK_COMPLETE_PROPOSAL_URL
1416
}

build-logic/convention/src/main/kotlin/AndroidApplicationConventionPlugin.kt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,11 @@ class AndroidApplicationConventionPlugin: Plugin<Project> {
6161
"TUK_INVITE_GATHERING_URL",
6262
"\"${localProperties.getProperty("TUK_INVITE_GATHERING_URL")}\""
6363
)
64+
buildConfigField(
65+
"String",
66+
"TUK_COMPLETE_PROPOSAL_URL",
67+
"\"${localProperties.getProperty("TUK_COMPLETE_PROPOSAL_URL")}\""
68+
)
6469

6570
}
6671
}

core/data/src/main/java/com/plottwist/core/data/gathering/repository/GatheringRepository.kt

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@ import com.plottwist.core.data.mapper.toDomainModel
44
import com.plottwist.core.domain.gathering.repository.GatheringRepository
55
import com.plottwist.core.domain.model.GatheringDetail
66
import com.plottwist.core.domain.model.Gatherings
7+
import com.plottwist.core.domain.model.Proposal
78
import com.plottwist.core.domain.model.Purposes
9+
import com.plottwist.core.network.model.gathering.CreateProposeData
10+
import com.plottwist.core.network.model.gathering.CreateProposeRequest
811
import com.plottwist.core.network.service.TukApiService
912
import javax.inject.Inject
1013

@@ -34,4 +37,32 @@ class GatheringRepositoryImpl @Inject constructor(
3437
Result.failure(e)
3538
}
3639
}
40+
41+
override suspend fun createPropose(
42+
gatheringId: Long?,
43+
whereTag: String,
44+
whenTag: String,
45+
whatTag: String
46+
): Result<Proposal> {
47+
try {
48+
val result = tukApiService.createPropose(
49+
gatheringId = gatheringId,
50+
CreateProposeRequest(
51+
purpose = CreateProposeData(
52+
whereTag = whereTag,
53+
whenTag = whenTag,
54+
whatTag = whatTag
55+
)
56+
)
57+
)
58+
59+
return if(result.success) {
60+
Result.success(result.toDomainModel())
61+
}else {
62+
Result.failure(Exception(result.meta?.errorMessage))
63+
}
64+
} catch (e: Exception) {
65+
return Result.failure(e)
66+
}
67+
}
3768
}

core/data/src/main/java/com/plottwist/core/data/mapper/Gathering.kt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ import com.plottwist.core.domain.model.GatheringDetail
44
import com.plottwist.core.domain.model.GatheringMember
55
import com.plottwist.core.domain.model.GatheringOverviews
66
import com.plottwist.core.domain.model.Gatherings
7+
import com.plottwist.core.domain.model.Proposal
78
import com.plottwist.core.domain.model.Purposes
9+
import com.plottwist.core.network.model.gathering.CreateProposeResponse
810
import com.plottwist.core.network.model.gathering.GatheringDetailData
911
import com.plottwist.core.network.model.gathering.GatheringMemberData
1012
import com.plottwist.core.network.model.gathering.GatheringOverviewsData
@@ -54,3 +56,9 @@ fun GetPurposesResponse.toDomainModel() : Purposes {
5456
whenTags = this.data.whenTags
5557
)
5658
}
59+
60+
fun CreateProposeResponse.toDomainModel() : Proposal {
61+
return Proposal(
62+
proposalId = this.data.proposalId
63+
)
64+
}
21.9 KB
Loading

core/designsystem/src/main/res/values/strings.xml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@
2424
<string name="gathering_detail_received_invitation">받은 초대장</string>
2525
<string name="gathering_detail_member">멤버 %d</string>
2626

27-
<string name="create_proposal_title">가볍게 제안하고\n만남을 이어가세요</string>
27+
<string name="create_proposal_title">이렇게 전해질 거예요,\n한번 볼까요?</string>
2828
<string name="create_proposal_select_gathering">모임 선택</string>
29-
<string name="create_proposal_propose">제안하기</string>
29+
<string name="create_proposal_propose">툭, 찔러보기</string>
3030
<string name="create_proposal_selected_gathering_name">%s 친구들에게</string>
3131

3232
<string name="onboarding_name_title">어떤 이름으로 친구들에게\n인사할까요?</string>
@@ -46,5 +46,6 @@
4646

4747

4848
<string name="common_next">다음</string>
49-
<string name="common_confirm">다음</string>
49+
<string name="common_confirm">확인</string>
50+
<string name="common_previous">이전</string>
5051
</resources>

core/domain/src/main/java/com/plottwist/core/domain/gathering/repository/GatheringRepository.kt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,17 @@ package com.plottwist.core.domain.gathering.repository
22

33
import com.plottwist.core.domain.model.GatheringDetail
44
import com.plottwist.core.domain.model.Gatherings
5+
import com.plottwist.core.domain.model.Proposal
56
import com.plottwist.core.domain.model.Purposes
67

78
interface GatheringRepository {
89
suspend fun getGatherings(): Result<Gatherings>
910
suspend fun getGatheringDetail(gatheringId: Long): Result<GatheringDetail>
1011
suspend fun getPurposes(): Result<Purposes>
12+
suspend fun createPropose(
13+
gatheringId: Long?,
14+
whereTag: String,
15+
whenTag: String,
16+
whatTag: String
17+
): Result<Proposal>
1118
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package com.plottwist.core.domain.gathering.usecase
2+
3+
import com.plottwist.core.domain.gathering.repository.GatheringRepository
4+
import com.plottwist.core.domain.model.Proposal
5+
import com.plottwist.core.domain.model.Purposes
6+
import javax.inject.Inject
7+
8+
class CreateProposalUseCase @Inject constructor(
9+
private val gatheringRepository: GatheringRepository
10+
) {
11+
suspend operator fun invoke(
12+
gatheringId: Long?,
13+
whereTag: String,
14+
whenTag: String,
15+
whatTag: String
16+
): Result<Proposal> {
17+
return gatheringRepository.createPropose(
18+
gatheringId = gatheringId,
19+
whereTag = whereTag,
20+
whenTag = whenTag,
21+
whatTag = whatTag
22+
)
23+
}
24+
}

core/domain/src/main/java/com/plottwist/core/domain/model/Gathering.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,7 @@ data class Purposes(
3131
val whereTags: List<String> = emptyList(),
3232
val whatTags: List<String> = emptyList()
3333
)
34+
35+
data class Proposal(
36+
val proposalId : Long
37+
)

0 commit comments

Comments
 (0)