Skip to content

Commit

Permalink
refactor: 不要な処理を削除
Browse files Browse the repository at this point in the history
  • Loading branch information
pantasystem committed May 17, 2024
1 parent 47efff2 commit 4a00774
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package net.pantasystem.milktea.data.infrastructure.note
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.sync.Mutex
import net.pantasystem.milktea.api.misskey.notes.NoteDTO
import net.pantasystem.milktea.api.misskey.notes.NoteRequest
import net.pantasystem.milktea.app_store.notes.InitialLoadQuery
import net.pantasystem.milktea.common.PageableState
Expand All @@ -13,22 +12,19 @@ import net.pantasystem.milktea.common.paginator.FutureLoader
import net.pantasystem.milktea.common.paginator.IdGetter
import net.pantasystem.milktea.common.paginator.PreviousLoader
import net.pantasystem.milktea.common.runCancellableCatching
import net.pantasystem.milktea.data.api.misskey.MisskeyAPIProvider
import net.pantasystem.milktea.model.account.Account
import net.pantasystem.milktea.model.account.page.Pageable
import net.pantasystem.milktea.model.account.page.SincePaginate
import net.pantasystem.milktea.model.account.page.UntilPaginate
import net.pantasystem.milktea.model.note.Note
import net.pantasystem.milktea.model.note.timeline.TimelineRepository
import net.pantasystem.milktea.model.note.timeline.TimelineType
import retrofit2.Response


internal class TimelinePagingStoreImpl(
private val pageableTimeline: Pageable,
private val getAccount: suspend () -> Account,
private val getInitialLoadQuery: () -> InitialLoadQuery?,
private val misskeyAPIProvider: MisskeyAPIProvider,
private val timelineRepository: TimelineRepository,
private val pageId: Long? = null,
) : EntityConverter<Note.Id, Note.Id>, PreviousLoader<Note.Id>, FutureLoader<Note.Id>,
Expand Down Expand Up @@ -119,33 +115,5 @@ internal class TimelinePagingStoreImpl(
_state.value = state
}

private suspend fun getStore(): (suspend (NoteRequest) -> Response<List<NoteDTO>?>)? {
val account = getAccount.invoke()
val api = misskeyAPIProvider.get(account)
return try {
when (pageableTimeline) {
is Pageable.GlobalTimeline -> api::globalTimeline
is Pageable.LocalTimeline -> api::localTimeline
is Pageable.HybridTimeline -> api::hybridTimeline
is Pageable.HomeTimeline -> api::homeTimeline
is Pageable.Search -> api::searchNote
is Pageable.Favorite -> throw IllegalArgumentException("use FavoriteNotePagingStore.kt")
is Pageable.UserTimeline -> api::userNotes
is Pageable.UserListTimeline -> api::userListTimeline
is Pageable.SearchByTag -> api::searchByTag
is Pageable.Featured -> api::featured
is Pageable.Mention -> api::mentions
is Pageable.CalckeyRecommendedTimeline -> api::getCalckeyRecommendedTimeline
is Pageable.ClipNotes -> api::getClipNotes
is Pageable.Antenna -> (api)::antennasNotes
is Pageable.ChannelTimeline -> api::channelTimeline
else -> throw IllegalArgumentException("unknown class:${pageableTimeline.javaClass}")
}

} catch (e: NullPointerException) {
null
}

}
}

Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ class TimelineStoreImpl(
getInitialLoadQuery = {
initialLoadQuery
},
misskeyAPIProvider = misskeyAPIProvider,
timelineRepository = timelineRepository,
pageId = pageId,
)
Expand Down

0 comments on commit 4a00774

Please sign in to comment.