Private
Public Access
1
0

Start integration with app: adds Hilt for dep injection, implements a view model

This commit is contained in:
2023-08-17 00:37:11 -07:00
parent 28f2bfe580
commit 4eef98aef4
17 changed files with 149 additions and 32 deletions

View File

@@ -27,6 +27,11 @@ data class Conversation(
@SerializedName("lastMessage")
var lastMessage: Message?,
) {
fun formattedDisplayName(): String {
return displayName ?: participants.joinToString(", ")
}
override fun equals(other: Any?): Boolean {
if (other == null || javaClass != other.javaClass) return false
@@ -39,4 +44,15 @@ data class Conversation(
unreadCount == o.unreadCount
)
}
override fun hashCode(): Int {
var result = guid.hashCode()
result = 31 * result + date.hashCode()
result = 31 * result + participants.hashCode()
result = 31 * result + (displayName?.hashCode() ?: 0)
result = 31 * result + unreadCount
result = 31 * result + (lastMessagePreview?.hashCode() ?: 0)
result = 31 * result + (lastMessage?.hashCode() ?: 0)
return result
}
}

View File

@@ -30,6 +30,7 @@ import retrofit2.Response
import java.util.Date
import java.util.UUID
@OptIn(ExperimentalStdlibApi::class)
class MockServer {
val version = "Kordophone-2.0"
val conversations: MutableList<Conversation> = mutableListOf()