Skip to content

Commit

Permalink
feat: Add tracking Switch for Matomo & Sentry
Browse files Browse the repository at this point in the history
  • Loading branch information
KevinBoulongne committed Oct 15, 2024
1 parent f40ca3e commit d3ef937
Show file tree
Hide file tree
Showing 7 changed files with 61 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,17 @@
package com.infomaniak.swisstransfer.ui.screen.main.settings

import androidx.compose.foundation.Image
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.*
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.verticalScroll
import androidx.compose.material3.Surface
import androidx.compose.material3.Switch
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.saveable.rememberSaveable
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
Expand All @@ -39,10 +43,11 @@ import com.infomaniak.swisstransfer.ui.theme.SwissTransferTheme
import com.infomaniak.swisstransfer.ui.utils.PreviewSmallWindow

@Composable
fun SettingsDataManagementMatomoScreen(
navigateBack: (() -> Unit)?,
// onItemClick: (SettingsOptionScreens) -> Unit,
) {
fun SettingsDataManagementMatomoScreen(navigateBack: (() -> Unit)?) {

// TODO: Use real value from Realm, and save it to Realm / anywhere else too.
var isMatomoAuthorized by rememberSaveable { mutableStateOf(true) }

SmallWindowTopAppBarScaffold(
smallWindowTopAppBar = {
SwissTransferTopAppBar(
Expand All @@ -66,6 +71,23 @@ fun SettingsDataManagementMatomoScreen(
color = SwissTransferTheme.colors.primaryTextColor,
modifier = Modifier.padding(Margin.Medium),
)
Row(
modifier = Modifier
.fillMaxWidth()
.padding(Margin.Medium),
verticalAlignment = Alignment.CenterVertically,
) {
Text(
text = stringResource(R.string.settingsAuthorizeTracking),
style = SwissTransferTheme.typography.bodyRegular,
color = SwissTransferTheme.colors.primaryTextColor,
)
Spacer(Modifier.weight(1.0f))
Switch(
checked = isMatomoAuthorized,
onCheckedChange = { isMatomoAuthorized = it },
)
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,17 @@
package com.infomaniak.swisstransfer.ui.screen.main.settings

import androidx.compose.foundation.Image
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.*
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.verticalScroll
import androidx.compose.material3.Surface
import androidx.compose.material3.Switch
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.saveable.rememberSaveable
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
Expand All @@ -39,10 +43,11 @@ import com.infomaniak.swisstransfer.ui.theme.SwissTransferTheme
import com.infomaniak.swisstransfer.ui.utils.PreviewSmallWindow

@Composable
fun SettingsDataManagementSentryScreen(
navigateBack: (() -> Unit)?,
// onItemClick: (SettingsOptionScreens) -> Unit,
) {
fun SettingsDataManagementSentryScreen(navigateBack: (() -> Unit)?) {

// TODO: Use real value from Realm, and save it to Realm / anywhere else too.
var isSentryAuthorized by rememberSaveable { mutableStateOf(true) }

SmallWindowTopAppBarScaffold(
smallWindowTopAppBar = {
SwissTransferTopAppBar(
Expand All @@ -66,6 +71,23 @@ fun SettingsDataManagementSentryScreen(
color = SwissTransferTheme.colors.primaryTextColor,
modifier = Modifier.padding(Margin.Medium),
)
Row(
modifier = Modifier
.fillMaxWidth()
.padding(Margin.Medium),
verticalAlignment = Alignment.CenterVertically,
) {
Text(
text = stringResource(R.string.settingsAuthorizeTracking),
style = SwissTransferTheme.typography.bodyRegular,
color = SwissTransferTheme.colors.primaryTextColor,
)
Spacer(Modifier.weight(1.0f))
Switch(
checked = isSentryAuthorized,
onCheckedChange = { isSentryAuthorized = it },
)
}
}
}
}
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values-de/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
<string name="receivedTitle">Empfangen</string>
<string name="sentEmptyTitle">Unsere Geschichte beginnt hier</string>
<string name="sentTitle">Gesendet</string>
<string name="settingsAuthorizeTracking">Verfolgung genehmigen</string>
<string name="settingsCategoryAbout">Über</string>
<string name="settingsCategoryDataManagement">Daten &amp; Datenschutz</string>
<string name="settingsCategoryDefaultSettings">Standardeinstellungen</string>
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values-es/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
<string name="receivedTitle">Recibido</string>
<string name="sentEmptyTitle">Nuestra historia comienza aquí</string>
<string name="sentTitle">Enviado a</string>
<string name="settingsAuthorizeTracking">Autorizar el seguimiento</string>
<string name="settingsCategoryAbout">Quiénes somos</string>
<string name="settingsCategoryDataManagement">Datos y privacidad</string>
<string name="settingsCategoryDefaultSettings">Ajustes por defecto</string>
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values-fr/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
<string name="receivedTitle">Reçu</string>
<string name="sentEmptyTitle">Notre histoire commence ici</string>
<string name="sentTitle">Envoyé</string>
<string name="settingsAuthorizeTracking">Autoriser le suivi</string>
<string name="settingsCategoryAbout">A propos</string>
<string name="settingsCategoryDataManagement">Données &amp; Confidentialité</string>
<string name="settingsCategoryDefaultSettings">Paramètres par défaut</string>
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values-it/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
<string name="receivedTitle">Ricevuto</string>
<string name="sentEmptyTitle">La nostra storia inizia qui</string>
<string name="sentTitle">Inviato a</string>
<string name="settingsAuthorizeTracking">Autorizza il tracciamento</string>
<string name="settingsCategoryAbout">Chi siamo</string>
<string name="settingsCategoryDataManagement">Dati e privacy</string>
<string name="settingsCategoryDefaultSettings">Impostazioni predefinite</string>
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
<string name="receivedTitle">Received</string>
<string name="sentEmptyTitle">Our story begins here</string>
<string name="sentTitle">Sent</string>
<string name="settingsAuthorizeTracking">Authorize tracking</string>
<string name="settingsCategoryAbout">About</string>
<string name="settingsCategoryDataManagement">Data &amp; Privacy</string>
<string name="settingsCategoryDefaultSettings">Default settings</string>
Expand Down

0 comments on commit d3ef937

Please sign in to comment.