Skip to content

Commit

Permalink
Boolti-279 feat: FA 유저 정보 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
mangbaam committed Aug 4, 2024
1 parent f5cc4c9 commit f15b00a
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ package com.nexters.boolti.data.datasource

import android.content.Context
import androidx.datastore.core.DataStore
import com.google.firebase.analytics.FirebaseAnalytics
import com.google.firebase.analytics.ktx.analytics
import com.google.firebase.ktx.Firebase
import com.nexters.boolti.data.db.AppSettings
import com.nexters.boolti.data.db.dataStore
import com.nexters.boolti.data.network.api.LoginService
Expand Down Expand Up @@ -46,6 +49,8 @@ internal class AuthDataSource @Inject constructor(

suspend fun login(request: LoginRequest) = runCatching {
loginService.kakaoLogin(request)
}.onSuccess {
Firebase.analytics.logEvent(FirebaseAnalytics.Event.LOGIN, null)
}

suspend fun logout(): Result<Unit> = runCatching {
Expand All @@ -67,6 +72,7 @@ internal class AuthDataSource @Inject constructor(
refreshToken = "",
)
}
Firebase.analytics.setUserId(null)
}

suspend fun refresh(): Result<SignUpResponse?> = runCatching {
Expand All @@ -85,5 +91,9 @@ internal class AuthDataSource @Inject constructor(
userCode = user.userCode,
)
}
Firebase.analytics.apply {
setUserId(user.id)
setUserProperty("nickname", user.nickname)
}
}
}

0 comments on commit f15b00a

Please sign in to comment.