Skip to content

Commit

Permalink
refactor: Deprecatedアノテーションをを付与
Browse files Browse the repository at this point in the history
  • Loading branch information
pantasystem committed Jan 8, 2024
1 parent 22f3add commit 08d200d
Showing 1 changed file with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,25 @@ package net.pantasystem.milktea.model

import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.channels.BufferOverflow
import kotlinx.coroutines.flow.*
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.MutableSharedFlow
import kotlinx.coroutines.flow.SharingStarted
import kotlinx.coroutines.flow.flow
import kotlinx.coroutines.flow.onEach
import kotlinx.coroutines.flow.shareIn
import net.pantasystem.milktea.common.Logger
import net.pantasystem.milktea.common.runCancellableCatching
import net.pantasystem.milktea.model.gallery.GalleryPost

/**
* アプリケーションのスコープの範囲内で完了するタスク
*/
@Deprecated("複雑でわかりづらいのでWorkerかStoreに移行したい")
fun interface ITask<T> {
suspend fun execute(): T
}

@Deprecated("複雑でわかりづらいのでWorkerかStoreに移行したい")
sealed class TaskState<T> {
data class Success<T>(val res: T) : TaskState<T>()
data class Error<T>(val e: Throwable, val task: ITask<T>) : TaskState<T>()
Expand All @@ -24,11 +31,13 @@ sealed class TaskState<T> {
/**
* 別のCoroutineScopeでタスクを実行する
*/
@Deprecated("複雑でわかりづらいのでWorkerかStoreに移行したい")
interface TaskExecutor<T> {
val tasks: Flow<TaskState<T>>
fun dispatch(task: ITask<T>, isLazy: Boolean = false): Flow<TaskState<T>>
}

@Deprecated("複雑でわかりづらいのでWorkerかStoreに移行したい")
class TaskExecutorImpl<T>(
val coroutineScope: CoroutineScope,
val logger: Logger
Expand Down Expand Up @@ -58,6 +67,7 @@ class TaskExecutorImpl<T>(
}
}

@Deprecated("複雑でわかりづらいのでWorkerかStoreに移行したい")
class CreateGalleryTaskExecutor(
private val taskExecutorImpl: TaskExecutor<GalleryPost>
) : TaskExecutor<GalleryPost> by taskExecutorImpl

0 comments on commit 08d200d

Please sign in to comment.