mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-23 18:15:22 +00:00
Rename ExpirationSettings to DisappearingMessages
This commit is contained in:
parent
d92e798618
commit
b211c8bffb
@ -176,7 +176,7 @@
|
||||
android:screenOrientation="portrait" />
|
||||
<activity android:name="org.thoughtcrime.securesms.preferences.appearance.AppearanceSettingsActivity"
|
||||
android:screenOrientation="portrait"/>
|
||||
<activity android:name="org.thoughtcrime.securesms.conversation.expiration.ExpirationSettingsActivity"
|
||||
<activity android:name="org.thoughtcrime.securesms.conversation.disappearingmessages.DisappearingMessagesActivity"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/Theme.Session.DayNight.NoActionBar" />
|
||||
|
||||
|
@ -41,7 +41,7 @@ class ConversationActionBarView : LinearLayout {
|
||||
|
||||
private val settingsAdapter = ConversationSettingsAdapter { setting ->
|
||||
if (setting.settingType == ConversationSettingType.EXPIRATION) {
|
||||
delegate?.onExpirationSettingClicked()
|
||||
delegate?.onDisappearingMessagesClicked()
|
||||
}
|
||||
}
|
||||
|
||||
@ -202,7 +202,7 @@ class ConversationActionBarView : LinearLayout {
|
||||
|
||||
|
||||
fun interface ConversationActionBarDelegate {
|
||||
fun onExpirationSettingClicked()
|
||||
fun onDisappearingMessagesClicked()
|
||||
}
|
||||
|
||||
data class ConversationSetting(
|
||||
|
@ -1,4 +1,4 @@
|
||||
package org.thoughtcrime.securesms.conversation.expiration
|
||||
package org.thoughtcrime.securesms.conversation.disappearingmessages
|
||||
|
||||
import android.os.Bundle
|
||||
import android.widget.Toast
|
||||
@ -12,33 +12,34 @@ import androidx.lifecycle.repeatOnLifecycle
|
||||
import dagger.hilt.android.AndroidEntryPoint
|
||||
import kotlinx.coroutines.launch
|
||||
import network.loki.messenger.R
|
||||
import network.loki.messenger.databinding.ActivityExpirationSettingsBinding
|
||||
import network.loki.messenger.databinding.ActivityDisappearingMessagesBinding
|
||||
import org.thoughtcrime.securesms.PassphraseRequiredActionBarActivity
|
||||
import org.thoughtcrime.securesms.conversation.disappearingmessages.ui.DisappearingMessages
|
||||
import org.thoughtcrime.securesms.database.RecipientDatabase
|
||||
import org.thoughtcrime.securesms.database.ThreadDatabase
|
||||
import org.thoughtcrime.securesms.ui.AppTheme
|
||||
import javax.inject.Inject
|
||||
|
||||
@AndroidEntryPoint
|
||||
class ExpirationSettingsActivity: PassphraseRequiredActionBarActivity() {
|
||||
class DisappearingMessagesActivity: PassphraseRequiredActionBarActivity() {
|
||||
|
||||
private lateinit var binding : ActivityExpirationSettingsBinding
|
||||
private lateinit var binding : ActivityDisappearingMessagesBinding
|
||||
|
||||
@Inject lateinit var recipientDb: RecipientDatabase
|
||||
@Inject lateinit var threadDb: ThreadDatabase
|
||||
@Inject lateinit var viewModelFactory: ExpirationSettingsViewModel.AssistedFactory
|
||||
@Inject lateinit var viewModelFactory: DisappearingMessagesViewModel.AssistedFactory
|
||||
|
||||
private val threadId: Long by lazy {
|
||||
intent.getLongExtra(THREAD_ID, -1)
|
||||
}
|
||||
|
||||
private val viewModel: ExpirationSettingsViewModel by viewModels {
|
||||
private val viewModel: DisappearingMessagesViewModel by viewModels {
|
||||
viewModelFactory.create(threadId)
|
||||
}
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?, ready: Boolean) {
|
||||
super.onCreate(savedInstanceState, ready)
|
||||
binding = ActivityExpirationSettingsBinding.inflate(layoutInflater)
|
||||
binding = ActivityDisappearingMessagesBinding.inflate(layoutInflater)
|
||||
setContentView(binding.root)
|
||||
|
||||
setUpToolbar()
|
||||
@ -50,7 +51,7 @@ class ExpirationSettingsActivity: PassphraseRequiredActionBarActivity() {
|
||||
viewModel.event.collect {
|
||||
when (it) {
|
||||
Event.SUCCESS -> finish()
|
||||
Event.FAIL -> showToast(getString(R.string.ExpirationSettingsActivity_settings_not_updated))
|
||||
Event.FAIL -> showToast(getString(R.string.DisappearingMessagesActivity_settings_not_updated))
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -59,7 +60,7 @@ class ExpirationSettingsActivity: PassphraseRequiredActionBarActivity() {
|
||||
lifecycleScope.launch {
|
||||
repeatOnLifecycle(Lifecycle.State.STARTED) {
|
||||
viewModel.state.collect { state ->
|
||||
supportActionBar?.subtitle = state.subtitle(this@ExpirationSettingsActivity)
|
||||
supportActionBar?.subtitle = state.subtitle(this@DisappearingMessagesActivity)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -72,7 +73,7 @@ class ExpirationSettingsActivity: PassphraseRequiredActionBarActivity() {
|
||||
private fun setUpToolbar() {
|
||||
setSupportActionBar(binding.toolbar)
|
||||
val actionBar = supportActionBar ?: return
|
||||
actionBar.title = getString(R.string.activity_expiration_settings_title)
|
||||
actionBar.title = getString(R.string.activity_disappearing_messages_title)
|
||||
actionBar.setDisplayHomeAsUpEnabled(true)
|
||||
actionBar.setHomeButtonEnabled(true)
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package org.thoughtcrime.securesms.conversation.expiration
|
||||
package org.thoughtcrime.securesms.conversation.disappearingmessages
|
||||
|
||||
import android.app.Application
|
||||
import androidx.annotation.StringRes
|
||||
@ -25,7 +25,6 @@ import org.session.libsession.messaging.messages.control.ExpirationTimerUpdate
|
||||
import org.session.libsession.messaging.sending_receiving.MessageSender
|
||||
import org.session.libsession.snode.SnodeAPI
|
||||
import org.session.libsession.utilities.Address
|
||||
import org.session.libsession.utilities.ExpirationUtil
|
||||
import org.session.libsession.utilities.SSKEnvironment.MessageExpirationManagerProtocol
|
||||
import org.session.libsession.utilities.TextSecurePreferences
|
||||
import org.thoughtcrime.securesms.database.GroupDatabase
|
||||
@ -54,8 +53,8 @@ data class State(
|
||||
val showDebugOptions: Boolean = false
|
||||
) {
|
||||
val subtitle get() = when {
|
||||
isGroup || isNoteToSelf -> GetString(R.string.activity_expiration_settings_subtitle_sent)
|
||||
else -> GetString(R.string.activity_expiration_settings_subtitle)
|
||||
isGroup || isNoteToSelf -> GetString(R.string.activity_disappearing_messages_subtitle_sent)
|
||||
else -> GetString(R.string.activity_disappearing_messages_subtitle)
|
||||
}
|
||||
|
||||
val typeOptionsHidden get() = isNoteToSelf || (isGroup && isNewConfigEnabled)
|
||||
@ -76,7 +75,7 @@ object NoOpCallbacks: Callbacks {
|
||||
override fun setMode(mode: ExpiryMode) {}
|
||||
}
|
||||
|
||||
class ExpirationSettingsViewModel(
|
||||
class DisappearingMessagesViewModel(
|
||||
private val threadId: Long,
|
||||
private val application: Application,
|
||||
private val textSecurePreferences: TextSecurePreferences,
|
||||
@ -166,7 +165,7 @@ class ExpirationSettingsViewModel(
|
||||
private val storage: Storage
|
||||
) : ViewModelProvider.Factory {
|
||||
|
||||
override fun <T : ViewModel> create(modelClass: Class<T>): T = ExpirationSettingsViewModel(
|
||||
override fun <T : ViewModel> create(modelClass: Class<T>): T = DisappearingMessagesViewModel(
|
||||
threadId,
|
||||
application,
|
||||
textSecurePreferences,
|
||||
@ -187,8 +186,8 @@ data class UiState(
|
||||
) {
|
||||
constructor(state: State): this(
|
||||
cards = listOfNotNull(
|
||||
typeOptions(state)?.let { CardModel(GetString(R.string.activity_expiration_settings_delete_type), it) },
|
||||
timeOptions(state)?.let { CardModel(GetString(R.string.activity_expiration_settings_timer), it) }
|
||||
typeOptions(state)?.let { CardModel(GetString(R.string.activity_disappearing_messages_delete_type), it) },
|
||||
timeOptions(state)?.let { CardModel(GetString(R.string.activity_disappearing_messages_timer), it) }
|
||||
),
|
||||
showGroupFooter = state.isGroup && state.isNewConfigEnabled,
|
||||
showSetButton = state.isSelfAdmin
|
@ -1,4 +1,4 @@
|
||||
package org.thoughtcrime.securesms.conversation.expiration
|
||||
package org.thoughtcrime.securesms.conversation.disappearingmessages.ui
|
||||
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.Box
|
||||
@ -27,6 +27,12 @@ import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import network.loki.messenger.R
|
||||
import network.loki.messenger.libsession_util.util.ExpiryMode
|
||||
import org.thoughtcrime.securesms.conversation.disappearingmessages.Callbacks
|
||||
import org.thoughtcrime.securesms.conversation.disappearingmessages.CardModel
|
||||
import org.thoughtcrime.securesms.conversation.disappearingmessages.ExpiryType
|
||||
import org.thoughtcrime.securesms.conversation.disappearingmessages.NoOpCallbacks
|
||||
import org.thoughtcrime.securesms.conversation.disappearingmessages.State
|
||||
import org.thoughtcrime.securesms.conversation.disappearingmessages.UiState
|
||||
import org.thoughtcrime.securesms.ui.CellNoMargin
|
||||
import org.thoughtcrime.securesms.ui.Divider
|
||||
import org.thoughtcrime.securesms.ui.OutlineButton
|
||||
@ -56,7 +62,7 @@ fun DisappearingMessages(
|
||||
OptionsCard(it, callbacks)
|
||||
}
|
||||
|
||||
if (state.showGroupFooter) Text(text = stringResource(R.string.activity_expiration_settings_group_footer),
|
||||
if (state.showGroupFooter) Text(text = stringResource(R.string.activity_disappearing_messages_group_footer),
|
||||
style = TextStyle(
|
||||
fontSize = 11.sp,
|
||||
fontWeight = FontWeight(400),
|
||||
@ -67,7 +73,7 @@ fun DisappearingMessages(
|
||||
}
|
||||
|
||||
if (state.showSetButton) OutlineButton(
|
||||
stringResource(R.string.expiration_settings_set_button_title),
|
||||
stringResource(R.string.disappearing_messages_set_button_title),
|
||||
modifier = Modifier
|
||||
.align(Alignment.CenterHorizontally)
|
||||
.padding(bottom = 20.dp),
|
||||
@ -90,51 +96,3 @@ fun OptionsCard(card: CardModel, callbacks: Callbacks) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Preview(widthDp = 450, heightDp = 700)
|
||||
@Composable
|
||||
fun PreviewStates(
|
||||
@PreviewParameter(StatePreviewParameterProvider::class) state: State
|
||||
) {
|
||||
PreviewTheme(R.style.Classic_Dark) {
|
||||
DisappearingMessages(
|
||||
UiState(state)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
class StatePreviewParameterProvider : PreviewParameterProvider<State> {
|
||||
override val values = newConfigValues.filter { it.expiryType != ExpiryType.LEGACY } + newConfigValues.map { it.copy(isNewConfigEnabled = false) }
|
||||
|
||||
private val newConfigValues get() = sequenceOf(
|
||||
// new 1-1
|
||||
State(expiryMode = ExpiryMode.NONE),
|
||||
State(expiryMode = ExpiryMode.Legacy(43200)),
|
||||
State(expiryMode = ExpiryMode.AfterRead(300)),
|
||||
State(expiryMode = ExpiryMode.AfterSend(43200)),
|
||||
// new group non-admin
|
||||
State(isGroup = true, isSelfAdmin = false),
|
||||
State(isGroup = true, isSelfAdmin = false, expiryMode = ExpiryMode.Legacy(43200)),
|
||||
State(isGroup = true, isSelfAdmin = false, expiryMode = ExpiryMode.AfterSend(43200)),
|
||||
// new group admin
|
||||
State(isGroup = true),
|
||||
State(isGroup = true, expiryMode = ExpiryMode.Legacy(43200)),
|
||||
State(isGroup = true, expiryMode = ExpiryMode.AfterSend(43200)),
|
||||
// new note-to-self
|
||||
State(isNoteToSelf = true),
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@Preview
|
||||
@Composable
|
||||
fun PreviewThemes(
|
||||
@PreviewParameter(ThemeResPreviewParameterProvider::class) themeResId: Int
|
||||
) {
|
||||
PreviewTheme(themeResId) {
|
||||
DisappearingMessages(
|
||||
UiState(State(expiryMode = ExpiryMode.AfterSend(43200))),
|
||||
modifier = Modifier.size(400.dp, 600.dp)
|
||||
)
|
||||
}
|
||||
}
|
@ -0,0 +1,63 @@
|
||||
package org.thoughtcrime.securesms.conversation.disappearingmessages.ui
|
||||
|
||||
import androidx.compose.foundation.layout.size
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.compose.ui.tooling.preview.PreviewParameter
|
||||
import androidx.compose.ui.tooling.preview.PreviewParameterProvider
|
||||
import androidx.compose.ui.unit.dp
|
||||
import network.loki.messenger.R
|
||||
import network.loki.messenger.libsession_util.util.ExpiryMode
|
||||
import org.thoughtcrime.securesms.conversation.disappearingmessages.ExpiryType
|
||||
import org.thoughtcrime.securesms.conversation.disappearingmessages.State
|
||||
import org.thoughtcrime.securesms.conversation.disappearingmessages.UiState
|
||||
import org.thoughtcrime.securesms.ui.PreviewTheme
|
||||
import org.thoughtcrime.securesms.ui.ThemeResPreviewParameterProvider
|
||||
|
||||
@Preview(widthDp = 450, heightDp = 700)
|
||||
@Composable
|
||||
fun PreviewStates(
|
||||
@PreviewParameter(StatePreviewParameterProvider::class) state: State
|
||||
) {
|
||||
PreviewTheme(R.style.Classic_Dark) {
|
||||
DisappearingMessages(
|
||||
UiState(state)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
class StatePreviewParameterProvider : PreviewParameterProvider<State> {
|
||||
override val values = newConfigValues.filter { it.expiryType != ExpiryType.LEGACY } + newConfigValues.map { it.copy(isNewConfigEnabled = false) }
|
||||
|
||||
private val newConfigValues get() = sequenceOf(
|
||||
// new 1-1
|
||||
State(expiryMode = ExpiryMode.NONE),
|
||||
State(expiryMode = ExpiryMode.Legacy(43200)),
|
||||
State(expiryMode = ExpiryMode.AfterRead(300)),
|
||||
State(expiryMode = ExpiryMode.AfterSend(43200)),
|
||||
// new group non-admin
|
||||
State(isGroup = true, isSelfAdmin = false),
|
||||
State(isGroup = true, isSelfAdmin = false, expiryMode = ExpiryMode.Legacy(43200)),
|
||||
State(isGroup = true, isSelfAdmin = false, expiryMode = ExpiryMode.AfterSend(43200)),
|
||||
// new group admin
|
||||
State(isGroup = true),
|
||||
State(isGroup = true, expiryMode = ExpiryMode.Legacy(43200)),
|
||||
State(isGroup = true, expiryMode = ExpiryMode.AfterSend(43200)),
|
||||
// new note-to-self
|
||||
State(isNoteToSelf = true),
|
||||
)
|
||||
}
|
||||
|
||||
@Preview
|
||||
@Composable
|
||||
fun PreviewThemes(
|
||||
@PreviewParameter(ThemeResPreviewParameterProvider::class) themeResId: Int
|
||||
) {
|
||||
PreviewTheme(themeResId) {
|
||||
DisappearingMessages(
|
||||
UiState(State(expiryMode = ExpiryMode.AfterSend(43200))),
|
||||
modifier = Modifier.size(400.dp, 600.dp)
|
||||
)
|
||||
}
|
||||
}
|
@ -106,7 +106,7 @@ import org.thoughtcrime.securesms.attachments.ScreenshotObserver
|
||||
import org.thoughtcrime.securesms.audio.AudioRecorder
|
||||
import org.thoughtcrime.securesms.contacts.SelectContactsActivity.Companion.selectedContactsKey
|
||||
import org.thoughtcrime.securesms.conversation.ConversationActionBarDelegate
|
||||
import org.thoughtcrime.securesms.conversation.expiration.ExpirationSettingsActivity
|
||||
import org.thoughtcrime.securesms.conversation.disappearingmessages.DisappearingMessagesActivity
|
||||
import org.thoughtcrime.securesms.conversation.v2.ConversationReactionOverlay.OnActionSelectedListener
|
||||
import org.thoughtcrime.securesms.conversation.v2.ConversationReactionOverlay.OnReactionSelectedListener
|
||||
import org.thoughtcrime.securesms.conversation.v2.MessageDetailActivity.Companion.MESSAGE_TIMESTAMP
|
||||
@ -1123,8 +1123,8 @@ class ConversationActivityV2 : PassphraseRequiredActionBarActivity(), InputBarDe
|
||||
// endregion
|
||||
|
||||
// region Interaction
|
||||
override fun onExpirationSettingClicked() {
|
||||
viewModel.recipient?.let { showExpirationSettings(it) }
|
||||
override fun onDisappearingMessagesClicked() {
|
||||
viewModel.recipient?.let { showDisappearingMessages(it) }
|
||||
}
|
||||
|
||||
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
||||
@ -1170,14 +1170,13 @@ class ConversationActivityV2 : PassphraseRequiredActionBarActivity(), InputBarDe
|
||||
Toast.makeText(this, R.string.copied_to_clipboard, Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
|
||||
override fun showExpirationSettings(thread: Recipient) {
|
||||
override fun showDisappearingMessages(thread: Recipient) {
|
||||
if (thread.isClosedGroupRecipient) {
|
||||
val group = groupDb.getGroup(thread.address.toGroupString()).orNull()
|
||||
if (group?.isActive == false) { return }
|
||||
groupDb.getGroup(thread.address.toGroupString()).orNull()?.run { if (isActive) return }
|
||||
}
|
||||
val expirationIntent = Intent(this, ExpirationSettingsActivity::class.java)
|
||||
expirationIntent.putExtra(ExpirationSettingsActivity.THREAD_ID, viewModel.threadId)
|
||||
show(expirationIntent, true)
|
||||
Intent(this, DisappearingMessagesActivity::class.java)
|
||||
.apply { putExtra(DisappearingMessagesActivity.THREAD_ID, viewModel.threadId) }
|
||||
.also { show(it, true) }
|
||||
}
|
||||
|
||||
override fun unblock() {
|
||||
|
@ -131,7 +131,7 @@ object ConversationMenuHelper {
|
||||
R.id.menu_view_all_media -> { showAllMedia(context, thread) }
|
||||
R.id.menu_search -> { search(context) }
|
||||
R.id.menu_add_shortcut -> { addShortcut(context, thread) }
|
||||
R.id.menu_expiring_messages -> { showExpirationSettings(context, thread) }
|
||||
R.id.menu_expiring_messages -> { showDisappearingMessages(context, thread) }
|
||||
R.id.menu_unblock -> { unblock(context, thread) }
|
||||
R.id.menu_block -> { block(context, thread, deleteThread = false) }
|
||||
R.id.menu_block_delete -> { blockAndDelete(context, thread) }
|
||||
@ -223,9 +223,9 @@ object ConversationMenuHelper {
|
||||
}.execute()
|
||||
}
|
||||
|
||||
private fun showExpirationSettings(context: Context, thread: Recipient) {
|
||||
private fun showDisappearingMessages(context: Context, thread: Recipient) {
|
||||
val listener = context as? ConversationMenuListener ?: return
|
||||
listener.showExpirationSettings(thread)
|
||||
listener.showDisappearingMessages(thread)
|
||||
}
|
||||
|
||||
private fun unblock(context: Context, thread: Recipient) {
|
||||
@ -327,7 +327,7 @@ object ConversationMenuHelper {
|
||||
fun unblock()
|
||||
fun copySessionID(sessionId: String)
|
||||
fun copyOpenGroupUrl(thread: Recipient)
|
||||
fun showExpirationSettings(thread: Recipient)
|
||||
fun showDisappearingMessages(thread: Recipient)
|
||||
}
|
||||
|
||||
}
|
@ -78,7 +78,6 @@ import org.session.libsignal.utilities.IdPrefix
|
||||
import org.session.libsignal.utilities.KeyHelper
|
||||
import org.session.libsignal.utilities.Log
|
||||
import org.session.libsignal.utilities.guava.Optional
|
||||
import org.thoughtcrime.securesms.conversation.expiration.type
|
||||
import org.thoughtcrime.securesms.database.helpers.SQLCipherOpenHelper
|
||||
import org.thoughtcrime.securesms.database.model.MessageId
|
||||
import org.thoughtcrime.securesms.database.model.ReactionRecord
|
||||
|
@ -54,7 +54,7 @@ import kotlinx.coroutines.launch
|
||||
import network.loki.messenger.R
|
||||
import org.session.libsession.utilities.recipients.Recipient
|
||||
import org.thoughtcrime.securesms.components.ProfilePictureView
|
||||
import org.thoughtcrime.securesms.conversation.expiration.OptionModel
|
||||
import org.thoughtcrime.securesms.conversation.disappearingmessages.OptionModel
|
||||
import kotlin.math.min
|
||||
|
||||
@Composable
|
||||
|
@ -12,9 +12,9 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?colorPrimary"
|
||||
app:contentInsetStart="0dp"
|
||||
app:subtitle="@string/activity_expiration_settings_subtitle"
|
||||
app:subtitle="@string/activity_disappearing_messages_subtitle"
|
||||
app:subtitleTextAppearance="@style/TextAppearance.Session.ToolbarSubtitle"
|
||||
app:title="@string/activity_expiration_settings_title" />
|
||||
app:title="@string/activity_disappearing_messages_title" />
|
||||
|
||||
<androidx.compose.ui.platform.ComposeView
|
||||
android:id="@+id/container"
|
@ -1040,22 +1040,21 @@
|
||||
<string name="fragment_enter_community_url_join_button_title">Join</string>
|
||||
<string name="new_conversation_dialog_back_button_content_description">Navigate Back</string>
|
||||
<string name="new_conversation_dialog_close_button_content_description">Close Dialog</string>
|
||||
<string name="activity_expiration_settings_title">Disappearing Messages</string>
|
||||
<string name="activity_expiration_settings_subtitle">This setting applies to everyone in this conversation.</string>
|
||||
<string name="activity_disappearing_messages_title">Disappearing Messages</string>
|
||||
<string name="activity_disappearing_messages_subtitle">This setting applies to everyone in this conversation.</string>
|
||||
<string name="expiration_type_disappear_legacy_description">Original version of disappearing messages.</string>
|
||||
<string name="expiration_type_disappear_legacy">Legacy</string>
|
||||
<string name="activity_expiration_settings_subtitle_sent">Messages disappear after they have been sent.</string>
|
||||
<string name="activity_disappearing_messages_subtitle_sent">Messages disappear after they have been sent.</string>
|
||||
<string name="expiration_type_disappear_after_read">Disappear After Read</string>
|
||||
<string name="expiration_type_disappear_after_read_description">Messages delete after they have been read.</string>
|
||||
<string name="expiration_type_disappear_after_send">Disappear After Send</string>
|
||||
<string name="expiration_type_disappear_after_send_description">Messages delete after they have been sent.</string>
|
||||
<string name="expiration_settings_set_button_title">Set</string>
|
||||
<string name="activity_expiration_settings_delete_type">Delete Type</string>
|
||||
<string name="activity_expiration_settings_timer">Timer</string>
|
||||
<string name="activity_expiration_settings_group_footer">This setting applies to everyone in this conversation.\nOnly group admins can change this setting.</string>
|
||||
<string name="disappearing_messages_set_button_title">Set</string>
|
||||
<string name="activity_disappearing_messages_delete_type">Delete Type</string>
|
||||
<string name="activity_disappearing_messages_timer">Timer</string>
|
||||
<string name="activity_disappearing_messages_group_footer">This setting applies to everyone in this conversation.\nOnly group admins can change this setting.</string>
|
||||
<string name="activity_conversation_outdated_client_banner_text">%s is using an outdated client. Disappearing messages may not work as expected.</string>
|
||||
<string name="ExpirationSettingsActivity_settings_updated">Settings updated</string>
|
||||
<string name="ExpirationSettingsActivity_settings_not_updated">Settings not updated and please try again</string>
|
||||
<string name="DisappearingMessagesActivity_settings_not_updated">Settings not updated and please try again</string>
|
||||
<string name="ErrorNotifier_migration">Database Upgrade Failed</string>
|
||||
<string name="ErrorNotifier_migration_downgrade">Please contact support to report the error.</string>
|
||||
<string name="delivery_status_syncing">Syncing</string>
|
||||
|
@ -1,4 +1,4 @@
|
||||
package org.thoughtcrime.securesms.conversation.expiration
|
||||
package org.thoughtcrime.securesms.conversation.disappearingmessages
|
||||
|
||||
import android.app.Application
|
||||
import com.google.common.truth.Truth.assertThat
|
||||
@ -41,7 +41,7 @@ private val GROUP_ADDRESS = Address.fromSerialized(GROUP_NUMBER)
|
||||
|
||||
@OptIn(ExperimentalCoroutinesApi::class)
|
||||
@RunWith(MockitoJUnitRunner::class)
|
||||
class ExpirationSettingsViewModelTest {
|
||||
class DisappearingMessagesViewModelTest {
|
||||
|
||||
@ExperimentalCoroutinesApi
|
||||
@get:Rule
|
||||
@ -84,7 +84,7 @@ class ExpirationSettingsViewModelTest {
|
||||
).isEqualTo(
|
||||
UiState(
|
||||
CardModel(
|
||||
R.string.activity_expiration_settings_timer,
|
||||
R.string.activity_disappearing_messages_timer,
|
||||
typeOption(ExpiryMode.NONE, selected = true),
|
||||
timeOption(ExpiryType.AFTER_SEND, 12.hours),
|
||||
timeOption(ExpiryType.AFTER_SEND, 1.days),
|
||||
@ -123,7 +123,7 @@ class ExpirationSettingsViewModelTest {
|
||||
).isEqualTo(
|
||||
UiState(
|
||||
CardModel(
|
||||
R.string.activity_expiration_settings_timer,
|
||||
R.string.activity_disappearing_messages_timer,
|
||||
typeOption(ExpiryMode.NONE, selected = true),
|
||||
timeOption(ExpiryType.LEGACY, 12.hours),
|
||||
timeOption(ExpiryType.LEGACY, 1.days),
|
||||
@ -162,7 +162,7 @@ class ExpirationSettingsViewModelTest {
|
||||
).isEqualTo(
|
||||
UiState(
|
||||
CardModel(
|
||||
R.string.activity_expiration_settings_timer,
|
||||
R.string.activity_disappearing_messages_timer,
|
||||
typeOption(ExpiryMode.NONE, selected = true),
|
||||
timeOption(ExpiryType.AFTER_SEND, 12.hours),
|
||||
timeOption(ExpiryType.AFTER_SEND, 1.days),
|
||||
@ -202,7 +202,7 @@ class ExpirationSettingsViewModelTest {
|
||||
).isEqualTo(
|
||||
UiState(
|
||||
CardModel(
|
||||
R.string.activity_expiration_settings_timer,
|
||||
R.string.activity_disappearing_messages_timer,
|
||||
typeOption(ExpiryMode.NONE, enabled = false, selected = true),
|
||||
timeOption(ExpiryType.AFTER_SEND, 12.hours, enabled = false),
|
||||
timeOption(ExpiryType.AFTER_SEND, 1.days, enabled = false),
|
||||
@ -244,7 +244,7 @@ class ExpirationSettingsViewModelTest {
|
||||
).isEqualTo(
|
||||
UiState(
|
||||
CardModel(
|
||||
R.string.activity_expiration_settings_delete_type,
|
||||
R.string.activity_disappearing_messages_delete_type,
|
||||
typeOption(ExpiryMode.NONE, selected = true),
|
||||
typeOption(12.hours, ExpiryType.AFTER_READ),
|
||||
typeOption(1.days, ExpiryType.AFTER_SEND)
|
||||
@ -283,13 +283,13 @@ class ExpirationSettingsViewModelTest {
|
||||
).isEqualTo(
|
||||
UiState(
|
||||
CardModel(
|
||||
R.string.activity_expiration_settings_delete_type,
|
||||
R.string.activity_disappearing_messages_delete_type,
|
||||
typeOption(ExpiryMode.NONE),
|
||||
typeOption(time, ExpiryType.AFTER_READ),
|
||||
typeOption(time, ExpiryType.AFTER_SEND, selected = true)
|
||||
),
|
||||
CardModel(
|
||||
GetString(R.string.activity_expiration_settings_timer),
|
||||
GetString(R.string.activity_disappearing_messages_timer),
|
||||
timeOption(ExpiryType.AFTER_SEND, 12.hours, selected = true),
|
||||
timeOption(ExpiryType.AFTER_SEND, 1.days),
|
||||
timeOption(ExpiryType.AFTER_SEND, 7.days),
|
||||
@ -329,14 +329,14 @@ class ExpirationSettingsViewModelTest {
|
||||
).isEqualTo(
|
||||
UiState(
|
||||
CardModel(
|
||||
R.string.activity_expiration_settings_delete_type,
|
||||
R.string.activity_disappearing_messages_delete_type,
|
||||
typeOption(ExpiryMode.NONE),
|
||||
typeOption(time, ExpiryType.LEGACY, selected = true),
|
||||
typeOption(12.hours, ExpiryType.AFTER_READ, enabled = false),
|
||||
typeOption(1.days, ExpiryType.AFTER_SEND, enabled = false)
|
||||
),
|
||||
CardModel(
|
||||
GetString(R.string.activity_expiration_settings_timer),
|
||||
GetString(R.string.activity_disappearing_messages_timer),
|
||||
timeOption(ExpiryType.LEGACY, 12.hours, selected = true),
|
||||
timeOption(ExpiryType.LEGACY, 1.days),
|
||||
timeOption(ExpiryType.LEGACY, 7.days),
|
||||
@ -376,13 +376,13 @@ class ExpirationSettingsViewModelTest {
|
||||
).isEqualTo(
|
||||
UiState(
|
||||
CardModel(
|
||||
R.string.activity_expiration_settings_delete_type,
|
||||
R.string.activity_disappearing_messages_delete_type,
|
||||
typeOption(ExpiryMode.NONE),
|
||||
typeOption(12.hours, ExpiryType.AFTER_READ),
|
||||
typeOption(time, ExpiryType.AFTER_SEND, selected = true)
|
||||
),
|
||||
CardModel(
|
||||
GetString(R.string.activity_expiration_settings_timer),
|
||||
GetString(R.string.activity_disappearing_messages_timer),
|
||||
timeOption(ExpiryType.AFTER_SEND, 12.hours),
|
||||
timeOption(ExpiryType.AFTER_SEND, 1.days, selected = true),
|
||||
timeOption(ExpiryType.AFTER_SEND, 7.days),
|
||||
@ -423,13 +423,13 @@ class ExpirationSettingsViewModelTest {
|
||||
).isEqualTo(
|
||||
UiState(
|
||||
CardModel(
|
||||
R.string.activity_expiration_settings_delete_type,
|
||||
R.string.activity_disappearing_messages_delete_type,
|
||||
typeOption(ExpiryMode.NONE),
|
||||
typeOption(1.days, ExpiryType.AFTER_READ, selected = true),
|
||||
typeOption(time, ExpiryType.AFTER_SEND)
|
||||
),
|
||||
CardModel(
|
||||
GetString(R.string.activity_expiration_settings_timer),
|
||||
GetString(R.string.activity_disappearing_messages_timer),
|
||||
timeOption(ExpiryType.AFTER_READ, 5.minutes),
|
||||
timeOption(ExpiryType.AFTER_READ, 1.hours),
|
||||
timeOption(ExpiryType.AFTER_READ, 12.hours),
|
||||
@ -476,13 +476,13 @@ class ExpirationSettingsViewModelTest {
|
||||
).isEqualTo(
|
||||
UiState(
|
||||
CardModel(
|
||||
R.string.activity_expiration_settings_delete_type,
|
||||
R.string.activity_disappearing_messages_delete_type,
|
||||
typeOption(ExpiryMode.NONE),
|
||||
typeOption(12.hours, ExpiryType.AFTER_READ),
|
||||
typeOption(1.days, ExpiryType.AFTER_SEND, selected = true)
|
||||
),
|
||||
CardModel(
|
||||
GetString(R.string.activity_expiration_settings_timer),
|
||||
GetString(R.string.activity_disappearing_messages_timer),
|
||||
timeOption(ExpiryType.AFTER_SEND, 12.hours),
|
||||
timeOption(ExpiryType.AFTER_SEND, 1.days, selected = true),
|
||||
timeOption(ExpiryType.AFTER_SEND, 7.days),
|
||||
@ -547,7 +547,7 @@ class ExpirationSettingsViewModelTest {
|
||||
updatedTimestampMs = 0
|
||||
)
|
||||
|
||||
private fun createViewModel(isNewConfigEnabled: Boolean = true) = ExpirationSettingsViewModel(
|
||||
private fun createViewModel(isNewConfigEnabled: Boolean = true) = DisappearingMessagesViewModel(
|
||||
THREAD_ID,
|
||||
application,
|
||||
textSecurePreferences,
|
Loading…
Reference in New Issue
Block a user