feat: 라이브 30분 연속 청취시 트래킹 API 호출 기능 추가

This commit is contained in:
2025-05-17 16:57:12 +09:00
parent 1720173a16
commit 9260d271a7
8 changed files with 88 additions and 4 deletions

View File

@@ -0,0 +1,15 @@
package kr.co.vividnext.sodalive.tracking
import io.reactivex.rxjava3.core.Single
import kr.co.vividnext.sodalive.common.ApiResponse
import retrofit2.http.Body
import retrofit2.http.Header
import retrofit2.http.POST
interface UserEventApi {
@POST("/user-action")
fun trackEvent(
@Body request: UserEventRequest,
@Header("Authorization") authHeader: String
): Single<ApiResponse<Any>>
}

View File

@@ -0,0 +1,13 @@
package kr.co.vividnext.sodalive.tracking
import io.reactivex.rxjava3.core.Single
import kr.co.vividnext.sodalive.common.ApiResponse
class UserEventRepository(private val api: UserEventApi) {
fun trackEvent(eventType: UserEventType, token: String): Single<ApiResponse<Any>> {
return api.trackEvent(
request = UserEventRequest(actionType = eventType),
authHeader = token
)
}
}

View File

@@ -0,0 +1,15 @@
package kr.co.vividnext.sodalive.tracking
import androidx.annotation.Keep
import com.google.gson.annotations.SerializedName
@Keep
data class UserEventRequest(
@SerializedName("actionType") val actionType: UserEventType
)
@Keep
enum class UserEventType {
@SerializedName("LIVE_CONTINUOUS_LISTEN_30")
LIVE_CONTINUOUS_LISTEN_30
}