fix: compile issues

This commit is contained in:
0x330a 2023-11-23 15:42:12 +11:00
parent 9e183f6e54
commit 06b879057f
No known key found for this signature in database
GPG key ID: 267811D6E6A2698C
4 changed files with 33 additions and 5 deletions

View file

@ -46,7 +46,9 @@ class ClosedGroupViewTests {
}
val overriddenStorage = Storage(applicationContext, mock(), ConfigFactory(context, emptyDb) {
keyPair.secretKey to userSessionId.hexString()
}, mock())
}, mock(), { stringRes, toastLength, parameters ->
})
storage = overriddenStorage
}

View file

@ -1145,6 +1145,11 @@ open class Storage(
mmsDB.markAsSent(infoMessageID, true)
}
// override fun insertGroupUpdatedControlMessage(groupSessionId: SessionId,
// controlMessage) {
//
// }
override fun isLegacyClosedGroup(publicKey: String): Boolean {
return DatabaseComponent.get(context).lokiAPIDatabase().isClosedGroup(publicKey)
}

View file

@ -552,15 +552,13 @@ private fun handleGroupInfoChange(message: GroupUpdated, closedGroup: SessionId)
verifyAdminSignature(closedGroup, adminSignature.toByteArray(), "INFO_CHANGE"+type+message.sentTimestamp!!)
val newName = if (infoChanged.hasUpdatedName()) infoChanged.updatedName else null
val newExpiration = if (infoChanged.hasUpdatedExpiration()) infoChanged.updatedExpiration else null
// insert control messages
// storage.insertIncomingInfoMessage()
}
private fun handlePromotionMessage(message: GroupUpdated) {
val sender = message.sender!!
val storage = MessagingModuleConfiguration.shared.storage
val inner = message.inner
// insert control messages
}
private fun MessageReceiver.handleInviteResponse(message: GroupUpdated, closedGroup: SessionId) {

View file

@ -3,10 +3,11 @@ package org.session.libsession.messaging.utilities
import com.fasterxml.jackson.annotation.JsonSubTypes
import com.fasterxml.jackson.annotation.JsonTypeInfo
import com.fasterxml.jackson.core.JsonParseException
import org.session.libsession.messaging.messages.control.GroupUpdated
import org.session.libsignal.messages.SignalServiceGroup
import org.session.libsignal.utilities.JsonUtil
import org.session.libsignal.utilities.Log
import java.util.*
import java.util.Collections
// class used to save update messages details
class UpdateMessageData () {
@ -35,11 +36,20 @@ class UpdateMessageData () {
constructor(): this(Collections.emptyList())
}
class GroupMemberLeft(): Kind()
class GroupMemberUpdated(val sessionIds: List<String>, val type: MemberUpdateType?): Kind() {
constructor(): this(emptyList(), null)
}
class OpenGroupInvitation(val groupUrl: String, val groupName: String): Kind() {
constructor(): this("", "")
}
}
sealed class MemberUpdateType {
data object ADDED: MemberUpdateType()
data object REMOVED: MemberUpdateType()
data object PROMOTED: MemberUpdateType()
}
constructor(kind: Kind): this() {
this.kind = kind
}
@ -58,6 +68,19 @@ class UpdateMessageData () {
}
}
fun buildGroupUpdate(groupUpdated: GroupUpdated): UpdateMessageData? {
val inner = groupUpdated.inner
TODO()
// return when {
// inner.hasMemberChangeMessage() -> {
// val memberChange = inner.memberChangeMessage
// val type = memberChange.type
// memberChange.memberSessionIdsList
// }
// else -> null
// }
}
fun buildOpenGroupInvitation(url: String, name: String): UpdateMessageData {
return UpdateMessageData(Kind.OpenGroupInvitation(url, name))
}