Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX/#431] Timeline / 내쪽지 필터 Empty시 투표 뷰로 이동 구현 #432

Merged
merged 4 commits into from
Mar 22, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,13 @@ class MainActivity : BindingActivity<ActivityMainBinding>(R.layout.activity_main
}
}

fun navigateToVote() {
supportFragmentManager.commit {
replace<YelloFragment>(R.id.fcv_main)
}
initBnvItemIconTintList()
}

private fun setupGetUserSubsState() {
userSubsStateJob = viewModel.getUserSubsState.flowWithLifecycle(lifecycle).onEach { state ->
when (state) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,7 @@ class NoticeDialog :
}

private fun initCloseBtnClickListener() {
binding.tvNoticeClose.setOnSingleClickListener {
if (viewModel.isNoticeDisabled.value) {
AmplitudeManager.trackEventWithProperties(EVENT_CLICK_POP_UP_NO)
}
dismiss()
}
binding.tvNoticeClose.setOnSingleClickListener { dismiss() }
}

override fun onDestroyView() {
Expand All @@ -108,7 +103,6 @@ class NoticeDialog :
private const val ARGS_IMAGE_URL = "IMAGE_URL"
private const val ARGS_REDIRECT_URL = "REDIRECT_URL"
private const val EVENT_CLICK_POP_UP = "click_notice_popup"
private const val EVENT_CLICK_POP_UP_NO = "click_notice_popup_no"

@JvmStatic
fun newInstance(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.el.yello.presentation.main.dialog.notice

import androidx.lifecycle.ViewModel
import com.el.yello.util.manager.AmplitudeManager
import com.example.domain.repository.NoticeRepository
import dagger.hilt.android.lifecycle.HiltViewModel
import kotlinx.coroutines.flow.MutableStateFlow
Expand All @@ -19,6 +20,13 @@ class NoticeViewModel @Inject constructor(
}

fun setDisabledNotice(url: String) {
if (isNoticeDisabled.value) noticeRepository.setDisabledNoticeUrl(url)
if (isNoticeDisabled.value) {
noticeRepository.setDisabledNoticeUrl(url)
AmplitudeManager.trackEventWithProperties(EVENT_CLICK_POP_UP_NO)
}
}

companion object {
private const val EVENT_CLICK_POP_UP_NO = "click_notice_popup_no"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import androidx.paging.LoadState
import androidx.recyclerview.widget.RecyclerView
import com.el.yello.R
import com.el.yello.databinding.FragmentTimelineBinding
import com.el.yello.presentation.main.MainActivity
import com.el.yello.presentation.main.dialog.invite.InviteFriendDialog
import com.el.yello.util.extension.BaseLinearRcvItemDeco
import com.el.yello.util.extension.setPullToScrollColor
Expand Down Expand Up @@ -73,13 +74,17 @@ class TimelineFragment : BindingFragment<FragmentTimelineBinding>(R.layout.fragm

private fun initInviteBtnListener() {
binding.btnLookNoFriend.setOnSingleClickListener {
inviteFriendDialog =
InviteFriendDialog.newInstance(viewModel.getYelloId(), TIMELINE_NO_FRIEND)
AmplitudeManager.trackEventWithProperties(
EVENT_CLICK_INVITE,
JSONObject().put(NAME_INVITE_VIEW, TIMELINE_NO_FRIEND),
)
inviteFriendDialog?.show(parentFragmentManager, INVITE_DIALOG)
if (isFilterSelected) {
(requireActivity() as MainActivity).navigateToVote()
} else {
inviteFriendDialog =
InviteFriendDialog.newInstance(viewModel.getYelloId(), TIMELINE_NO_FRIEND)
AmplitudeManager.trackEventWithProperties(
"click_invite",
JSONObject().put("invite_view", TIMELINE_NO_FRIEND),
)
inviteFriendDialog?.show(parentFragmentManager, INVITE_DIALOG)
}
}
}

Expand All @@ -89,25 +94,28 @@ class TimelineFragment : BindingFragment<FragmentTimelineBinding>(R.layout.fragm
adapter.refresh()
viewModel.setFirstLoading(true)
observeTimelinePagingList(isFilterSelected)
with(binding) {
if (isFilterSelected) {
AmplitudeManager.trackEventWithProperties(EVENT_VIEW_TIMELINE_MY_MESSAGE)
tvLookFilterType.text = TYPE_MINE
tvLookNoFriendTitle.text = stringOf(R.string.look_invite_no_title_mine)
} else {
AmplitudeManager.trackEventWithProperties(EVENT_VIEW_TIMELINE)
tvLookFilterType.text = TYPE_ALL
tvLookNoFriendTitle.text = stringOf(R.string.look_invite_no_title)
}
}
setEmptyViewByFilter(isFilterSelected)
}
}

private fun initFromPushNotification() {
isFilterSelected = arguments?.getBoolean(IS_FILTER_SELECTED, false) ?: false
if (isFilterSelected) {
binding.tvLookFilterType.text = TYPE_MINE
binding.tvLookNoFriendTitle.text = stringOf(R.string.look_invite_no_title_mine)
setEmptyViewByFilter(isFilterSelected)
}

private fun setEmptyViewByFilter(isFilterSelected: Boolean) {
with(binding) {
if (isFilterSelected) {
AmplitudeManager.trackEventWithProperties(EVENT_VIEW_TIMELINE_MY_MESSAGE)
tvLookFilterType.text = TYPE_MINE
tvLookNoFriendTitle.text = stringOf(R.string.look_invite_no_title_mine)
btnLookNoFriend.text = stringOf(R.string.look_btn_vote)
} else {
AmplitudeManager.trackEventWithProperties(EVENT_VIEW_TIMELINE)
tvLookFilterType.text = TYPE_ALL
tvLookNoFriendTitle.text = stringOf(R.string.look_invite_no_title)
btnLookNoFriend.text = stringOf(R.string.look_btn_invite)
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/fragment_timeline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@
android:gravity="center"
android:paddingHorizontal="30dp"
android:paddingVertical="17dp"
android:text="@string/recommend_invite_no_subtitle"
android:text="@string/look_btn_invite"
android:textAppearance="?textAppearanceButton"
android:textColor="@color/yello_main_500"
android:textSize="15sp"
Expand Down
4 changes: 3 additions & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,9 @@

<string name="look_title">타임라인</string>
<string name="look_invite_no_title">친구들이 받은 쪽지가 궁금하다면\n친구를 초대해볼까요?</string>
<string name="look_invite_no_title_mine">쪽지를 보낼 친구가 없다면\n친구를 초대하세요!</string>
<string name="look_invite_no_title_mine">전하고 싶은 말이 있는 친구에게\n쪽지를 보내 보세요!</string>
<string name="look_btn_invite">친구 초대하고 리워드 받기</string>
<string name="look_btn_vote">지금 바로 쪽지 보내기</string>
<string name="look_tv_info">쪽지를 보낸 사람의 이름은 공개되지 않아요.</string>
<string name="look_tv_filter_basic">모든 쪽지</string>

Expand Down
4 changes: 2 additions & 2 deletions build-logic/convention/src/main/kotlin/Constants.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ object Constants {
const val compileSdk = 33
const val minSdk = 28
const val targetSdk = 33
const val versionCode = 43
const val versionName = "2.0"
const val versionCode = 44
const val versionName = "2.1"
const val jvmVersion = "17"
}
Loading