mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-27 20:15:21 +00:00
fix: issue for overwriting local config with an outdated user config merge
This commit is contained in:
parent
8db92cc55c
commit
2e3d50364c
@ -25,6 +25,7 @@ import org.thoughtcrime.securesms.database.RecipientDatabase
|
||||
import org.thoughtcrime.securesms.database.ThreadDatabase
|
||||
import org.thoughtcrime.securesms.preferences.RadioOption
|
||||
import org.thoughtcrime.securesms.preferences.RadioOptionAdapter
|
||||
import org.thoughtcrime.securesms.util.ConfigurationMessageUtilities
|
||||
import javax.inject.Inject
|
||||
import kotlin.math.max
|
||||
|
||||
@ -116,10 +117,9 @@ class ExpirationSettingsActivity: PassphraseRequiredActionBarActivity() {
|
||||
viewModel.uiState.collect { uiState ->
|
||||
when (uiState.settingsSaved) {
|
||||
true -> {
|
||||
showToast(getString(R.string.ExpirationSettingsActivity_settings_updated))
|
||||
ConfigurationMessageUtilities.forceSyncConfigurationNowIfNeeded(this@ExpirationSettingsActivity)
|
||||
finish()
|
||||
}
|
||||
|
||||
false -> showToast(getString(R.string.ExpirationSettingsActivity_settings_not_updated))
|
||||
else -> {}
|
||||
}
|
||||
|
@ -540,6 +540,9 @@ class ConversationActivityV2 : PassphraseRequiredActionBarActivity(), InputBarDe
|
||||
}
|
||||
}
|
||||
updatePlaceholder()
|
||||
viewModel.recipient?.let {
|
||||
maybeUpdateToolbar(recipient = it)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onLoaderReset(cursor: Loader<Cursor>) {
|
||||
@ -859,6 +862,7 @@ class ConversationActivityV2 : PassphraseRequiredActionBarActivity(), InputBarDe
|
||||
|
||||
private fun isMessageRequestThread(): Boolean {
|
||||
val recipient = viewModel.recipient ?: return false
|
||||
if (recipient.isLocalNumber) return false
|
||||
return !recipient.isGroupRecipient && !recipient.isApproved
|
||||
}
|
||||
|
||||
|
@ -486,10 +486,16 @@ open class Storage(context: Context, helper: SQLCipherOpenHelper, private val co
|
||||
setPinned(ourThread, userProfile.getNtsPriority() > 0)
|
||||
}
|
||||
|
||||
// Set or reset the shared library to use latest expiration config
|
||||
getThreadId(recipient)?.let { ourThread ->
|
||||
val currentExpiration = getExpirationConfiguration(ourThread)
|
||||
if (currentExpiration != null && currentExpiration.updatedTimestampMs > messageTimestamp) {
|
||||
setExpirationConfiguration(currentExpiration)
|
||||
} else {
|
||||
val expiration = ExpirationConfiguration(ourThread, userProfile.getNtsExpiry(), messageTimestamp)
|
||||
DatabaseComponent.get(context).expirationConfigurationDatabase().setExpirationConfiguration(expiration)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -622,6 +628,11 @@ open class Storage(context: Context, helper: SQLCipherOpenHelper, private val co
|
||||
ClosedGroupPollerV2.shared.startPolling(group.sessionId)
|
||||
}
|
||||
getThreadId(Address.fromSerialized(groupId))?.let { conversationThreadId ->
|
||||
|
||||
val currentExpiration = getExpirationConfiguration(conversationThreadId)
|
||||
if (currentExpiration != null && currentExpiration.updatedTimestampMs > messageTimestamp) {
|
||||
setExpirationConfiguration(currentExpiration)
|
||||
} else {
|
||||
val mode =
|
||||
if (group.disappearingTimer == 0L) ExpiryMode.NONE
|
||||
else ExpiryMode.AfterRead(group.disappearingTimer)
|
||||
@ -634,6 +645,7 @@ open class Storage(context: Context, helper: SQLCipherOpenHelper, private val co
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun setAuthToken(room: String, server: String, newValue: String) {
|
||||
val id = "$server.$room"
|
||||
@ -1221,6 +1233,10 @@ open class Storage(context: Context, helper: SQLCipherOpenHelper, private val co
|
||||
}
|
||||
}
|
||||
getThreadId(recipient)?.let { conversationThreadId ->
|
||||
val currentExpiration = getExpirationConfiguration(conversationThreadId)
|
||||
if (currentExpiration != null && currentExpiration.updatedTimestampMs > timestamp) {
|
||||
setExpirationConfiguration(currentExpiration)
|
||||
} else {
|
||||
val expiration = ExpirationConfiguration(
|
||||
conversationThreadId,
|
||||
contact.expiryMode,
|
||||
@ -1229,6 +1245,7 @@ open class Storage(context: Context, helper: SQLCipherOpenHelper, private val co
|
||||
DatabaseComponent.get(context).expirationConfigurationDatabase()
|
||||
.setExpirationConfiguration(expiration)
|
||||
}
|
||||
}
|
||||
setRecipientHash(recipient, contact.hashCode().toString())
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user