Skip to content

Commit

Permalink
Fix private message reply bug.
Browse files Browse the repository at this point in the history
  • Loading branch information
dessalines committed Jan 20, 2022
1 parent 26da8fd commit f55288b
Showing 1 changed file with 1 addition and 43 deletions.
Original file line number Diff line number Diff line change
@@ -1,24 +1,15 @@
package com.jerboa.ui.components.private_message

import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.text.KeyboardOptions
import androidx.compose.foundation.text.selection.SelectionContainer
import androidx.compose.material.*
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Close
import androidx.compose.material.icons.filled.Send
import androidx.compose.runtime.Composable
import androidx.compose.runtime.DisposableEffect
import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
import androidx.compose.ui.focus.FocusRequester
import androidx.compose.ui.focus.focusRequester
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.text.input.KeyboardCapitalization
import androidx.compose.ui.text.input.KeyboardType
import androidx.compose.ui.tooling.preview.Preview
import androidx.navigation.NavController
import androidx.navigation.compose.rememberNavController
Expand Down Expand Up @@ -73,7 +64,7 @@ fun RepliedPrivateMessage(
PrivateMessageHeader(
privateMessageView = privateMessageView,
onPersonClick = onPersonClick,
myPersonId = privateMessageView.creator.id // TODO check this
myPersonId = privateMessageView.recipient.id,
)
SelectionContainer {
Text(text = privateMessageView.private_message.content)
Expand All @@ -87,39 +78,6 @@ fun RepliedPrivateMessagePreview() {
RepliedPrivateMessage(privateMessageView = samplePrivateMessageView)
}

// TODO what is this doing here
@Composable
fun PrivateMessageReplyTextField(
reply: String,
onReplyChange: (String) -> Unit
) {
val focusRequester = remember { FocusRequester() }

TextField(
value = reply,
onValueChange = onReplyChange,
placeholder = { Text(text = "Type your comment") },
modifier = Modifier
.fillMaxWidth()
.focusRequester(focusRequester),
keyboardOptions = KeyboardOptions.Default.copy(
capitalization = KeyboardCapitalization.Sentences,
keyboardType = KeyboardType.Text,
autoCorrect = true,
),
colors = TextFieldDefaults.textFieldColors(
backgroundColor = Color.Transparent,
focusedIndicatorColor = Color.Transparent,
unfocusedIndicatorColor = Color.Transparent,
)
)

DisposableEffect(Unit) {
focusRequester.requestFocus()
onDispose { }
}
}

@Composable
fun PrivateMessageReply(
privateMessageView: PrivateMessageView,
Expand Down

0 comments on commit f55288b

Please sign in to comment.