Commit fa7a0625 authored by Konstantin Tskhovrebov's avatar Konstantin Tskhovrebov 🤖

Refactor Screens class.

parent 7e6d529d
......@@ -46,10 +46,43 @@ import ru.terrakok.gitlabclient.ui.user.info.UserInfoFragment
* @author Konstantin Tskhovrebov (aka terrakok) on 26.03.17.
*/
object Screens {
//flows
object AuthFlow : SupportAppScreen() {
override fun getFragment() = FlowFactory.createAuthFlowFragment()
}
object DrawerFlow : SupportAppScreen() {
override fun getFragment() = DrawerFlowFragment()
}
data class ProjectFlow(
val projectId: Long
) : SupportAppScreen() {
override fun getFragment() = FlowFactory.createProjectFlowFragment(projectId)
}
data class UserFlow(
val userId: Long
) : SupportAppScreen() {
override fun getFragment() = FlowFactory.createUserFlowFragment(userId)
}
data class IssueFlow(
val projectId: Long,
val issueId: Long
) : SupportAppScreen() {
override fun getFragment() = FlowFactory.createIssueFlowFragment(projectId, issueId)
}
data class MergeRequestFlow(
val projectId: Long,
val mrId: Long
) : SupportAppScreen() {
override fun getFragment() = FlowFactory.createMergeRequestFlowFragment(projectId, mrId)
}
//screens
object Main : SupportAppScreen() {
override fun getFragment() = MainFragment()
}
......@@ -108,20 +141,10 @@ object Screens {
override fun getFragment() = LibrariesFragment()
}
object AuthFlow : SupportAppScreen() {
override fun getFragment() = FlowFactory.createAuthFlowFragment()
}
object Auth : SupportAppScreen() {
override fun getFragment() = AuthFragment()
}
data class ProjectFlow(
val projectId: Long
) : SupportAppScreen() {
override fun getFragment() = FlowFactory.createProjectFlowFragment(projectId)
}
object MainProject : SupportAppScreen() {
override fun getFragment() = MainProjectFragment()
}
......@@ -176,23 +199,10 @@ object Screens {
override fun getFragment() = ProjectFilesFragment()
}
data class UserFlow(
val userId: Long
) : SupportAppScreen() {
override fun getFragment() = FlowFactory.createUserFlowFragment(userId)
}
object UserInfo : SupportAppScreen() {
override fun getFragment() = UserInfoFragment()
}
data class MergeRequestFlow(
val projectId: Long,
val mrId: Long
) : SupportAppScreen() {
override fun getFragment() = FlowFactory.createMergeRequestFlowFragment(projectId, mrId)
}
object MainMergeRequest : SupportAppScreen() {
override fun getFragment() = MainMergeRequestFragment()
}
......@@ -213,13 +223,6 @@ object Screens {
override fun getFragment() = MergeRequestChangesFragment()
}
data class IssueFlow(
val projectId: Long,
val issueId: Long
) : SupportAppScreen() {
override fun getFragment() = FlowFactory.createIssueFlowFragment(projectId, issueId)
}
object MainIssue : SupportAppScreen() {
override fun getFragment() = MainIssueFragment()
}
......@@ -236,30 +239,11 @@ object Screens {
override fun getFragment() = PrivacyPolicyFragment()
}
//external flows
data class ExternalBrowserFlow(
val url: String
) : SupportAppScreen() {
override fun getActivityIntent(context: Context?) =
Intent(Intent.ACTION_VIEW, Uri.parse(url))
}
data class ShareFlow(
val text: String
) : SupportAppScreen() {
override fun getActivityIntent(context: Context?) =
Intent.createChooser(
Intent(Intent.ACTION_SEND).apply {
putExtra(Intent.EXTRA_TEXT, text)
type = "text/plain"
},
text
)
}
data class MilestoneFlow(
val milestoneId: Long
) : SupportAppScreen() {
//todo: implement milestone flow.
override fun getFragment() = StubFragment()
}
}
\ No newline at end of file
......@@ -70,7 +70,7 @@ class ProjectMilestonesPresenter @Inject constructor(
}
)
fun onMilestoneClick(milestoneId: Long) = router.startFlow(Screens.MilestoneFlow(milestoneId))
fun onMilestoneClick(milestoneId: Long) {} //todo: implement milestone screen.
fun refreshMilestones() = paginator.refresh()
fun loadNextMilestonesPage() = paginator.loadNewPage()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment