Skip to content
This repository has been archived by the owner on Nov 3, 2022. It is now read-only.

Commit

Permalink
Merge pull request #554 from TeamBeMe/feature/l2hyunwoo_firebase
Browse files Browse the repository at this point in the history
Merge l2hyunwoo develop
  • Loading branch information
l2hyunwoo authored Feb 28, 2021
2 parents 034a38a + f2087b6 commit 4f634d7
Show file tree
Hide file tree
Showing 24 changed files with 212 additions and 7 deletions.
1 change: 1 addition & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

<application
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import com.teambeme.beme.data.remote.singleton.RetrofitObjects
import com.teambeme.beme.databinding.ActivityAnswerBinding
import com.teambeme.beme.util.StatusBarUtil
import com.teambeme.beme.util.dp
import com.teambeme.beme.util.recordClickEvent
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch

Expand Down Expand Up @@ -145,6 +146,7 @@ class AnswerActivity : BindingActivity<ActivityAnswerBinding>(R.layout.activity_
val layoutParams =
binding.linearAnswerPublic.layoutParams!! as ConstraintLayout.LayoutParams
if (isPublic) {
recordClickEvent("SWITCH", "OPEN_ANSWER_ANSWERVIEW")
val animator = setValueChangeAnimator(20.dp, 64.dp)
val alphaAnimator = ValueAnimator.ofFloat(0f, 1f).apply {
duration = 400
Expand All @@ -158,6 +160,7 @@ class AnswerActivity : BindingActivity<ActivityAnswerBinding>(R.layout.activity_
binding.linearAnswerBlockComment.alpha = it.animatedValue as Float
}
} else {
recordClickEvent("SWITCH", "PRIVATE_ANSWER_ANSWERVIEW")
val animator = setValueChangeAnimator(64.dp, 20.dp)
animator.addUpdateListener { updatedAnimation ->
layoutParams.setMargins(0, 0, 0, updatedAnimation.animatedValue as Int)
Expand All @@ -174,6 +177,8 @@ class AnswerActivity : BindingActivity<ActivityAnswerBinding>(R.layout.activity_
}

binding.switchAnswerReplyCancel.setOnCheckedChangeListener { _, isChecked ->
if (isChecked) recordClickEvent("SWITCH", "OPEN_COMMENT_ANSWERVIEW")
else recordClickEvent("SWITCH", "PRIVATE_COMMENT_ANSWERVIEW")
answerViewModel.setCommentBlockedStatus(isChecked)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import com.teambeme.beme.databinding.ItemExploreOtherMindsBinding
import com.teambeme.beme.detail.view.DetailActivity
import com.teambeme.beme.explore.model.ResponseExplorationMinds
import com.teambeme.beme.explore.view.ExploreDetailActivity
import com.teambeme.beme.util.recordClickEvent
import com.teambeme.beme.util.startActivity

class OtherMindsRcvAdapter(private val context: Context) :
Expand Down Expand Up @@ -52,6 +53,7 @@ class OtherMindsRcvAdapter(private val context: Context) :
context: Context
) {
binding.btnOtherMindsShowOtherAnswers.setOnClickListener {
recordClickEvent("BUTTON", "CLICK_SAME")
context.startActivity<ExploreDetailActivity>(otherMindsData.questionTitle, otherMindsData.questionId)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import com.teambeme.beme.explore.view.ExploreDetailActivity
import com.teambeme.beme.explore.viewmodel.ExploreViewModel
import com.teambeme.beme.following.viewmodel.FollowingViewModel
import com.teambeme.beme.otherpage.view.OtherPageActivity
import com.teambeme.beme.util.recordClickEvent
import com.teambeme.beme.util.startActivity

class OtherQuestionsRcvAdapter<B : ViewDataBinding>(
Expand Down Expand Up @@ -177,6 +178,7 @@ class OtherQuestionsRcvAdapter<B : ViewDataBinding>(
) {
binding.btnOtherQuestionsDoAnswer.setOnClickListener {
Log.d("answer", "adapter")
recordClickEvent("BUTTON", "CLICK_ANSWERCHECK_FOLLOWING")
otherQuestionButtonClickListener?.otherQuestionAnswerClickListener(otherQuestionsData.questionId)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import com.teambeme.beme.explore.viewmodel.ExploreViewModelFactory
import com.teambeme.beme.home.view.HomeFragment
import com.teambeme.beme.idsearchfollowing.view.FollowingAfterIdSearchActivity
import com.teambeme.beme.notification.view.NotificationActivity
import com.teambeme.beme.util.recordClickEvent

class ExploreFragment : BindingFragment<FragmentExploreBinding>(R.layout.fragment_explore) {
private val exploreViewModelFactory = ExploreViewModelFactory(
Expand Down Expand Up @@ -65,9 +66,21 @@ class ExploreFragment : BindingFragment<FragmentExploreBinding>(R.layout.fragmen
setIsMorePageObserve()
setIntentAnswerObserve()
setListenerForPullRefreshLayout()
setChipListener()
return binding.root
}

private fun setChipListener() {
with(binding) {
chipExploreThink.setOnClickListener { recordClickEvent("BUTTON", "CLICK_VALUES_SEARCH") }
chipExploreRelationship.setOnClickListener { recordClickEvent("BUTTON", "CLICK_RELATIONSHIP_SEARCH") }
chipExploreLove.setOnClickListener { recordClickEvent("BUTTON", "CLICK_LOVE_SEARCH") }
chipExploreDaily.setOnClickListener { recordClickEvent("BUTTON", "CLICK_DAILYLIFE_SEARCH") }
chipExploreMe.setOnClickListener { recordClickEvent("BUTTON", "CLICK_ABOUTME_SEARCH") }
chipExploreStory.setOnClickListener { recordClickEvent("BUTTON", "CLICK_STORY_SEARCH") }
}
}

private fun setIntentAnswerObserve() {
exploreViewModel.questionForFirstAnswer.observe(viewLifecycleOwner) {
it?.let {
Expand Down Expand Up @@ -183,6 +196,7 @@ class ExploreFragment : BindingFragment<FragmentExploreBinding>(R.layout.fragmen

private fun setClickListenerForIdSearchButton() {
binding.btnExploreIdSearch.setOnClickListener {
recordClickEvent("BUTTON", "CLICK_SEARCHID_SEARCH")
val intent = Intent(activity, FollowingAfterIdSearchActivity::class.java)
startActivity(intent)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import com.teambeme.beme.following.viewmodel.FollowingViewModel
import com.teambeme.beme.following.viewmodel.FollowingViewModelFactory
import com.teambeme.beme.idsearchfollowing.view.FollowingAfterIdSearchActivity
import com.teambeme.beme.notification.view.NotificationActivity
import com.teambeme.beme.util.recordClickEvent

class FollowingFragment : BindingFragment<FragmentFollowingBinding>(R.layout.fragment_following) {
private val followingViewModelFactory = FollowingViewModelFactory(
Expand Down Expand Up @@ -273,6 +274,7 @@ class FollowingFragment : BindingFragment<FragmentFollowingBinding>(R.layout.fra

private fun setClickListenerForIdSearchButton() {
binding.btnFollowingIdSearch.setOnClickListener {
recordClickEvent("BUTTON", "CLICK_SEARCHID_FOLLOWING")
val intent = Intent(activity, FollowingAfterIdSearchActivity::class.java)
startActivity(intent)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import com.teambeme.beme.databinding.ItemFollowingAfterIdsearchBinding
import com.teambeme.beme.idsearchfollowing.model.ResponseIdSearchData
import com.teambeme.beme.idsearchfollowing.viewmodel.IdSearchViewModel
import com.teambeme.beme.otherpage.view.OtherPageActivity
import com.teambeme.beme.util.recordClickEvent

class IdSearchAdapter(
private val viewModel: IdSearchViewModel
Expand Down Expand Up @@ -87,6 +88,7 @@ class IdSearchAdapter(
) {
binding.btnFollowingFollowing.setOnClickListener {
viewModel.requestFollowAndFollowing(data.id)
recordClickEvent("BUTTON", "FOLLOW_SEARCHID_FALSE")
binding.btnFollowingFollow.visibility = View.VISIBLE
binding.btnFollowingFollowing.visibility = View.INVISIBLE
}
Expand All @@ -99,6 +101,7 @@ class IdSearchAdapter(
) {
binding.btnFollowingFollow.setOnClickListener {
viewModel.requestFollowAndFollowing(data.id)
recordClickEvent("BUTTON", "FOLLOW_SEARCHID_TRUE")
binding.btnFollowingFollow.visibility = View.INVISIBLE
binding.btnFollowingFollowing.visibility = View.VISIBLE
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,8 @@ class FollowingAfterIdSearchActivity :
}

private fun initBinding(binding: ActivityFollowingAfterIdSearchBinding) {
binding.apply {
idSearchViewModel = idSearchViewModel
lifecycleOwner = this@FollowingAfterIdSearchActivity
}
binding.idSearchViewModel = idSearchViewModel
binding.lifecycleOwner = this@FollowingAfterIdSearchActivity
}

private fun setRecentSearchAdapter(binding: ActivityFollowingAfterIdSearchBinding) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import com.teambeme.beme.main.view.MainActivity
import com.teambeme.beme.signup.view.SignUpActivity
import com.teambeme.beme.util.KeyboardVisibilityUtils
import com.teambeme.beme.util.StatusBarUtil
import com.teambeme.beme.util.recordClickEvent

class LoginActivity : BindingActivity<ActivityLoginBinding>(R.layout.activity_login) {
private lateinit var keyboardVisibilityUtils: KeyboardVisibilityUtils
Expand All @@ -47,7 +48,12 @@ class LoginActivity : BindingActivity<ActivityLoginBinding>(R.layout.activity_lo

private fun setUIListener() {
with(binding) {
btnLoginSignup.setOnClickListener { startActivity(Intent(this@LoginActivity, SignUpActivity::class.java)) }
btnLoginSignup.setOnClickListener {
recordClickEvent("BUTTON", "CLICK_SIGN_SIGN")
startActivity(Intent(this@LoginActivity, SignUpActivity::class.java))
}
btnRegisterFindId.setOnClickListener { recordClickEvent("BUTTON", "CLICK_SEARCHID_LOGIN") }
btnRegisterFindPassword.setOnClickListener { recordClickEvent("BUTTON", "CLICK_FINDPWD_LOGIN") }
txtlayoutLoginPassword.setEndIconOnClickListener { loginViewModel?.setShowPassword() }
}
keyboardVisibilityUtils = KeyboardVisibilityUtils(window,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,22 @@ package com.teambeme.beme.main.adapter
import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentActivity
import androidx.viewpager2.adapter.FragmentStateAdapter
import com.google.firebase.analytics.FirebaseAnalytics
import com.google.firebase.analytics.ktx.analytics
import com.google.firebase.analytics.ktx.logEvent
import com.google.firebase.ktx.Firebase
import com.teambeme.beme.explore.view.ExploreFragment
import com.teambeme.beme.following.view.FollowingFragment
import com.teambeme.beme.home.view.HomeFragment
import com.teambeme.beme.main.model.ScreenName
import com.teambeme.beme.mypage.view.MyPageFragment

class MainViewPagerAdapter(fragmentActivity: FragmentActivity) :
FragmentStateAdapter(fragmentActivity) {
override fun getItemCount() = MAIN_PAGE_NUM

override fun createFragment(position: Int): Fragment {
recordScreen(position)
return when (position) {
0 -> HomeFragment()
1 -> ExploreFragment()
Expand All @@ -21,6 +27,13 @@ class MainViewPagerAdapter(fragmentActivity: FragmentActivity) :
}
}

private fun recordScreen(position: Int) {
Firebase.analytics.logEvent(FirebaseAnalytics.Event.SCREEN_VIEW) {
param(FirebaseAnalytics.Param.SCREEN_NAME, ScreenName.of(position))
param(FirebaseAnalytics.Param.SCREEN_CLASS, "MainActivity")
}
}

companion object {
const val MAIN_PAGE_NUM = 4
}
Expand Down
18 changes: 18 additions & 0 deletions app/src/main/java/com/teambeme/beme/main/model/ScreenName.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package com.teambeme.beme.main.model

enum class ScreenName(
private val index: Int,
private val screenName: String
) {
HOME(0, "HomeFragment"),
EXPLORE(1, "ExploreFragment"),
FOLLOWING(2, "FollowingFragment"),
MYPAGE(3, "MyPageFragment");

companion object {
fun of(index: Int): String {
return values().find { index == it.index }?.screenName
?: throw IllegalArgumentException("도대체 이 숫자는 어디서 나온거죠? 고양이 수: $index")
}
}
}
22 changes: 22 additions & 0 deletions app/src/main/java/com/teambeme/beme/mypage/model/CategoryFilter.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package com.teambeme.beme.mypage.model

import com.teambeme.beme.R

enum class CategoryFilter(
private val checkId: Int,
private val itemId: String
) {
VALUES(R.id.chip_write_1, "CLICK_VALUES_MPFILTER"),
RELATIONSHIP(R.id.chip_write_2, "CLICK_RELATIONSHIP_MPFILTER"),
LOVE(R.id.chip_write_3, "CLICK_LOVE_MPFILTER"),
DAILYLIFE(R.id.chip_write_4, "CLICK_DAILYLIFE_MPFILTER"),
ME(R.id.chip_write_5, "CLICK_ME_MPFILTER"),
STORY(R.id.chip_write_6, "CLICK_STORY_MPFILTER");

companion object {
fun asItemId(checkId: Int): String {
return values().find { it.checkId == checkId }?.itemId
?: throw IllegalArgumentException("무슨 범위여 이게 $checkId")
}
}
}
19 changes: 19 additions & 0 deletions app/src/main/java/com/teambeme/beme/mypage/model/PublicRange.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package com.teambeme.beme.mypage.model

import com.teambeme.beme.R

enum class PublicRange(
private val checkId: Int,
private val itemId: String
) {
ALL(R.id.chip_range_1, "CLICK_ALL_MPFILTER"),
OPEN(R.id.chip_range_2, "CLICK_OPEN_MPFILTER"),
PRIVATE(R.id.chip_range_3, "CLICK_PRIVATE_MPFILTER");

companion object {
fun asItemId(checkId: Int): String {
return values().find { it.checkId == checkId }?.itemId
?: throw IllegalArgumentException("무슨 범위여 이게 $checkId")
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,12 @@ import com.teambeme.beme.R
import com.teambeme.beme.data.remote.datasource.MyPageDataSourceImpl
import com.teambeme.beme.data.remote.singleton.RetrofitObjects
import com.teambeme.beme.databinding.ItemBottomWriteBinding
import com.teambeme.beme.mypage.model.CategoryFilter
import com.teambeme.beme.mypage.model.PublicRange
import com.teambeme.beme.mypage.repository.MyPageRepositoryImpl
import com.teambeme.beme.mypage.viewmodel.MyPageViewModel
import com.teambeme.beme.mypage.viewmodel.MyPageViewModelFactory
import com.teambeme.beme.util.recordClickEvent

class BottomWriteFragment(private val filter: Boolean) : BottomSheetDialogFragment() {
private lateinit var binding: ItemBottomWriteBinding
Expand All @@ -39,12 +42,13 @@ class BottomWriteFragment(private val filter: Boolean) : BottomSheetDialogFragme
dismiss()
}
binding.chipGroupRange.setOnCheckedChangeListener { group, checkedId ->
recordClickEvent("BUTTON", PublicRange.asItemId(checkedId))
setRangeOnCheckedListner(checkedId)
}
binding.chipGroupWriteCategori.setOnCheckedChangeListener { group, checkedId ->
recordClickEvent("BUTTON", CategoryFilter.asItemId(checkedId))
setWriteOnCheckedListener(checkedId)
}

return binding.root
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import com.teambeme.beme.mypage.repository.MyPageRepositoryImpl
import com.teambeme.beme.mypage.view.BottomWriteFragment.Companion.WRITE_FILTER
import com.teambeme.beme.mypage.viewmodel.MyPageViewModel
import com.teambeme.beme.mypage.viewmodel.MyPageViewModelFactory
import com.teambeme.beme.util.recordClickEvent

class MyWriteFragment : Fragment() {
private lateinit var binding: FragmentMyWriteBinding
Expand Down Expand Up @@ -56,6 +57,10 @@ class MyWriteFragment : Fragment() {
mypageViewModel.isAnswerEmpty.observe(viewLifecycleOwner) {
isEmptyListener(it)
}
binding.imgWriteFilter.setOnClickListener {
recordClickEvent("BUTTON", "CLICK_FILTER_MYPAGE")
mypageViewModel.writeFilterOnClick()
}
setSearchView()
return binding.root
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import com.teambeme.beme.databinding.ItemRecentActivitiesBinding
import com.teambeme.beme.detail.view.DetailActivity
import com.teambeme.beme.notification.model.ResponseNoticeData
import com.teambeme.beme.otherpage.view.OtherPageActivity
import com.teambeme.beme.util.recordClickEvent

class NoticeAdapter :
ListAdapter<ResponseNoticeData.Data.Activity, NoticeAdapter.NoticeViewHolder>(NoticeDiffUtil()) {
Expand Down Expand Up @@ -46,6 +47,7 @@ class NoticeAdapter :
view.context.startActivity(intent)
}
itemView.setOnClickListener { view ->
recordClickEvent("BUTTON", "CLCIK_ALARM")
if (getItem(position).questionTitle != null) {
val intent = Intent(view.context, DetailActivity::class.java)
intent.putExtra("answerId", getItem(holder.adapterPosition).answerId)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ import android.view.View
import android.widget.Toast
import androidx.activity.viewModels
import androidx.viewpager2.widget.ViewPager2
import com.google.firebase.analytics.FirebaseAnalytics
import com.google.firebase.analytics.ktx.analytics
import com.google.firebase.analytics.ktx.logEvent
import com.google.firebase.ktx.Firebase
import com.teambeme.beme.R
import com.teambeme.beme.base.BindingActivity
import com.teambeme.beme.data.local.singleton.BeMeAuthPreference
Expand Down Expand Up @@ -79,6 +83,10 @@ class OnBoardingActivity :
private fun providePageChangeCallback(): ViewPager2.OnPageChangeCallback {
return object : ViewPager2.OnPageChangeCallback() {
override fun onPageSelected(position: Int) {
Firebase.analytics.logEvent(FirebaseAnalytics.Event.SCREEN_VIEW) {
param(FirebaseAnalytics.Param.SCREEN_CLASS, "OnBoardingActivity")
param(FirebaseAnalytics.Param.SCREEN_NAME, getScreenName(position))
}
when (position) {
3 -> {
with(binding) {
Expand All @@ -97,6 +105,15 @@ class OnBoardingActivity :
}
}

private fun getScreenName(position: Int): String {
return when (position) {
0 -> "ONBOARDING_1"
1 -> "ONBOARDING_2"
2 -> "ONBOARDING_3"
else -> "ONBOARDING_4"
}
}

private fun <T> navigateTo(activity: Class<T>) {
val intent =
Intent(this@OnBoardingActivity, activity)
Expand Down
Loading

0 comments on commit 4f634d7

Please sign in to comment.