From f418d59d3ea4c828ab9c4e8dd19fe65e43892464 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=A0=84=ED=95=B4=EC=84=B1?= Date: Tue, 10 Jan 2023 20:55:43 +0900 Subject: [PATCH 1/6] =?UTF-8?q?feat:=20mixpanel=20project=20token=20?= =?UTF-8?q?=ED=99=98=EA=B2=BD=EB=B3=84=EB=A1=9C=20=EB=B6=84=EB=A6=AC=20(#1?= =?UTF-8?q?90)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/build.gradle | 2 ++ .../threedays/buildproperty/BuildProperty.kt | 1 + .../core/analytics/MixpanelAnalyticsSdk.kt | 17 ++++++++++++++++- 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/app/build.gradle b/app/build.gradle index 2afdc567..d35557d1 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -45,6 +45,7 @@ android { ] buildConfigField 'String', 'BASE_URL', "\"${properties.getProperty('release.three-days.base-url')}\"" buildConfigField 'String', 'KAKAO_APP_KEY', "\"${properties.getProperty('release.kakao.app-key')}\"" + buildConfigField 'String', 'MIXPANEL_PROJECT_TOKEN', "\"${properties.getProperty('release.mixpanel.project-token')}\"" } debug { applicationIdSuffix '.debug' @@ -53,6 +54,7 @@ android { ] buildConfigField 'String', 'BASE_URL', "\"${properties.getProperty('debug.three-days.base-url')}\"" buildConfigField 'String', 'KAKAO_APP_KEY', "\"${properties.getProperty('debug.kakao.app-key')}\"" + buildConfigField 'String', 'MIXPANEL_PROJECT_TOKEN', "\"${properties.getProperty('debug.mixpanel.project-token')}\"" } alpha { initWith debug diff --git a/build-property/src/main/java/com/depromeet/threedays/buildproperty/BuildProperty.kt b/build-property/src/main/java/com/depromeet/threedays/buildproperty/BuildProperty.kt index de9accea..de1b82b2 100644 --- a/build-property/src/main/java/com/depromeet/threedays/buildproperty/BuildProperty.kt +++ b/build-property/src/main/java/com/depromeet/threedays/buildproperty/BuildProperty.kt @@ -8,6 +8,7 @@ enum class BuildProperty( ) { BASE_URL("api 서버 주소"), KAKAO_APP_KEY("Kakao native app key"), + MIXPANEL_PROJECT_TOKEN("Mixpanel project token") ; /** diff --git a/core/src/main/java/com/depromeet/threedays/core/analytics/MixpanelAnalyticsSdk.kt b/core/src/main/java/com/depromeet/threedays/core/analytics/MixpanelAnalyticsSdk.kt index 3f7c106d..ec2fc55e 100644 --- a/core/src/main/java/com/depromeet/threedays/core/analytics/MixpanelAnalyticsSdk.kt +++ b/core/src/main/java/com/depromeet/threedays/core/analytics/MixpanelAnalyticsSdk.kt @@ -1,6 +1,7 @@ package com.depromeet.threedays.core.analytics import android.content.Context +import com.depromeet.threedays.buildproperty.BuildProperty import com.mixpanel.android.mpmetrics.MixpanelAPI import org.json.JSONObject import timber.log.Timber @@ -10,10 +11,24 @@ class MixpanelAnalyticsSdk : AnalyticsSdk { private var initialized = false override fun init(context: Context) { - mixpanelAPI = MixpanelAPI.getInstance(context, "823f0e71338dd687bbe4d1b2f34e1272", true) + val projectToken = resolveToken(context) + mixpanelAPI = MixpanelAPI.getInstance(context, projectToken, true) initialized = true } + // FIXME: DI 받아서 접근하도록 변경 + private fun resolveToken(context: Context): String { + return try { + context.classLoader + .loadClass("com.depromeet.threedays.BuildConfig") + .getDeclaredField(BuildProperty.MIXPANEL_PROJECT_TOKEN.name) + .get(null) as String + } catch (e: Exception) { + Timber.e(e, "Failed to resolve mixpanel project token") + throw e + } + } + override fun isInitialized(): Boolean = initialized override fun event(name: String, properties: Map) { From 5232ee7c189b4808b054628dbd64f2e5e5777620 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=A0=84=ED=95=B4=EC=84=B1?= Date: Tue, 10 Jan 2023 21:29:52 +0900 Subject: [PATCH 2/6] =?UTF-8?q?DEP-000=20fix:=20=EC=8B=A4=ED=8C=A8?= =?UTF-8?q?=ED=95=98=EB=8A=94=20=EC=95=A1=EC=85=98=20=EC=82=AD=EC=A0=9C=20?= =?UTF-8?q?(#191)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/update_version_code.yml | 22 ---------------------- 1 file changed, 22 deletions(-) delete mode 100644 .github/workflows/update_version_code.yml diff --git a/.github/workflows/update_version_code.yml b/.github/workflows/update_version_code.yml deleted file mode 100644 index ef9d0626..00000000 --- a/.github/workflows/update_version_code.yml +++ /dev/null @@ -1,22 +0,0 @@ -name: 'Update version code' -on: - workflow_dispatch: - pull_request: - types: [opened, ready_for_review] - branches: - - develop - -jobs: - update_version_code: - name: Update version code - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - run: sed -i "s/threeDaysAppVersionCode = [0-9]*/threeDaysAppVersionCode = $((`sed -n 's/threeDaysAppVersionCode = \([0-9]*\)/\1/p' build.gradle` + 1))/" build.gradle - - run: git config --local user.email `git log -1 --format='%ae'` - - run: git config --local user.name `git log -1 --format='%an'` - - run: git add build.gradle - - run: "git commit -m \"docs: Increment version code\"" - - run: git push origin HEAD From 6d2b041930c5197a4f1a3c6e393b95f0411b67a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=A0=84=ED=95=B4=EC=84=B1?= Date: Tue, 10 Jan 2023 22:22:29 +0900 Subject: [PATCH 3/6] =?UTF-8?q?DEP-000=20refactor:=20=EC=82=AC=EC=9A=A9?= =?UTF-8?q?=ED=95=98=EC=A7=80=20=EC=95=8A=EB=8A=94=20=EB=9D=BC=EC=9D=B4?= =?UTF-8?q?=EB=B8=8C=EB=9F=AC=EB=A6=AC=20=EC=A0=9C=EA=B1=B0=20(#192)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- data/build.gradle | 3 --- dependencies.gradle | 19 +------------------ presentation/mate/build.gradle | 2 -- 3 files changed, 1 insertion(+), 23 deletions(-) diff --git a/data/build.gradle b/data/build.gradle index 8c532383..2557c05a 100644 --- a/data/build.gradle +++ b/data/build.gradle @@ -52,9 +52,6 @@ dependencies { implementation deps.network.adapter implementation deps.network.interceptor - implementation(roomDeps) - kapt deps.room.roomCompiler - implementation deps.timber testImplementation(testDeps) diff --git a/dependencies.gradle b/dependencies.gradle index 5bae795d..853fa6f1 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -26,12 +26,10 @@ ext { "leakcanary" : "2.9.1", "chucker" : "3.5.2", "google" : "20.2.0", - "room" : "2.4.3", "emoji" : "1.0.0-alpha03", "lottie" : "5.2.0", "datastore" : "1.0.0", "ossLicenses" : "17.0.0", - "facebook" : "15.2.0", "mixpanel" : "7.+", ] deps = [ @@ -107,13 +105,6 @@ ext { "kakao" : "com.kakao.sdk:v2-user:${versions.kakao}", "google" : "com.google.android.gms:play-services-auth:${versions.google}" ], - "room" : [ - "roomCommon" : "androidx.room:room-common:${versions.room}", - "roomCompiler" : "androidx.room:room-compiler:${versions.room}", - "roomKtx" : "androidx.room:room-ktx:${versions.room}", - "roomRuntime" : "androidx.room:room-runtime:${versions.room}", - "roomRxjava2" : "androidx.room:room-rxjava2:${versions.room}" - ], "emoji" : [ "emoji2" : "androidx.emoji2:emoji2:${versions.emoji}", "emoji2View" : "androidx.emoji2:emoji2-views:${versions.emoji}" @@ -121,8 +112,7 @@ ext { "lottie" : "com.airbnb.android:lottie:${versions.lottie}", "splash" : "androidx.core:core-splashscreen:1.0.0", "ossLicenses" : "com.google.android.gms:play-services-oss-licenses:${versions.ossLicenses}", - "facebook" : "com.facebook.android:facebook-share:${versions.facebook}", - "mixpanel" : "com.mixpanel.android:mixpanel-android:${versions.mixpanel}" + "mixpanel" : "com.mixpanel.android:mixpanel-android:${versions.mixpanel}", ] coroutines = [ @@ -171,13 +161,6 @@ ext { deps.login.google ] - roomDeps = [ - deps.room.roomCommon, - deps.room.roomKtx, - deps.room.roomRuntime, - deps.room.roomRxjava2 - ] - emojiDeps = [ deps.emoji.emoji2, deps.emoji.emoji2View diff --git a/presentation/mate/build.gradle b/presentation/mate/build.gradle index 224e2d20..9c8bc95a 100644 --- a/presentation/mate/build.gradle +++ b/presentation/mate/build.gradle @@ -53,6 +53,4 @@ dependencies { testImplementation(testDeps) androidTestImplementation(androidTestDeps) - - implementation deps.facebook } From 7a6c3d9f10268e2a78b7c33dcbc8dc8af08199f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=A0=84=ED=95=B4=EC=84=B1?= Date: Wed, 11 Jan 2023 01:42:50 +0900 Subject: [PATCH 4/6] =?UTF-8?q?DEP-000=20refactor:=20debug=20app=20?= =?UTF-8?q?=EC=9D=B4=EB=A6=84=20=EB=B3=80=EA=B2=BD=20(#193)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/debug/res/values/strings.xml | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 app/src/debug/res/values/strings.xml diff --git a/app/src/debug/res/values/strings.xml b/app/src/debug/res/values/strings.xml new file mode 100644 index 00000000..ee8c6373 --- /dev/null +++ b/app/src/debug/res/values/strings.xml @@ -0,0 +1,3 @@ + + 짝심삼일 (debug) + From 7668f9effe89a7b083f6f6ba4c7f4eb956972540 Mon Sep 17 00:00:00 2001 From: hyein-kim <68214704+kimhyeing@users.noreply.github.com> Date: Wed, 11 Jan 2023 02:18:59 +0900 Subject: [PATCH 5/6] =?UTF-8?q?DEP-368=20fix:=20mixpanel=20=EC=9D=B4?= =?UTF-8?q?=EB=B2=A4=ED=8A=B8=20=EB=B0=9C=ED=96=89=20=EC=98=A4=EB=A5=98=20?= =?UTF-8?q?(#194)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../core/analytics/ThreeDaysEvent.kt | 2 ++ .../threedays/home/home/HomeFragment.kt | 16 +++++++------ .../threedays/home/home/HomeViewModel.kt | 5 +++- .../home/dialog/NotiRecommendBottomSheet.kt | 15 ++++++++++++ .../depromeet/threedays/mate/MateFragment.kt | 24 +++++++++---------- .../mate/create/step1/ConnectHabitActivity.kt | 4 ++-- .../create/step2/ChooseMateTypeActivity.kt | 6 ++--- .../create/step3/SetMateNicknameActivity.kt | 2 +- .../threedays/mate/share/ShareMateActivity.kt | 14 +++++------ .../signup/complete/SignupCompleteActivity.kt | 15 ++++++++++++ 10 files changed, 70 insertions(+), 33 deletions(-) diff --git a/core/src/main/java/com/depromeet/threedays/core/analytics/ThreeDaysEvent.kt b/core/src/main/java/com/depromeet/threedays/core/analytics/ThreeDaysEvent.kt index e1eb1730..b872775b 100644 --- a/core/src/main/java/com/depromeet/threedays/core/analytics/ThreeDaysEvent.kt +++ b/core/src/main/java/com/depromeet/threedays/core/analytics/ThreeDaysEvent.kt @@ -27,6 +27,7 @@ enum class Screen { MateCompleted, MateShare, MateMaking, + Push } enum class ThreeDaysEvent { @@ -53,4 +54,5 @@ enum class ThreeDaysEvent { MateLevelupViewed, MateCompletedViewed, MateSaveClicked, + PushViewed } diff --git a/presentation/home/src/main/java/com/depromeet/threedays/home/home/HomeFragment.kt b/presentation/home/src/main/java/com/depromeet/threedays/home/home/HomeFragment.kt index 98a6626c..69925311 100644 --- a/presentation/home/src/main/java/com/depromeet/threedays/home/home/HomeFragment.kt +++ b/presentation/home/src/main/java/com/depromeet/threedays/home/home/HomeFragment.kt @@ -24,18 +24,21 @@ import com.depromeet.threedays.domain.key.RESULT_CREATE import com.depromeet.threedays.domain.key.RESULT_UPDATE import com.depromeet.threedays.home.MainActivity import com.depromeet.threedays.home.R -import com.depromeet.threedays.core_design_system.R as core_design import com.depromeet.threedays.home.databinding.FragmentHomeBinding import com.depromeet.threedays.home.home.dialog.MoreActionModal import com.depromeet.threedays.home.home.dialog.NotiGuideBottomSheet import com.depromeet.threedays.home.home.dialog.NotiRecommendBottomSheet import com.depromeet.threedays.mate.MateFragment -import com.depromeet.threedays.navigator.* +import com.depromeet.threedays.navigator.ArchivedHabitNavigator +import com.depromeet.threedays.navigator.HabitCreateNavigator +import com.depromeet.threedays.navigator.HabitUpdateNavigator +import com.depromeet.threedays.navigator.NotificationNavigator import dagger.hilt.android.AndroidEntryPoint import kotlinx.coroutines.launch import java.time.ZoneId import java.time.ZonedDateTime import javax.inject.Inject +import com.depromeet.threedays.core_design_system.R as core_design @AndroidEntryPoint class HomeFragment : BaseFragment(R.layout.fragment_home) { @@ -80,9 +83,9 @@ class HomeFragment : BaseFragment(R.layout.f private fun onCreateHabitClick() { if(viewModel.habits.value.isEmpty()) { AnalyticsUtil.event( - name = ThreeDaysEvent.NewMateClicked.toString(), + name = ThreeDaysEvent.NewHabitClicked.toString(), properties = mapOf( - MixPanelEvent.ScreenName to Screen.HomeDefault, + MixPanelEvent.ScreenName to Screen.HomeDefault.toString(), MixPanelEvent.ButtonType to ButtonType.NewHabit.toString() ) ) @@ -248,15 +251,14 @@ class HomeFragment : BaseFragment(R.layout.f viewLifecycleOwner.repeatOnLifecycle(Lifecycle.State.STARTED) { launch { viewModel.habits.collect { list -> - if(list.isNotEmpty()) { + if (list.isEmpty()) { AnalyticsUtil.event( name = ThreeDaysEvent.HomeDefaultViewed.toString(), properties = mapOf( MixPanelEvent.ScreenName to Screen.HomeDefault.toString() ) ) - } - else { + } else { AnalyticsUtil.event( name = ThreeDaysEvent.HomeActivatedViewed.toString(), properties = mapOf( diff --git a/presentation/home/src/main/java/com/depromeet/threedays/home/home/HomeViewModel.kt b/presentation/home/src/main/java/com/depromeet/threedays/home/home/HomeViewModel.kt index 3c838721..686aaef4 100644 --- a/presentation/home/src/main/java/com/depromeet/threedays/home/home/HomeViewModel.kt +++ b/presentation/home/src/main/java/com/depromeet/threedays/home/home/HomeViewModel.kt @@ -15,7 +15,10 @@ import com.depromeet.threedays.home.home.model.HabitUI import com.depromeet.threedays.home.home.model.toHabitUI import com.depromeet.threedays.mate.MateImageResourceResolver.Companion.levelToResourceFunction import dagger.hilt.android.lifecycle.HiltViewModel -import kotlinx.coroutines.flow.* +import kotlinx.coroutines.flow.MutableSharedFlow +import kotlinx.coroutines.flow.MutableStateFlow +import kotlinx.coroutines.flow.SharedFlow +import kotlinx.coroutines.flow.StateFlow import kotlinx.coroutines.launch import java.time.LocalDate import javax.inject.Inject diff --git a/presentation/home/src/main/java/com/depromeet/threedays/home/home/dialog/NotiRecommendBottomSheet.kt b/presentation/home/src/main/java/com/depromeet/threedays/home/home/dialog/NotiRecommendBottomSheet.kt index b3e04e81..c3aa5f6e 100644 --- a/presentation/home/src/main/java/com/depromeet/threedays/home/home/dialog/NotiRecommendBottomSheet.kt +++ b/presentation/home/src/main/java/com/depromeet/threedays/home/home/dialog/NotiRecommendBottomSheet.kt @@ -5,6 +5,7 @@ import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import android.widget.Button +import com.depromeet.threedays.core.analytics.* import com.depromeet.threedays.core.util.setOnSingleClickListener import com.depromeet.threedays.home.R import com.google.android.material.bottomsheet.BottomSheetDialogFragment @@ -17,6 +18,13 @@ class NotiRecommendBottomSheet( container: ViewGroup?, savedInstanceState: Bundle? ): View? { + AnalyticsUtil.event( + name = ThreeDaysEvent.PushViewed.toString(), + properties = mapOf( + MixPanelEvent.ScreenName to Screen.Push.toString() + ) + ) + super.onCreateView(inflater, container, savedInstanceState) return inflater.inflate(R.layout.bottom_sheet_noti_recommend, container, false) } @@ -26,6 +34,13 @@ class NotiRecommendBottomSheet( val btnConfirm = view.findViewById