Commit 378a4c8e authored by Konstantin Tskhovrebov's avatar Konstantin Tskhovrebov 🤖

Merge branch 'task/add_imported_event' into 'develop'

Add imported EventAction

See merge request !160
parents bc588fc9 687c0529
......@@ -5,6 +5,7 @@ package ru.terrakok.gitlabclient.entity.app.target
*/
enum class TargetHeaderIcon {
CREATED,
IMPORTED,
JOINED,
COMMENTED,
MERGED,
......
......@@ -12,6 +12,8 @@ enum class EventAction(private val jsonName: String) {
COMMENTED_ON("commented on"),
@SerializedName("created")
CREATED("created"),
@SerializedName("imported")
IMPORTED("imported"),
@SerializedName("pushed to")
PUSHED_TO("pushed to"),
@SerializedName("pushed new")
......
......@@ -71,11 +71,13 @@ fun EventAction.getHumanName(resources: Resources) = when (this) {
EventAction.COMMENTED_ON -> resources.getString(R.string.event_action_commented_on)
EventAction.JOINED -> resources.getString(R.string.event_action_joined)
EventAction.CREATED -> resources.getString(R.string.event_action_created)
EventAction.IMPORTED -> resources.getString(R.string.event_action_imported)
}
@DrawableRes
fun TargetHeaderIcon.getIcon() = when (this) {
TargetHeaderIcon.CREATED -> R.drawable.ic_event_created_24dp
TargetHeaderIcon.IMPORTED -> R.drawable.ic_event_imported_24dp
TargetHeaderIcon.JOINED -> R.drawable.ic_event_joined_24dp
TargetHeaderIcon.COMMENTED -> R.drawable.ic_event_commented_24dp
TargetHeaderIcon.MERGED -> R.drawable.ic_event_merged_24dp
......@@ -101,7 +103,11 @@ fun TodoAction.getHumanName(resources: Resources): String = when (this) {
fun TargetHeaderTitle.getHumanName(resources: Resources) = when (this) {
is TargetHeaderTitle.Event -> {
"$userName ${action.getHumanName(resources)} $targetName ${resources.getString(R.string.at)} $projectName"
if (action == EventAction.IMPORTED) {
"$userName ${action.getHumanName(resources)} $targetName $projectName"
} else {
"$userName ${action.getHumanName(resources)} $targetName ${resources.getString(R.string.at)} $projectName"
}
}
is TargetHeaderTitle.Todo -> {
val actionName = action.getHumanName(resources)
......
......@@ -155,6 +155,7 @@ class EventRepository @Inject constructor(
private fun getIcon(action: EventAction) = when (action) {
EventAction.CREATED -> TargetHeaderIcon.CREATED
EventAction.IMPORTED -> TargetHeaderIcon.IMPORTED
EventAction.JOINED -> TargetHeaderIcon.JOINED
EventAction.COMMENTED_ON,
EventAction.COMMENTED -> TargetHeaderIcon.COMMENTED
......@@ -240,6 +241,8 @@ class EventRepository @Inject constructor(
event.projectId
)
}
} else if (event.actionName == EventAction.IMPORTED) {
TargetData(AppTarget.PROJECT, AppTarget.PROJECT.toString(), event.projectId)
} else {
TargetData(AppTarget.PROJECT, "${AppTarget.PROJECT} ${event.projectId}", event.projectId)
}
......
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="401.952"
android:viewportHeight="401.952">
<path
android:fillColor="#FFFFFF"
android:pathData="M279.368,211.107L247.84,211.107c-5.573,0 -10.134,-4.56 -10.134,-10.133l-0.049,-32.893L237.657,81.28l0,0C237.296,76.027 232.732,71.841 227.396,71.839l-53.197,0.001c-5.573,0 -10.133,4.558 -10.133,10.129l0.179,119.004c0,5.573 -4.558,10.133 -10.132,10.133L122.586,211.107c-5.574,0 -7.173,3.467 -3.557,7.707l75.367,108.12c3.619,4.24 9.541,4.24 13.159,0l75.364,-108.118C286.539,214.576 284.942,211.107 279.368,211.107z" />
</vector>
......@@ -102,6 +102,7 @@
<string name="event_action_closed">closed</string>
<string name="event_action_commented_on">commented on</string>
<string name="event_action_created">created</string>
<string name="event_action_imported">imported</string>
<string name="event_action_pushed_to">pushed to</string>
<string name="event_action_pushed_new">pushed new</string>
<string name="event_action_deleted">deleted</string>
......
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