feat: open group attachment and message processing

This commit is contained in:
jubb
2021-04-26 14:30:51 +10:00
parent 6272856ef9
commit 4bf0990ef9
5 changed files with 27 additions and 7 deletions

View File

@@ -576,6 +576,13 @@ class Storage(context: Context, helper: SQLCipherOpenHelper) : Database(context,
return if (threadID < 0) null else threadID
}
override fun getThreadIdForMms(mmsId: Long): Long {
val mmsDb = DatabaseFactory.getMmsDatabase(context)
val cursor = mmsDb.getMessage(mmsId)
val reader = mmsDb.readerFor(cursor)
return reader.current.threadId
}
override fun getSessionRequestSentTimestamp(publicKey: String): Long? {
return DatabaseFactory.getLokiAPIDatabase(context).getSessionRequestSentTimestamp(publicKey)
}

View File

@@ -110,7 +110,7 @@ class PublicChatManager(private val context: Context) {
fun addChat(server: String, room: String, info: OpenGroupAPIV2.Info, publicKey: String): OpenGroupV2 {
val chat = OpenGroupV2(server, room, info.name, publicKey)
var threadID = GroupManager.getOpenGroupThreadID(chat.id, context)
var profilePicture: Bitmap? = null
val profilePicture: Bitmap?
if (threadID < 0) {
val profilePictureAsByteArray = try {
OpenGroupAPIV2.downloadOpenGroupProfilePicture(info.id,server).get()