mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-25 11:05:25 +00:00
fix: force has sent for local user, only prevent setting last seen for open group recipients, allow empty user pics to trigger config sync in settings
This commit is contained in:
parent
4cbf1bc337
commit
4f534d5a1e
@ -248,6 +248,10 @@ class ConversationActivityV2 : PassphraseRequiredActionBarActivity(), InputBarDe
|
|||||||
// assume created thread
|
// assume created thread
|
||||||
if (recipient.isContactRecipient && !recipient.isLocalNumber) {
|
if (recipient.isContactRecipient && !recipient.isLocalNumber) {
|
||||||
storage.setRecipientApproved(recipient, true) // assume approved when we CREATE the thread, not send first message
|
storage.setRecipientApproved(recipient, true) // assume approved when we CREATE the thread, not send first message
|
||||||
|
} else if (recipient.isLocalNumber) {
|
||||||
|
// this gets around the filtering of unapproved / unsent threads
|
||||||
|
// since the sql query would have to take into account whether address == local user address
|
||||||
|
threadDb.setHasSent(threadId, true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} ?: finish()
|
} ?: finish()
|
||||||
|
@ -182,8 +182,9 @@ open class Storage(context: Context, helper: SQLCipherOpenHelper, private val co
|
|||||||
val ourRecipient = fromSerialized(getUserPublicKey()!!).let {
|
val ourRecipient = fromSerialized(getUserPublicKey()!!).let {
|
||||||
Recipient.from(context, it, false)
|
Recipient.from(context, it, false)
|
||||||
}
|
}
|
||||||
TextSecurePreferences.setProfilePictureURL(context, newProfilePicture)
|
ourRecipient.resolve().profileKey = newProfileKey
|
||||||
TextSecurePreferences.setProfileKey(context, newProfileKey?.let { Base64.encodeBytes(it) })
|
TextSecurePreferences.setProfileKey(context, newProfileKey?.let { Base64.encodeBytes(it) })
|
||||||
|
TextSecurePreferences.setProfilePictureURL(context, newProfilePicture)
|
||||||
ApplicationContext.getInstance(context).jobManager.add(RetrieveProfileAvatarJob(ourRecipient, newProfilePicture))
|
ApplicationContext.getInstance(context).jobManager.add(RetrieveProfileAvatarJob(ourRecipient, newProfilePicture))
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -437,6 +438,7 @@ open class Storage(context: Context, helper: SQLCipherOpenHelper, private val co
|
|||||||
} else {
|
} else {
|
||||||
// create note to self thread if needed (?)
|
// create note to self thread if needed (?)
|
||||||
val ourThread = getOrCreateThreadIdFor(recipient.address)
|
val ourThread = getOrCreateThreadIdFor(recipient.address)
|
||||||
|
DatabaseComponent.get(context).threadDatabase().setHasSent(ourThread, true)
|
||||||
setPinned(ourThread, userProfile.getNtsPriority() > 0)
|
setPinned(ourThread, userProfile.getNtsPriority() > 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1008,7 +1010,10 @@ open class Storage(context: Context, helper: SQLCipherOpenHelper, private val co
|
|||||||
val communityInfo = groups.getOrConstructCommunityInfo(infoServer, infoRoom, pubKeyHex)
|
val communityInfo = groups.getOrConstructCommunityInfo(infoServer, infoRoom, pubKeyHex)
|
||||||
groups.set(communityInfo)
|
groups.set(communityInfo)
|
||||||
val volatile = volatileConfig.getOrConstructCommunity(infoServer, infoRoom, pubKey)
|
val volatile = volatileConfig.getOrConstructCommunity(infoServer, infoRoom, pubKey)
|
||||||
volatileConfig.set(volatile.copy(lastRead = 0))
|
if (volatile.lastRead != 0L) {
|
||||||
|
val threadId = getThreadId(openGroup) ?: return
|
||||||
|
markConversationAsRead(threadId, volatile.lastRead)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun hasBackgroundGroupAddJob(groupJoinUrl: String): Boolean {
|
override fun hasBackgroundGroupAddJob(groupJoinUrl: String): Boolean {
|
||||||
|
@ -539,7 +539,8 @@ public class ThreadDatabase extends Database {
|
|||||||
public boolean setLastSeen(long threadId, long timestamp) {
|
public boolean setLastSeen(long threadId, long timestamp) {
|
||||||
// edge case where we set the last seen time for a conversation before it loads messages (joining community for example)
|
// edge case where we set the last seen time for a conversation before it loads messages (joining community for example)
|
||||||
MmsSmsDatabase mmsSmsDatabase = DatabaseComponent.get(context).mmsSmsDatabase();
|
MmsSmsDatabase mmsSmsDatabase = DatabaseComponent.get(context).mmsSmsDatabase();
|
||||||
if (mmsSmsDatabase.getConversationCount(threadId) <= 0) return false;
|
Recipient forThreadId = getRecipientForThreadId(threadId);
|
||||||
|
if (mmsSmsDatabase.getConversationCount(threadId) <= 0 && forThreadId != null && forThreadId.isOpenGroupRecipient()) return false;
|
||||||
|
|
||||||
SQLiteDatabase db = databaseHelper.getWritableDatabase();
|
SQLiteDatabase db = databaseHelper.getWritableDatabase();
|
||||||
|
|
||||||
|
@ -2,7 +2,10 @@ package org.thoughtcrime.securesms.preferences
|
|||||||
|
|
||||||
import android.Manifest
|
import android.Manifest
|
||||||
import android.app.Activity
|
import android.app.Activity
|
||||||
import android.content.*
|
import android.content.ClipData
|
||||||
|
import android.content.ClipboardManager
|
||||||
|
import android.content.Context
|
||||||
|
import android.content.Intent
|
||||||
import android.net.Uri
|
import android.net.Uri
|
||||||
import android.os.AsyncTask
|
import android.os.AsyncTask
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
@ -232,16 +235,16 @@ class SettingsActivity : PassphraseRequiredActionBarActivity() {
|
|||||||
// new config
|
// new config
|
||||||
val url = TextSecurePreferences.getProfilePictureURL(this)
|
val url = TextSecurePreferences.getProfilePictureURL(this)
|
||||||
val profileKey = ProfileKeyUtil.getProfileKey(this)
|
val profileKey = ProfileKeyUtil.getProfileKey(this)
|
||||||
if (!url.isNullOrEmpty() && profileKey.isNotEmpty()) {
|
if (profilePicture == null) {
|
||||||
|
userConfig?.setPic(UserPic.DEFAULT)
|
||||||
|
} else if (!url.isNullOrEmpty() && profileKey.isNotEmpty()) {
|
||||||
userConfig?.setPic(UserPic(url, profileKey))
|
userConfig?.setPic(UserPic(url, profileKey))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (profilePicture != null || displayName != null) {
|
if (userConfig != null && userConfig.needsDump()) {
|
||||||
if (userConfig != null && userConfig.needsDump()) {
|
configFactory.persist(userConfig)
|
||||||
configFactory.persist(userConfig)
|
|
||||||
}
|
|
||||||
ConfigurationMessageUtilities.forceSyncConfigurationNowIfNeeded(this@SettingsActivity)
|
|
||||||
}
|
}
|
||||||
|
ConfigurationMessageUtilities.forceSyncConfigurationNowIfNeeded(this@SettingsActivity)
|
||||||
}
|
}
|
||||||
compoundPromise.alwaysUi {
|
compoundPromise.alwaysUi {
|
||||||
if (displayName != null) {
|
if (displayName != null) {
|
||||||
|
Loading…
Reference in New Issue
Block a user