android: add google and foss build flavors (#7328)

* android: add google and foss build flavors

* android: get the Google Play account country in the google flavor

* android, desktop: update whats new

* temp: comment out wefunder link
This commit is contained in:
sh
2026-08-12 15:28:59 +01:00
committed by GitHub
parent 486c2abf26
commit 0a61b0ddea
24 changed files with 235 additions and 70 deletions
@@ -1,5 +1,7 @@
package chat.simplex.common.platform
import androidx.compose.runtime.MutableState
import androidx.compose.runtime.mutableStateOf
import chat.simplex.common.BuildConfigCommon
import chat.simplex.common.model.*
import chat.simplex.common.ui.theme.DefaultTheme
@@ -30,6 +32,9 @@ else
val databaseBackend: String = if (appPlatform == AppPlatform.ANDROID) "sqlite" else BuildConfigCommon.DATABASE_BACKEND
// Country of the Google Play account, only set in the google flavor of the Android app
val androidPlayStoreCountry: MutableState<String?> = mutableStateOf(null)
class FifoQueue<E>(private var capacity: Int) : LinkedList<E>() {
override fun add(element: E): Boolean {
if (size > capacity) removeFirstOrNull()
@@ -29,7 +29,11 @@ interface PlatformInterface {
fun androidRestartNetworkObserver() {}
fun androidCreateActiveCallState(): Closeable = Closeable { }
fun androidIsXiaomiDevice(): Boolean = false
// Requests the Google Play account country into [androidPlayStoreCountry]
fun androidLoadPlayStoreCountry() {}
val androidApiLevel: Int? get() = null
// The build distributed via Google Play, which has to follow its policies
val androidIsPlayStoreBuild: Boolean get() = false
@Composable fun androidLockPortraitOrientation() {}
suspend fun androidAskToAllowBackgroundCalls(): Boolean = true
@Composable fun desktopShowAppUpdateNotice() {}
@@ -183,6 +183,8 @@ fun ChatListView(chatModel: ChatModel, userPickerState: MutableStateFlow<Animate
val showWhatsNew = shouldShowWhatsNew(chatModel)
val showUpdatedConditions = chatModel.conditions.value.conditionsAction?.shouldShowNotice ?: false
if (showWhatsNew || showUpdatedConditions) {
// Requested here, so that the country is known by the time the modal opens
platform.androidLoadPlayStoreCountry()
delay(1000L)
ModalManager.center.showCustomModal { close -> WhatsNewView(close = close, updatedConditions = showUpdatedConditions) }
}
@@ -19,6 +19,7 @@ import androidx.compose.ui.platform.LocalClipboardManager
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import chat.simplex.common.BuildConfigCommon
import chat.simplex.common.model.ChatController.appPrefs
import chat.simplex.common.model.ChatModel
import chat.simplex.common.model.*
@@ -916,6 +917,11 @@ private val versionDescriptions: List<VersionDescription> = listOf(
version = "v7.0",
post = null,
features = listOf(
// VersionFeature.FeatureView(
// icon = null,
// titleId = MR.strings.v7_0_invest,
// view = { _ -> InvestInSimpleXChatView() }
// ),
VersionFeature.FeatureDescription(
icon = MR.images.ic_alternate_email,
titleId = MR.strings.v7_0_simplex_names,
@@ -950,6 +956,58 @@ fun shouldShowWhatsNew(m: ChatModel): Boolean {
return v != lastVersion
}
// private const val WEFUNDER_URL = "https://wefunder.com/simplexchat"
//
// @Composable
// private fun InvestInSimpleXChatView() {
// if (platform.androidIsPlayStoreBuild) {
// LaunchedEffect(Unit) { if (androidPlayStoreCountry.value == null) platform.androidLoadPlayStoreCountry() }
// if (androidPlayStoreCountry.value != "US") return
// }
// val uriHandler = LocalUriHandler.current
// Row(horizontalArrangement = Arrangement.spacedBy(8.dp), modifier = Modifier.padding(bottom = 12.dp)) {
// Column(modifier = Modifier.weight(1f)) {
// Row(
// verticalAlignment = Alignment.CenterVertically,
// horizontalArrangement = Arrangement.spacedBy(8.dp),
// modifier = Modifier.padding(bottom = 4.dp)
// ) {
// Icon(painterResource(MR.images.ic_redeem), stringResource(MR.strings.v7_0_invest), tint = MaterialTheme.colors.secondary)
// Text(
// generalGetString(MR.strings.v7_0_invest),
// maxLines = 2,
// overflow = TextOverflow.Ellipsis,
// style = MaterialTheme.typography.h4,
// fontWeight = FontWeight.Medium,
// modifier = Modifier.padding(bottom = 6.dp)
// )
// }
// Text(generalGetString(MR.strings.v7_0_invest_descr), fontSize = 15.sp, modifier = Modifier.padding(bottom = 4.dp))
// Row(
// verticalAlignment = Alignment.CenterVertically,
// horizontalArrangement = Arrangement.spacedBy(8.dp),
// modifier = Modifier
// .clickable(
// interactionSource = remember { MutableInteractionSource() },
// indication = null
// ) {
// uriHandler.openExternalLink(WEFUNDER_URL)
// }
// ) {
// Text(stringResource(MR.strings.v7_0_invest_learn_more), color = MaterialTheme.colors.primary, fontSize = 15.sp)
// Icon(painterResource(MR.images.ic_open_in_new), stringResource(MR.strings.v7_0_invest_learn_more), tint = MaterialTheme.colors.primary)
// }
// }
// if (BuildConfigCommon.SIMPLEX_ASSETS) {
// Image(
// painterResource(if (isInDarkTheme()) MR.images.own_stake_light else MR.images.own_stake),
// contentDescription = null,
// modifier = Modifier.width(80.dp)
// )
// }
// }
// }
@Composable
fun CreateUpdateAddressShortLinkView(modalManager: ModalManager) {
val clipboard = LocalClipboardManager.current
@@ -22,7 +22,6 @@ import dev.icerock.moko.resources.compose.stringResource
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.*
import chat.simplex.common.BuildConfigCommon
import chat.simplex.common.model.*
import chat.simplex.common.model.ChatController.appPrefs
import chat.simplex.common.platform.*
@@ -143,7 +142,7 @@ fun HelpAndSupportView(
SectionDividerSpaced()
SectionView(stringResource(MR.strings.settings_section_title_support_project)) {
if (!BuildConfigCommon.ANDROID_BUNDLE) {
if (!platform.androidIsPlayStoreBuild) {
ContributeItem(uriHandler)
}
if (appPlatform.isAndroid) {
@@ -2736,6 +2736,9 @@
<string name="v6_5_safe_web_links_descr">- opt-in to send link previews.\n- use SOCKS proxy if enabled.\n- prevent hyperlink phishing.\n- remove link tracking.</string>
<string name="v6_5_non_profit_governance">Non-profit governance</string>
<string name="v6_5_non_profit_governance_descr">To make SimpleX Network last.</string>
<!-- <string name="v7_0_invest">Invest in SimpleX Chat</string> -->
<!-- <string name="v7_0_invest_descr">Equity crowdfunding launched!</string> -->
<!-- <string name="v7_0_invest_learn_more">Learn more on Wefunder</string> -->
<string name="v7_0_simplex_names">SimpleX public names (BETA)</string>
<string name="v7_0_simplex_names_descr">Public names for your channel or business.</string>
<string name="v7_0_channels">Better channels 📢</string>
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
<rect width="24" height="24" fill="none"/>
</svg>

After

Width:  |  Height:  |  Size: 175 B

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

After

Width:  |  Height:  |  Size: 175 B