Skip to content

Commit

Permalink
feat : 결제 내역 보기 구현 (딥링크 X)
Browse files Browse the repository at this point in the history
  • Loading branch information
HamBP committed Jul 29, 2024
1 parent a79d208 commit 26cc452
Show file tree
Hide file tree
Showing 3 changed files with 112 additions and 65 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ fun MainNavigation(modifier: Modifier, onClickQrScan: (showId: String, showName:
navigateToHome = navController::navigateToHome,
)
addGiftCompleteScreen(
navigateTo = navController::navigateTo,
navigateToHome = navController::navigateToHome,
popBackStack = { navController.popBackStack(MainDestination.Gift.route, true)}
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,24 @@ import androidx.navigation.compose.composable
import com.nexters.boolti.presentation.screen.MainDestination

fun NavGraphBuilder.addGiftCompleteScreen(
navigateTo: (String) -> Unit,
navigateToHome: () -> Unit,
popBackStack: () -> Unit,
) {
composable(
route = MainDestination.GiftComplete.route,
) {
GiftCompleteScreen(onClickClose = popBackStack, onClickHome = navigateToHome)
GiftCompleteScreen(
onClickClose = popBackStack,
onClickHome = navigateToHome,
navigateToReservation = { reservation ->
navigateTo(
MainDestination.ReservationDetail.createRoute(
id = reservation.id,
isGift = true,
)
)
},
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,20 @@ package com.nexters.boolti.presentation.screen.giftcomplete
import android.content.Context
import androidx.activity.compose.BackHandler
import androidx.compose.foundation.background
import androidx.compose.foundation.gestures.scrollable
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
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.layout.width
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.foundation.verticalScroll
import androidx.compose.material3.ButtonDefaults
import androidx.compose.material3.HorizontalDivider
import androidx.compose.material3.Icon
Expand All @@ -25,6 +29,7 @@ import androidx.compose.runtime.getValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.Brush
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.painterResource
Expand All @@ -44,6 +49,7 @@ import com.nexters.boolti.domain.model.PaymentType
import com.nexters.boolti.domain.model.ReservationDetail
import com.nexters.boolti.presentation.BuildConfig
import com.nexters.boolti.presentation.R
import com.nexters.boolti.presentation.component.SecondaryButton
import com.nexters.boolti.presentation.extension.cardCodeToCompanyName
import com.nexters.boolti.presentation.screen.payment.PaymentToolbar
import com.nexters.boolti.presentation.screen.payment.TicketSummarySection
Expand All @@ -62,6 +68,7 @@ import timber.log.Timber
fun GiftCompleteScreen(
onClickHome: () -> Unit,
onClickClose: () -> Unit,
navigateToReservation: (reservation: ReservationDetail) -> Unit,
viewModel: GiftCompleteViewModel = hiltViewModel(),
) {
val reservation by viewModel.reservation.collectAsStateWithLifecycle()
Expand All @@ -74,78 +81,105 @@ fun GiftCompleteScreen(
PaymentToolbar(onClickHome = onClickHome, onClickClose = onClickClose)
}
) { innerPadding ->
Column(
modifier = Modifier
.padding(innerPadding)
.padding(horizontal = marginHorizontal)
) {
val month = reservation?.salesEndDateTime?.month?.value ?: 0
val day = reservation?.salesEndDateTime?.dayOfMonth ?: 0
val dateText = stringResource(id = R.string.gift_expiration_date, month, day)
val buttonText = stringResource(id = R.string.gift_check)

Text(
modifier = Modifier.padding(vertical = 20.dp),
text = stringResource(id = R.string.gift_complete_note),
style = point4,
)
HorizontalDivider(color = Grey85)
InfoRow(
modifier = Modifier.padding(top = 24.dp, bottom = 8.dp),
label = stringResource(R.string.reservation_number),
value = reservation?.csReservationId ?: ""
)
InfoRow(
modifier = Modifier.padding(top = 8.dp),
label = stringResource(R.string.gift_receiver),
value = if (reservation != null) "${reservation?.visitorName} / ${reservation?.visitorPhoneNumber}" else ""
)
TextButton(
Box {
Column(
modifier = Modifier
.padding(top = 16.dp)
.fillMaxWidth()
.height(48.dp),
shape = RoundedCornerShape(4.dp),
colors = ButtonDefaults.outlinedButtonColors(containerColor = KakaoYellow),
contentPadding = PaddingValues(horizontal = 20.dp),
onClick = {
if (ShareClient.instance.isKakaoTalkSharingAvailable(context)) {
reservation?.let {
sendMessage(context, it, dateText, buttonText)
.padding(innerPadding)
.padding(horizontal = marginHorizontal)
.verticalScroll(rememberScrollState())
) {
val month = reservation?.salesEndDateTime?.month?.value ?: 0
val day = reservation?.salesEndDateTime?.dayOfMonth ?: 0
val dateText = stringResource(id = R.string.gift_expiration_date, month, day)
val buttonText = stringResource(id = R.string.gift_check)

Text(
modifier = Modifier.padding(vertical = 20.dp),
text = stringResource(id = R.string.gift_complete_note),
style = point4,
)
HorizontalDivider(color = Grey85)
InfoRow(
modifier = Modifier.padding(top = 24.dp, bottom = 8.dp),
label = stringResource(R.string.reservation_number),
value = reservation?.csReservationId ?: ""
)
InfoRow(
modifier = Modifier.padding(top = 8.dp),
label = stringResource(R.string.gift_receiver),
value = if (reservation != null) "${reservation?.visitorName} / ${reservation?.visitorPhoneNumber}" else ""
)
TextButton(
modifier = Modifier
.padding(top = 16.dp)
.fillMaxWidth()
.height(48.dp),
shape = RoundedCornerShape(4.dp),
colors = ButtonDefaults.outlinedButtonColors(containerColor = KakaoYellow),
contentPadding = PaddingValues(horizontal = 20.dp),
onClick = {
if (ShareClient.instance.isKakaoTalkSharingAvailable(context)) {
reservation?.let {
sendMessage(context, it, dateText, buttonText)
}
} else {
// TODO: 카카오톡 미설치 케이스 (아직은 고려 X)
}
} else {
// TODO: 카카오톡 미설치 케이스 (아직은 고려 X)
}
}
) {
Box(
modifier = Modifier.fillMaxWidth(),
contentAlignment = Alignment.CenterStart,
) {
Icon(
painter = painterResource(R.drawable.ic_kakaotalk),
contentDescription = null,
modifier = Modifier.size(width = 20.dp, height = 20.dp),
tint = Color.Black,
)
Text(
stringResource(id = R.string.gift_select_receiver),
Box(
modifier = Modifier.fillMaxWidth(),
style = MaterialTheme.typography.titleMedium,
color = Grey95,
textAlign = TextAlign.Center,
contentAlignment = Alignment.CenterStart,
) {
Icon(
painter = painterResource(R.drawable.ic_kakaotalk),
contentDescription = null,
modifier = Modifier.size(width = 20.dp, height = 20.dp),
tint = Color.Black,
)
Text(
stringResource(id = R.string.gift_select_receiver),
modifier = Modifier.fillMaxWidth(),
style = MaterialTheme.typography.titleMedium,
color = Grey95,
textAlign = TextAlign.Center,
)
}
}
GiftPolicy(
modifier = Modifier.padding(top = 12.dp, bottom = 24.dp),
giftPolicy = stringArrayResource(id = R.array.gift_information).toList()
)
HorizontalDivider(color = Grey85)
reservation?.let { reservation ->
ShowInformation(
reservation = reservation
)
}
Spacer(modifier = Modifier.height(88.dp))
}
GiftPolicy(
modifier = Modifier.padding(top = 12.dp, bottom = 24.dp),
giftPolicy = stringArrayResource(id = R.array.gift_information).toList()
)
HorizontalDivider(color = Grey85)
reservation?.let {
ShowInformation(
reservation = it
)
reservation?.let { reservation ->
Column(
modifier = Modifier.align(Alignment.BottomCenter)
) {
Box(
modifier = Modifier
.fillMaxWidth()
.height(16.dp)
.background(
brush = Brush.verticalGradient(listOf(Color.Transparent, Grey95))
)
)
SecondaryButton(
modifier = Modifier
.fillMaxWidth()
.background(Grey95)
.padding(horizontal = marginHorizontal, vertical = 8.dp),
label = stringResource(R.string.show_reservation),
) {
navigateToReservation(reservation)
}
}
}
}
}
Expand Down

0 comments on commit 26cc452

Please sign in to comment.