feat(creator): 채널 후원 요청을 연결한다

This commit is contained in:
2026-06-16 19:22:21 +09:00
parent a01675b592
commit de351d700c
4 changed files with 131 additions and 2 deletions

View File

@@ -463,7 +463,15 @@ class AppDI(private val context: Context, isDebugMode: Boolean) {
factory { DmChatRepository(api = get(), realtimeClient = get()) }
factory { HomeCreatorRankingRepository(get()) }
factory { HomeRecommendationRepository(get()) }
factory { CreatorChannelHomeRepository(api = get(), userRepository = get(), talkApi = get(), reportRepository = get()) }
factory {
CreatorChannelHomeRepository(
api = get(),
userRepository = get(),
talkApi = get(),
reportRepository = get(),
explorerRepository = get()
)
}
factory { CharacterTabRepository(get()) }
factory { CharacterDetailRepository(get(), get()) }
factory { CharacterGalleryRepository(get()) }

View File

@@ -36,6 +36,7 @@ class CreatorChannelHomeViewModel(
private var isFollowInProgress = false
private var isCreateChatRoomInProgress = false
private var isPostChannelDonationInProgress = false
fun loadHome(creatorId: Long) {
if (creatorId <= 0) return
@@ -131,6 +132,40 @@ class CreatorChannelHomeViewModel(
)
}
fun postChannelDonation(can: Int, isSecret: Boolean, message: String) {
val content = _homeStateLiveData.value as? CreatorChannelHomeUiState.Content ?: return
if (isPostChannelDonationInProgress) return
isPostChannelDonationInProgress = true
compositeDisposable.add(
repository.postChannelDonation(
creatorId = content.header.creatorId,
can = can,
isSecret = isSecret,
message = message,
token = authToken()
)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(
{
isPostChannelDonationInProgress = false
if (it.success) {
SharedPreferenceManager.can = (SharedPreferenceManager.can - can).coerceAtLeast(0)
loadHome(content.header.creatorId)
} else {
showUnknownErrorToast()
}
},
{
isPostChannelDonationInProgress = false
it.message?.let { message -> Logger.e(message) }
showUnknownErrorToast()
}
)
)
}
fun blockUser() {
val content = _homeStateLiveData.value as? CreatorChannelHomeUiState.Content ?: return

View File

@@ -2,6 +2,8 @@ package kr.co.vividnext.sodalive.v2.creator.channel.data
import kr.co.vividnext.sodalive.chat.talk.TalkApi
import kr.co.vividnext.sodalive.chat.talk.room.CreateChatRoomRequest
import kr.co.vividnext.sodalive.explorer.ExplorerRepository
import kr.co.vividnext.sodalive.explorer.profile.channel_donation.PostChannelDonationRequest
import kr.co.vividnext.sodalive.report.ReportRepository
import kr.co.vividnext.sodalive.report.ReportRequest
import kr.co.vividnext.sodalive.report.ReportType
@@ -11,7 +13,8 @@ class CreatorChannelHomeRepository(
private val api: CreatorChannelHomeApi,
private val userRepository: UserRepository,
private val talkApi: TalkApi,
private val reportRepository: ReportRepository
private val reportRepository: ReportRepository,
private val explorerRepository: ExplorerRepository
) {
fun getHome(creatorId: Long, token: String) = api.getHome(
creatorId = creatorId,
@@ -35,6 +38,22 @@ class CreatorChannelHomeRepository(
request = CreateChatRoomRequest(characterId)
)
fun postChannelDonation(
creatorId: Long,
can: Int,
isSecret: Boolean,
message: String,
token: String
) = explorerRepository.postChannelDonation(
request = PostChannelDonationRequest(
creatorId = creatorId,
can = can,
isSecret = isSecret,
message = message
),
token = token
)
fun blockUser(userId: Long, token: String) = userRepository.memberBlock(
userId = userId,
token = token