2021-05-18 08:03:47 +02:00
|
|
|
package org.session.libsession.database
|
2020-12-02 06:38:30 +01:00
|
|
|
|
2021-01-13 07:11:30 +01:00
|
|
|
import android.content.Context
|
2021-01-08 07:05:44 +01:00
|
|
|
import android.net.Uri
|
2022-09-05 03:29:47 +02:00
|
|
|
import org.session.libsession.messaging.BlindedIdMapping
|
Add one on one calls over clearnet (#864)
* feat: adding basic webrtc deps and test activity
* more testing code
* feat: add protos and bump version
* feat: added basic call functionality
* feat: adding UI and flipping cameras
* feat: add stats and starting call bottom sheet
* feat: hanging up and bottom sheet behaviors should work now
* feat: add call stats report on frontend
* feat: add relay toggle for answer and offer
* fix: add keep screen on and more end call message on back pressed / on finish
* refactor: removing and replacing dagger 1 dep with android hilt
* feat: include latest proto
* feat: update to utilise call ID
* feat: add stun and turn
* refactor: playing around with deps and transport types
* feat: adding call service functionality and permissions for calls
* feat: add call manager and more static intent building functions for WebRtcCallService.kt
* feat: adding ringers and more audio boilerplate
* feat: audio manager call service boilerplate
* feat: update kotlin and add in call view model and more management functions
* refactor: moving call code around to service and viewmodel interactions
* feat: plugging CallManager.kt into view model and service, fixing up dependencies
* feat: implementing more WebRtcCallService.kt functions and handlers for actions as well as lifecycle
* feat: adding more lifecycle vm and callmanager / call service functionality
* feat: adding more command handlers in WebRtcCallService.kt
* feat: more commands handled, adding lock manager and bluetooth permissions
* feat: adding remainder of basic functionality to services and CallManager.kt
* feat: hooking up calls and fixing broken dependencies and compile errors
* fix: add timestamp to incoming call
* feat: some connection and service launching / ring lifecycle
* feat: call establishing and displaying
* fix: fixing call connect flows
* feat: ringers and better state handling
* feat: updating call layout
* feat: add fixes to bluetooth and begin the network renegotiation
* feat: add call related permissions and more network handover tests
* fix: don't display call option in conversation and don't show notification if option not enabled
* fix: incoming ringer fix on receiving call, call notification priorities and notification channel update
* build: update build number for testing
* fix: bluetooth auto-connection and re-connection fixes, removing finished todos, allowing self-send call messages for deduping answers
* feat: add pre-offer information and action handling in web rtc call service
* refactor: discard offer messages from non-matching pre-offers we are already expecting
* build: build numbers and version name update
* feat: handle discarding pending calls from linked devices
* feat: add signing props to release config build
* docs: fix comment on time being 300s (5m) instead of 30s
* feat: adding call messages for incoming/outgoing/missed
* refactor: handle in-thread call notifications better and replace deny button intent with denyCallIntent instead of hangup
* feat: add a hangup via data channel message
* feat: process microphone enabled events and remove debuggable from build.gradle
* feat: add first call notification
* refactor: set the buttons to match iOS in terms of enable disable and colours
* refactor: change the call logos in control messages
* refactor: more bluetooth improvements
* refactor: move start ringer and init of audio manager to CallManager.kt and string fix up
* build: remove debuggable for release build
* refactor: replace call icons
* feat: adding a call time display
* refactor: change the call time to update every second
* refactor: testing out the full screen intents
* refactor: wrapper use corrected session description, set title to recipient displayName, indicate session calls
* fix: crash on view with a parent already attached
* refactor: aspect ratio fit preserved
* refactor: add wantsToAnswer ability in pre-init for fullscreenintent
* refactor: prevent calls from non hasSent participants
* build: update gradle code
* refactor: replace timeout schedule with a seconds count
* fix: various bug fixes for calls
* fix: remove end call from busy
* refactor: use answerCall instead of manual intent building again
* build: new version
* feat: add silenced notifications for call notification builder. check pre-offer and connecting state for pending connection
* build: update build number
* fix: text color uses overridden style value
* fix: remove wrap content for renderers and look more at recovering from network switches
* build: update build number
* refactor: remove whitespace
* build: update build number
* refactor: used shared number for BatchMessageReceiveJob.kt parameter across pollers
* fix: glide in update crash
* fix: bug fixes for self-send answer / hangup messages
* build: update build number
* build: update build.gradle number
* refactor: compile errors and refactoring to view binding
* fix: set the content to binding.root view
* build: increase build number
* build: update build numbers
* feat: adding base for rotation and picking random subset of turn servers
* feat: starting the screen rotation processing
* feat: setting up rotation for the remote render view
* refactor: applying rotation and mirroring based on front / rear cameras that wraps nicely, only scale reworking needed
* refactor: calls video stretching but consistent
* refactor: state machine and tests for the transition events
* feat: new call state processing
* refactor: adding reconnecting logic and visuals
* feat: state machine reconnect logic wip
* feat: add reconnecting and merge fixes
* feat: check new session based off current state
* feat: reconnection logic works correctly now
* refactor: reduce TIMEOUT_SECONDS to 30 from 90
* feat: reset peer connection on DC to prevent ICE messages from old connection or stale state in reconnecting
* refactor: add null case
* fix: set approved on new outgoing threads, use approved more deeply and invalidate the options menu on recipient modified. Add approvedMe flag toggles for visible message receive
* fix: add name update in action bar on modified, change where approvedMe is set
* build: increment build number
* build: update build number
* fix: merge compile errors and increment build number
* refactor: remove negotiation based on which party dropped connection
* refactor: call reconnection improvement tested cross platform to re-establish
* refactor: failed and disconnect events only handled if either the reconnect or the timeout runnables are not set
* build: update version number
* fix: reduce timeout
* fix: fixes the incoming hangup logic for linked devices
* refactor: match iOS styling for call activity closer
* chore: upgrade build numbers
* feat: add in call settings dialog for if calls is disabled in conversation
* feat: add a first call missed control message and info popup with link to privacy settings
* fix: looking at crash for specific large transaction in NotificationManager
* refactor: removing the people in case transaction size reduces to fix notif crash
* fix: comment out the entire send multiple to see if it fixes the issue
* refactor: revert to including the full notification process in a try/catch to handle weird responses from NotificationManager
* fix: add in notification settings prompt for calls and try to fall back to dirty full screen intent / start activity if we're allowed
* build: upgrade build number
2022-04-19 06:25:40 +02:00
|
|
|
import org.session.libsession.messaging.calls.CallMessageType
|
2021-05-07 08:31:46 +02:00
|
|
|
import org.session.libsession.messaging.contacts.Contact
|
2020-12-02 06:38:30 +01:00
|
|
|
import org.session.libsession.messaging.jobs.AttachmentUploadJob
|
|
|
|
import org.session.libsession.messaging.jobs.Job
|
|
|
|
import org.session.libsession.messaging.jobs.MessageSendJob
|
2022-09-04 13:03:32 +02:00
|
|
|
import org.session.libsession.messaging.messages.Message
|
2021-03-30 07:23:12 +02:00
|
|
|
import org.session.libsession.messaging.messages.control.ConfigurationMessage
|
2022-03-04 07:46:39 +01:00
|
|
|
import org.session.libsession.messaging.messages.control.MessageRequestResponse
|
2020-12-18 06:43:19 +01:00
|
|
|
import org.session.libsession.messaging.messages.visible.Attachment
|
2022-09-04 13:03:32 +02:00
|
|
|
import org.session.libsession.messaging.messages.visible.Reaction
|
2021-01-11 23:58:38 +01:00
|
|
|
import org.session.libsession.messaging.messages.visible.VisibleMessage
|
2022-09-05 03:29:47 +02:00
|
|
|
import org.session.libsession.messaging.open_groups.GroupMember
|
2022-08-10 10:17:48 +02:00
|
|
|
import org.session.libsession.messaging.open_groups.OpenGroup
|
2021-01-08 07:05:44 +01:00
|
|
|
import org.session.libsession.messaging.sending_receiving.attachments.AttachmentId
|
2021-03-15 03:35:05 +01:00
|
|
|
import org.session.libsession.messaging.sending_receiving.attachments.DatabaseAttachment
|
2021-05-27 07:00:16 +02:00
|
|
|
import org.session.libsession.messaging.sending_receiving.data_extraction.DataExtractionNotificationInfoMessage
|
2021-04-26 03:23:09 +02:00
|
|
|
import org.session.libsession.messaging.sending_receiving.link_preview.LinkPreview
|
2021-01-11 23:58:38 +01:00
|
|
|
import org.session.libsession.messaging.sending_receiving.quotes.QuoteModel
|
2021-05-18 08:11:38 +02:00
|
|
|
import org.session.libsession.utilities.Address
|
2021-05-18 08:03:47 +02:00
|
|
|
import org.session.libsession.utilities.GroupRecord
|
2021-05-21 07:02:34 +02:00
|
|
|
import org.session.libsession.utilities.recipients.Recipient
|
2021-05-18 08:03:47 +02:00
|
|
|
import org.session.libsession.utilities.recipients.Recipient.RecipientSettings
|
2021-05-18 01:21:56 +02:00
|
|
|
import org.session.libsignal.crypto.ecc.ECKeyPair
|
2021-05-18 01:50:16 +02:00
|
|
|
import org.session.libsignal.messages.SignalServiceAttachmentPointer
|
|
|
|
import org.session.libsignal.messages.SignalServiceGroup
|
2020-12-02 06:38:30 +01:00
|
|
|
|
|
|
|
interface StorageProtocol {
|
|
|
|
|
|
|
|
// General
|
|
|
|
fun getUserPublicKey(): String?
|
2021-01-14 01:42:26 +01:00
|
|
|
fun getUserX25519KeyPair(): ECKeyPair
|
2020-12-02 06:38:30 +01:00
|
|
|
fun getUserDisplayName(): String?
|
|
|
|
fun getUserProfileKey(): ByteArray?
|
|
|
|
fun getUserProfilePictureURL(): String?
|
2021-05-21 07:21:24 +02:00
|
|
|
fun setUserProfilePictureURL(newProfilePicture: String)
|
2021-05-21 07:02:34 +02:00
|
|
|
// Signal
|
2020-12-10 05:30:32 +01:00
|
|
|
fun getOrGenerateRegistrationID(): Int
|
2020-12-03 04:29:50 +01:00
|
|
|
|
2020-12-02 06:38:30 +01:00
|
|
|
// Jobs
|
2021-01-29 01:16:53 +01:00
|
|
|
fun persistJob(job: Job)
|
2021-05-07 03:48:03 +02:00
|
|
|
fun markJobAsSucceeded(jobId: String)
|
2021-05-13 01:38:39 +02:00
|
|
|
fun markJobAsFailedPermanently(jobId: String)
|
2021-05-07 03:48:03 +02:00
|
|
|
fun getAllPendingJobs(type: String): Map<String,Job?>
|
2020-12-15 05:45:44 +01:00
|
|
|
fun getAttachmentUploadJob(attachmentID: Long): AttachmentUploadJob?
|
2020-12-02 06:38:30 +01:00
|
|
|
fun getMessageSendJob(messageSendJobID: String): MessageSendJob?
|
2021-09-29 07:29:24 +02:00
|
|
|
fun getMessageReceiveJob(messageReceiveJobID: String): Job?
|
2021-12-15 07:11:55 +01:00
|
|
|
fun getGroupAvatarDownloadJob(server: String, room: String): Job?
|
2020-12-02 06:38:30 +01:00
|
|
|
fun resumeMessageSendJobIfNeeded(messageSendJobID: String)
|
|
|
|
fun isJobCanceled(job: Job): Boolean
|
|
|
|
|
|
|
|
// Authorization
|
2021-04-13 09:17:16 +02:00
|
|
|
fun getAuthToken(room: String, server: String): String?
|
|
|
|
fun setAuthToken(room: String, server: String, newValue: String)
|
|
|
|
fun removeAuthToken(room: String, server: String)
|
|
|
|
|
2022-08-10 10:17:48 +02:00
|
|
|
// Servers
|
|
|
|
fun setServerCapabilities(server: String, capabilities: List<String>)
|
|
|
|
fun getServerCapabilities(server: String): List<String>
|
|
|
|
|
2021-04-13 09:17:16 +02:00
|
|
|
// Open Groups
|
2022-08-10 10:17:48 +02:00
|
|
|
fun getAllOpenGroups(): Map<Long, OpenGroup>
|
|
|
|
fun updateOpenGroup(openGroup: OpenGroup)
|
|
|
|
fun getOpenGroup(threadId: Long): OpenGroup?
|
2021-05-21 07:02:34 +02:00
|
|
|
fun addOpenGroup(urlAsString: String)
|
2022-09-04 13:03:32 +02:00
|
|
|
fun onOpenGroupAdded(server: String)
|
Performance improvements and bug fixes (#869)
* refactor: fail on testSnode instead of recursively using up snode list. add call timeout on http client
* refactor: refactoring batch message receives and pollers
* refactor: reduce thread utils pool count to a 2 thread fixed pool. Do a check against pubkey instead of room names for oxenHostedOpenGroup
* refactor: caching lib with potential loader fixes and no-cache for giphy
* refactor: remove store and instead use ConcurrentHashMap with a backing update coroutine
* refactor: queue trim thread jobs instead of add every message processed
* fix: wrapping auth token and initial sync for open groups in a threadutils queued runnable, getting initial sync times down
* fix: fixing the user contacts cache in ConversationAdapter.kt
* refactor: improve polling and initial sync, move group joins from config messages into a background job fetching image.
* refactor: improving the job queuing for open groups, replacing placeholder avatar generation with a custom glide loader and archiving initial sync of open groups
* feat: add OpenGroupDeleteJob.kt
* feat: add open group delete job to process deletions after batch adding
* feat: add vacuum and fix job queue re-adding jobs forever, only try to set message hash values in DB if they have changed
* refactor: remove redundant inflation for profile image views throughout app
* refactor(wip): reducing layout inflation and starting to refactor the open group deletion issues taking a long time
* refactor(wip): refactoring group deletion to not iterate through and delete messages individually
* refactor(wip): refactoring group deletion to not iterate through and delete messages individually
* fix: group deletion optimisation
* build: bump build number
* build: bump build number and fix batch message receive retry logic
* fix: clear out open group deletes
* fix: update visible ConversationAdapter.kt binding for initial contact fetching and better traces for debugging background jobs
* fix: add in check for / force sync latest encryption key pair from linked devices if we already have that closed group
* Rename .java to .kt
* refactor: change MmsDatabase to kotlin to make list operations easier
* fix: nullable type
* fix: compilation issues and constants in .kt instead of .java
* fix: bug fix expiration timer on closed group recipient
* feat: use the job queue properly across executors
* feat: start on open group dispatcher-specific logic, probably a queue factory based on openGroupId if that is the same across new message and deletion jobs to ensure consistent entry and removal
* refactor: removing redundant code and fixing jobqueue per opengroup
* fix: allow attachments in note to self
* fix: make the minWidth in quote view bind max of text / title and body, wrapped ?
* fix: fixing up layouts and code view layouts
* fix: remove TODO, remove timestamp binding
* feat: fix view logic, avatars and padding, downloading attachments lazily (on bind), fixing potential crash, add WindowDebouncer.kt
* fix: NPE on viewModel recipient from removed thread while tearing down the Recipient observer in ConversationActivityV2.kt
* refactor: replace conversation notification debouncer handler with handlerthread, same as conversation list debouncer
* refactor: UI for groups and poller improvements
* fix: revert some changes in poller
* feat: add header back in for message requests
* refactor: remove Trace calls, add more conditions to the HomeDiffUtil for updating more efficiently
* feat: try update the home adapter if we get a profile picture modified event
* feat: bump build numbers
* fix: try to start with list in homeViewModel if we don't have already, render quotes to be width of attachment slide view instead of fixed
* fix: set channel to be conflated instead of no buffer
* fix: set unreads based off last local user message vs incrementing unreads to be all amount
* feat: add profile update flag, update build number
* fix: link preview thumbnails download on bind
* fix: centercrop placeholder in glide request
* feat: recycle the contact selection list and profile image in unbind
* fix: try to prevent user KP crash at weird times
* fix: remove additional log, improve attachment download success rate, fix share logs dialog issue
2022-06-08 09:12:34 +02:00
|
|
|
fun hasBackgroundGroupAddJob(groupJoinUrl: String): Boolean
|
2021-04-29 09:13:42 +02:00
|
|
|
fun setOpenGroupServerMessageID(messageID: Long, serverID: Long, threadID: Long, isSms: Boolean)
|
2022-08-10 10:17:48 +02:00
|
|
|
fun getOpenGroup(room: String, server: String): OpenGroup?
|
2022-09-26 03:44:59 +02:00
|
|
|
fun setGroupMemberRoles(members: List<GroupMember>)
|
2020-12-02 06:38:30 +01:00
|
|
|
|
|
|
|
// Open Group Public Keys
|
|
|
|
fun getOpenGroupPublicKey(server: String): String?
|
|
|
|
fun setOpenGroupPublicKey(server: String, newValue: String)
|
|
|
|
|
2021-02-09 01:45:38 +01:00
|
|
|
// Open Group Metadata
|
|
|
|
fun updateTitle(groupID: String, newValue: String)
|
|
|
|
fun updateProfilePicture(groupID: String, newValue: ByteArray)
|
2021-05-05 05:52:15 +02:00
|
|
|
fun setUserCount(room: String, server: String, newValue: Int)
|
2021-02-09 01:45:38 +01:00
|
|
|
|
2020-12-02 06:38:30 +01:00
|
|
|
// Last Message Server ID
|
2021-05-21 07:02:34 +02:00
|
|
|
fun getLastMessageServerID(room: String, server: String): Long?
|
|
|
|
fun setLastMessageServerID(room: String, server: String, newValue: Long)
|
|
|
|
fun removeLastMessageServerID(room: String, server: String)
|
2020-12-02 06:38:30 +01:00
|
|
|
|
|
|
|
// Last Deletion Server ID
|
2021-05-21 07:02:34 +02:00
|
|
|
fun getLastDeletionServerID(room: String, server: String): Long?
|
|
|
|
fun setLastDeletionServerID(room: String, server: String, newValue: Long)
|
|
|
|
fun removeLastDeletionServerID(room: String, server: String)
|
2020-12-02 06:38:30 +01:00
|
|
|
|
2020-12-07 05:22:02 +01:00
|
|
|
// Message Handling
|
2021-05-19 00:56:44 +02:00
|
|
|
fun isDuplicateMessage(timestamp: Long): Boolean
|
2020-12-07 05:22:02 +01:00
|
|
|
fun getReceivedMessageTimestamps(): Set<Long>
|
|
|
|
fun addReceivedMessageTimestamp(timestamp: Long)
|
2021-05-06 05:28:58 +02:00
|
|
|
fun removeReceivedMessageTimestamps(timestamps: Set<Long>)
|
2021-05-21 07:02:34 +02:00
|
|
|
/**
|
|
|
|
* Returns the IDs of the saved attachments.
|
|
|
|
*/
|
|
|
|
fun persistAttachments(messageID: Long, attachments: List<Attachment>): List<Long>
|
|
|
|
fun getAttachmentsForMessage(messageID: Long): List<DatabaseAttachment>
|
|
|
|
fun getMessageIdInDatabase(timestamp: Long, author: String): Long? // TODO: This is a weird name
|
2021-07-23 08:04:18 +02:00
|
|
|
fun updateSentTimestamp(messageID: Long, isMms: Boolean, openGroupSentTimestamp: Long, threadId: Long)
|
2021-07-01 03:06:11 +02:00
|
|
|
fun markAsSending(timestamp: Long, author: String)
|
2021-03-02 02:24:09 +01:00
|
|
|
fun markAsSent(timestamp: Long, author: String)
|
|
|
|
fun markUnidentified(timestamp: Long, author: String)
|
2021-03-02 04:13:12 +01:00
|
|
|
fun setErrorMessage(timestamp: Long, author: String, error: Exception)
|
2021-08-10 08:42:15 +02:00
|
|
|
fun setMessageServerHash(messageID: Long, serverHash: String)
|
2020-12-07 05:22:02 +01:00
|
|
|
|
2020-12-10 05:30:32 +01:00
|
|
|
// Closed Groups
|
|
|
|
fun getGroup(groupID: String): GroupRecord?
|
2021-02-16 01:14:27 +01:00
|
|
|
fun createGroup(groupID: String, title: String?, members: List<Address>, avatar: SignalServiceAttachmentPointer?, relay: String?, admins: List<Address>, formationTimestamp: Long)
|
2021-03-23 00:00:51 +01:00
|
|
|
fun isGroupActive(groupPublicKey: String): Boolean
|
2020-12-10 05:30:32 +01:00
|
|
|
fun setActive(groupID: String, value: Boolean)
|
2021-05-21 07:02:34 +02:00
|
|
|
fun getZombieMembers(groupID: String): Set<String>
|
2020-12-10 05:30:32 +01:00
|
|
|
fun removeMember(groupID: String, member: Address)
|
|
|
|
fun updateMembers(groupID: String, members: List<Address>)
|
2021-05-21 07:02:34 +02:00
|
|
|
fun setZombieMembers(groupID: String, members: List<Address>)
|
2021-02-09 01:45:38 +01:00
|
|
|
fun getAllClosedGroupPublicKeys(): Set<String>
|
2021-03-23 00:00:51 +01:00
|
|
|
fun getAllActiveClosedGroupPublicKeys(): Set<String>
|
2021-02-09 01:45:38 +01:00
|
|
|
fun addClosedGroupPublicKey(groupPublicKey: String)
|
|
|
|
fun removeClosedGroupPublicKey(groupPublicKey: String)
|
|
|
|
fun addClosedGroupEncryptionKeyPair(encryptionKeyPair: ECKeyPair, groupPublicKey: String)
|
|
|
|
fun removeAllClosedGroupEncryptionKeyPairs(groupPublicKey: String)
|
2021-04-14 08:37:04 +02:00
|
|
|
fun insertIncomingInfoMessage(context: Context, senderPublicKey: String, groupID: String, type: SignalServiceGroup.Type,
|
2021-05-21 07:02:34 +02:00
|
|
|
name: String, members: Collection<String>, admins: Collection<String>, sentTimestamp: Long)
|
2021-04-14 08:37:04 +02:00
|
|
|
fun insertOutgoingInfoMessage(context: Context, groupID: String, type: SignalServiceGroup.Type, name: String,
|
2021-05-21 07:02:34 +02:00
|
|
|
members: Collection<String>, admins: Collection<String>, threadID: Long, sentTimestamp: Long)
|
2021-01-20 00:04:14 +01:00
|
|
|
fun isClosedGroup(publicKey: String): Boolean
|
2021-01-20 01:18:00 +01:00
|
|
|
fun getClosedGroupEncryptionKeyPairs(groupPublicKey: String): MutableList<ECKeyPair>
|
|
|
|
fun getLatestClosedGroupEncryptionKeyPair(groupPublicKey: String): ECKeyPair?
|
2021-06-10 09:34:48 +02:00
|
|
|
fun updateFormationTimestamp(groupID: String, formationTimestamp: Long)
|
2021-12-15 07:11:55 +01:00
|
|
|
fun updateTimestampUpdated(groupID: String, updatedTimestamp: Long)
|
2021-06-09 06:31:05 +02:00
|
|
|
fun setExpirationTimer(groupID: String, duration: Int)
|
2021-02-09 01:45:38 +01:00
|
|
|
|
2021-02-05 06:35:15 +01:00
|
|
|
// Groups
|
|
|
|
fun getAllGroups(): List<GroupRecord>
|
2020-12-02 06:38:30 +01:00
|
|
|
|
2020-12-10 05:30:32 +01:00
|
|
|
// Settings
|
|
|
|
fun setProfileSharing(address: Address, value: Boolean)
|
|
|
|
|
|
|
|
// Thread
|
2021-01-11 23:58:38 +01:00
|
|
|
fun getOrCreateThreadIdFor(address: Address): Long
|
2021-01-20 00:04:14 +01:00
|
|
|
fun getOrCreateThreadIdFor(publicKey: String, groupPublicKey: String?, openGroupID: String?): Long
|
2021-05-21 07:02:34 +02:00
|
|
|
fun getThreadId(publicKeyOrOpenGroupID: String): Long?
|
|
|
|
fun getThreadId(address: Address): Long?
|
|
|
|
fun getThreadId(recipient: Recipient): Long?
|
2021-04-29 09:13:42 +02:00
|
|
|
fun getThreadIdForMms(mmsId: Long): Long
|
2021-05-21 03:09:03 +02:00
|
|
|
fun getLastUpdated(threadID: Long): Long
|
2021-05-26 07:22:19 +02:00
|
|
|
fun trimThread(threadID: Long, threadLimit: Int)
|
2022-09-13 07:01:15 +02:00
|
|
|
fun trimThreadBefore(threadID: Long, timestamp: Long)
|
|
|
|
fun getMessageCount(threadID: Long): Long
|
2022-11-02 07:31:37 +01:00
|
|
|
fun setThreadPinned(threadID: Long, isPinned: Boolean)
|
|
|
|
fun isThreadPinned(threadID: Long): Boolean
|
2022-11-14 07:22:00 +01:00
|
|
|
fun clearMessages(threadID: Long): Boolean
|
2020-12-02 06:38:30 +01:00
|
|
|
|
2021-05-21 07:02:34 +02:00
|
|
|
// Contacts
|
2021-05-07 08:31:46 +02:00
|
|
|
fun getContactWithSessionID(sessionID: String): Contact?
|
|
|
|
fun getAllContacts(): Set<Contact>
|
|
|
|
fun setContact(contact: Contact)
|
2021-07-09 07:13:43 +02:00
|
|
|
fun getRecipientForThread(threadId: Long): Recipient?
|
2021-01-08 01:11:50 +01:00
|
|
|
fun getRecipientSettings(address: Address): RecipientSettings?
|
2022-11-11 05:29:39 +01:00
|
|
|
fun hasAutoDownloadFlagBeenSet(recipient: Recipient): Boolean
|
2021-03-30 07:23:12 +02:00
|
|
|
fun addContacts(contacts: List<ConfigurationMessage.Contact>)
|
2022-11-08 07:41:58 +01:00
|
|
|
fun shouldAutoDownloadAttachments(recipient: Recipient): Boolean
|
|
|
|
fun setAutoDownloadAttachments(recipient: Recipient, shouldAutoDownloadAttachments: Boolean)
|
2021-01-08 07:05:44 +01:00
|
|
|
|
2021-05-21 07:02:34 +02:00
|
|
|
// Attachments
|
2021-01-08 07:05:44 +01:00
|
|
|
fun getAttachmentDataUri(attachmentId: AttachmentId): Uri
|
|
|
|
fun getAttachmentThumbnailUri(attachmentId: AttachmentId): Uri
|
2021-01-11 23:58:38 +01:00
|
|
|
|
|
|
|
// Message Handling
|
2021-05-21 07:02:34 +02:00
|
|
|
/**
|
|
|
|
* Returns the ID of the `TSIncomingMessage` that was constructed.
|
|
|
|
*/
|
Performance improvements and bug fixes (#869)
* refactor: fail on testSnode instead of recursively using up snode list. add call timeout on http client
* refactor: refactoring batch message receives and pollers
* refactor: reduce thread utils pool count to a 2 thread fixed pool. Do a check against pubkey instead of room names for oxenHostedOpenGroup
* refactor: caching lib with potential loader fixes and no-cache for giphy
* refactor: remove store and instead use ConcurrentHashMap with a backing update coroutine
* refactor: queue trim thread jobs instead of add every message processed
* fix: wrapping auth token and initial sync for open groups in a threadutils queued runnable, getting initial sync times down
* fix: fixing the user contacts cache in ConversationAdapter.kt
* refactor: improve polling and initial sync, move group joins from config messages into a background job fetching image.
* refactor: improving the job queuing for open groups, replacing placeholder avatar generation with a custom glide loader and archiving initial sync of open groups
* feat: add OpenGroupDeleteJob.kt
* feat: add open group delete job to process deletions after batch adding
* feat: add vacuum and fix job queue re-adding jobs forever, only try to set message hash values in DB if they have changed
* refactor: remove redundant inflation for profile image views throughout app
* refactor(wip): reducing layout inflation and starting to refactor the open group deletion issues taking a long time
* refactor(wip): refactoring group deletion to not iterate through and delete messages individually
* refactor(wip): refactoring group deletion to not iterate through and delete messages individually
* fix: group deletion optimisation
* build: bump build number
* build: bump build number and fix batch message receive retry logic
* fix: clear out open group deletes
* fix: update visible ConversationAdapter.kt binding for initial contact fetching and better traces for debugging background jobs
* fix: add in check for / force sync latest encryption key pair from linked devices if we already have that closed group
* Rename .java to .kt
* refactor: change MmsDatabase to kotlin to make list operations easier
* fix: nullable type
* fix: compilation issues and constants in .kt instead of .java
* fix: bug fix expiration timer on closed group recipient
* feat: use the job queue properly across executors
* feat: start on open group dispatcher-specific logic, probably a queue factory based on openGroupId if that is the same across new message and deletion jobs to ensure consistent entry and removal
* refactor: removing redundant code and fixing jobqueue per opengroup
* fix: allow attachments in note to self
* fix: make the minWidth in quote view bind max of text / title and body, wrapped ?
* fix: fixing up layouts and code view layouts
* fix: remove TODO, remove timestamp binding
* feat: fix view logic, avatars and padding, downloading attachments lazily (on bind), fixing potential crash, add WindowDebouncer.kt
* fix: NPE on viewModel recipient from removed thread while tearing down the Recipient observer in ConversationActivityV2.kt
* refactor: replace conversation notification debouncer handler with handlerthread, same as conversation list debouncer
* refactor: UI for groups and poller improvements
* fix: revert some changes in poller
* feat: add header back in for message requests
* refactor: remove Trace calls, add more conditions to the HomeDiffUtil for updating more efficiently
* feat: try update the home adapter if we get a profile picture modified event
* feat: bump build numbers
* fix: try to start with list in homeViewModel if we don't have already, render quotes to be width of attachment slide view instead of fixed
* fix: set channel to be conflated instead of no buffer
* fix: set unreads based off last local user message vs incrementing unreads to be all amount
* feat: add profile update flag, update build number
* fix: link preview thumbnails download on bind
* fix: centercrop placeholder in glide request
* feat: recycle the contact selection list and profile image in unbind
* fix: try to prevent user KP crash at weird times
* fix: remove additional log, improve attachment download success rate, fix share logs dialog issue
2022-06-08 09:12:34 +02:00
|
|
|
fun persist(message: VisibleMessage, quotes: QuoteModel?, linkPreview: List<LinkPreview?>, groupPublicKey: String?, openGroupID: String?, attachments: List<Attachment>, runIncrement: Boolean, runThreadUpdate: Boolean): Long?
|
|
|
|
fun markConversationAsRead(threadId: Long, updateLastSeen: Boolean)
|
|
|
|
fun incrementUnread(threadId: Long, amount: Int)
|
|
|
|
fun updateThread(threadId: Long, unarchive: Boolean)
|
2021-04-09 08:06:12 +02:00
|
|
|
fun insertDataExtractionNotificationMessage(senderPublicKey: String, message: DataExtractionNotificationInfoMessage, sentTimestamp: Long)
|
2022-03-04 07:46:39 +01:00
|
|
|
fun insertMessageRequestResponse(response: MessageRequestResponse)
|
2022-03-09 23:54:18 +01:00
|
|
|
fun setRecipientApproved(recipient: Recipient, approved: Boolean)
|
|
|
|
fun setRecipientApprovedMe(recipient: Recipient, approvedMe: Boolean)
|
Add one on one calls over clearnet (#864)
* feat: adding basic webrtc deps and test activity
* more testing code
* feat: add protos and bump version
* feat: added basic call functionality
* feat: adding UI and flipping cameras
* feat: add stats and starting call bottom sheet
* feat: hanging up and bottom sheet behaviors should work now
* feat: add call stats report on frontend
* feat: add relay toggle for answer and offer
* fix: add keep screen on and more end call message on back pressed / on finish
* refactor: removing and replacing dagger 1 dep with android hilt
* feat: include latest proto
* feat: update to utilise call ID
* feat: add stun and turn
* refactor: playing around with deps and transport types
* feat: adding call service functionality and permissions for calls
* feat: add call manager and more static intent building functions for WebRtcCallService.kt
* feat: adding ringers and more audio boilerplate
* feat: audio manager call service boilerplate
* feat: update kotlin and add in call view model and more management functions
* refactor: moving call code around to service and viewmodel interactions
* feat: plugging CallManager.kt into view model and service, fixing up dependencies
* feat: implementing more WebRtcCallService.kt functions and handlers for actions as well as lifecycle
* feat: adding more lifecycle vm and callmanager / call service functionality
* feat: adding more command handlers in WebRtcCallService.kt
* feat: more commands handled, adding lock manager and bluetooth permissions
* feat: adding remainder of basic functionality to services and CallManager.kt
* feat: hooking up calls and fixing broken dependencies and compile errors
* fix: add timestamp to incoming call
* feat: some connection and service launching / ring lifecycle
* feat: call establishing and displaying
* fix: fixing call connect flows
* feat: ringers and better state handling
* feat: updating call layout
* feat: add fixes to bluetooth and begin the network renegotiation
* feat: add call related permissions and more network handover tests
* fix: don't display call option in conversation and don't show notification if option not enabled
* fix: incoming ringer fix on receiving call, call notification priorities and notification channel update
* build: update build number for testing
* fix: bluetooth auto-connection and re-connection fixes, removing finished todos, allowing self-send call messages for deduping answers
* feat: add pre-offer information and action handling in web rtc call service
* refactor: discard offer messages from non-matching pre-offers we are already expecting
* build: build numbers and version name update
* feat: handle discarding pending calls from linked devices
* feat: add signing props to release config build
* docs: fix comment on time being 300s (5m) instead of 30s
* feat: adding call messages for incoming/outgoing/missed
* refactor: handle in-thread call notifications better and replace deny button intent with denyCallIntent instead of hangup
* feat: add a hangup via data channel message
* feat: process microphone enabled events and remove debuggable from build.gradle
* feat: add first call notification
* refactor: set the buttons to match iOS in terms of enable disable and colours
* refactor: change the call logos in control messages
* refactor: more bluetooth improvements
* refactor: move start ringer and init of audio manager to CallManager.kt and string fix up
* build: remove debuggable for release build
* refactor: replace call icons
* feat: adding a call time display
* refactor: change the call time to update every second
* refactor: testing out the full screen intents
* refactor: wrapper use corrected session description, set title to recipient displayName, indicate session calls
* fix: crash on view with a parent already attached
* refactor: aspect ratio fit preserved
* refactor: add wantsToAnswer ability in pre-init for fullscreenintent
* refactor: prevent calls from non hasSent participants
* build: update gradle code
* refactor: replace timeout schedule with a seconds count
* fix: various bug fixes for calls
* fix: remove end call from busy
* refactor: use answerCall instead of manual intent building again
* build: new version
* feat: add silenced notifications for call notification builder. check pre-offer and connecting state for pending connection
* build: update build number
* fix: text color uses overridden style value
* fix: remove wrap content for renderers and look more at recovering from network switches
* build: update build number
* refactor: remove whitespace
* build: update build number
* refactor: used shared number for BatchMessageReceiveJob.kt parameter across pollers
* fix: glide in update crash
* fix: bug fixes for self-send answer / hangup messages
* build: update build number
* build: update build.gradle number
* refactor: compile errors and refactoring to view binding
* fix: set the content to binding.root view
* build: increase build number
* build: update build numbers
* feat: adding base for rotation and picking random subset of turn servers
* feat: starting the screen rotation processing
* feat: setting up rotation for the remote render view
* refactor: applying rotation and mirroring based on front / rear cameras that wraps nicely, only scale reworking needed
* refactor: calls video stretching but consistent
* refactor: state machine and tests for the transition events
* feat: new call state processing
* refactor: adding reconnecting logic and visuals
* feat: state machine reconnect logic wip
* feat: add reconnecting and merge fixes
* feat: check new session based off current state
* feat: reconnection logic works correctly now
* refactor: reduce TIMEOUT_SECONDS to 30 from 90
* feat: reset peer connection on DC to prevent ICE messages from old connection or stale state in reconnecting
* refactor: add null case
* fix: set approved on new outgoing threads, use approved more deeply and invalidate the options menu on recipient modified. Add approvedMe flag toggles for visible message receive
* fix: add name update in action bar on modified, change where approvedMe is set
* build: increment build number
* build: update build number
* fix: merge compile errors and increment build number
* refactor: remove negotiation based on which party dropped connection
* refactor: call reconnection improvement tested cross platform to re-establish
* refactor: failed and disconnect events only handled if either the reconnect or the timeout runnables are not set
* build: update version number
* fix: reduce timeout
* fix: fixes the incoming hangup logic for linked devices
* refactor: match iOS styling for call activity closer
* chore: upgrade build numbers
* feat: add in call settings dialog for if calls is disabled in conversation
* feat: add a first call missed control message and info popup with link to privacy settings
* fix: looking at crash for specific large transaction in NotificationManager
* refactor: removing the people in case transaction size reduces to fix notif crash
* fix: comment out the entire send multiple to see if it fixes the issue
* refactor: revert to including the full notification process in a try/catch to handle weird responses from NotificationManager
* fix: add in notification settings prompt for calls and try to fall back to dirty full screen intent / start activity if we're allowed
* build: upgrade build number
2022-04-19 06:25:40 +02:00
|
|
|
fun insertCallMessage(senderPublicKey: String, callMessageType: CallMessageType, sentTimestamp: Long)
|
|
|
|
fun conversationHasOutgoing(userPublicKey: String): Boolean
|
2022-08-10 10:17:48 +02:00
|
|
|
|
|
|
|
// Last Inbox Message Id
|
|
|
|
fun getLastInboxMessageId(server: String): Long?
|
|
|
|
fun setLastInboxMessageId(server: String, messageId: Long)
|
|
|
|
fun removeLastInboxMessageId(server: String)
|
|
|
|
|
|
|
|
// Last Outbox Message Id
|
|
|
|
fun getLastOutboxMessageId(server: String): Long?
|
|
|
|
fun setLastOutboxMessageId(server: String, messageId: Long)
|
|
|
|
fun removeLastOutboxMessageId(server: String)
|
|
|
|
fun getOrCreateBlindedIdMapping(blindedId: String, server: String, serverPublicKey: String, fromOutbox: Boolean = false): BlindedIdMapping
|
|
|
|
|
2022-09-07 06:41:39 +02:00
|
|
|
fun addReaction(reaction: Reaction, messageSender: String, notifyUnread: Boolean)
|
|
|
|
fun removeReaction(emoji: String, messageTimestamp: Long, author: String, notifyUnread: Boolean)
|
2022-09-04 13:03:32 +02:00
|
|
|
fun updateReactionIfNeeded(message: Message, sender: String, openGroupSentTimestamp: Long)
|
|
|
|
fun deleteReactions(messageId: Long, mms: Boolean)
|
New app theming (#913)
* feat: start new app theming feature
* feat: add some theming colours
* refactor: start refactoring themes and colours to use dynamic attributes
* feat: adding more colours and switching over default colours to be theme based instead of hard-coded or day/night specific
* refactor: take a look at ocean light and logo colour
* feat: global search colours for light and dark ocean
* feat: more styling
* feat: adding themes to conversation activity and refactoring the base theme to apply over the top of the activity's theme so it retains noActionBar etc
* feat: add dynamic accent color
* docs: add todo for changing how accent colour is applied
* feat: update new theming to use override primary style so that the regular colorAccent attribute can be used in existing layouts
* feat: coordinating styles across layouts, fixing up pinned icons and naming for conversation list items
* refactor: re-styling layouts to match new themes and attributes. Need to figure out action mode close button
* refactor: remove @color/text and replace with ?android:textColorPrimary to override in themes
* refactor: add context theme wrapper to bottom sheet dialog that references accent color
* fix: input bar bug fix and preference activity themes
* refactor: new settings menu options
* fix: crash for PNModeActivity.kt
refactor: move ordering in seed dialog to match designs, copy changes to match new settings menu
* feat: add new appearance settings activity
* refactor: title and VM changes
* fix: correct override
* feat: add theme appearance screen UI features and start VM implementation. re-add legacy theme utils to get default for migration
* fix: compile errors and missing themes from emoji features
* refactor: remove background shape alteration and old bottom sheet styles, re-add the theme mode attr
* feat: appearance screen wired up, just need to refresh theme
* feat: add theme state recreation and fix match system settings option
* refactor: add bottom margin
* feat: explore custom preference category
* feat: add the customized session theme for CorrectedPreferenceFragment
* feat: replace AppProtectionPreferenceFragment to extend ListSummaryPreferenceFragment
* refactor: change drawable style and remove explicit dividers
* refactor: remove divider in CorrectedPreferenceFragment
* feat: add theme state check on resume, might be jarring currently
* feat: add preference divider elements for settings menu
* refactor: settings menu redesigns
* refactor: change led preference to integer and refactor TextSecurePreferences.kt
* feat: add scroll parcel to save/restore hierarchy on restart with appearance changes
* feat: add the conversations blocked contacts and refactor preference order and copy
* feat: add blocked contacts activity, basic layout and vm
* feat: add unblock DB functions and storage protocol, start working on the DB query state flow, might have to just implement recipient on modified listener
* feat: add blocked contacts and notif recipient listeners
* feat: add recipient db reader
* feat: add blocked contact interactions and fix a theming crash for notifications
* feat: introduce better equals and hashcode implementations to recipient, replace home diff util content check with hashcode-based comparison
* feat: add settings menu vectors
* fix: preview compile error
* refactor: migrating settings menu to new designs
* feat: help menu
* refactor: simplify link opening
* refactor: remove space
* feat: refactor preferences and start theming for light mode options
* refactor: fixing dark and light modes with dialogs
* refactor: popup dialogs use proper themes now
* refactor: alert dialogs and media edit fragments use attribute references
* refactor: use input bar button attribute instead color control normal in vector tint
* refactor: transparency, dialog fixes, notification fix
* refactor: attrs and styles for buttons
* fix: use prominent button color on the outline button's border
* fix: fix the trash
* refactor: remove the appearance
* refactor: avatar placeholder generation, chips and element border styles
* refactor: use colors instead of style references
* refactor: theming changes to match designs and feedback
* refactor: the titles are bold and the categories are tertiary coloured now
* fix: appearance settings match preferences, search bottom bar uses themed attributes
* refactor: increase setting button height
* Update clear all data dialog
* Update seed dialog
* refactor: more qa feedback changes
* feat: add new TLs and fa-rIR TLs
* Update notification content dialog
* Fix message requests clear all button text color
* feat: re-add screenshot observer
* refactor: make send tint accent color
* feat: add unread background differences
* fix: change unread count indicator
* build: upgrade build numbers
* Fix message requests popupmenu background color
* fix: crash from attr reference in color attribute
* build: upgrade build number
* fix: message bubbles, thumbnail backgrounds, search bar visibility with input bar, attachment buttons
* fix: tertiary text for keyboard page search view
* fix: emoji overflow colour differences
* fix: reaction pill dialog background is now correct colour
* Add style to reactions tab layout
* fix: appearance activity reverting primary color at correct time
* fix: show call privacy warning every time instead of just once
* fix: gradient background(?) and audio autoplay disable
* fix: crash in all media containing documents
* fix: reaction dialog heading fixes
* Add style to reactions tab layout
* fix: remove gradient backgrounds
* fix: adding new reaction normal text attribute to try correct the tab layout
* fix: ocean dark unread/read colours
* build; update build number
* build: update build number
Co-authored-by: charles <charles@oxen.io>
2022-10-12 08:05:55 +02:00
|
|
|
fun unblock(toUnblock: List<Recipient>)
|
|
|
|
fun blockedContacts(): List<Recipient>
|
2021-04-08 07:11:46 +02:00
|
|
|
}
|