From 4a247b494f9b81ff3e1bfb508a4ec092d657a52c Mon Sep 17 00:00:00 2001 From: blueme0 Date: Fri, 16 Feb 2024 00:50:00 +0900 Subject: [PATCH 1/6] =?UTF-8?q?[fix/#160]=20=ED=9A=8C=EC=9B=90=EA=B0=80?= =?UTF-8?q?=EC=9E=85=20=EC=9D=B4=EB=A6=84=20=EC=9E=85=EB=A0=A5=20=EC=BA=A1?= =?UTF-8?q?=EC=85=98=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../teumteum/presentation/signup/name/GetNameFragment.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/teumteum/teumteum/presentation/signup/name/GetNameFragment.kt b/app/src/main/java/com/teumteum/teumteum/presentation/signup/name/GetNameFragment.kt index 5fb7c245..c69f08be 100644 --- a/app/src/main/java/com/teumteum/teumteum/presentation/signup/name/GetNameFragment.kt +++ b/app/src/main/java/com/teumteum/teumteum/presentation/signup/name/GetNameFragment.kt @@ -62,7 +62,8 @@ class GetNameFragment } else { (activity as SignUpActivity).disableNextButton() - binding.tvCaption.visibility = View.VISIBLE + if (userName.isNotBlank()) binding.tvCaption.visibility = View.VISIBLE + else binding.tvCaption.visibility = View.INVISIBLE } } } From 62544bd32c291127e3ae08267667f4b5c33c4fec Mon Sep 17 00:00:00 2001 From: blueme0 Date: Fri, 16 Feb 2024 00:56:34 +0900 Subject: [PATCH 2/6] =?UTF-8?q?[fix/#160]=20=EC=B9=B4=EB=93=9C=20=ED=9B=84?= =?UTF-8?q?=EB=A9=B4=20GOAL=20=ED=85=8D=EC=8A=A4=ED=8A=B8=20=EC=83=89?= =?UTF-8?q?=EC=83=81=20=EB=B0=98=EC=98=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../signup/complete/CardCompleteFragment.kt | 6 ++++-- .../presentation/signup/fix/CardFixFragment.kt | 8 +++++--- .../com/teumteum/teumteum/util/ResMapper.kt | 17 +++++++++++++++++ .../teumteum/util/custom/view/BackCardView.kt | 6 +++++- 4 files changed, 31 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/com/teumteum/teumteum/presentation/signup/complete/CardCompleteFragment.kt b/app/src/main/java/com/teumteum/teumteum/presentation/signup/complete/CardCompleteFragment.kt index 9d853b57..3e1d0451 100644 --- a/app/src/main/java/com/teumteum/teumteum/presentation/signup/complete/CardCompleteFragment.kt +++ b/app/src/main/java/com/teumteum/teumteum/presentation/signup/complete/CardCompleteFragment.kt @@ -16,6 +16,7 @@ import com.teumteum.teumteum.util.SignupUtils.CHARACTER_CARD_LIST_BACK import com.teumteum.teumteum.util.SignupUtils.STATUS_STUDENT import com.teumteum.teumteum.util.SignupUtils.STATUS_TRAINEE import com.teumteum.teumteum.util.SignupUtils.STATUS_WORKER +import com.teumteum.teumteum.util.custom.view.model.BackCard import com.teumteum.teumteum.util.custom.view.model.FrontCard import com.teumteum.teumteum.util.custom.view.model.Interest import dagger.hilt.android.AndroidEntryPoint @@ -60,9 +61,10 @@ class CardCompleteFragment for (i in interestSelf.value) { interests.add(Interest(i)) } + + val bc = BackCard(goalContent = goalText.value, characterResId = CHARACTER_CARD_LIST_BACK[characterId.value]) + binding.cardviewBack.getInstance(bc) binding.cardviewBack.apply { - tvGoalContent.text = goalText.value - CHARACTER_CARD_LIST_BACK[characterId.value]?.let { ivCharacter.setImageResource(it) } submitInterestList(interests) isModify = false setIsModifyDetail(false) diff --git a/app/src/main/java/com/teumteum/teumteum/presentation/signup/fix/CardFixFragment.kt b/app/src/main/java/com/teumteum/teumteum/presentation/signup/fix/CardFixFragment.kt index 404b615a..4a63108b 100644 --- a/app/src/main/java/com/teumteum/teumteum/presentation/signup/fix/CardFixFragment.kt +++ b/app/src/main/java/com/teumteum/teumteum/presentation/signup/fix/CardFixFragment.kt @@ -73,11 +73,13 @@ class CardFixFragment for (i in interestSelf.value) { interests.add(Interest(i)) } + + val bc = BackCard(goalContent = goalText.value, characterResId = SignupUtils.CHARACTER_CARD_LIST_BACK[characterId.value]) + binding.cardviewBack.getInstance(bc) binding.cardviewBack.apply { - setIsModifyDetail(true) - tvGoalContent.text = goalText.value - SignupUtils.CHARACTER_CARD_LIST_BACK[characterId.value]?.let { ivCharacter.setImageResource(it) } submitInterestList(interests) + isModify = false + setIsModifyDetail(true) } } } diff --git a/app/src/main/java/com/teumteum/teumteum/util/ResMapper.kt b/app/src/main/java/com/teumteum/teumteum/util/ResMapper.kt index 2f6269dc..0e2f2f38 100644 --- a/app/src/main/java/com/teumteum/teumteum/util/ResMapper.kt +++ b/app/src/main/java/com/teumteum/teumteum/util/ResMapper.kt @@ -60,6 +60,23 @@ object ResMapper { } } + fun getColorByBackCardCharacterDrawble(context: Context, characterResId: Int): Int { + return when (characterResId) { + R.drawable.ic_card_back_ghost -> getColorByCharacterId(context, 0) + R.drawable.ic_card_back_star -> getColorByCharacterId(context, 1) + R.drawable.ic_card_back_bear -> getColorByCharacterId(context, 2) + R.drawable.ic_card_back_raccon -> getColorByCharacterId(context, 3) + R.drawable.ic_card_back_cat -> getColorByCharacterId(context, 4) + R.drawable.ic_card_back_rabbit -> getColorByCharacterId(context, 5) + R.drawable.ic_card_back_fox -> getColorByCharacterId(context, 6) + R.drawable.ic_card_back_water -> getColorByCharacterId(context, 7) + R.drawable.ic_card_back_penguin -> getColorByCharacterId(context, 8) + R.drawable.ic_card_back_dog -> getColorByCharacterId(context, 9) + R.drawable.ic_card_back_mouse -> getColorByCharacterId(context, 10) + R.drawable.ic_card_back_panda -> getColorByCharacterId(context, 11) + else -> getColorByCharacterId(context, 0) + } + } fun getColorByCharacterId(context: Context, characterId: Int): Int { return when (characterId) { diff --git a/app/src/main/java/com/teumteum/teumteum/util/custom/view/BackCardView.kt b/app/src/main/java/com/teumteum/teumteum/util/custom/view/BackCardView.kt index 904d2dd9..fe772838 100644 --- a/app/src/main/java/com/teumteum/teumteum/util/custom/view/BackCardView.kt +++ b/app/src/main/java/com/teumteum/teumteum/util/custom/view/BackCardView.kt @@ -19,6 +19,7 @@ import com.google.android.flexbox.FlexWrap import com.google.android.flexbox.FlexboxLayoutManager import com.google.android.flexbox.JustifyContent import com.teumteum.teumteum.R +import com.teumteum.teumteum.util.ResMapper import com.teumteum.teumteum.util.callback.OnCurrentListChangedListener import com.teumteum.teumteum.util.custom.itemdecoration.FlexboxItemDecoration import com.teumteum.teumteum.util.custom.view.adapter.InterestAdapter @@ -163,7 +164,10 @@ class BackCardView : CardView, OnCurrentListChangedListener { private fun setUpViews() { tvGoalTitle.text = backCard.goalTitle tvGoalContent.text = backCard.goalContent - backCard.characterResId?.let { ivCharacter.setImageResource(it) } + backCard.characterResId?.let { + ivCharacter.setImageResource(it) + tvGoalTitle.setTextColor(ResMapper.getColorByBackCardCharacterDrawble(context, it)) + } ivFloat.setImageResource(backCard.floatResId) } From 8f9ea000d61eabb528caa9fac8d151156fd0f8a4 Mon Sep 17 00:00:00 2001 From: blueme0 Date: Fri, 16 Feb 2024 08:47:34 +0900 Subject: [PATCH 3/6] =?UTF-8?q?[fix/#160]=20=EC=9C=A0=EC=A0=80=20=EB=A6=AC?= =?UTF-8?q?=EB=B7=B0=20response=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../teumteum/data/datasource/remote/RemoteGroupDataSource.kt | 4 ++-- .../java/com/teumteum/data/repository/GroupRepositoryImpl.kt | 2 +- .../src/main/java/com/teumteum/data/service/GroupService.kt | 5 ++--- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/core/data/src/main/java/com/teumteum/data/datasource/remote/RemoteGroupDataSource.kt b/core/data/src/main/java/com/teumteum/data/datasource/remote/RemoteGroupDataSource.kt index 62055bb5..35ee5335 100644 --- a/core/data/src/main/java/com/teumteum/data/datasource/remote/RemoteGroupDataSource.kt +++ b/core/data/src/main/java/com/teumteum/data/datasource/remote/RemoteGroupDataSource.kt @@ -3,7 +3,7 @@ package com.teumteum.data.datasource.remote import com.teumteum.data.model.request.RequestReviewFriend import com.teumteum.data.model.response.ResponseGroup import com.teumteum.data.model.response.ResponseMeeting -import com.teumteum.data.model.response.ResponseReviewFriends +import com.teumteum.data.model.response.ResponseReviewFriend import com.teumteum.data.service.GroupService import okhttp3.MultipartBody import okhttp3.RequestBody @@ -85,7 +85,7 @@ class RemoteGroupDataSource @Inject constructor( suspend fun getReviewFriendList( meetingId: Long - ): ResponseReviewFriends { + ): List { return service.getReviewFriendList(meetingId) } diff --git a/core/data/src/main/java/com/teumteum/data/repository/GroupRepositoryImpl.kt b/core/data/src/main/java/com/teumteum/data/repository/GroupRepositoryImpl.kt index bdf6d783..f4bd591e 100644 --- a/core/data/src/main/java/com/teumteum/data/repository/GroupRepositoryImpl.kt +++ b/core/data/src/main/java/com/teumteum/data/repository/GroupRepositoryImpl.kt @@ -98,7 +98,7 @@ class GroupRepositoryImpl @Inject constructor( override suspend fun getReviewFriendList(meetingId: Long): Result> { return runCatching { - dataSource.getReviewFriendList(meetingId).participants.map { it.toReviewFriend() } + dataSource.getReviewFriendList(meetingId).map { it.toReviewFriend() } } } diff --git a/core/data/src/main/java/com/teumteum/data/service/GroupService.kt b/core/data/src/main/java/com/teumteum/data/service/GroupService.kt index a5f91bc5..1a12f892 100644 --- a/core/data/src/main/java/com/teumteum/data/service/GroupService.kt +++ b/core/data/src/main/java/com/teumteum/data/service/GroupService.kt @@ -3,8 +3,7 @@ package com.teumteum.data.service import com.teumteum.data.model.request.RequestReviewFriend import com.teumteum.data.model.response.ResponseGroup import com.teumteum.data.model.response.ResponseMeeting -import com.teumteum.data.model.response.ResponseReviewFriends -import com.teumteum.domain.entity.Meeting +import com.teumteum.data.model.response.ResponseReviewFriend import okhttp3.MultipartBody import okhttp3.RequestBody import retrofit2.Response @@ -85,7 +84,7 @@ interface GroupService { @GET("meetings/{meetingId}/participants") suspend fun getReviewFriendList( @Path("meetingId") meetingId: Long - ): ResponseReviewFriends + ): List @POST("users/reviews") suspend fun postRegisterReview( From dbef3f7bf6b0b3d6eb206d6e06a9031e01cf3a7b Mon Sep 17 00:00:00 2001 From: blueme0 Date: Fri, 16 Feb 2024 08:48:02 +0900 Subject: [PATCH 4/6] =?UTF-8?q?[fix/#160]=20=EC=9C=A0=EC=A0=80=20=EB=A6=AC?= =?UTF-8?q?=EB=B7=B0=20=EC=82=AC=EC=9A=A9=EC=9E=90=20=EB=B3=B8=EC=9D=B8?= =?UTF-8?q?=EC=97=90=20=EB=8C=80=ED=95=9C=20=EC=98=88=EC=99=B8=20=EC=BC=80?= =?UTF-8?q?=EC=9D=B4=EC=8A=A4=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../teumteum/config/TeumMessagingService.kt | 5 ++++- .../presentation/group/review/ReviewViewModel.kt | 16 +++++++++++++--- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/com/teumteum/teumteum/config/TeumMessagingService.kt b/app/src/main/java/com/teumteum/teumteum/config/TeumMessagingService.kt index e32ea452..100c3f78 100644 --- a/app/src/main/java/com/teumteum/teumteum/config/TeumMessagingService.kt +++ b/app/src/main/java/com/teumteum/teumteum/config/TeumMessagingService.kt @@ -67,9 +67,12 @@ class TeumMessagingService : FirebaseMessagingService() { } if (alertMessage.type == END_MEETING) { alertMessage.meetingId = message.data["meetingId"]?.toLong() +// Timber.tag("teum-alerts").d("data: ${message.data}") +// Timber.tag("teum-alerts").d("participants string: ${message.data["participants"]?.split(",").toString()}") +// Timber.tag("teum-alerts").d("participants size: ${message.data["participants"]?.split(",")?.size}") alertMessage.participants = message.data["participants"]?.split(",")?.map { it.toInt() } val userId = userRepository.getUserInfo()?.id?.toInt() - if (alertMessage.participants?.contains(userId) == true) + if (alertMessage.participants?.contains(userId) == true && alertMessage.participants?.size!! > 1) sendNotificationAlarm(alertMessage) } else if (alertMessage.title.isNotEmpty()) sendNotificationAlarm(alertMessage) diff --git a/app/src/main/java/com/teumteum/teumteum/presentation/group/review/ReviewViewModel.kt b/app/src/main/java/com/teumteum/teumteum/presentation/group/review/ReviewViewModel.kt index edd1ca6d..c5f86bd0 100644 --- a/app/src/main/java/com/teumteum/teumteum/presentation/group/review/ReviewViewModel.kt +++ b/app/src/main/java/com/teumteum/teumteum/presentation/group/review/ReviewViewModel.kt @@ -4,15 +4,18 @@ import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope import com.teumteum.domain.entity.ReviewFriend import com.teumteum.domain.repository.GroupRepository +import com.teumteum.domain.repository.UserRepository import dagger.hilt.android.lifecycle.HiltViewModel import javax.inject.Inject import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.StateFlow import kotlinx.coroutines.launch +import timber.log.Timber @HiltViewModel class ReviewViewModel @Inject constructor( - private val repository: GroupRepository + private val repository: GroupRepository, + private val userRepository: UserRepository ) : ViewModel() { private var _selectFriendList = listOf() val selectFriendList get() = _selectFriendList @@ -37,12 +40,19 @@ class ReviewViewModel @Inject constructor( _selectDetailFriendList.add(selectFriendDetail) } + private fun filterReviewFriendList(list: List): List { + val friendList = list.toMutableList() + val myUserId = userRepository.getUserInfo()?.id + friendList.removeAll { it.id == myUserId } + return friendList + } + fun getReviewFriendList() { meetingId?.let { id -> viewModelScope.launch { repository.getReviewFriendList(id) - .onSuccess { - _moimFriendList.value = it + .onSuccess { list -> + _moimFriendList.value = filterReviewFriendList(list) } } } From 05601bf56ae8520f1c3c897215260391e45cc361 Mon Sep 17 00:00:00 2001 From: blueme0 Date: Fri, 16 Feb 2024 08:49:05 +0900 Subject: [PATCH 5/6] =?UTF-8?q?[fix/#160]=20ReviewViewModel=20=EC=BD=94?= =?UTF-8?q?=EB=93=9C=20=EC=88=98=EC=A0=95=20=EB=B0=8F=20=EB=A6=AC=EB=B7=B0?= =?UTF-8?q?=20=ED=95=9C=20=EB=AA=85=EC=9D=BC=20=EB=95=8C=EB=8F=84=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../presentation/group/review/ReviewFriendDetailFragment.kt | 2 +- .../teumteum/presentation/group/review/ReviewViewModel.kt | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/com/teumteum/teumteum/presentation/group/review/ReviewFriendDetailFragment.kt b/app/src/main/java/com/teumteum/teumteum/presentation/group/review/ReviewFriendDetailFragment.kt index 5168e37a..1154e1c8 100644 --- a/app/src/main/java/com/teumteum/teumteum/presentation/group/review/ReviewFriendDetailFragment.kt +++ b/app/src/main/java/com/teumteum/teumteum/presentation/group/review/ReviewFriendDetailFragment.kt @@ -48,8 +48,8 @@ class ReviewFriendDetailFragment : private fun initClick() { val friendDetail = ReviewFriend(id, characterId, name, job) binding.btnReview.setOnSingleClickListener { + viewModel.addSelectDetailFriendList(friendDetail) if (viewModel.currentFriendIndex < viewModel.selectFriendList.size) { - viewModel.addSelectDetailFriendList(friendDetail) (requireActivity() as? ReviewActivity)?.nextFriendDetailFragment() } else { viewModel.postRegisterReview() diff --git a/app/src/main/java/com/teumteum/teumteum/presentation/group/review/ReviewViewModel.kt b/app/src/main/java/com/teumteum/teumteum/presentation/group/review/ReviewViewModel.kt index c5f86bd0..fc5f4ca2 100644 --- a/app/src/main/java/com/teumteum/teumteum/presentation/group/review/ReviewViewModel.kt +++ b/app/src/main/java/com/teumteum/teumteum/presentation/group/review/ReviewViewModel.kt @@ -10,7 +10,6 @@ import javax.inject.Inject import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.StateFlow import kotlinx.coroutines.launch -import timber.log.Timber @HiltViewModel class ReviewViewModel @Inject constructor( @@ -21,7 +20,7 @@ class ReviewViewModel @Inject constructor( val selectFriendList get() = _selectFriendList private var _selectDetailFriendList = mutableListOf() - val selectDetailFriendList get() = _selectFriendList + val selectDetailFriendList get() = _selectDetailFriendList var meetingId: Long? = null From b9d5763bcab4f4cb7a3b15012d998af4a5000cc7 Mon Sep 17 00:00:00 2001 From: blueme0 Date: Fri, 16 Feb 2024 09:13:41 +0900 Subject: [PATCH 6/6] =?UTF-8?q?[fix/#160]=20=EC=9E=84=EC=8B=9C=20=EC=A1=B0?= =?UTF-8?q?=EC=B9=98=20:=20=EB=AA=A8=EC=9E=84=20=EC=B0=B8=EC=97=AC?= =?UTF-8?q?=EC=9E=90=203=EB=AA=85=20=EC=9D=B4=EC=83=81=EC=9D=B8=20?= =?UTF-8?q?=EA=B2=BD=EC=9A=B0=EC=97=90=EB=A7=8C=20=EB=A6=AC=EB=B7=B0=20?= =?UTF-8?q?=EC=95=8C=EB=A6=BC=20=EC=A0=84=EC=86=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/teumteum/teumteum/config/TeumMessagingService.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/com/teumteum/teumteum/config/TeumMessagingService.kt b/app/src/main/java/com/teumteum/teumteum/config/TeumMessagingService.kt index 100c3f78..beb3413c 100644 --- a/app/src/main/java/com/teumteum/teumteum/config/TeumMessagingService.kt +++ b/app/src/main/java/com/teumteum/teumteum/config/TeumMessagingService.kt @@ -72,7 +72,7 @@ class TeumMessagingService : FirebaseMessagingService() { // Timber.tag("teum-alerts").d("participants size: ${message.data["participants"]?.split(",")?.size}") alertMessage.participants = message.data["participants"]?.split(",")?.map { it.toInt() } val userId = userRepository.getUserInfo()?.id?.toInt() - if (alertMessage.participants?.contains(userId) == true && alertMessage.participants?.size!! > 1) + if (alertMessage.participants?.contains(userId) == true && alertMessage.participants?.size!! > 2) sendNotificationAlarm(alertMessage) } else if (alertMessage.title.isNotEmpty()) sendNotificationAlarm(alertMessage)