mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-05-25 16:24:27 +00:00
Added "Invite someone" screen state without images.
This commit is contained in:
+122
-42
@@ -3,6 +3,7 @@ package chat.simplex.common.views.invitation_redesign
|
||||
import androidx.compose.foundation.Image
|
||||
import androidx.compose.foundation.clickable
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.Spacer
|
||||
@@ -12,8 +13,11 @@ import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.size
|
||||
import androidx.compose.foundation.layout.width
|
||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||
import androidx.compose.material.Button
|
||||
import androidx.compose.material.ButtonDefaults
|
||||
import androidx.compose.material.Card
|
||||
import androidx.compose.material.Icon
|
||||
import androidx.compose.material.IconButton
|
||||
import androidx.compose.material.MaterialTheme
|
||||
import androidx.compose.material.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
@@ -26,6 +30,11 @@ import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import chat.simplex.common.ui.theme.DEFAULT_PADDING
|
||||
import chat.simplex.res.MR
|
||||
import dev.icerock.moko.resources.compose.painterResource
|
||||
import dev.icerock.moko.resources.compose.stringResource
|
||||
|
||||
const val SHOW_PICTURES = false
|
||||
|
||||
@Composable
|
||||
fun InviteCardComponent(
|
||||
@@ -33,6 +42,9 @@ fun InviteCardComponent(
|
||||
titleIcon: Painter,
|
||||
title: String,
|
||||
description: String? = null,
|
||||
bulletPoints: List<String> = emptyList(),
|
||||
buttonText: String? = null,
|
||||
onDismiss: (() -> Unit)? = null,
|
||||
onClick: () -> Unit
|
||||
) {
|
||||
Card(
|
||||
@@ -44,50 +56,118 @@ fun InviteCardComponent(
|
||||
.padding(horizontal = DEFAULT_PADDING)
|
||||
.clickable(onClick = onClick)
|
||||
) {
|
||||
Column(
|
||||
Modifier.fillMaxWidth(),
|
||||
horizontalAlignment = Alignment.CenterHorizontally
|
||||
) {
|
||||
Image(
|
||||
image,
|
||||
contentDescription = null,
|
||||
contentScale = ContentScale.FillWidth,
|
||||
modifier = Modifier.fillMaxWidth()
|
||||
)
|
||||
|
||||
Row(
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
horizontalArrangement = Arrangement.Center,
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(vertical = 16.dp)
|
||||
Box {
|
||||
Column(
|
||||
Modifier.fillMaxWidth(),
|
||||
horizontalAlignment = Alignment.CenterHorizontally
|
||||
) {
|
||||
Icon(
|
||||
titleIcon,
|
||||
contentDescription = null,
|
||||
tint = MaterialTheme.colors.primary,
|
||||
modifier = Modifier.size(24.dp)
|
||||
)
|
||||
Spacer(Modifier.width(8.dp))
|
||||
Text(
|
||||
title,
|
||||
style = MaterialTheme.typography.body1.copy(
|
||||
fontSize = 18.sp,
|
||||
fontWeight = FontWeight.Medium
|
||||
),
|
||||
color = Color.Black
|
||||
)
|
||||
if (SHOW_PICTURES) {
|
||||
Image(
|
||||
image,
|
||||
contentDescription = null,
|
||||
contentScale = ContentScale.FillWidth,
|
||||
modifier = Modifier.fillMaxWidth()
|
||||
)
|
||||
} else {
|
||||
Spacer(Modifier.height(DEFAULT_PADDING))
|
||||
}
|
||||
|
||||
Row(
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
horizontalArrangement = Arrangement.Center,
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(horizontal = DEFAULT_PADDING)
|
||||
) {
|
||||
Icon(
|
||||
titleIcon,
|
||||
contentDescription = null,
|
||||
tint = MaterialTheme.colors.primary,
|
||||
modifier = Modifier.size(24.dp)
|
||||
)
|
||||
Spacer(Modifier.width(8.dp))
|
||||
Text(
|
||||
title,
|
||||
style = MaterialTheme.typography.body1.copy(
|
||||
fontSize = 18.sp,
|
||||
fontWeight = FontWeight.Medium
|
||||
),
|
||||
color = Color.Black
|
||||
)
|
||||
}
|
||||
|
||||
if (description != null) {
|
||||
Spacer(Modifier.height(4.dp))
|
||||
Text(
|
||||
description,
|
||||
style = MaterialTheme.typography.body2.copy(fontSize = 14.sp),
|
||||
color = Color.Gray
|
||||
)
|
||||
}
|
||||
|
||||
if (bulletPoints.isNotEmpty()) {
|
||||
Spacer(Modifier.height(DEFAULT_PADDING))
|
||||
Column(
|
||||
Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(horizontal = DEFAULT_PADDING * 1.5f)
|
||||
) {
|
||||
bulletPoints.forEach { point ->
|
||||
Row(Modifier.padding(bottom = 4.dp)) {
|
||||
Text(
|
||||
"\u2022 ",
|
||||
style = MaterialTheme.typography.body1.copy(fontWeight = FontWeight.Bold),
|
||||
color = Color.Black
|
||||
)
|
||||
Text(
|
||||
point,
|
||||
style = MaterialTheme.typography.body1,
|
||||
color = Color.Black
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (buttonText != null) {
|
||||
Spacer(Modifier.height(DEFAULT_PADDING))
|
||||
Button(
|
||||
onClick = onClick,
|
||||
shape = RoundedCornerShape(20.dp),
|
||||
colors = ButtonDefaults.buttonColors(backgroundColor = MaterialTheme.colors.primary),
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.height(56.dp)
|
||||
.padding(horizontal = DEFAULT_PADDING)
|
||||
) {
|
||||
Text(
|
||||
buttonText,
|
||||
color = Color.White,
|
||||
style = MaterialTheme.typography.body1.copy(
|
||||
fontSize = 17.sp,
|
||||
fontWeight = FontWeight.Medium
|
||||
)
|
||||
)
|
||||
}
|
||||
Spacer(Modifier.height(DEFAULT_PADDING))
|
||||
} else {
|
||||
Spacer(Modifier.height(8.dp))
|
||||
}
|
||||
}
|
||||
if (description != null) {
|
||||
Text(
|
||||
description,
|
||||
style = MaterialTheme.typography.body1.copy(
|
||||
fontSize = 14.sp,
|
||||
fontWeight = FontWeight.Medium
|
||||
),
|
||||
color = Color.Black
|
||||
)
|
||||
Spacer(Modifier.height(8.dp))
|
||||
|
||||
if (!SHOW_PICTURES && onDismiss != null) {
|
||||
IconButton(
|
||||
onClick = onDismiss,
|
||||
modifier = Modifier
|
||||
.align(Alignment.TopEnd)
|
||||
.padding(4.dp)
|
||||
) {
|
||||
Icon(
|
||||
painterResource(MR.images.ic_close),
|
||||
stringResource(MR.strings.back),
|
||||
tint = MaterialTheme.colors.secondary
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+14
@@ -46,6 +46,13 @@ fun InviteSomeoneContent() {
|
||||
titleIcon = painterResource(MR.images.ic_add_link),
|
||||
title = stringResource(MR.strings.create_private_1_time_link),
|
||||
description = stringResource(MR.strings.contact_can_use_link_or_scan_qr),
|
||||
bulletPoints = listOf(
|
||||
stringResource(MR.strings.one_time_link_only_one_person),
|
||||
stringResource(MR.strings.one_time_link_once_connected_removed),
|
||||
stringResource(MR.strings.one_time_link_secure_to_pass)
|
||||
),
|
||||
buttonText = stringResource(MR.strings.create_1_time_link),
|
||||
onDismiss = {},
|
||||
onClick = {
|
||||
ModalManager.start.showModalCloseable { close ->
|
||||
OneTimeLinkView(rhId = chatModel.currentRemoteHost.value?.remoteHostId, close = close)
|
||||
@@ -60,6 +67,13 @@ fun InviteSomeoneContent() {
|
||||
titleIcon = painterResource(MR.images.ic_qr_code),
|
||||
title = stringResource(MR.strings.create_public_simplex_address),
|
||||
description = stringResource(MR.strings.public_link_for_social_media_email_or_website),
|
||||
bulletPoints = listOf(
|
||||
stringResource(MR.strings.address_many_people_can_connect),
|
||||
stringResource(MR.strings.address_removed_without_losing_contacts),
|
||||
stringResource(MR.strings.address_servers_cant_see_profile)
|
||||
),
|
||||
buttonText = stringResource(MR.strings.create_simplex_address),
|
||||
onDismiss = {},
|
||||
onClick = {
|
||||
ModalManager.start.showModalCloseable { close ->
|
||||
OneTimeLinkView(rhId = chatModel.currentRemoteHost.value?.remoteHostId, close = close)
|
||||
|
||||
@@ -469,8 +469,14 @@
|
||||
<string name="contact_can_use_link_or_scan_qr">Your contact can use link or scan QR code</string>
|
||||
<string name="send_1_time_link_description">Send 1-time link to your contact via any messenger, it is secure. Ask to use it in the app.</string>
|
||||
<string name="or_show_qr_code_in_person_or_video_call">Or show this QR code in person or in a video call.</string>
|
||||
<string name="one_time_link_only_one_person">Only one person can connect</string>
|
||||
<string name="one_time_link_once_connected_removed">Once connected, the link is removed</string>
|
||||
<string name="one_time_link_secure_to_pass">It is secure to pass via less secure channel</string>
|
||||
<string name="create_public_simplex_address">Create public SimpleX address</string>
|
||||
<string name="public_link_for_social_media_email_or_website">Public link for social media, email or website</string>
|
||||
<string name="address_many_people_can_connect">Many people can connect</string>
|
||||
<string name="address_removed_without_losing_contacts">Can be removed without losing contacts</string>
|
||||
<string name="address_servers_cant_see_profile">Servers can\'t see profile in the address without having link</string>
|
||||
<string name="loading_chats">Loading chats…</string>
|
||||
<string name="no_filtered_chats">No filtered chats</string>
|
||||
<string name="no_chats_in_list">No chats in list %s.</string>
|
||||
|
||||
Reference in New Issue
Block a user