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

[FEAT/#443] Profile / 탈퇴 방지 팝업 추가 #444

Merged
merged 5 commits into from
Jun 7, 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 @@ -15,6 +15,7 @@ import com.el.yello.R
import com.el.yello.databinding.ActivityMainBinding
import com.el.yello.presentation.event.EventActivity
import com.el.yello.presentation.main.MainViewModel.Companion.CODE_UNAVAILABLE_EVENT
import com.el.yello.presentation.main.dialog.invite.InviteFriendDialog
import com.el.yello.presentation.main.dialog.notice.NoticeDialog
import com.el.yello.presentation.main.myyello.MyYelloFragment
import com.el.yello.presentation.main.myyello.read.MyYelloReadActivity
Expand Down Expand Up @@ -52,6 +53,7 @@ class MainActivity : BindingActivity<ActivityMainBinding>(R.layout.activity_main

private var backPressedTime: Long = 0
private var userSubsStateJob: Job? = null
private var inviteFriendDialog: InviteFriendDialog? = null

private val onBackPressedCallback = object : OnBackPressedCallback(true) {
override fun handleOnBackPressed() {
Expand All @@ -76,6 +78,16 @@ class MainActivity : BindingActivity<ActivityMainBinding>(R.layout.activity_main
setupGetNoticeState()
setupGetVoteCountState()
setupGetEventState()
navigateToRecommendShowDialog()
}

private fun navigateToRecommendShowDialog() {
if (intent.getBooleanExtra(RECOMMEND_FRAGMENT, false)) {
binding.bnvMain.selectedItemId = R.id.menu_recommend
navigateTo<RecommendFragment>()
val inviteFriendDialog = InviteFriendDialog.newInstance(viewModel.getYelloId(), PREVIOUS_Screen)
inviteFriendDialog.show(supportFragmentManager, INVITE_FRIEND_DIALOG)
}
}

private fun initBackPressedCallback() {
Expand Down Expand Up @@ -334,6 +346,11 @@ class MainActivity : BindingActivity<ActivityMainBinding>(R.layout.activity_main
}
}

override fun onDestroy() {
super.onDestroy()
inviteFriendDialog = null
}

companion object {
private const val EXTRA_TYPE = "type"
private const val EXTRA_PATH = "path"
Expand All @@ -354,6 +371,10 @@ class MainActivity : BindingActivity<ActivityMainBinding>(R.layout.activity_main
private const val EVENT_CLICK_RECOMMEND_NAVIGATION = "click_recommend_navigation"
private const val TAG_NOTICE_DIALOG = "NOTICE_DIALOG"

private const val RECOMMEND_FRAGMENT = "RecommendFragment"
private const val INVITE_FRIEND_DIALOG = "InviteFriendDialog"
private const val PREVIOUS_Screen = "Previous Screen"

@JvmStatic
fun getIntent(context: Context, type: String? = null, path: String? = null) =
Intent(context, MainActivity::class.java).apply {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,8 @@ class MainViewModel @Inject constructor(
}
}

fun getYelloId() = authRepository.getYelloId()

companion object {
const val CODE_UNAVAILABLE_EVENT = "100"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ import com.el.yello.R
import com.el.yello.databinding.FragmentInviteFriendDialogBinding
import com.el.yello.util.manager.AmplitudeManager
import com.example.ui.base.BindingDialogFragment
import com.example.ui.extension.toast
import com.example.ui.extension.setOnSingleClickListener
import com.example.ui.extension.toast
import com.kakao.sdk.common.util.KakaoCustomTabsClient
import com.kakao.sdk.share.ShareClient
import com.kakao.sdk.share.WebSharerClient
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
package com.el.yello.presentation.setting

import android.content.Intent
import android.content.res.Resources
import android.os.Bundle
import android.view.View
import android.view.WindowManager
import com.el.yello.R
import com.el.yello.databinding.FragmentProfileQuitInviteFriendBinding
import com.el.yello.presentation.main.MainActivity
import com.el.yello.util.manager.AmplitudeManager
import com.example.ui.base.BindingDialogFragment
import com.example.ui.extension.setOnSingleClickListener
import dagger.hilt.android.AndroidEntryPoint

@AndroidEntryPoint
class ProfileQuitInviteDialog :
BindingDialogFragment<FragmentProfileQuitInviteFriendBinding>(R.layout.fragment_profile_quit_invite_friend) {

override fun onStart() {
super.onStart()
setDialogBackground()
}

override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)

binding.btnProfileInviteNo.setOnSingleClickListener {
ProfileQuitDialog().show(parentFragmentManager, QUIT_DIALOG)
dismiss()
}
binding.btnProfileInviteYes.setOnSingleClickListener {
AmplitudeManager.trackEventWithProperties(EVENT_CLICK_WITHDRAWAL_RECOMMEND)
val intent = Intent(requireContext(), MainActivity::class.java).apply {
flags = Intent.FLAG_ACTIVITY_CLEAR_TASK
putExtra(RECOMMEND_FRAGMENT, true)
}
startActivity(intent)
dismiss()
}
}

private fun setDialogBackground() {
val deviceWidth = Resources.getSystem().displayMetrics.widthPixels
val dialogHorizontalMargin = (Resources.getSystem().displayMetrics.density * 16) * 2

dialog?.window?.apply {
setLayout(
(deviceWidth - dialogHorizontalMargin * 2).toInt(),
WindowManager.LayoutParams.WRAP_CONTENT,
)
setBackgroundDrawableResource(R.color.transparent)
}
dialog?.setCanceledOnTouchOutside(false)
dialog?.setCancelable(true)
}

private companion object {
const val QUIT_DIALOG = "quitDialog"
private const val RECOMMEND_FRAGMENT = "RecommendFragment"
private const val EVENT_CLICK_WITHDRAWAL_RECOMMEND = "click_withdrawal_recommend"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class ProfileQuitReasonActivity :

private var clickedItemPosition: Int = RecyclerView.NO_POSITION
private var isItemClicked: Boolean = false
private var profileQuitDialog: ProfileQuitDialog? = null
private var profileQuitInviteDialog: ProfileQuitInviteDialog? = null

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
Expand Down Expand Up @@ -65,8 +65,8 @@ class ProfileQuitReasonActivity :

private fun initInviteDialogBtnListener() {
binding.btnProfileQuitReasonDone.setOnSingleClickListener {
profileQuitDialog = ProfileQuitDialog()
profileQuitDialog?.show(supportFragmentManager, QUIT_DIALOG)
profileQuitInviteDialog = ProfileQuitInviteDialog()
profileQuitInviteDialog?.show(supportFragmentManager, QUIT_DIALOG)
}
}

Expand Down Expand Up @@ -96,7 +96,7 @@ class ProfileQuitReasonActivity :

override fun onDestroy() {
super.onDestroy()
profileQuitDialog?.dismiss()
profileQuitInviteDialog?.dismiss()
_adapter = null
}

Expand Down
42 changes: 42 additions & 0 deletions app/src/main/res/drawable/img_quit_invite_friend.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="100dp"
android:height="100dp"
android:viewportWidth="100"
android:viewportHeight="100">
<group>
<clip-path
android:pathData="M0,0h100v100h-100z"/>
<group>
<clip-path
android:pathData="M50,0L50,0A50,50 0,0 1,100 50L100,50A50,50 0,0 1,50 100L50,100A50,50 0,0 1,0 50L0,50A50,50 0,0 1,50 0z"/>
<path
android:pathData="M50,0L50,0A50,50 0,0 1,100 50L100,50A50,50 0,0 1,50 100L50,100A50,50 0,0 1,0 50L0,50A50,50 0,0 1,50 0z"
android:fillColor="#1D1E23"/>
<path
android:pathData="M28.5,74.5m-40,0a40,40 0,1 1,80 0a40,40 0,1 1,-80 0"
android:fillColor="#FBFF3E"/>
<path
android:pathData="M54,37.5C55.5,36 56.5,33.25 56.75,31C59.58,31 65.05,31.65 63.25,34.25C61.45,36.85 56.25,38 54,37.5Z"
android:fillColor="#F0F1F4"/>
</group>
<group>
<clip-path
android:pathData="M30.07,50.43l19.06,-3.43l4.57,25.41l-19.06,3.43z"/>
<path
android:pathData="M45.72,53.9C44.77,54.07 43.94,53.92 43.24,53.47C42.53,53.01 42.1,52.35 41.94,51.46C41.78,50.57 41.95,49.77 42.45,49.09C42.93,48.41 43.66,47.98 44.62,47.81C45.59,47.64 46.43,47.78 47.14,48.23C47.84,48.69 48.28,49.37 48.44,50.27C48.6,51.18 48.43,51.95 47.93,52.61C47.43,53.29 46.7,53.7 45.72,53.88L45.72,53.9Z"
android:fillColor="#151515"/>
<path
android:pathData="M35.65,55.71C34.7,55.88 33.87,55.73 33.17,55.29C32.46,54.84 32.03,54.16 31.87,53.27C31.71,52.38 31.88,51.58 32.38,50.9C32.88,50.22 33.6,49.79 34.55,49.62C35.51,49.45 36.37,49.59 37.07,50.04C37.77,50.5 38.21,51.18 38.37,52.09C38.53,52.99 38.36,53.76 37.86,54.43C37.36,55.09 36.63,55.52 35.65,55.69L35.65,55.71Z"
android:fillColor="#151515"/>
<path
android:pathData="M44.2,74.12C42.3,74.46 40.55,74.4 38.99,73.91C37.43,73.42 36.12,72.59 35.08,71.4C34.03,70.21 33.36,68.72 33.04,66.94C32.72,65.16 32.83,63.53 33.4,62.05C33.95,60.58 34.89,59.34 36.19,58.35C37.49,57.36 39.09,56.7 40.97,56.36C42.86,56.02 44.62,56.08 46.18,56.55C47.74,57.03 49.03,57.86 50.07,59.05C51.1,60.25 51.78,61.73 52.1,63.51C52.42,65.29 52.3,66.92 51.75,68.4C51.2,69.88 50.27,71.11 48.98,72.11C47.69,73.12 46.09,73.78 44.2,74.12ZM43.21,68.61C44,68.46 44.64,68.22 45.15,67.85C45.66,67.48 46,67.02 46.19,66.46C46.39,65.9 46.42,65.27 46.3,64.57C46.17,63.87 45.92,63.28 45.54,62.82C45.16,62.37 44.67,62.06 44.08,61.89C43.47,61.72 42.79,61.71 41.99,61.85C41.2,62 40.56,62.24 40.05,62.61C39.54,62.98 39.18,63.44 38.99,64C38.8,64.56 38.76,65.19 38.89,65.91C39.02,66.62 39.27,67.18 39.65,67.64C40.02,68.1 40.52,68.4 41.12,68.57C41.73,68.74 42.43,68.75 43.21,68.61Z"
android:fillColor="#151515"/>
</group>
<path
android:pathData="M50.5,21a20.5,14.5 0,1 0,41 0a20.5,14.5 0,1 0,-41 0z"
android:fillColor="#F0F1F4"/>
<path
android:pathData="M69.59,14.63H73.67L73,22.65H70.25L69.59,14.63ZM71.63,27.56C70.99,27.56 70.48,27.38 70.1,27.02C69.71,26.66 69.52,26.18 69.52,25.61C69.52,25.02 69.71,24.54 70.1,24.18C70.48,23.82 70.99,23.64 71.63,23.64C72.26,23.64 72.77,23.82 73.16,24.18C73.54,24.54 73.73,25.02 73.73,25.61C73.73,26.18 73.54,26.66 73.16,27.02C72.77,27.38 72.26,27.56 71.63,27.56Z"
android:fillColor="#151515"/>
</group>
</vector>
76 changes: 76 additions & 0 deletions app/src/main/res/layout/fragment_profile_quit_invite_friend.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_gravity="center">

<data>

</data>

<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="40dp"
android:background="@drawable/shape_grayscales900_fill_8_rect"
android:paddingBottom="26dp">

<TextView
android:id="@+id/tv_profile_invite_dialog_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="44dp"
android:gravity="center"
android:text="@string/profile_dialog_invite_friend_title"
android:textAppearance="?textAppearanceSubtitle1"
android:textColor="@color/white"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<ImageView
android:id="@+id/iv_profile_invite_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:src="@drawable/img_quit_invite_friend"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tv_profile_invite_dialog_title" />

<TextView
android:id="@+id/btn_profile_invite_no"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="38dp"
android:layout_marginTop="49dp"
android:gravity="center"
android:paddingVertical="11dp"
android:text="@string/profile_dialog_invite_friend_no"
android:textAppearance="?textAppearanceButton"
android:textColor="@color/grayscales_600"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@id/btn_profile_invite_yes"
app:layout_constraintHorizontal_chainStyle="packed"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/iv_profile_invite_icon" />

<TextView
android:id="@+id/btn_profile_invite_yes"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="7dp"
android:layout_marginEnd="38dp"
android:gravity="center"
android:paddingVertical="11dp"
android:text="@string/profile_dialog_invite_friend_yes"
android:textAppearance="?textAppearanceButton"
android:textColor="@color/yello_main_500"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_chainStyle="packed"
app:layout_constraintStart_toEndOf="@id/btn_profile_invite_no"
app:layout_constraintTop_toTopOf="@id/btn_profile_invite_no" />

</androidx.constraintlayout.widget.ConstraintLayout>

</layout>
3 changes: 3 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,9 @@
<string name="profile_item_bottom_sheet_tv_friend">친구 수</string>
<string name="profile_item_bottom_sheet_tv_msg">받은 쪽지</string>
<string name="profile_item_bottom_sheet_btn_delete">친구 끊기</string>
<string name="profile_dialog_invite_friend_title">친구가 없다면\n친구를 초대할 수도 있어요.</string>
<string name="profile_dialog_invite_friend_no">다음에 할게요</string>
<string name="profile_dialog_invite_friend_yes">오,그런 방법이!</string>
<string name="profile_dialog_tv_title">정말 탈퇴하시겠습니까?</string>
<string name="profile_dialog_btn_no">아니요</string>
<string name="profile_dialog_btn_yes">네, 탈퇴합니다</string>
Expand Down
Loading