Skip to content

Refactor recipient #1277

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 33 commits into
base: dev
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
e829386
Remove unused data from recipient class
SessionHero01 Jun 20, 2025
e4e9db7
No recipient anywhere
SessionHero01 Jun 20, 2025
16c8159
Merge remote-tracking branch 'origin/dev' into refactor-recipient
SessionHero01 Jun 24, 2025
6b3efdd
Tidy up address
SessionHero01 Jun 24, 2025
95f989a
Initial implementation of recipient repository
SessionHero01 Jun 24, 2025
18f3d46
WIP
SessionHero01 Jun 24, 2025
05fac2a
WIP
SessionHero01 Jun 24, 2025
b016a6f
WIP
SessionHero01 Jun 24, 2025
e184eb1
WIP
SessionHero01 Jun 26, 2025
994c629
WIP
SessionHero01 Jun 26, 2025
6c7a813
WIP
SessionHero01 Jun 26, 2025
1675762
WIP
SessionHero01 Jun 27, 2025
143e957
WIP
SessionHero01 Jun 27, 2025
92873c6
Recipient optimising
SessionHero01 Jun 27, 2025
7514740
Fixes crash on disappearing messages
SessionHero01 Jun 27, 2025
f30e2b8
Merge remote-tracking branch 'origin/dev' into refactor-recipient
SessionHero01 Jun 27, 2025
47bbe62
Renamed
SessionHero01 Jun 27, 2025
7587fb7
Merge remote-tracking branch 'origin/dev' into refactor-recipient
SessionHero01 Jun 27, 2025
17612d1
Profile pic refactoring WIP
SessionHero01 Jun 27, 2025
4b2aef2
Download worker
SessionHero01 Jun 30, 2025
69820ca
Clean stuff properly
SessionHero01 Jun 30, 2025
558d3f2
WIP
SessionHero01 Jun 30, 2025
629b135
Mention fix
SessionHero01 Jul 1, 2025
028664a
Remove contact database
SessionHero01 Jul 1, 2025
5889f21
Merge remote-tracking branch 'origin/dev' into refactor-recipient
SessionHero01 Jul 2, 2025
f5302ad
Fixed conflicts
SessionHero01 Jul 2, 2025
cf8a7e2
Merge remote-tracking branch 'origin/dev' into refactor-recipient
SessionHero01 Jul 2, 2025
3942fa8
Only pass in address to convo screen
SessionHero01 Jul 2, 2025
a42ea6c
Tidy up
SessionHero01 Jul 2, 2025
22cf75a
WIP
SessionHero01 Jul 3, 2025
fb05ef1
WIP
SessionHero01 Jul 3, 2025
efce12f
Tidy up reactivity logic in convo screen
SessionHero01 Jul 3, 2025
25402f1
Remove loader from message request activity
SessionHero01 Jul 3, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,6 @@ dependencies {
implementation(libs.photoview)
implementation(libs.glide)
implementation(libs.compose)
implementation(libs.eventbus)
implementation(libs.android.image.cropper)
implementation(libs.subsampling.scale.image.view) {
exclude(group = "com.android.support", module = "support-annotations")
Expand Down
21 changes: 0 additions & 21 deletions app/src/main/java/org/session/libsession/avatars/ContactPhoto.java

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import org.session.libsession.messaging.sending_receiving.attachments.SessionSer
import org.session.libsession.messaging.sending_receiving.attachments.SessionServiceAttachmentStream
import org.session.libsession.utilities.Address
import org.session.libsession.utilities.UploadResult
import org.session.libsession.utilities.recipients.Recipient
import org.session.libsignal.messages.SignalServiceAttachmentPointer
import org.session.libsignal.messages.SignalServiceAttachmentStream
import org.thoughtcrime.securesms.database.model.MessageId
Expand Down Expand Up @@ -45,5 +44,4 @@ interface MessageDataProvider {
fun getMessageBodyFor(timestamp: Long, author: String): String
fun getAttachmentIDsFor(mmsMessageId: Long): List<Long>
fun getLinkPreviewAttachmentIDFor(mmsMessageId: Long): Long?
fun getIndividualRecipientForMms(mmsId: Long): Recipient?
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@ package org.session.libsession.database

import android.content.Context
import android.net.Uri
import network.loki.messenger.libsession_util.util.ExpiryMode
import network.loki.messenger.libsession_util.util.KeyPair
import org.session.libsession.messaging.BlindedIdMapping
import org.session.libsession.messaging.calls.CallMessageType
import org.session.libsession.messaging.contacts.Contact
import org.session.libsession.messaging.jobs.AttachmentUploadJob
import org.session.libsession.messaging.jobs.Job
import org.session.libsession.messaging.jobs.MessageSendJob
import org.session.libsession.messaging.messages.ExpirationConfiguration
import org.session.libsession.messaging.messages.Message
import org.session.libsession.messaging.messages.control.GroupUpdated
import org.session.libsession.messaging.messages.control.MessageRequestResponse
Expand All @@ -28,8 +27,8 @@ import org.session.libsession.messaging.utilities.UpdateMessageData
import org.session.libsession.utilities.Address
import org.session.libsession.utilities.GroupDisplayInfo
import org.session.libsession.utilities.GroupRecord
import org.session.libsession.utilities.recipients.RecipientSettings
import org.session.libsession.utilities.recipients.Recipient
import org.session.libsession.utilities.recipients.Recipient.RecipientSettings
import org.session.libsignal.crypto.ecc.ECKeyPair
import org.session.libsignal.messages.SignalServiceAttachmentPointer
import org.session.libsignal.messages.SignalServiceGroup
Expand All @@ -48,10 +47,8 @@ interface StorageProtocol {
fun getUserX25519KeyPair(): ECKeyPair
fun getUserBlindedAccountId(serverPublicKey: String): AccountId?
fun getUserProfile(): Profile
fun setProfilePicture(recipient: Recipient, newProfilePicture: String?, newProfileKey: ByteArray?)
fun setBlocksCommunityMessageRequests(recipient: Recipient, blocksMessageRequests: Boolean)
fun setUserProfilePicture(newProfilePicture: String?, newProfileKey: ByteArray?)
fun clearUserPic(clearConfig: Boolean = true)
fun setBlocksCommunityMessageRequests(recipient: Address, blocksMessageRequests: Boolean)

// Signal
fun getOrGenerateRegistrationID(): Int

Expand Down Expand Up @@ -81,6 +78,7 @@ interface StorageProtocol {
fun getAllOpenGroups(): Map<Long, OpenGroup>
fun updateOpenGroup(openGroup: OpenGroup)
fun getOpenGroup(threadId: Long): OpenGroup?
fun getOpenGroup(address: Address): OpenGroup?
suspend fun addOpenGroup(urlAsString: String)
fun onOpenGroupAdded(server: String, room: String)
fun hasBackgroundGroupAddJob(groupJoinUrl: String): Boolean
Expand Down Expand Up @@ -130,13 +128,10 @@ interface StorageProtocol {
fun getGroup(groupID: String): GroupRecord?
fun createGroup(groupID: String, title: String?, members: List<Address>, avatar: SignalServiceAttachmentPointer?, relay: String?, admins: List<Address>, formationTimestamp: Long)
fun createInitialConfigGroup(groupPublicKey: String, name: String, members: Map<String, Boolean>, formationTimestamp: Long, encryptionKeyPair: ECKeyPair, expirationTimer: Int)
fun updateGroupConfig(groupPublicKey: String)
fun isGroupActive(groupPublicKey: String): Boolean
fun setActive(groupID: String, value: Boolean)
fun getZombieMembers(groupID: String): Set<String>
fun removeMember(groupID: String, member: Address)
fun updateMembers(groupID: String, members: List<Address>)
fun setZombieMembers(groupID: String, members: List<Address>)
fun getAllLegacyGroupPublicKeys(): Set<String>
fun getAllActiveClosedGroupPublicKeys(): Set<String>
fun addClosedGroupPublicKey(groupPublicKey: String)
Expand Down Expand Up @@ -176,23 +171,17 @@ interface StorageProtocol {
// Groups
fun getAllGroups(includeInactive: Boolean): List<GroupRecord>

// Settings
fun setProfileSharing(address: Address, value: Boolean)

// Thread
fun getOrCreateThreadIdFor(address: Address): Long
fun getThreadIdFor(publicKey: String, groupPublicKey: String?, openGroupID: String?, createThread: Boolean): Long?
fun getThreadId(publicKeyOrOpenGroupID: String): Long?
fun getThreadId(openGroup: OpenGroup): Long?
fun getThreadId(address: Address): Long?
fun getThreadId(recipient: Recipient): Long?
fun getThreadIdForMms(mmsId: Long): Long
fun getLastUpdated(threadID: Long): Long
fun trimThread(threadID: Long, threadLimit: Int)
fun trimThreadBefore(threadID: Long, timestamp: Long)
fun getMessageCount(threadID: Long): Long
fun setPinned(threadID: Long, isPinned: Boolean)
fun isPinned(threadID: Long): Boolean
fun setPinned(address: Address, isPinned: Boolean)
fun deleteConversation(threadID: Long)
fun setThreadCreationDate(threadId: Long, newDate: Long)
fun getLastLegacyRecipient(threadRecipient: String): String?
Expand All @@ -201,16 +190,11 @@ interface StorageProtocol {
fun clearMedia(threadID: Long, fromUser: Address? = null): Boolean

// Contacts
fun getContactWithAccountID(accountID: String): Contact?
fun getAllContacts(): Set<Contact>
fun setContact(contact: Contact)
fun deleteContactAndSyncConfig(accountId: String)
fun getRecipientForThread(threadId: Long): Recipient?
fun getRecipientForThread(threadId: Long): Address?
fun getRecipientSettings(address: Address): RecipientSettings?
fun syncLibSessionContacts(contacts: List<LibSessionContact>, timestamp: Long?)
fun hasAutoDownloadFlagBeenSet(recipient: Recipient): Boolean
fun shouldAutoDownloadAttachments(recipient: Recipient): Boolean
fun setAutoDownloadAttachments(recipient: Recipient, shouldAutoDownloadAttachments: Boolean)
fun setAutoDownloadAttachments(recipient: Address, shouldAutoDownloadAttachments: Boolean)

// Attachments
fun getAttachmentDataUri(attachmentId: AttachmentId): Uri
Expand All @@ -228,9 +212,6 @@ interface StorageProtocol {
fun insertDataExtractionNotificationMessage(senderPublicKey: String, message: DataExtractionNotificationInfoMessage, sentTimestamp: Long)
fun insertMessageRequestResponseFromContact(response: MessageRequestResponse)
fun insertMessageRequestResponseFromYou(threadId: Long)
fun setRecipientApproved(recipient: Recipient, approved: Boolean)
fun getRecipientApproved(address: Address): Boolean
fun setRecipientApprovedMe(recipient: Recipient, approvedMe: Boolean)
fun insertCallMessage(senderPublicKey: String, callMessageType: CallMessageType, sentTimestamp: Long)
fun conversationHasOutgoing(userPublicKey: String): Boolean
fun deleteMessagesByHash(threadId: Long, hashes: List<String>)
Expand Down Expand Up @@ -269,16 +250,11 @@ interface StorageProtocol {
fun updateReactionIfNeeded(message: Message, sender: String, openGroupSentTimestamp: Long)
fun deleteReactions(messageId: MessageId)
fun deleteReactions(messageIds: List<Long>, mms: Boolean)
fun setBlocked(recipients: Iterable<Recipient>, isBlocked: Boolean, fromConfigUpdate: Boolean = false)
fun setBlocked(recipients: Iterable<Address>, isBlocked: Boolean, fromConfigUpdate: Boolean = false)
fun blockedContacts(): List<Recipient>
fun getExpirationConfiguration(threadId: Long): ExpirationConfiguration?
fun setExpirationConfiguration(config: ExpirationConfiguration)
fun getExpirationConfiguration(threadId: Long): ExpiryMode
fun setExpirationConfiguration(address: Address, expiryMode: ExpiryMode)
fun getExpiringMessages(messageIds: List<Long> = emptyList()): List<Pair<Long, Long>>
fun updateDisappearingState(
messageSender: String,
threadID: Long,
disappearingState: Recipient.DisappearingState
)

// Shared configs
fun conversationInConfig(publicKey: String?, groupPublicKey: String?, openGroupId: String?, visibleOnly: Boolean): Boolean
Expand Down
Loading