mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-27 12:05:22 +00:00
Default expiration timer value to zero
This commit is contained in:
parent
1ad10a4ac7
commit
4b66e0516d
@ -87,7 +87,8 @@ class ExpirationSettingsViewModel(
|
||||
val expiresIn = _selectedExpirationTimer.value?.value?.toIntOrNull() ?: 0
|
||||
val expiryType = _selectedExpirationType.value
|
||||
val expiryChangeTimestampMs = System.currentTimeMillis()
|
||||
storage.addExpirationConfiguration(ExpirationConfiguration(threadId, expiresIn, expiryType, expiryChangeTimestampMs))
|
||||
storage.setExpirationConfiguration(ExpirationConfiguration(threadId, expiresIn, expiryType, expiryChangeTimestampMs))
|
||||
|
||||
}
|
||||
|
||||
@dagger.assisted.AssistedFactory
|
||||
|
@ -932,10 +932,6 @@ class ConversationActivityV2 : PassphraseRequiredActionBarActivity(), InputBarDe
|
||||
if (item.itemId == android.R.id.home) {
|
||||
return false
|
||||
}
|
||||
else if (item.itemId == R.id.menu_overflow) {
|
||||
binding?.toolbar?.showOverflowMenu()
|
||||
return false
|
||||
}
|
||||
return viewModel.recipient?.let { recipient ->
|
||||
ConversationMenuHelper.onOptionItemSelected(this, item, recipient)
|
||||
} ?: false
|
||||
|
@ -58,8 +58,8 @@ object ConversationMenuHelper {
|
||||
if (thread.isGroupRecipient) {
|
||||
item.setIcon(R.drawable.ic_outline_settings_24)
|
||||
} else {
|
||||
item.setActionView(R.layout.view_profile_overflow)
|
||||
item.actionView.setOnClickListener { onOptionsItemSelected(item) }
|
||||
/*TODO: item.setActionView(R.layout.view_profile_overflow)
|
||||
item.actionView.setOnClickListener { onOptionsItemSelected(item) }*/
|
||||
}
|
||||
val menu = item.subMenu
|
||||
// Expiring messages
|
||||
|
@ -971,7 +971,7 @@ class Storage(context: Context, helper: SQLCipherOpenHelper) : Database(context,
|
||||
return DatabaseComponent.get(context).expirationConfigurationDatabase().getExpirationConfiguration(threadId)
|
||||
}
|
||||
|
||||
override fun addExpirationConfiguration(config: ExpirationConfiguration) {
|
||||
override fun setExpirationConfiguration(config: ExpirationConfiguration) {
|
||||
DatabaseComponent.get(context).expirationConfigurationDatabase().setExpirationConfiguration(config)
|
||||
}
|
||||
|
||||
|
@ -200,7 +200,7 @@ interface StorageProtocol {
|
||||
fun unblock(toUnblock: List<Recipient>)
|
||||
fun blockedContacts(): List<Recipient>
|
||||
fun getExpirationConfiguration(threadId: Long): ExpirationConfiguration?
|
||||
fun addExpirationConfiguration(config: ExpirationConfiguration)
|
||||
fun setExpirationConfiguration(config: ExpirationConfiguration)
|
||||
fun getExpiringMessages(messageIds: LongArray): List<Pair<String, Int>>
|
||||
fun updateDisappearingState(address: String, disappearingState: Recipient.DisappearingState)
|
||||
}
|
||||
|
@ -40,8 +40,11 @@ abstract class Message {
|
||||
}
|
||||
|
||||
fun setExpirationConfigurationIfNeeded(builder: SignalServiceProtos.Content.Builder) {
|
||||
val threadId = threadID ?: return
|
||||
val config = MessagingModuleConfiguration.shared.storage.getExpirationConfiguration(threadId) ?: return
|
||||
val config = threadID?.let { MessagingModuleConfiguration.shared.storage.getExpirationConfiguration(it) }
|
||||
?: run {
|
||||
builder.expirationTimer = 0
|
||||
return
|
||||
}
|
||||
builder.expirationTimer = config.durationSeconds
|
||||
if (config.isEnabled) {
|
||||
builder.expirationType = config.expirationType
|
||||
|
@ -101,7 +101,7 @@ fun updateExpirationConfigurationIfNeeded(message: Message, proto: SignalService
|
||||
type,
|
||||
proto.lastDisappearingMessageChangeTimestamp
|
||||
)
|
||||
storage.addExpirationConfiguration(remoteConfig)
|
||||
storage.setExpirationConfiguration(remoteConfig)
|
||||
}
|
||||
|
||||
// region Control Messages
|
||||
|
Loading…
Reference in New Issue
Block a user