Skip to content

Commit

Permalink
Merge pull request #156 from YAPP-Github/feature/jaino/#155
Browse files Browse the repository at this point in the history
#155 : 쪽지 QA 수정
  • Loading branch information
jeongjaino authored Sep 10, 2024
2 parents 69fa976 + 7b4149b commit 3585458
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ data class User(

fun toSchoolInfo() = "$schoolName ${grade}학년 ${classNumber}"

fun toShortSchoolName(): String =
schoolName.replace("중학교", "").replace("고등학교", "")

fun toUserInfoWithoutSchoolName() = "${grade}학년 ${classNumber}$name"

fun toDescription(): String {
val schoolName = schoolName.replace("중학교", "").replace("고등학교", "")
return "$schoolName ${grade}학년 ${classNumber}$name"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.res.vectorResource
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp
import com.bff.wespot.designsystem.R
import com.bff.wespot.designsystem.theme.Gray100
Expand All @@ -40,6 +41,7 @@ import com.bff.wespot.designsystem.util.OrientationPreviews
fun WSMessageItem(
date: String,
wsMessageItemType: WSMessageItemType,
schoolName: String? = null,
userInfo: String? = null,
itemClick: () -> Unit,
optionButtonClick: () -> Unit,
Expand All @@ -61,6 +63,7 @@ fun WSMessageItem(
userInfo = userInfo,
date = date,
wsMessageItemType = wsMessageItemType,
schoolName = schoolName,
)
}
}
Expand Down Expand Up @@ -88,6 +91,7 @@ private fun WSLetterItemOptionButton(

@Composable
private fun WSLetterItemContent(
schoolName: String?,
userInfo: String?,
date: String,
wsMessageItemType: WSMessageItemType,
Expand Down Expand Up @@ -121,16 +125,22 @@ private fun WSLetterItemContent(

Column(modifier = Modifier.padding(top = 2.dp)) {
Text(
text = wsMessageItemType.letterStatusText(),
text = schoolName?.let {
wsMessageItemType.letterStatusText() + " $schoolName"
} ?: wsMessageItemType.letterStatusText(),
color = Gray100,
style = StaticTypeScale.Default.body9,
maxLines = 1,
overflow = TextOverflow.Ellipsis,
)

userInfo?.let {
Text(
text = userInfo,
color = Gray100,
style = StaticTypeScale.Default.body9,
maxLines = 1,
overflow = TextOverflow.Ellipsis,
)
}
}
Expand Down Expand Up @@ -158,7 +168,6 @@ private fun WSLetterItemContent(
}

sealed interface WSMessageItemType {
// TODO 송신/차단/신고된 메세지는 다른 이모지 사용
@Composable
fun optionIcon(): ImageVector

Expand Down
Binary file modified designsystem/src/main/res/drawable/closed_letter.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified designsystem/src/main/res/drawable/opened_letter.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.dp
import androidx.compose.ui.window.Dialog
import androidx.compose.ui.zIndex
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import androidx.paging.LoadState
import androidx.paging.compose.collectAsLazyPagingItems
Expand Down Expand Up @@ -220,10 +221,11 @@ fun MessageStorageScreen(
item?.let {
WSMessageItem(
userInfo = if (item.isBlocked.not() && item.isReported.not()) {
item.receiver.toDescription()
item.receiver.toUserInfoWithoutSchoolName()
} else {
null
},
schoolName = item.receiver.toShortSchoolName(),
date = item.receivedAt?.toStringWithDotSeparator() ?: "",
wsMessageItemType = when {
item.isBlocked -> WSMessageItemType.BlockedMessage
Expand Down Expand Up @@ -386,11 +388,17 @@ private fun MessageContentDialog(
closeButtonClick: () -> Unit,
) {
Dialog(onDismissRequest = { }) {
Box(
modifier = Modifier
.width(296.dp)
.heightIn(min = 376.dp, max = 424.dp),
) {
Box(modifier = Modifier.width(296.dp)) {
Image(
modifier = Modifier
.align(Alignment.TopEnd)
.padding(top = 8.dp, end = 8.dp)
.clickable { closeButtonClick() }
.zIndex(1f),
painter = painterResource(id = R.drawable.close),
contentDescription = stringResource(id = R.string.close),
)

Column(
modifier = Modifier
.clip(WeSpotThemeManager.shapes.extraLarge)
Expand All @@ -400,44 +408,37 @@ private fun MessageContentDialog(
color = Primary400,
shape = WeSpotThemeManager.shapes.extraLarge,
)
.fillMaxSize()
.padding(horizontal = 24.dp, vertical = 20.dp),
verticalArrangement = Arrangement.spacedBy(20.dp),
.padding(start = 24.dp, end = 24.dp, bottom = 24.dp),
verticalArrangement = Arrangement.SpaceBetween,
) {
MessageDialogText("To.\n" + message.receiver)
Column {
MessageDialogText("To.\n" + message.receiver)

MessageDialogText(message.content, Modifier.weight(1f))
MessageDialogText(message.content, isMessageContent = true)
}

MessageDialogText(
text = "From.\n" + message.sender,
textAlign = TextAlign.End,
)
}

Box(
modifier = Modifier
.fillMaxWidth()
.padding(top = 8.dp, end = 8.dp),
contentAlignment = Alignment.CenterEnd,
) {
Image(
modifier = Modifier.clickable { closeButtonClick() },
painter = painterResource(id = R.drawable.close),
contentDescription = stringResource(id = R.string.close),
)
}
}
}
}

@Composable
private fun MessageDialogText(
text: String,
modifier: Modifier = Modifier,
textAlign: TextAlign = TextAlign.Start,
isMessageContent: Boolean = false,
) {
Text(
modifier = modifier.fillMaxWidth(),
modifier = Modifier
.fillMaxWidth()
.padding(top = 20.dp)
.let {
if (isMessageContent) it.heightIn(min = 192.dp, max = 240.dp) else it
},
text = text,
style = StaticTypeScale.Default.body4,
color = WeSpotThemeManager.colors.txtTitleColor,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,12 +154,14 @@ class SendViewModel @Inject constructor(
selectedUser = message.receiver,
messageInput = message.content,
isRandomName = message.isAnonymous,
sender = message.senderName,
)
}
// 예약된 메세지 보낸이가 익명인 경우, 새로 프로필을 불러온다.
// 예약된 메세지 보낸이가 익명인 경우, 새로 프로필을 불러와 상태에 대입한다.
if (message.isAnonymous) {
reduce { state.copy(randomName = message.senderName) }
getProfile()
} else {
reduce { state.copy(sender = message.senderName) }
}

messageInput.value = message.content
Expand Down

0 comments on commit 3585458

Please sign in to comment.