Skip to content

Commit

Permalink
Merge pull request #156 from PawWithU/feature/inter_management
Browse files Browse the repository at this point in the history
feature/management: ๋ด‰์‚ฌ ์™„๋ฃŒ ํƒญ์—์„œ ์ž‘์„ฑํ•œ ํ›„๊ธฐ ํ™•์ธ ํ™”๋ฉด ์ด๋™, ํ™”๋ฉด ๊ตฌํ˜„
  • Loading branch information
kang9366 authored May 22, 2024
2 parents 82bec6a + c8c15a5 commit 238eaa4
Show file tree
Hide file tree
Showing 23 changed files with 397 additions and 72 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import com.kusitms.connectdog.core.data.api.model.volunteer.EmailCertificationRe
import com.kusitms.connectdog.core.data.api.model.volunteer.IsDuplicateNicknameBody
import com.kusitms.connectdog.core.data.api.model.volunteer.NormalVolunteerSignUpBody
import com.kusitms.connectdog.core.data.api.model.volunteer.NoticeDetailResponseItem
import com.kusitms.connectdog.core.data.api.model.volunteer.ReviewDetailResponse
import com.kusitms.connectdog.core.data.api.model.volunteer.SocialVolunteerSignUpBody
import com.kusitms.connectdog.core.data.api.model.volunteer.UserInfoResponse
import retrofit2.http.Body
Expand Down Expand Up @@ -127,6 +128,11 @@ internal interface ApiService {
@Path("applicationId") applicationId: Long
): Response

@GET("/volunteers/reviews/{reviewId}")
suspend fun getReviewDetail(
@Path("reviewId") reviewId: Long
): ReviewDetailResponse

/**
* ๋กœ๊ทธ์ธ
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package com.kusitms.connectdog.core.data.api.model.volunteer

data class ReviewDetailResponse(
val profileImageNum: Int,
val dogName: String,
val volunteerNickname: String,
val createdDate: String,
val mainImage: String,
val images: List<String>,
val content: String,
val postId: Long,
val postMainImage: String,
val startDate: String,
val endDate: String,
val departureLoc: String,
val arrivalLoc: String,
val intermediaryId: Long,
val intermediaryName: String
)
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.kusitms.connectdog.core.data.mapper

import com.kusitms.connectdog.core.data.api.model.ReviewResponseItem
import com.kusitms.connectdog.core.data.api.model.volunteer.ReviewDetailResponse
import com.kusitms.connectdog.core.model.Review
import com.kusitms.connectdog.core.util.dateRangeFormat

Expand All @@ -17,3 +18,18 @@ internal fun ReviewResponseItem.toData(): Review {
content = content
)
}

fun ReviewDetailResponse.toData(): Review {
return Review(
profileNum = profileImageNum,
dogName = dogName,
userName = volunteerNickname,
mainImage = mainImage,
contentImages = images,
date = dateRangeFormat(startDate, endDate),
location = "$departureLoc โ†’ $arrivalLoc",
organization = intermediaryName,
content = content,
intermediaryId = intermediaryId
)
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.kusitms.connectdog.core.data.repository

import com.kusitms.connectdog.core.data.api.model.volunteer.ReviewDetailResponse
import com.kusitms.connectdog.core.model.Application
import com.kusitms.connectdog.core.model.ConnectDogResult
import com.kusitms.connectdog.core.model.Volunteer
Expand All @@ -10,4 +11,5 @@ interface ManagementRepository {
suspend fun getApplicationCompleted(page: Int? = 0, size: Int? = 5): List<Application>
suspend fun getMyApplication(applicationId: Long): Volunteer
suspend fun deleteMyApplication(applicationId: Long): ConnectDogResult
suspend fun getReview(reviewId: Long): ReviewDetailResponse
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.kusitms.connectdog.core.data.repository

import com.kusitms.connectdog.core.data.api.ApiService
import com.kusitms.connectdog.core.data.api.model.volunteer.ReviewDetailResponse
import com.kusitms.connectdog.core.data.mapper.toData
import com.kusitms.connectdog.core.data.mapper.volunteer.toData
import com.kusitms.connectdog.core.model.Application
Expand Down Expand Up @@ -30,4 +31,8 @@ internal class ManagementRepositoryImpl @Inject constructor(
override suspend fun deleteMyApplication(applicationId: Long): ConnectDogResult {
return api.deleteMyApplication(applicationId).toData()
}

override suspend fun getReview(reviewId: Long): ReviewDetailResponse {
return api.getReviewDetail(reviewId)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -278,14 +278,16 @@ private fun Title(
@Composable
fun ReviewItemContent(
review: Review,
modifier: Modifier = Modifier
modifier: Modifier = Modifier,
reviewType: ReviewType = ReviewType.REVIEW,
onInterProfileClick: (Long) -> Unit = {}
) {
Column(
modifier = modifier
.fillMaxWidth()
.wrapContentSize()
) {
ConnectDogReview(review = review, type = ReviewType.REVIEW)
ConnectDogReview(review = review, type = reviewType)
Spacer(modifier = Modifier.height(16.dp))
Divider(
Modifier
Expand All @@ -295,7 +297,9 @@ fun ReviewItemContent(
color = Gray7
)
Spacer(modifier = Modifier.height(16.dp))
IntermediatorInfo(review)
IntermediatorInfo(review) {
review.intermediaryId?.let { onInterProfileClick(it) }
}
Spacer(modifier = Modifier.height(16.dp))
Divider(
Modifier
Expand All @@ -308,7 +312,8 @@ fun ReviewItemContent(

@Composable
private fun IntermediatorInfo(
review: Review
review: Review,
onInterProfileClick: () -> Unit
) {
Row(
modifier = Modifier
Expand All @@ -333,7 +338,8 @@ private fun IntermediatorInfo(
text = "ํ”„๋กœํ•„ ๋ณด๊ธฐ",
fontSize = 12.sp,
color = Gray3,
fontWeight = FontWeight.Normal
fontWeight = FontWeight.Normal,
modifier = Modifier.clickable { onInterProfileClick() }
)
}
Spacer(modifier = Modifier.height(6.dp))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,13 @@ fun ConnectDogReview(
)
},
informationContent = {
ReviewContent(
date = review.date,
location = review.location,
organization = review.organization
)
if (type == ReviewType.HOME) {
ReviewContent(
date = review.date,
location = review.location,
organization = review.organization
)
}
},
contentUrl = review.mainImage,
reviewUrl = review.contentImages,
Expand Down
9 changes: 9 additions & 0 deletions core/designsystem/src/main/res/drawable/ic_down_triangle.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="8dp"
android:height="6dp"
android:viewportWidth="8"
android:viewportHeight="6">
<path
android:pathData="M3.2318,5.0781L0.3668,1.6402C-0.176,0.9889 0.2872,0 1.135,0H6.865C7.7128,0 8.176,0.9889 7.6332,1.6402L4.7682,5.0781C4.3684,5.5579 3.6316,5.5579 3.2318,5.0781Z"
android:fillColor="#8B8B8B"/>
</vector>
26 changes: 26 additions & 0 deletions core/designsystem/src/main/res/drawable/img_location_path.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="114dp"
android:viewportWidth="24"
android:viewportHeight="114">
<group>
<clip-path
android:pathData="M0,0h24v24h-24z"/>
<path
android:pathData="M12,21.33C11.77,21.33 11.53,21.28 11.3,21.2C11.07,21.12 10.86,20.99 10.68,20.83C9.59,19.83 8.63,18.85 7.8,17.9C6.97,16.95 6.27,16.03 5.71,15.14C5.15,14.25 4.73,13.39 4.44,12.56C4.15,11.74 4,10.95 4,10.2C4,7.7 4.8,5.71 6.41,4.22C8.02,2.74 9.88,2 12,2C14.12,2 15.98,2.74 17.59,4.22C19.2,5.71 20,7.7 20,10.2C20,10.95 19.85,11.74 19.56,12.56C19.27,13.39 18.85,14.25 18.29,15.14C17.73,16.03 17.03,16.95 16.2,17.9C15.37,18.85 14.41,19.83 13.32,20.83C13.14,20.99 12.93,21.12 12.7,21.2C12.47,21.28 12.23,21.33 12,21.33ZM12,12C12.55,12 13.02,11.8 13.41,11.41C13.8,11.02 14,10.55 14,10C14,9.45 13.8,8.98 13.41,8.59C13.02,8.2 12.55,8 12,8C11.45,8 10.98,8.2 10.59,8.59C10.2,8.98 10,9.45 10,10C10,10.55 10.2,11.02 10.59,11.41C10.98,11.8 11.45,12 12,12Z"
android:fillColor="#7B7B7B"/>
</group>
<path
android:pathData="M12,81.5L12,32.5"
android:strokeWidth="2"
android:fillColor="#00000000"
android:strokeColor="#D9D9D9"
android:strokeLineCap="round"/>
<group>
<clip-path
android:pathData="M0,90h24v24h-24z"/>
<path
android:pathData="M10.95,100.5L10.25,99.8C10.05,99.6 9.82,99.5 9.55,99.5C9.28,99.5 9.05,99.6 8.85,99.8C8.65,100 8.55,100.24 8.55,100.51C8.55,100.79 8.65,101.03 8.85,101.22L10.25,102.65C10.45,102.85 10.68,102.95 10.95,102.95C11.22,102.95 11.45,102.85 11.65,102.65L15.2,99.1C15.4,98.9 15.5,98.66 15.5,98.39C15.5,98.11 15.4,97.88 15.2,97.68C15,97.47 14.76,97.38 14.49,97.38C14.21,97.38 13.98,97.47 13.77,97.68L10.95,100.5ZM20,100.2C20,100.95 19.85,101.74 19.56,102.56C19.27,103.39 18.85,104.25 18.29,105.14C17.73,106.03 17.03,106.95 16.2,107.9C15.37,108.85 14.41,109.82 13.32,110.82C13.14,110.99 12.93,111.12 12.7,111.2C12.47,111.28 12.23,111.32 12,111.32C11.77,111.32 11.53,111.28 11.3,111.2C11.07,111.12 10.86,110.99 10.68,110.82C9.59,109.82 8.63,108.85 7.8,107.9C6.97,106.95 6.27,106.03 5.71,105.14C5.15,104.25 4.73,103.39 4.44,102.56C4.15,101.74 4,100.95 4,100.2C4,97.7 4.8,95.71 6.41,94.22C8.02,92.74 9.88,92 12,92C14.12,92 15.98,92.74 17.59,94.22C19.2,95.71 20,97.7 20,100.2Z"
android:fillColor="#FFAC60"/>
</group>
</vector>
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@ data class Review(
val location: String,
val organization: String,
val content: String,
val contentImages: List<String>?
val contentImages: List<String>?,
val intermediaryId: Long? = null
)
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import androidx.hilt.navigation.compose.hiltViewModel
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import com.kusitms.connectdog.core.designsystem.component.ConnectDogTopAppBar
import com.kusitms.connectdog.core.designsystem.component.ReviewItemContent
import com.kusitms.connectdog.core.designsystem.component.ReviewType
import com.kusitms.connectdog.core.designsystem.component.TopAppBarNavigationType
import com.kusitms.connectdog.core.designsystem.theme.ConnectDogTheme
import com.kusitms.connectdog.core.model.Review
Expand Down Expand Up @@ -93,7 +94,10 @@ fun ReviewLoading(modifier: Modifier) {
}
LazyColumn(modifier = modifier) {
items(list) {
ReviewItemContent(review = it)
ReviewItemContent(
review = it,
reviewType = ReviewType.REVIEW
)
}
}
}
Expand Down
1 change: 1 addition & 0 deletions feature/intermediator/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ dependencies {
implementation(libs.androidx.compose.ui.graphics)
implementation(libs.androidx.compose.ui.tooling.preview)
implementation(libs.androidx.compose.material3)
implementation("io.coil-kt:coil-compose:2.4.0")

// test
implementation(libs.androidx.junit.ktx)
Expand Down
Binary file not shown.
1 change: 1 addition & 0 deletions feature/intermediator/src/main/res/values/string.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
<string name="check_volunteer_top_title">์ด๋™๋ด‰์‚ฌ์ž ํ™•์ธ</string>
<string name="make_complete">๋ด‰์‚ฌ ์™„๋ฃŒํ•˜๊ธฐ</string>
<string name="create_review">ํ›„๊ธฐ ๋“ฑ๋ก</string>
<string name="check_review">์ž‘์„ฑํ•œ ํ›„๊ธฐ ํ™•์ธ</string>
<string name="check_recent">๊ทผํ™ฉ ํ™•์ธ</string>
<string name="reject">๋ฐ˜๋ คํ•˜๊ธฐ</string>
<string name="confirm">ํ™•์ •ํ•˜๊ธฐ</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ import com.kusitms.connectdog.feature.login.navigateNormalLogin
import com.kusitms.connectdog.feature.login.navigatePasswordSearch
import com.kusitms.connectdog.feature.login.navigatePasswordSearchComplete
import com.kusitms.connectdog.feature.login.navigateToLoginRoute
import com.kusitms.connectdog.feature.management.navigation.navigateCheckReview
import com.kusitms.connectdog.feature.management.navigation.navigateCreateReview
import com.kusitms.connectdog.feature.management.navigation.navigateManagement
import com.kusitms.connectdog.feature.mypage.navigation.navigateBadge
Expand Down Expand Up @@ -131,7 +132,8 @@ internal class MainNavigator(
fun navigateBadge() = navController.navigateBadge()
fun navigateBookmark() = navController.navigateBookmark()
fun navigateEditProfileImage() = navController.navigateEditProfileImage()
fun navigateCreateReview() = navController.navigateCreateReview()
fun navigateCreateReview(application: String) = navController.navigateCreateReview(application)
fun navigateCheckReview(reviewId: Long) = navController.navigateCheckReview(reviewId)

// intermediator
fun navigateIntermediatorHome() = navController.navigateInterHome()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.kusitms.connectdog.feature.main

import android.net.Uri
import androidx.compose.animation.AnimatedVisibility
import androidx.compose.animation.fadeIn
import androidx.compose.animation.fadeOut
Expand Down Expand Up @@ -27,6 +28,7 @@ import androidx.compose.ui.unit.IntOffset
import androidx.compose.ui.unit.dp
import androidx.hilt.navigation.compose.hiltViewModel
import androidx.navigation.compose.NavHost
import com.google.gson.Gson
import com.kusitms.connectdog.core.designsystem.theme.ConnectDogTheme
import com.kusitms.connectdog.core.util.AppMode
import com.kusitms.connectdog.feature.home.navigation.homeNavGraph
Expand Down Expand Up @@ -117,7 +119,12 @@ internal fun MainScreen(
managementNavGraph(
onBackClick = navigator::popBackStackIfNotHome,
onShowErrorSnackbar = {},
onNavigateToCreateReview = { navigator.navigateCreateReview() }
onNavigateToCheckReview = navigator::navigateCheckReview,
onNavigateToInterProfile = navigator::navigateIntermediatorProfile,
onNavigateToCreateReview = {
val jsonData = Uri.encode(Gson().toJson(it))
navigator.navigateCreateReview(jsonData)
}
)
mypageNavGraph(
padding = it,
Expand Down
1 change: 1 addition & 0 deletions feature/management/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ dependencies {

kapt(libs.hilt.compiler)
implementation(libs.hilt.android)
implementation(libs.google.gson)

implementation(libs.androidx.compose.navigation)
implementation(libs.hilt.navigation.compose)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,39 +3,74 @@ package com.kusitms.connectdog.feature.management.navigation
import androidx.navigation.NavController
import androidx.navigation.NavGraphBuilder
import androidx.navigation.NavOptions
import androidx.navigation.NavType
import androidx.navigation.compose.composable
import androidx.navigation.navArgument
import com.google.gson.Gson
import com.kusitms.connectdog.core.model.Application
import com.kusitms.connectdog.feature.management.screen.CheckReviewScreen
import com.kusitms.connectdog.feature.management.screen.CreateReviewScreen
import com.kusitms.connectdog.feature.management.screen.ManagementRoute

fun NavController.navigateManagement(navOptions: NavOptions) {
navigate(ManagementRoute.route, navOptions)
}

fun NavController.navigateCreateReview() {
navigate(ManagementRoute.create_review)
fun NavController.navigateCreateReview(application: String) {
navigate("${ManagementRoute.create_review}/$application")
}

fun NavController.navigateCheckReview(reviewId: Long) {
navigate("${ManagementRoute.check_review}/$reviewId")
}

fun NavGraphBuilder.managementNavGraph(
onBackClick: () -> Unit,
onNavigateToCreateReview: () -> Unit,
onNavigateToCreateReview: (Application) -> Unit,
onNavigateToCheckReview: (Long) -> Unit,
onNavigateToInterProfile: (Long) -> Unit,
onShowErrorSnackbar: (throwable: Throwable?) -> Unit
) {
composable(route = ManagementRoute.route) {
ManagementRoute(
onBackClick,
onNavigateToCreateReview,
onNavigateToCheckReview,
onShowErrorSnackbar
)
}

composable(route = ManagementRoute.create_review) {
composable(
route = "${ManagementRoute.create_review}/{application}",
arguments = listOf(
navArgument("application") { type = NavType.StringType }
)
) {
val applicationJson = it.arguments?.getString("application")
val application = Gson().fromJson(applicationJson, Application::class.java)
CreateReviewScreen(
onBackClick = onBackClick
onBackClick = onBackClick,
application = application
)
}

composable(
route = "${ManagementRoute.check_review}/{reviewId}",
arguments = listOf(
navArgument("reviewId") { type = NavType.LongType }
)
) {
val postId = it.arguments!!.getLong("reviewId")
CheckReviewScreen(
onBackClick = onBackClick,
reviewId = postId,
onInterProfileClick = onNavigateToInterProfile
)
}
}

object ManagementRoute {
const val route = "management"
const val create_review = "create_review"
const val check_review = "check_review"
}
Loading

0 comments on commit 238eaa4

Please sign in to comment.