SES-2229 Fix NewMessage ONS timeout error message for real

This commit is contained in:
Andrew 2024-06-26 23:02:45 +09:30
parent f2e72d794b
commit 1f50a702bc

View File

@ -20,6 +20,7 @@ import org.session.libsession.snode.SnodeAPI
import org.session.libsignal.utilities.PublicKeyValidation import org.session.libsignal.utilities.PublicKeyValidation
import org.session.libsignal.utilities.timeout import org.session.libsignal.utilities.timeout
import org.thoughtcrime.securesms.ui.GetString import org.thoughtcrime.securesms.ui.GetString
import java.util.concurrent.TimeoutException
import javax.inject.Inject import javax.inject.Inject
import kotlin.coroutines.cancellation.CancellationException import kotlin.coroutines.cancellation.CancellationException
import kotlin.time.Duration.Companion.seconds import kotlin.time.Duration.Companion.seconds
@ -100,8 +101,8 @@ internal class NewMessageViewModel @Inject constructor(
private fun Exception.toMessage() = when (this) { private fun Exception.toMessage() = when (this) {
is SnodeAPI.Error.Generic -> application.getString(R.string.onsErrorNotRecognized) is SnodeAPI.Error.Generic -> application.getString(R.string.onsErrorNotRecognized)
is TimeoutCancellationException -> application.getString(R.string.onsErrorUnableToSearch) is TimeoutException -> application.getString(R.string.onsErrorUnableToSearch)
else -> localizedMessage ?: application.getString(R.string.fragment_enter_public_key_error_message) else -> application.getString(R.string.fragment_enter_public_key_error_message)
} }
} }