diff --git a/app/src/main/java/org/thoughtcrime/securesms/conversation/expiration/ExpirationSettingsViewModel.kt b/app/src/main/java/org/thoughtcrime/securesms/conversation/expiration/ExpirationSettingsViewModel.kt index ca0fa267b3..ec2ba8c1ea 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/conversation/expiration/ExpirationSettingsViewModel.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/conversation/expiration/ExpirationSettingsViewModel.kt @@ -29,8 +29,8 @@ import kotlin.reflect.KClass class ExpirationSettingsViewModel( private val threadId: Long, - private val afterReadOptions: List>, - private val afterSendOptions: List>, + private val afterReadOptions: List, + private val afterSendOptions: List, private val textSecurePreferences: TextSecurePreferences, private val messageExpirationManager: MessageExpirationManagerProtocol, private val threadDb: ThreadDatabase, @@ -93,11 +93,11 @@ class ExpirationSettingsViewModel( }.onEach { options -> val enabled = _uiState.value.isSelfAdmin || recipient.value?.isClosedGroupRecipient == true _expirationTimerOptions.value = if (ExpirationConfiguration.isNewConfigEnabled && (recipient.value?.isLocalNumber == true || recipient.value?.isClosedGroupRecipient == true)) { - options.filterIsInstance().map { + options.map { it.copy(enabled = enabled) } } else { - options.slice(1 until options.size).filterIsInstance().map { + options.slice(1 until options.size).map { it.copy(enabled = enabled) } } diff --git a/app/src/main/java/org/thoughtcrime/securesms/preferences/RadioOptionAdapter.kt b/app/src/main/java/org/thoughtcrime/securesms/preferences/RadioOptionAdapter.kt index cb98876fb1..d4c4f77716 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/preferences/RadioOptionAdapter.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/preferences/RadioOptionAdapter.kt @@ -68,7 +68,7 @@ class RadioOptionAdapter( } -sealed class RadioOption( +data class RadioOption( val value: T, val title: String, val subtitle: String? = null, @@ -76,35 +76,5 @@ sealed class RadioOption( val contentDescription: String = "" ) -class StringRadioOption(value: String, - title: String, - subtitle: String? = null, - enabled: Boolean = true, - contentDescription: String = ""): RadioOption( - value, - title, - subtitle, - enabled, - contentDescription -) - -class ExpirationRadioOption( - value: ExpiryMode, - title: String, - subtitle: String? = null, - enabled: Boolean = true, - contentDescription: String = "" -): RadioOption( - value, - title, - subtitle, - enabled, - contentDescription -) { - fun copy(value: ExpiryMode = this.value, - title: String = this.title, - subtitle: String? = this.subtitle, - enabled: Boolean = this.enabled, - contentDescription: String = this.contentDescription) = - ExpirationRadioOption(value, title, subtitle, enabled, contentDescription) -} +typealias StringRadioOption = RadioOption +typealias ExpirationRadioOption = RadioOption