Commit 418e4d94 authored by Eugene Shapovalov's avatar Eugene Shapovalov 💬

Merge remote-tracking branch 'remotes/origin/develop' into feature/issue_merge_request_info

# Conflicts:
#	app/src/main/java/ru/terrakok/gitlabclient/entity/Note.kt
#	app/src/main/java/ru/terrakok/gitlabclient/entity/app/target/TargetHeader.kt
#	app/src/main/java/ru/terrakok/gitlabclient/entity/event/Event.kt
#	app/src/main/java/ru/terrakok/gitlabclient/entity/issue/Issue.kt
#	app/src/main/java/ru/terrakok/gitlabclient/entity/mergerequest/MergeRequest.kt
#	app/src/main/java/ru/terrakok/gitlabclient/entity/target/Target.kt
#	app/src/main/java/ru/terrakok/gitlabclient/entity/todo/Todo.kt
#	app/src/main/java/ru/terrakok/gitlabclient/model/data/server/deserializer/TodoDeserializer.kt
parents 6a05de19 c1365b10
......@@ -3,12 +3,12 @@ package ru.terrakok.gitlabclient.di.provider
import com.google.gson.Gson
import com.google.gson.GsonBuilder
import org.threeten.bp.LocalDate
import org.threeten.bp.LocalDateTime
import org.threeten.bp.OffsetDateTime
import ru.terrakok.gitlabclient.entity.Color
import ru.terrakok.gitlabclient.entity.todo.Todo
import ru.terrakok.gitlabclient.model.data.server.deserializer.ColorDeserializer
import ru.terrakok.gitlabclient.model.data.server.deserializer.LocalDateTimeDeserializer
import ru.terrakok.gitlabclient.model.data.server.deserializer.LocalDateDeserializer
import ru.terrakok.gitlabclient.model.data.server.deserializer.OffsetDateTimeDeserializer
import ru.terrakok.gitlabclient.model.data.server.deserializer.TodoDeserializer
import javax.inject.Inject
import javax.inject.Provider
......@@ -20,9 +20,9 @@ class GsonProvider @Inject constructor() : Provider<Gson> {
override fun get(): Gson =
GsonBuilder()
.registerTypeAdapter(LocalDateTime::class.java, LocalDateTimeDeserializer())
.registerTypeAdapter(Todo::class.java, TodoDeserializer())
.registerTypeAdapter(Color::class.java, ColorDeserializer())
.registerTypeAdapter(LocalDate::class.java, LocalDateDeserializer())
.registerTypeAdapter(OffsetDateTime::class.java, OffsetDateTimeDeserializer())
.create()
}
\ No newline at end of file
package ru.terrakok.gitlabclient.entity
import com.google.gson.annotations.SerializedName
import org.threeten.bp.LocalDateTime
import org.threeten.bp.OffsetDateTime
/**
* Created by Eugene Shapovalov (@CraggyHaggy) on 20.10.18.
......@@ -12,11 +12,11 @@ data class Commit(
@SerializedName("title") val title: String,
@SerializedName("author_name") val authorName: String,
@SerializedName("author_email") val authorEmail: String?,
@SerializedName("authored_date") val authoredDate: LocalDateTime,
@SerializedName("authored_date") val authoredDate: OffsetDateTime,
@SerializedName("commiter_name") val commiterName: String?,
@SerializedName("commiter_email") val commiterEmail: String?,
@SerializedName("commited_date") val commitedDate: LocalDateTime?,
@SerializedName("created_at") val createdAt: LocalDateTime,
@SerializedName("commited_date") val commitedDate: OffsetDateTime?,
@SerializedName("created_at") val createdAt: OffsetDateTime,
@SerializedName("message") val message: String,
@SerializedName("parent_ids") val parentIds: List<String>
)
\ No newline at end of file
package ru.terrakok.gitlabclient.entity
import com.google.gson.annotations.SerializedName
import org.threeten.bp.LocalDateTime
import org.threeten.bp.OffsetDateTime
import ru.terrakok.gitlabclient.entity.event.EventTargetType
data class Note(
@SerializedName("id") val id: Long,
@SerializedName("body") val body: String,
@SerializedName("author") val author: ShortUser,
@SerializedName("created_at") val createdAt: LocalDateTime,
@SerializedName("updated_at") val updatedAt: LocalDateTime?,
@SerializedName("created_at") val createdAt: OffsetDateTime,
@SerializedName("updated_at") val updatedAt: OffsetDateTime?,
@SerializedName("system") val isSystem: Boolean,
@SerializedName("noteable_id") val noteableId: Long,
@SerializedName("noteable_type") val noteableType: EventTargetType?,
......
package ru.terrakok.gitlabclient.entity
import com.google.gson.annotations.SerializedName
import org.threeten.bp.LocalDateTime
import org.threeten.bp.OffsetDateTime
data class Owner(
@SerializedName("id") val id: Long,
@SerializedName("name") val name: String,
@SerializedName("username") val username: String,
@SerializedName("created_at") val createdAt: LocalDateTime?
@SerializedName("created_at") val createdAt: OffsetDateTime?
)
package ru.terrakok.gitlabclient.entity
import com.google.gson.annotations.SerializedName
import org.threeten.bp.LocalDateTime
import org.threeten.bp.OffsetDateTime
data class Project(
@SerializedName("id") val id: Long,
......@@ -24,8 +24,8 @@ data class Project(
@SerializedName("wiki_enabled") val wikiEnabled: Boolean,
@SerializedName("snippets_enabled") val snippetsEnabled: Boolean,
@SerializedName("container_registry_enabled") val containerRegistryEnabled: Boolean,
@SerializedName("created_at") val createdAt: LocalDateTime?,
@SerializedName("last_activity_at") val lastActivityAt: LocalDateTime?,
@SerializedName("created_at") val createdAt: OffsetDateTime?,
@SerializedName("last_activity_at") val lastActivityAt: OffsetDateTime?,
@SerializedName("creator_id") val creatorId: Long,
@SerializedName("namespace") val namespace: Namespace?,
@SerializedName("permissions") val permissions: Permissions?,
......
package ru.terrakok.gitlabclient.entity
import com.google.gson.annotations.SerializedName
import org.threeten.bp.LocalDateTime
import org.threeten.bp.OffsetDateTime
data class User(
@SerializedName("id") val id: Long,
......@@ -11,7 +11,7 @@ data class User(
@SerializedName("state") val state: String?,
@SerializedName("avatar_url") val avatarUrl: String?,
@SerializedName("web_url") val webUrl: String?,
@SerializedName("created_at") val createdAt: LocalDateTime,
@SerializedName("created_at") val createdAt: OffsetDateTime,
@SerializedName("is_admin") val isAdmin: Boolean,
@SerializedName("bio") val bio: String?,
@SerializedName("location") val location: String?,
......@@ -20,11 +20,11 @@ data class User(
@SerializedName("twitter") val twitter: String?,
@SerializedName("website_url") val websiteUrl: String?,
@SerializedName("organization") val organization: String?,
@SerializedName("last_sign_in_at") val lastSignInAt: LocalDateTime,
@SerializedName("confirmed_at") val confirmedAt: LocalDateTime,
@SerializedName("last_sign_in_at") val lastSignInAt: OffsetDateTime,
@SerializedName("confirmed_at") val confirmedAt: OffsetDateTime,
@SerializedName("color_scheme_id") val colorSchemeId: Long,
@SerializedName("projects_limit") val projectsLimit: Long,
@SerializedName("current_sign_in_at") val currentSignInAt: LocalDateTime,
@SerializedName("current_sign_in_at") val currentSignInAt: OffsetDateTime,
@SerializedName("identities") val identities: List<Identity>?,
@SerializedName("can_create_group") val canCreateGroup: Boolean,
@SerializedName("can_create_project") val canCreateProject: Boolean,
......
package ru.terrakok.gitlabclient.entity.app.target
import org.threeten.bp.LocalDateTime
import org.threeten.bp.OffsetDateTime
import ru.terrakok.gitlabclient.entity.ShortUser
/**
......@@ -12,7 +12,7 @@ sealed class TargetHeader {
val icon: TargetHeaderIcon,
val title: TargetHeaderTitle,
val body: CharSequence,
val date: LocalDateTime,
val date: OffsetDateTime,
val target: AppTarget,
val targetId: Long,
val internal: TargetInternal?,
......
package ru.terrakok.gitlabclient.entity.event
import com.google.gson.annotations.SerializedName
import org.threeten.bp.LocalDateTime
import org.threeten.bp.OffsetDateTime
import ru.terrakok.gitlabclient.entity.Note
import ru.terrakok.gitlabclient.entity.PushData
import ru.terrakok.gitlabclient.entity.ShortUser
......@@ -17,7 +17,7 @@ data class Event(
@SerializedName("target_type") val targetType: EventTargetType?,
@SerializedName("author_id") val authorId: Long,
@SerializedName("target_title") val targetTitle: String?,
@SerializedName("created_at") val createdAt: LocalDateTime,
@SerializedName("created_at") val createdAt: OffsetDateTime,
@SerializedName("author") val author: ShortUser,
@SerializedName("author_username") val authorUsername: String,
@SerializedName("push_data") val pushData: PushData?,
......
......@@ -2,7 +2,7 @@ package ru.terrakok.gitlabclient.entity.issue
import com.google.gson.annotations.SerializedName
import org.threeten.bp.LocalDate
import org.threeten.bp.LocalDateTime
import org.threeten.bp.OffsetDateTime
import ru.terrakok.gitlabclient.entity.ShortUser
import ru.terrakok.gitlabclient.entity.TimeStats
import ru.terrakok.gitlabclient.entity.milestone.Milestone
......@@ -16,9 +16,9 @@ data class Issue(
@SerializedName("milestone") val milestone: Milestone?,
@SerializedName("project_id") val projectId: Long,
@SerializedName("assignees") val assignees: List<ShortUser>,
@SerializedName("updated_at") val updatedAt: LocalDateTime?,
@SerializedName("updated_at") val updatedAt: OffsetDateTime?,
@SerializedName("title") val title: String?,
@SerializedName("created_at") val createdAt: LocalDateTime,
@SerializedName("created_at") val createdAt: OffsetDateTime,
@SerializedName("labels") val labels: List<String>,
@SerializedName("user_notes_count") val userNotesCount: Int,
@SerializedName("due_date") val dueDate: LocalDate?,
......@@ -30,7 +30,7 @@ data class Issue(
// 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: ShortUser?,
@SerializedName("closed_at") val closedAt: LocalDateTime?,
@SerializedName("closed_at") val closedAt: OffsetDateTime?,
// The merge_requests_count attribute was introduced in GitLab 11.9.
@SerializedName("merge_requests_count") val relatedMergeRequestCount: Int,
@SerializedName("time_stats") val timeStats: TimeStats,
......
package ru.terrakok.gitlabclient.entity.mergerequest
import com.google.gson.annotations.SerializedName
import org.threeten.bp.LocalDateTime
import org.threeten.bp.OffsetDateTime
import ru.terrakok.gitlabclient.entity.ShortUser
import ru.terrakok.gitlabclient.entity.TimeStats
import ru.terrakok.gitlabclient.entity.milestone.Milestone
......@@ -9,8 +9,8 @@ import ru.terrakok.gitlabclient.entity.milestone.Milestone
data class MergeRequest(
@SerializedName("id") val id: Long,
@SerializedName("iid") val iid: Long,
@SerializedName("created_at") val createdAt: LocalDateTime,
@SerializedName("updated_at") val updatedAt: LocalDateTime?,
@SerializedName("created_at") val createdAt: OffsetDateTime,
@SerializedName("updated_at") val updatedAt: OffsetDateTime?,
@SerializedName("target_branch") val targetBranch: String,
@SerializedName("source_branch") val sourceBranch: String,
@SerializedName("project_id") val projectId: Long,
......@@ -38,9 +38,9 @@ data class MergeRequest(
// 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: ShortUser?,
@SerializedName("closed_at") val closedAt: LocalDateTime?,
@SerializedName("closed_at") val closedAt: OffsetDateTime?,
@SerializedName("merged_by") val mergedBy: ShortUser?,
@SerializedName("merged_at") val mergedAt: LocalDateTime?,
@SerializedName("merged_at") val mergedAt: OffsetDateTime?,
@SerializedName("changes") val changes: List<MergeRequestChange>?,
@SerializedName("assignees") val assignees: List<ShortUser>,
@SerializedName("time_stats") val timeStats: TimeStats,
......
......@@ -2,7 +2,7 @@ package ru.terrakok.gitlabclient.entity.milestone
import com.google.gson.annotations.SerializedName
import org.threeten.bp.LocalDate
import org.threeten.bp.LocalDateTime
import org.threeten.bp.OffsetDateTime
data class Milestone(
@SerializedName("id") val id: Long,
......@@ -12,8 +12,8 @@ data class Milestone(
@SerializedName("state") val state: MilestoneState,
@SerializedName("due_date") val dueDate: LocalDate?,
@SerializedName("start_date") val startDate: LocalDate?,
@SerializedName("created_at") val createdAt: LocalDateTime?,
@SerializedName("created_at") val createdAt: OffsetDateTime?,
@SerializedName("title") val title: String?,
@SerializedName("updated_at") val updatedAt: LocalDateTime?,
@SerializedName("updated_at") val updatedAt: OffsetDateTime?,
@SerializedName("web_url") val webUrl: String?
)
package ru.terrakok.gitlabclient.entity.target
import com.google.gson.annotations.SerializedName
import org.threeten.bp.LocalDateTime
import org.threeten.bp.OffsetDateTime
import ru.terrakok.gitlabclient.entity.ShortUser
import ru.terrakok.gitlabclient.entity.TimeStats
import ru.terrakok.gitlabclient.entity.milestone.Milestone
......@@ -21,9 +21,9 @@ abstract class Target {
@SerializedName("state")
private val _state: TargetState? = null
@SerializedName("updated_at")
val updatedAt: LocalDateTime? = null
val updatedAt: OffsetDateTime? = null
@SerializedName("created_at")
val createdAt: LocalDateTime? = null
val createdAt: OffsetDateTime? = null
@SerializedName("labels")
private val _labels: List<String>? = null
@SerializedName("milestone")
......
package ru.terrakok.gitlabclient.entity.target.issue
import com.google.gson.annotations.SerializedName
import org.threeten.bp.LocalDate
import ru.terrakok.gitlabclient.entity.Links
import ru.terrakok.gitlabclient.entity.target.Target
......@@ -9,7 +10,7 @@ import ru.terrakok.gitlabclient.entity.target.Target
*/
class Issue : Target() {
@SerializedName("due_date")
val dueDate: String? = null
val dueDate: LocalDate? = null
@SerializedName("confidential")
private val _confidential: Boolean? = null
@SerializedName("weight")
......
package ru.terrakok.gitlabclient.entity.todo
import org.threeten.bp.LocalDateTime
import org.threeten.bp.OffsetDateTime
import ru.terrakok.gitlabclient.entity.Project
import ru.terrakok.gitlabclient.entity.ShortUser
import ru.terrakok.gitlabclient.entity.target.Target
......@@ -19,5 +19,5 @@ data class Todo(
val targetUrl: String,
val body: String,
val state: TodoState,
val createdAt: LocalDateTime
val createdAt: OffsetDateTime
)
\ No newline at end of file
......@@ -5,7 +5,7 @@ import android.content.res.Resources
import androidx.annotation.DrawableRes
import org.threeten.bp.Duration
import org.threeten.bp.LocalDate
import org.threeten.bp.LocalDateTime
import org.threeten.bp.OffsetDateTime
import org.threeten.bp.format.DateTimeFormatter
import retrofit2.HttpException
import ru.terrakok.gitlabclient.R
......@@ -42,8 +42,11 @@ fun Throwable.userMessage(resourceManager: ResourceManager) = when (this) {
}
private val DATE_FORMAT = DateTimeFormatter.ofPattern("dd MMM yyyy")
fun LocalDateTime.humanTime(resources: Resources): String {
val delta = Duration.between(this, LocalDateTime.now())
fun OffsetDateTime.humanTime(resources: Resources): String {
val now = OffsetDateTime.now()
val ui = OffsetDateTime.of(toLocalDateTime(), now.offset)
val delta = Duration.between(ui, now)
.seconds
.let { maxOf(0, it) }
......@@ -59,7 +62,7 @@ fun LocalDateTime.humanTime(resources: Resources): String {
return resources.getString(R.string.time_ago, timeStr)
}
fun LocalDate.humanDate() = format(DATE_FORMAT)
fun LocalDate.humanDate(): String = format(DATE_FORMAT)
fun EventAction.getHumanName(resources: Resources) = when (this) {
EventAction.UPDATED -> resources.getString(R.string.event_action_updated)
......
......@@ -2,7 +2,8 @@ package ru.terrakok.gitlabclient.model.data.server
import io.reactivex.Completable
import io.reactivex.Single
import org.threeten.bp.LocalDateTime
import org.threeten.bp.LocalDate
import org.threeten.bp.OffsetDateTime
import retrofit2.adapter.rxjava2.Result
import retrofit2.http.*
import ru.terrakok.gitlabclient.entity.*
......@@ -163,8 +164,8 @@ interface GitlabApi {
@Query("milestone") milestone: String?,
@Query("view") viewType: MergeRequestViewType?,
@Query("labels") labels: String?,
@Query("created_before") createdBefore: LocalDateTime?,
@Query("created_after") createdAfter: LocalDateTime?,
@Query("created_before") createdBefore: OffsetDateTime?,
@Query("created_after") createdAfter: OffsetDateTime?,
@Query("scope") scope: MergeRequestScope?,
@Query("author_id") authorId: Int?,
@Query("assignee_id") assigneeId: Int?,
......@@ -182,8 +183,8 @@ interface GitlabApi {
@Query("milestone") milestone: String?,
@Query("view") viewType: MergeRequestViewType?,
@Query("labels") labels: String?,
@Query("created_before") createdBefore: LocalDateTime?,
@Query("created_after") createdAfter: LocalDateTime?,
@Query("created_before") createdBefore: OffsetDateTime?,
@Query("created_after") createdAfter: OffsetDateTime?,
@Query("scope") scope: MergeRequestScope?,
@Query("author_id") authorId: Int?,
@Query("assignee_id") assigneeId: Int?,
......@@ -298,23 +299,23 @@ interface GitlabApi {
@FormUrlEncoded
@POST("$API_PATH/projects/{project_id}/milestones")
fun createMileStone(
fun createMilestone(
@Path("project_id") projectId: Long,
@Field("title") title: String,
@Field("description") description: String?,
@Field("due_date") dueDate: String?,
@Field("start_date") startDate: String?
@Field("due_date") dueDate: LocalDate?,
@Field("start_date") startDate: LocalDate?
): Single<Milestone>
@FormUrlEncoded
@PUT("$API_PATH/projects/{project_id}/milestones/{milestone_id}")
fun updateMileStone(
fun updateMilestone(
@Path("project_id") projectId: Long,
@Path("milestone_id") mileStoneId: Long,
@Field("title") title: String?,
@Field("description") description: String?,
@Field("due_date") dueDate: String?,
@Field("start_date") startDate: String?
@Field("due_date") dueDate: LocalDate?,
@Field("start_date") startDate: LocalDate?
): Single<Milestone>
@DELETE("$API_PATH/projects/{project_id}/milestones/{milestone_id}")
......
......@@ -12,11 +12,11 @@ import java.lang.reflect.Type
*/
class LocalDateDeserializer : JsonDeserializer<LocalDate> {
private val dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd")
override fun deserialize(
json: JsonElement,
type: Type,
jsonDeserializationContext: JsonDeserializationContext
): LocalDate {
return LocalDate.parse(json.asJsonPrimitive.asString, DateTimeFormatter.ofPattern("yyyy-MM-dd"))
}
): LocalDate = LocalDate.parse(json.asJsonPrimitive.asString, dateTimeFormatter)
}
\ No newline at end of file
......@@ -3,22 +3,17 @@ package ru.terrakok.gitlabclient.model.data.server.deserializer
import com.google.gson.JsonDeserializationContext
import com.google.gson.JsonDeserializer
import com.google.gson.JsonElement
import org.threeten.bp.LocalDateTime
import org.threeten.bp.ZonedDateTime
import org.threeten.bp.OffsetDateTime
import org.threeten.bp.format.DateTimeFormatter
import java.lang.reflect.Type
import java.util.*
/**
* Created by Konstantin Tskhovrebov (aka @terrakok) on 27.02.18.
*/
class LocalDateTimeDeserializer : JsonDeserializer<LocalDateTime> {
private val offset = TimeZone.getDefault().rawOffset / 1000L
class OffsetDateTimeDeserializer : JsonDeserializer<OffsetDateTime> {
private val dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss.SSSX")
override fun deserialize(
json: JsonElement,
type: Type,
jsonDeserializationContext: JsonDeserializationContext
): LocalDateTime {
return ZonedDateTime.parse(json.asJsonPrimitive.asString).plusSeconds(offset).toLocalDateTime()
}
typeOfT: Type,
context: JsonDeserializationContext?
): OffsetDateTime = OffsetDateTime.parse(json.asJsonPrimitive.asString, dateTimeFormatter)
}
\ No newline at end of file
......@@ -4,7 +4,7 @@ import com.google.gson.JsonDeserializationContext
import com.google.gson.JsonDeserializer
import com.google.gson.JsonElement
import com.google.gson.JsonParseException
import org.threeten.bp.LocalDateTime
import org.threeten.bp.OffsetDateTime
import ru.terrakok.gitlabclient.entity.Project
import ru.terrakok.gitlabclient.entity.ShortUser
import ru.terrakok.gitlabclient.entity.target.Target
......@@ -51,7 +51,7 @@ class TodoDeserializer : JsonDeserializer<Todo> {
jsonObject.get("target_url").asString,
jsonObject.get("body").asString,
context.deserialize<TodoState>(jsonObject.get("state"), TodoState::class.java),
context.deserialize<LocalDateTime>(jsonObject.get("created_at"), LocalDateTime::class.java)
context.deserialize<OffsetDateTime>(jsonObject.get("created_at"), OffsetDateTime::class.java)
)
} else {
throw JsonParseException("Configure Gson in GsonProvider.")
......
package ru.terrakok.gitlabclient.model.interactor.milestone
import org.threeten.bp.LocalDate
import ru.terrakok.gitlabclient.entity.milestone.MilestoneState
import ru.terrakok.gitlabclient.model.repository.issue.IssueRepository
import ru.terrakok.gitlabclient.model.repository.mergerequest.MergeRequestRepository
......@@ -29,8 +30,8 @@ class MilestoneInteractor @Inject constructor(
projectId: Long,
title: String,
description: String?,
dueDate: String?,
startDate: String?
dueDate: LocalDate?,
startDate: LocalDate?
) = milestoneRepository
.createMilestone(projectId, title, description, dueDate, startDate)
......@@ -39,8 +40,8 @@ class MilestoneInteractor @Inject constructor(
milestoneId: Long,
title: String?,
description: String?,
dueDate: String?,
startDate: String?
dueDate: LocalDate?,
startDate: LocalDate?
) = milestoneRepository
.updateMilestone(projectId, milestoneId, title, description, dueDate, startDate)
......
......@@ -3,7 +3,7 @@ package ru.terrakok.gitlabclient.model.repository.event
import io.reactivex.Observable
import io.reactivex.Single
import io.reactivex.functions.BiFunction
import org.threeten.bp.LocalDateTime
import org.threeten.bp.OffsetDateTime
import ru.terrakok.gitlabclient.di.DefaultPageSize
import ru.terrakok.gitlabclient.di.PrimitiveWrapper
import ru.terrakok.gitlabclient.entity.OrderBy
......@@ -34,8 +34,8 @@ class EventRepository @Inject constructor(
fun getEvents(
action: EventAction? = null,
targetType: EventTarget? = null,
beforeDay: LocalDateTime? = null,
afterDay: LocalDateTime? = null,
beforeDay: OffsetDateTime? = null,
afterDay: OffsetDateTime? = null,
sort: Sort? = Sort.DESC,
orderBy: OrderBy = OrderBy.UPDATED_AT,
page: Int,
......@@ -68,8 +68,8 @@ class EventRepository @Inject constructor(
projectId: Long,
action: EventAction? = null,
targetType: EventTarget? = null,
beforeDay: LocalDateTime? = null,
afterDay: LocalDateTime? = null,
beforeDay: OffsetDateTime? = null,
afterDay: OffsetDateTime? = null,
sort: Sort? = Sort.DESC,
orderBy: OrderBy = OrderBy.UPDATED_AT,
page: Int,
......
......@@ -3,7 +3,7 @@ package ru.terrakok.gitlabclient.model.repository.mergerequest
import io.reactivex.Observable
import io.reactivex.Single
import io.reactivex.functions.BiFunction
import org.threeten.bp.LocalDateTime
import org.threeten.bp.OffsetDateTime
import ru.terrakok.gitlabclient.di.DefaultPageSize
import ru.terrakok.gitlabclient.di.PrimitiveWrapper
import ru.terrakok.gitlabclient.entity.*
......@@ -36,8 +36,8 @@ class MergeRequestRepository @Inject constructor(
milestone: String? = null,
viewType: MergeRequestViewType? = null,
labels: String? = null,
createdBefore: LocalDateTime? = null,
createdAfter: LocalDateTime? = null,
createdBefore: OffsetDateTime? = null,
createdAfter: OffsetDateTime? = null,
scope: MergeRequestScope? = null,
authorId: Int? = null,
assigneeId: Int? = null,
......@@ -69,8 +69,8 @@ class MergeRequestRepository @Inject constructor(
milestone: String? = null,
viewType: MergeRequestViewType? = null,
labels: String? = null,
createdBefore: LocalDateTime? = null,
createdAfter: LocalDateTime? = null,
createdBefore: OffsetDateTime? = null,
createdAfter: OffsetDateTime? = null,
scope: MergeRequestScope? = null,
authorId: Int? = null,
assigneeId: Int? = null,
......
......@@ -2,6 +2,7 @@ package ru.terrakok.gitlabclient.model.repository.milestone
import io.reactivex.Completable
import io.reactivex.Single
import org.threeten.bp.LocalDate
import ru.terrakok.gitlabclient.di.DefaultPageSize
import ru.terrakok.gitlabclient.di.PrimitiveWrapper
import ru.terrakok.gitlabclient.entity.milestone.Milestone
......@@ -39,10 +40,10 @@ class MilestoneRepository @Inject constructor(
projectId: Long,
title: String,
description: String? = null,
dueDate: String? = null,
startDate: String? = null
dueDate: LocalDate? = null,
startDate: LocalDate? = null
): Single<Milestone> = api
.createMileStone(projectId, title, description, dueDate, startDate)
.createMilestone(projectId, title, description, dueDate, startDate)
.subscribeOn(schedulers.io())
.observeOn(schedulers.ui())
......@@ -51,10 +52,10 @@ class MilestoneRepository @Inject constructor(
milestoneId: Long,
title: String? = null,
description: String? = null,
dueDate: String? = null,
startDate: String? = null
dueDate: LocalDate? = null,
startDate: LocalDate? = null
): Single<Milestone> = api
.updateMileStone(projectId, milestoneId, title, description, dueDate, startDate)
.updateMilestone(projectId, milestoneId, title, description, dueDate, startDate)
.subscribeOn(schedulers.io())
.observeOn(schedulers.ui())
......
......@@ -101,11 +101,16 @@ class MainFragment : BaseFragment(), MainView {
}
}
private fun buildBottomBarNotification(@ColorRes backgroundColor: Int, count: Int) =
AHNotification.Builder()
.setBackgroundColor(ContextCompat.getColor(requireContext(), backgroundColor))
.setText(count.toString())
.build()
private fun buildBottomBarNotification(@ColorRes backgroundColor: Int, count: Int): AHNotification {
return if (count > 0) {
AHNotification.Builder()
.setBackgroundColor(ContextCompat.getColor(requireContext(), backgroundColor))
.setText(count.toString())
.build()
} else {
AHNotification()
}
}
companion object {
private val eventsTab = Screens.MyEvents
......
......@@ -8,6 +8,7 @@ import org.junit.Test
import org.mockito.Mockito.`when`
import org.mockito.Mockito.verify
import org.threeten.bp.LocalDateTime
import org.threeten.bp.OffsetDateTime
import ru.terrakok.gitlabclient.TestSchedulers
import ru.terrakok.gitlabclient.entity.User
import ru.terrakok.gitlabclient.model.data.server.GitlabApi
......@@ -23,7 +24,7 @@ class ProfileRepositoryTest {
private val testServer = "Test server"
private val testError = RuntimeException("test error")
private val testDate = LocalDateTime.of(2018, 1, 1, 0, 0)
private val testDate = OffsetDateTime.of(LocalDateTime.of(2018, 1, 1, 0, 0), OffsetDateTime.now().offset)
private val testUser = User(
id = 1L,
username = "",
......
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