-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #267 from Nexters/feature/259
[feature/259] 선물하기 무료 케이스 및 다양한 케이스 처리
- Loading branch information
Showing
17 changed files
with
406 additions
and
256 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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 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 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
18 changes: 18 additions & 0 deletions
18
domain/src/main/java/com/nexters/boolti/domain/request/FreeGiftRequest.kt
This file contains 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,18 @@ | ||
package com.nexters.boolti.domain.request | ||
|
||
import kotlinx.serialization.SerialName | ||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
data class FreeGiftRequest( | ||
val amount: Int, | ||
val showId: String, | ||
val salesTicketTypeId: String, | ||
val ticketCount: Int, | ||
@SerialName("giftImgId") val giftImageId: String, | ||
val message: String, | ||
val senderName: String, | ||
val senderPhoneNumber: String, | ||
val recipientName: String, | ||
val recipientPhoneNumber: String, | ||
) |
This file contains 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 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
174 changes: 174 additions & 0 deletions
174
presentation/src/main/java/com/nexters/boolti/presentation/screen/gift/CardSelection.kt
This file contains 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,174 @@ | ||
package com.nexters.boolti.presentation.screen.gift | ||
|
||
import androidx.compose.foundation.background | ||
import androidx.compose.foundation.border | ||
import androidx.compose.foundation.clickable | ||
import androidx.compose.foundation.layout.Arrangement | ||
import androidx.compose.foundation.layout.Column | ||
import androidx.compose.foundation.layout.PaddingValues | ||
import androidx.compose.foundation.layout.aspectRatio | ||
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.lazy.LazyRow | ||
import androidx.compose.foundation.lazy.items | ||
import androidx.compose.foundation.shape.RoundedCornerShape | ||
import androidx.compose.foundation.text.BasicTextField | ||
import androidx.compose.material3.MaterialTheme | ||
import androidx.compose.material3.Text | ||
import androidx.compose.runtime.Composable | ||
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.graphics.SolidColor | ||
import androidx.compose.ui.layout.ContentScale | ||
import androidx.compose.ui.res.stringResource | ||
import androidx.compose.ui.text.style.TextAlign | ||
import androidx.compose.ui.tooling.preview.Preview | ||
import androidx.compose.ui.unit.dp | ||
import coil.compose.AsyncImage | ||
import com.nexters.boolti.domain.model.ImagePair | ||
import com.nexters.boolti.presentation.R | ||
import com.nexters.boolti.presentation.theme.BooltiTheme | ||
import com.nexters.boolti.presentation.theme.Grey10 | ||
import kotlinx.collections.immutable.ImmutableList | ||
import kotlinx.collections.immutable.toPersistentList | ||
|
||
|
||
@Composable | ||
fun CardSelection( | ||
message: String, | ||
onMessageChanged: (String) -> Unit, | ||
images: ImmutableList<ImagePair>, | ||
selectedImage: ImagePair?, | ||
onImageSelected: (ImagePair) -> Unit, | ||
) { | ||
Column( | ||
modifier = Modifier.padding(top = 24.dp, bottom = 48.dp), | ||
) { | ||
Column( | ||
modifier = Modifier | ||
.padding(horizontal = 32.dp) | ||
.clip(RoundedCornerShape(8.dp)) | ||
.background( | ||
brush = Brush.verticalGradient( | ||
colors = listOf( | ||
Color(0xFFFF5A14), | ||
Color(0xFFFFA883), | ||
) | ||
) | ||
) | ||
.border( | ||
width = 1.dp, | ||
color = Color(0xFFFFA883), | ||
shape = RoundedCornerShape(8.dp) | ||
) | ||
.padding(horizontal = 20.dp, vertical = 32.dp) | ||
.fillMaxWidth(), | ||
horizontalAlignment = Alignment.CenterHorizontally, | ||
) { | ||
val maximumLength = 40 | ||
val messageLengthUnit = stringResource(id = R.string.gift_message_length_unit) | ||
|
||
BasicTextField( | ||
modifier = Modifier | ||
.fillMaxWidth() | ||
.height(80.dp), | ||
value = message, | ||
onValueChange = onMessageChanged, | ||
textStyle = MaterialTheme.typography.titleLarge.copy( | ||
color = Color.White, | ||
textAlign = TextAlign.Center | ||
), | ||
cursorBrush = SolidColor(Color.White) | ||
) | ||
Text( | ||
modifier = Modifier.padding(top = 12.dp), | ||
text = "${message.length}/${maximumLength}${messageLengthUnit}", | ||
style = MaterialTheme.typography.labelMedium.copy(color = Grey10), | ||
) | ||
|
||
AsyncImage( | ||
model = selectedImage?.originImage, | ||
contentDescription = stringResource(id = R.string.gift_selected_image), | ||
modifier = Modifier | ||
.padding(top = 28.dp) | ||
.fillMaxWidth() | ||
.aspectRatio(3 / 2f) | ||
.background(Color.White), | ||
contentScale = ContentScale.Crop, | ||
) | ||
} | ||
|
||
// TODO: 현재 선택 가능한 카드가 1개, 이후 카드 개수가 추가되면 주석 풀기! | ||
// CardCarousel( | ||
// modifier = Modifier | ||
// .padding(top = 44.dp) | ||
// .fillMaxWidth(), | ||
// images = images, | ||
// selectedImage = selectedImage, | ||
// onImageSelected = onImageSelected, | ||
// ) | ||
} | ||
} | ||
|
||
@Composable | ||
private fun CardCarousel( | ||
images: ImmutableList<ImagePair>, | ||
selectedImage: ImagePair?, | ||
onImageSelected: (ImagePair) -> Unit, | ||
modifier: Modifier = Modifier, | ||
) { | ||
LazyRow( | ||
modifier = modifier, | ||
contentPadding = PaddingValues(start = 32.dp), | ||
horizontalArrangement = Arrangement.spacedBy(12.dp), | ||
) { | ||
items(images) { image -> | ||
val cardModifier = if (image == selectedImage) { | ||
Modifier.border( | ||
width = 1.dp, | ||
color = MaterialTheme.colorScheme.primary, | ||
shape = RoundedCornerShape(4.dp) | ||
) | ||
} else { | ||
Modifier | ||
} | ||
|
||
AsyncImage( | ||
model = image.thumbnailImage, | ||
contentDescription = stringResource(id = R.string.gift_image), | ||
modifier = cardModifier | ||
.size(52.dp) | ||
.clip(RoundedCornerShape(4.dp)) | ||
.clickable { | ||
onImageSelected(image) | ||
}, | ||
contentScale = ContentScale.Crop, | ||
) | ||
} | ||
} | ||
} | ||
|
||
@Preview | ||
@Composable | ||
private fun CardSelectionPreview() { | ||
BooltiTheme { | ||
CardSelection( | ||
message = "공연에 초대합니다.", | ||
onMessageChanged = {}, | ||
images = (1..10).map { | ||
ImagePair( | ||
it.toString(), | ||
"https://picsum.photos/200", | ||
"https://picsum.photos/200" | ||
) | ||
}.toPersistentList(), | ||
selectedImage = ImagePair("", "", ""), | ||
onImageSelected = {} | ||
) | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
presentation/src/main/java/com/nexters/boolti/presentation/screen/gift/GiftEvent.kt
This file contains 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 |
---|---|---|
@@ -1,7 +1,7 @@ | ||
package com.nexters.boolti.presentation.screen.gift | ||
|
||
sealed interface GiftEvent { | ||
data class GiftSuccess(val reservationId: String, val showId: String) : GiftEvent | ||
data class GiftSuccess(val reservationId: String, val giftUuid: String) : GiftEvent | ||
data class ProgressPayment(val userId: String, val orderId: String) : GiftEvent | ||
data object NoRemainingQuantity : GiftEvent | ||
} |
Oops, something went wrong.