From 2db7cc8f8e64112694c30a87fb4a8aa64edf9235 Mon Sep 17 00:00:00 2001 From: Sangho Kim Date: Mon, 9 Sep 2024 23:16:54 +0900 Subject: [PATCH 01/14] =?UTF-8?q?[FIX/#129]=20=EA=B5=AC=EB=A7=A4=20?= =?UTF-8?q?=EA=B3=BC=EC=A0=95=20canceled=20=EB=8C=80=EC=9D=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/co/orange/buy/progress/BuyProgressActivity.kt | 7 ++----- .../java/co/orange/buy/progress/BuyProgressViewModel.kt | 7 ++----- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/feature/buy/src/main/java/co/orange/buy/progress/BuyProgressActivity.kt b/feature/buy/src/main/java/co/orange/buy/progress/BuyProgressActivity.kt index 1381f21a..b9ae2366 100644 --- a/feature/buy/src/main/java/co/orange/buy/progress/BuyProgressActivity.kt +++ b/feature/buy/src/main/java/co/orange/buy/progress/BuyProgressActivity.kt @@ -188,7 +188,8 @@ class BuyProgressActivity : iamPortRequest = request, ) { response -> Timber.tag("okhttp").d("IAMPORT PURCHASE RESPONSE : $response") - viewModel.patchPayEndToServer(response?.error_code) + if (response == null) return@payment + viewModel.patchPayEndToServer(response.success) } } @@ -198,10 +199,6 @@ class BuyProgressActivity : when (state) { is UiState.Success -> { if (state.data.payStatus == PAY_SUCCESS) { - if (viewModel.isOrderCanceled) { - viewModel.isOrderCanceled = false - return@onEach - } viewModel.postToRequestOrderToServer() } else { toast(stringOf(R.string.error_msg)) diff --git a/feature/buy/src/main/java/co/orange/buy/progress/BuyProgressViewModel.kt b/feature/buy/src/main/java/co/orange/buy/progress/BuyProgressViewModel.kt index e8fe5650..40403f51 100644 --- a/feature/buy/src/main/java/co/orange/buy/progress/BuyProgressViewModel.kt +++ b/feature/buy/src/main/java/co/orange/buy/progress/BuyProgressViewModel.kt @@ -41,7 +41,6 @@ class BuyProgressViewModel var isTermPurchaseSelected = MutableLiveData(false) var isCompleted = MutableLiveData(false) var isOrderStarted = false - var isOrderCanceled = false private val _getBuyDataState = MutableStateFlow>(UiState.Empty) val getBuyDataState: StateFlow> = _getBuyDataState @@ -142,16 +141,15 @@ class BuyProgressViewModel } } - fun patchPayEndToServer(errorCode: String?) { + fun patchPayEndToServer(isSuccess: Boolean?) { _patchPayEndState.value = UiState.Loading viewModelScope.launch { buyRepository.patchPaymentEnd( PayEndRequestModel( orderId, - if (errorCode.isNullOrEmpty()) PAY_SUCCESS else PAY_FAILURE, + if (isSuccess != false) PAY_SUCCESS else PAY_FAILURE, ), ).onSuccess { - isOrderCanceled = errorCode == ERROR_CANCELED _patchPayEndState.value = UiState.Success(it) }.onFailure { _patchPayEndState.value = UiState.Failure(it.message.orEmpty()) @@ -179,7 +177,6 @@ class BuyProgressViewModel private const val NICE_PAYMENTS = "nice_v2.$PAYMENT_UID" private const val PAYMENT_DEFAULT = "card" - private const val ERROR_CANCELED = "F400" private const val PAY_STATUS_PENDING = "PENDING" const val PAY_SUCCESS = "PAID" From 67dee4ad342a3e884324733cb7c57c88172250bd Mon Sep 17 00:00:00 2001 From: Sangho Kim Date: Tue, 10 Sep 2024 18:22:59 +0900 Subject: [PATCH 02/14] =?UTF-8?q?[ADD/#129]=20=EC=95=B0=ED=94=8C=EB=A6=AC?= =?UTF-8?q?=ED=8A=9C=EB=93=9C=20apikey=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/build.gradle.kts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 7a4f3704..1b20a575 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -46,6 +46,11 @@ android { "BASE_URL", gradleLocalProperties(rootDir).getProperty("dev.base.url"), ) + buildConfigField( + "String", + "AMPLITUDE_KEY", + gradleLocalProperties(rootDir).getProperty("dev.amplitude.key"), + ) } release { buildConfigField( @@ -53,6 +58,11 @@ android { "BASE_URL", gradleLocalProperties(rootDir).getProperty("base.url"), ) + buildConfigField( + "String", + "AMPLITUDE_KEY", + gradleLocalProperties(rootDir).getProperty("amplitude.key"), + ) isMinifyEnabled = false proguardFiles( From 48b449684277c0ccfb848fd1ce0468f7f8332b0b Mon Sep 17 00:00:00 2001 From: Sangho Kim Date: Tue, 10 Sep 2024 18:26:34 +0900 Subject: [PATCH 03/14] =?UTF-8?q?[ADD/#129]=20Amplitude=20dependency=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/build.gradle.kts | 1 + app/src/main/AndroidManifest.xml | 1 + .../ddanzi/di/module/NavigationModule.kt | 2 +- .../orange/ddanzi/manager/AmplitudeManager.kt | 59 +++++++++++++++++++ .../navigate/NavigationManagerImpl.kt | 2 +- buildSrc/src/main/kotlin/Dependencies.kt | 1 + buildSrc/src/main/kotlin/Versions.kt | 1 + 7 files changed, 65 insertions(+), 2 deletions(-) create mode 100644 app/src/main/java/co/orange/ddanzi/manager/AmplitudeManager.kt rename app/src/main/java/co/orange/ddanzi/{di => }/navigate/NavigationManagerImpl.kt (99%) diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 1b20a575..2a5e4554 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -130,6 +130,7 @@ dependencies { implementation(retrofit) implementation(retrofitJsonConverter) implementation(timber) + implementation(amplitude) } KakaoDependencies.run { diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index f6dbf212..b67c44bc 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -5,6 +5,7 @@ + ? = null, + properties2: Map? = null, + ) { + when { + properties1 == null && properties2 == null -> { + amplitude.track(eventName) + } + + properties1 != null && properties2 == null -> { + amplitude.track(eventName, properties1) + } + + properties1 != null && properties2 != null -> { + val combinedProperties = mutableMapOf() + combinedProperties.putAll(properties1) + combinedProperties.putAll(properties2) + amplitude.track(eventName, combinedProperties) + } + } + } + + fun updateProperties( + propertyName: String, + values: String, + ) { + amplitude.identify(Identify().set(propertyName, values)) + } + + fun updateIntProperties( + propertyName: String, + intValues: Int, + ) { + amplitude.identify(Identify().set(propertyName, intValues)) + } + + fun plusIntProperties(propertyName: String) { + amplitude.identify(Identify().add(propertyName, 1)) + } +} diff --git a/app/src/main/java/co/orange/ddanzi/di/navigate/NavigationManagerImpl.kt b/app/src/main/java/co/orange/ddanzi/navigate/NavigationManagerImpl.kt similarity index 99% rename from app/src/main/java/co/orange/ddanzi/di/navigate/NavigationManagerImpl.kt rename to app/src/main/java/co/orange/ddanzi/navigate/NavigationManagerImpl.kt index 63080d8b..e7eaa130 100644 --- a/app/src/main/java/co/orange/ddanzi/di/navigate/NavigationManagerImpl.kt +++ b/app/src/main/java/co/orange/ddanzi/navigate/NavigationManagerImpl.kt @@ -1,4 +1,4 @@ -package co.orange.ddanzi.di.navigate +package co.orange.ddanzi.navigate import android.content.Context import android.content.Intent diff --git a/buildSrc/src/main/kotlin/Dependencies.kt b/buildSrc/src/main/kotlin/Dependencies.kt index 1b6a66d3..a357b1c1 100644 --- a/buildSrc/src/main/kotlin/Dependencies.kt +++ b/buildSrc/src/main/kotlin/Dependencies.kt @@ -65,6 +65,7 @@ object ThirdPartyDependencies { const val timber = "com.jakewharton.timber:timber:${Versions.timberVersion}" const val coil = "io.coil-kt:coil:${Versions.coilVersion}" const val lottie = "com.airbnb.android:lottie:${Versions.lottieVersion}" + const val amplitude = "com.amplitude:analytics-android:${Versions.amplitudeVersion}" const val progressView = "com.github.skydoves:progressview:${Versions.progressViewVersion}" const val balloon = "com.github.skydoves:balloon:${Versions.balloonVersion}" diff --git a/buildSrc/src/main/kotlin/Versions.kt b/buildSrc/src/main/kotlin/Versions.kt index d5b8fb9a..b9a2e1b3 100644 --- a/buildSrc/src/main/kotlin/Versions.kt +++ b/buildSrc/src/main/kotlin/Versions.kt @@ -35,6 +35,7 @@ object Versions { const val circleIndicatorVersion = "2.1.6" const val mlkitVersion = "16.0.0" const val appUpdateVersion = "2.1.0" + const val amplitudeVersion = "1.17.3" const val iamportVersion = "v1.4.5" From 1847611765d9d17517eab4fbe08e33a63be66d21 Mon Sep 17 00:00:00 2001 From: Sangho Kim Date: Tue, 10 Sep 2024 18:32:33 +0900 Subject: [PATCH 04/14] =?UTF-8?q?[FEAT/#129]=20Amplitude=20Manager=20?= =?UTF-8?q?=EC=84=A4=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/java/co/orange/ddanzi/MyApp.kt | 7 +++++ .../orange/ddanzi/manager/AmplitudeManager.kt | 27 +++++++------------ 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/app/src/main/java/co/orange/ddanzi/MyApp.kt b/app/src/main/java/co/orange/ddanzi/MyApp.kt index 81b123ca..c548c533 100644 --- a/app/src/main/java/co/orange/ddanzi/MyApp.kt +++ b/app/src/main/java/co/orange/ddanzi/MyApp.kt @@ -2,7 +2,9 @@ package co.orange.ddanzi import android.app.Application import androidx.appcompat.app.AppCompatDelegate +import co.orange.ddanzi.BuildConfig.AMPLITUDE_KEY import co.orange.ddanzi.BuildConfig.NATIVE_APP_KEY +import co.orange.ddanzi.manager.AmplitudeManager import com.kakao.sdk.common.KakaoSdk import dagger.hilt.android.HiltAndroidApp import timber.log.Timber @@ -14,6 +16,7 @@ class MyApp : Application() { initTimber() initKakaoSdk() + initAmplitude() setDayMode() } @@ -25,6 +28,10 @@ class MyApp : Application() { KakaoSdk.init(this, NATIVE_APP_KEY) } + private fun initAmplitude() { + AmplitudeManager.init(this, AMPLITUDE_KEY) + } + private fun setDayMode() { AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO) } diff --git a/app/src/main/java/co/orange/ddanzi/manager/AmplitudeManager.kt b/app/src/main/java/co/orange/ddanzi/manager/AmplitudeManager.kt index dc4b61ec..97fb8ee5 100644 --- a/app/src/main/java/co/orange/ddanzi/manager/AmplitudeManager.kt +++ b/app/src/main/java/co/orange/ddanzi/manager/AmplitudeManager.kt @@ -1,5 +1,10 @@ package co.orange.ddanzi.manager +import android.content.Context +import com.amplitude.android.Amplitude +import com.amplitude.android.Configuration +import com.amplitude.android.events.Identify + object AmplitudeManager { private lateinit var amplitude: Amplitude @@ -18,24 +23,12 @@ object AmplitudeManager { fun trackEvent( eventName: String, - properties1: Map? = null, - properties2: Map? = null, + properties: Map? = null, ) { - when { - properties1 == null && properties2 == null -> { - amplitude.track(eventName) - } - - properties1 != null && properties2 == null -> { - amplitude.track(eventName, properties1) - } - - properties1 != null && properties2 != null -> { - val combinedProperties = mutableMapOf() - combinedProperties.putAll(properties1) - combinedProperties.putAll(properties2) - amplitude.track(eventName, combinedProperties) - } + if (properties == null) { + amplitude.track(eventName) + } else { + amplitude.track(eventName, properties) } } From 853be3a97a3cbfe4789fce6387f9827b9188a171 Mon Sep 17 00:00:00 2001 From: Sangho Kim Date: Tue, 10 Sep 2024 18:44:18 +0900 Subject: [PATCH 05/14] =?UTF-8?q?[FEAT/#129]=20Amplitude=20Manager=20core?= =?UTF-8?q?=20=EB=AA=A8=EB=93=88=20=EC=84=A4=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/build.gradle.kts | 1 - app/src/main/java/co/orange/ddanzi/MyApp.kt | 2 +- .../ddanzi/di/module/NavigationModule.kt | 2 +- .../NavigationManagerImpl.kt | 2 +- core/build.gradle.kts | 36 ++++++++++++------- .../core/amplitude}/AmplitudeManager.kt | 2 +- .../co/orange/auth/login/LoginActivity.kt | 2 ++ 7 files changed, 29 insertions(+), 18 deletions(-) rename app/src/main/java/co/orange/ddanzi/{navigate => navigation}/NavigationManagerImpl.kt (99%) rename {app/src/main/java/co/orange/ddanzi/manager => core/src/main/java/co/orange/core/amplitude}/AmplitudeManager.kt (97%) diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 2a5e4554..1b20a575 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -130,7 +130,6 @@ dependencies { implementation(retrofit) implementation(retrofitJsonConverter) implementation(timber) - implementation(amplitude) } KakaoDependencies.run { diff --git a/app/src/main/java/co/orange/ddanzi/MyApp.kt b/app/src/main/java/co/orange/ddanzi/MyApp.kt index c548c533..ea027f8a 100644 --- a/app/src/main/java/co/orange/ddanzi/MyApp.kt +++ b/app/src/main/java/co/orange/ddanzi/MyApp.kt @@ -2,9 +2,9 @@ package co.orange.ddanzi import android.app.Application import androidx.appcompat.app.AppCompatDelegate +import co.orange.core.amplitude.AmplitudeManager import co.orange.ddanzi.BuildConfig.AMPLITUDE_KEY import co.orange.ddanzi.BuildConfig.NATIVE_APP_KEY -import co.orange.ddanzi.manager.AmplitudeManager import com.kakao.sdk.common.KakaoSdk import dagger.hilt.android.HiltAndroidApp import timber.log.Timber diff --git a/app/src/main/java/co/orange/ddanzi/di/module/NavigationModule.kt b/app/src/main/java/co/orange/ddanzi/di/module/NavigationModule.kt index 6a356cab..9a5091ba 100644 --- a/app/src/main/java/co/orange/ddanzi/di/module/NavigationModule.kt +++ b/app/src/main/java/co/orange/ddanzi/di/module/NavigationModule.kt @@ -1,7 +1,7 @@ package co.orange.ddanzi.di.module import co.orange.core.navigation.NavigationManager -import co.orange.ddanzi.navigate.NavigationManagerImpl +import co.orange.ddanzi.navigation.NavigationManagerImpl import dagger.Module import dagger.Provides import dagger.hilt.InstallIn diff --git a/app/src/main/java/co/orange/ddanzi/navigate/NavigationManagerImpl.kt b/app/src/main/java/co/orange/ddanzi/navigation/NavigationManagerImpl.kt similarity index 99% rename from app/src/main/java/co/orange/ddanzi/navigate/NavigationManagerImpl.kt rename to app/src/main/java/co/orange/ddanzi/navigation/NavigationManagerImpl.kt index e7eaa130..1e5b9722 100644 --- a/app/src/main/java/co/orange/ddanzi/navigate/NavigationManagerImpl.kt +++ b/app/src/main/java/co/orange/ddanzi/navigation/NavigationManagerImpl.kt @@ -1,4 +1,4 @@ -package co.orange.ddanzi.navigate +package co.orange.ddanzi.navigation import android.content.Context import android.content.Intent diff --git a/core/build.gradle.kts b/core/build.gradle.kts index 916bf83b..fac0d748 100644 --- a/core/build.gradle.kts +++ b/core/build.gradle.kts @@ -30,21 +30,31 @@ android { } dependencies { - // Kotlin - implementation(KotlinDependencies.kotlin) + KotlinDependencies.run { + implementation(kotlin) + } - // Lifecycle Ktx - implementation(AndroidXDependencies.lifeCycleKtx) + AndroidXDependencies.run { + implementation(lifeCycleKtx) + implementation(hilt) + } - // Material Design - implementation(GoogleDependencies.materialDesign) + GoogleDependencies.run { + implementation(materialDesign) + } - // Hilt - implementation(AndroidXDependencies.hilt) - kapt(KaptDependencies.hiltAndroidCompiler) + KaptDependencies.run { + kapt(hiltAndroidCompiler) + } - // Test Dependency - testImplementation(TestDependencies.jUnit) - androidTestImplementation(TestDependencies.androidTest) - androidTestImplementation(TestDependencies.espresso) + ThirdPartyDependencies.run { + implementation(timber) + implementation(amplitude) + } + + TestDependencies.run { + testImplementation(jUnit) + androidTestImplementation(androidTest) + androidTestImplementation(espresso) + } } diff --git a/app/src/main/java/co/orange/ddanzi/manager/AmplitudeManager.kt b/core/src/main/java/co/orange/core/amplitude/AmplitudeManager.kt similarity index 97% rename from app/src/main/java/co/orange/ddanzi/manager/AmplitudeManager.kt rename to core/src/main/java/co/orange/core/amplitude/AmplitudeManager.kt index 97fb8ee5..feca8cda 100644 --- a/app/src/main/java/co/orange/ddanzi/manager/AmplitudeManager.kt +++ b/core/src/main/java/co/orange/core/amplitude/AmplitudeManager.kt @@ -1,4 +1,4 @@ -package co.orange.ddanzi.manager +package co.orange.core.amplitude import android.content.Context import com.amplitude.android.Amplitude diff --git a/feature/auth/src/main/java/co/orange/auth/login/LoginActivity.kt b/feature/auth/src/main/java/co/orange/auth/login/LoginActivity.kt index 860d3b71..4d345c35 100644 --- a/feature/auth/src/main/java/co/orange/auth/login/LoginActivity.kt +++ b/feature/auth/src/main/java/co/orange/auth/login/LoginActivity.kt @@ -8,6 +8,7 @@ import androidx.lifecycle.lifecycleScope import co.orange.auth.databinding.ActivityLoginBinding import co.orange.auth.phone.PhoneActivity import co.orange.core.R +import co.orange.core.amplitude.AmplitudeManager import co.orange.core.base.BaseActivity import co.orange.core.extension.setOnSingleClickListener import co.orange.core.extension.stringOf @@ -34,6 +35,7 @@ class LoginActivity : BaseActivity(featureR.layout.activit private fun initLoginBtnListener() { binding.btnLoginKakao.setOnSingleClickListener { + AmplitudeManager.trackEvent("click_sign_up_kakao") viewModel.startLogInWithKakao(this) } } From 5a39546fb3c4a3e328fcb00d9e963918c211d156 Mon Sep 17 00:00:00 2001 From: Sangho Kim Date: Tue, 10 Sep 2024 18:56:56 +0900 Subject: [PATCH 06/14] =?UTF-8?q?[ADD/#129]=20auth=20=EB=AA=A8=EB=93=88=20?= =?UTF-8?q?amplitude=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ddanzi/di/interceptor/AuthInterceptor.kt | 2 ++ .../ddanzi/navigation/NavigationManagerImpl.kt | 7 ++++++- .../orange/core/navigation/NavigationManager.kt | 5 ++++- .../java/co/orange/auth/phone/PhoneActivity.kt | 15 ++++++++++----- .../java/co/orange/auth/phone/TermBottomSheet.kt | 2 ++ .../java/co/orange/main/detail/DetailActivity.kt | 4 ++-- .../java/co/orange/main/main/home/HomeFragment.kt | 4 ++-- .../orange/main/main/profile/ProfileFragment.kt | 2 +- .../java/co/orange/main/search/SearchActivity.kt | 2 +- 9 files changed, 30 insertions(+), 13 deletions(-) diff --git a/app/src/main/java/co/orange/ddanzi/di/interceptor/AuthInterceptor.kt b/app/src/main/java/co/orange/ddanzi/di/interceptor/AuthInterceptor.kt index 7bb7bda9..d6c0b0d2 100644 --- a/app/src/main/java/co/orange/ddanzi/di/interceptor/AuthInterceptor.kt +++ b/app/src/main/java/co/orange/ddanzi/di/interceptor/AuthInterceptor.kt @@ -5,6 +5,7 @@ import android.content.Intent import android.os.Handler import android.os.Looper import co.orange.auth.login.LoginActivity +import co.orange.core.amplitude.AmplitudeManager import co.orange.core.extension.toast import co.orange.domain.entity.request.ReissueRequestModel import co.orange.domain.repository.AuthRepository @@ -63,6 +64,7 @@ class AuthInterceptor userRepository.clearInfo() Handler(Looper.getMainLooper()).post { + AmplitudeManager.trackEvent("view_sign_up", mapOf("sign_up_from" to "token")) context.toast(TOKEN_EXPIRED_ERROR) Intent(context, LoginActivity::class.java).apply { addFlags(Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TASK) diff --git a/app/src/main/java/co/orange/ddanzi/navigation/NavigationManagerImpl.kt b/app/src/main/java/co/orange/ddanzi/navigation/NavigationManagerImpl.kt index 1e5b9722..50989564 100644 --- a/app/src/main/java/co/orange/ddanzi/navigation/NavigationManagerImpl.kt +++ b/app/src/main/java/co/orange/ddanzi/navigation/NavigationManagerImpl.kt @@ -6,6 +6,7 @@ import co.orange.auth.login.LoginActivity import co.orange.buy.finished.BuyFinishedActivity import co.orange.buy.info.BuyInfoActivity import co.orange.buy.progress.BuyProgressActivity +import co.orange.core.amplitude.AmplitudeManager import co.orange.core.navigation.NavigationManager import co.orange.main.alarm.AlarmRequestActivity import co.orange.main.detail.DetailActivity @@ -63,7 +64,11 @@ class NavigationManagerImpl /** To Auth Module**/ - override fun toLoginView(context: Context) { + override fun toLoginView( + context: Context, + property: String, + ) { + AmplitudeManager.trackEvent("view_sign_up", mapOf("sign_up_from" to property)) context.startActivity(Intent(context, LoginActivity::class.java)) } diff --git a/core/src/main/java/co/orange/core/navigation/NavigationManager.kt b/core/src/main/java/co/orange/core/navigation/NavigationManager.kt index 8d93bf7d..28e1cb11 100644 --- a/core/src/main/java/co/orange/core/navigation/NavigationManager.kt +++ b/core/src/main/java/co/orange/core/navigation/NavigationManager.kt @@ -23,7 +23,10 @@ interface NavigationManager { /** To Auth Module**/ - fun toLoginView(context: Context) + fun toLoginView( + context: Context, + property: String, + ) /** To Setting Module**/ diff --git a/feature/auth/src/main/java/co/orange/auth/phone/PhoneActivity.kt b/feature/auth/src/main/java/co/orange/auth/phone/PhoneActivity.kt index bf7247e2..e6359f3f 100644 --- a/feature/auth/src/main/java/co/orange/auth/phone/PhoneActivity.kt +++ b/feature/auth/src/main/java/co/orange/auth/phone/PhoneActivity.kt @@ -10,6 +10,7 @@ import co.orange.auth.BuildConfig.MERCHANT_UID import co.orange.auth.databinding.ActivityPhoneBinding import co.orange.auth.submit.SubmitActivity import co.orange.core.R +import co.orange.core.amplitude.AmplitudeManager import co.orange.core.base.BaseActivity import co.orange.core.extension.setOnSingleClickListener import co.orange.core.extension.setStatusBarColorFromResource @@ -34,7 +35,7 @@ class PhoneActivity : BaseActivity(featureR.layout.activit override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) - Iamport.init(this) + initView() initAuthBtnListener() observeIsSubmitClicked() observeIamportTokenResult() @@ -42,8 +43,14 @@ class PhoneActivity : BaseActivity(featureR.layout.activit observeSignUpState() } + private fun initView() { + Iamport.init(this) + AmplitudeManager.trackEvent("view_verification") + } + private fun initAuthBtnListener() { binding.btnPhoneAuth.setOnSingleClickListener { + AmplitudeManager.trackEvent("click_verification_next") termBottomSheet = TermBottomSheet() termBottomSheet?.show(supportFragmentManager, BOTTOM_SHEET_TERM) } @@ -108,11 +115,9 @@ class PhoneActivity : BaseActivity(featureR.layout.activit .onEach { state -> when (state) { is UiState.Success -> { + AmplitudeManager.trackEvent("complete_sign_up") setLoadingScreen(false) - SubmitActivity.createIntent(this, state.data).apply { - startActivity(this) - } - finish() + startActivity(SubmitActivity.createIntent(this, state.data)) } is UiState.Failure -> { diff --git a/feature/auth/src/main/java/co/orange/auth/phone/TermBottomSheet.kt b/feature/auth/src/main/java/co/orange/auth/phone/TermBottomSheet.kt index 24b9d13e..ef3ec8a2 100644 --- a/feature/auth/src/main/java/co/orange/auth/phone/TermBottomSheet.kt +++ b/feature/auth/src/main/java/co/orange/auth/phone/TermBottomSheet.kt @@ -7,6 +7,7 @@ import android.view.View import androidx.fragment.app.activityViewModels import co.orange.auth.databinding.BottomSheetTermBinding import co.orange.core.R +import co.orange.core.amplitude.AmplitudeManager import co.orange.core.base.BaseBottomSheet import co.orange.core.extension.setOnSingleClickListener import co.orange.auth.R as featureR @@ -48,6 +49,7 @@ class TermBottomSheet : private fun initSubmitBtnListener() { binding.btnSubmit.setOnSingleClickListener { + AmplitudeManager.trackEvent("click_verification_terms_next") viewModel.clickSubmitBtn(true) dismiss() } diff --git a/feature/main/src/main/java/co/orange/main/detail/DetailActivity.kt b/feature/main/src/main/java/co/orange/main/detail/DetailActivity.kt index 22476b2d..653bc57d 100644 --- a/feature/main/src/main/java/co/orange/main/detail/DetailActivity.kt +++ b/feature/main/src/main/java/co/orange/main/detail/DetailActivity.kt @@ -67,7 +67,7 @@ class DetailActivity : BaseActivity(featureR.layout.activ private fun initLikeBtnListener() { binding.btnLike.setOnSingleClickShortListener { if (!viewModel.getUserLogined()) { - navigationManager.toLoginView(this) + navigationManager.toLoginView(this, "like") return@setOnSingleClickShortListener } viewModel.setLikeStateWithServer() @@ -77,7 +77,7 @@ class DetailActivity : BaseActivity(featureR.layout.activ private fun initPurchaseBtnListener() { binding.btnPurchase.setOnSingleClickListener { if (!viewModel.getUserLogined()) { - navigationManager.toLoginView(this) + navigationManager.toLoginView(this, "buy") return@setOnSingleClickListener } if (viewModel.optionList.isEmpty()) { diff --git a/feature/main/src/main/java/co/orange/main/main/home/HomeFragment.kt b/feature/main/src/main/java/co/orange/main/main/home/HomeFragment.kt index a5db119b..5d0e5594 100644 --- a/feature/main/src/main/java/co/orange/main/main/home/HomeFragment.kt +++ b/feature/main/src/main/java/co/orange/main/main/home/HomeFragment.kt @@ -91,7 +91,7 @@ class HomeFragment() : BaseFragment(featureR.layout.fragmen position: Int, ) { if (!viewModel.getUserLogined()) { - navigationManager.toLoginView(requireContext()) + navigationManager.toLoginView(requireContext(), "like") return } viewModel.setLikeStateWithServer(productId, isInterested, position) @@ -110,7 +110,7 @@ class HomeFragment() : BaseFragment(featureR.layout.fragmen if (viewModel.getUserLogined()) { navigationManager.toSellOnboardingView(requireContext()) } else { - navigationManager.toLoginView(requireContext()) + navigationManager.toLoginView(requireContext(), "sell") } } } diff --git a/feature/main/src/main/java/co/orange/main/main/profile/ProfileFragment.kt b/feature/main/src/main/java/co/orange/main/main/profile/ProfileFragment.kt index 763f388e..8456772b 100644 --- a/feature/main/src/main/java/co/orange/main/main/profile/ProfileFragment.kt +++ b/feature/main/src/main/java/co/orange/main/main/profile/ProfileFragment.kt @@ -58,7 +58,7 @@ class ProfileFragment() : BaseFragment(featureR.layout.f private fun initLoginBtnListener() { binding.btnLogin.setOnSingleClickListener { - navigationManager.toLoginView(requireContext()) + navigationManager.toLoginView(requireContext(), "mypage") } } diff --git a/feature/main/src/main/java/co/orange/main/search/SearchActivity.kt b/feature/main/src/main/java/co/orange/main/search/SearchActivity.kt index f2810f98..3d585061 100644 --- a/feature/main/src/main/java/co/orange/main/search/SearchActivity.kt +++ b/feature/main/src/main/java/co/orange/main/search/SearchActivity.kt @@ -135,7 +135,7 @@ class SearchActivity : position: Int, ) { if (!viewModel.getUserLogined()) { - navigationManager.toLoginView(this) + navigationManager.toLoginView(this, "like") return } viewModel.setLikeStateWithServer(productId, isInterested, position) From 4c3cc13cc87e1120f6a04b9584777a13240ac0a1 Mon Sep 17 00:00:00 2001 From: Sangho Kim Date: Tue, 10 Sep 2024 22:14:02 +0900 Subject: [PATCH 07/14] =?UTF-8?q?[ADD/#129]=20main=20=EB=AA=A8=EB=93=88=20?= =?UTF-8?q?amplitude=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../co/orange/auth/phone/PhoneViewModel.kt | 2 ++ .../co/orange/main/main/home/HomeFragment.kt | 18 ++++++++---------- .../co/orange/main/search/SearchActivity.kt | 4 ++++ 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/feature/auth/src/main/java/co/orange/auth/phone/PhoneViewModel.kt b/feature/auth/src/main/java/co/orange/auth/phone/PhoneViewModel.kt index ebce6318..fef98c17 100644 --- a/feature/auth/src/main/java/co/orange/auth/phone/PhoneViewModel.kt +++ b/feature/auth/src/main/java/co/orange/auth/phone/PhoneViewModel.kt @@ -3,6 +3,7 @@ package co.orange.auth.phone import androidx.lifecycle.MutableLiveData import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope +import co.orange.core.amplitude.AmplitudeManager import co.orange.core.extension.toPhoneFrom import co.orange.core.state.UiState import co.orange.domain.entity.request.SignUpRequestModel @@ -47,6 +48,7 @@ class PhoneViewModel val postSignUpState: StateFlow> = _postSignUpState fun checkAllTerm() { + AmplitudeManager.trackEvent("click_verification_terms_all") isTermPrivateSelected.value = isTermAllSelected.value?.not() isTermServiceSelected.value = isTermAllSelected.value?.not() isTermMarketingSelected.value = isTermAllSelected.value?.not() diff --git a/feature/main/src/main/java/co/orange/main/main/home/HomeFragment.kt b/feature/main/src/main/java/co/orange/main/main/home/HomeFragment.kt index 5d0e5594..668a9fae 100644 --- a/feature/main/src/main/java/co/orange/main/main/home/HomeFragment.kt +++ b/feature/main/src/main/java/co/orange/main/main/home/HomeFragment.kt @@ -10,6 +10,7 @@ import androidx.lifecycle.flowWithLifecycle import androidx.lifecycle.lifecycleScope import androidx.recyclerview.widget.GridLayoutManager import co.orange.core.R +import co.orange.core.amplitude.AmplitudeManager import co.orange.core.base.BaseFragment import co.orange.core.extension.dpToPx import co.orange.core.extension.setOnSingleClickListener @@ -59,6 +60,7 @@ class HomeFragment() : BaseFragment(featureR.layout.fragmen override fun onResume() { super.onResume() + AmplitudeManager.trackEvent("view_home") viewModel.getHomeDataFromServer() } @@ -73,16 +75,12 @@ class HomeFragment() : BaseFragment(featureR.layout.fragmen } private fun initBannerClickListener(x: String) { - Intent(Intent.ACTION_VIEW, Uri.parse(WEB_BANNER)).apply { - startActivity(this) - } + AmplitudeManager.trackEvent("click_home_banner") + startActivity(Intent(Intent.ACTION_VIEW, Uri.parse(WEB_BANNER))) } private fun initProductClickListener(productId: String) { - DetailActivity.createIntent( - requireContext(), - productId, - ).apply { startActivity(this) } + startActivity(DetailActivity.createIntent(requireContext(), productId)) } private fun initLikeClickListener( @@ -99,14 +97,14 @@ class HomeFragment() : BaseFragment(featureR.layout.fragmen private fun initSearchBtnListener() { binding.btnSearch.setOnSingleClickListener { - Intent(requireContext(), SearchActivity::class.java).apply { - startActivity(this) - } + AmplitudeManager.trackEvent("click_home_search") + startActivity(Intent(requireContext(), SearchActivity::class.java)) } } private fun initSellBtnListener() { binding.btnSell.setOnSingleClickListener { + AmplitudeManager.trackEvent("click_home_sell") if (viewModel.getUserLogined()) { navigationManager.toSellOnboardingView(requireContext()) } else { diff --git a/feature/main/src/main/java/co/orange/main/search/SearchActivity.kt b/feature/main/src/main/java/co/orange/main/search/SearchActivity.kt index 3d585061..52461367 100644 --- a/feature/main/src/main/java/co/orange/main/search/SearchActivity.kt +++ b/feature/main/src/main/java/co/orange/main/search/SearchActivity.kt @@ -7,6 +7,7 @@ import androidx.core.widget.doAfterTextChanged import androidx.lifecycle.flowWithLifecycle import androidx.lifecycle.lifecycleScope import co.orange.core.R +import co.orange.core.amplitude.AmplitudeManager import co.orange.core.base.BaseActivity import co.orange.core.extension.initFocusWithKeyboard import co.orange.core.extension.setOnSingleClickListener @@ -104,6 +105,7 @@ class SearchActivity : } private fun initKeywordClickListener(keyword: String) { + AmplitudeManager.trackEvent("click_search_popular") binding.etSearch.setText(keyword) } @@ -151,6 +153,7 @@ class SearchActivity : lifecycleScope.launch { delay(DEBOUNCE_TIME) text.toString().let { text -> + AmplitudeManager.trackEvent("click_search_search") binding.layoutAfterSearch.isVisible = true binding.tvSearchedText.text = getString(R.string.add_quotation, text) viewModel.getSearchResultFromServer(text) @@ -241,6 +244,7 @@ class SearchActivity : override fun onDestroy() { super.onDestroy() + _keywordAdapter = null _recentAdapter = null _resultAdapter = null From 2ed76dc935c5b174c777fc5b6f036b8fd4b69212 Mon Sep 17 00:00:00 2001 From: Sangho Kim Date: Wed, 11 Sep 2024 00:09:13 +0900 Subject: [PATCH 08/14] =?UTF-8?q?[ADD/#129]=20=ED=8C=90=EB=A7=A4=20?= =?UTF-8?q?=EB=AA=A8=EB=93=88=20amplitude=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../orange/main/alarm/AlarmRequestActivity.kt | 4 ++++ .../sell/finished/SellFinishedActivity.kt | 17 +++++++++---- .../sell/onboarding/SellOnboardingActivity.kt | 8 +++++++ .../sell/onboarding/SellProductDialog.kt | 24 ++++++++++++++----- .../sell/progress/SellProgressActivity.kt | 18 ++++++++++++-- .../sell/progress/SellProgressViewModel.kt | 2 ++ .../co/orange/setting/bank/BankActivity.kt | 6 ++--- .../setting/bank/add/BankAddActivity.kt | 2 ++ 8 files changed, 65 insertions(+), 16 deletions(-) diff --git a/feature/main/src/main/java/co/orange/main/alarm/AlarmRequestActivity.kt b/feature/main/src/main/java/co/orange/main/alarm/AlarmRequestActivity.kt index bd11899f..31f3fa9d 100644 --- a/feature/main/src/main/java/co/orange/main/alarm/AlarmRequestActivity.kt +++ b/feature/main/src/main/java/co/orange/main/alarm/AlarmRequestActivity.kt @@ -12,6 +12,7 @@ import androidx.activity.result.ActivityResultLauncher import androidx.activity.result.contract.ActivityResultContracts import androidx.core.app.ActivityCompat import androidx.core.content.ContextCompat +import co.orange.core.amplitude.AmplitudeManager import co.orange.core.base.BaseActivity import co.orange.core.extension.initOnBackPressedListener import co.orange.core.extension.setOnSingleClickListener @@ -32,6 +33,7 @@ class AlarmRequestActivity : override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) + AmplitudeManager.trackEvent("view_sell_push") initOnBackPressedListener(binding.root) initExitBtnListener() initAlarmBtnListener() @@ -47,9 +49,11 @@ class AlarmRequestActivity : private fun initExitBtnListener() { with(binding) { btnExit.setOnSingleClickListener { + AmplitudeManager.trackEvent("click_sell_push_refuse") checkIsBuyOrSell() } btnLater.setOnSingleClickListener { + AmplitudeManager.trackEvent("click_sell_push_refuse") checkIsBuyOrSell() } } diff --git a/feature/sell/src/main/java/co/orange/sell/finished/SellFinishedActivity.kt b/feature/sell/src/main/java/co/orange/sell/finished/SellFinishedActivity.kt index c66d847f..dc35cbf3 100644 --- a/feature/sell/src/main/java/co/orange/sell/finished/SellFinishedActivity.kt +++ b/feature/sell/src/main/java/co/orange/sell/finished/SellFinishedActivity.kt @@ -4,6 +4,7 @@ import android.content.Context import android.content.Intent import android.os.Bundle import androidx.activity.viewModels +import co.orange.core.amplitude.AmplitudeManager import co.orange.core.base.BaseActivity import co.orange.core.extension.setOnSingleClickListener import co.orange.core.extension.setPriceForm @@ -34,25 +35,31 @@ class SellFinishedActivity : private fun initReturnBtnListener() { with(binding) { btnExit.setOnSingleClickListener { navigationManager.toMainViewWIthClearing(this@SellFinishedActivity) } - btnSellMore.setOnSingleClickListener { navigationManager.toMainViewWIthClearing(this@SellFinishedActivity) } + btnSellMore.setOnSingleClickListener { + AmplitudeManager.trackEvent("click_sell_adjustment_add") + navigationManager.toMainViewWIthClearing(this@SellFinishedActivity) + } } } private fun initDetailBtnListener() { binding.btnProductDetail.setOnSingleClickListener { - SellInfoActivity.createIntent(this, viewModel.itemId).apply { - startActivity(this) - } + AmplitudeManager.trackEvent("click_sell_adjustment_check") + startActivity(SellInfoActivity.createIntent(this, viewModel.itemId)) } } private fun setUiWithIntent() { + intent.getStringExtra(EXTRA_ITEM_ID)?.let { viewModel.itemId = it } with(binding) { - intent.getStringExtra(EXTRA_ITEM_ID)?.let { viewModel.itemId = it } intent.getStringExtra(EXTRA_PRODUCT_NAME)?.let { tvFinishedItemName.text = it } intent.getStringExtra(EXTRA_PRODUCT_IMAGE)?.let { ivFinishedItem.load(it) } tvFinishedItemPrice.text = intent.getIntExtra(EXTRA_SALE_PRICE, 0).setPriceForm() } + AmplitudeManager.trackEvent( + "complete_sell_adjustment", + mapOf("item_id" to viewModel.itemId), + ) } companion object { diff --git a/feature/sell/src/main/java/co/orange/sell/onboarding/SellOnboardingActivity.kt b/feature/sell/src/main/java/co/orange/sell/onboarding/SellOnboardingActivity.kt index 12985792..beaa7d60 100644 --- a/feature/sell/src/main/java/co/orange/sell/onboarding/SellOnboardingActivity.kt +++ b/feature/sell/src/main/java/co/orange/sell/onboarding/SellOnboardingActivity.kt @@ -11,6 +11,7 @@ import androidx.core.view.isVisible import androidx.lifecycle.flowWithLifecycle import androidx.lifecycle.lifecycleScope import co.orange.core.R +import co.orange.core.amplitude.AmplitudeManager import co.orange.core.base.BaseActivity import co.orange.core.extension.setOnSingleClickListener import co.orange.core.extension.setStatusBarColorFromResource @@ -41,6 +42,7 @@ class SellOnboardingActivity : override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) + AmplitudeManager.trackEvent("view_landing_1") initViewPager() initExitBtnListener() initNextBtnListener() @@ -69,6 +71,10 @@ class SellOnboardingActivity : btnNext.setOnClickListener { vpOnboarding.currentItem += 1 setGuideWIthPosition(vpOnboarding.currentItem) + when (vpOnboarding.currentItem) { + 1 -> AmplitudeManager.trackEvent("click_landing_1_next") + 2 -> AmplitudeManager.trackEvent("click_landing_2_next") + } } } } @@ -88,11 +94,13 @@ class SellOnboardingActivity : private fun initSelectBtnListener() { binding.btnSelect.setOnSingleClickListener { + AmplitudeManager.trackEvent("click_landing_3_next") checkAndGetImage() } } private fun checkAndGetImage() { + AmplitudeManager.trackEvent("view_gallery") if (ActivityResultContracts.PickVisualMedia.isPhotoPickerAvailable()) { photoPickerResult.launch(PickVisualMediaRequest(ActivityResultContracts.PickVisualMedia.ImageOnly)) } else { diff --git a/feature/sell/src/main/java/co/orange/sell/onboarding/SellProductDialog.kt b/feature/sell/src/main/java/co/orange/sell/onboarding/SellProductDialog.kt index 529dad7a..e0983c70 100644 --- a/feature/sell/src/main/java/co/orange/sell/onboarding/SellProductDialog.kt +++ b/feature/sell/src/main/java/co/orange/sell/onboarding/SellProductDialog.kt @@ -5,6 +5,7 @@ import android.view.View import android.view.WindowManager import androidx.fragment.app.activityViewModels import co.orange.core.R +import co.orange.core.amplitude.AmplitudeManager import co.orange.core.base.BaseDialog import co.orange.core.extension.setOnSingleClickListener import co.orange.sell.databinding.DialogSellProductBinding @@ -33,6 +34,7 @@ class SellProductDialog : ) { super.onViewCreated(view, savedInstanceState) + AmplitudeManager.trackEvent("view_confirm") initExitBtnListener() initConfirmBtnListener() initPickAgainBtnListener() @@ -45,18 +47,28 @@ class SellProductDialog : private fun initConfirmBtnListener() { binding.btnSubmit.setOnSingleClickListener { - SellProgressActivity.createIntent( - requireContext(), - viewModel.productId, - viewModel.productName, - viewModel.uploadedUrl, - ).apply { startActivity(this) } + AmplitudeManager.trackEvent( + "click_confirm_next", + mapOf("product_id" to viewModel.productId), + ) + startActivity( + SellProgressActivity.createIntent( + requireContext(), + viewModel.productId, + viewModel.productName, + viewModel.uploadedUrl, + ), + ) dismiss() } } private fun initPickAgainBtnListener() { binding.btnPickAgain.setOnSingleClickListener { + AmplitudeManager.trackEvent( + "click_confirm_quit", + mapOf("product_id" to viewModel.productId), + ) viewModel.setCheckedAgain(true) dismiss() } diff --git a/feature/sell/src/main/java/co/orange/sell/progress/SellProgressActivity.kt b/feature/sell/src/main/java/co/orange/sell/progress/SellProgressActivity.kt index ef90832b..71a4d0c4 100644 --- a/feature/sell/src/main/java/co/orange/sell/progress/SellProgressActivity.kt +++ b/feature/sell/src/main/java/co/orange/sell/progress/SellProgressActivity.kt @@ -13,6 +13,7 @@ import androidx.core.view.isVisible import androidx.lifecycle.flowWithLifecycle import androidx.lifecycle.lifecycleScope import co.orange.core.R +import co.orange.core.amplitude.AmplitudeManager import co.orange.core.base.BaseActivity import co.orange.core.extension.setOnSingleClickListener import co.orange.core.extension.setPriceForm @@ -47,7 +48,7 @@ class SellProgressActivity : override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) - binding.vm = viewModel + initView() initExitBtnListener() initTermDetailBtnListener() initRegisterBtnListener() @@ -62,8 +63,16 @@ class SellProgressActivity : getProductWithIdFromIntent() } + private fun initView() { + binding.vm = viewModel + AmplitudeManager.trackEvent("view_sell", mapOf("product_id" to viewModel.productId)) + } + private fun initExitBtnListener() { - binding.btnExit.setOnSingleClickListener { finish() } + binding.btnExit.setOnSingleClickListener { + AmplitudeManager.trackEvent("click_sell_quit") + finish() + } } private fun initTermDetailBtnListener() { @@ -83,6 +92,10 @@ class SellProgressActivity : private fun initRegisterBtnListener() { binding.btnRegister.setOnSingleClickListener { + AmplitudeManager.trackEvent( + "click_sell_next", + mapOf("product_id" to viewModel.productId), + ) with(viewModel) { setLoadingState(true) if (isBankExist) { @@ -103,6 +116,7 @@ class SellProgressActivity : } private fun startSelectingDate() { + AmplitudeManager.trackEvent("click_sell_date") sellDateBottomSheet = SellDateBottomSheet() sellDateBottomSheet?.show(supportFragmentManager, BOTTOM_SHEET_DATE) } diff --git a/feature/sell/src/main/java/co/orange/sell/progress/SellProgressViewModel.kt b/feature/sell/src/main/java/co/orange/sell/progress/SellProgressViewModel.kt index fed8c514..de605feb 100644 --- a/feature/sell/src/main/java/co/orange/sell/progress/SellProgressViewModel.kt +++ b/feature/sell/src/main/java/co/orange/sell/progress/SellProgressViewModel.kt @@ -3,6 +3,7 @@ package co.orange.sell.progress import androidx.lifecycle.MutableLiveData import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope +import co.orange.core.amplitude.AmplitudeManager import co.orange.core.state.UiState import co.orange.domain.entity.request.SellRegisterRequestModel import co.orange.domain.entity.response.SellProductModel @@ -44,6 +45,7 @@ class SellProgressViewModel val postRegisterState: StateFlow> = _postRegisterState fun checkAllTerm() { + AmplitudeManager.trackEvent("click_sell_terms_all") isTermServiceSelected.value = isTermAllSelected.value?.not() isTermSellSelected.value = isTermAllSelected.value?.not() isTermAllSelected.value = isTermAllSelected.value?.not() diff --git a/feature/setting/src/main/java/co/orange/setting/bank/BankActivity.kt b/feature/setting/src/main/java/co/orange/setting/bank/BankActivity.kt index e0cc6722..4dbdc7b0 100644 --- a/feature/setting/src/main/java/co/orange/setting/bank/BankActivity.kt +++ b/feature/setting/src/main/java/co/orange/setting/bank/BankActivity.kt @@ -6,6 +6,7 @@ import androidx.core.view.isVisible import androidx.lifecycle.flowWithLifecycle import androidx.lifecycle.lifecycleScope import co.orange.core.R +import co.orange.core.amplitude.AmplitudeManager import co.orange.core.base.BaseActivity import co.orange.core.extension.setOnSingleClickListener import co.orange.core.extension.stringOf @@ -29,6 +30,7 @@ class BankActivity : BaseActivity(featureR.layout.activity_ override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) + AmplitudeManager.trackEvent("view_account") initBackBtnListener() initBankInfoBtnListener() observeUserBankState() @@ -52,9 +54,7 @@ class BankActivity : BaseActivity(featureR.layout.activity_ } private fun navigateToAddBankView(accountId: Long) { - BankAddActivity.createIntent(this, accountId).apply { - startActivity(this) - } + startActivity(BankAddActivity.createIntent(this, accountId)) } private fun observeUserBankState() { diff --git a/feature/setting/src/main/java/co/orange/setting/bank/add/BankAddActivity.kt b/feature/setting/src/main/java/co/orange/setting/bank/add/BankAddActivity.kt index 11d6a461..1144ccb6 100644 --- a/feature/setting/src/main/java/co/orange/setting/bank/add/BankAddActivity.kt +++ b/feature/setting/src/main/java/co/orange/setting/bank/add/BankAddActivity.kt @@ -7,6 +7,7 @@ import androidx.activity.viewModels import androidx.lifecycle.flowWithLifecycle import androidx.lifecycle.lifecycleScope import co.orange.core.R +import co.orange.core.amplitude.AmplitudeManager import co.orange.core.base.BaseActivity import co.orange.core.extension.setOnSingleClickListener import co.orange.core.extension.stringOf @@ -47,6 +48,7 @@ class BankAddActivity : BaseActivity(featureR.layout.act } private fun initConfirmBtnListener() { + AmplitudeManager.trackEvent("click_account_next") val accountId = intent.getLongExtra(EXTRA_ACCOUNT_ID, -1) binding.btnConfirm.setOnSingleClickListener { if (accountId == DEFAULT_ID) { From 29d586fc0de9bf71559f5a4757bed5918f4582e7 Mon Sep 17 00:00:00 2001 From: Sangho Kim Date: Wed, 11 Sep 2024 00:26:36 +0900 Subject: [PATCH 09/14] =?UTF-8?q?[ADD/#129]=20=EA=B5=AC=EB=A7=A4=20?= =?UTF-8?q?=EB=AA=A8=EB=93=88=20amplitude=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../buy/finished/BuyFinishedActivity.kt | 19 +++++++++++++++---- .../buy/progress/BuyProgressActivity.kt | 12 +++++++++++- .../buy/progress/BuyProgressViewModel.kt | 2 ++ .../orange/main/alarm/AlarmRequestActivity.kt | 7 ++++--- .../co/orange/main/detail/DetailActivity.kt | 18 ++++++++++++++++-- .../orange/main/detail/OptionBottomSheet.kt | 3 +++ 6 files changed, 51 insertions(+), 10 deletions(-) diff --git a/feature/buy/src/main/java/co/orange/buy/finished/BuyFinishedActivity.kt b/feature/buy/src/main/java/co/orange/buy/finished/BuyFinishedActivity.kt index 56b51646..55cd0de4 100644 --- a/feature/buy/src/main/java/co/orange/buy/finished/BuyFinishedActivity.kt +++ b/feature/buy/src/main/java/co/orange/buy/finished/BuyFinishedActivity.kt @@ -9,6 +9,7 @@ import androidx.lifecycle.lifecycleScope import co.orange.buy.databinding.ActivityBuyFinishedBinding import co.orange.buy.info.BuyInfoActivity import co.orange.core.R +import co.orange.core.amplitude.AmplitudeManager import co.orange.core.base.BaseActivity import co.orange.core.extension.breakLines import co.orange.core.extension.convertDateTime @@ -38,15 +39,26 @@ class BuyFinishedActivity : override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) + initView() initReturnBtnListener() initDetailBtnListener() getIntentInfo() observeGetOrderInfoState() } + private fun initView() { + AmplitudeManager.trackEvent( + "complete_purchase_adjustment", + mapOf("order_id" to viewModel.orderId), + ) + } + private fun initReturnBtnListener() { binding.btnHome.setOnSingleClickListener { navigateToHome() } - binding.btnKeepShopping.setOnSingleClickListener { navigateToHome() } + binding.btnKeepShopping.setOnSingleClickListener { + AmplitudeManager.trackEvent("click_purchase_adjustment_add") + navigateToHome() + } } private fun navigateToHome() { @@ -55,9 +67,8 @@ class BuyFinishedActivity : private fun initDetailBtnListener() { binding.btnShowDetail.setOnSingleClickListener { - BuyInfoActivity.createIntent(this, viewModel.orderId).apply { - startActivity(this) - } + AmplitudeManager.trackEvent("click_purchase_adjustment_check") + startActivity(BuyInfoActivity.createIntent(this, viewModel.orderId)) } } diff --git a/feature/buy/src/main/java/co/orange/buy/progress/BuyProgressActivity.kt b/feature/buy/src/main/java/co/orange/buy/progress/BuyProgressActivity.kt index b9ae2366..1f208029 100644 --- a/feature/buy/src/main/java/co/orange/buy/progress/BuyProgressActivity.kt +++ b/feature/buy/src/main/java/co/orange/buy/progress/BuyProgressActivity.kt @@ -17,6 +17,7 @@ import co.orange.buy.databinding.ActivityBuyProgressBinding import co.orange.buy.finished.BuyFinishedActivity import co.orange.buy.progress.BuyProgressViewModel.Companion.PAY_SUCCESS import co.orange.core.R +import co.orange.core.amplitude.AmplitudeManager import co.orange.core.base.BaseActivity import co.orange.core.extension.breakLines import co.orange.core.extension.setOnSingleClickListener @@ -72,7 +73,10 @@ class BuyProgressActivity : } private fun initExitBtnListener() { - binding.btnExit.setOnSingleClickListener { finish() } + binding.btnExit.setOnSingleClickListener { + AmplitudeManager.trackEvent("click_purchase_quit") + finish() + } } private fun initDeliveryChangeBtnListener() { @@ -83,6 +87,7 @@ class BuyProgressActivity : } private fun navigateToAddAddress() { + AmplitudeManager.trackEvent("click_purchase_address") navigationManager.toDeliveryView(this) } @@ -103,6 +108,10 @@ class BuyProgressActivity : private fun initConfirmBtnListener() { binding.btnConfirmPurchase.setOnSingleClickListener { + AmplitudeManager.trackEvent( + "click_purchase_purchase", + mapOf("product_id" to viewModel.productId), + ) viewModel.postPayStartToServer() } } @@ -115,6 +124,7 @@ class BuyProgressActivity : ?: emptyList() getBuyDataFromServer() } + AmplitudeManager.trackEvent("view_purchase", mapOf("product_id" to viewModel.productId)) } private fun observeGetBuyDataState() { diff --git a/feature/buy/src/main/java/co/orange/buy/progress/BuyProgressViewModel.kt b/feature/buy/src/main/java/co/orange/buy/progress/BuyProgressViewModel.kt index 40403f51..9d765798 100644 --- a/feature/buy/src/main/java/co/orange/buy/progress/BuyProgressViewModel.kt +++ b/feature/buy/src/main/java/co/orange/buy/progress/BuyProgressViewModel.kt @@ -4,6 +4,7 @@ import androidx.lifecycle.MutableLiveData import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope import co.orange.buy.BuildConfig.PAYMENT_UID +import co.orange.core.amplitude.AmplitudeManager import co.orange.core.state.UiState import co.orange.domain.entity.request.OrderRequestModel import co.orange.domain.entity.request.PayEndRequestModel @@ -55,6 +56,7 @@ class BuyProgressViewModel val postOrderState: StateFlow> = _postOrderState fun checkAllTerm() { + AmplitudeManager.trackEvent("click_purchase_terms_all") isTermServiceSelected.value = isTermAllSelected.value?.not() isTermPurchaseSelected.value = isTermAllSelected.value?.not() isTermAllSelected.value = isTermAllSelected.value?.not() diff --git a/feature/main/src/main/java/co/orange/main/alarm/AlarmRequestActivity.kt b/feature/main/src/main/java/co/orange/main/alarm/AlarmRequestActivity.kt index 31f3fa9d..3138bdcd 100644 --- a/feature/main/src/main/java/co/orange/main/alarm/AlarmRequestActivity.kt +++ b/feature/main/src/main/java/co/orange/main/alarm/AlarmRequestActivity.kt @@ -33,7 +33,6 @@ class AlarmRequestActivity : override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) - AmplitudeManager.trackEvent("view_sell_push") initOnBackPressedListener(binding.root) initExitBtnListener() initAlarmBtnListener() @@ -49,11 +48,11 @@ class AlarmRequestActivity : private fun initExitBtnListener() { with(binding) { btnExit.setOnSingleClickListener { - AmplitudeManager.trackEvent("click_sell_push_refuse") + AmplitudeManager.trackEvent("click_push_refuse") checkIsBuyOrSell() } btnLater.setOnSingleClickListener { - AmplitudeManager.trackEvent("click_sell_push_refuse") + AmplitudeManager.trackEvent("click_push_refuse") checkIsBuyOrSell() } } @@ -105,8 +104,10 @@ class AlarmRequestActivity : private fun checkIsBuyOrSell() { if (intent.getBooleanExtra(EXTRA_IS_BUYING, true)) { + AmplitudeManager.trackEvent("view_purchase_push") navigateToBuyFinishedActivity() } else { + AmplitudeManager.trackEvent("view_sell_push") navigateToSellFinishedActivity() } } diff --git a/feature/main/src/main/java/co/orange/main/detail/DetailActivity.kt b/feature/main/src/main/java/co/orange/main/detail/DetailActivity.kt index 653bc57d..ce818687 100644 --- a/feature/main/src/main/java/co/orange/main/detail/DetailActivity.kt +++ b/feature/main/src/main/java/co/orange/main/detail/DetailActivity.kt @@ -10,6 +10,7 @@ import androidx.core.view.isVisible import androidx.lifecycle.flowWithLifecycle import androidx.lifecycle.lifecycleScope import co.orange.core.R +import co.orange.core.amplitude.AmplitudeManager import co.orange.core.base.BaseActivity import co.orange.core.extension.breakLines import co.orange.core.extension.setOnSingleClickListener @@ -52,13 +53,20 @@ class DetailActivity : BaseActivity(featureR.layout.activ } private fun initBackBtnListener() { - binding.btnBack.setOnSingleClickListener { finish() } - binding.btnHome.setOnSingleClickListener { finish() } + binding.btnBack.setOnSingleClickListener { + AmplitudeManager.trackEvent("click_detail_quit") + finish() + } + binding.btnHome.setOnSingleClickListener { + AmplitudeManager.trackEvent("click_detail_home") + finish() + } } private fun initDetailViewBtnListener() { binding.btnDetailView.setOnSingleClickListener { if (viewModel.infoUrl.isNotEmpty()) { + AmplitudeManager.trackEvent("click_detail_detail") startActivity(Intent(Intent.ACTION_VIEW, Uri.parse(viewModel.infoUrl))) } } @@ -66,6 +74,7 @@ class DetailActivity : BaseActivity(featureR.layout.activ private fun initLikeBtnListener() { binding.btnLike.setOnSingleClickShortListener { + AmplitudeManager.trackEvent("click_detail_heart") if (!viewModel.getUserLogined()) { navigationManager.toLoginView(this, "like") return@setOnSingleClickShortListener @@ -76,6 +85,10 @@ class DetailActivity : BaseActivity(featureR.layout.activ private fun initPurchaseBtnListener() { binding.btnPurchase.setOnSingleClickListener { + AmplitudeManager.trackEvent( + "click_detail_purchase", + mapOf("product_id" to viewModel.productId), + ) if (!viewModel.getUserLogined()) { navigationManager.toLoginView(this, "buy") return@setOnSingleClickListener @@ -94,6 +107,7 @@ class DetailActivity : BaseActivity(featureR.layout.activ productId = intent.getStringExtra(EXTRA_PRODUCT_ID).orEmpty() getProductDetailFromServer() } + AmplitudeManager.trackEvent("view_detail", mapOf("product_id" to viewModel.productId)) } private fun observeGetProductDetailState() { diff --git a/feature/main/src/main/java/co/orange/main/detail/OptionBottomSheet.kt b/feature/main/src/main/java/co/orange/main/detail/OptionBottomSheet.kt index 9e713831..daccb33b 100644 --- a/feature/main/src/main/java/co/orange/main/detail/OptionBottomSheet.kt +++ b/feature/main/src/main/java/co/orange/main/detail/OptionBottomSheet.kt @@ -8,6 +8,7 @@ import androidx.fragment.app.activityViewModels import androidx.lifecycle.flowWithLifecycle import androidx.lifecycle.lifecycleScope import co.orange.core.R +import co.orange.core.amplitude.AmplitudeManager import co.orange.core.base.BaseBottomSheet import co.orange.core.extension.setOnSingleClickListener import co.orange.core.extension.setOverThousand @@ -43,6 +44,7 @@ class OptionBottomSheet : ) { super.onViewCreated(view, savedInstanceState) + AmplitudeManager.trackEvent("view_option") initDetailViewBtnListener() initPurchaseBtnListener() initLikeBtnListener() @@ -62,6 +64,7 @@ class OptionBottomSheet : private fun initPurchaseBtnListener() { binding.btnPurchase.setOnSingleClickListener { + AmplitudeManager.trackEvent("click_option_next") navigationManager.toBuyProgressView( requireContext(), viewModel.productId, From f5df3514e37a241001490d481809ae67ff81f17b Mon Sep 17 00:00:00 2001 From: Sangho Kim Date: Wed, 11 Sep 2024 00:41:45 +0900 Subject: [PATCH 10/14] =?UTF-8?q?[FIX/#129]=20FCM=20Service=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/co/orange/main/config/DdanziMessagingService.kt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/feature/main/src/main/java/co/orange/main/config/DdanziMessagingService.kt b/feature/main/src/main/java/co/orange/main/config/DdanziMessagingService.kt index 2730a16e..e57e2ac3 100644 --- a/feature/main/src/main/java/co/orange/main/config/DdanziMessagingService.kt +++ b/feature/main/src/main/java/co/orange/main/config/DdanziMessagingService.kt @@ -18,6 +18,8 @@ import java.util.Random class DdanziMessagingService : FirebaseMessagingService() { override fun onNewToken(token: String) { super.onNewToken(token) + + Timber.tag("okhttp").d("NOTIFICATION ON NEW TOKEN : $token") } override fun handleIntent(intent: Intent?) { From 3f928de58a0f1f5df11c4584ed0ab979252820ae Mon Sep 17 00:00:00 2001 From: Sangho Kim Date: Wed, 11 Sep 2024 15:55:31 +0900 Subject: [PATCH 11/14] =?UTF-8?q?[ADD/#125]=20DependencyGraph=20=EC=84=A4?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.gradle.kts | 4 + gradle/projectDependencyGraph.gradle | 124 +++++++++++++++++++++++++++ 2 files changed, 128 insertions(+) create mode 100644 gradle/projectDependencyGraph.gradle diff --git a/build.gradle.kts b/build.gradle.kts index 1820d77d..68e60f10 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -19,3 +19,7 @@ buildscript { tasks.register("clean", Delete::class) { delete(rootProject.buildDir) } + +apply { + from("gradle/projectDependencyGraph.gradle") +} diff --git a/gradle/projectDependencyGraph.gradle b/gradle/projectDependencyGraph.gradle new file mode 100644 index 00000000..c58a2204 --- /dev/null +++ b/gradle/projectDependencyGraph.gradle @@ -0,0 +1,124 @@ +task projectDependencyGraph { + doLast { + def dot = new File(rootProject.buildDir, 'dependency-graph/project.dot') + dot.parentFile.mkdirs() + dot.delete() + + dot << 'digraph {\n' + dot << " graph [label=\"${rootProject.name}\\n \",labelloc=t,fontsize=30,ranksep=1.4];\n" + dot << ' node [style=filled, fillcolor="#bbbbbb"];\n' + dot << ' rankdir=TB;\n' + + def rootProjects = [] + def queue = [rootProject] + while (!queue.isEmpty()) { + def project = queue.remove(0) + rootProjects.add(project) + queue.addAll(project.childProjects.values()) + } + + def projects = new LinkedHashSet() + def dependencies = new LinkedHashMap, List>() + def multiplatformProjects = [] + def jsProjects = [] + def androidProjects = [] + def androidDynamicFeatureProjects = [] + def javaProjects = [] + + queue = [rootProject] + while (!queue.isEmpty()) { + def project = queue.remove(0) + queue.addAll(project.childProjects.values()) + + if (project.plugins.hasPlugin('org.jetbrains.kotlin.multiplatform')) { + multiplatformProjects.add(project) + } + if (project.plugins.hasPlugin('kotlin2js')) { + jsProjects.add(project) + } + if (project.plugins.hasPlugin('com.android.library') || project.plugins.hasPlugin('com.android.application')) { + androidProjects.add(project) + } + if (project.plugins.hasPlugin('com.android.dynamic-feature')) { + androidDynamicFeatureProjects.add(project) + } + if (project.plugins.hasPlugin('java-library') || project.plugins.hasPlugin('java')) { + javaProjects.add(project) + } + + project.configurations.all { config -> + if (config.name.toLowerCase().contains("test")) return + config.dependencies + .withType(ProjectDependency) + .collect { it.dependencyProject } + .each { dependency -> + projects.add(project) + projects.add(dependency) + rootProjects.remove(dependency) + + def graphKey = new Tuple2(project, dependency) + def traits = dependencies.computeIfAbsent(graphKey) { new ArrayList() } + + if (config.name.toLowerCase().endsWith('implementation')) { + traits.add('style=dotted') + } + } + } + } + + projects = projects.sort { it.path } + + dot << '\n # Projects\n\n' + for (project in projects) { + def traits = [] + + if (rootProjects.contains(project)) { + traits.add('shape=box') + } + + if (multiplatformProjects.contains(project)) { + traits.add('fillcolor="#ffd2b3"') + } else if (jsProjects.contains(project)) { + traits.add('fillcolor="#ffffba"') + } else if (androidProjects.contains(project)) { + traits.add('fillcolor="#baffc9"') + } else if (androidDynamicFeatureProjects.contains(project)) { + traits.add('fillcolor="#c9baff"') + } else if (javaProjects.contains(project)) { + traits.add('fillcolor="#ffb3ba"') + } else { + traits.add('fillcolor="#eeeeee"') + } + + dot << " \"${project.path}\" [${traits.join(", ")}];\n" + } + + dot << '\n {rank = same;' + for (project in projects) { + if (rootProjects.contains(project)) { + dot << " \"${project.path}\";" + } + } + dot << '}\n' + + dot << '\n # Dependencies\n\n' + dependencies.forEach { key, traits -> + dot << " \"${key.first.path}\" -> \"${key.second.path}\"" + if (!traits.isEmpty()) { + dot << " [${traits.join(", ")}]" + } + dot << '\n' + } + + dot << '}\n' + + def p = 'dot -Tpng -O project.dot'.execute([], dot.parentFile) + p.waitFor() + if (p.exitValue() != 0) { + throw new RuntimeException(p.errorStream.text) + } + dot.delete() + + println("Project module dependency graph created at ${dot.absolutePath}.png") + } +} \ No newline at end of file From 8ab39419c740e2cd694a3ec095a68167571ec68c Mon Sep 17 00:00:00 2001 From: Sangho Kim Date: Wed, 11 Sep 2024 15:56:17 +0900 Subject: [PATCH 12/14] =?UTF-8?q?[ADD/#125]=20DependencyGraph=20=EC=84=A4?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gradle/projectDependencyGraph.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/projectDependencyGraph.gradle b/gradle/projectDependencyGraph.gradle index c58a2204..e8eee8d4 100644 --- a/gradle/projectDependencyGraph.gradle +++ b/gradle/projectDependencyGraph.gradle @@ -1,4 +1,4 @@ -task projectDependencyGraph { +tasks.register('projectDependencyGraph') { doLast { def dot = new File(rootProject.buildDir, 'dependency-graph/project.dot') dot.parentFile.mkdirs() From 88515ab6dc9aef71e3edfe26a8227b7d58f78e7f Mon Sep 17 00:00:00 2001 From: Sangho Kim Date: Wed, 11 Sep 2024 16:49:24 +0900 Subject: [PATCH 13/14] =?UTF-8?q?[FIX/#129]=20BankDialog=20navigation=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sell/src/main/java/co/orange/sell/progress/BankDialog.kt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/feature/sell/src/main/java/co/orange/sell/progress/BankDialog.kt b/feature/sell/src/main/java/co/orange/sell/progress/BankDialog.kt index 2ef0291f..9af30337 100644 --- a/feature/sell/src/main/java/co/orange/sell/progress/BankDialog.kt +++ b/feature/sell/src/main/java/co/orange/sell/progress/BankDialog.kt @@ -9,9 +9,11 @@ import co.orange.core.base.BaseDialog import co.orange.core.extension.setOnSingleClickListener import co.orange.core.navigation.NavigationManager import co.orange.sell.databinding.DialogBankBinding +import dagger.hilt.android.AndroidEntryPoint import javax.inject.Inject import co.orange.sell.R as featureR +@AndroidEntryPoint class BankDialog : BaseDialog(featureR.layout.dialog_bank) { @Inject From 2e2e5d52f71a19017f7fabefd22b4bc2adeb3a5d Mon Sep 17 00:00:00 2001 From: Sangho Kim Date: Wed, 11 Sep 2024 17:09:00 +0900 Subject: [PATCH 14/14] =?UTF-8?q?[FIX/#129]=20=EB=8D=B0=EC=9D=B4=ED=8A=B8?= =?UTF-8?q?=ED=94=BC=EC=BB=A4=20=EB=82=A0=EC=A7=9C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/co/orange/sell/progress/SellDateBottomSheet.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/feature/sell/src/main/java/co/orange/sell/progress/SellDateBottomSheet.kt b/feature/sell/src/main/java/co/orange/sell/progress/SellDateBottomSheet.kt index 119f34b9..7cbdc5fb 100644 --- a/feature/sell/src/main/java/co/orange/sell/progress/SellDateBottomSheet.kt +++ b/feature/sell/src/main/java/co/orange/sell/progress/SellDateBottomSheet.kt @@ -53,8 +53,9 @@ class SellDateBottomSheet : private fun setDatePicker() { binding.dpSell.apply { val calendar = Calendar.getInstance() + calendar.add(Calendar.DAY_OF_YEAR, -7) minDate = calendar.timeInMillis - calendar.add(Calendar.DAY_OF_YEAR, 7) + calendar.add(Calendar.DAY_OF_YEAR, 14) maxDate = calendar.timeInMillis } }