Skip to content
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
9 changes: 6 additions & 3 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ plugins {
alias(libs.plugins.hilt)
alias(libs.plugins.ksp)
alias(libs.plugins.google.services)
alias(libs.plugins.firebase.crashlytics)
}

val localProperties =
Expand All @@ -21,8 +22,8 @@ android {

defaultConfig {
applicationId = "com.sseotdabwa.buyornot"
versionCode = 1
versionName = "1.0.0"
versionCode = 2
versionName = "0.0.1"

buildConfigField("String", "KAKAO_NATIVE_APP_KEY", "\"${localProperties.getProperty("kakao.nativeAppKey", "")}\"")
manifestPlaceholders["NATIVE_APP_KEY"] = localProperties.getProperty("kakao.nativeAppKey", "")
Expand Down Expand Up @@ -59,7 +60,8 @@ android {
signingConfig = signingConfigs.getByName("release")
}
release {
isMinifyEnabled = false
isMinifyEnabled = true
isShrinkResources = true
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro",
Expand Down Expand Up @@ -104,6 +106,7 @@ dependencies {

implementation(platform(libs.firebase.bom))
implementation(libs.firebase.messaging)
implementation(libs.firebase.crashlytics)

ksp(libs.hilt.compiler)

Expand Down
81 changes: 60 additions & 21 deletions app/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -1,21 +1,60 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}

# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable

# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
# [Common] Android
-keepattributes SourceFile,LineNumberTable
-keepattributes *Annotation*
-keepattributes Signature
-keepattributes InnerClasses
-dontwarn sun.misc.**
-dontwarn javax.annotation.**

# [Kotlin]
-keep class kotlin.Metadata { *; }

# [Hilt / Dagger]
-keep class dagger.hilt.** { *; }
-keep class com.google.dagger.** { *; }
-keep @dagger.hilt.android.lifecycle.HiltViewModel class *
-keep interface * extends javax.inject.Provider

# [Retrofit / OkHttp]
-keep class retrofit2.** { *; }
-dontwarn retrofit2.**
-keepattributes *Annotation*
-keepclassmembers class * {
@retrofit2.http.* <methods>;
}
-keep class okhttp3.** { *; }
-dontwarn okhttp3.**
-dontwarn okio.**

# [Kotlinx Serialization]
-keepattributes *Annotation*, InnerClasses
-keepclassmembers class * {
@kotlinx.serialization.Serializable *;
}
-keepclassmembers class * {
kotlinx.serialization.KSerializer serializer(...);
}

# [Domain/Data Models] - API 톡신 데이터 클래슀 보쑴
# λͺ¨λ“  λͺ¨λ“ˆμ˜ domain.model, network.model ν•˜μœ„μ˜ ν΄λž˜μŠ€λ“€μ„ λ³΄μ‘΄ν•©λ‹ˆλ‹€.
-keep class com.sseotdabwa.buyornot.domain.model.** { *; }
-keep class com.sseotdabwa.buyornot.core.network.model.** { *; }

# [Coil]
-keep class coil.** { *; }
-dontwarn coil.**

# [Firebase]
-keep class com.google.firebase.** { *; }
-dontwarn com.google.firebase.**

# [Lottie]
-keep class com.airbnb.lottie.** { *; }

# [Kakao SDK]
-keep class com.kakao.sdk.** { *; }
-dontwarn com.kakao.sdk.**

# [Jetpack Compose]
-keep class androidx.compose.runtime.RecomposeScopeImpl { *; }
-keep class * implements androidx.compose.runtime.Parcelable { *; }
1 change: 1 addition & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
<uses-permission android:name="com.google.android.gms.permission.AD_ID" />

<application
android:name=".BuyOrNotApplication"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import com.sseotdabwa.buyornot.feature.auth.navigation.splashScreen
import com.sseotdabwa.buyornot.feature.home.navigation.homeScreen
import com.sseotdabwa.buyornot.feature.home.navigation.navigateToHome
import com.sseotdabwa.buyornot.feature.home.navigation.navigateToHomeWithTab
import com.sseotdabwa.buyornot.feature.home.viewmodel.HomeTab
import com.sseotdabwa.buyornot.feature.home.ui.HomeTab
import com.sseotdabwa.buyornot.feature.mypage.navigation.myPageGraph
import com.sseotdabwa.buyornot.feature.mypage.navigation.navigateToMyPage
import com.sseotdabwa.buyornot.feature.notification.navigation.navigateToNotification
Expand Down
1 change: 1 addition & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ plugins {
alias(libs.plugins.ksp) apply false
alias(libs.plugins.ktlint) apply false
alias(libs.plugins.google.services) apply false
alias(libs.plugins.firebase.crashlytics) apply false
}

apply(from = "gradle/dependencyGraph.gradle")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import androidx.navigation.NavType
import androidx.navigation.compose.composable
import androidx.navigation.navArgument
import com.sseotdabwa.buyornot.feature.home.ui.HomeRoute
import com.sseotdabwa.buyornot.feature.home.viewmodel.HomeTab
import com.sseotdabwa.buyornot.feature.home.ui.HomeTab

const val HOME_ROUTE = "home"
const val HOME_ROUTE_WITH_TAB = "home?tab={tab}"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.sseotdabwa.buyornot.feature.home.viewmodel
package com.sseotdabwa.buyornot.feature.home.ui

import androidx.compose.runtime.Immutable
import com.sseotdabwa.buyornot.core.designsystem.components.ImageAspectRatio
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,6 @@ import com.sseotdabwa.buyornot.core.designsystem.icon.BuyOrNotIcons
import com.sseotdabwa.buyornot.core.designsystem.icon.asImageVector
import com.sseotdabwa.buyornot.core.designsystem.theme.BuyOrNotTheme
import com.sseotdabwa.buyornot.domain.model.UserType
import com.sseotdabwa.buyornot.feature.home.viewmodel.FeedItem
import com.sseotdabwa.buyornot.feature.home.viewmodel.FilterChip
import com.sseotdabwa.buyornot.feature.home.viewmodel.HomeIntent
import com.sseotdabwa.buyornot.feature.home.viewmodel.HomeSideEffect
import com.sseotdabwa.buyornot.feature.home.viewmodel.HomeTab
import com.sseotdabwa.buyornot.feature.home.viewmodel.HomeUiState
import kotlinx.coroutines.flow.distinctUntilChanged
import kotlinx.coroutines.flow.filter
import kotlin.math.roundToInt
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,6 @@ import com.sseotdabwa.buyornot.domain.model.VoteChoice
import com.sseotdabwa.buyornot.domain.repository.FeedRepository
import com.sseotdabwa.buyornot.domain.repository.UserPreferencesRepository
import com.sseotdabwa.buyornot.domain.repository.UserRepository
import com.sseotdabwa.buyornot.feature.home.viewmodel.FeedItem
import com.sseotdabwa.buyornot.feature.home.viewmodel.FilterChip
import com.sseotdabwa.buyornot.feature.home.viewmodel.HomeIntent
import com.sseotdabwa.buyornot.feature.home.viewmodel.HomeSideEffect
import com.sseotdabwa.buyornot.feature.home.viewmodel.HomeTab
import com.sseotdabwa.buyornot.feature.home.viewmodel.HomeUiState
import dagger.hilt.android.lifecycle.HiltViewModel
import kotlinx.coroutines.flow.SharingStarted
import kotlinx.coroutines.flow.stateIn
Expand Down Expand Up @@ -210,6 +204,18 @@ class HomeViewModel @Inject constructor(
val previousFeeds = uiState.value.feeds
val previousCachedFeeds = cachedFeeds

// 본인 κΈ€ μ—¬λΆ€ 확인 (νˆ¬ν‘œ λ°©μ§€)
val targetFeed = cachedFeeds.find { it.id == feedId }
if (targetFeed?.isOwner == true) {
sendSideEffect(
HomeSideEffect.ShowSnackbar(
message = "μžμ‹ μ˜ κΈ€μ—λŠ” νˆ¬ν‘œν•  수 μ—†μŠ΅λ‹ˆλ‹€.",
icon = null,
),
)
return
}

// 1. 낙관적 μ—…λ°μ΄νŠΈ (Optimistic Update)
// API 호좜 μ „ UIλ₯Ό μ¦‰μ‹œ μ—…λ°μ΄νŠΈν•˜μ—¬ μ‚¬μš©μž κ²½ν—˜ κ°œμ„ 
val optimisticUpdate = { feeds: List<FeedItem> ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@ data class UploadUiState(
val showCategorySheet: Boolean = false,
val showExitDialog: Boolean = false,
val categories: List<FeedCategory> = FeedCategory.entries,
)
) {
val hasInput: Boolean
get() = selectedImageUri != null || category != null || price.isNotEmpty() || content.isNotEmpty()
}

sealed interface UploadIntent {
data class UpdateCategory(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,11 @@ fun UploadScreen(
}

BackHandler {
if (!uiState.showExitDialog) viewModel.handleIntent(UploadIntent.UpdateExitDialogVisibility(true))
if (uiState.hasInput) {
if (!uiState.showExitDialog) viewModel.handleIntent(UploadIntent.UpdateExitDialogVisibility(true))
} else {
onNavigateBack()
}
}

Column(
Expand All @@ -131,7 +135,11 @@ fun UploadScreen(
.windowInsetsPadding(WindowInsets.safeDrawing),
) {
BackTopBar {
viewModel.handleIntent(UploadIntent.UpdateExitDialogVisibility(true))
if (uiState.hasInput) {
viewModel.handleIntent(UploadIntent.UpdateExitDialogVisibility(true))
} else {
onNavigateBack()
}
}

Column(
Expand Down
5 changes: 4 additions & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,9 @@ googleid = "1.2.0"
lottie = "6.7.1"

# Firebase
firebaseBom = "33.9.0"
firebaseBom = "34.9.0"
googleServices = "4.4.2"
firebaseCrashlytics = "3.0.3"

# Code Quality
ktlint = "14.0.1"
Expand Down Expand Up @@ -120,6 +121,7 @@ androidx-compose-runtime = { group = "androidx.compose.runtime", name = "runtime
# Firebase
firebase-bom = { group = "com.google.firebase", name = "firebase-bom", version.ref = "firebaseBom" }
firebase-messaging = { group = "com.google.firebase", name = "firebase-messaging" }
firebase-crashlytics = { group = "com.google.firebase", name = "firebase-crashlytics" }

lottie-compose = { group = "com.airbnb.android", name = "lottie-compose", version.ref = "lottie" }

Expand All @@ -134,3 +136,4 @@ hilt = { id = "com.google.dagger.hilt.android", version.ref = "hilt" }
ksp = { id = "com.google.devtools.ksp", version.ref = "ksp" }
ktlint = { id = "org.jlleitschuh.gradle.ktlint", version.ref = "ktlint" }
google-services = { id = "com.google.gms.google-services", version.ref = "googleServices" }
firebase-crashlytics = { id = "com.google.firebase.crashlytics", version.ref = "firebaseCrashlytics" }
Loading