Commit 6e6607eb authored by Eugene Shapovalov's avatar Eugene Shapovalov 💬

Merge remote-tracking branch 'remotes/origin/develop' into fix/list_update

# Conflicts:
#	app/src/main/java/ru/terrakok/gitlabclient/model/repository/issue/IssueRepository.kt
#	app/src/main/java/ru/terrakok/gitlabclient/model/repository/mergerequest/MergeRequestRepository.kt
#	app/src/main/java/ru/terrakok/gitlabclient/ui/global/list/UserNoteAdapterDelegate.kt
parents 4bbb6c8a ac4587e7
......@@ -57,7 +57,7 @@ ext {
moxyVersion = "1.4.6"
toothpickVersion = "1.0.6"
retrofitVersion = "2.2.0"
markwonVersion = "1.0.3"
markwonVersion = "1.1.1"
}
dependencies {
......
......@@ -2,13 +2,13 @@ package ru.terrakok.gitlabclient
import android.content.Intent
import android.net.Uri
import ru.terrakok.gitlabclient.toothpick.DI
import ru.terrakok.gitlabclient.entity.issue.IssueState
import ru.terrakok.gitlabclient.entity.mergerequest.MergeRequestState
import ru.terrakok.gitlabclient.ui.about.AboutFragment
import ru.terrakok.gitlabclient.ui.auth.AuthFlowFragment
import ru.terrakok.gitlabclient.ui.auth.AuthFragment
import ru.terrakok.gitlabclient.ui.drawer.DrawerFlowFragment
import ru.terrakok.gitlabclient.ui.global.BaseFragment
import ru.terrakok.gitlabclient.ui.global.StubFragment
import ru.terrakok.gitlabclient.ui.issue.IssueFlowFragment
import ru.terrakok.gitlabclient.ui.issue.IssueFragment
import ru.terrakok.gitlabclient.ui.issue.IssueInfoFragment
......@@ -27,8 +27,12 @@ import ru.terrakok.gitlabclient.ui.my.mergerequests.MyMergeRequestsFragment
import ru.terrakok.gitlabclient.ui.my.todos.MyTodosContainerFragment
import ru.terrakok.gitlabclient.ui.my.todos.MyTodosFragment
import ru.terrakok.gitlabclient.ui.project.ProjectFlowFragment
import ru.terrakok.gitlabclient.ui.project.ProjectMainFlowFragment
import ru.terrakok.gitlabclient.ui.project.info.ProjectInfoFragment
import ru.terrakok.gitlabclient.ui.project.ProjectFragment
import ru.terrakok.gitlabclient.ui.project.ProjectInfoFragment
import ru.terrakok.gitlabclient.ui.project.issues.ProjectIssuesContainerFragment
import ru.terrakok.gitlabclient.ui.project.issues.ProjectIssuesFragment
import ru.terrakok.gitlabclient.ui.project.mergerequest.ProjectMergeRequestsContainerFragment
import ru.terrakok.gitlabclient.ui.project.mergerequest.ProjectMergeRequestsFragment
import ru.terrakok.gitlabclient.ui.projects.ProjectsContainerFragment
import ru.terrakok.gitlabclient.ui.projects.ProjectsListFragment
import ru.terrakok.gitlabclient.ui.user.UserFlowFragment
......@@ -65,7 +69,9 @@ object Screens {
const val PROJECT_FLOW = "project flow"
const val PROJECT_MAIN_FLOW = "project main flow"
const val PROJECT_INFO_SCREEN = "project info screen"
const val PROJECT_ISSUES_CONTAINER_SCREEN = "project issues container screen"
const val PROJECT_ISSUES_SCREEN = "project issues screen"
const val PROJECT_MR_CONTAINER_SCREEN = "project mr container screen"
const val PROJECT_MR_SCREEN = "project mr screen"
const val USER_FLOW = "user flow"
......@@ -134,10 +140,12 @@ object Screens {
Screens.USER_INFO_SCREEN -> UserInfoFragment()
Screens.PROJECT_FLOW -> ProjectFlowFragment.create(data as Long)
Screens.PROJECT_MAIN_FLOW -> ProjectMainFlowFragment()
Screens.PROJECT_MAIN_FLOW -> ProjectFragment()
Screens.PROJECT_INFO_SCREEN -> ProjectInfoFragment()
Screens.PROJECT_ISSUES_SCREEN -> StubFragment.create(DI.PROJECT_FLOW_SCOPE)
Screens.PROJECT_MR_SCREEN -> StubFragment.create(DI.PROJECT_FLOW_SCOPE)
Screens.PROJECT_ISSUES_CONTAINER_SCREEN -> ProjectIssuesContainerFragment()
Screens.PROJECT_ISSUES_SCREEN -> ProjectIssuesFragment.create(data as IssueState)
Screens.PROJECT_MR_CONTAINER_SCREEN -> ProjectMergeRequestsContainerFragment()
Screens.PROJECT_MR_SCREEN -> ProjectMergeRequestsFragment.create(data as MergeRequestState)
Screens.MR_FLOW -> {
val (projectId, mrId) = data as Pair<Long, Long>
......
......@@ -7,13 +7,13 @@ import ru.terrakok.gitlabclient.entity.Author
* Created by Konstantin Tskhovrebov (aka @terrakok) on 24.12.17.
*/
data class TargetHeader(
val author: Author,
val icon: TargetHeaderIcon,
val title: TargetHeaderTitle,
val body: CharSequence,
val date: LocalDateTime,
val target: AppTarget,
val targetId: Long,
val internal: TargetInternal?,
val badges: List<TargetBadge>
val author: Author,
val icon: TargetHeaderIcon,
val title: TargetHeaderTitle,
val body: CharSequence,
val date: LocalDateTime,
val target: AppTarget,
val targetId: Long,
val internal: TargetInternal?,
val badges: List<TargetBadge>
)
\ No newline at end of file
......@@ -24,5 +24,10 @@ data class Issue(
@SerializedName("web_url") val webUrl: String?,
@SerializedName("confidential") val confidential: Boolean,
@SerializedName("upvotes") val upvotes: Int,
@SerializedName("downvotes") val downvotes: Int
@SerializedName("downvotes") val downvotes: Int,
// The closed_by attribute was introduced in GitLab 10.6.
// This value will only be present for issues which were closed after GitLab 10.6 and
// when the user account that closed the issue still exists.
@SerializedName("closed_by") val closedBy: Author?,
@SerializedName("closed_at") val closedAt: LocalDateTime?
)
\ No newline at end of file
......@@ -34,5 +34,12 @@ data class MergeRequest(
@SerializedName("force_remove_source_branch") val forceRemoveSourceBranch: Boolean,
@SerializedName("web_url") val webUrl: String?,
@SerializedName("time_stats") val timeStats: MergeRequestTimeStats?,
@SerializedName("labels") val labels: List<String>
@SerializedName("labels") val labels: List<String>,
// The closed_by attribute was introduced in GitLab 10.6.
// This value will only be present for merge requests which were closed/merged after GitLab 10.6
// and when the user account that closed/merged the issue still exists.
@SerializedName("closed_by") val closedBy: Author?,
@SerializedName("closed_at") val closedAt: LocalDateTime?,
@SerializedName("merged_by") val mergedBy: Author?,
@SerializedName("merged_at") val mergedAt: LocalDateTime?
)
......@@ -91,6 +91,21 @@ interface GitlabApi {
@Query("per_page") pageSize: Int
): Single<List<Issue>>
@GET("$API_PATH/projects/{project_id}/issues")
fun getIssues(
@Path("project_id") projectId: Long,
@Query("scope") scope: IssueScope?,
@Query("state") state: IssueState?,
@Query("labels") labels: String?,
@Query("milestone") milestone: String?,
@Query("iids") iids: Array<Long>?,
@Query("order_by") orderBy: OrderBy?,
@Query("sort") sort: Sort?,
@Query("search") search: String?,
@Query("page") page: Int,
@Query("per_page") pageSize: Int
): Single<List<Issue>>
@GET("$API_PATH/projects/{project_id}/issues/{issue_id}")
fun getIssue(
@Path("project_id") projectId: Long,
......@@ -110,7 +125,7 @@ interface GitlabApi {
): Single<List<Event>>
@GET("$API_PATH/merge_requests")
fun getMergeRequests(
fun getMyMergeRequests(
@Query("state") state: MergeRequestState?,
@Query("milestone") milestone: String?,
@Query("view") viewType: MergeRequestViewType?,
......@@ -127,7 +142,8 @@ interface GitlabApi {
@Query("per_page") pageSize: Int
): Single<List<MergeRequest>>
fun getProjectMergeRequests(
@GET("$API_PATH/projects/{project_id}/merge_requests")
fun getMergeRequests(
@Path("project_id") projectId: Long,
@Query("state") state: MergeRequestState?,
@Query("milestone") milestone: String?,
......
package ru.terrakok.gitlabclient.model.data.server
import ru.terrakok.gitlabclient.entity.Project
import javax.inject.Inject
/**
* @author Eugene Shapovalov (CraggyHaggy) on 09.04.18.
*/
class MarkDownUrlResolver @Inject constructor() {
private val regex = Regex("^!\\[.+]\\(/uploads/.+/.+\\.\\w{3,4}\\)$")
// ![CragHag](/uploads/69c4ef83b86c66eb3f147915d26c427e/CragHag.png) - before attach
// ![2018-09-03_15.26.43](/uploads/c1fc914375a3d975f12bb6d54d1ee8c8/2018-09-03_15.26.43.jpg)
// https://gitlab.com/terrakok/gitlab-client/uploads/b4048510da2ba117cdc793007066bc25/CragHag.png link to download
// https://gitlab.com/CraggyHaggy/GandastBot/uploads/9475c799f5e9ad5cd1a8ce28ce652ff9/citadel.jpg
fun resolve(body: String, project: Project): String {
return if (regex.matches(body)) {
StringBuilder(body)
.insert(body.indexOf("/uploads/"), project.pathWithNamespace)
.toString()
} else {
body
}
}
}
\ No newline at end of file
......@@ -24,6 +24,19 @@ class IssueInteractor @Inject constructor(
page = page
)
fun getIssues(
projectId: Long,
issueState: IssueState?,
page: Int
) = issueRepository
.getIssues(
projectId = projectId,
state = issueState,
scope = IssueScope.ALL,
orderBy = OrderBy.UPDATED_AT,
page = page
)
fun getIssue(
projectId: Long,
issueId: Long
......
......@@ -14,13 +14,25 @@ class MergeRequestInteractor @Inject constructor(
onlyOpened: Boolean,
page: Int
) = mergeRequestRepository
.getMergeRequests(
.getMyMergeRequests(
scope = if (createdByMe) MergeRequestScope.CREATED_BY_ME else MergeRequestScope.ASSIGNED_TO_ME,
state = if (onlyOpened) MergeRequestState.OPENED else null,
orderBy = OrderBy.UPDATED_AT,
page = page
)
fun getMergeRequests(
projectId: Long,
mergeRequestState: MergeRequestState,
page: Int
) = mergeRequestRepository
.getMergeRequests(
projectId = projectId,
state = mergeRequestState,
orderBy = OrderBy.UPDATED_AT,
page = page
)
fun getMergeRequest(
projectId: Long,
mergeRequestId: Long
......
......@@ -15,6 +15,7 @@ import ru.terrakok.gitlabclient.entity.event.EventTarget
import ru.terrakok.gitlabclient.entity.event.EventTargetType
import ru.terrakok.gitlabclient.model.data.server.GitlabApi
import ru.terrakok.gitlabclient.model.system.SchedulersProvider
import ru.terrakok.gitlabclient.model.data.server.MarkDownUrlResolver
import ru.terrakok.gitlabclient.toothpick.PrimitiveWrapper
import ru.terrakok.gitlabclient.toothpick.qualifier.DefaultPageSize
import javax.inject.Inject
......@@ -25,7 +26,8 @@ import javax.inject.Inject
class EventRepository @Inject constructor(
private val api: GitlabApi,
private val schedulers: SchedulersProvider,
@DefaultPageSize private val defaultPageSizeWrapper: PrimitiveWrapper<Int>
@DefaultPageSize private val defaultPageSizeWrapper: PrimitiveWrapper<Int>,
private val markDownUrlResolver: MarkDownUrlResolver
) {
private val defaultPageSize = defaultPageSizeWrapper.value
......@@ -86,7 +88,7 @@ class EventRepository @Inject constructor(
targetData.name,
project?.name ?: ""
),
getBody(event) ?: "",
getBody(event, project) ?: "",
event.createdAt,
targetData.target,
targetData.id,
......@@ -209,9 +211,15 @@ class EventRepository @Inject constructor(
}
}
private fun getBody(event: Event) = when (event.targetType) {
private fun getBody(event: Event, project: Project?) = when (event.targetType) {
EventTargetType.NOTE,
EventTargetType.DIFF_NOTE -> event.note?.body
EventTargetType.DIFF_NOTE -> {
if (event.note != null && project != null) {
markDownUrlResolver.resolve(event.note.body, project)
} else {
null
}
}
EventTargetType.ISSUE,
EventTargetType.MERGE_REQUEST,
EventTargetType.MILESTONE -> event.targetTitle
......
......@@ -3,6 +3,7 @@ package ru.terrakok.gitlabclient.model.repository.issue
import io.reactivex.Observable
import io.reactivex.Single
import io.reactivex.functions.BiFunction
import ru.terrakok.gitlabclient.entity.Note
import ru.terrakok.gitlabclient.entity.OrderBy
import ru.terrakok.gitlabclient.entity.Project
import ru.terrakok.gitlabclient.entity.Sort
......@@ -12,6 +13,7 @@ import ru.terrakok.gitlabclient.entity.issue.Issue
import ru.terrakok.gitlabclient.entity.issue.IssueScope
import ru.terrakok.gitlabclient.entity.issue.IssueState
import ru.terrakok.gitlabclient.model.data.server.GitlabApi
import ru.terrakok.gitlabclient.model.data.server.MarkDownUrlResolver
import ru.terrakok.gitlabclient.model.system.SchedulersProvider
import ru.terrakok.gitlabclient.toothpick.PrimitiveWrapper
import ru.terrakok.gitlabclient.toothpick.qualifier.DefaultPageSize
......@@ -23,7 +25,8 @@ import javax.inject.Inject
class IssueRepository @Inject constructor(
private val api: GitlabApi,
private val schedulers: SchedulersProvider,
@DefaultPageSize private val defaultPageSizeWrapper: PrimitiveWrapper<Int>
@DefaultPageSize private val defaultPageSizeWrapper: PrimitiveWrapper<Int>,
private val markDownUrlResolver: MarkDownUrlResolver
) {
private val defaultPageSize = defaultPageSizeWrapper.value
......@@ -52,6 +55,32 @@ class IssueRepository @Inject constructor(
.subscribeOn(schedulers.io())
.observeOn(schedulers.ui())
fun getIssues(
projectId: Long,
scope: IssueScope? = null,
state: IssueState? = null,
labels: String? = null,
milestone: String? = null,
iids: Array<Long>? = null,
orderBy: OrderBy? = null,
sort: Sort? = null,
search: String? = null,
page: Int,
pageSize: Int = defaultPageSize
) = api
.getIssues(projectId, scope, state, labels, milestone, iids, orderBy, sort, search, page, pageSize)
.flatMap { issues ->
Single.zip(
Single.just(issues),
getDistinctProjects(issues),
BiFunction<List<Issue>, Map<Long, Project>, List<TargetHeader>> { sourceIssues, projects ->
sourceIssues.map { getTargetHeader(it, projects[it.projectId]!!) }
}
)
}
.subscribeOn(schedulers.io())
.observeOn(schedulers.ui())
private fun getDistinctProjects(events: List<Issue>): Single<Map<Long, Project>> {
return Observable.fromIterable(events)
.distinct { it.projectId }
......@@ -105,11 +134,31 @@ class IssueRepository @Inject constructor(
fun getIssueNotes(
projectId: Long,
issueId: Long
) = api
.getIssueDiscussions(projectId, issueId)
.flattenAsObservable { it }
.concatMap { discussion -> Observable.fromIterable(discussion.notes) }
.toList()
) = Single
.zip(
api.getProject(projectId),
getDiscussionNotes(projectId, issueId),
BiFunction<Project, List<Note>, List<Note>> { project, notes ->
ArrayList(notes).apply {
val iterator = listIterator()
while (iterator.hasNext()) {
val note = iterator.next()
val resolved = markDownUrlResolver.resolve(note.body, project)
if (resolved != note.body) {
iterator.set(note.copy(body = resolved))
}
}
}
}
)
.subscribeOn(schedulers.io())
.observeOn(schedulers.ui())
private fun getDiscussionNotes(projectId: Long, issueId: Long) =
api
.getIssueDiscussions(projectId, issueId)
.flattenAsObservable { it }
.concatMap { discussion -> Observable.fromIterable(discussion.notes) }
.toList()
}
\ No newline at end of file
......@@ -4,6 +4,7 @@ import io.reactivex.Observable
import io.reactivex.Single
import io.reactivex.functions.BiFunction
import org.threeten.bp.LocalDateTime
import ru.terrakok.gitlabclient.entity.Note
import ru.terrakok.gitlabclient.entity.OrderBy
import ru.terrakok.gitlabclient.entity.Project
import ru.terrakok.gitlabclient.entity.Sort
......@@ -14,6 +15,7 @@ import ru.terrakok.gitlabclient.entity.mergerequest.MergeRequestScope
import ru.terrakok.gitlabclient.entity.mergerequest.MergeRequestState
import ru.terrakok.gitlabclient.entity.mergerequest.MergeRequestViewType
import ru.terrakok.gitlabclient.model.data.server.GitlabApi
import ru.terrakok.gitlabclient.model.data.server.MarkDownUrlResolver
import ru.terrakok.gitlabclient.model.system.SchedulersProvider
import ru.terrakok.gitlabclient.toothpick.PrimitiveWrapper
import ru.terrakok.gitlabclient.toothpick.qualifier.DefaultPageSize
......@@ -22,11 +24,12 @@ import javax.inject.Inject
class MergeRequestRepository @Inject constructor(
private val api: GitlabApi,
private val schedulers: SchedulersProvider,
@DefaultPageSize private val defaultPageSizeWrapper: PrimitiveWrapper<Int>
@DefaultPageSize private val defaultPageSizeWrapper: PrimitiveWrapper<Int>,
private val markDownUrlResolver: MarkDownUrlResolver
) {
private val defaultPageSize = defaultPageSizeWrapper.value
fun getMergeRequests(
fun getMyMergeRequests(
state: MergeRequestState? = null,
milestone: String? = null,
viewType: MergeRequestViewType? = null,
......@@ -42,7 +45,7 @@ class MergeRequestRepository @Inject constructor(
page: Int,
pageSize: Int = defaultPageSize
) = api
.getMergeRequests(
.getMyMergeRequests(
state, milestone, viewType, labels, createdBefore, createdAfter, scope,
authorId, assigneeId, meReactionEmoji, orderBy, sort, page, pageSize
)
......@@ -58,6 +61,39 @@ class MergeRequestRepository @Inject constructor(
.subscribeOn(schedulers.io())
.observeOn(schedulers.ui())
fun getMergeRequests(
projectId: Long,
state: MergeRequestState? = null,
milestone: String? = null,
viewType: MergeRequestViewType? = null,
labels: String? = null,
createdBefore: LocalDateTime? = null,
createdAfter: LocalDateTime? = null,
scope: MergeRequestScope? = null,
authorId: Int? = null,
assigneeId: Int? = null,
meReactionEmoji: String? = null,
orderBy: OrderBy? = null,
sort: Sort? = null,
page: Int,
pageSize: Int = defaultPageSize
) = api
.getMergeRequests(
projectId, state, milestone, viewType, labels, createdBefore, createdAfter,
scope, authorId, assigneeId, meReactionEmoji, orderBy, sort, page, pageSize
)
.flatMap { mrs ->
Single.zip(
Single.just(mrs),
getDistinctProjects(mrs),
BiFunction<List<MergeRequest>, Map<Long, Project>, List<TargetHeader>> { sourceMrs, projects ->
sourceMrs.map { getTargetHeader(it, projects[it.projectId]!!) }
}
)
}
.subscribeOn(schedulers.io())
.observeOn(schedulers.ui())
private fun getDistinctProjects(mrs: List<MergeRequest>): Single<Map<Long, Project>> {
return Observable.fromIterable(mrs)
.distinct { it.projectId }
......@@ -112,11 +148,31 @@ class MergeRequestRepository @Inject constructor(
fun getMergeRequestNotes(
projectId: Long,
mergeRequestId: Long
) = api
.getMergeRequestDiscussions(projectId, mergeRequestId)
.flattenAsObservable { it }
.concatMap { discussion -> Observable.fromIterable(discussion.notes) }
.toList()
) = Single
.zip(
api.getProject(projectId),
getDiscussionNotes(projectId, mergeRequestId),
BiFunction<Project, List<Note>, List<Note>> { project, notes ->
ArrayList(notes).apply {
val iterator = listIterator()
while (iterator.hasNext()) {
val note = iterator.next()
val resolved = markDownUrlResolver.resolve(note.body, project)
if (resolved != note.body) {
iterator.set(note.copy(body = resolved))
}
}
}
}
)
.subscribeOn(schedulers.io())
.observeOn(schedulers.ui())
private fun getDiscussionNotes(projectId: Long, mergeRequestId: Long) =
api
.getMergeRequestDiscussions(projectId, mergeRequestId)
.flattenAsObservable { it }
.concatMap { discussion -> Observable.fromIterable(discussion.notes) }
.toList()
}
\ No newline at end of file
......@@ -10,16 +10,12 @@ import ru.terrakok.gitlabclient.model.system.SchedulersProvider
*/
class MarkDownConverter(
private val config: SpannableConfiguration,
private val imageHostHolder: ImageHostHolder,
private val schedulers: SchedulersProvider
) {
class ImageHostHolder(var url: String)
fun markdownToSpannable(raw: String): Single<CharSequence> = Single
.fromCallable {
// imageHostHolder.url = "" todo resolve image urls
Markwon.markdown(config, raw)
}
.subscribeOn(schedulers.computation())
.observeOn(schedulers.ui())
fun markdownToSpannable(raw: String): Single<CharSequence> =
Single
.fromCallable { Markwon.markdown(config, raw) }
.subscribeOn(schedulers.computation())
.observeOn(schedulers.ui())
}
\ No newline at end of file
......@@ -34,9 +34,8 @@ class IssueNotesPresenter @Inject constructor(
private fun requestNotes() {
issueInteractor.getIssueNotes(projectId, issueId)
.toObservable()
.flatMapIterable { it }
.flatMap { note ->
.flattenAsObservable { it }
.concatMap { note ->
mdConverter.markdownToSpannable(note.body)
.map { NoteWithFormattedBody(note, it) }
.toObservable()
......
......@@ -34,9 +34,8 @@ class MergeRequestNotesPresenter @Inject constructor(
private fun requestNotes() {
mrInteractor.getMergeRequestNotes(projectId, mrId)
.toObservable()
.flatMapIterable { it }
.flatMap { note ->
.flattenAsObservable { it }
.concatMap { note ->
mdConverter.markdownToSpannable(note.body)
.map { NoteWithFormattedBody(note, it) }
.toObservable()
......
......@@ -6,7 +6,11 @@ import ru.terrakok.gitlabclient.entity.app.target.TargetHeader
import ru.terrakok.gitlabclient.extension.openInfo
import ru.terrakok.gitlabclient.model.interactor.event.EventInteractor
import ru.terrakok.gitlabclient.model.system.flow.FlowRouter
import ru.terrakok.gitlabclient.presentation.global.*
import ru.terrakok.gitlabclient.presentation.global.BasePresenter
import ru.terrakok.gitlabclient.presentation.global.ErrorHandler
import ru.terrakok.gitlabclient.presentation.global.GlobalMenuController
import ru.terrakok.gitlabclient.presentation.global.MarkDownConverter
import ru.terrakok.gitlabclient.presentation.global.Paginator
import javax.inject.Inject
/**
......@@ -30,9 +34,8 @@ class MyEventsPresenter @Inject constructor(
private val paginator = Paginator(
{
eventInteractor.getEvents(it)
.toObservable()
.flatMapIterable { it }
.flatMap { item ->
.flattenAsObservable { it }
.concatMap { item ->
mdConverter.markdownToSpannable(item.body.toString())
.map { md -> item.copy(body = md) }
.toObservable()
......
......@@ -36,9 +36,8 @@ class MyIssuesPresenter @Inject constructor(
private val paginator = Paginator(
{
issueInteractor.getMyIssues(filter.createdByMe, filter.onlyOpened, it)
.toObservable()
.flatMapIterable { it }
.flatMap { item ->
.flattenAsObservable { it }
.concatMap { item ->
mdConverter.markdownToSpannable(item.body.toString())
.map { md -> item.copy(body = md) }
.toObservable()
......
......@@ -33,9 +33,8 @@ class MyMergeRequestsPresenter @Inject constructor(
private val paginator = Paginator(
{
interactor.getMyMergeRequests(filter.createdByMe, filter.onlyOpened, it)
.toObservable()
.flatMapIterable { it }
.flatMap { item ->
.flattenAsObservable { it }
.concatMap { item ->
mdConverter.markdownToSpannable(item.body.toString())
.map { md -> item.copy(body = md) }
.toObservable()
......
......@@ -37,9 +37,8 @@ class MyTodosPresenter @Inject constructor(
private val paginator = Paginator(
{
todoListInteractor.getMyTodos(isPending, it)
.toObservable()
.flatMapIterable { it }
.flatMap { item ->
.flattenAsObservable { it }
.concatMap { item ->
mdConverter.markdownToSpannable(item.body.toString())
.map { md -> item.copy(body = md) }
.toObservable()
......
......@@ -3,7 +3,6 @@ package ru.terrakok.gitlabclient.presentation.project.info
import com.arellomobile.mvp.InjectViewState
import io.reactivex.Single
import ru.terrakok.gitlabclient.model.interactor.project.ProjectInteractor
import ru.terrakok.gitlabclient.model.system.flow.FlowRouter
import ru.terrakok.gitlabclient.presentation.global.BasePresenter
import ru.terrakok.gitlabclient.presentation.global.ErrorHandler
import ru.terrakok.gitlabclient.presentation.global.MarkDownConverter
......@@ -17,7 +16,6 @@ import javax.inject.Inject
@InjectViewState
class ProjectInfoPresenter @Inject constructor(
@ProjectId private val projectIdWrapper: PrimitiveWrapper<Long>,
private val router: FlowRouter,
private val projectInteractor: ProjectInteractor,
private val mdConverter: MarkDownConverter,
private val errorHandler: ErrorHandler
......@@ -50,6 +48,4 @@ class ProjectInfoPresenter @Inject constructor(
)
.connect()
}
fun onBackPressed() = router.exit()
}
\ No newline at end of file
......@@ -11,6 +11,7 @@ import ru.terrakok.gitlabclient.entity.Project
*/
@StateStrategyType(AddToEndSingleStrategy::class)
interface ProjectInfoView : MvpView {
fun showProject(project: Project, mdReadme: CharSequence)
fun showProgress(show: Boolean)
......
package ru.terrakok.gitlabclient.presentation.project.issues
import com.arellomobile.mvp.InjectViewState
import ru.terrakok.gitlabclient.Screens
import ru.terrakok.gitlabclient.entity.app.target.TargetHeader
import ru.terrakok.gitlabclient.entity.issue.IssueState
import ru.terrakok.gitlabclient.extension.openInfo
import ru.terrakok.gitlabclient.model.interactor.issue.IssueInteractor
import ru.terrakok.gitlabclient.model.system.flow.FlowRouter
import ru.terrakok.gitlabclient.presentation.global.BasePresenter
import ru.terrakok.gitlabclient.presentation.global.ErrorHandler
import ru.terrakok.gitlabclient.presentation.global.MarkDownConverter
import ru.terrakok.gitlabclient.presentation.global.Paginator