Added logic to be buildable without extra assets folder. Still have some issues

This commit is contained in:
hayk888997
2026-04-04 18:37:01 +04:00
parent e7bc20db82
commit a2d01cd6bd
15 changed files with 104 additions and 69 deletions
+9 -1
View File
@@ -11,6 +11,9 @@ plugins {
group = "chat.simplex"
version = extra["android.version_name"] as String
val simplexArtLightResources = rootProject.rootDir.resolve("../../../simplex-chat-art/multiplatform/light")
val simplexArtRepoPresent = simplexArtLightResources.isDirectory
kotlin {
androidTarget()
jvm("desktop")
@@ -31,7 +34,11 @@ kotlin {
}
val commonMain by getting {
resources.srcDir(rootProject.rootDir.resolve("../../../simplex-chat-art/multiplatform/light"))
if (simplexArtRepoPresent) {
resources.srcDir(simplexArtLightResources)
} else {
resources.srcDir("src/commonMain/resourcesFallbackArt")
}
dependencies {
api(compose.runtime)
api(compose.foundation)
@@ -161,6 +168,7 @@ buildConfig {
buildConfigField("int", "DESKTOP_VERSION_CODE", "${extra["desktop.version_code"]}")
buildConfigField("String", "DATABASE_BACKEND", "\"${extra["database.backend"]}\"")
buildConfigField("Boolean", "ANDROID_BUNDLE", "${extra["android.bundle"]}")
buildConfigField("Boolean", "FULL_INVITATION_IMAGES", "$simplexArtRepoPresent")
}
}
@@ -37,38 +37,40 @@ fun ConnectBannerCard(onInviteClick: () -> Unit, onScanPasteClick: () -> Unit) {
modifier = Modifier.fillMaxWidth()
) {
Column {
Row(
Modifier.fillMaxWidth(),
horizontalArrangement = Arrangement.SpaceEvenly
) {
Box(
modifier = Modifier
.weight(1f)
.aspectRatio(1.6f)
.clickable { onInviteClick() },
if (fullInvitationArtAvailable) {
Row(
Modifier.fillMaxWidth(),
horizontalArrangement = Arrangement.SpaceEvenly
) {
Image(
painterResource(MR.images.ic_invitation_card_invite_someone),
contentDescription = stringResource(MR.strings.create_link_or_qr),
modifier = Modifier.fillMaxSize(),
contentScale = ContentScale.Crop
)
}
Box(
modifier = Modifier
.weight(1f)
.aspectRatio(1.6f)
.clickable { onScanPasteClick() },
) {
Image(
painterResource(MR.images.ic_invitation_card_one_time_link),
contentDescription = stringResource(MR.strings.paste_link_scan),
modifier = Modifier.fillMaxSize(),
contentScale = ContentScale.Crop
)
Box(
modifier = Modifier
.weight(1f)
.aspectRatio(1.6f)
.clickable { onInviteClick() },
) {
Image(
painterResource(MR.images.ic_invitation_card_invite_someone),
contentDescription = stringResource(MR.strings.create_link_or_qr),
modifier = Modifier.fillMaxSize(),
contentScale = ContentScale.Crop
)
}
Box(
modifier = Modifier
.weight(1f)
.aspectRatio(1.6f)
.clickable { onScanPasteClick() },
) {
Image(
painterResource(MR.images.ic_invitation_card_one_time_link),
contentDescription = stringResource(MR.strings.paste_link_scan),
modifier = Modifier.fillMaxSize(),
contentScale = ContentScale.Crop
)
}
}
Divider(color = MaterialTheme.colors.onSurface.copy(alpha = 0.06f))
}
Divider(color = MaterialTheme.colors.onSurface.copy(alpha = 0.06f))
Row(
Modifier.fillMaxWidth().padding(vertical = DEFAULT_PADDING_HALF),
horizontalArrangement = Arrangement.SpaceEvenly
@@ -50,16 +50,18 @@ fun ModalData.ConnectViewLinkOrQrModal(rhId: Long?, close: () -> Unit) {
.verticalScroll(rememberScrollState()),
horizontalAlignment = Alignment.CenterHorizontally
) {
Spacer(Modifier.height(24.dp))
Image(
painterResource(MR.images.ic_invitation_connect_link),
contentDescription = null,
contentScale = ContentScale.Fit,
modifier = Modifier.size(160.dp)
)
Spacer(Modifier.height(24.dp))
if (fullInvitationArtAvailable) {
Spacer(Modifier.height(24.dp))
Image(
painterResource(MR.images.ic_invitation_connect_link),
contentDescription = null,
contentScale = ContentScale.Fit,
modifier = Modifier.size(160.dp)
)
Spacer(Modifier.height(24.dp))
} else {
Spacer(Modifier.height(16.dp))
}
SectionView(
title = stringResource(MR.strings.paste_the_link_you_received).uppercase(),
@@ -0,0 +1,10 @@
package chat.simplex.common.views.invitation_redesign
import chat.simplex.common.BuildConfigCommon
/**
* True when `simplex-chat-art/multiplatform/light` was present at build time (see `common/build.gradle.kts`).
* When false, resources come from placeholder SVGs — decorative invitation hero images must not be shown.
*/
internal val fullInvitationArtAvailable: Boolean
get() = BuildConfigCommon.FULL_INVITATION_IMAGES
@@ -41,12 +41,16 @@ fun InvitationCardView(
Modifier.fillMaxWidth().padding(bottom = DEFAULT_PADDING_HALF),
horizontalAlignment = Alignment.CenterHorizontally
) {
Image(
painterResource(mainImageResource),
contentDescription = null,
modifier = Modifier.fillMaxWidth()
)
Spacer(Modifier.height(DEFAULT_PADDING_HALF))
if (fullInvitationArtAvailable) {
Image(
painterResource(mainImageResource),
contentDescription = null,
modifier = Modifier.fillMaxWidth()
)
Spacer(Modifier.height(DEFAULT_PADDING_HALF))
} else {
Spacer(Modifier.height(DEFAULT_PADDING_HALF))
}
Row(verticalAlignment = Alignment.CenterVertically) {
Icon(
painterResource(iconResource),
@@ -69,4 +73,4 @@ fun InvitationCardView(
}
}
}
}
}
@@ -61,7 +61,7 @@ fun InviteCardComponent(
Modifier.fillMaxWidth(),
horizontalAlignment = Alignment.CenterHorizontally
) {
if (SHOW_PICTURES) {
if (fullInvitationArtAvailable) {
Image(
image,
contentDescription = null,
@@ -40,10 +40,10 @@ fun EmptyChatListView(onConnectClick: () -> Unit, onOneTimeLinkClick: () -> Unit
style = MaterialTheme.typography.h1.copy(fontWeight = FontWeight.Bold),
)
Spacer(Modifier.height(DEFAULT_PADDING))
if (SHOW_PICTURES) {
InviteSomeoneWithPicturesContent(onOneTimeLinkClick = onOneTimeLinkClick)
if (fullInvitationArtAvailable) {
InviteSomeoneWithPicturesContent(onOneTimeLinkClick = onOneTimeLinkClick)
} else {
InviteSomeoneContent()
InviteSomeoneContent()
}
SectionBottomSpacer()
}
@@ -166,15 +166,16 @@ fun OneTimeLinkBottomSheetContent(connLinkInvitation: CreatedConnLink) {
) {
Spacer(Modifier.height(DEFAULT_PADDING))
Image(
painterResource(MR.images.ic_invitation_one_time_link),
contentDescription = null,
modifier = Modifier
.fillMaxWidth()
.padding(horizontal = DEFAULT_PADDING * 3)
)
Spacer(Modifier.height(DEFAULT_PADDING))
if (fullInvitationArtAvailable) {
Image(
painterResource(MR.images.ic_invitation_one_time_link),
contentDescription = null,
modifier = Modifier
.fillMaxWidth()
.padding(horizontal = DEFAULT_PADDING * 3)
)
Spacer(Modifier.height(DEFAULT_PADDING))
}
Text(
stringResource(MR.strings.send_1_time_link_description),
@@ -235,15 +236,16 @@ fun OneTimeLinkContent(connLinkInvitation: CreatedConnLink) {
) {
Spacer(Modifier.height(DEFAULT_PADDING))
Image(
painterResource(MR.images.ic_invitation_one_time_link),
contentDescription = null,
modifier = Modifier
.fillMaxWidth()
.padding(horizontal = DEFAULT_PADDING * 3)
)
Spacer(Modifier.height(DEFAULT_PADDING))
if (fullInvitationArtAvailable) {
Image(
painterResource(MR.images.ic_invitation_one_time_link),
contentDescription = null,
modifier = Modifier
.fillMaxWidth()
.padding(horizontal = DEFAULT_PADDING * 3)
)
Spacer(Modifier.height(DEFAULT_PADDING))
}
Text(
stringResource(MR.strings.send_1_time_link_description),
@@ -0,0 +1 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"/>

After

Width:  |  Height:  |  Size: 139 B

@@ -0,0 +1 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"/>

After

Width:  |  Height:  |  Size: 139 B

@@ -0,0 +1 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"/>

After

Width:  |  Height:  |  Size: 139 B

@@ -0,0 +1 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"/>

After

Width:  |  Height:  |  Size: 139 B

@@ -0,0 +1 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"/>

After

Width:  |  Height:  |  Size: 139 B

@@ -0,0 +1 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"/>

After

Width:  |  Height:  |  Size: 139 B

@@ -0,0 +1 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"/>

After

Width:  |  Height:  |  Size: 139 B