mirror of
https://github.com/nextcloud/talk-android
synced 2025-07-30 08:05:30 +01:00
Set password
Signed-off-by: sowjanyakch <sowjanya.kch@gmail.com>
This commit is contained in:
parent
cb6fdf6fe1
commit
1187b41e51
@ -32,6 +32,7 @@ import androidx.compose.foundation.rememberScrollState
|
||||
import androidx.compose.foundation.verticalScroll
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.automirrored.filled.ArrowBack
|
||||
import androidx.compose.material3.AlertDialog
|
||||
import androidx.compose.material3.Button
|
||||
import androidx.compose.material3.ExperimentalMaterial3Api
|
||||
import androidx.compose.material3.HorizontalDivider
|
||||
@ -42,10 +43,14 @@ import androidx.compose.material3.OutlinedTextField
|
||||
import androidx.compose.material3.Scaffold
|
||||
import androidx.compose.material3.Switch
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.material3.TextField
|
||||
import androidx.compose.material3.TopAppBar
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.collectAsState
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.graphics.Color
|
||||
@ -345,13 +350,15 @@ fun RoomCreationOptions(conversationCreationViewModel: ConversationCreationViewM
|
||||
conversationCreationViewModel.isGuestsAllowed.value = it
|
||||
}
|
||||
)
|
||||
}
|
||||
},
|
||||
showDialog = false
|
||||
)
|
||||
|
||||
if (isGuestsAllowed) {
|
||||
ConversationOptions(
|
||||
icon = R.drawable.ic_lock_grey600_24px,
|
||||
text = R.string.nc_set_password
|
||||
text = R.string.nc_set_password,
|
||||
showDialog = true
|
||||
)
|
||||
}
|
||||
|
||||
@ -365,7 +372,8 @@ fun RoomCreationOptions(conversationCreationViewModel: ConversationCreationViewM
|
||||
conversationCreationViewModel.isConversationAvailableForRegisteredUsers.value = it
|
||||
}
|
||||
)
|
||||
}
|
||||
},
|
||||
showDialog = false
|
||||
)
|
||||
|
||||
if (isConversationAvailableForRegisteredUsers) {
|
||||
@ -378,17 +386,26 @@ fun RoomCreationOptions(conversationCreationViewModel: ConversationCreationViewM
|
||||
conversationCreationViewModel.openForGuestAppUsers.value = it
|
||||
}
|
||||
)
|
||||
}
|
||||
},
|
||||
showDialog = false
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun ConversationOptions(icon: Int? = null, text: Int, switch: @Composable (() -> Unit)? = null) {
|
||||
fun ConversationOptions(icon: Int? = null, text: Int, switch: @Composable (() -> Unit)? = null, showDialog: Boolean) {
|
||||
Row(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(start = 16.dp, end = 16.dp, bottom = 8.dp),
|
||||
.padding(start = 16.dp, end = 16.dp, bottom = 8.dp)
|
||||
.then(
|
||||
if (showDialog) {
|
||||
Modifier.clickable {
|
||||
}
|
||||
} else {
|
||||
Modifier
|
||||
}
|
||||
),
|
||||
horizontalArrangement = Arrangement.SpaceBetween,
|
||||
verticalAlignment = Alignment.CenterVertically
|
||||
) {
|
||||
@ -412,6 +429,32 @@ fun ConversationOptions(icon: Int? = null, text: Int, switch: @Composable (() ->
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun ShowPasswordDialog() {
|
||||
var password by remember { mutableStateOf("") }
|
||||
|
||||
AlertDialog(
|
||||
onDismissRequest = { /*TODO*/ },
|
||||
confirmButton = {
|
||||
Button(onClick = {
|
||||
}) {
|
||||
Text(text = stringResource(id = R.string.nc_cancel))
|
||||
}
|
||||
},
|
||||
title = { Text(text = "Set Password") },
|
||||
text = {
|
||||
TextField(value = password, onValueChange = {
|
||||
password = it
|
||||
})
|
||||
},
|
||||
dismissButton = {
|
||||
Button(onClick = { /* Handle cancel */ }) {
|
||||
Text(text = stringResource(id = R.string.nc_cancel))
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun CreateConversation(conversationCreationViewModel: ConversationCreationViewModel, context: Context) {
|
||||
val selectedParticipants by conversationCreationViewModel.selectedParticipants.collectAsState()
|
||||
|
@ -34,6 +34,8 @@ class ConversationCreationViewModel @Inject constructor(
|
||||
|
||||
private val _roomName = MutableStateFlow("")
|
||||
val roomName: StateFlow<String> = _roomName
|
||||
private val _password = MutableStateFlow("")
|
||||
val password: StateFlow<String> = _password
|
||||
private val _conversationDescription = MutableStateFlow("")
|
||||
val conversationDescription: StateFlow<String> = _conversationDescription
|
||||
var isGuestsAllowed = mutableStateOf(false)
|
||||
@ -50,6 +52,10 @@ class ConversationCreationViewModel @Inject constructor(
|
||||
_roomName.value = roomName
|
||||
}
|
||||
|
||||
fun updatePassword(password: String) {
|
||||
_password.value = password
|
||||
}
|
||||
|
||||
fun updateConversationDescription(conversationDescription: String) {
|
||||
_conversationDescription.value = conversationDescription
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user