Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop' into feature/feat-mypag…
Browse files Browse the repository at this point in the history
…e-setting

# Conflicts:
#	app/src/main/AndroidManifest.xml
  • Loading branch information
sxunea committed Feb 26, 2024
2 parents 22dc4b4 + 7f4b29c commit e4890ba
Show file tree
Hide file tree
Showing 61 changed files with 658 additions and 104 deletions.
5 changes: 5 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
android:theme="@style/Theme.Winey"
android:usesCleartextTraffic="true"
tools:targetApi="31">

<service
android:name=".configuration.WineyMessagingService"
android:enabled="true"
Expand Down Expand Up @@ -86,6 +87,10 @@
android:name=".presentation.main.mypage.setting.SettingActivity"
android:exported="false"
android:screenOrientation="portrait" />
<activity
android:name=".presentation.main.mypage.goal.GoalPathActivity"
android:exported="false"
android:screenOrientation="portrait" />
<activity
android:name=".presentation.main.mypage.myfeed.MyFeedActivity"
android:exported="false"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ data class ResponseGetFeedDetailDto(
val feedMoney: Long,
@SerialName("feedTitle")
val feedTitle: String,
@SerialName("feedType")
val feedType: String?,
@SerialName("isLiked")
val isLiked: Boolean,
@SerialName("likes")
Expand Down Expand Up @@ -61,6 +63,7 @@ data class ResponseGetFeedDetailDto(
feedImage = getFeedResponseDto.feedImage,
feedMoney = getFeedResponseDto.feedMoney,
feedTitle = getFeedResponseDto.feedTitle,
feedType = getFeedResponseDto.feedType ?: "",
isLiked = getFeedResponseDto.isLiked,
likes = getFeedResponseDto.likes,
nickName = getFeedResponseDto.nickName,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ data class ResponseGetWineyFeedListDto(
val feedMoney: Long,
@SerialName("feedTitle")
val feedTitle: String,
@SerialName("feedType")
val feedType: String?,
@SerialName("isLiked")
val isLiked: Boolean,
@SerialName("likes")
Expand Down Expand Up @@ -65,6 +67,7 @@ data class ResponseGetWineyFeedListDto(
feedImage = feed.feedImage,
feedMoney = feed.feedMoney,
feedTitle = feed.feedTitle,
feedType = feed.feedType ?: "",
isLiked = feed.isLiked,
likes = feed.likes,
nickName = feed.nickName,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ data class DetailFeed(
val feedImage: String,
val feedMoney: Long,
val feedTitle: String,
val feedType: String,
var isLiked: Boolean,
var likes: Long,
val nickName: String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ data class WineyFeed(
val feedImage: String,
val feedMoney: Long,
val feedTitle: String,
val feedType: String,
var isLiked: Boolean,
var likes: Long,
val nickName: String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ class WineyFeedFragment :
override fun onStart() {
super.onStart()
if (clickedFeedId != -1) {
Timber.d("onStart getDetailFeed")
viewModel.getDetailFeed(clickedFeedId)
}
}
Expand Down Expand Up @@ -137,7 +136,6 @@ class WineyFeedFragment :
}

private fun saveClickedFeedId(feedId: Int) {
Timber.d("CLICKED FEED ID: $feedId")
clickedFeedId = feedId
}

Expand Down Expand Up @@ -266,10 +264,12 @@ class WineyFeedFragment :
.onEach { state ->
when (state) {
is UiState.Success -> {
Timber.e("PAGING DATA SUBMIT in Fragment")
val pagingData = state.data
wineyFeedAdapter.submitData(pagingData)
viewModel.initGetWineyFeedListState()

// 상세피드 들어갔다 나올 때, 성공 상태가 계속 관찰되어
// 이미 삭제된 항목이 되살아나는 일이 없도록 UiState 초기화
viewModel.initGetWineyFeedState()
}

is UiState.Failure -> {
Expand Down Expand Up @@ -336,6 +336,8 @@ class WineyFeedFragment :
type = SnackbarType.WineyFeedResult(isSuccess = true)
)

// 상세피드 들어갔다 나올 때 성공 상태가 계속 관찰되어
// 스낵바가 반복해서 뜨지 않도록 UiState 초기화
viewModel.initDeleteFeedState()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ class WineyFeedViewModel @Inject constructor(
getWineyFeedList()
}

// todo: 위니피드 조회 시, 절약 vs 과소비 타입에 따라 버튼 디자인 바뀌도록 변경
private fun getWineyFeedList() {
viewModelScope.launch {
_getWineyFeedListState.emit(UiState.Loading)
Expand All @@ -58,13 +57,12 @@ class WineyFeedViewModel @Inject constructor(
handleFailureState(_getWineyFeedListState, t)
}
.collectLatest { pagingData ->
Timber.e("PAGING DATA COLLECT in ViewModel")
_getWineyFeedListState.emit(UiState.Success(pagingData))
}
}
}

fun initGetWineyFeedListState() {
fun initGetWineyFeedState() {
_getWineyFeedListState.value = UiState.Empty
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package org.go.sopt.winey.presentation.main.mypage.goal

import android.os.Bundle
import androidx.fragment.app.Fragment
import androidx.fragment.app.commit
import androidx.fragment.app.replace
import org.go.sopt.winey.R
import org.go.sopt.winey.databinding.ActivityGoalPathBinding
import org.go.sopt.winey.util.binding.BindingActivity

class GoalPathActivity : BindingActivity<ActivityGoalPathBinding>(R.layout.activity_goal_path) {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)

setupDefaultFragment(savedInstanceState)

// todo: 황제 레벨에서는 배경 이미지 변경
// todo: 목표 달성까지 남은 절약 금액, 피드 업로드 횟수 표시
}

private fun setupDefaultFragment(savedInstanceState: Bundle?) {
if (savedInstanceState == null) {
navigateTo<GoalPathLevel1Fragment>()
}
}

private inline fun <reified T : Fragment> navigateTo() {
supportFragmentManager.commit {
replace<T>(R.id.fcv_goal_path, T::class.simpleName)
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
package org.go.sopt.winey.presentation.main.mypage.goal

import android.animation.Animator
import android.os.Bundle
import android.view.View
import androidx.core.view.isVisible
import org.go.sopt.winey.R
import org.go.sopt.winey.databinding.FragmentGoalPathLevel1Binding
import org.go.sopt.winey.util.binding.BindingFragment

class GoalPathLevel1Fragment :
BindingFragment<FragmentGoalPathLevel1Binding>(R.layout.fragment_goal_path_level1) {
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)

initAnimatorListener()

// todo: 목표 달성 현황에 따라 체크박스 이미지 변경
}

private fun initAnimatorListener() {
binding.lottieGoalPathStep1.addAnimatorListener(object : Animator.AnimatorListener {
override fun onAnimationStart(animation: Animator) {
with(binding) {
ivGoalPathLv1.isVisible = false
lottieGoalPathStep1.isVisible = true
}
}

override fun onAnimationEnd(animation: Animator) {
with(binding) {
lottieGoalPathStep1.isVisible = false
ivGoalPathLv2.isVisible = true
}
}

override fun onAnimationCancel(animation: Animator) {
}

override fun onAnimationRepeat(animation: Animator) {
}
})
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package org.go.sopt.winey.presentation.main.mypage.goal

import android.animation.Animator
import android.os.Bundle
import android.view.View
import androidx.core.view.isVisible
import org.go.sopt.winey.R
import org.go.sopt.winey.databinding.FragmentGoalPathLevel2Binding
import org.go.sopt.winey.util.binding.BindingFragment

class GoalPathLevel2Fragment :
BindingFragment<FragmentGoalPathLevel2Binding>(R.layout.fragment_goal_path_level2) {
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)

initAnimatorListener()
}

private fun initAnimatorListener() {
binding.lottieGoalPathStep2.addAnimatorListener(object : Animator.AnimatorListener {
override fun onAnimationStart(animation: Animator) {
with(binding) {
ivGoalPathLv2.isVisible = false
lottieGoalPathStep2.isVisible = true
}
}

override fun onAnimationEnd(animation: Animator) {
with(binding) {
lottieGoalPathStep2.isVisible = false
ivGoalPathLv3.isVisible = true
}
}

override fun onAnimationCancel(animation: Animator) {
}

override fun onAnimationRepeat(animation: Animator) {
}
})
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package org.go.sopt.winey.presentation.main.mypage.goal

import android.animation.Animator
import android.os.Bundle
import android.view.View
import androidx.core.view.isVisible
import org.go.sopt.winey.R
import org.go.sopt.winey.databinding.FragmentGoalPathLevel3Binding
import org.go.sopt.winey.util.binding.BindingFragment

class GoalPathLevel3Fragment :
BindingFragment<FragmentGoalPathLevel3Binding>(R.layout.fragment_goal_path_level3) {
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)

initAnimatorListener()
}

private fun initAnimatorListener() {
binding.lottieGoalPathStep3.addAnimatorListener(object : Animator.AnimatorListener {
override fun onAnimationStart(animation: Animator) {
with(binding) {
ivGoalPathLv3.isVisible = false
lottieGoalPathStep3.isVisible = true
}
}

override fun onAnimationEnd(animation: Animator) {
with(binding) {
lottieGoalPathStep3.isVisible = false
ivGoalPathLv4.isVisible = true
}
}

override fun onAnimationCancel(animation: Animator) {
}

override fun onAnimationRepeat(animation: Animator) {
}
})
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package org.go.sopt.winey.presentation.main.mypage.goal

import android.os.Bundle
import android.view.View
import org.go.sopt.winey.R
import org.go.sopt.winey.databinding.FragmentGoalPathLevel4Binding
import org.go.sopt.winey.util.binding.BindingFragment

class GoalPathLevel4Fragment :
BindingFragment<FragmentGoalPathLevel4Binding>(R.layout.fragment_goal_path_level4) {
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ class MyFeedActivity : BindingActivity<FragmentMyfeedBinding>(R.layout.fragment_
super.onStart()

if (clickedFeedId != -1) {
Timber.d("onStart getDetailFeed")
viewModel.getDetailFeed(clickedFeedId)
}
}
Expand Down Expand Up @@ -96,7 +95,6 @@ class MyFeedActivity : BindingActivity<FragmentMyfeedBinding>(R.layout.fragment_
}

private fun saveClickedFeedId(feedId: Int) {
Timber.d("CLICKED FEED ID: $feedId")
clickedFeedId = feedId
}

Expand Down Expand Up @@ -160,6 +158,8 @@ class MyFeedActivity : BindingActivity<FragmentMyfeedBinding>(R.layout.fragment_
type = SnackbarType.WineyFeedResult(isSuccess = true)
)

// 상세피드 들어갔다 나올 때 성공 상태가 계속 관찰되어
// 스낵바가 반복해서 뜨지 않도록 UiState 초기화
viewModel.initDeleteFeedState()
}

Expand Down Expand Up @@ -192,10 +192,12 @@ class MyFeedActivity : BindingActivity<FragmentMyfeedBinding>(R.layout.fragment_
.onEach { state ->
when (state) {
is UiState.Success -> {
Timber.e("PAGING DATA SUBMIT in Fragment")
val pagingData = state.data
myFeedAdapter.submitData(pagingData)
viewModel.initGetMyFeedListState()

// 상세피드 들어갔다 나올 때, 성공 상태가 계속 관찰되어
// 이미 삭제된 항목이 되살아나는 일이 없도록 UiState 초기화
viewModel.initGetMyFeedState()
}

is UiState.Failure -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,12 @@ class MyFeedViewModel @Inject constructor(
handleFailureState(_getMyFeedListState, t)
}
.collectLatest { pagingData ->
Timber.e("PAGING DATA COLLECT in ViewModel")
_getMyFeedListState.emit(UiState.Success(pagingData))
}
}
}

fun initGetMyFeedListState() {
fun initGetMyFeedState() {
_getMyFeedListState.value = UiState.Empty
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.go.sopt.winey.presentation.splash

import android.app.Activity
import android.content.Intent
import android.os.Build
import android.os.Bundle
Expand Down Expand Up @@ -104,6 +105,13 @@ class SplashActivity : BindingActivity<ActivitySplashBinding>(R.layout.activity_
}
}

private inline fun <reified T : Activity> navigateTo() {
Intent(this, T::class.java).apply {
addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK or Intent.FLAG_ACTIVITY_NEW_TASK)
startActivity(this)
}
}

private fun checkAppUpdateInfo() {
appUpdateManager.appUpdateInfo.addOnSuccessListener { appUpdateInfo ->
if (appUpdateInfo.updateAvailability() == UpdateAvailability.UPDATE_AVAILABLE &&
Expand Down
Loading

0 comments on commit e4890ba

Please sign in to comment.