Skip to content

Commit

Permalink
Merge pull request #259 from team-winey/feature/mod-levelup-guide-noti
Browse files Browse the repository at this point in the history
[mod] 알림 목록 / 레벨업 가이드 화면 변경
  • Loading branch information
leeeha authored Mar 2, 2024
2 parents f58802b + ad9108c commit c955428
Show file tree
Hide file tree
Showing 16 changed files with 55 additions and 47 deletions.
2 changes: 1 addition & 1 deletion app/release/output-metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"type": "SINGLE",
"filters": [],
"attributes": [],
"versionCode": 23,
"versionCode": 25,
"versionName": "1.1.0",
"outputFile": "app-release.apk"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import org.go.sopt.winey.databinding.ActivityMainBinding
import org.go.sopt.winey.presentation.main.feed.WineyFeedFragment
import org.go.sopt.winey.presentation.main.feed.detail.DetailActivity
import org.go.sopt.winey.presentation.main.mypage.MyPageFragment
import org.go.sopt.winey.presentation.main.mypage.MypageHelpActivity
import org.go.sopt.winey.presentation.main.mypage.goal.GoalPathActivity
import org.go.sopt.winey.presentation.main.recommend.RecommendFragment
import org.go.sopt.winey.presentation.model.NotificationType
import org.go.sopt.winey.presentation.onboarding.login.LoginActivity
Expand Down Expand Up @@ -105,11 +105,10 @@ class MainActivity : BindingActivity<ActivityMainBinding>(R.layout.activity_main
navigateToMyPageFragment(KEY_FROM_NOTI, true)
}

NotificationType.LIKE_NOTIFICATION, NotificationType.COMMENT_NOTIFICATION -> {
NotificationType.LIKE_NOTIFICATION, NotificationType.COMMENT_NOTIFICATION ->
navigateToDetailScreen(feedId?.toInt())
}

NotificationType.HOW_TO_LEVEL_UP -> navigateToLevelUpGuideScreen()
NotificationType.HOW_TO_LEVEL_UP -> navigateToGoalPathScreen()
else -> {}
}
}
Expand All @@ -120,7 +119,7 @@ class MainActivity : BindingActivity<ActivityMainBinding>(R.layout.activity_main
return
}

if (intent.getBooleanExtra(KEY_TO_MYPAGE, false)) {
if (intent.getBooleanExtra(KEY_TO_MY_PAGE, false)) {
navigateToMyPageFragment(KEY_FROM_NOTI, true)
return
}
Expand Down Expand Up @@ -217,9 +216,8 @@ class MainActivity : BindingActivity<ActivityMainBinding>(R.layout.activity_main
startActivity(intent)
}

// todo: 레벨업 가이드 화면 바꿔야 할텐데!
private fun navigateToLevelUpGuideScreen() {
val intent = Intent(this, MypageHelpActivity::class.java)
private fun navigateToGoalPathScreen() {
val intent = Intent(this, GoalPathActivity::class.java)
startActivity(intent)
}

Expand All @@ -236,7 +234,7 @@ class MainActivity : BindingActivity<ActivityMainBinding>(R.layout.activity_main
private const val KEY_FROM_NOTI = "fromNoti"

const val KEY_FEED_ID = "feedId"
const val KEY_TO_MYPAGE = "navigateMypage"
const val KEY_TO_MY_PAGE = "navigateMyPage"
const val KEY_FROM_GOAL_PATH = "fromGoalPath"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,16 @@ import org.go.sopt.winey.domain.entity.UserV2
import org.go.sopt.winey.domain.entity.WineyFeed
import org.go.sopt.winey.domain.repository.DataStoreRepository
import org.go.sopt.winey.presentation.main.MainViewModel
import org.go.sopt.winey.presentation.main.feed.adapter.WineyFeedAdapter
import org.go.sopt.winey.presentation.main.feed.adapter.WineyFeedGoalAdapter
import org.go.sopt.winey.presentation.main.feed.adapter.WineyFeedHeaderAdapter
import org.go.sopt.winey.presentation.main.feed.adapter.WineyFeedLoadAdapter
import org.go.sopt.winey.presentation.main.feed.detail.DetailActivity
import org.go.sopt.winey.presentation.main.feed.upload.UploadActivity
import org.go.sopt.winey.presentation.main.mypage.goal.GoalPathActivity
import org.go.sopt.winey.presentation.main.notification.NotificationActivity
import org.go.sopt.winey.presentation.model.WineyDialogLabel
import org.go.sopt.winey.presentation.model.WineyFeedType
import org.go.sopt.winey.util.activity.showReportGoogleForm
import org.go.sopt.winey.util.amplitude.AmplitudeUtils
import org.go.sopt.winey.util.amplitude.type.EventType
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.go.sopt.winey.presentation.main.feed
package org.go.sopt.winey.presentation.main.feed.adapter

import android.view.LayoutInflater
import android.view.View
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.go.sopt.winey.presentation.main.feed
package org.go.sopt.winey.presentation.main.feed.adapter

import android.content.Context
import android.view.LayoutInflater
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.go.sopt.winey.presentation.main.feed
package org.go.sopt.winey.presentation.main.feed.adapter

import android.view.LayoutInflater
import android.view.ViewGroup
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.go.sopt.winey.presentation.main.feed
package org.go.sopt.winey.presentation.main.feed.adapter

import android.view.LayoutInflater
import android.view.ViewGroup
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import dagger.hilt.android.AndroidEntryPoint
import org.go.sopt.winey.R
import org.go.sopt.winey.databinding.ActivityUploadBinding
import org.go.sopt.winey.presentation.main.feed.WineyFeedFragment
import org.go.sopt.winey.presentation.main.feed.WineyFeedType
import org.go.sopt.winey.presentation.model.WineyFeedType
import org.go.sopt.winey.util.binding.BindingActivity
import org.go.sopt.winey.util.intent.getCompatibleSerializable

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import okhttp3.RequestBody
import okhttp3.RequestBody.Companion.toRequestBody
import org.go.sopt.winey.data.model.remote.response.ResponsePostWineyFeedDto
import org.go.sopt.winey.domain.repository.FeedRepository
import org.go.sopt.winey.presentation.main.feed.WineyFeedType
import org.go.sopt.winey.presentation.model.WineyFeedType
import org.go.sopt.winey.util.code.ErrorCode
import org.go.sopt.winey.util.multipart.UriToRequestBody
import org.go.sopt.winey.util.view.InputUiState
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import kotlinx.coroutines.launch
import org.go.sopt.winey.R
import org.go.sopt.winey.databinding.FragmentMyfeedBinding
import org.go.sopt.winey.domain.entity.WineyFeed
import org.go.sopt.winey.presentation.main.feed.WineyFeedLoadAdapter
import org.go.sopt.winey.presentation.main.feed.adapter.WineyFeedLoadAdapter
import org.go.sopt.winey.presentation.main.feed.detail.DetailActivity
import org.go.sopt.winey.presentation.model.WineyDialogLabel
import org.go.sopt.winey.util.binding.BindingActivity
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import org.go.sopt.winey.R
import org.go.sopt.winey.databinding.ActivityNotificationBinding
import org.go.sopt.winey.presentation.main.MainActivity
import org.go.sopt.winey.presentation.main.feed.detail.DetailActivity
import org.go.sopt.winey.presentation.main.mypage.MypageHelpActivity
import org.go.sopt.winey.presentation.main.mypage.goal.GoalPathActivity
import org.go.sopt.winey.util.binding.BindingActivity
import org.go.sopt.winey.util.context.snackBar
import org.go.sopt.winey.util.view.UiState
Expand All @@ -22,6 +22,7 @@ class NotificationActivity :
BindingActivity<ActivityNotificationBinding>(R.layout.activity_notification) {
private val viewModel by viewModels<NotificationViewModel>()
private lateinit var notificationAdapter: NotificationAdapter

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
initNotificationAdapter()
Expand All @@ -34,8 +35,8 @@ class NotificationActivity :
private fun initNotificationAdapter() {
notificationAdapter = NotificationAdapter(
navigateFeedDetail = { feedId -> navigateToDetail(feedId) },
navigateLevelupHelp = { navigateToLevelupHelp() },
navigateMypage = { navigateToMypage() }
navigateGoalPath = { navigateToGoalPath() },
navigateMyPage = { navigateToMyPage() }
)
binding.rvNotificationPost.adapter = notificationAdapter
}
Expand Down Expand Up @@ -79,15 +80,15 @@ class NotificationActivity :
startActivity(intent)
}

private fun navigateToMypage() {
val intent = Intent(this, MainActivity::class.java)
intent.putExtra(MainActivity.KEY_TO_MYPAGE, true)
private fun navigateToGoalPath() {
val intent = Intent(this, GoalPathActivity::class.java)
startActivity(intent)
this.finish()
}

private fun navigateToLevelupHelp() {
val intent = Intent(this, MypageHelpActivity::class.java)
private fun navigateToMyPage() {
val intent = Intent(this, MainActivity::class.java)
intent.putExtra(MainActivity.KEY_TO_MY_PAGE, true)
startActivity(intent)
this.finish()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@ import androidx.recyclerview.widget.ListAdapter
import androidx.recyclerview.widget.RecyclerView
import org.go.sopt.winey.databinding.ItemNotificationPostBinding
import org.go.sopt.winey.domain.entity.Notification
import org.go.sopt.winey.presentation.model.NotificationType
import org.go.sopt.winey.util.view.ItemDiffCallback

class NotificationAdapter(
private val navigateFeedDetail: (feedId: Int?) -> Unit,
private val navigateMypage: () -> Unit,
private val navigateLevelupHelp: () -> Unit
private val navigateMyPage: () -> Unit,
private val navigateGoalPath: () -> Unit
) :
ListAdapter<Notification, NotificationAdapter.NotificationViewHolder>(DiffUtil) {

Expand All @@ -26,11 +27,12 @@ class NotificationAdapter(
data.notiReceiver == data.notiMessage.substring(0, data.notiReceiver.length)
}
}

class NotificationViewHolder(
private val binding: ItemNotificationPostBinding,
private val navigateFeedDetail: (feedId: Int?) -> Unit,
private val navigateMypage: () -> Unit,
private val navigateLevelupHelp: () -> Unit
private val navigateMyPage: () -> Unit,
private val navigateGoalPath: () -> Unit
) : RecyclerView.ViewHolder(binding.root) {

fun onBind(data: Notification?) {
Expand All @@ -39,13 +41,16 @@ class NotificationAdapter(
if (data == null) {
return
}

binding.root.setOnClickListener {
when (data?.notiType) {
"HOWTOLEVELUP" -> navigateLevelupHelp.invoke()
"LIKENOTI", "COMMENTNOTI" -> navigateFeedDetail(data.linkId)
else -> navigateMypage.invoke()
when (data.notiType) {
NotificationType.LIKE_NOTIFICATION.key,
NotificationType.COMMENT_NOTIFICATION.key -> navigateFeedDetail(data.linkId)
NotificationType.HOW_TO_LEVEL_UP.key -> navigateGoalPath.invoke()
else -> navigateMyPage.invoke()
}
}

executePendingBindings()
}
}
Expand All @@ -54,7 +59,7 @@ class NotificationAdapter(
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): NotificationViewHolder {
val binding =
ItemNotificationPostBinding.inflate(LayoutInflater.from(parent.context), parent, false)
return NotificationViewHolder(binding, navigateFeedDetail, navigateMypage, navigateLevelupHelp)
return NotificationViewHolder(binding, navigateFeedDetail, navigateMyPage, navigateGoalPath)
}

override fun onBindViewHolder(holder: NotificationViewHolder, position: Int) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.go.sopt.winey.presentation.main.feed
package org.go.sopt.winey.presentation.model

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

import android.app.Activity
import android.content.Intent
import android.os.Build
import android.os.Bundle
Expand All @@ -27,6 +26,7 @@ import org.go.sopt.winey.presentation.main.MainActivity
import org.go.sopt.winey.presentation.onboarding.guide.GuideActivity
import org.go.sopt.winey.util.binding.BindingActivity
import org.go.sopt.winey.util.context.colorOf
import org.go.sopt.winey.util.context.snackBar
import timber.log.Timber
import javax.inject.Inject

Expand Down Expand Up @@ -111,15 +111,10 @@ 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 ->
val appUpdateInfoTask = appUpdateManager.appUpdateInfo

appUpdateInfoTask.addOnSuccessListener { appUpdateInfo ->
if (appUpdateInfo.updateAvailability() == UpdateAvailability.UPDATE_AVAILABLE &&
appUpdateInfo.isUpdateTypeAllowed(AppUpdateType.IMMEDIATE)
) {
Expand All @@ -129,6 +124,10 @@ class SplashActivity : BindingActivity<ActivitySplashBinding>(R.layout.activity_
checkAutoLogin()
}
}

appUpdateInfoTask.addOnFailureListener { t ->
snackBar(binding.root) { t.message.toString() }
}
}

private fun requestImmediateUpdate(appUpdateInfo: AppUpdateInfo) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import coil.load
import coil.transform.RoundedCornersTransformation
import de.hdodenhof.circleimageview.CircleImageView
import org.go.sopt.winey.R
import org.go.sopt.winey.presentation.main.feed.WineyFeedType
import org.go.sopt.winey.presentation.model.WineyFeedType
import org.go.sopt.winey.presentation.model.UserLevel
import org.go.sopt.winey.presentation.nickname.NicknameActivity.Companion.MY_PAGE_SCREEN
import org.go.sopt.winey.presentation.nickname.NicknameActivity.Companion.STORY_SCREEN
Expand Down
2 changes: 1 addition & 1 deletion buildSrc/src/main/java/DefaultConfig.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ object DefaultConfig {
const val compileSdk = 33
const val minSdk = 28
const val targetSdk = 33
const val versionCode = 23
const val versionCode = 25
const val versionName = "1.1.0"
}

0 comments on commit c955428

Please sign in to comment.