diff --git a/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/main/settings/SettingsDurationValidityScreen.kt b/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/main/settings/SettingsDurationValidityScreen.kt
index f61d89bc6..f2cedc951 100644
--- a/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/main/settings/SettingsDurationValidityScreen.kt
+++ b/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/main/settings/SettingsDurationValidityScreen.kt
@@ -48,7 +48,8 @@ fun SettingsValidityPeriodScreen() {
enum class ValidityPeriod(
override val title: @Composable () -> String,
- override val icon: ImageVector? = null
+ override val imageVector: ImageVector? = null,
+ override val imageVectorResId: Int? = null,
) : SettingOption {
THIRTY({ pluralStringResource(R.plurals.settingsValidityPeriodValue, 30, 30) }),
FIFTEEN({ pluralStringResource(R.plurals.settingsValidityPeriodValue, 15, 15) }),
diff --git a/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/main/settings/SettingsEmailLanguageScreen.kt b/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/main/settings/SettingsEmailLanguageScreen.kt
new file mode 100644
index 000000000..ce6d7ffdc
--- /dev/null
+++ b/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/main/settings/SettingsEmailLanguageScreen.kt
@@ -0,0 +1,70 @@
+/*
+ * Infomaniak SwissTransfer - Android
+ * Copyright (C) 2024 Infomaniak Network SA
+ *
+ * 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 com.infomaniak.swisstransfer.ui.screen.main.settings
+
+import androidx.compose.foundation.layout.Column
+import androidx.compose.foundation.rememberScrollState
+import androidx.compose.foundation.verticalScroll
+import androidx.compose.material3.Surface
+import androidx.compose.runtime.Composable
+import androidx.compose.runtime.mutableIntStateOf
+import androidx.compose.runtime.saveable.rememberSaveable
+import androidx.compose.ui.Modifier
+import androidx.compose.ui.graphics.vector.ImageVector
+import androidx.compose.ui.res.stringResource
+import com.infomaniak.swisstransfer.R
+import com.infomaniak.swisstransfer.ui.screen.main.settings.components.SettingOption
+import com.infomaniak.swisstransfer.ui.screen.main.settings.components.SettingTitle
+import com.infomaniak.swisstransfer.ui.screen.main.settings.components.SingleSelectOptions
+import com.infomaniak.swisstransfer.ui.theme.SwissTransferTheme
+import com.infomaniak.swisstransfer.ui.utils.PreviewMobile
+import com.infomaniak.swisstransfer.ui.utils.PreviewTablet
+
+@Composable
+fun SettingsEmailLanguageScreen() {
+ Column(modifier = Modifier.verticalScroll(rememberScrollState())) {
+ SettingTitle(titleRes = R.string.settingsEmailLanguageTitle)
+
+ val (selectedItem, setSelectedItem) = rememberSaveable { mutableIntStateOf(0) } // TODO: Use DataStore or Realm
+ SingleSelectOptions(EmailLanguage.entries, { selectedItem }, setSelectedItem)
+ }
+}
+
+enum class EmailLanguage(
+ override val title: @Composable () -> String,
+ override val imageVector: ImageVector? = null,
+ override val imageVectorResId: Int? = null
+) : SettingOption {
+ ENGLISH({ stringResource(R.string.settingsEmailLanguageValueEnglish) }, imageVectorResId = R.drawable.flag_gb),
+ FRENCH({ stringResource(R.string.settingsEmailLanguageValueFrench) }, imageVectorResId = R.drawable.flag_fr),
+ GERMAN({ stringResource(R.string.settingsEmailLanguageValueGerman) }, imageVectorResId = R.drawable.flag_ge),
+ ITALIAN({ stringResource(R.string.settingsEmailLanguageValueItalian) }, imageVectorResId = R.drawable.flag_it),
+ SPANISH({ stringResource(R.string.settingsEmailLanguageValueSpanish) }, imageVectorResId = R.drawable.flag_es),
+}
+
+@PreviewMobile
+@PreviewTablet
+@Composable
+private fun SettingsThemeScreenPreview() {
+ SwissTransferTheme {
+ Surface {
+ SettingsEmailLanguageScreen()
+ }
+ }
+}
diff --git a/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/main/settings/SettingsScreen.kt b/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/main/settings/SettingsScreen.kt
index 4c526d6a4..0e7ff529c 100644
--- a/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/main/settings/SettingsScreen.kt
+++ b/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/main/settings/SettingsScreen.kt
@@ -108,7 +108,7 @@ private fun DetailPane(navigator: ThreePaneScaffoldNavigator SettingsThemeScreen()
VALIDITY_PERIOD -> SettingsValidityPeriodScreen()
DOWNLOAD_LIMIT -> Unit
- EMAIL_LANGUAGE -> Unit
+ EMAIL_LANGUAGE -> SettingsEmailLanguageScreen()
NOTIFICATIONS,
DISCOVER_INFOMANIAK,
SHARE_IDEAS,
diff --git a/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/main/settings/SettingsThemeScreen.kt b/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/main/settings/SettingsThemeScreen.kt
index f34ba7d3a..66759eb8b 100644
--- a/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/main/settings/SettingsThemeScreen.kt
+++ b/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/main/settings/SettingsThemeScreen.kt
@@ -52,7 +52,11 @@ fun SettingsThemeScreen() {
}
}
-enum class ThemeOption(override val title: @Composable () -> String, override val icon: ImageVector) : SettingOption {
+enum class ThemeOption(
+ override val title: @Composable () -> String,
+ override val imageVector: ImageVector,
+ override val imageVectorResId: Int? = null
+) : SettingOption {
SYSTEM({ stringResource(R.string.settingsOptionThemeSystem) }, AppIcons.BlackAndWhiteCircle),
LIGHT({ stringResource(R.string.settingsOptionThemeLight) }, AppIcons.WhiteCircle),
DARK({ stringResource(R.string.settingsOptionThemeDark) }, AppIcons.BlackCircle),
diff --git a/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/main/settings/components/SingleSelectOptions.kt b/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/main/settings/components/SingleSelectOptions.kt
index 8f77bfc4a..6518bc512 100644
--- a/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/main/settings/components/SingleSelectOptions.kt
+++ b/app/src/main/java/com/infomaniak/swisstransfer/ui/screen/main/settings/components/SingleSelectOptions.kt
@@ -35,6 +35,7 @@ import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.res.stringResource
+import androidx.compose.ui.res.vectorResource
import androidx.compose.ui.tooling.preview.Preview
import com.infomaniak.swisstransfer.R
import com.infomaniak.swisstransfer.ui.components.SharpRippleButton
@@ -91,7 +92,11 @@ private fun SettingOptionItem(item: SettingOption, isSelected: Boolean, onClick:
interface SettingOption {
val title: @Composable () -> String
+ val imageVector: ImageVector?
+ val imageVectorResId: Int?
+
val icon: ImageVector?
+ @Composable get() = imageVector ?: imageVectorResId?.let { ImageVector.vectorResource(it) }
}
@Preview(name = "Light")
@@ -103,7 +108,8 @@ private fun SettingOptionItemPreview() {
Column {
val item = object : SettingOption {
override val title: @Composable () -> String = { stringResource(R.string.appName) }
- override val icon: ImageVector = AppIcons.Add
+ override val imageVector: ImageVector = AppIcons.Add
+ override val imageVectorResId = null
}
SettingOptionItem(item, true) {}
SettingOptionItem(item, false) {}
diff --git a/app/src/main/res/drawable/flag_es.xml b/app/src/main/res/drawable/flag_es.xml
new file mode 100644
index 000000000..43f3bf421
--- /dev/null
+++ b/app/src/main/res/drawable/flag_es.xml
@@ -0,0 +1,2213 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/drawable/flag_fr.xml b/app/src/main/res/drawable/flag_fr.xml
new file mode 100644
index 000000000..7a2ab8813
--- /dev/null
+++ b/app/src/main/res/drawable/flag_fr.xml
@@ -0,0 +1,22 @@
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/drawable/flag_gb.xml b/app/src/main/res/drawable/flag_gb.xml
new file mode 100644
index 000000000..af86fadce
--- /dev/null
+++ b/app/src/main/res/drawable/flag_gb.xml
@@ -0,0 +1,49 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/drawable/flag_ge.xml b/app/src/main/res/drawable/flag_ge.xml
new file mode 100644
index 000000000..a5a3b7e78
--- /dev/null
+++ b/app/src/main/res/drawable/flag_ge.xml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/drawable/flag_it.xml b/app/src/main/res/drawable/flag_it.xml
new file mode 100644
index 000000000..105424d2d
--- /dev/null
+++ b/app/src/main/res/drawable/flag_it.xml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml
index 99b6685b6..643f11f3a 100644
--- a/app/src/main/res/values-de/strings.xml
+++ b/app/src/main/res/values-de/strings.xml
@@ -31,6 +31,12 @@
General
Wähle Sie eine Präferenz
Entdecken Sie Infomaniak
+ Legt eine Standardsprache für Ihre Weiterleitungen per E-Mail fest
+ Englisch
+ Deutsch
+ Deutsch
+ Italienisch
+ Spanisch
Limit für Downloads
Sprache der E-Mail
Gib deine Meinung ab
diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml
index 892c96312..312c740ce 100644
--- a/app/src/main/res/values-es/strings.xml
+++ b/app/src/main/res/values-es/strings.xml
@@ -29,6 +29,12 @@
Quiénes somos
Ajustes por defecto
General
+ Establecer un idioma por defecto para las transferencias de correo electrónico
+ Inglés
+ Francés
+ Alemán
+ Italiano
+ Español
Seleccione una preferencia
Descubrir Infomaniak
Límite de descarga
diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml
index fdb9f01ed..b03708575 100644
--- a/app/src/main/res/values-fr/strings.xml
+++ b/app/src/main/res/values-fr/strings.xml
@@ -29,6 +29,12 @@
A propos
Paramètres par défaut
Général
+ Défini une langue par défaut pour vos transferts par e-mail
+ Anglais
+ Francais
+ Allemand
+ Italien
+ Espagnol
Sélectionne une préférence
Découvrir Infomaniak
Limite de téléchargements
diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml
index 1dcdc54d5..5c0093fa6 100644
--- a/app/src/main/res/values-it/strings.xml
+++ b/app/src/main/res/values-it/strings.xml
@@ -30,6 +30,12 @@
Impostazioni predefinite
Generale
Selezionare una preferenza
+ Impostare una lingua predefinita per i trasferimenti di e-mail
+ Inglese
+ Francese
+ Tedesco
+ Italiano
+ Spagnolo
Scoprire Infomaniak
Limite di download
Lingua della posta elettronica
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 9292bcec9..7cca02079 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -32,6 +32,12 @@
About
Default settings
Général
+ Set a default language for your email transfers
+ English
+ French
+ German
+ Italian
+ Spanish
Select a preference
Discover Infomaniak
Download limit