-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #27 from MONEYMONG/feature/moneymong-501-ga-트래킹
Feature/moneymong 501 ga 트래킹
- Loading branch information
Showing
10 changed files
with
129 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
core/common/src/main/java/com/moneymong/moneymong/common/di/EventModule.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package com.moneymong.moneymong.common.di | ||
|
||
import com.moneymong.moneymong.common.event.EventTracker | ||
import dagger.Module | ||
import dagger.Provides | ||
import dagger.hilt.InstallIn | ||
import dagger.hilt.components.SingletonComponent | ||
import javax.inject.Singleton | ||
|
||
@Module | ||
@InstallIn(SingletonComponent::class) | ||
object EventModule { | ||
|
||
@Provides | ||
@Singleton | ||
fun provideEventTracker(): EventTracker = | ||
EventTracker() | ||
} |
38 changes: 38 additions & 0 deletions
38
core/common/src/main/java/com/moneymong/moneymong/common/event/Event.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package com.moneymong.moneymong.common.event | ||
|
||
enum class Event(val eventName: String, val desc: String) { | ||
OPERATION_COST_CLICK( | ||
eventName = "operation_cost_click", | ||
desc = "운영비 등록하기 버튼 클릭" | ||
), | ||
LEDGER_CLICK( | ||
eventName = "ledger_click", | ||
desc = "소속 장부 확인 버튼 클릭" | ||
), | ||
OCR_REGISTER_CLICK( | ||
eventName = "ocr_register_click", | ||
desc = "등록하기 버튼 클릭" | ||
), | ||
OCR_MODIFY_CLICK( | ||
eventName = "ocr_modify_click", | ||
desc = "수정하기 버튼 클릭" | ||
), | ||
OCR_MODIFY_TO_REGISTER_CLICK( | ||
eventName = "ocr_modify_to_register_click", | ||
desc = "등록하기 버튼 클릭" | ||
), | ||
PLUS_CLICK( | ||
eventName = "plus_click", | ||
desc = "+ 플로팅 버튼 클릭" | ||
), | ||
HAND_CLICK( | ||
eventName = "hand_click", | ||
desc = "수동 등록 플로팅 버튼 클릭" | ||
), | ||
OCR_CLICK( | ||
eventName = "ocr_click", | ||
desc = "OCR 등록 플로팅 버튼 클릭" | ||
) | ||
; | ||
|
||
} |
24 changes: 24 additions & 0 deletions
24
core/common/src/main/java/com/moneymong/moneymong/common/event/EventTracker.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package com.moneymong.moneymong.common.event | ||
|
||
import android.os.Bundle | ||
import com.google.firebase.Firebase | ||
import com.google.firebase.analytics.FirebaseAnalytics | ||
import com.google.firebase.analytics.analytics | ||
import javax.inject.Inject | ||
|
||
class EventTracker @Inject constructor() { | ||
|
||
private lateinit var firebaseAnalytics: FirebaseAnalytics | ||
private var initialized: Boolean = false | ||
|
||
fun initialize() { | ||
firebaseAnalytics = Firebase.analytics | ||
initialized = true | ||
} | ||
|
||
fun logEvent(event: Event, param: Bundle? = null) { | ||
check(initialized) { "logEvent를 호출하기 전 초기화가 필요합니다." } | ||
|
||
firebaseAnalytics.logEvent(event.eventName, param) | ||
} | ||
} |
14 changes: 11 additions & 3 deletions
14
...m/moneymong/moneymong/feature/agency/register/complete/AgencyRegisterCompleteViewModel.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,29 @@ | ||
package com.moneymong.moneymong.feature.agency.register.complete | ||
|
||
import com.moneymong.moneymong.common.base.BaseViewModel | ||
import com.moneymong.moneymong.common.event.Event | ||
import com.moneymong.moneymong.common.event.EventTracker | ||
import dagger.hilt.android.lifecycle.HiltViewModel | ||
import javax.inject.Inject | ||
|
||
@HiltViewModel | ||
class AgencyRegisterCompleteViewModel @Inject constructor() : | ||
class AgencyRegisterCompleteViewModel @Inject constructor( | ||
private val eventTracker: EventTracker | ||
) : | ||
BaseViewModel<AgencyRegisterCompleteState, AgencyRegisterCompleteSideEffect>( | ||
AgencyRegisterCompleteState | ||
) { | ||
|
||
fun navigateToLedger() = | ||
fun navigateToLedger() { | ||
eventTracker.logEvent(Event.LEDGER_CLICK) | ||
eventEmit(sideEffect = AgencyRegisterCompleteSideEffect.NavigateToLedger) | ||
} | ||
|
||
fun navigateToAgencySearch() = | ||
eventEmit(sideEffect = AgencyRegisterCompleteSideEffect.NavigateToAgencySearch) | ||
|
||
fun navigateToLedgerManual() = | ||
fun navigateToLedgerManual() { | ||
eventTracker.logEvent(Event.OPERATION_COST_CLICK) | ||
eventEmit(sideEffect = AgencyRegisterCompleteSideEffect.NavigateToLedgerManual) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters