From f2c9d05968a06f8fa4639ec2420aae218d5b7cf3 Mon Sep 17 00:00:00 2001 From: James Rich <2199651+jamesarich@users.noreply.github.com> Date: Wed, 8 Oct 2025 20:04:34 -0500 Subject: [PATCH] feat(#3409): Add analytics notice to welcome screen (#3410) Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com> --- core/strings/src/main/res/values/strings.xml | 8 +++ .../core/ui/component/AutoLinkText.kt | 6 -- feature/intro/build.gradle.kts | 1 + .../feature/intro/AnalyticsIntro.kt | 25 ++++++++ .../feature/intro/AnalyticsIntro.kt | 60 +++++++++++++++++++ .../meshtastic/feature/intro/WelcomeScreen.kt | 9 +++ 6 files changed, 103 insertions(+), 6 deletions(-) create mode 100644 feature/intro/src/fdroid/kotlin/org/meshtastic/feature/intro/AnalyticsIntro.kt create mode 100644 feature/intro/src/google/kotlin/org/meshtastic/feature/intro/AnalyticsIntro.kt diff --git a/core/strings/src/main/res/values/strings.xml b/core/strings/src/main/res/values/strings.xml index b3b91127d..395896378 100644 --- a/core/strings/src/main/res/values/strings.xml +++ b/core/strings/src/main/res/values/strings.xml @@ -929,4 +929,12 @@ No application available to handle link. System Settings No Stats Available + + + Analytics are collected to help us improve the Android app (thank you), we will receive anonymized information about user behavior. This includes crash reports, screens used in the app, etc. + "Analytics platforms: " + Firebase https://firebase.google.com/ + Datadog https://www.datadoghq.com/ + For more information, see our privacy policy. + " https://meshtastic.org/docs/legal/privacy/" diff --git a/core/ui/src/main/kotlin/org/meshtastic/core/ui/component/AutoLinkText.kt b/core/ui/src/main/kotlin/org/meshtastic/core/ui/component/AutoLinkText.kt index e9f14b8b6..d18d751db 100644 --- a/core/ui/src/main/kotlin/org/meshtastic/core/ui/component/AutoLinkText.kt +++ b/core/ui/src/main/kotlin/org/meshtastic/core/ui/component/AutoLinkText.kt @@ -82,9 +82,3 @@ private fun Spannable.toAnnotatedString(linkStyles: TextLinkStyles): AnnotatedSt private fun AutoLinkTextPreview() { AutoLinkText("A text containing a link https://example.com") } - -@Preview(showBackground = true) -@Composable -private fun AutoLinkTextPreview2() { - AutoLinkText("") -} diff --git a/feature/intro/build.gradle.kts b/feature/intro/build.gradle.kts index fc6fce362..2f930e7e7 100644 --- a/feature/intro/build.gradle.kts +++ b/feature/intro/build.gradle.kts @@ -26,6 +26,7 @@ android { namespace = "org.meshtastic.feature.intro" } dependencies { implementation(projects.core.strings) + googleImplementation(projects.core.ui) implementation(libs.accompanist.permissions) implementation(libs.androidx.compose.material.iconsExtended) diff --git a/feature/intro/src/fdroid/kotlin/org/meshtastic/feature/intro/AnalyticsIntro.kt b/feature/intro/src/fdroid/kotlin/org/meshtastic/feature/intro/AnalyticsIntro.kt new file mode 100644 index 000000000..def21ab01 --- /dev/null +++ b/feature/intro/src/fdroid/kotlin/org/meshtastic/feature/intro/AnalyticsIntro.kt @@ -0,0 +1,25 @@ +/* + * Copyright (c) 2025 Meshtastic LLC + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package org.meshtastic.feature.intro + +import androidx.compose.runtime.Composable + +@Composable +fun AnalyticsIntro() { + // no-op for fdroid +} diff --git a/feature/intro/src/google/kotlin/org/meshtastic/feature/intro/AnalyticsIntro.kt b/feature/intro/src/google/kotlin/org/meshtastic/feature/intro/AnalyticsIntro.kt new file mode 100644 index 000000000..786966ba7 --- /dev/null +++ b/feature/intro/src/google/kotlin/org/meshtastic/feature/intro/AnalyticsIntro.kt @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2025 Meshtastic LLC + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package org.meshtastic.feature.intro + +import androidx.compose.foundation.layout.Arrangement +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.material3.Text +import androidx.compose.runtime.Composable +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.res.stringResource +import androidx.compose.ui.text.style.TextAlign +import androidx.compose.ui.tooling.preview.Preview +import androidx.compose.ui.unit.dp +import org.meshtastic.core.strings.R +import org.meshtastic.core.ui.component.AutoLinkText + +@Composable +fun AnalyticsIntro(modifier: Modifier = Modifier) { + Column( + modifier = modifier.fillMaxWidth(), + horizontalAlignment = Alignment.CenterHorizontally, + verticalArrangement = Arrangement.spacedBy(8.dp), + ) { + val textModifier = Modifier.fillMaxWidth().align(Alignment.CenterHorizontally) + Text(modifier = textModifier, textAlign = TextAlign.Center, text = stringResource(R.string.analytics_notice)) + Text(modifier = textModifier, textAlign = TextAlign.Center, text = stringResource(R.string.analytics_platforms)) + AutoLinkText(stringResource(R.string.firebase_link)) + AutoLinkText(stringResource(R.string.datadog_link)) + + Text( + modifier = textModifier, + textAlign = TextAlign.Center, + text = stringResource(R.string.for_more_information_see_our_privacy_policy), + ) + AutoLinkText(text = stringResource(R.string.privacy_url)) + } +} + +@Preview(showBackground = true) +@Composable +private fun AnalyticsIntroPreview() { + AnalyticsIntro() +} diff --git a/feature/intro/src/main/kotlin/org/meshtastic/feature/intro/WelcomeScreen.kt b/feature/intro/src/main/kotlin/org/meshtastic/feature/intro/WelcomeScreen.kt index 01a7a3db8..a1be9c359 100644 --- a/feature/intro/src/main/kotlin/org/meshtastic/feature/intro/WelcomeScreen.kt +++ b/feature/intro/src/main/kotlin/org/meshtastic/feature/intro/WelcomeScreen.kt @@ -38,6 +38,7 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.text.style.TextAlign +import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp import org.meshtastic.core.strings.R @@ -99,6 +100,14 @@ internal fun WelcomeScreen(onGetStarted: () -> Unit) { FeatureRow(feature = feature) Spacer(modifier = Modifier.height(16.dp)) } + Spacer(modifier = Modifier.weight(1f)) + AnalyticsIntro() } } } + +@Preview +@Composable +private fun WelcomeScreenPreview() { + WelcomeScreen(onGetStarted = {}) +}