Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix text not auto-capitalized #335

Merged
merged 1 commit into from
Feb 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import androidx.compose.ui.text.AnnotatedString
import androidx.compose.ui.text.SpanStyle
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.buildAnnotatedString
import androidx.compose.ui.text.input.KeyboardCapitalization
import androidx.compose.ui.text.input.TextFieldValue
import androidx.compose.ui.text.input.VisualTransformation
import net.primal.android.core.utils.TextMatcher
Expand All @@ -40,7 +41,9 @@ fun NoteOutlinedTextField(
supportingText: @Composable (() -> Unit)? = null,
isError: Boolean = false,
visualTransformation: VisualTransformation = VisualTransformation.None,
keyboardOptions: KeyboardOptions = KeyboardOptions.Default,
keyboardOptions: KeyboardOptions = KeyboardOptions.Default.copy(
capitalization = KeyboardCapitalization.Sentences,
),
keyboardActions: KeyboardActions = KeyboardActions.Default,
singleLine: Boolean = false,
maxLines: Int = if (singleLine) 1 else Int.MAX_VALUE,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import androidx.compose.foundation.lazy.LazyListState
import androidx.compose.foundation.lazy.rememberLazyListState
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.foundation.text.KeyboardOptions
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.outlined.ArrowUpward
import androidx.compose.material.icons.outlined.HourglassBottom
Expand All @@ -42,6 +43,7 @@ import androidx.compose.ui.graphics.Color
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.platform.LocalUriHandler
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.input.KeyboardCapitalization
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import androidx.lifecycle.Lifecycle
Expand Down Expand Up @@ -87,6 +89,7 @@ fun ChatScreen(
Lifecycle.Event.ON_START, Lifecycle.Event.ON_STOP -> {
viewModel.setEvent(ChatContract.UiEvent.MessagesSeen)
}

else -> Unit
}
}
Expand Down Expand Up @@ -437,6 +440,9 @@ private fun MessageOutlinedTextField(
textStyle = AppTheme.typography.bodyMedium,
colors = PrimalDefaults.outlinedTextFieldColors(),
shape = AppTheme.shapes.medium,
keyboardOptions = KeyboardOptions.Default.copy(
capitalization = KeyboardCapitalization.Sentences,
),
)

AppBarIcon(
Expand All @@ -463,8 +469,10 @@ private fun ChatErrorHandler(error: ChatContract.UiState.ChatError?, snackbarHos
val errorMessage = when (error) {
is ChatContract.UiState.ChatError.MissingRelaysConfiguration ->
context.getString(R.string.app_missing_relays_config)

is ChatContract.UiState.ChatError.PublishError ->
context.getString(R.string.chat_nostr_publish_error)

else -> null
}

Expand Down