Skip to content

Commit

Permalink
Merge pull request #251 from Team-HMH/feat/qa_0824_yuri
Browse files Browse the repository at this point in the history
Feat/qa 0824 yuri
  • Loading branch information
kangyuri1114 authored Sep 19, 2024
2 parents fbe4cb9 + 7d08f3c commit 1400575
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import androidx.lifecycle.flowWithLifecycle
import androidx.lifecycle.lifecycleScope
import androidx.recyclerview.widget.LinearLayoutManager
import com.hmh.hamyeonham.common.amplitude.AmplitudeUtils
import com.hmh.hamyeonham.common.context.toast
import com.hmh.hamyeonham.common.view.viewBinding
import com.hmh.hamyeonham.feature.challenge.databinding.ActivityPointBinding
import dagger.hilt.android.AndroidEntryPoint
Expand All @@ -29,6 +30,7 @@ class PointActivity : AppCompatActivity() {
initViews()
collectPointInfo()
collectUserPoint()
collectPointSuccessState()
}

private fun initViews() {
Expand Down Expand Up @@ -66,4 +68,12 @@ class PointActivity : AppCompatActivity() {
setResult(RESULT_OK, intent.putExtra("point", it))
}.launchIn(lifecycleScope)
}

private fun collectPointSuccessState() {
viewModel.getPointSuccess.flowWithLifecycle(lifecycle).onEach {
if(it) {
toast("포인트를 획득했어요!")
}
}.launchIn(lifecycleScope)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ class PointViewModel @Inject constructor(
private val _pointInfoList = MutableStateFlow(emptyList<PointInfo.ChallengePointStatus>())
val pointInfoList = _pointInfoList.asStateFlow()

private val _getPointSuccess = MutableStateFlow(false)
val getPointSuccess = _getPointSuccess.asStateFlow()


init {
getPointInfoList()
}
Expand All @@ -32,6 +36,7 @@ class PointViewModel @Inject constructor(
val properties = JSONObject().put("get_point_date", challengeDate)
AmplitudeUtils.trackEventWithProperties("click_getpoint_button", properties)
getPointInfoList()
_getPointSuccess.value = true
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,14 @@ class UsageStaticsTotalViewHolder(
private fun bindBlackHoleInfo(totalModel: HomeItem.TotalModel) {
val blackHoleInfo =
when {
// 권한이 허용되어 있는 경우
// 챌린지 성공한 경우
totalModel.challengeSuccess -> {
BlackHoleInfo.createByPercentage(totalModel.totalPercentage)
?: BlackHoleInfo.LEVEL0
}
// 권한이 허용되지 않은 경우 default 값
// 챌린지 실패한 경우
else -> {
BlackHoleInfo.LEVEL_NONE
BlackHoleInfo.LEVEL5
}
}

Expand All @@ -78,7 +78,6 @@ enum class BlackHoleInfo(
val lottieFile: Int,
val description: Int,
) {
LEVEL_NONE(999, R.raw.lottie_blackhole0, R.string.blackhole_none),
LEVEL0(0, R.raw.lottie_blackhole0, R.string.blackhole0),
LEVEL1(25, R.raw.lottie_blackhole1, R.string.blackhole1),
LEVEL2(50, R.raw.lottie_blackhole2, R.string.blackhole2),
Expand Down

0 comments on commit 1400575

Please sign in to comment.