mirror of
https://github.com/oxen-io/session-android.git
synced 2025-10-18 07:14:01 +00:00
feat: add some base config migration logic, start implementing wrappers for conversation and expiry types
This commit is contained in:
Submodule libsession-util/libsession-util updated: 65cc4d6b0a...349d0b7d0d
@@ -65,4 +65,20 @@ class UserProfile(pointer: Long) : ConfigBase(pointer) {
|
||||
external fun getName(): String?
|
||||
external fun getPic(): UserPic?
|
||||
external fun setPic(userPic: UserPic)
|
||||
}
|
||||
|
||||
class ConversationConfig(pointer: Long): ConfigBase(pointer) {
|
||||
companion object {
|
||||
init {
|
||||
System.loadLibrary("session_util")
|
||||
}
|
||||
|
||||
external fun newInstance(ed25519SecretKey: ByteArray): ConversationConfig
|
||||
|
||||
external fun newInstance(ed25519SecretKey: ByteArray, initialDump: ByteArray): ConversationConfig
|
||||
|
||||
}
|
||||
|
||||
external fun todo()
|
||||
|
||||
}
|
@@ -0,0 +1,44 @@
|
||||
package network.loki.messenger.libsession_util.util
|
||||
|
||||
sealed class Conversation {
|
||||
data class OneToOne(
|
||||
val sessionId: String,
|
||||
val lastRead: Long,
|
||||
val expiryMode: ExpiryMode,
|
||||
): Conversation()
|
||||
|
||||
data class OpenGroup(
|
||||
val baseUrl: String,
|
||||
val room: String,
|
||||
val pubKey: ByteArray,
|
||||
val lastRead: Long,
|
||||
) : Conversation() {
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) return true
|
||||
if (javaClass != other?.javaClass) return false
|
||||
|
||||
other as OpenGroup
|
||||
|
||||
if (baseUrl != other.baseUrl) return false
|
||||
if (room != other.room) return false
|
||||
if (!pubKey.contentEquals(other.pubKey)) return false
|
||||
if (lastRead != other.lastRead) return false
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
override fun hashCode(): Int {
|
||||
var result = baseUrl.hashCode()
|
||||
result = 31 * result + room.hashCode()
|
||||
result = 31 * result + pubKey.contentHashCode()
|
||||
result = 31 * result + lastRead.hashCode()
|
||||
return result
|
||||
}
|
||||
}
|
||||
|
||||
data class LegacyClosedGroup(
|
||||
val groupId: String,
|
||||
val lastRead: Long,
|
||||
val expiryMode: ExpiryMode
|
||||
): Conversation()
|
||||
}
|
@@ -0,0 +1,7 @@
|
||||
package network.loki.messenger.libsession_util.util
|
||||
|
||||
sealed class ExpiryMode(val expiryMinutes: Long) {
|
||||
object NONE: ExpiryMode(0)
|
||||
class AfterSend(minutes: Long): ExpiryMode(minutes)
|
||||
class AfterRead(minutes: Long): ExpiryMode(minutes)
|
||||
}
|
Reference in New Issue
Block a user