feat(live): 생성 결과 계약을 추가한다
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
package kr.co.vividnext.sodalive.v2.live.action
|
||||
|
||||
sealed interface LiveCreationResult {
|
||||
data object Ignored : LiveCreationResult
|
||||
|
||||
data object Created : LiveCreationResult
|
||||
|
||||
data object RefreshOnly : LiveCreationResult
|
||||
|
||||
data class Enter(val roomId: Long) : LiveCreationResult
|
||||
}
|
||||
|
||||
fun resolveLiveCreationResult(
|
||||
isSuccessful: Boolean,
|
||||
roomId: Long?,
|
||||
channelName: String?
|
||||
): LiveCreationResult = when {
|
||||
!isSuccessful -> LiveCreationResult.Ignored
|
||||
channelName == null -> LiveCreationResult.Created
|
||||
roomId != null && roomId > 0L -> LiveCreationResult.Enter(roomId)
|
||||
else -> LiveCreationResult.RefreshOnly
|
||||
}
|
||||
Reference in New Issue
Block a user