Skip to content

Commit

Permalink
Remove isUserStoredEventDeleted which isn't needed anymore
Browse files Browse the repository at this point in the history
  • Loading branch information
LunarX committed Jun 6, 2024
1 parent e1e9448 commit efe6ee8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,10 @@ class CalendarEventResponse() : EmbeddedRealmObject {

constructor(
userStoredEvent: CalendarEvent?,
isUserStoredEventDeleted: Boolean,
attachmentEvent: CalendarEvent?,
attachmentEventMethod: String?,
) : this() {
this.userStoredEvent = userStoredEvent
this.isUserStoredEventDeleted = isUserStoredEventDeleted
this.attachmentEvent = attachmentEvent
this._attachmentEventMethod = attachmentEventMethod
}
Expand All @@ -70,7 +68,6 @@ class CalendarEventResponse() : EmbeddedRealmObject {
fun everythingButAttendeesIsTheSame(other: CalendarEventResponse?): Boolean {
if (other == null) return false

if (isUserStoredEventDeleted != other.isUserStoredEventDeleted) return false
if (_attachmentEventMethod != other._attachmentEventMethod) return false

val c1 = calendarEvent
Expand All @@ -89,15 +86,13 @@ class CalendarEventResponse() : EmbeddedRealmObject {
other as CalendarEventResponse

if (userStoredEvent != other.userStoredEvent) return false
if (isUserStoredEventDeleted != other.isUserStoredEventDeleted) return false
if (attachmentEvent != other.attachmentEvent) return false

return _attachmentEventMethod == other._attachmentEventMethod
}

override fun hashCode(): Int {
var result = userStoredEvent?.hashCode() ?: 0
result = 31 * result + isUserStoredEventDeleted.hashCode()
result = 31 * result + (attachmentEvent?.hashCode() ?: 0)
result = 31 * result + (_attachmentEventMethod?.hashCode() ?: 0)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import com.infomaniak.mail.data.models.calendar.Attendee
import com.infomaniak.mail.data.models.calendar.Attendee.AttendanceState
import com.infomaniak.mail.data.models.calendar.CalendarEvent
import com.infomaniak.mail.data.models.calendar.CalendarEventResponse
import com.infomaniak.mail.data.models.calendar.CalendarEventResponse.AttachmentEventMethod
import com.infomaniak.mail.data.models.message.Body
import com.infomaniak.mail.data.models.message.Message
import com.infomaniak.mail.ui.main.thread.ThreadAdapter
Expand Down Expand Up @@ -141,10 +142,11 @@ class CalendarEventResponseTest {

private fun getBasicCalendarEventResponse(
userStoredEvent: CalendarEvent,
isUserStoredEventDeleted: Boolean,
hasCanceledEventMethod: Boolean,
): CalendarEventResponse {
val attachmentEvent = getBasicCalendarEvent(AttendanceState.NEEDS_ACTION)
return CalendarEventResponse(userStoredEvent, isUserStoredEventDeleted, attachmentEvent, "REQUEST")
val method = if (hasCanceledEventMethod) AttachmentEventMethod.CANCEL.name else AttachmentEventMethod.REQUEST.name
return CalendarEventResponse(userStoredEvent, attachmentEvent, method)
}

companion object {
Expand Down

0 comments on commit efe6ee8

Please sign in to comment.