feat(chat-quota): 쿼터 구매 계약과 광고 ad unit 구성을 추가한다
This commit is contained in:
@@ -87,6 +87,7 @@ android {
|
|||||||
buildConfigField 'String', 'YANDEX_INLINE_BANNER_CHARACTER_TAB_AD_UNIT_ID', '"R-M-19140295-13"'
|
buildConfigField 'String', 'YANDEX_INLINE_BANNER_CHARACTER_TAB_AD_UNIT_ID', '"R-M-19140295-13"'
|
||||||
buildConfigField 'String', 'YANDEX_INLINE_BANNER_ORIGINAL_TAB_AD_UNIT_ID', '"R-M-19140295-14"'
|
buildConfigField 'String', 'YANDEX_INLINE_BANNER_ORIGINAL_TAB_AD_UNIT_ID', '"R-M-19140295-14"'
|
||||||
buildConfigField 'String', 'YANDEX_INLINE_BANNER_TALK_TAB_AD_UNIT_ID', '"R-M-19140295-15"'
|
buildConfigField 'String', 'YANDEX_INLINE_BANNER_TALK_TAB_AD_UNIT_ID', '"R-M-19140295-15"'
|
||||||
|
buildConfigField 'String', 'YANDEX_REWARDED_CHAT_QUOTA_AD_UNIT_ID', '"R-M-19140295-16"'
|
||||||
buildConfigField 'String', 'BASE_URL', '"https://api.sodalive.net"'
|
buildConfigField 'String', 'BASE_URL', '"https://api.sodalive.net"'
|
||||||
buildConfigField 'String', 'AGORA_API_BASE_URL', '"https://api.agora.io/api/speech-to-speech-translation/v2/"'
|
buildConfigField 'String', 'AGORA_API_BASE_URL', '"https://api.agora.io/api/speech-to-speech-translation/v2/"'
|
||||||
buildConfigField 'String', 'AGORA_CUSTOMER_ID', '"de5dd9ea151f4a43ba1ad8411817b169"'
|
buildConfigField 'String', 'AGORA_CUSTOMER_ID', '"de5dd9ea151f4a43ba1ad8411817b169"'
|
||||||
@@ -130,6 +131,7 @@ android {
|
|||||||
buildConfigField 'String', 'YANDEX_INLINE_BANNER_CHARACTER_TAB_AD_UNIT_ID', '"R-M-19140297-13"'
|
buildConfigField 'String', 'YANDEX_INLINE_BANNER_CHARACTER_TAB_AD_UNIT_ID', '"R-M-19140297-13"'
|
||||||
buildConfigField 'String', 'YANDEX_INLINE_BANNER_ORIGINAL_TAB_AD_UNIT_ID', '"R-M-19140297-14"'
|
buildConfigField 'String', 'YANDEX_INLINE_BANNER_ORIGINAL_TAB_AD_UNIT_ID', '"R-M-19140297-14"'
|
||||||
buildConfigField 'String', 'YANDEX_INLINE_BANNER_TALK_TAB_AD_UNIT_ID', '"R-M-19140297-15"'
|
buildConfigField 'String', 'YANDEX_INLINE_BANNER_TALK_TAB_AD_UNIT_ID', '"R-M-19140297-15"'
|
||||||
|
buildConfigField 'String', 'YANDEX_REWARDED_CHAT_QUOTA_AD_UNIT_ID', '"R-M-19140297-16"'
|
||||||
buildConfigField 'String', 'BASE_URL', '"https://test-api.sodalive.net"'
|
buildConfigField 'String', 'BASE_URL', '"https://test-api.sodalive.net"'
|
||||||
buildConfigField 'String', 'AGORA_API_BASE_URL', '"https://api.agora.io/api/speech-to-speech-translation/v2/"'
|
buildConfigField 'String', 'AGORA_API_BASE_URL', '"https://api.agora.io/api/speech-to-speech-translation/v2/"'
|
||||||
buildConfigField 'String', 'AGORA_CUSTOMER_ID', '"de5dd9ea151f4a43ba1ad8411817b169"'
|
buildConfigField 'String', 'AGORA_CUSTOMER_ID', '"de5dd9ea151f4a43ba1ad8411817b169"'
|
||||||
|
|||||||
@@ -13,6 +13,8 @@ import io.reactivex.rxjava3.schedulers.Schedulers
|
|||||||
import kr.co.vividnext.sodalive.chat.talk.TalkApi
|
import kr.co.vividnext.sodalive.chat.talk.TalkApi
|
||||||
import kr.co.vividnext.sodalive.chat.talk.room.db.ChatMessageDao
|
import kr.co.vividnext.sodalive.chat.talk.room.db.ChatMessageDao
|
||||||
import kr.co.vividnext.sodalive.chat.talk.room.quota.ChatQuotaPurchaseRequest
|
import kr.co.vividnext.sodalive.chat.talk.room.quota.ChatQuotaPurchaseRequest
|
||||||
|
import kr.co.vividnext.sodalive.chat.talk.room.quota.ChatRoomQuotaCanOption
|
||||||
|
import kr.co.vividnext.sodalive.chat.talk.room.quota.ChatRoomQuotaChargeType
|
||||||
import kr.co.vividnext.sodalive.chat.talk.room.quota.ChatQuotaStatusResponse
|
import kr.co.vividnext.sodalive.chat.talk.room.quota.ChatQuotaStatusResponse
|
||||||
import kr.co.vividnext.sodalive.common.ApiResponse
|
import kr.co.vividnext.sodalive.common.ApiResponse
|
||||||
import java.util.concurrent.Callable
|
import java.util.concurrent.Callable
|
||||||
@@ -73,10 +75,18 @@ class ChatRepository(
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** 쿼터 구매 */
|
/** 쿼터 구매 */
|
||||||
fun purchaseChatQuota(roomId: Long, token: String): Single<ChatQuotaStatusResponse> {
|
fun purchaseChatQuota(
|
||||||
|
roomId: Long,
|
||||||
|
token: String,
|
||||||
|
chargeType: ChatRoomQuotaChargeType,
|
||||||
|
canOption: ChatRoomQuotaCanOption? = null
|
||||||
|
): Single<ChatQuotaStatusResponse> {
|
||||||
return talkApi.purchaseChatQuota(
|
return talkApi.purchaseChatQuota(
|
||||||
roomId = roomId,
|
roomId = roomId,
|
||||||
request = ChatQuotaPurchaseRequest(),
|
request = ChatQuotaPurchaseRequest(
|
||||||
|
chargeType = chargeType,
|
||||||
|
canOption = canOption
|
||||||
|
),
|
||||||
authHeader = token
|
authHeader = token
|
||||||
)
|
)
|
||||||
.subscribeOn(Schedulers.io())
|
.subscribeOn(Schedulers.io())
|
||||||
@@ -87,12 +97,14 @@ class ChatRepository(
|
|||||||
* 로컬에서 최근 20개 메시지 조회
|
* 로컬에서 최근 20개 메시지 조회
|
||||||
*/
|
*/
|
||||||
fun getRecentMessagesFromLocal(roomId: Long): Single<List<ChatMessage>> {
|
fun getRecentMessagesFromLocal(roomId: Long): Single<List<ChatMessage>> {
|
||||||
return Single.fromCallable(Callable {
|
return Single.fromCallable(
|
||||||
|
Callable {
|
||||||
runCatching {
|
runCatching {
|
||||||
val entities = kotlinx.coroutines.runBlocking { chatDao.getRecentMessages(roomId) }
|
val entities = kotlinx.coroutines.runBlocking { chatDao.getRecentMessages(roomId) }
|
||||||
entities.map { it.toDomain() }
|
entities.map { it.toDomain() }
|
||||||
}.getOrDefault(emptyList())
|
}.getOrDefault(emptyList())
|
||||||
}).subscribeOn(Schedulers.io())
|
}
|
||||||
|
).subscribeOn(Schedulers.io())
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -5,5 +5,22 @@ import com.google.gson.annotations.SerializedName
|
|||||||
|
|
||||||
@Keep
|
@Keep
|
||||||
data class ChatQuotaPurchaseRequest(
|
data class ChatQuotaPurchaseRequest(
|
||||||
@SerializedName("container") val container: String = "aos"
|
@SerializedName("container") val container: String = "aos",
|
||||||
|
@SerializedName("chargeType") val chargeType: ChatRoomQuotaChargeType,
|
||||||
|
@SerializedName("canOption") val canOption: ChatRoomQuotaCanOption? = null
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@Keep
|
||||||
|
enum class ChatRoomQuotaChargeType {
|
||||||
|
CAN,
|
||||||
|
AD
|
||||||
|
}
|
||||||
|
|
||||||
|
@Keep
|
||||||
|
enum class ChatRoomQuotaCanOption(
|
||||||
|
val needCan: Int,
|
||||||
|
val quota: Int
|
||||||
|
) {
|
||||||
|
CAN_10(10, 15),
|
||||||
|
CAN_20(20, 40)
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user