diff --git a/app/build.gradle.kts b/app/build.gradle.kts index ce380077..d624efb5 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -6,7 +6,6 @@ plugins { kotlin("kapt") id("kotlin-parcelize") id("dagger.hilt.android.plugin") - id("com.google.android.gms.oss-licenses-plugin") } android { @@ -108,7 +107,6 @@ dependencies { implementation(retrofit) implementation(retrofitJsonConverter) implementation(timber) - implementation(ossLicense) } KakaoDependencies.run { diff --git a/build.gradle.kts b/build.gradle.kts index bdb5eb82..c5a9d7e8 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -9,7 +9,6 @@ buildscript { classpath(ClassPathPlugins.gradle) classpath(ClassPathPlugins.kotlinGradle) classpath(ClassPathPlugins.hilt) - classpath(ClassPathPlugins.oss) } } diff --git a/buildSrc/src/main/kotlin/Constants.kt b/buildSrc/src/main/kotlin/Constants.kt index 53c1ee82..74826f23 100644 --- a/buildSrc/src/main/kotlin/Constants.kt +++ b/buildSrc/src/main/kotlin/Constants.kt @@ -3,6 +3,6 @@ object Constants { const val compileSdk = 34 const val minSdk = 28 const val targetSdk = 34 - const val versionCode = 4 - const val versionName = "1.0.1" + const val versionCode = 5 + const val versionName = "1.0.2" } diff --git a/buildSrc/src/main/kotlin/Dependencies.kt b/buildSrc/src/main/kotlin/Dependencies.kt index 97fd1339..e091cddd 100644 --- a/buildSrc/src/main/kotlin/Dependencies.kt +++ b/buildSrc/src/main/kotlin/Dependencies.kt @@ -30,10 +30,8 @@ object AndroidXDependencies { "androidx.lifecycle:lifecycle-common-java8:${Versions.lifecycleVersion}" const val workManager = "androidx.work:work-runtime-ktx:${Versions.workManagerVersion}" - const val hiltWorkManager = "androidx.hilt:hilt-work:1.0.0" + const val hiltWorkManager = "androidx.hilt:hilt-work:${Versions.hiltWorkVersion}" const val hilt = "com.google.dagger:hilt-android:${Versions.hiltVersion}" - const val ossLicense = - "com.google.android.gms:play-services-oss-licenses:${Versions.ossVersion}" } object TestDependencies { @@ -42,41 +40,37 @@ object TestDependencies { const val espresso = "androidx.test.espresso:espresso-core:${Versions.espressoVersion}" } -object MaterialDesignDependencies { +object GoogleDependencies { const val materialDesign = "com.google.android.material:material:${Versions.materialDesignVersion}" + const val mlkit = "com.google.mlkit:text-recognition-korean:${Versions.mlkitVersion}" + const val appUpdate = "com.google.android.play:app-update-ktx:${Versions.appUpdateVersion}" } object KaptDependencies { const val hiltAndroidCompiler = "com.google.dagger:hilt-compiler:${Versions.hiltVersion}" const val hiltCompiler = "com.google.dagger:hilt-compiler:${Versions.hiltVersion}" - const val hiltWorkManagerCompiler = "androidx.hilt:hilt-compiler:1.0.0" + const val hiltWorkManagerCompiler = "androidx.hilt:hilt-compiler:${Versions.hiltWorkVersion}" } object ThirdPartyDependencies { - const val coil = "io.coil-kt:coil:${Versions.coilVersion}" - const val retrofit = "com.squareup.retrofit2:retrofit:${Versions.retrofitVersion}" const val retrofitJsonConverter = "com.jakewharton.retrofit:retrofit2-kotlinx-serialization-converter:${Versions.kotlinSerializationConverterVersion}" + const val okHttpBom = "com.squareup.okhttp3:okhttp-bom:${Versions.okHttpVersion}" const val okHttp = "com.squareup.okhttp3:okhttp" const val okHttpLoggingInterceptor = "com.squareup.okhttp3:logging-interceptor" const val timber = "com.jakewharton.timber:timber:${Versions.timberVersion}" - - const val ossLicense = - "com.google.android.gms:play-services-oss-licenses:${Versions.ossVersion}" + const val coil = "io.coil-kt:coil:${Versions.coilVersion}" + const val lottie = "com.airbnb.android:lottie:${Versions.lottieVersion}" const val progressView = "com.github.skydoves:progressview:${Versions.progressViewVersion}" const val balloon = "com.github.skydoves:balloon:${Versions.balloonVersion}" - const val lottie = "com.airbnb.android:lottie:${Versions.lottieVersion}" + const val circleIndicator = "me.relex:circleindicator:${Versions.circleIndicatorVersion}" const val circularProgressBar = "com.mikhaellopez:circularprogressbar:${Versions.circularProgressBar}" - const val circleIndicator = "me.relex:circleindicator:${Versions.circleIndicatorVersion}" - const val shimmer = "com.facebook.shimmer:shimmer:${Versions.shimmerVersion}" - - const val mlkit = "com.google.mlkit:text-recognition-korean:${Versions.mlkitVersion}" } object JitpackDependencies { @@ -87,7 +81,6 @@ object ClassPathPlugins { const val gradle = "com.android.tools.build:gradle:${Versions.gradleVersion}" const val kotlinGradle = "org.jetbrains.kotlin:kotlin-gradle-plugin:${Versions.kotlinVersion}" const val hilt = "com.google.dagger:hilt-android-gradle-plugin:${Versions.hiltVersion}" - const val oss = "com.google.android.gms:oss-licenses-plugin:${Versions.ossPluginVersion}" } object FirebaseDependencies { diff --git a/buildSrc/src/main/kotlin/Versions.kt b/buildSrc/src/main/kotlin/Versions.kt index f69b779d..3d1bc2e4 100644 --- a/buildSrc/src/main/kotlin/Versions.kt +++ b/buildSrc/src/main/kotlin/Versions.kt @@ -14,13 +14,12 @@ object Versions { const val legacySupportVersion = "1.0.0" const val securityVersion = "1.1.0-alpha06" const val hiltVersion = "2.46.1" + const val hiltWorkVersion = "1.0.0" const val fragmentKtxVersion = "1.5.7" const val navigationVersion = "2.7.7" const val webkitVersion = "1.8.0" const val coroutinesAndroidVersion = "1.7.1" const val lifecycleVersion = "2.6.1" - const val ossPluginVersion = "0.10.4" - const val ossVersion = "17.0.0" const val splashVersion = "1.0.1" const val workManagerVersion = "2.8.1" const val coilVersion = "2.4.0" @@ -34,8 +33,8 @@ object Versions { const val circularProgressBar = "3.1.0" const val kakaoVersion = "2.20.3" const val circleIndicatorVersion = "2.1.6" - const val shimmerVersion = "0.5.0" const val mlkitVersion = "16.0.0" + const val appUpdateVersion = "2.1.0" const val iamportVersion = "v1.4.5" diff --git a/core/build.gradle.kts b/core/build.gradle.kts index 9ae9393b..916bf83b 100644 --- a/core/build.gradle.kts +++ b/core/build.gradle.kts @@ -37,7 +37,7 @@ dependencies { implementation(AndroidXDependencies.lifeCycleKtx) // Material Design - implementation(MaterialDesignDependencies.materialDesign) + implementation(GoogleDependencies.materialDesign) // Hilt implementation(AndroidXDependencies.hilt) @@ -47,4 +47,4 @@ dependencies { testImplementation(TestDependencies.jUnit) androidTestImplementation(TestDependencies.androidTest) androidTestImplementation(TestDependencies.espresso) -} \ No newline at end of file +} diff --git a/data/src/main/java/co/orange/data/dto/response/SellInfoDto.kt b/data/src/main/java/co/orange/data/dto/response/SellInfoDto.kt index 4c31f1ea..d2e1bd5f 100644 --- a/data/src/main/java/co/orange/data/dto/response/SellInfoDto.kt +++ b/data/src/main/java/co/orange/data/dto/response/SellInfoDto.kt @@ -19,15 +19,15 @@ data class SellInfoDto( @SerialName("salePrice") val salePrice: Int, @SerialName("orderId") - val orderId: String, - @SerialName("buyerNickname") - val buyerNickname: String, + val orderId: String?, + @SerialName("buyerNickName") + val buyerNickname: String?, @SerialName("paidAt") - val paidAt: String, + val paidAt: String?, @SerialName("addressInfo") val addressInfo: AddressInfoDto, @SerialName("paymentMethod") - val paymentMethod: String, + val paymentMethod: String?, ) { fun toModel() = SellInfoModel( diff --git a/domain/src/main/kotlin/co/orange/domain/entity/response/SellInfoModel.kt b/domain/src/main/kotlin/co/orange/domain/entity/response/SellInfoModel.kt index 75c50de0..68d546c0 100644 --- a/domain/src/main/kotlin/co/orange/domain/entity/response/SellInfoModel.kt +++ b/domain/src/main/kotlin/co/orange/domain/entity/response/SellInfoModel.kt @@ -7,9 +7,9 @@ data class SellInfoModel( val imgUrl: String, val originPrice: Int, val salePrice: Int, - val orderId: String, - val buyerNickname: String, - val paidAt: String, + val orderId: String?, + val buyerNickname: String?, + val paidAt: String?, val addressInfo: AddressInfoModel, - val paymentMethod: String, + val paymentMethod: String?, ) diff --git a/presentation/build.gradle.kts b/presentation/build.gradle.kts index 2804b62c..d0f9a606 100644 --- a/presentation/build.gradle.kts +++ b/presentation/build.gradle.kts @@ -88,8 +88,10 @@ dependencies { kapt(hiltWorkManagerCompiler) } - MaterialDesignDependencies.run { + GoogleDependencies.run { implementation(materialDesign) + implementation(mlkit) + implementation(appUpdate) } TestDependencies.run { @@ -101,13 +103,11 @@ dependencies { ThirdPartyDependencies.run { implementation(coil) implementation(timber) - implementation(ossLicense) implementation(progressView) implementation(balloon) implementation(lottie) implementation(circularProgressBar) implementation(circleIndicator) - implementation(mlkit) } JitpackDependencies.run { diff --git a/presentation/src/main/java/co/orange/presentation/sell/info/SellInfoActivity.kt b/presentation/src/main/java/co/orange/presentation/sell/info/SellInfoActivity.kt index b8fcb058..8a73ed76 100644 --- a/presentation/src/main/java/co/orange/presentation/sell/info/SellInfoActivity.kt +++ b/presentation/src/main/java/co/orange/presentation/sell/info/SellInfoActivity.kt @@ -89,7 +89,7 @@ class SellInfoActivity : tvInfoDeliveryPhone.text = item.addressInfo.recipientPhone tvInfoTransactionMethod.text = item.paymentMethod tvInfoTransactionDate.text = - item.paidAt.convertDateTime(OLD_DATE_PATTERN, NEW_DATE_PATTERN) + item.paidAt?.convertDateTime(OLD_DATE_PATTERN, NEW_DATE_PATTERN) tvInfoPayKakao.text = item.originPrice.setPriceForm() tvInfoPayReal.text = item.salePrice.setPriceForm() tvInfoPayTotal.text = item.salePrice.setPriceForm() @@ -127,7 +127,7 @@ class SellInfoActivity : btnSellConfirm.setText(btnTextResId) btnSellConfirm.isEnabled = isButtonEnabled ivSellToast.isVisible = isButtonEnabled - if (status != ItemStatus.ON_SALE.name) { + if (status == ItemStatus.ON_SALE.name) { tvInfoTransaction.isVisible = false layoutInfoBuyer.isVisible = false layoutInfoDelivery.isVisible = false diff --git a/presentation/src/main/java/co/orange/presentation/sell/info/SellInfoViewModel.kt b/presentation/src/main/java/co/orange/presentation/sell/info/SellInfoViewModel.kt index 8a7bce2d..dd72b25d 100644 --- a/presentation/src/main/java/co/orange/presentation/sell/info/SellInfoViewModel.kt +++ b/presentation/src/main/java/co/orange/presentation/sell/info/SellInfoViewModel.kt @@ -28,7 +28,7 @@ class SellInfoViewModel viewModelScope.launch { sellRepository.getItemDetailInfo(itemId) .onSuccess { - orderId = it.orderId + orderId = it.orderId.orEmpty() _getSellInfoState.value = UiState.Success(it) }.onFailure { _getSellInfoState.value = UiState.Failure(it.message.orEmpty()) diff --git a/presentation/src/main/java/co/orange/presentation/sell/onboarding/SellOnboardingViewModel.kt b/presentation/src/main/java/co/orange/presentation/sell/onboarding/SellOnboardingViewModel.kt index b084f4b9..248f45d9 100644 --- a/presentation/src/main/java/co/orange/presentation/sell/onboarding/SellOnboardingViewModel.kt +++ b/presentation/src/main/java/co/orange/presentation/sell/onboarding/SellOnboardingViewModel.kt @@ -54,7 +54,7 @@ class SellOnboardingViewModel viewModelScope.launch { sellRepository.getSignedUrl(selectedImageName) .onSuccess { - uploadedUrl = it.signedUrl + uploadedUrl = URL_GCP + selectedImageName putImageToCloud(it.signedUrl) } .onFailure { @@ -95,4 +95,8 @@ class SellOnboardingViewModel fun resetProductIdState() { _changingImageState.value = UiState.Empty } + + companion object { + private const val URL_GCP = "https://storage.googleapis.com/ddanzi_bucket/" + } } diff --git a/presentation/src/main/java/co/orange/presentation/splash/SplashActivity.kt b/presentation/src/main/java/co/orange/presentation/splash/SplashActivity.kt index a20560aa..09d1ecf0 100644 --- a/presentation/src/main/java/co/orange/presentation/splash/SplashActivity.kt +++ b/presentation/src/main/java/co/orange/presentation/splash/SplashActivity.kt @@ -3,42 +3,97 @@ package co.orange.presentation.splash import android.app.AlertDialog import android.content.Intent import android.os.Bundle +import androidx.activity.result.ActivityResultLauncher +import androidx.activity.result.IntentSenderRequest +import androidx.activity.result.contract.ActivityResultContracts import androidx.lifecycle.lifecycleScope import co.orange.core.base.BaseActivity import co.orange.core.extension.setNavigationBarColorFromResource import co.orange.core.extension.setStatusBarColorFromResource +import co.orange.core.extension.toast import co.orange.presentation.main.MainActivity +import com.google.android.play.core.appupdate.AppUpdateInfo +import com.google.android.play.core.appupdate.AppUpdateManagerFactory +import com.google.android.play.core.appupdate.AppUpdateOptions +import com.google.android.play.core.install.model.AppUpdateType.IMMEDIATE +import com.google.android.play.core.install.model.UpdateAvailability.UPDATE_AVAILABLE import dagger.hilt.android.AndroidEntryPoint import kotlinx.coroutines.delay import kotlinx.coroutines.launch +import kr.genti.presentation.BuildConfig import kr.genti.presentation.R import kr.genti.presentation.databinding.ActivitySplashBinding @AndroidEntryPoint class SplashActivity : BaseActivity(R.layout.activity_splash) { + private val appUpdateManager by lazy { AppUpdateManagerFactory.create(this) } + + private val activityResultLauncher: ActivityResultLauncher = + registerForActivityResult(ActivityResultContracts.StartIntentSenderForResult()) { + if (it.resultCode != RESULT_OK) { + toast("업데이트가 취소되었습니다.") + finishAffinity() + } + } + override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) - setStatusBarColor() - setNavigationBarColor() + setStatusBarColorFromResource(R.color.black) + setNavigationBarColorFromResource(R.color.black) + } + + override fun onResume() { + super.onResume() checkConnectedNetwork() } - private fun setStatusBarColor() = setStatusBarColorFromResource(R.color.black) + private fun checkConnectedNetwork() { + if (NetworkManager.checkNetworkState(this@SplashActivity)) { + checkAppUpdateAvailable() + } else { + showNetworkErrorAlertDialog() + } + } + + private fun checkAppUpdateAvailable() { + if (BuildConfig.DEBUG) { + navigateToMain() + } else { + appUpdateManager.appUpdateInfo.addOnSuccessListener { appUpdateInfo -> + if (isAppUpdateNeeded(appUpdateInfo)) { + requestUpdate(appUpdateInfo) + } else { + navigateToMain() + } + }.addOnFailureListener { + toast("업데이트에 실패했습니다.") + navigateToMain() + } + } + } + + private fun isAppUpdateNeeded(appUpdateInfo: AppUpdateInfo) = + appUpdateInfo.updateAvailability() == UPDATE_AVAILABLE && + appUpdateInfo.isUpdateTypeAllowed(IMMEDIATE) - private fun setNavigationBarColor() = setNavigationBarColorFromResource(R.color.black) + private fun requestUpdate(appUpdateInfo: AppUpdateInfo) { + runCatching { + appUpdateManager.startUpdateFlowForResult( + appUpdateInfo, + activityResultLauncher, + AppUpdateOptions.newBuilder(IMMEDIATE).build(), + ) + } + } - private fun checkConnectedNetwork() { + private fun navigateToMain() { lifecycleScope.launch { delay(DELAY_TIME) - if (NetworkManager.checkNetworkState(this@SplashActivity)) { - Intent(this@SplashActivity, MainActivity::class.java).apply { - startActivity(this) - } - finish() - } else { - showNetworkErrorAlertDialog() + Intent(this@SplashActivity, MainActivity::class.java).apply { + startActivity(this) } + finish() } } diff --git a/presentation/src/main/res/layout/activity_sell_info.xml b/presentation/src/main/res/layout/activity_sell_info.xml index 2e3d8796..df6608d9 100644 --- a/presentation/src/main/res/layout/activity_sell_info.xml +++ b/presentation/src/main/res/layout/activity_sell_info.xml @@ -77,10 +77,10 @@ android:layout_width="0dp" android:layout_height="wrap_content" android:gravity="center" - android:text="@string/sell_info_tv_message" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toTopOf="parent" /> + app:layout_constraintTop_toTopOf="parent" + tools:text="@string/sell_info_tv_message" /> + app:layout_constraintTop_toBottomOf="@id/tv_info_product_title" + tools:src="@drawable/mock_img_product" /> 상품 등록 완료 상품 등록이 완료되었습니다. - 주문 확인 후 거래가 진행됩니다. 근데 여기서 뭔가 설명문을 좀 적어야 할 것 같은데? + 주문 확인 후 거래가 진행됩니다.\n거래가 성사되면 판매를 확정해주세요. 상품 등록 확인 상품 추가 등록