diff --git a/app/src/main/java/org/thoughtcrime/securesms/conversation/newmessage/NewMessageFragment.kt b/app/src/main/java/org/thoughtcrime/securesms/conversation/newmessage/NewMessageFragment.kt index df0fded3a9..49abfd1207 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/conversation/newmessage/NewMessageFragment.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/conversation/newmessage/NewMessageFragment.kt @@ -12,12 +12,9 @@ import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.fillMaxHeight import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding -import androidx.compose.foundation.layout.width import androidx.compose.foundation.pager.HorizontalPager import androidx.compose.foundation.pager.rememberPagerState -import androidx.compose.material.LocalContentAlpha import androidx.compose.material.MaterialTheme -import androidx.compose.material.Text import androidx.compose.material.primarySurface import androidx.compose.runtime.Composable import androidx.compose.runtime.collectAsState @@ -52,7 +49,6 @@ import org.thoughtcrime.securesms.ui.LoadingArcOr import org.thoughtcrime.securesms.ui.LocalDimensions import org.thoughtcrime.securesms.ui.PreviewTheme import org.thoughtcrime.securesms.ui.ThemeResPreviewParameterProvider -import org.thoughtcrime.securesms.ui.baseBold import org.thoughtcrime.securesms.ui.classicDarkColors import org.thoughtcrime.securesms.ui.components.AppBar import org.thoughtcrime.securesms.ui.components.BorderlessButtonWithIcon @@ -166,7 +162,7 @@ fun EnterAccountId( error = state.error?.string(), ) if (state.error == null) { - BorderlessButtonSecondary( + BorderlessButtonWithIcon( text = stringResource(R.string.messageNewDescription), iconRes = R.drawable.ic_circle_question_mark, contentColor = classicDarkColors[5], diff --git a/app/src/main/java/org/thoughtcrime/securesms/conversation/newmessage/NewMessageViewModel.kt b/app/src/main/java/org/thoughtcrime/securesms/conversation/newmessage/NewMessageViewModel.kt index a1ffa29782..90d816173f 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/conversation/newmessage/NewMessageViewModel.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/conversation/newmessage/NewMessageViewModel.kt @@ -36,11 +36,11 @@ class NewMessageViewModel @Inject constructor( private val _qrErrors = Channel() val qrErrors: Flow = _qrErrors.receiveAsFlow() - private var job: Job? = null + private var loadOnsJob: Job? = null override fun onChange(value: String) { - job?.cancel() - job = null + loadOnsJob?.cancel() + loadOnsJob = null _state.update { State(newMessageIdOrOns = value) } } @@ -58,7 +58,7 @@ class NewMessageViewModel @Inject constructor( } private fun createPrivateChatIfPossible(onsNameOrPublicKey: String) { - if (job?.isActive == true) return + if (loadOnsJob?.isActive == true) return if (PublicKeyValidation.isValid(onsNameOrPublicKey, isPrefixRequired = false)) { if (PublicKeyValidation.hasValidPrefix(onsNameOrPublicKey)) { @@ -70,7 +70,7 @@ class NewMessageViewModel @Inject constructor( // This could be an ONS name _state.update { it.copy(error = null, loading = true) } - job = viewModelScope.launch(Dispatchers.IO) { + loadOnsJob = viewModelScope.launch(Dispatchers.IO) { try { withTimeout(5.seconds) { SnodeAPI.getSessionID(onsNameOrPublicKey).get() diff --git a/app/src/main/java/org/thoughtcrime/securesms/ui/components/Button.kt b/app/src/main/java/org/thoughtcrime/securesms/ui/components/Button.kt index c2963c3188..3a3edabfa7 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/ui/components/Button.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/ui/components/Button.kt @@ -105,7 +105,7 @@ fun OutlineButton( onClick = onClick, border = BorderStroke(1.dp, LocalButtonColor.current), colors = ButtonDefaults.outlinedButtonColors( - contentColor = LocalButtonColor.current, + contentColor = if (enabled) LocalButtonColor.current else Color.Unspecified, backgroundColor = Color.Unspecified ) ) { @@ -200,20 +200,6 @@ fun FilledButton( } } -@Composable -fun BorderlessButtonSecondary( - text: String, - modifier: Modifier = Modifier, - onClick: () -> Unit -) { - BorderlessButton( - text, - modifier = modifier, - contentColor = MaterialTheme.colors.onSurface.copy(ContentAlpha.medium), - onClick = onClick - ) -} - @Composable fun BorderlessButton( modifier: Modifier = Modifier,