mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-27 20:15:21 +00:00
impl of missing methods in DatabaseAttachmentProvider
This commit is contained in:
parent
883c71331b
commit
845ea16415
@ -8,8 +8,6 @@ import org.session.libsession.messaging.sending_receiving.attachments.*
|
|||||||
import org.session.libsession.messaging.threads.Address
|
import org.session.libsession.messaging.threads.Address
|
||||||
import org.session.libsignal.libsignal.util.guava.Optional
|
import org.session.libsignal.libsignal.util.guava.Optional
|
||||||
import org.session.libsignal.service.api.messages.SignalServiceAttachment
|
import org.session.libsignal.service.api.messages.SignalServiceAttachment
|
||||||
import org.session.libsignal.service.api.messages.SignalServiceAttachmentPointer
|
|
||||||
import org.thoughtcrime.securesms.ApplicationContext
|
|
||||||
import org.thoughtcrime.securesms.database.Database
|
import org.thoughtcrime.securesms.database.Database
|
||||||
import org.thoughtcrime.securesms.database.DatabaseFactory
|
import org.thoughtcrime.securesms.database.DatabaseFactory
|
||||||
import org.thoughtcrime.securesms.database.helpers.SQLCipherOpenHelper
|
import org.thoughtcrime.securesms.database.helpers.SQLCipherOpenHelper
|
||||||
@ -28,10 +26,6 @@ class DatabaseAttachmentProvider(context: Context, helper: SQLCipherOpenHelper)
|
|||||||
return databaseAttachment.toAttachmentStream(context)
|
return databaseAttachment.toAttachmentStream(context)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getAttachmentPointer(attachmentID: String): SignalServiceAttachmentPointer? {
|
|
||||||
TODO("Not yet implemented")
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun getAttachmentPointer(attachmentId: Long): SessionServiceAttachmentPointer? {
|
override fun getAttachmentPointer(attachmentId: Long): SessionServiceAttachmentPointer? {
|
||||||
val attachmentDatabase = DatabaseFactory.getAttachmentDatabase(context)
|
val attachmentDatabase = DatabaseFactory.getAttachmentDatabase(context)
|
||||||
val databaseAttachment = attachmentDatabase.getAttachment(AttachmentId(attachmentId, 0)) ?: return null
|
val databaseAttachment = attachmentDatabase.getAttachment(AttachmentId(attachmentId, 0)) ?: return null
|
||||||
@ -50,15 +44,18 @@ class DatabaseAttachmentProvider(context: Context, helper: SQLCipherOpenHelper)
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun getMessageForQuote(timestamp: Long, author: Address): Long? {
|
override fun getMessageForQuote(timestamp: Long, author: Address): Long? {
|
||||||
TODO("Not yet implemented")
|
val messagingDatabase = DatabaseFactory.getMmsSmsDatabase(context)
|
||||||
|
return messagingDatabase.getMessageFor(timestamp, author)?.id
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getAttachmentsWithLinkPreviewFor(messageID: Long): List<Attachment> {
|
override fun getAttachmentsAndLinkPreviewFor(messageID: Long): List<Attachment> {
|
||||||
TODO("Not yet implemented")
|
val attachmentDatabase = DatabaseFactory.getAttachmentDatabase(context)
|
||||||
|
return attachmentDatabase.getAttachmentsForMessage(messageID)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getMessageBodyFor(messageID: Long): String {
|
override fun getMessageBodyFor(messageID: Long): String {
|
||||||
TODO("Not yet implemented")
|
val messagingDatabase = DatabaseFactory.getSmsDatabase(context)
|
||||||
|
return messagingDatabase.getMessage(messageID).body
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun insertAttachment(messageId: Long, attachmentId: Long, stream: InputStream) {
|
override fun insertAttachment(messageId: Long, attachmentId: Long, stream: InputStream) {
|
||||||
@ -72,13 +69,13 @@ class DatabaseAttachmentProvider(context: Context, helper: SQLCipherOpenHelper)
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun getMessageID(serverID: Long): Long? {
|
override fun getMessageID(serverID: Long): Long? {
|
||||||
TODO("Not yet implemented")
|
val openGroupMessagingDatabase = DatabaseFactory.getLokiMessageDatabase(context)
|
||||||
|
return openGroupMessagingDatabase.getMessageID(serverID)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun deleteMessage(messageID: Long) {
|
override fun deleteMessage(messageID: Long) {
|
||||||
TODO("Not yet implemented")
|
val messagingDatabase = DatabaseFactory.getSmsDatabase(context)
|
||||||
//val publicChatAPI = ApplicationContext.getInstance(context).publicChatAPI
|
messagingDatabase.deleteMessage(messageID)
|
||||||
//publicChatAPI?.deleteMessage(messageID)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -10,10 +10,6 @@ import java.io.InputStream
|
|||||||
|
|
||||||
interface MessageDataProvider {
|
interface MessageDataProvider {
|
||||||
|
|
||||||
//fun getAttachment(attachmentId: Long): SignalServiceAttachmentStream?
|
|
||||||
|
|
||||||
fun getAttachmentPointer(attachmentID: String): SignalServiceAttachmentPointer?
|
|
||||||
|
|
||||||
fun getMessageID(serverID: Long): Long?
|
fun getMessageID(serverID: Long): Long?
|
||||||
fun deleteMessage(messageID: Long)
|
fun deleteMessage(messageID: Long)
|
||||||
|
|
||||||
@ -32,7 +28,7 @@ interface MessageDataProvider {
|
|||||||
|
|
||||||
// Quotes
|
// Quotes
|
||||||
fun getMessageForQuote(timestamp: Long, author: Address): Long?
|
fun getMessageForQuote(timestamp: Long, author: Address): Long?
|
||||||
fun getAttachmentsWithLinkPreviewFor(messageID: Long): List<Attachment>
|
fun getAttachmentsAndLinkPreviewFor(messageID: Long): List<Attachment>
|
||||||
fun getMessageBodyFor(messageID: Long): String
|
fun getMessageBodyFor(messageID: Long): String
|
||||||
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user