fix: legacy message deletions working better now

This commit is contained in:
0x330a
2023-01-11 17:25:38 +11:00
parent b6a4fb9024
commit 2048e08c86
4 changed files with 11 additions and 7 deletions

View File

@@ -77,7 +77,7 @@ class ExpirationSettingsViewModel(
expirationConfig?.expirationTypeValue?.let { 0 /* Legacy */ } ?: -1
}
_selectedExpirationTimer.value = when(expirationConfig?.expirationType) {
ExpirationType.DELETE_AFTER_SEND -> afterSendOptions.find { it.value.toIntOrNull() == expirationConfig?.durationSeconds }
null, ExpirationType.DELETE_AFTER_SEND -> afterSendOptions.find { it.value.toIntOrNull() == expirationConfig?.durationSeconds }
ExpirationType.DELETE_AFTER_READ -> afterReadOptions.find { it.value.toIntOrNull() == expirationConfig?.durationSeconds }
else -> afterSendOptions.firstOrNull()
}
@@ -107,7 +107,11 @@ class ExpirationSettingsViewModel(
}
fun onSetClick() = viewModelScope.launch {
val expiryType = _selectedExpirationType.value
var typeValue = _selectedExpirationType.value
if (typeValue == 0) {
typeValue = ExpirationType.DELETE_AFTER_READ_VALUE
}
val expiryType = typeValue
val expirationTimer = _selectedExpirationTimer.value?.value?.toIntOrNull() ?: 0
val address = recipient.value?.address
if (address == null || (expirationConfig?.expirationTypeValue == expiryType && expirationConfig?.durationSeconds == expirationTimer)) {

View File

@@ -363,7 +363,7 @@ class ConversationActivityV2 : PassphraseRequiredActionBarActivity(), InputBarDe
setUpRecipientObserver()
getLatestOpenGroupInfoIfNeeded()
setUpBlockedBanner()
setUpOutdatedClientBanner();
setUpOutdatedClientBanner()
binding!!.searchBottomBar.setEventListener(this)
setUpSearchResultObserver()
scrollToFirstUnreadMessageIfNeeded()