Start integration with app: adds Hilt for dep injection, implements a view model
This commit is contained in:
@@ -27,7 +27,7 @@ android {
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
}
|
||||
kotlinOptions {
|
||||
jvmTarget = '1.8'
|
||||
jvmTarget = JavaVersion.VERSION_1_8.toString()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ dependencies {
|
||||
implementation 'com.google.code.gson:gson:2.9.0'
|
||||
|
||||
// Realm
|
||||
implementation 'io.realm.kotlin:library-base:1.10.0'
|
||||
implementation "io.realm.kotlin:library-base:${realm_version}"
|
||||
|
||||
// https://mvnrepository.com/artifact/org.jetbrains.kotlinx/kotlinx-coroutines-core
|
||||
implementation group: 'org.jetbrains.kotlinx', name: 'kotlinx-coroutines-core', version: '1.7.3', ext: 'pom'
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user