mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-25 11:05:25 +00:00
Fix up more DI
This commit is contained in:
parent
2523975462
commit
71009c373b
@ -111,6 +111,7 @@ import java.util.concurrent.Executors;
|
|||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
|
import dagger.Lazy;
|
||||||
import dagger.hilt.EntryPoints;
|
import dagger.hilt.EntryPoints;
|
||||||
import dagger.hilt.android.HiltAndroidApp;
|
import dagger.hilt.android.HiltAndroidApp;
|
||||||
import kotlin.Deprecated;
|
import kotlin.Deprecated;
|
||||||
@ -133,7 +134,6 @@ public class ApplicationContext extends Application implements DefaultLifecycleO
|
|||||||
|
|
||||||
private static final String TAG = ApplicationContext.class.getSimpleName();
|
private static final String TAG = ApplicationContext.class.getSimpleName();
|
||||||
|
|
||||||
public MessageNotifier messageNotifier = null;
|
|
||||||
public Poller poller = null;
|
public Poller poller = null;
|
||||||
public Broadcaster broadcaster = null;
|
public Broadcaster broadcaster = null;
|
||||||
private WindowDebouncer conversationListDebouncer;
|
private WindowDebouncer conversationListDebouncer;
|
||||||
@ -164,7 +164,9 @@ public class ApplicationContext extends Application implements DefaultLifecycleO
|
|||||||
@Inject TypingStatusRepository typingStatusRepository;
|
@Inject TypingStatusRepository typingStatusRepository;
|
||||||
@Inject TypingStatusSender typingStatusSender;
|
@Inject TypingStatusSender typingStatusSender;
|
||||||
@Inject ReadReceiptManager readReceiptManager;
|
@Inject ReadReceiptManager readReceiptManager;
|
||||||
|
@Inject Lazy<MessageNotifier> messageNotifierLazy;
|
||||||
|
@Inject LokiAPIDatabase apiDB;
|
||||||
|
@Inject EmojiSearchDatabase emojiSearchDb;
|
||||||
|
|
||||||
private volatile boolean isAppVisible;
|
private volatile boolean isAppVisible;
|
||||||
|
|
||||||
@ -180,14 +182,21 @@ public class ApplicationContext extends Application implements DefaultLifecycleO
|
|||||||
return (ApplicationContext) context.getApplicationContext();
|
return (ApplicationContext) context.getApplicationContext();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Deprecated(message = "Use proper DI to inject this component")
|
||||||
public TextSecurePreferences getPrefs() {
|
public TextSecurePreferences getPrefs() {
|
||||||
return EntryPoints.get(getApplicationContext(), AppComponent.class).getPrefs();
|
return EntryPoints.get(getApplicationContext(), AppComponent.class).getPrefs();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Deprecated(message = "Use proper DI to inject this component")
|
||||||
public DatabaseComponent getDatabaseComponent() {
|
public DatabaseComponent getDatabaseComponent() {
|
||||||
return EntryPoints.get(getApplicationContext(), DatabaseComponent.class);
|
return EntryPoints.get(getApplicationContext(), DatabaseComponent.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Deprecated(message = "Use proper DI to inject this component")
|
||||||
|
public MessageNotifier getMessageNotifier() {
|
||||||
|
return messageNotifierLazy.get();
|
||||||
|
}
|
||||||
|
|
||||||
public Handler getConversationListNotificationHandler() {
|
public Handler getConversationListNotificationHandler() {
|
||||||
if (this.conversationListHandlerThread == null) {
|
if (this.conversationListHandlerThread == null) {
|
||||||
conversationListHandlerThread = new HandlerThread("ConversationListHandler");
|
conversationListHandlerThread = new HandlerThread("ConversationListHandler");
|
||||||
@ -248,13 +257,11 @@ public class ApplicationContext extends Application implements DefaultLifecycleO
|
|||||||
NotificationChannels.create(this);
|
NotificationChannels.create(this);
|
||||||
ProcessLifecycleOwner.get().getLifecycle().addObserver(this);
|
ProcessLifecycleOwner.get().getLifecycle().addObserver(this);
|
||||||
AppContext.INSTANCE.configureKovenant();
|
AppContext.INSTANCE.configureKovenant();
|
||||||
messageNotifier = new OptimizedMessageNotifier(new DefaultMessageNotifier());
|
|
||||||
broadcaster = new Broadcaster(this);
|
broadcaster = new Broadcaster(this);
|
||||||
LokiAPIDatabase apiDB = getDatabaseComponent().lokiAPIDatabase();
|
|
||||||
boolean useTestNet = textSecurePreferences.getEnvironment() == Environment.TEST_NET;
|
boolean useTestNet = textSecurePreferences.getEnvironment() == Environment.TEST_NET;
|
||||||
SnodeModule.Companion.configure(apiDB, broadcaster, useTestNet);
|
SnodeModule.Companion.configure(apiDB, broadcaster, useTestNet);
|
||||||
initializePeriodicTasks();
|
initializePeriodicTasks();
|
||||||
SSKEnvironment.Companion.configure(typingStatusRepository, readReceiptManager, profileManager, messageNotifier, expiringMessageManager);
|
SSKEnvironment.Companion.configure(typingStatusRepository, readReceiptManager, profileManager, getMessageNotifier(), expiringMessageManager);
|
||||||
initializeWebRtc();
|
initializeWebRtc();
|
||||||
initializeBlobProvider();
|
initializeBlobProvider();
|
||||||
resubmitProfilePictureIfNeeded();
|
resubmitProfilePictureIfNeeded();
|
||||||
@ -319,7 +326,7 @@ public class ApplicationContext extends Application implements DefaultLifecycleO
|
|||||||
isAppVisible = false;
|
isAppVisible = false;
|
||||||
Log.i(TAG, "App is no longer visible.");
|
Log.i(TAG, "App is no longer visible.");
|
||||||
KeyCachingService.onAppBackgrounded(this);
|
KeyCachingService.onAppBackgrounded(this);
|
||||||
messageNotifier.setVisibleThread(-1);
|
getMessageNotifier().setVisibleThread(-1);
|
||||||
if (poller != null) {
|
if (poller != null) {
|
||||||
poller.stopIfNeeded();
|
poller.stopIfNeeded();
|
||||||
}
|
}
|
||||||
@ -452,7 +459,6 @@ public class ApplicationContext extends Application implements DefaultLifecycleO
|
|||||||
|
|
||||||
private void loadEmojiSearchIndexIfNeeded() {
|
private void loadEmojiSearchIndexIfNeeded() {
|
||||||
Executors.newSingleThreadExecutor().execute(() -> {
|
Executors.newSingleThreadExecutor().execute(() -> {
|
||||||
EmojiSearchDatabase emojiSearchDb = getDatabaseComponent().emojiSearchDatabase();
|
|
||||||
if (emojiSearchDb.query("face", 1).isEmpty()) {
|
if (emojiSearchDb.query("face", 1).isEmpty()) {
|
||||||
try (InputStream inputStream = getAssets().open("emoji/emoji_search_index.json")) {
|
try (InputStream inputStream = getAssets().open("emoji/emoji_search_index.json")) {
|
||||||
List<EmojiSearchData> searchIndex = Arrays.asList(JsonUtil.fromJson(inputStream, EmojiSearchData[].class));
|
List<EmojiSearchData> searchIndex = Arrays.asList(JsonUtil.fromJson(inputStream, EmojiSearchData[].class));
|
||||||
|
@ -49,7 +49,7 @@ public class DatabaseUpgradeActivity extends BaseActivity {
|
|||||||
new AsyncTask<Void, Void, Void>() {
|
new AsyncTask<Void, Void, Void>() {
|
||||||
@Override
|
@Override
|
||||||
protected Void doInBackground(Void... params) {
|
protected Void doInBackground(Void... params) {
|
||||||
ApplicationContext.getInstance(context).messageNotifier.updateNotification(context);
|
ApplicationContext.getInstance(context).getMessageNotifier().updateNotification(context);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||||
|
@ -14,9 +14,9 @@ import network.loki.messenger.libsession_util.util.GroupDisplayInfo
|
|||||||
import network.loki.messenger.libsession_util.util.GroupInfo
|
import network.loki.messenger.libsession_util.util.GroupInfo
|
||||||
import network.loki.messenger.libsession_util.util.UserPic
|
import network.loki.messenger.libsession_util.util.UserPic
|
||||||
import org.session.libsession.avatars.AvatarHelper
|
import org.session.libsession.avatars.AvatarHelper
|
||||||
|
import org.session.libsession.database.MessageDataProvider
|
||||||
import org.session.libsession.database.StorageProtocol
|
import org.session.libsession.database.StorageProtocol
|
||||||
import org.session.libsession.messaging.BlindedIdMapping
|
import org.session.libsession.messaging.BlindedIdMapping
|
||||||
import org.session.libsession.messaging.MessagingModuleConfiguration
|
|
||||||
import org.session.libsession.messaging.calls.CallMessageType
|
import org.session.libsession.messaging.calls.CallMessageType
|
||||||
import org.session.libsession.messaging.contacts.Contact
|
import org.session.libsession.messaging.contacts.Contact
|
||||||
import org.session.libsession.messaging.jobs.AttachmentUploadJob
|
import org.session.libsession.messaging.jobs.AttachmentUploadJob
|
||||||
@ -49,11 +49,12 @@ import org.session.libsession.messaging.sending_receiving.attachments.Attachment
|
|||||||
import org.session.libsession.messaging.sending_receiving.attachments.DatabaseAttachment
|
import org.session.libsession.messaging.sending_receiving.attachments.DatabaseAttachment
|
||||||
import org.session.libsession.messaging.sending_receiving.data_extraction.DataExtractionNotificationInfoMessage
|
import org.session.libsession.messaging.sending_receiving.data_extraction.DataExtractionNotificationInfoMessage
|
||||||
import org.session.libsession.messaging.sending_receiving.link_preview.LinkPreview
|
import org.session.libsession.messaging.sending_receiving.link_preview.LinkPreview
|
||||||
|
import org.session.libsession.messaging.sending_receiving.notifications.MessageNotifier
|
||||||
import org.session.libsession.messaging.sending_receiving.quotes.QuoteModel
|
import org.session.libsession.messaging.sending_receiving.quotes.QuoteModel
|
||||||
import org.session.libsession.messaging.utilities.SodiumUtilities
|
import org.session.libsession.messaging.utilities.SodiumUtilities
|
||||||
import org.session.libsession.messaging.utilities.UpdateMessageData
|
import org.session.libsession.messaging.utilities.UpdateMessageData
|
||||||
import org.session.libsession.snode.OnionRequestAPI
|
import org.session.libsession.snode.OnionRequestAPI
|
||||||
import org.session.libsession.snode.SnodeAPI
|
import org.session.libsession.snode.SnodeClock
|
||||||
import org.session.libsession.utilities.Address
|
import org.session.libsession.utilities.Address
|
||||||
import org.session.libsession.utilities.Address.Companion.fromSerialized
|
import org.session.libsession.utilities.Address.Companion.fromSerialized
|
||||||
import org.session.libsession.utilities.GroupRecord
|
import org.session.libsession.utilities.GroupRecord
|
||||||
@ -113,6 +114,12 @@ open class Storage @Inject constructor(
|
|||||||
private val lokiThreadDatabase: LokiThreadDatabase,
|
private val lokiThreadDatabase: LokiThreadDatabase,
|
||||||
private val sessionContactDatabase: SessionContactDatabase,
|
private val sessionContactDatabase: SessionContactDatabase,
|
||||||
private val expirationConfigurationDatabase: ExpirationConfigurationDatabase,
|
private val expirationConfigurationDatabase: ExpirationConfigurationDatabase,
|
||||||
|
private val profileManager: SSKEnvironment.ProfileManagerProtocol,
|
||||||
|
private val notificationManager: MessageNotifier,
|
||||||
|
private val messageDataProvider: MessageDataProvider,
|
||||||
|
private val messageExpirationManager: SSKEnvironment.MessageExpirationManagerProtocol,
|
||||||
|
private val clock: SnodeClock,
|
||||||
|
private val preferences: TextSecurePreferences,
|
||||||
) : Database(context, helper), StorageProtocol, ThreadDatabase.ConversationThreadUpdateListener {
|
) : Database(context, helper), StorageProtocol, ThreadDatabase.ConversationThreadUpdateListener {
|
||||||
|
|
||||||
init {
|
init {
|
||||||
@ -133,7 +140,7 @@ open class Storage @Inject constructor(
|
|||||||
val legacyGroup = configs.userGroups.getOrConstructLegacyGroupInfo(accountId)
|
val legacyGroup = configs.userGroups.getOrConstructLegacyGroupInfo(accountId)
|
||||||
configs.userGroups.set(legacyGroup)
|
configs.userGroups.set(legacyGroup)
|
||||||
val newVolatileParams = configs.convoInfoVolatile.getOrConstructLegacyGroup(accountId).copy(
|
val newVolatileParams = configs.convoInfoVolatile.getOrConstructLegacyGroup(accountId).copy(
|
||||||
lastRead = SnodeAPI.nowWithOffset,
|
lastRead = clock.currentTimeMills(),
|
||||||
)
|
)
|
||||||
configs.convoInfoVolatile.set(newVolatileParams)
|
configs.convoInfoVolatile.set(newVolatileParams)
|
||||||
}
|
}
|
||||||
@ -210,7 +217,7 @@ open class Storage @Inject constructor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun getUserPublicKey(): String? {
|
override fun getUserPublicKey(): String? {
|
||||||
return TextSecurePreferences.getLocalNumber(context)
|
return preferences.getLocalNumber()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getUserX25519KeyPair(): ECKeyPair {
|
override fun getUserX25519KeyPair(): ECKeyPair {
|
||||||
@ -291,18 +298,16 @@ open class Storage @Inject constructor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun deleteMessagesByHash(threadId: Long, hashes: List<String>) {
|
override fun deleteMessagesByHash(threadId: Long, hashes: List<String>) {
|
||||||
val messageDataProvider = MessagingModuleConfiguration.shared.messageDataProvider
|
|
||||||
val info = lokiMessageDatabase.getSendersForHashes(threadId, hashes.toSet())
|
val info = lokiMessageDatabase.getSendersForHashes(threadId, hashes.toSet())
|
||||||
// TODO: no idea if we need to server delete this
|
// TODO: no idea if we need to server delete this
|
||||||
for ((serverHash, sender, messageIdToDelete, isSms) in info) {
|
for ((serverHash, sender, messageIdToDelete, isSms) in info) {
|
||||||
messageDataProvider.updateMessageAsDeleted(messageIdToDelete, isSms)
|
messageDataProvider.updateMessageAsDeleted(messageIdToDelete, isSms)
|
||||||
if (!messageDataProvider.isOutgoingMessage(messageIdToDelete)) {
|
if (!messageDataProvider.isOutgoingMessage(messageIdToDelete)) {
|
||||||
SSKEnvironment.shared.notificationManager.updateNotification(context)
|
notificationManager.updateNotification(context)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
override fun deleteMessagesByUser(threadId: Long, userSessionId: String) {
|
override fun deleteMessagesByUser(threadId: Long, userSessionId: String) {
|
||||||
val messageDataProvider = MessagingModuleConfiguration.shared.messageDataProvider
|
|
||||||
val userMessages = mmsSmsDatabase.getUserMessages(threadId, userSessionId)
|
val userMessages = mmsSmsDatabase.getUserMessages(threadId, userSessionId)
|
||||||
val (mmsMessages, smsMessages) = userMessages.partition { it.isMms }
|
val (mmsMessages, smsMessages) = userMessages.partition { it.isMms }
|
||||||
if (mmsMessages.isNotEmpty()) {
|
if (mmsMessages.isNotEmpty()) {
|
||||||
@ -684,7 +689,7 @@ open class Storage @Inject constructor(
|
|||||||
// message timestamp and as such we cannot use that to identify the local message.
|
// message timestamp and as such we cannot use that to identify the local message.
|
||||||
override fun markAsSentToCommunity(threadId: Long, messageID: Long) {
|
override fun markAsSentToCommunity(threadId: Long, messageID: Long) {
|
||||||
val database = mmsSmsDatabase
|
val database = mmsSmsDatabase
|
||||||
val message = database.getLastSentMessageRecordFromSender(threadId, TextSecurePreferences.getLocalNumber(context))
|
val message = database.getLastSentMessageRecordFromSender(threadId, preferences.getLocalNumber())
|
||||||
|
|
||||||
// Ensure we can find the local message..
|
// Ensure we can find the local message..
|
||||||
if (message == null) {
|
if (message == null) {
|
||||||
@ -749,7 +754,7 @@ open class Storage @Inject constructor(
|
|||||||
// modifies the message timestamp and as such we cannot use that to identify the local message.
|
// modifies the message timestamp and as such we cannot use that to identify the local message.
|
||||||
override fun markUnidentifiedInCommunity(threadId: Long, messageId: Long) {
|
override fun markUnidentifiedInCommunity(threadId: Long, messageId: Long) {
|
||||||
val database = mmsSmsDatabase
|
val database = mmsSmsDatabase
|
||||||
val message = database.getLastSentMessageRecordFromSender(threadId, TextSecurePreferences.getLocalNumber(context))
|
val message = database.getLastSentMessageRecordFromSender(threadId, preferences.getLocalNumber())
|
||||||
|
|
||||||
// Check to ensure the message exists
|
// Check to ensure the message exists
|
||||||
if (message == null) {
|
if (message == null) {
|
||||||
@ -1023,7 +1028,7 @@ open class Storage @Inject constructor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun insertGroupInfoChange(message: GroupUpdated, closedGroup: AccountId): Long? {
|
override fun insertGroupInfoChange(message: GroupUpdated, closedGroup: AccountId): Long? {
|
||||||
val sentTimestamp = message.sentTimestamp ?: SnodeAPI.nowWithOffset
|
val sentTimestamp = message.sentTimestamp ?: clock.currentTimeMills()
|
||||||
val senderPublicKey = message.sender
|
val senderPublicKey = message.sender
|
||||||
val groupName = configFactory.withGroupConfigs(closedGroup) { it.groupInfo.getName() }
|
val groupName = configFactory.withGroupConfigs(closedGroup) { it.groupInfo.getName() }
|
||||||
|
|
||||||
@ -1033,7 +1038,7 @@ open class Storage @Inject constructor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun insertGroupInfoLeaving(closedGroup: AccountId): Long? {
|
override fun insertGroupInfoLeaving(closedGroup: AccountId): Long? {
|
||||||
val sentTimestamp = SnodeAPI.nowWithOffset
|
val sentTimestamp = clock.currentTimeMills()
|
||||||
val senderPublicKey = getUserPublicKey() ?: return null
|
val senderPublicKey = getUserPublicKey() ?: return null
|
||||||
val updateData = UpdateMessageData.buildGroupLeaveUpdate(UpdateMessageData.Kind.GroupLeaving)
|
val updateData = UpdateMessageData.buildGroupLeaveUpdate(UpdateMessageData.Kind.GroupLeaving)
|
||||||
|
|
||||||
@ -1211,7 +1216,7 @@ open class Storage @Inject constructor(
|
|||||||
sessionContactDatabase.setContact(contact)
|
sessionContactDatabase.setContact(contact)
|
||||||
val address = fromSerialized(contact.accountID)
|
val address = fromSerialized(contact.accountID)
|
||||||
if (!getRecipientApproved(address)) return
|
if (!getRecipientApproved(address)) return
|
||||||
val recipientHash = SSKEnvironment.shared.profileManager.contactUpdatedInternal(contact)
|
val recipientHash = profileManager.contactUpdatedInternal(contact)
|
||||||
val recipient = Recipient.from(context, address, false)
|
val recipient = Recipient.from(context, address, false)
|
||||||
setRecipientHash(recipient, recipientHash)
|
setRecipientHash(recipient, recipientHash)
|
||||||
}
|
}
|
||||||
@ -1234,7 +1239,6 @@ open class Storage @Inject constructor(
|
|||||||
val id = AccountId(contact.id)
|
val id = AccountId(contact.id)
|
||||||
id.prefix?.isBlinded() == false || mappingDb.getBlindedIdMapping(contact.id).none { it.accountId != null }
|
id.prefix?.isBlinded() == false || mappingDb.getBlindedIdMapping(contact.id).none { it.accountId != null }
|
||||||
}
|
}
|
||||||
val profileManager = SSKEnvironment.shared.profileManager
|
|
||||||
moreContacts.forEach { contact ->
|
moreContacts.forEach { contact ->
|
||||||
val address = fromSerialized(contact.id)
|
val address = fromSerialized(contact.id)
|
||||||
val recipient = Recipient.from(context, address, false)
|
val recipient = Recipient.from(context, address, false)
|
||||||
@ -1510,8 +1514,7 @@ open class Storage @Inject constructor(
|
|||||||
)
|
)
|
||||||
|
|
||||||
database.insertSecureDecryptedMessageInbox(mediaMessage, threadId, runThreadUpdate = true)
|
database.insertSecureDecryptedMessageInbox(mediaMessage, threadId, runThreadUpdate = true)
|
||||||
|
messageExpirationManager.maybeStartExpiration(sentTimestamp, senderPublicKey, expiryMode)
|
||||||
SSKEnvironment.shared.messageExpirationManager.maybeStartExpiration(sentTimestamp, senderPublicKey, expiryMode)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1543,7 +1546,6 @@ open class Storage @Inject constructor(
|
|||||||
val threadId = getOrCreateThreadIdFor(sender.address)
|
val threadId = getOrCreateThreadIdFor(sender.address)
|
||||||
val profile = response.profile
|
val profile = response.profile
|
||||||
if (profile != null) {
|
if (profile != null) {
|
||||||
val profileManager = SSKEnvironment.shared.profileManager
|
|
||||||
val name = profile.displayName!!
|
val name = profile.displayName!!
|
||||||
if (name.isNotEmpty()) {
|
if (name.isNotEmpty()) {
|
||||||
profileManager.setName(context, sender, name)
|
profileManager.setName(context, sender, name)
|
||||||
@ -1629,7 +1631,7 @@ open class Storage @Inject constructor(
|
|||||||
val mmsDb = mmsDatabase
|
val mmsDb = mmsDatabase
|
||||||
val message = IncomingMediaMessage(
|
val message = IncomingMediaMessage(
|
||||||
fromSerialized(userPublicKey),
|
fromSerialized(userPublicKey),
|
||||||
SnodeAPI.nowWithOffset,
|
clock.currentTimeMills(),
|
||||||
-1,
|
-1,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
@ -1684,7 +1686,7 @@ open class Storage @Inject constructor(
|
|||||||
val expireStartedAt = if (expiryMode is ExpiryMode.AfterSend) sentTimestamp else 0
|
val expireStartedAt = if (expiryMode is ExpiryMode.AfterSend) sentTimestamp else 0
|
||||||
val callMessage = IncomingTextMessage.fromCallInfo(callMessageType, address, Optional.absent(), sentTimestamp, expiresInMillis, expireStartedAt)
|
val callMessage = IncomingTextMessage.fromCallInfo(callMessageType, address, Optional.absent(), sentTimestamp, expiresInMillis, expireStartedAt)
|
||||||
database.insertCallMessage(callMessage)
|
database.insertCallMessage(callMessage)
|
||||||
SSKEnvironment.shared.messageExpirationManager.maybeStartExpiration(sentTimestamp, senderPublicKey, expiryMode)
|
messageExpirationManager.maybeStartExpiration(sentTimestamp, senderPublicKey, expiryMode)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun conversationHasOutgoing(userPublicKey: String): Boolean {
|
override fun conversationHasOutgoing(userPublicKey: String): Boolean {
|
||||||
|
@ -768,7 +768,7 @@ public class ThreadDatabase extends Database {
|
|||||||
if (mmsSmsDatabase.getConversationCount(threadId) <= 0 && !force) return false;
|
if (mmsSmsDatabase.getConversationCount(threadId) <= 0 && !force) return false;
|
||||||
List<MarkedMessageInfo> messages = setRead(threadId, lastSeenTime);
|
List<MarkedMessageInfo> messages = setRead(threadId, lastSeenTime);
|
||||||
MarkReadReceiver.process(context, messages);
|
MarkReadReceiver.process(context, messages);
|
||||||
ApplicationContext.getInstance(context).messageNotifier.updateNotification(context, threadId);
|
ApplicationContext.getInstance(context).getMessageNotifier().updateNotification(context, threadId);
|
||||||
return setLastSeen(threadId, lastSeenTime);
|
return setLastSeen(threadId, lastSeenTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,17 +9,16 @@ import dagger.hilt.EntryPoint
|
|||||||
import dagger.hilt.InstallIn
|
import dagger.hilt.InstallIn
|
||||||
import dagger.hilt.android.qualifiers.ApplicationContext
|
import dagger.hilt.android.qualifiers.ApplicationContext
|
||||||
import dagger.hilt.components.SingletonComponent
|
import dagger.hilt.components.SingletonComponent
|
||||||
import org.session.libsession.database.StorageProtocol
|
|
||||||
import org.session.libsession.messaging.groups.GroupManagerV2
|
import org.session.libsession.messaging.groups.GroupManagerV2
|
||||||
|
import org.session.libsession.messaging.sending_receiving.notifications.MessageNotifier
|
||||||
import org.session.libsession.utilities.AppTextSecurePreferences
|
import org.session.libsession.utilities.AppTextSecurePreferences
|
||||||
import org.session.libsession.utilities.ConfigFactoryProtocol
|
import org.session.libsession.utilities.ConfigFactoryProtocol
|
||||||
import org.session.libsession.utilities.SSKEnvironment
|
import org.session.libsession.utilities.SSKEnvironment
|
||||||
import org.session.libsession.utilities.TextSecurePreferences
|
import org.session.libsession.utilities.TextSecurePreferences
|
||||||
import org.session.libsession.utilities.Toaster
|
import org.session.libsession.utilities.Toaster
|
||||||
import org.session.libsignal.database.LokiAPIDatabaseProtocol
|
|
||||||
import org.thoughtcrime.securesms.database.LokiAPIDatabase
|
|
||||||
import org.thoughtcrime.securesms.database.Storage
|
|
||||||
import org.thoughtcrime.securesms.groups.GroupManagerV2Impl
|
import org.thoughtcrime.securesms.groups.GroupManagerV2Impl
|
||||||
|
import org.thoughtcrime.securesms.notifications.DefaultMessageNotifier
|
||||||
|
import org.thoughtcrime.securesms.notifications.OptimizedMessageNotifier
|
||||||
import org.thoughtcrime.securesms.repository.ConversationRepository
|
import org.thoughtcrime.securesms.repository.ConversationRepository
|
||||||
import org.thoughtcrime.securesms.repository.DefaultConversationRepository
|
import org.thoughtcrime.securesms.repository.DefaultConversationRepository
|
||||||
import org.thoughtcrime.securesms.sskenvironment.ProfileManager
|
import org.thoughtcrime.securesms.sskenvironment.ProfileManager
|
||||||
@ -27,7 +26,18 @@ import javax.inject.Singleton
|
|||||||
|
|
||||||
@Module
|
@Module
|
||||||
@InstallIn(SingletonComponent::class)
|
@InstallIn(SingletonComponent::class)
|
||||||
abstract class AppModule {
|
class AppModule {
|
||||||
|
|
||||||
|
@Provides
|
||||||
|
@Singleton
|
||||||
|
fun provideMessageNotifier(): MessageNotifier {
|
||||||
|
return OptimizedMessageNotifier(DefaultMessageNotifier())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Module
|
||||||
|
@InstallIn(SingletonComponent::class)
|
||||||
|
abstract class AppBindings {
|
||||||
|
|
||||||
@Binds
|
@Binds
|
||||||
abstract fun bindTextSecurePreferences(preferences: AppTextSecurePreferences): TextSecurePreferences
|
abstract fun bindTextSecurePreferences(preferences: AppTextSecurePreferences): TextSecurePreferences
|
||||||
|
@ -35,6 +35,7 @@ import org.greenrobot.eventbus.Subscribe
|
|||||||
import org.greenrobot.eventbus.ThreadMode
|
import org.greenrobot.eventbus.ThreadMode
|
||||||
import org.session.libsession.messaging.groups.GroupManagerV2
|
import org.session.libsession.messaging.groups.GroupManagerV2
|
||||||
import org.session.libsession.messaging.jobs.JobQueue
|
import org.session.libsession.messaging.jobs.JobQueue
|
||||||
|
import org.session.libsession.messaging.sending_receiving.notifications.MessageNotifier
|
||||||
import org.session.libsession.snode.SnodeClock
|
import org.session.libsession.snode.SnodeClock
|
||||||
import org.session.libsession.utilities.Address
|
import org.session.libsession.utilities.Address
|
||||||
import org.session.libsession.utilities.ProfilePictureModifiedEvent
|
import org.session.libsession.utilities.ProfilePictureModifiedEvent
|
||||||
@ -103,6 +104,7 @@ class HomeActivity : PassphraseRequiredActionBarActivity(),
|
|||||||
@Inject lateinit var lokiThreadDatabase: LokiThreadDatabase
|
@Inject lateinit var lokiThreadDatabase: LokiThreadDatabase
|
||||||
@Inject lateinit var sessionJobDatabase: SessionJobDatabase
|
@Inject lateinit var sessionJobDatabase: SessionJobDatabase
|
||||||
@Inject lateinit var clock: SnodeClock
|
@Inject lateinit var clock: SnodeClock
|
||||||
|
@Inject lateinit var messageNotifier: MessageNotifier
|
||||||
|
|
||||||
private val globalSearchViewModel by viewModels<GlobalSearchViewModel>()
|
private val globalSearchViewModel by viewModels<GlobalSearchViewModel>()
|
||||||
private val homeViewModel by viewModels<HomeViewModel>()
|
private val homeViewModel by viewModels<HomeViewModel>()
|
||||||
@ -354,7 +356,7 @@ class HomeActivity : PassphraseRequiredActionBarActivity(),
|
|||||||
|
|
||||||
override fun onResume() {
|
override fun onResume() {
|
||||||
super.onResume()
|
super.onResume()
|
||||||
ApplicationContext.getInstance(this).messageNotifier.setHomeScreenVisible(true)
|
messageNotifier.setHomeScreenVisible(true)
|
||||||
if (textSecurePreferences.getLocalNumber() == null) { return; } // This can be the case after a secondary device is auto-cleared
|
if (textSecurePreferences.getLocalNumber() == null) { return; } // This can be the case after a secondary device is auto-cleared
|
||||||
IdentityKeyUtil.checkUpdate(this)
|
IdentityKeyUtil.checkUpdate(this)
|
||||||
binding.profileButton.recycle() // clear cached image before update tje profilePictureView
|
binding.profileButton.recycle() // clear cached image before update tje profilePictureView
|
||||||
|
@ -68,7 +68,7 @@ public class AndroidAutoHeardReceiver extends BroadcastReceiver {
|
|||||||
messageIdsCollection.addAll(messageIds);
|
messageIdsCollection.addAll(messageIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
ApplicationContext.getInstance(context).messageNotifier.updateNotification(context);
|
ApplicationContext.getInstance(context).getMessageNotifier().updateNotification(context);
|
||||||
MarkReadReceiver.process(context, messageIdsCollection);
|
MarkReadReceiver.process(context, messageIdsCollection);
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
@ -109,7 +109,7 @@ public class AndroidAutoReplyReceiver extends BroadcastReceiver {
|
|||||||
|
|
||||||
List<MarkedMessageInfo> messageIds = DatabaseComponent.get(context).threadDatabase().setRead(replyThreadId, true);
|
List<MarkedMessageInfo> messageIds = DatabaseComponent.get(context).threadDatabase().setRead(replyThreadId, true);
|
||||||
|
|
||||||
ApplicationContext.getInstance(context).messageNotifier.updateNotification(context);
|
ApplicationContext.getInstance(context).getMessageNotifier().updateNotification(context);
|
||||||
MarkReadReceiver.process(context, messageIds);
|
MarkReadReceiver.process(context, messageIds);
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
@ -17,7 +17,7 @@ public class DeleteNotificationReceiver extends BroadcastReceiver {
|
|||||||
@Override
|
@Override
|
||||||
public void onReceive(final Context context, Intent intent) {
|
public void onReceive(final Context context, Intent intent) {
|
||||||
if (DELETE_NOTIFICATION_ACTION.equals(intent.getAction())) {
|
if (DELETE_NOTIFICATION_ACTION.equals(intent.getAction())) {
|
||||||
ApplicationContext.getInstance(context).messageNotifier.clearReminder(context);
|
ApplicationContext.getInstance(context).getMessageNotifier().clearReminder(context);
|
||||||
|
|
||||||
final long[] ids = intent.getLongArrayExtra(EXTRA_IDS);
|
final long[] ids = intent.getLongArrayExtra(EXTRA_IDS);
|
||||||
final boolean[] mms = intent.getBooleanArrayExtra(EXTRA_MMS);
|
final boolean[] mms = intent.getBooleanArrayExtra(EXTRA_MMS);
|
||||||
|
@ -31,11 +31,11 @@ import org.session.libsession.messaging.messages.signal.OutgoingMediaMessage;
|
|||||||
import org.session.libsession.messaging.messages.signal.OutgoingTextMessage;
|
import org.session.libsession.messaging.messages.signal.OutgoingTextMessage;
|
||||||
import org.session.libsession.messaging.messages.visible.VisibleMessage;
|
import org.session.libsession.messaging.messages.visible.VisibleMessage;
|
||||||
import org.session.libsession.messaging.sending_receiving.MessageSender;
|
import org.session.libsession.messaging.sending_receiving.MessageSender;
|
||||||
import org.session.libsession.snode.SnodeAPI;
|
import org.session.libsession.messaging.sending_receiving.notifications.MessageNotifier;
|
||||||
|
import org.session.libsession.snode.SnodeClock;
|
||||||
import org.session.libsession.utilities.Address;
|
import org.session.libsession.utilities.Address;
|
||||||
import org.session.libsession.utilities.recipients.Recipient;
|
import org.session.libsession.utilities.recipients.Recipient;
|
||||||
import org.session.libsignal.utilities.Log;
|
import org.session.libsignal.utilities.Log;
|
||||||
import org.thoughtcrime.securesms.ApplicationContext;
|
|
||||||
import org.thoughtcrime.securesms.database.MarkedMessageInfo;
|
import org.thoughtcrime.securesms.database.MarkedMessageInfo;
|
||||||
import org.thoughtcrime.securesms.database.MmsDatabase;
|
import org.thoughtcrime.securesms.database.MmsDatabase;
|
||||||
import org.thoughtcrime.securesms.database.SmsDatabase;
|
import org.thoughtcrime.securesms.database.SmsDatabase;
|
||||||
@ -70,6 +70,10 @@ public class RemoteReplyReceiver extends BroadcastReceiver {
|
|||||||
SmsDatabase smsDatabase;
|
SmsDatabase smsDatabase;
|
||||||
@Inject
|
@Inject
|
||||||
Storage storage;
|
Storage storage;
|
||||||
|
@Inject
|
||||||
|
MessageNotifier messageNotifier;
|
||||||
|
@Inject
|
||||||
|
SnodeClock clock;
|
||||||
|
|
||||||
@SuppressLint("StaticFieldLeak")
|
@SuppressLint("StaticFieldLeak")
|
||||||
@Override
|
@Override
|
||||||
@ -94,7 +98,7 @@ public class RemoteReplyReceiver extends BroadcastReceiver {
|
|||||||
Recipient recipient = Recipient.from(context, address, false);
|
Recipient recipient = Recipient.from(context, address, false);
|
||||||
long threadId = threadDatabase.getOrCreateThreadIdFor(recipient);
|
long threadId = threadDatabase.getOrCreateThreadIdFor(recipient);
|
||||||
VisibleMessage message = new VisibleMessage();
|
VisibleMessage message = new VisibleMessage();
|
||||||
message.setSentTimestamp(SnodeAPI.getNowWithOffset());
|
message.setSentTimestamp(clock.currentTimeMills());
|
||||||
message.setText(responseText.toString());
|
message.setText(responseText.toString());
|
||||||
ExpirationConfiguration config = storage.getExpirationConfiguration(threadId);
|
ExpirationConfiguration config = storage.getExpirationConfiguration(threadId);
|
||||||
ExpiryMode expiryMode = config == null ? null : config.getExpiryMode();
|
ExpiryMode expiryMode = config == null ? null : config.getExpiryMode();
|
||||||
@ -124,7 +128,7 @@ public class RemoteReplyReceiver extends BroadcastReceiver {
|
|||||||
|
|
||||||
List<MarkedMessageInfo> messageIds = threadDatabase.setRead(threadId, true);
|
List<MarkedMessageInfo> messageIds = threadDatabase.setRead(threadId, true);
|
||||||
|
|
||||||
ApplicationContext.getInstance(context).messageNotifier.updateNotification(context);
|
messageNotifier.updateNotification(context);
|
||||||
MarkReadReceiver.process(context, messageIds);
|
MarkReadReceiver.process(context, messageIds);
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package org.thoughtcrime.securesms.service
|
package org.thoughtcrime.securesms.service
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
|
import dagger.Lazy
|
||||||
import dagger.hilt.android.qualifiers.ApplicationContext
|
import dagger.hilt.android.qualifiers.ApplicationContext
|
||||||
import network.loki.messenger.libsession_util.util.ExpiryMode
|
import network.loki.messenger.libsession_util.util.ExpiryMode
|
||||||
import network.loki.messenger.libsession_util.util.ExpiryMode.AfterSend
|
import network.loki.messenger.libsession_util.util.ExpiryMode.AfterSend
|
||||||
@ -13,7 +14,7 @@ import org.session.libsession.utilities.Address.Companion.fromSerialized
|
|||||||
import org.session.libsession.utilities.GroupUtil
|
import org.session.libsession.utilities.GroupUtil
|
||||||
import org.session.libsession.utilities.GroupUtil.doubleEncodeGroupID
|
import org.session.libsession.utilities.GroupUtil.doubleEncodeGroupID
|
||||||
import org.session.libsession.utilities.SSKEnvironment.MessageExpirationManagerProtocol
|
import org.session.libsession.utilities.SSKEnvironment.MessageExpirationManagerProtocol
|
||||||
import org.session.libsession.utilities.TextSecurePreferences.Companion.getLocalNumber
|
import org.session.libsession.utilities.TextSecurePreferences
|
||||||
import org.session.libsession.utilities.recipients.Recipient
|
import org.session.libsession.utilities.recipients.Recipient
|
||||||
import org.session.libsignal.messages.SignalServiceGroup
|
import org.session.libsignal.messages.SignalServiceGroup
|
||||||
import org.session.libsignal.utilities.Hex
|
import org.session.libsignal.utilities.Hex
|
||||||
@ -41,7 +42,8 @@ class ExpiringMessageManager @Inject constructor(
|
|||||||
private val mmsDatabase: MmsDatabase,
|
private val mmsDatabase: MmsDatabase,
|
||||||
private val mmsSmsDatabase: MmsSmsDatabase,
|
private val mmsSmsDatabase: MmsSmsDatabase,
|
||||||
private val clock: SnodeClock,
|
private val clock: SnodeClock,
|
||||||
private val storage: Storage,
|
private val storage: Lazy<Storage>,
|
||||||
|
private val preferences: TextSecurePreferences,
|
||||||
) : MessageExpirationManagerProtocol {
|
) : MessageExpirationManagerProtocol {
|
||||||
private val expiringMessageReferences = TreeSet<ExpiringMessageReference>()
|
private val expiringMessageReferences = TreeSet<ExpiringMessageReference>()
|
||||||
private val executor: Executor = Executors.newSingleThreadExecutor()
|
private val executor: Executor = Executors.newSingleThreadExecutor()
|
||||||
@ -97,7 +99,7 @@ class ExpiringMessageManager @Inject constructor(
|
|||||||
}
|
}
|
||||||
recipient = Recipient.from(context, groupAddress, false)
|
recipient = Recipient.from(context, groupAddress, false)
|
||||||
}
|
}
|
||||||
val threadId = storage.getThreadId(recipient) ?: return
|
val threadId = storage.get().getThreadId(recipient) ?: return
|
||||||
val mediaMessage = IncomingMediaMessage(
|
val mediaMessage = IncomingMediaMessage(
|
||||||
address, sentTimestamp!!, -1,
|
address, sentTimestamp!!, -1,
|
||||||
expiresInMillis, expireStartedAt, true,
|
expiresInMillis, expireStartedAt, true,
|
||||||
@ -137,7 +139,7 @@ class ExpiringMessageManager @Inject constructor(
|
|||||||
val address = fromSerialized(serializedAddress)
|
val address = fromSerialized(serializedAddress)
|
||||||
val recipient = Recipient.from(context, address, false)
|
val recipient = Recipient.from(context, address, false)
|
||||||
|
|
||||||
message.threadID = storage.getOrCreateThreadIdFor(address)
|
message.threadID = storage.get().getOrCreateThreadIdFor(address)
|
||||||
val timerUpdateMessage = OutgoingExpirationUpdateMessage(
|
val timerUpdateMessage = OutgoingExpirationUpdateMessage(
|
||||||
recipient,
|
recipient,
|
||||||
sentTimestamp!!,
|
sentTimestamp!!,
|
||||||
@ -161,7 +163,7 @@ class ExpiringMessageManager @Inject constructor(
|
|||||||
override fun insertExpirationTimerMessage(message: ExpirationTimerUpdate) {
|
override fun insertExpirationTimerMessage(message: ExpirationTimerUpdate) {
|
||||||
val expiryMode: ExpiryMode = message.expiryMode
|
val expiryMode: ExpiryMode = message.expiryMode
|
||||||
|
|
||||||
val userPublicKey = getLocalNumber(context)
|
val userPublicKey = preferences.getLocalNumber()
|
||||||
val senderPublicKey = message.sender
|
val senderPublicKey = message.sender
|
||||||
val sentTimestamp = message.sentTimestamp ?: 0
|
val sentTimestamp = message.sentTimestamp ?: 0
|
||||||
val expireStartedAt = if ((expiryMode is AfterSend || message.isSenderSelf) && !message.isGroup) sentTimestamp else 0
|
val expireStartedAt = if ((expiryMode is AfterSend || message.isSenderSelf) && !message.isGroup) sentTimestamp else 0
|
||||||
|
@ -127,7 +127,7 @@ public class KeyCachingService extends Service {
|
|||||||
@Override
|
@Override
|
||||||
protected Void doInBackground(Void... params) {
|
protected Void doInBackground(Void... params) {
|
||||||
if (!DatabaseUpgradeActivity.isUpdate(KeyCachingService.this)) {
|
if (!DatabaseUpgradeActivity.isUpdate(KeyCachingService.this)) {
|
||||||
ApplicationContext.getInstance(KeyCachingService.this).messageNotifier.updateNotification(KeyCachingService.this);
|
ApplicationContext.getInstance(KeyCachingService.this).getMessageNotifier().updateNotification(KeyCachingService.this);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -193,7 +193,7 @@ public class KeyCachingService extends Service {
|
|||||||
new AsyncTask<Void, Void, Void>() {
|
new AsyncTask<Void, Void, Void>() {
|
||||||
@Override
|
@Override
|
||||||
protected Void doInBackground(Void... params) {
|
protected Void doInBackground(Void... params) {
|
||||||
ApplicationContext.getInstance(KeyCachingService.this).messageNotifier.updateNotification(KeyCachingService.this);
|
ApplicationContext.getInstance(KeyCachingService.this).getMessageNotifier().updateNotification(KeyCachingService.this);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package org.thoughtcrime.securesms.sskenvironment
|
package org.thoughtcrime.securesms.sskenvironment
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
|
import dagger.Lazy
|
||||||
import network.loki.messenger.libsession_util.util.UserPic
|
import network.loki.messenger.libsession_util.util.UserPic
|
||||||
import org.session.libsession.database.StorageProtocol
|
import org.session.libsession.database.StorageProtocol
|
||||||
import org.session.libsession.messaging.contacts.Contact
|
import org.session.libsession.messaging.contacts.Contact
|
||||||
@ -21,7 +22,7 @@ import javax.inject.Singleton
|
|||||||
@Singleton
|
@Singleton
|
||||||
class ProfileManager @Inject constructor(
|
class ProfileManager @Inject constructor(
|
||||||
private val configFactory: ConfigFactoryProtocol,
|
private val configFactory: ConfigFactoryProtocol,
|
||||||
private val storage: StorageProtocol,
|
private val storage: Lazy<StorageProtocol>,
|
||||||
private val contactDatabase: SessionContactDatabase,
|
private val contactDatabase: SessionContactDatabase,
|
||||||
private val recipientDatabase: RecipientDatabase,
|
private val recipientDatabase: RecipientDatabase,
|
||||||
private val jobDatabase: SessionJobDatabase,
|
private val jobDatabase: SessionJobDatabase,
|
||||||
@ -33,7 +34,7 @@ class ProfileManager @Inject constructor(
|
|||||||
val accountID = recipient.address.serialize()
|
val accountID = recipient.address.serialize()
|
||||||
var contact = contactDatabase.getContactWithAccountID(accountID)
|
var contact = contactDatabase.getContactWithAccountID(accountID)
|
||||||
if (contact == null) contact = Contact(accountID)
|
if (contact == null) contact = Contact(accountID)
|
||||||
contact.threadID = storage.getThreadId(recipient.address)
|
contact.threadID = storage.get().getThreadId(recipient.address)
|
||||||
if (contact.nickname != nickname) {
|
if (contact.nickname != nickname) {
|
||||||
contact.nickname = nickname
|
contact.nickname = nickname
|
||||||
contactDatabase.setContact(contact)
|
contactDatabase.setContact(contact)
|
||||||
@ -47,7 +48,7 @@ class ProfileManager @Inject constructor(
|
|||||||
val accountID = recipient.address.serialize()
|
val accountID = recipient.address.serialize()
|
||||||
var contact = contactDatabase.getContactWithAccountID(accountID)
|
var contact = contactDatabase.getContactWithAccountID(accountID)
|
||||||
if (contact == null) contact = Contact(accountID)
|
if (contact == null) contact = Contact(accountID)
|
||||||
contact.threadID = storage.getThreadId(recipient.address)
|
contact.threadID = storage.get().getThreadId(recipient.address)
|
||||||
if (contact.name != name) {
|
if (contact.name != name) {
|
||||||
contact.name = name
|
contact.name = name
|
||||||
contactDatabase.setContact(contact)
|
contactDatabase.setContact(contact)
|
||||||
@ -69,7 +70,7 @@ class ProfileManager @Inject constructor(
|
|||||||
(it.value as? RetrieveProfileAvatarJob)?.recipientAddress == recipient.address
|
(it.value as? RetrieveProfileAvatarJob)?.recipientAddress == recipient.address
|
||||||
}
|
}
|
||||||
val resolved = recipient.resolve()
|
val resolved = recipient.resolve()
|
||||||
storage.setProfilePicture(
|
storage.get().setProfilePicture(
|
||||||
recipient = resolved,
|
recipient = resolved,
|
||||||
newProfileKey = profileKey,
|
newProfileKey = profileKey,
|
||||||
newProfilePicture = profilePictureURL
|
newProfilePicture = profilePictureURL
|
||||||
@ -77,7 +78,7 @@ class ProfileManager @Inject constructor(
|
|||||||
val accountID = recipient.address.serialize()
|
val accountID = recipient.address.serialize()
|
||||||
var contact = contactDatabase.getContactWithAccountID(accountID)
|
var contact = contactDatabase.getContactWithAccountID(accountID)
|
||||||
if (contact == null) contact = Contact(accountID)
|
if (contact == null) contact = Contact(accountID)
|
||||||
contact.threadID = storage.getThreadId(recipient.address)
|
contact.threadID = storage.get().getThreadId(recipient.address)
|
||||||
if (!contact.profilePictureEncryptionKey.contentEquals(profileKey) || contact.profilePictureURL != profilePictureURL) {
|
if (!contact.profilePictureEncryptionKey.contentEquals(profileKey) || contact.profilePictureURL != profilePictureURL) {
|
||||||
contact.profilePictureEncryptionKey = profileKey
|
contact.profilePictureEncryptionKey = profileKey
|
||||||
contact.profilePictureURL = profilePictureURL
|
contact.profilePictureURL = profilePictureURL
|
||||||
|
@ -28,6 +28,7 @@ class MessagingModuleConfiguration(
|
|||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
|
@Deprecated("Use properly DI components instead")
|
||||||
val shared: MessagingModuleConfiguration
|
val shared: MessagingModuleConfiguration
|
||||||
get() = context.getSystemService(MESSAGING_MODULE_SERVICE) as MessagingModuleConfiguration
|
get() = context.getSystemService(MESSAGING_MODULE_SERVICE) as MessagingModuleConfiguration
|
||||||
|
|
||||||
|
@ -8,6 +8,7 @@ class SnodeModule(
|
|||||||
) {
|
) {
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
@Deprecated("Use properly DI components instead")
|
||||||
lateinit var shared: SnodeModule
|
lateinit var shared: SnodeModule
|
||||||
|
|
||||||
val isInitialized: Boolean get() = Companion::shared.isInitialized
|
val isInitialized: Boolean get() = Companion::shared.isInitialized
|
||||||
|
Loading…
Reference in New Issue
Block a user