Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file removed app/release/app-release.apk
Binary file not shown.
Binary file removed app/release/baselineProfiles/0/app-release.dm
Binary file not shown.
Binary file removed app/release/baselineProfiles/1/app-release.dm
Binary file not shown.
37 changes: 0 additions & 37 deletions app/release/output-metadata.json

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
package com.example.core.util.extension

fun Long.toCategoryName(): String {
import com.example.core.ui.R

fun Long.toCategoryName(): Int {
return when(this) {
0L -> "직장 내 고충"
1L -> "체류 및 비자"
2L -> "산재 및 의료"
3L -> "기타"
else -> "직장 내 고충"
0L -> R.string.community_category_workplace
1L -> R.string.community_category_visa
2L -> R.string.community_category_insurance
3L -> R.string.community_category_etc
else -> R.string.community_category_workplace
}
}

Expand Down
Binary file added core-ui/src/main/res/drawable/flag_ch.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 added core-ui/src/main/res/drawable/flag_en.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 added core-ui/src/main/res/drawable/flag_jp.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 added core-ui/src/main/res/drawable/flag_kr.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 added core-ui/src/main/res/drawable/flag_vi.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 6 additions & 1 deletion core-ui/src/main/res/values-ja/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,13 @@
<string name="mypage_logout_dialog_title">ログアウトしますか?</string>
<string name="mypage_logout_dialog_subtitle">また次回お会いしましょう!</string>
<string name="mypage_nickname_edit">ニックネームの変更</string>
<string name="community_empty_message">まだ投稿がありません。\n最初の投稿を作成してみましょう!</string>
<string name="community_empty_message">まだ投稿がありません。 最初の投稿を作成してみましょう!</string>
<string name="ai_chat_toast">チャットは500文字以内で入力してください。</string>
<string name="mypage_chat_sumary">チャット要約</string>
<string name="temp_nickname_deadline">ニックネームは15文字以下で入力してください。</string>
<string name="mypage_posts_comments_one_line">投稿 / コメント</string>
<string name="failed_connect_server">サーバーとの通信に失敗しました。</string>
<string name="anonymous">匿名%d</string>
<string name="write_post">投稿の作成</string>
<string name="edit_post">投稿の修正</string>
</resources>
5 changes: 5 additions & 0 deletions core-ui/src/main/res/values-ko/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -114,4 +114,9 @@
<string name="ai_chat_toast">채팅은 500자 이하로 입력해주세요.</string>
<string name="mypage_chat_sumary">chat 요약</string>
<string name="temp_nickname_deadline">닉네임은 15자 이하로 입력해주세요.</string>
<string name="mypage_posts_comments_one_line">게시글 / 댓글</string>
<string name="failed_connect_server">서버와의 통신에 실패했습니다.</string>
<string name="anonymous">익명%d</string>
<string name="write_post">게시글 작성</string>
<string name="edit_post">게시글 수정</string>
</resources>
5 changes: 5 additions & 0 deletions core-ui/src/main/res/values-vi/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -114,4 +114,9 @@
<string name="home_greeting_suffix">,</string>
<string name="home_greeting_message">Xin chào!</string>
<string name="temp_nickname_deadline">Vui lòng nhập biệt danh không quá 15 ký tự.</string>
<string name="mypage_posts_comments_one_line">Bài viết / Bình luận</string>
<string name="failed_connect_server">Kết nối với máy chủ thất bại.</string>
<string name="anonymous">Ẩn danh%d</string>
<string name="write_post">Viết bài đăng</string>
<string name="edit_post">Chỉnh sửa bài đăng</string>
</resources>
5 changes: 5 additions & 0 deletions core-ui/src/main/res/values-zh-rCN/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -114,4 +114,9 @@
<string name="home_greeting_suffix">,</string>
<string name="home_greeting_message">您好!</string>
<string name="temp_nickname_deadline">昵称请限制在15个字符以内。</string>
<string name="mypage_posts_comments_one_line">帖子 / 评论</string>
<string name="failed_connect_server">与服务器通信失败。</string>
<string name="anonymous">匿名%d</string>
<string name="write_post">发布帖子</string>
<string name="edit_post">修改帖子</string>
</resources>
7 changes: 7 additions & 0 deletions core-ui/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -158,4 +158,11 @@
<string name="home_greeting_suffix">,</string>
<string name="home_greeting_message">Hello</string>
<string name="temp_nickname_deadline">Please enter a nickname of 15 characters or fewer.</string>
<string name="mypage_posts_comments_one_line">Posts/Comments</string>

<string name="failed_connect_server">Failed to communicate with the server.</string>
<string name="anonymous">Anonymous%d</string>
<string name="write_post">Write Post</string>
<string name="edit_post">Edit Post</string>

</resources>
24 changes: 12 additions & 12 deletions core/model/src/main/java/com/example/model/common/Language.kt
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ data class LanguageRequest(
)

@Serializable
enum class Language(val code: Long, val displayName: String, val flag: String, val localeCode: String) {
ENGLISH(1, "English", Flag.ENGLISH, "en"),
KOREAN(2, "Korean", Flag.KOREAN, "ko"),
JAPANESE(3, "Japanese", Flag.JAPANESE, "ja"),
CHINESE(4, "Chinese", Flag.CHINESE, "zh-CN"),
VIETNAMESE(5, "Vietnamese", Flag.VIETNAMESE, "vi");
enum class Language(val code: Long, val displayName: String, val national: National, val localeCode: String) {
ENGLISH(1, "English", National.ENGLISH, "en"),
KOREAN(2, "Korean", National.KOREAN, "ko"),
JAPANESE(3, "Japanese", National.JAPANESE, "ja"),
CHINESE(4, "Chinese", National.CHINESE, "zh-CN"),
VIETNAMESE(5, "Vietnamese", National.VIETNAMESE, "vi");

companion object {
fun fromCode(code: Long): Language? {
Expand All @@ -24,10 +24,10 @@ enum class Language(val code: Long, val displayName: String, val flag: String, v
}
}

object Flag {
val ENGLISH = "\uD83C\uDDFA\uD83C\uDDF8"
val KOREAN = "\uD83C\uDDF0\uD83C\uDDF7"
val JAPANESE = "\uD83C\uDDEF\uD83C\uDDF5"
val CHINESE = "\uD83C\uDDE8\uD83C\uDDF3"
val VIETNAMESE = "\uD83C\uDDFB\uD83C\uDDF3"
enum class National {
ENGLISH,
KOREAN,
JAPANESE,
CHINESE,
VIETNAMESE,
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ data class DetailRequest(
val page: Int = 0,
@SerialName("size")
val size: Int = 10,
@SerialName("category_id")
val categoryId: Long,
@SerialName("community_id")
val communityId: Long,
)
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ data class DetailResponse(
val title: String = "",
@SerialName("content")
val content: String = "",
@SerialName("category_id")
val categoryId: Long = 0,
@SerialName("created_at")
val createdAt: String = "",
@SerialName("fileList")
Expand Down
38 changes: 24 additions & 14 deletions feature/src/main/java/com/example/feature/ui/community/Community.kt
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ import com.example.model.community.Post
@Composable
internal fun Community(
onNavigateToCommunityPostWrite: (Int, Int, ContentType) -> Unit,
onNavigateToCommunityPostDetail: (Int, Int) -> Unit,
onNavigateToCommunityPostDetail: (Int) -> Unit,
onCheckCommunityUpdate: () -> Boolean,
onClearCommunityUpdate: () -> Unit,
modifier: Modifier = Modifier,
Expand Down Expand Up @@ -159,6 +159,7 @@ internal fun Community(
isSelected = pagerState.currentPage == 3,
)
}
Spacer(modifier = Modifier.height(12.dp))
HorizontalDivider(modifier = Modifier.fillMaxWidth(), thickness = 1.dp, color = HelloWorldMain200)
HorizontalPager(
state = pagerState,
Expand All @@ -167,25 +168,25 @@ internal fun Community(
when (page) {
0 -> CommunityTabContent(
posts = problemPosts,
onPostClick = { onNavigateToCommunityPostDetail(0, it) },
onPostClick = { onNavigateToCommunityPostDetail(it) },
onLoadMore = { viewModel.loadMorePosts(0) },
isLoading = isLoading,
)
1 -> CommunityTabContent(
posts = nationalPosts,
onPostClick = { onNavigateToCommunityPostDetail(1, it) },
onPostClick = { onNavigateToCommunityPostDetail(it) },
onLoadMore = { viewModel.loadMorePosts(1) },
isLoading = isLoading,
)
2 -> CommunityTabContent(
posts = medicalPosts,
onPostClick = { onNavigateToCommunityPostDetail(2, it) },
onPostClick = { onNavigateToCommunityPostDetail(it) },
onLoadMore = { viewModel.loadMorePosts(2) },
isLoading = isLoading,
)
3 -> CommunityTabContent(
posts = etcPosts,
onPostClick = { onNavigateToCommunityPostDetail(3, it) },
onPostClick = { onNavigateToCommunityPostDetail(it) },
onLoadMore = { viewModel.loadMorePosts(3) },
isLoading = isLoading,
)
Expand Down Expand Up @@ -317,15 +318,15 @@ fun CommunityPostItem(
) {
Text(
text = post.title.truncateWithEllipsis(20),
style = AppTypography.body02,
style = AppTypography.heading04,
color = HelloWorldGrayScale800,
maxLines = 1,
overflow = TextOverflow.Ellipsis,
)
Spacer(modifier = Modifier.height(4.dp))
Text(
text = post.content.truncateWithEllipsis(if (post.imageUrl != null) 30 else 40),
style = AppTypography.label01,
style = AppTypography.body02,
color = HelloWorldGrayScale500,
maxLines = 1,
overflow = TextOverflow.Ellipsis,
Expand All @@ -351,11 +352,18 @@ fun CommunityPostItem(
verticalAlignment = Alignment.CenterVertically
) {
// 카테고리, 날짜
Text(
text = "${post.categoryId.toCategoryName()} • ${post.createdAt.toFormattedDate()}",
style = AppTypography.label03,
color = HelloWorldGrayScale500
)
Row {
Text(
text = stringResource(post.categoryId.toCategoryName()),
style = AppTypography.label02,
color = HelloWorldGrayScale500,
)
Text(
text = " • ${post.createdAt.toFormattedDate()}",
style = AppTypography.label02,
color = HelloWorldGrayScale500,
)
}
// 댓글
Row(
verticalAlignment = Alignment.CenterVertically
Expand All @@ -370,7 +378,7 @@ fun CommunityPostItem(
Spacer(modifier = Modifier.width(2.dp))
Text(
text = "${post.commentNum}",
style = AppTypography.label03,
style = AppTypography.label02,
color = HelloWorldGrayScale500
)
}
Expand Down Expand Up @@ -425,8 +433,10 @@ internal fun TabIconAndLabel(
}
Text(
text = title,
modifier = Modifier.width(60.dp),
style = AppTypography.label01,
color = if (isSelected) HelloWorldGrayScale800 else HelloWorldGrayScale300
color = if (isSelected) HelloWorldGrayScale800 else HelloWorldGrayScale300,
textAlign = TextAlign.Center
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ internal fun CommunityPostDetail(
onClick = {
expanded = false
onNavigateToCommunityPostWrite(
viewModel.request.categoryId.toInt(),
post.categoryId.toInt(),
viewModel.request.communityId.toInt(),
ContentType.UPDATE
)
Expand Down Expand Up @@ -264,7 +264,6 @@ internal fun CommunityPostDetail(
confirm = R.string.action_report,
onDismiss = { viewModel.updateDialogData() },
onConfirm = {
// TODO api 추가
viewModel.updateDialogData()
viewModel.reportPost { result ->
if (result) {
Expand All @@ -277,7 +276,7 @@ internal fun CommunityPostDetail(
} else {
viewModel.updateToastData(
ToastData(
text = 0, // 서버와의 통신에 실패했습니다.
text = R.string.failed_connect_server,
onDismiss = { viewModel.updateToastData() }
)
)
Expand Down Expand Up @@ -321,11 +320,18 @@ internal fun CommunityPostDetail(
.fillMaxWidth(),
verticalArrangement = Arrangement.spacedBy(12.dp)
) {
Text(
text = "${viewModel.request.categoryId.toCategoryName()} • ${post.createdAt.toFormattedDate()}",
style = AppTypography.label02,
color = HelloWorldGrayScale500,
)
Row {
Text(
text = stringResource(post.categoryId.toCategoryName()),
style = AppTypography.label02,
color = HelloWorldGrayScale500,
)
Text(
text = " • ${post.createdAt.toFormattedDate()}",
style = AppTypography.label02,
color = HelloWorldGrayScale500,
)
}
Text(
text = post.title,
style = AppTypography.heading02,
Expand Down Expand Up @@ -450,7 +456,6 @@ internal fun CommunityPostDetail(
confirm = R.string.action_report,
onDismiss = { viewModel.updateDialogData() },
onConfirm = {
// TODO api 추가
viewModel.updateDialogData()
},
)
Expand Down Expand Up @@ -573,7 +578,7 @@ private fun CommentItem(
verticalAlignment = Alignment.CenterVertically
) {
Text(
text = "익명${comment.anonymousName}",
text = stringResource(R.string.anonymous, comment.anonymousName),
style = AppTypography.label03,
color = HelloWorldGrayScale800,
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,25 +1,23 @@
package com.example.feature.ui.community

import android.util.Log
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import com.example.core.data.community.CommunityRepository
import com.example.core.ui.component.DialogData
import com.example.core.ui.component.ToastData
import com.example.core.util.extension.toFormattedDate
import com.example.model.community.DetailComment
import com.example.model.community.DetailRequest
import com.example.model.community.DetailResponse
import com.example.model.community.Post
import dagger.assisted.Assisted
import dagger.assisted.AssistedFactory
import dagger.assisted.AssistedInject
import dagger.hilt.android.lifecycle.HiltViewModel
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.flow.asStateFlow
import kotlinx.coroutines.flow.update
import kotlinx.coroutines.launch
import java.time.LocalDateTime
import javax.inject.Inject

@HiltViewModel(assistedFactory = PostDetailViewModel.Factory::class)
class PostDetailViewModel @AssistedInject constructor(
Expand Down Expand Up @@ -55,6 +53,7 @@ class PostDetailViewModel @AssistedInject constructor(

fun getContent(init: Boolean? = null) {
if (init == true) {
_post.update { DetailResponse() }
_commentList.value = emptyList()
_page.value = 0
}
Expand Down Expand Up @@ -121,7 +120,7 @@ class PostDetailViewModel @AssistedInject constructor(
fun deletePost(onResult: (Boolean) -> Unit) {
viewModelScope.launch {
communityRepository.deletePost(
categoryId = request.categoryId,
categoryId = _post.value.categoryId,
communityId = request.communityId
).fold(
onSuccess = {
Expand Down
Loading