Merge remote-tracking branch 'refs/remotes/origin/disappear-2' into disappear-2

This commit is contained in:
Andrew 2024-01-19 16:05:27 +10:00
commit e2e5a36f51
3 changed files with 24 additions and 6 deletions

View File

@ -537,6 +537,7 @@ class ConversationActivityV2 : PassphraseRequiredActionBarActivity(), InputBarDe
updatePlaceholder()
viewModel.recipient?.let {
maybeUpdateToolbar(recipient = it)
setUpOutdatedClientBanner()
}
}
@ -697,12 +698,14 @@ class ConversationActivityV2 : PassphraseRequiredActionBarActivity(), InputBarDe
private fun setUpOutdatedClientBanner() {
val legacyRecipient = viewModel.legacyBannerRecipient(this)
if (ExpirationConfiguration.isNewConfigEnabled &&
val shouldShowLegacy = ExpirationConfiguration.isNewConfigEnabled &&
legacyRecipient != null
) {
binding?.outdatedBanner?.isVisible = shouldShowLegacy
if (shouldShowLegacy) {
binding?.outdatedBannerTextView?.text =
resources.getString(R.string.activity_conversation_outdated_client_banner_text, legacyRecipient.name)
binding?.outdatedBanner?.isVisible = true
resources.getString(R.string.activity_conversation_outdated_client_banner_text, legacyRecipient!!.name)
}
}

View File

@ -30,7 +30,6 @@ import org.session.libsession.messaging.jobs.MessageSendJob
import org.session.libsession.messaging.jobs.RetrieveProfileAvatarJob
import org.session.libsession.messaging.messages.Destination
import org.session.libsession.messaging.messages.ExpirationConfiguration
import org.session.libsession.messaging.messages.ExpirationConfiguration.Companion.isNewConfigEnabled
import org.session.libsession.messaging.messages.Message
import org.session.libsession.messaging.messages.control.ConfigurationMessage
import org.session.libsession.messaging.messages.control.MessageRequestResponse
@ -1733,6 +1732,11 @@ open class Storage(
if (currentConfig != null && currentConfig.updatedTimestampMs >= config.updatedTimestampMs) return
val expiryMode = config.expiryMode
if (expiryMode == ExpiryMode.NONE) {
// Clear the legacy recipients on updating config to be none
DatabaseComponent.get(context).lokiAPIDatabase().setLastLegacySenderAddress(recipient.address.serialize(), null)
}
if (recipient.isClosedGroupRecipient) {
val userGroups = configFactory.userGroups ?: return
val groupPublicKey = GroupUtil.addressToGroupSessionId(recipient.address)

View File

@ -335,6 +335,17 @@ fun MessageReceiver.handleVisibleMessage(
if (userPublicKey != messageSender && !isUserBlindedSender) {
storage.setBlocksCommunityMessageRequests(recipient, message.blocksMessageRequests)
}
// update the disappearing / legacy banner for the sender
val disappearingState = when {
proto.dataMessage.expireTimer > 0 && !proto.hasExpirationType() -> Recipient.DisappearingState.LEGACY
else -> Recipient.DisappearingState.UPDATED
}
storage.updateDisappearingState(
messageSender,
threadID,
disappearingState
)
}
// Parse quote if needed
var quoteModel: QuoteModel? = null