Skip to content

Commit

Permalink
Fixes #1641
Browse files Browse the repository at this point in the history
  • Loading branch information
mtotschnig committed Feb 1, 2025
1 parent cc0baee commit a0ef5ad
Show file tree
Hide file tree
Showing 78 changed files with 188 additions and 14 deletions.
5 changes: 2 additions & 3 deletions fints/src/main/java/org/totschnig/fints/Banking.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package org.totschnig.fints

import android.app.Activity
import android.os.Bundle
import android.text.SpannableStringBuilder
import android.text.TextUtils
Expand Down Expand Up @@ -249,7 +248,7 @@ class Banking : ProtectedFragmentActivity() {
if (tanRequested.value == null && tanMediumRequested.value == null && pushTanRequested.value == null && secMechRequested.value == null) {
SetupDialog(dialogState, workState.value, bankingCredentials, errorState) {
if (calledFromOnboarding) {
setResult(if (it) Activity.RESULT_OK else Activity.RESULT_CANCELED)
setResult(if (it) RESULT_OK else RESULT_CANCELED)
finish()
} else {
dialogState = DialogState.NoShow
Expand Down Expand Up @@ -412,7 +411,7 @@ class Banking : ProtectedFragmentActivity() {
onValueChange = {
nrDays = try {
it.toLong()
} catch (e: NumberFormatException) {
} catch (_: NumberFormatException) {
0
}
},
Expand Down
43 changes: 32 additions & 11 deletions fints/src/main/java/org/totschnig/fints/Composables.kt
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,16 @@ import androidx.compose.foundation.text.KeyboardOptions
import androidx.compose.foundation.verticalScroll
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.AccountBalance
import androidx.compose.material.icons.filled.Visibility
import androidx.compose.material.icons.filled.VisibilityOff
import androidx.compose.material3.AlertDialog
import androidx.compose.material3.Button
import androidx.compose.material3.Checkbox
import androidx.compose.material3.CircularProgressIndicator
import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.OutlinedTextField
import androidx.compose.material3.OutlinedTextFieldDefaults
import androidx.compose.material3.RadioButton
import androidx.compose.material3.Text
import androidx.compose.material3.minimumInteractiveComponentSize
Expand All @@ -51,6 +53,7 @@ import androidx.compose.ui.semantics.Role
import androidx.compose.ui.text.input.ImeAction
import androidx.compose.ui.text.input.KeyboardType
import androidx.compose.ui.text.input.PasswordVisualTransformation
import androidx.compose.ui.text.input.VisualTransformation
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import kotlinx.coroutines.job
Expand Down Expand Up @@ -103,11 +106,12 @@ fun ColumnScope.BankingCredentials(
}
}
}
var showPassword by remember { mutableStateOf(false) }
OutlinedTextField(
modifier = Modifier
.align(Alignment.CenterHorizontally)
.optional(focusRequester) { this.focusRequester(it) },
visualTransformation = PasswordVisualTransformation(),
visualTransformation = if (showPassword) VisualTransformation.None else PasswordVisualTransformation(),
keyboardOptions = KeyboardOptions(
keyboardType = KeyboardType.Password,
imeAction = ImeAction.Done
Expand All @@ -122,16 +126,31 @@ fun ColumnScope.BankingCredentials(
bankingCredentials.value = credentials.copy(password = it.trim())
},
label = { Text(text = stringResource(id = RB.string.password)) },
singleLine = true
)
// Not using supportingText parameter of OutlinedTextField, because of
// https://issuetracker.google.com/issues/270523016
Text(
modifier = Modifier.width(OutlinedTextFieldDefaults.MinWidth),
text = stringResource(id = R.string.pin_info)
singleLine = true,
supportingText = {
Text(text = stringResource(id = R.string.pin_info))
},
trailingIcon = {
PasswordVisibilityToggleIcon(
showPassword = showPassword,
onTogglePasswordVisibility = { showPassword = !showPassword })
}
)
}

@Composable
fun PasswordVisibilityToggleIcon(
showPassword: Boolean,
onTogglePasswordVisibility: () -> Unit
) {
val image = if (showPassword) Icons.Filled.Visibility else Icons.Filled.VisibilityOff
val contentDescription = stringResource(if (showPassword) RB.string.hide_password else RB.string.show_password)

IconButton(onClick = onTogglePasswordVisibility) {
Icon(imageVector = image, contentDescription = contentDescription)
}
}

@Composable
fun PushTanDialog(pushTanRequest: PushTanRequest?) {
pushTanRequest?.let {
Expand Down Expand Up @@ -172,7 +191,9 @@ fun TanDialog(tanRequest: TanRequest?) {
Text(tanRequest.message)
tanRequest.bitmap?.let {
Image(
modifier = Modifier.height(200.dp).width(200.dp),
modifier = Modifier
.height(200.dp)
.width(200.dp),
bitmap = it.asImageBitmap(),
contentDescription = null
)
Expand Down Expand Up @@ -420,7 +441,7 @@ private fun TanMediaPreview() {
@Preview
@Composable
private fun TanPreview() {
val bmp = createRandomBitmap(50,50)
val bmp = createRandomBitmap(50, 50)
TanDialog(TanRequest("Please scan", bmp) {})
}

Expand Down
2 changes: 2 additions & 0 deletions myExpenses/src/main/res/values-af/aosp.xml
Original file line number Diff line number Diff line change
Expand Up @@ -79,4 +79,6 @@
<string name="enabled">"Geaktiveer"</string>
<string name="disabled">"Gedeaktiveer"</string>
<string name="preview">"Voorskou"</string>
<string name="show_password">"Wys wagwoord"</string>
<string name="hide_password">"Versteek wagwoord"</string>
</resources>
2 changes: 2 additions & 0 deletions myExpenses/src/main/res/values-am/aosp.xml
Original file line number Diff line number Diff line change
Expand Up @@ -78,4 +78,6 @@
<string name="enabled">"ነቅቷል"</string>
<string name="disabled">"ተሰናክሏል"</string>
<string name="preview">"ቅድመ-ዕይታ"</string>
<string name="show_password">"የይለፍ ቃል አሳይ"</string>
<string name="hide_password">"የይለፍ ቃልድ ደብቅ"</string>
</resources>
2 changes: 2 additions & 0 deletions myExpenses/src/main/res/values-ar/aosp.xml
Original file line number Diff line number Diff line change
Expand Up @@ -150,4 +150,6 @@
<string name="enabled">"مفعّل"</string>
<string name="disabled">"غير مفعّل"</string>
<string name="preview">"معاينة"</string>
<string name="show_password">"إظهار كلمة المرور"</string>
<string name="hide_password">"إخفاء كلمة المرور"</string>
</resources>
2 changes: 2 additions & 0 deletions myExpenses/src/main/res/values-az/aosp.xml
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,6 @@
<string name="enabled">"Aktiv edilib"</string>
<string name="disabled">"Deaktiv edilib"</string>
<string name="preview">"Önizləmə"</string>
<string name="show_password">"Parol görünsün"</string>
<string name="hide_password">"Şifrəni gizlət"</string>
</resources>
2 changes: 2 additions & 0 deletions myExpenses/src/main/res/values-b+sr+Latn/aosp.xml
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,6 @@
<string name="menu_create_folder">"Novi folder"</string>
<string name="enabled">"Omogućeno"</string>
<string name="disabled">"Onemogućeno"</string>
<string name="show_password">"Prikaži lozinku"</string>
<string name="hide_password">"Sakrij lozinku"</string>
</resources>
2 changes: 2 additions & 0 deletions myExpenses/src/main/res/values-be/aosp.xml
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,6 @@
<string name="menu_create_folder">"Новая папка"</string>
<string name="enabled">"Уключана"</string>
<string name="disabled">"Выключана"</string>
<string name="show_password">"Паказваць пароль"</string>
<string name="hide_password">"Схаваць пароль"</string>
</resources>
2 changes: 2 additions & 0 deletions myExpenses/src/main/res/values-bg/aosp.xml
Original file line number Diff line number Diff line change
Expand Up @@ -152,4 +152,6 @@
<string name="enabled">"Активирано"</string>
<string name="disabled">"Деактивирано"</string>
<string name="preview">"Визуал."</string>
<string name="show_password">"Показване на паролата"</string>
<string name="hide_password">"Скриване на паролата"</string>
</resources>
2 changes: 2 additions & 0 deletions myExpenses/src/main/res/values-bn/aosp.xml
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,6 @@
<string name="enabled">"চালু করা আছে"</string>
<string name="disabled">"বন্ধ করা আছে"</string>
<string name="preview">"পূর্বরূপ"</string>
<string name="show_password">"পাসওয়ার্ড দেখুন"</string>
<string name="hide_password">"পাসওয়ার্ড লুকান"</string>
</resources>
2 changes: 2 additions & 0 deletions myExpenses/src/main/res/values-bs/aosp.xml
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,6 @@
<string name="delimiter_tab">"Tabulator"</string>
<string name="enabled">"Omogućeno"</string>
<string name="disabled">"Onemogućeno"</string>
<string name="show_password">"Prikaži lozinku"</string>
<string name="hide_password">"Sakrij lozinku"</string>
</resources>
2 changes: 2 additions & 0 deletions myExpenses/src/main/res/values-ca/aosp.xml
Original file line number Diff line number Diff line change
Expand Up @@ -151,4 +151,6 @@
<string name="enabled">"Activat"</string>
<string name="disabled">"Desactivat"</string>
<string name="preview">"Previsual."</string>
<string name="show_password">"Mostra la contrasenya"</string>
<string name="hide_password">"Amaga la contrasenya"</string>
</resources>
2 changes: 2 additions & 0 deletions myExpenses/src/main/res/values-cs/aosp.xml
Original file line number Diff line number Diff line change
Expand Up @@ -153,4 +153,6 @@
<string name="enabled">"Zapnuto"</string>
<string name="disabled">"Vypnuto"</string>
<string name="preview">"Náhled"</string>
<string name="show_password">"Zobrazovat heslo"</string>
<string name="hide_password">"Skrýt heslo"</string>
</resources>
2 changes: 2 additions & 0 deletions myExpenses/src/main/res/values-da/aosp.xml
Original file line number Diff line number Diff line change
Expand Up @@ -151,4 +151,6 @@
<string name="enabled">"Aktiveret"</string>
<string name="disabled">"Deaktiveret"</string>
<string name="preview">"Vis eks."</string>
<string name="show_password">"Vis adgangskode"</string>
<string name="hide_password">"Skjul adgangskoden"</string>
</resources>
2 changes: 2 additions & 0 deletions myExpenses/src/main/res/values-de/aosp.xml
Original file line number Diff line number Diff line change
Expand Up @@ -150,4 +150,6 @@
<string name="enabled">"Aktiviert"</string>
<string name="disabled">"Deaktiviert"</string>
<string name="preview">"Vorschau"</string>
<string name="show_password">"Passwort anzeigen"</string>
<string name="hide_password">"Passwort ausblenden"</string>
</resources>
2 changes: 2 additions & 0 deletions myExpenses/src/main/res/values-el/aosp.xml
Original file line number Diff line number Diff line change
Expand Up @@ -150,4 +150,6 @@
<string name="enabled">"Ενεργή"</string>
<string name="disabled">"Ανενεργή"</string>
<string name="preview">"Προεπισκ."</string>
<string name="show_password">"Εμφάνιση κωδικού πρόσβασης"</string>
<string name="hide_password">"Απόκρυψη κωδικού πρόσβασης"</string>
</resources>
2 changes: 2 additions & 0 deletions myExpenses/src/main/res/values-es/aosp.xml
Original file line number Diff line number Diff line change
Expand Up @@ -151,4 +151,6 @@
<string name="enabled">"Habilitado"</string>
<string name="disabled">"Inhabilitado"</string>
<string name="preview">"Vista previa"</string>
<string name="show_password">"Mostrar contraseña"</string>
<string name="hide_password">"Ocultar contraseña"</string>
</resources>
2 changes: 2 additions & 0 deletions myExpenses/src/main/res/values-et/aosp.xml
Original file line number Diff line number Diff line change
Expand Up @@ -85,4 +85,6 @@
<string name="enabled">"Lubatud"</string>
<string name="disabled">"Keelatud"</string>
<string name="preview">"Eelvaade"</string>
<string name="show_password">"Kuva parool"</string>
<string name="hide_password">"Peida parool"</string>
</resources>
2 changes: 2 additions & 0 deletions myExpenses/src/main/res/values-eu/aosp.xml
Original file line number Diff line number Diff line change
Expand Up @@ -148,4 +148,6 @@
<string name="enabled">"Gaituta"</string>
<string name="disabled">"Desgaituta"</string>
<string name="preview">"Aurreikusi"</string>
<string name="show_password">"Erakutsi pasahitza"</string>
<string name="hide_password">"Ezkutatu pasahitza"</string>
</resources>
2 changes: 2 additions & 0 deletions myExpenses/src/main/res/values-fa/aosp.xml
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,6 @@
<string name="enabled">"فعال"</string>
<string name="disabled">"غیرفعال"</string>
<string name="preview">"پیش‌نمایش"</string>
<string name="show_password">"نمایش گذرواژه"</string>
<string name="hide_password">"پنهان کردن گذرواژه"</string>
</resources>
2 changes: 2 additions & 0 deletions myExpenses/src/main/res/values-fi/aosp.xml
Original file line number Diff line number Diff line change
Expand Up @@ -84,4 +84,6 @@
<string name="enabled">"Päällä"</string>
<string name="disabled">"Ei käytössä"</string>
<string name="preview">"Esikatselu"</string>
<string name="show_password">"Näytä salasana"</string>
<string name="hide_password">"Piilota salasana"</string>
</resources>
2 changes: 2 additions & 0 deletions myExpenses/src/main/res/values-fr/aosp.xml
Original file line number Diff line number Diff line change
Expand Up @@ -151,4 +151,6 @@
<string name="enabled">"Activé"</string>
<string name="disabled">"Désactivé"</string>
<string name="preview">"Prévisualiser"</string>
<string name="show_password">"Afficher le mot de passe"</string>
<string name="hide_password">"Masquer le mot de passe"</string>
</resources>
2 changes: 2 additions & 0 deletions myExpenses/src/main/res/values-gl/aosp.xml
Original file line number Diff line number Diff line change
Expand Up @@ -83,4 +83,6 @@
<string name="enabled">"Activouse"</string>
<string name="disabled">"Desactivouse"</string>
<string name="preview">"Vista previa"</string>
<string name="show_password">"Mostrar contrasinal"</string>
<string name="hide_password">"Ocultar contrasinal"</string>
</resources>
2 changes: 2 additions & 0 deletions myExpenses/src/main/res/values-gu/aosp.xml
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,6 @@
<string name="enabled">"ચાલુ છે"</string>
<string name="disabled">"બંધ છે"</string>
<string name="preview">"પૂર્વાવલોકન કરો"</string>
<string name="show_password">"પાસવર્ડ બતાવો"</string>
<string name="hide_password">"પાસવર્ડ છુપાવો"</string>
</resources>
2 changes: 2 additions & 0 deletions myExpenses/src/main/res/values-hi/aosp.xml
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,6 @@
<string name="enabled">"चालू है"</string>
<string name="disabled">"बंद है"</string>
<string name="preview">"पूर्वावलोकन"</string>
<string name="show_password">"पासवर्ड दिखाएं"</string>
<string name="hide_password">"पासवर्ड छिपाएं"</string>
</resources>
2 changes: 2 additions & 0 deletions myExpenses/src/main/res/values-hr/aosp.xml
Original file line number Diff line number Diff line change
Expand Up @@ -143,4 +143,6 @@
<string name="enabled">"Omogućeno"</string>
<string name="disabled">"Onemogućeno"</string>
<string name="preview">"Pregled"</string>
<string name="show_password">"Prikaži zaporku"</string>
<string name="hide_password">"Sakrij zaporku"</string>
</resources>
2 changes: 2 additions & 0 deletions myExpenses/src/main/res/values-hu/aosp.xml
Original file line number Diff line number Diff line change
Expand Up @@ -152,4 +152,6 @@
<string name="enabled">"Engedélyezve"</string>
<string name="disabled">"Letiltva"</string>
<string name="preview">"Előnézet"</string>
<string name="show_password">"Jelszó megjelenítése"</string>
<string name="hide_password">"Jelszó elrejtése"</string>
</resources>
2 changes: 2 additions & 0 deletions myExpenses/src/main/res/values-hy/aosp.xml
Original file line number Diff line number Diff line change
Expand Up @@ -79,4 +79,6 @@
<string name="enabled">"Միացված է"</string>
<string name="disabled">"Անջատված է"</string>
<string name="preview">"Նախադիտում"</string>
<string name="show_password">"Ցույց տալ գաղտնաբառը"</string>
<string name="hide_password">"Թաքցնել գաղտնաբառը"</string>
</resources>
2 changes: 2 additions & 0 deletions myExpenses/src/main/res/values-in/aosp.xml
Original file line number Diff line number Diff line change
Expand Up @@ -85,4 +85,6 @@
<string name="enabled">"Aktif"</string>
<string name="disabled">"Nonaktif"</string>
<string name="preview">"Pratinjau"</string>
<string name="show_password">"Tampilkan sandi"</string>
<string name="hide_password">"Sembunyikan sandi"</string>
</resources>
2 changes: 2 additions & 0 deletions myExpenses/src/main/res/values-is/aosp.xml
Original file line number Diff line number Diff line change
Expand Up @@ -82,4 +82,6 @@
<string name="enabled">"Virkt"</string>
<string name="disabled">"Óvirkt"</string>
<string name="preview">"Forskoða"</string>
<string name="show_password">"Sýna aðgangsorð"</string>
<string name="hide_password">"Fela aðgangsorð"</string>
</resources>
2 changes: 2 additions & 0 deletions myExpenses/src/main/res/values-it/aosp.xml
Original file line number Diff line number Diff line change
Expand Up @@ -150,4 +150,6 @@
<string name="enabled">"Attivato"</string>
<string name="disabled">"Disattivato"</string>
<string name="preview">"Anteprima"</string>
<string name="show_password">"Mostra password"</string>
<string name="hide_password">"Nascondi password"</string>
</resources>
2 changes: 2 additions & 0 deletions myExpenses/src/main/res/values-iw/aosp.xml
Original file line number Diff line number Diff line change
Expand Up @@ -142,4 +142,6 @@
<string name="enabled">"מופעלת"</string>
<string name="disabled">"מושבתת"</string>
<string name="preview">"תצוגה מקדימה"</string>
<string name="show_password">"הצגת הסיסמה"</string>
<string name="hide_password">"הסתר סיסמה"</string>
</resources>
2 changes: 2 additions & 0 deletions myExpenses/src/main/res/values-ja/aosp.xml
Original file line number Diff line number Diff line change
Expand Up @@ -148,4 +148,6 @@
<string name="enabled">"有効"</string>
<string name="disabled">"無効"</string>
<string name="preview">"プレビュー"</string>
<string name="show_password">"パスワードを表示する"</string>
<string name="hide_password">"パスワードを隠す"</string>
</resources>
2 changes: 2 additions & 0 deletions myExpenses/src/main/res/values-ka/aosp.xml
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,6 @@
<string name="enabled">"ჩართულია"</string>
<string name="disabled">"გათიშულია"</string>
<string name="preview">"გადახედვა"</string>
<string name="show_password">"პაროლის გამოჩენა"</string>
<string name="hide_password">"პაროლის დამალვა"</string>
</resources>
2 changes: 2 additions & 0 deletions myExpenses/src/main/res/values-kk/aosp.xml
Original file line number Diff line number Diff line change
Expand Up @@ -75,4 +75,6 @@
<string name="enabled">"Қосулы"</string>
<string name="disabled">"Өшірулі"</string>
<string name="preview">"Алдын ала қарау"</string>
<string name="show_password">"Құпия сөзді көрсету"</string>
<string name="hide_password">"Құпия сөзді жасыру"</string>
</resources>
2 changes: 2 additions & 0 deletions myExpenses/src/main/res/values-km/aosp.xml
Original file line number Diff line number Diff line change
Expand Up @@ -134,4 +134,6 @@
<string name="enabled">"បាន​បើក"</string>
<string name="disabled">"បាន​បិទ"</string>
<string name="preview">"មើល​ជាមុន"</string>
<string name="show_password">"បង្ហាញ​ពាក្យ​សម្ងាត់"</string>
<string name="hide_password">"លាក់​ពាក្យសម្ងាត់"</string>
</resources>
Loading

0 comments on commit a0ef5ad

Please sign in to comment.