diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 9351be202..4eefa37d6 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -84,10 +84,10 @@
android:name=".presentation.main.profile.manage.ProfileQuitForSureActivity"
android:exported="false"
android:screenOrientation="portrait" />
-
-
-
-
+
\ No newline at end of file
diff --git a/app/src/main/java/com/yello/di/DataSourceModule.kt b/app/src/main/java/com/yello/di/DataSourceModule.kt
index b257cd97f..3bdcf351f 100644
--- a/app/src/main/java/com/yello/di/DataSourceModule.kt
+++ b/app/src/main/java/com/yello/di/DataSourceModule.kt
@@ -4,6 +4,7 @@ import com.example.data.datasource.OnboardingDataSource
import com.example.data.datasource.YelloDataSource
import com.example.data.datasource.local.MockYelloDataSourceImpl
import com.example.data.datasource.remote.OnboardingDataSourceImpl
+import com.example.data.datasource.remote.YelloDataSourceImpl
import dagger.Module
import dagger.Provides
import dagger.hilt.InstallIn
@@ -15,7 +16,7 @@ import javax.inject.Singleton
object DataSourceModule {
@Provides
@Singleton
- fun provideYelloDataSource(yelloDataSource: MockYelloDataSourceImpl): YelloDataSource =
+ fun provideYelloDataSource(yelloDataSource: YelloDataSourceImpl): YelloDataSource =
yelloDataSource
@Provides
diff --git a/app/src/main/java/com/yello/presentation/main/myyello/MyYelloAdapter.kt b/app/src/main/java/com/yello/presentation/main/myyello/MyYelloAdapter.kt
index 2ee150619..243fab7cb 100644
--- a/app/src/main/java/com/yello/presentation/main/myyello/MyYelloAdapter.kt
+++ b/app/src/main/java/com/yello/presentation/main/myyello/MyYelloAdapter.kt
@@ -7,10 +7,13 @@ import androidx.core.view.isVisible
import androidx.recyclerview.widget.RecyclerView
import com.example.domain.entity.Yello
import com.example.domain.enum.GenderEnum
+import com.example.ui.view.setOnSingleClickListener
import com.yello.R
import com.yello.databinding.ItemMyYelloBinding
+import com.yello.util.Utils
-class MyYelloAdapter : RecyclerView.Adapter() {
+class MyYelloAdapter(private val itemClick: (Yello) -> (Unit)) :
+ RecyclerView.Adapter() {
private val yelloList = mutableListOf()
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): MyYelloViewHolder {
val binding = ItemMyYelloBinding.inflate(
@@ -18,7 +21,7 @@ class MyYelloAdapter : RecyclerView.Adapter()
parent,
false
)
- return MyYelloViewHolder(binding)
+ return MyYelloViewHolder(binding, itemClick)
}
override fun onBindViewHolder(holder: MyYelloViewHolder, position: Int) {
@@ -33,7 +36,8 @@ class MyYelloAdapter : RecyclerView.Adapter()
}
class MyYelloViewHolder(
- private val binding: ItemMyYelloBinding
+ private val binding: ItemMyYelloBinding,
+ private val itemClick: (Yello) -> Unit
) : RecyclerView.ViewHolder(binding.root) {
fun onBind(item: Yello) {
binding.ivReadYelloPoint.isVisible = !item.isRead && !item.isHintUsed
@@ -81,23 +85,14 @@ class MyYelloAdapter : RecyclerView.Adapter()
binding.tvKeyword.text = item.vote.keyword
binding.tvKeywordFoot.text = item.vote.keywordFoot
if (item.nameHint >= 0) {
- binding.tvSendName.text = setChosungText(item.senderName, item.nameHint)
+ binding.tvSendName.text = Utils.setChosungText(item.senderName, item.nameHint)
}
binding.clSendName.isVisible = item.nameHint != -1
}
- }
- private fun setChosungText(name: String, number: Int): String {
- val firstChosung = name[number]
- val chosungUnicode = Character.UnicodeBlock.of(firstChosung.toInt())
- return if (chosungUnicode == Character.UnicodeBlock.HANGUL_COMPATIBILITY_JAMO
- || chosungUnicode == Character.UnicodeBlock.HANGUL_JAMO
- || chosungUnicode == Character.UnicodeBlock.HANGUL_SYLLABLES
- ) {
- val chosungIndex = (firstChosung.toInt() - 0xAC00) / 28 / 21
- val chosung = Character.toChars(chosungIndex + 0x1100)[0]
- chosung.toString() // 출력: "ㄱ"
- } else ""
+ binding.root.setOnSingleClickListener {
+ itemClick(item)
+ }
}
}
}
diff --git a/app/src/main/java/com/yello/presentation/main/myyello/MyYelloFragment.kt b/app/src/main/java/com/yello/presentation/main/myyello/MyYelloFragment.kt
index a9860df4a..43ef49506 100644
--- a/app/src/main/java/com/yello/presentation/main/myyello/MyYelloFragment.kt
+++ b/app/src/main/java/com/yello/presentation/main/myyello/MyYelloFragment.kt
@@ -12,6 +12,7 @@ import com.example.ui.fragment.toast
import com.example.ui.view.UiState
import com.yello.R
import com.yello.databinding.FragmentMyYelloBinding
+import com.yello.presentation.main.myyello.read.MyYelloReadActivity
import com.yello.presentation.util.BaseLinearRcvItemDeco
import dagger.hilt.android.AndroidEntryPoint
import kotlinx.coroutines.flow.launchIn
@@ -32,7 +33,9 @@ class MyYelloFragment : BindingFragment(R.layout.fragmen
private fun initView() {
viewModel.getMyYelloList()
- adapter = MyYelloAdapter()
+ adapter = MyYelloAdapter {
+ startActivity(MyYelloReadActivity.getIntent(requireContext(), it.id))
+ }
binding.rvMyYelloReceive.addItemDecoration(
BaseLinearRcvItemDeco(
8,
@@ -56,7 +59,6 @@ class MyYelloFragment : BindingFragment(R.layout.fragmen
when (it) {
is UiState.Success -> {
adapter?.addItem(it.data.yello)
- binding.tvCount.text = it.data.totalCount.toString()
}
is UiState.Failure -> {
@@ -66,25 +68,27 @@ class MyYelloFragment : BindingFragment(R.layout.fragmen
else -> {}
}
}.launchIn(viewLifecycleOwner.lifecycleScope)
+
+ viewModel.totalCount.flowWithLifecycle(viewLifecycleOwner.lifecycle)
+ .onEach {
+ binding.tvCount.text = it.toString()
+ }.launchIn(viewLifecycleOwner.lifecycleScope)
}
+ // 페이지네이션
private fun infinityScroll() {
binding.rvMyYelloReceive.addOnScrollListener(object : RecyclerView.OnScrollListener() {
override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) {
super.onScrolled(recyclerView, dx, dy)
- // 화면에 보이는 마지막 아이템의 position
- val lastVisibleItemPosition =
- (recyclerView.layoutManager as LinearLayoutManager).findLastCompletelyVisibleItemPosition()
- // 어댑터에 등록된 아이템의 총 개수 -1
- val itemTotalCount = adapter?.itemCount?.minus(1)
- // 스크롤이 끝에 도달했는지 확인
- if (lastVisibleItemPosition != -1 && itemTotalCount != -1) {
- if (lastVisibleItemPosition == itemTotalCount) {
+ if (dy > 0) {
+ if (!binding.rvMyYelloReceive.canScrollVertically(1) &&
+ (recyclerView.layoutManager as LinearLayoutManager).findLastVisibleItemPosition() == adapter!!.itemCount - 1
+ ) {
viewModel.getMyYelloList()
}
- }
}
- })
+ }
+ })
}
override fun onDestroyView() {
diff --git a/app/src/main/java/com/yello/presentation/main/myyello/MyYelloViewModel.kt b/app/src/main/java/com/yello/presentation/main/myyello/MyYelloViewModel.kt
index 3d6c6bdfb..e50f1ff0b 100644
--- a/app/src/main/java/com/yello/presentation/main/myyello/MyYelloViewModel.kt
+++ b/app/src/main/java/com/yello/presentation/main/myyello/MyYelloViewModel.kt
@@ -1,15 +1,17 @@
package com.yello.presentation.main.myyello
-import android.util.Log
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import com.example.domain.entity.MyYello
import com.example.domain.repository.YelloRepository
import com.example.ui.view.UiState
import dagger.hilt.android.lifecycle.HiltViewModel
+import kotlinx.coroutines.flow.MutableSharedFlow
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.SharedFlow
+import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.flow.asSharedFlow
+import kotlinx.coroutines.flow.asStateFlow
import kotlinx.coroutines.launch
import javax.inject.Inject
@@ -17,26 +19,31 @@ import javax.inject.Inject
class MyYelloViewModel @Inject constructor(
private val repository: YelloRepository
) : ViewModel() {
- private val _myYelloData = MutableStateFlow>(UiState.Loading)
+ private val _myYelloData = MutableSharedFlow>()
val myYelloData: SharedFlow> = _myYelloData.asSharedFlow()
- private var currentPage = 0
+ private val _totalCount = MutableStateFlow(0)
+ val totalCount: StateFlow = _totalCount.asStateFlow()
+
+ private var currentPage = -1
private var isPagingFinish = false
private var totalPage = Int.MAX_VALUE
fun getMyYelloList() {
if (isPagingFinish) return
- _myYelloData.value = UiState.Loading
+ _myYelloData.tryEmit(UiState.Loading)
viewModelScope.launch {
repository.getMyYelloList(++currentPage)
.onSuccess {
totalPage = Math.ceil((it.totalCount * 0.1)).toInt()
if (totalPage == currentPage) isPagingFinish = true
- _myYelloData.value = when {
- it.yello.isEmpty() -> UiState.Empty
- else -> UiState.Success(it)
- }
-
+ _myYelloData.emit(
+ when {
+ it.yello.isEmpty() -> UiState.Empty
+ else -> UiState.Success(it)
+ }
+ )
+ _totalCount.value = it.totalCount
}.onFailure {
_myYelloData.emit(UiState.Failure("옐로 리스트 서버 통신 실패"))
}
diff --git a/app/src/main/java/com/yello/presentation/main/myyello/read/MyYelloReadActivity.kt b/app/src/main/java/com/yello/presentation/main/myyello/read/MyYelloReadActivity.kt
new file mode 100644
index 000000000..0fabe10ee
--- /dev/null
+++ b/app/src/main/java/com/yello/presentation/main/myyello/read/MyYelloReadActivity.kt
@@ -0,0 +1,93 @@
+package com.yello.presentation.main.myyello.read
+
+import android.content.Context
+import android.content.Intent
+import android.os.Bundle
+import androidx.activity.viewModels
+import androidx.core.view.isVisible
+import androidx.lifecycle.flowWithLifecycle
+import androidx.lifecycle.lifecycleScope
+import com.example.domain.entity.YelloDetail
+import com.example.domain.enum.PointEnum
+import com.example.ui.base.BindingActivity
+import com.example.ui.context.toast
+import com.example.ui.intent.longExtra
+import com.example.ui.view.UiState
+import com.example.ui.view.setOnSingleClickListener
+import com.yello.R
+import com.yello.databinding.ActivityMyYelloReadBinding
+import com.yello.util.Utils
+import dagger.hilt.android.AndroidEntryPoint
+import kotlinx.coroutines.flow.launchIn
+import kotlinx.coroutines.flow.onEach
+
+@AndroidEntryPoint
+class MyYelloReadActivity :
+ BindingActivity(R.layout.activity_my_yello_read) {
+ private val id by longExtra()
+ private val viewModel by viewModels()
+ override fun onCreate(savedInstanceState: Bundle?) {
+ super.onCreate(savedInstanceState)
+
+ initView()
+ initClick()
+ observe()
+ }
+
+ private fun initView() {
+ viewModel.getYelloDetail(id)
+ }
+
+ private fun initClick() {
+ binding.tvInitialCheck.setOnSingleClickListener {
+ PointUseDialog.newInstance(true, PointEnum.INITIAL.ordinal)
+ .show(supportFragmentManager, "dialog")
+ }
+
+ binding.clSendCheck.setOnSingleClickListener {
+ PointUseDialog.newInstance(true, PointEnum.KEYWORD.ordinal)
+ .show(supportFragmentManager, "dialog")
+ }
+
+ binding.ivBack.setOnSingleClickListener {
+ finish()
+ }
+ }
+
+ private fun observe() {
+ viewModel.yelloDetailData.flowWithLifecycle(lifecycle)
+ .onEach {
+ when (it) {
+ is UiState.Success -> {
+ binding.data = it.data
+ setData(it.data)
+ }
+
+ is UiState.Failure -> {
+ toast(it.msg)
+ }
+
+ else -> {
+
+ }
+ }
+ }.launchIn(lifecycleScope)
+ }
+
+ private fun setData(yello: YelloDetail) {
+ binding.tvSendName.isVisible = yello.nameHint != -1
+ binding.tvNameNotYet.isVisible = yello.nameHint == -1
+ if (yello.nameHint >= 0) binding.tvSendName.text =
+ Utils.setChosungText(yello.senderName, yello.nameHint)
+ binding.tvGender.text =
+ if (yello.senderGender.contains("MALE")) getString(R.string.my_yello_male) else getString(
+ R.string.my_yello_female
+ )
+ }
+
+ companion object {
+ fun getIntent(context: Context, id: Long) =
+ Intent(context, MyYelloReadActivity::class.java)
+ .putExtra("id", id)
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/yello/presentation/main/myyello/read/MyYelloReadViewModel.kt b/app/src/main/java/com/yello/presentation/main/myyello/read/MyYelloReadViewModel.kt
new file mode 100644
index 000000000..2154f31f0
--- /dev/null
+++ b/app/src/main/java/com/yello/presentation/main/myyello/read/MyYelloReadViewModel.kt
@@ -0,0 +1,32 @@
+package com.yello.presentation.main.myyello.read
+
+import androidx.lifecycle.ViewModel
+import androidx.lifecycle.viewModelScope
+import com.example.domain.entity.YelloDetail
+import com.example.domain.repository.YelloRepository
+import com.example.ui.view.UiState
+import dagger.hilt.android.lifecycle.HiltViewModel
+import kotlinx.coroutines.flow.MutableStateFlow
+import kotlinx.coroutines.flow.StateFlow
+import kotlinx.coroutines.flow.asStateFlow
+import kotlinx.coroutines.launch
+import javax.inject.Inject
+
+@HiltViewModel
+class MyYelloReadViewModel @Inject constructor(
+ private val repository: YelloRepository
+) : ViewModel() {
+ private val _yelloDetailData = MutableStateFlow>(UiState.Loading)
+ val yelloDetailData: StateFlow> = _yelloDetailData.asStateFlow()
+
+ fun getYelloDetail(id: Long) {
+ viewModelScope.launch {
+ repository.getYelloDetail(id)
+ .onSuccess {
+ _yelloDetailData.value = UiState.Success(it)
+ }.onFailure {
+ _yelloDetailData.value = UiState.Failure("옐로 상세보기 서버 통신 실패")
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/yello/presentation/main/myyello/read/PointUseDialog.kt b/app/src/main/java/com/yello/presentation/main/myyello/read/PointUseDialog.kt
new file mode 100644
index 000000000..2359673db
--- /dev/null
+++ b/app/src/main/java/com/yello/presentation/main/myyello/read/PointUseDialog.kt
@@ -0,0 +1,64 @@
+package com.yello.presentation.main.myyello.read
+
+import android.content.res.Resources
+import android.os.Bundle
+import android.view.View
+import android.view.WindowManager
+import androidx.core.view.isVisible
+import com.example.domain.enum.PointEnum
+import com.example.ui.base.BindingDialogFragment
+import com.example.ui.intent.boolArgs
+import com.example.ui.intent.intArgs
+import com.yello.R
+import com.yello.databinding.DialogPointUseBinding
+
+class PointUseDialog : BindingDialogFragment(R.layout.dialog_point_use) {
+ private val isTwoButton by boolArgs()
+ private val pointType by intArgs()
+ override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
+ super.onViewCreated(view, savedInstanceState)
+
+ initView()
+ setDialogBackground()
+ }
+
+ private fun initView() {
+ setButtonView()
+ }
+
+ private fun setButtonView() {
+ binding.tvNo.isVisible = !isTwoButton
+ if (!isTwoButton) {
+ binding.tvNo.text = "투표하고 포인트 받기"
+ } else {
+ if (pointType == PointEnum.INITIAL.ordinal) {
+ binding.tvTitle.text = "300 포인트로 초성을 얻을까요?"
+ }
+ }
+ }
+
+ private fun setDialogBackground() {
+ val deviceWidth = Resources.getSystem().displayMetrics.widthPixels
+ val dialogHorizontalMargin = (Resources.getSystem().displayMetrics.density * 40) * 2
+
+ dialog?.window?.apply {
+ setLayout(
+ (deviceWidth - dialogHorizontalMargin * 2).toInt(),
+ WindowManager.LayoutParams.WRAP_CONTENT
+ )
+ setBackgroundDrawableResource(R.drawable.shape_fill_gray900_12dp)
+ }
+ dialog?.setCancelable(true)
+ }
+
+ companion object {
+ @JvmStatic
+ fun newInstance(isTwoButton: Boolean, pointType: Int) =
+ PointUseDialog().apply {
+ arguments = Bundle().apply {
+ putInt("point_type", pointType)
+ putBoolean("is_two_button", isTwoButton)
+ }
+ }
+ }
+}
diff --git a/app/src/main/java/com/yello/util/Utils.kt b/app/src/main/java/com/yello/util/Utils.kt
new file mode 100644
index 000000000..031d6cc6b
--- /dev/null
+++ b/app/src/main/java/com/yello/util/Utils.kt
@@ -0,0 +1,16 @@
+package com.yello.util
+
+object Utils {
+ fun setChosungText(name: String, number: Int): String {
+ val firstChosung = name[number]
+ val chosungUnicode = Character.UnicodeBlock.of(firstChosung.toInt())
+ return if (chosungUnicode == Character.UnicodeBlock.HANGUL_COMPATIBILITY_JAMO
+ || chosungUnicode == Character.UnicodeBlock.HANGUL_JAMO
+ || chosungUnicode == Character.UnicodeBlock.HANGUL_SYLLABLES
+ ) {
+ val chosungIndex = (firstChosung.toInt() - 0xAC00) / 28 / 21
+ val chosung = Character.toChars(chosungIndex + 0x1100)[0]
+ chosung.toString() // 출력: "ㄱ"
+ } else ""
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/yello/util/binding/BindingAdapter.kt b/app/src/main/java/com/yello/util/binding/BindingAdapter.kt
index a10b0fee5..f40cdd9be 100644
--- a/app/src/main/java/com/yello/util/binding/BindingAdapter.kt
+++ b/app/src/main/java/com/yello/util/binding/BindingAdapter.kt
@@ -6,11 +6,12 @@ import android.widget.ImageView
import android.widget.TextView
import androidx.constraintlayout.widget.ConstraintLayout
import androidx.core.content.ContextCompat.getColor
+import androidx.core.view.isVisible
import androidx.databinding.BindingAdapter
import com.yello.R
object BindingAdapter {
-
+ @JvmStatic
@BindingAdapter("setVoteBackground")
fun ConstraintLayout.setVoteBackground(bgIndex: Int) {
setBackgroundResource(
@@ -158,4 +159,26 @@ object BindingAdapter {
},
)
}
+
+ @JvmStatic
+ @BindingAdapter("setNullOrBlankVisible")
+ fun TextView.setNullOrBlankVisible(text: String?) {
+ this.isVisible = !text.isNullOrBlank()
+ }
+
+ @JvmStatic
+ @BindingAdapter("setImageTint")
+ fun ImageView.setImageTint(colorIndex: Int) {
+ if (colorIndex == 1 || colorIndex == 3 || colorIndex == 7) {
+ this.setColorFilter(getColor(this.context, R.color.black))
+ }
+ }
+
+ @JvmStatic
+ @BindingAdapter("setTextTint")
+ fun TextView.setTextTint(colorIndex: Int) {
+ if (colorIndex == 1 || colorIndex == 3 || colorIndex == 7) {
+ this.setTextColor(getColor(this.context, R.color.black))
+ }
+ }
}
diff --git a/app/src/main/res/drawable-hdpi/ic_instagram.png b/app/src/main/res/drawable-hdpi/ic_instagram.png
new file mode 100644
index 000000000..c8cf2cef9
Binary files /dev/null and b/app/src/main/res/drawable-hdpi/ic_instagram.png differ
diff --git a/app/src/main/res/drawable-mdpi/ic_instagram.png b/app/src/main/res/drawable-mdpi/ic_instagram.png
new file mode 100644
index 000000000..b3ac6012d
Binary files /dev/null and b/app/src/main/res/drawable-mdpi/ic_instagram.png differ
diff --git a/app/src/main/res/drawable-xhdpi/ic_instagram.png b/app/src/main/res/drawable-xhdpi/ic_instagram.png
new file mode 100644
index 000000000..d205ab304
Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ic_instagram.png differ
diff --git a/app/src/main/res/drawable-xxhdpi/ic_instagram.png b/app/src/main/res/drawable-xxhdpi/ic_instagram.png
new file mode 100644
index 000000000..173be017c
Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_instagram.png differ
diff --git a/app/src/main/res/drawable-xxxhdpi/ic_instagram.png b/app/src/main/res/drawable-xxxhdpi/ic_instagram.png
new file mode 100644
index 000000000..46814bc24
Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/ic_instagram.png differ
diff --git a/app/src/main/res/drawable/shape_fill_black_32dp.xml b/app/src/main/res/drawable/shape_fill_black_32dp.xml
new file mode 100644
index 000000000..0bc481598
--- /dev/null
+++ b/app/src/main/res/drawable/shape_fill_black_32dp.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/drawable/shape_fill_gray900_12dp.xml b/app/src/main/res/drawable/shape_fill_gray900_12dp.xml
new file mode 100644
index 000000000..349162bca
--- /dev/null
+++ b/app/src/main/res/drawable/shape_fill_gray900_12dp.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/drawable/shape_white_35per_8dp.xml b/app/src/main/res/drawable/shape_white_35per_8dp.xml
new file mode 100644
index 000000000..eb73604db
--- /dev/null
+++ b/app/src/main/res/drawable/shape_white_35per_8dp.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_my_yello_read.xml b/app/src/main/res/layout/activity_my_yello_read.xml
new file mode 100644
index 000000000..b31b0c2cb
--- /dev/null
+++ b/app/src/main/res/layout/activity_my_yello_read.xml
@@ -0,0 +1,363 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/dialog_point_use.xml b/app/src/main/res/layout/dialog_point_use.xml
new file mode 100644
index 000000000..faeaf6e5e
--- /dev/null
+++ b/app/src/main/res/layout/dialog_point_use.xml
@@ -0,0 +1,138 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index a6e644b68..1673a384c 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -75,6 +75,13 @@
누가 보냈는지 확인하기
너
아직 쪽지가 온 게 없어요.
+ \???
+ 0
+ 님이 보냄
+ 익명의 여학생
+ 익명의 남학생
+ 인스타그램 공유하기
+ 100포인트로 키워드 확인하기
투표 포인트 적립!
투표로 포인트를 모아 쪽지를 열어보세요.
diff --git a/buildSrc/src/main/kotlin/Versions.kt b/buildSrc/src/main/kotlin/Versions.kt
index 6051342f2..ef5e487ae 100644
--- a/buildSrc/src/main/kotlin/Versions.kt
+++ b/buildSrc/src/main/kotlin/Versions.kt
@@ -43,7 +43,7 @@ object Versions {
const val espressoVersion = "3.3.0"
const val androidTestVersion = "1.1.2"
- const val flipperVersion = "0.193.0"
+ const val flipperVersion = "0.187.0"
const val soloaderVersion = "0.10.5"
const val leakCanaryVersion = "2.11"
diff --git a/data/src/main/assets/fake_detail_yello.json b/data/src/main/assets/fake_detail_yello.json
index b6c49a648..53a0235a9 100644
--- a/data/src/main/assets/fake_detail_yello.json
+++ b/data/src/main/assets/fake_detail_yello.json
@@ -2,13 +2,18 @@
"status": 200,
"message": "조회 성공하였습니다.",
"data": {
+ "currentPoint": 400,
"nameHint": -1,
"isAnswerRevealed": false,
+ "senderGender": "MALE",
"senderName": "이의제",
"vote": {
- "head": "나는 너랑 한강에서",
- "answer": "차박하면서 책읽는 것을",
- "foot": "하고 싶어"
+ "questionId": 2,
+ "nameHead" : "술자리에서",
+ "nameFoot" : "가",
+ "keywordHead" : "사라진다면",
+ "keyword" : "수영",
+ "keywordFoot" : "(이)야"
}
}
}
\ No newline at end of file
diff --git a/data/src/main/assets/fake_total_yello.json b/data/src/main/assets/fake_total_yello.json
index da72db2a7..6b2e2ed2f 100644
--- a/data/src/main/assets/fake_total_yello.json
+++ b/data/src/main/assets/fake_total_yello.json
@@ -6,7 +6,7 @@
"yello": [
{
"id": 1,
- "gender": "M",
+ "gender": "MALE",
"nameHint": -1,
"senderName": "권세훈",
"vote": {
@@ -22,7 +22,7 @@
},
{
"id": 1,
- "gender": "W",
+ "gender": "FEMALE",
"nameHint": -1,
"senderName": "권세훈",
"vote": {
@@ -38,7 +38,7 @@
},
{
"id": 1,
- "gender": "M",
+ "gender": "MALE",
"nameHint": -1,
"senderName": "권세훈",
"vote": {
@@ -54,7 +54,7 @@
},
{
"id": 1,
- "gender": "M",
+ "gender": "MALE",
"nameHint": -1,
"senderName": "권세훈",
"vote": {
@@ -70,7 +70,7 @@
},
{
"id": 1,
- "gender": "W",
+ "gender": "FEMALE",
"nameHint": 1,
"senderName": "권세훈",
"vote": {
@@ -86,7 +86,7 @@
},
{
"id": 1,
- "gender": "M",
+ "gender": "MALE",
"nameHint": 0,
"senderName": "권세훈",
"vote": {
@@ -102,7 +102,7 @@
},
{
"id": 1,
- "gender": "M",
+ "gender": "MALE",
"nameHint": 0,
"senderName": "권세훈",
"vote": {
@@ -118,7 +118,7 @@
},
{
"id": 1,
- "gender": "M",
+ "gender": "MALE",
"nameHint": 0,
"senderName": "권세훈",
"vote": {
diff --git a/data/src/main/java/com/example/data/model/response/yello/ResponseMyYello.kt b/data/src/main/java/com/example/data/model/response/yello/ResponseMyYello.kt
index a8a3ec205..010bebe58 100644
--- a/data/src/main/java/com/example/data/model/response/yello/ResponseMyYello.kt
+++ b/data/src/main/java/com/example/data/model/response/yello/ResponseMyYello.kt
@@ -9,17 +9,17 @@ import kotlinx.serialization.Serializable
@Serializable
data class ResponseMyYello(
val totalCount: Int,
- val yello: List
+ val votes: List
) {
fun toTotalYello(): MyYello {
- return MyYello(totalCount, yello.map { it.toYello() })
+ return MyYello(totalCount, votes.map { it.toYello() })
}
}
@Serializable
data class YelloDto(
- val id: Int,
- val gender: String,
+ val id: Long,
+ val senderGender: String,
val nameHint: Int,
val senderName: String,
val vote: VoteDto,
@@ -28,8 +28,17 @@ data class YelloDto(
val createdAt: String
) {
fun toYello(): Yello {
- val genderEnum = if (gender.contains("M")) GenderEnum.M else GenderEnum.W
- return Yello(id, genderEnum, nameHint, senderName, vote.toVote(), isHintUsed, isRead, createdAt)
+ val genderEnum = if (senderGender.contains("MALE")) GenderEnum.M else GenderEnum.W
+ return Yello(
+ id,
+ genderEnum,
+ nameHint,
+ senderName,
+ vote.toVote(),
+ isHintUsed,
+ isRead,
+ createdAt
+ )
}
}
diff --git a/data/src/main/java/com/example/data/model/response/yello/ResponseYelloDetail.kt b/data/src/main/java/com/example/data/model/response/yello/ResponseYelloDetail.kt
index 4dc610fbd..7769ae9a8 100644
--- a/data/src/main/java/com/example/data/model/response/yello/ResponseYelloDetail.kt
+++ b/data/src/main/java/com/example/data/model/response/yello/ResponseYelloDetail.kt
@@ -1,28 +1,27 @@
package com.example.data.model.response.yello
import com.example.domain.entity.YelloDetail
-import com.example.domain.entity.YelloDetailVote
import kotlinx.serialization.Serializable
@Serializable
data class ResponseYelloDetail(
+ val currentPoint: Int,
+ val colorIndex: Int,
val nameHint: Int,
val isAnswerRevealed: Boolean,
+ val senderGender: String,
val senderName: String,
- val vote: YelloDetailVoteDto
+ val vote: VoteDto
) {
fun toYelloDetail(): YelloDetail {
- return YelloDetail(nameHint, isAnswerRevealed, senderName, vote.toYelloDetailVote())
- }
-}
-
-@Serializable
-data class YelloDetailVoteDto(
- val head: String,
- val answer: String,
- val foot: String
-) {
- fun toYelloDetailVote(): YelloDetailVote {
- return YelloDetailVote(head, answer, foot)
+ return YelloDetail(
+ currentPoint,
+ colorIndex,
+ nameHint,
+ isAnswerRevealed,
+ senderGender,
+ senderName,
+ vote.toVote()
+ )
}
}
\ No newline at end of file
diff --git a/data/src/main/java/com/example/data/remote/service/YelloService.kt b/data/src/main/java/com/example/data/remote/service/YelloService.kt
index ed7532135..fe1ec79d7 100644
--- a/data/src/main/java/com/example/data/remote/service/YelloService.kt
+++ b/data/src/main/java/com/example/data/remote/service/YelloService.kt
@@ -11,12 +11,12 @@ import retrofit2.http.Path
import retrofit2.http.Query
interface YelloService {
- @GET("/api/v1/yello")
+ @GET("api/v1/vote")
suspend fun getMyYelloList(
@Query("page") page: Int
): BaseResponse
- @GET("/api/v1/yello/{id}/name")
+ @GET("api/v1/vote/{id}")
suspend fun getYelloDetail(
@Path("id") id: Long
): BaseResponse
diff --git a/data/src/main/java/com/example/data/repository/YelloRepositoryImpl.kt b/data/src/main/java/com/example/data/repository/YelloRepositoryImpl.kt
index daf0e31c2..eac9d8e59 100644
--- a/data/src/main/java/com/example/data/repository/YelloRepositoryImpl.kt
+++ b/data/src/main/java/com/example/data/repository/YelloRepositoryImpl.kt
@@ -12,7 +12,7 @@ class YelloRepositoryImpl @Inject constructor(
private val dataSource: YelloDataSource
) : YelloRepository {
override suspend fun getMyYelloList(page: Int): Result {
- return kotlin.runCatching { dataSource.getMyYelloList(page).data.toTotalYello() }
+ return runCatching { dataSource.getMyYelloList(page).data.toTotalYello() }
}
override suspend fun getYelloDetail(id: Long): Result {
diff --git a/domain/src/main/java/com/example/domain/entity/MyYello.kt b/domain/src/main/java/com/example/domain/entity/MyYello.kt
index f64d65886..cf6887d9c 100644
--- a/domain/src/main/java/com/example/domain/entity/MyYello.kt
+++ b/domain/src/main/java/com/example/domain/entity/MyYello.kt
@@ -8,7 +8,7 @@ data class MyYello(
)
data class Yello(
- val id: Int,
+ val id: Long,
val gender: GenderEnum,
val nameHint: Int,
val senderName: String,
diff --git a/domain/src/main/java/com/example/domain/entity/YelloDetail.kt b/domain/src/main/java/com/example/domain/entity/YelloDetail.kt
index ff04dcb3c..dec419525 100644
--- a/domain/src/main/java/com/example/domain/entity/YelloDetail.kt
+++ b/domain/src/main/java/com/example/domain/entity/YelloDetail.kt
@@ -1,14 +1,11 @@
package com.example.domain.entity
data class YelloDetail(
+ val currentPoint: Int,
+ val colorIndex: Int,
val nameHint: Int,
val isAnswerRevealed: Boolean,
+ val senderGender: String,
val senderName: String,
- val vote: YelloDetailVote
-)
-
-data class YelloDetailVote(
- val head: String,
- val answer: String,
- val foot: String
-)
+ val vote: Vote
+)
\ No newline at end of file
diff --git a/domain/src/main/java/com/example/domain/enum/PointEnum.kt b/domain/src/main/java/com/example/domain/enum/PointEnum.kt
new file mode 100644
index 000000000..09c803d50
--- /dev/null
+++ b/domain/src/main/java/com/example/domain/enum/PointEnum.kt
@@ -0,0 +1,5 @@
+package com.example.domain.enum
+
+enum class PointEnum {
+ INITIAL, KEYWORD
+}
\ No newline at end of file