Added icon for Baader Bank
This commit is contained in:
parent
1d58a3b9e2
commit
fd87598b96
|
@ -31,14 +31,14 @@ private val bankingGroupMapper = BankingGroupMapper()
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun BankIcon(bank: BankInfo, modifier: Modifier = Modifier, iconModifier: Modifier = DefaultIconModifier, fallbackIcon: ImageVector? = null) {
|
fun BankIcon(bank: BankInfo, modifier: Modifier = Modifier, iconModifier: Modifier = DefaultIconModifier, fallbackIcon: ImageVector? = null) {
|
||||||
val iconUrl by remember(bank.bic) { mutableStateOf(bankIconService.findIconForBank(bank.name, bankingGroupMapper.getBankingGroup(bank.name, bank.bic))) }
|
val iconUrl by remember(bank.bic) { mutableStateOf(bankIconService.findIconForBank(bank.name, bank.bic, bankingGroupMapper.getBankingGroup(bank.name, bank.bic))) }
|
||||||
|
|
||||||
BankIcon(iconUrl, modifier, iconModifier, fallbackIcon = fallbackIcon)
|
BankIcon(iconUrl, modifier, iconModifier, fallbackIcon = fallbackIcon)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun BankIcon(user: BankViewInfo?, modifier: Modifier = Modifier, iconModifier: Modifier = DefaultIconModifier, fallbackIcon: ImageVector? = null) {
|
fun BankIcon(user: BankViewInfo?, modifier: Modifier = Modifier, iconModifier: Modifier = DefaultIconModifier, fallbackIcon: ImageVector? = null) {
|
||||||
val iconUrl = user?.let { bankIconService.findIconForBank(it.bankName, it.bankingGroup) }
|
val iconUrl = user?.let { bankIconService.findIconForBank(it.bankName, null, it.bankingGroup) }
|
||||||
|
|
||||||
BankIcon(iconUrl, modifier, iconModifier, fallbackIcon = fallbackIcon)
|
BankIcon(iconUrl, modifier, iconModifier, fallbackIcon = fallbackIcon)
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,9 +5,9 @@ import net.codinux.banking.client.model.User
|
||||||
|
|
||||||
class BankIconService { // TODO: extract to a common library
|
class BankIconService { // TODO: extract to a common library
|
||||||
|
|
||||||
fun findIconForBank(user: User) = findIconForBank(user.bankName, user.bankingGroup)
|
fun findIconForBank(user: User) = findIconForBank(user.bankName, user.bic, user.bankingGroup)
|
||||||
|
|
||||||
fun findIconForBank(bankName: String, bankingGroup: BankingGroup? = null): String? = when (bankingGroup) {
|
fun findIconForBank(bankName: String, bic: String? = null, bankingGroup: BankingGroup? = null): String? = when (bankingGroup) {
|
||||||
BankingGroup.Sparkasse -> "https://sparkasse.de/favicon-32x32.png"
|
BankingGroup.Sparkasse -> "https://sparkasse.de/favicon-32x32.png"
|
||||||
BankingGroup.DKB -> "https://www.ib.dkb.de/favicon.ico"
|
BankingGroup.DKB -> "https://www.ib.dkb.de/favicon.ico"
|
||||||
BankingGroup.OldenburgischeLandesbank -> "https://olb.de/assets/img/icon/olb/favicon-32x32.png"
|
BankingGroup.OldenburgischeLandesbank -> "https://olb.de/assets/img/icon/olb/favicon-32x32.png"
|
||||||
|
@ -33,6 +33,11 @@ class BankIconService { // TODO: extract to a common library
|
||||||
|
|
||||||
BankingGroup.N26 -> "https://n26.de/favicon.ico"
|
BankingGroup.N26 -> "https://n26.de/favicon.ico"
|
||||||
|
|
||||||
|
else -> findByBicOrName(bankName, bic)
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun findByBicOrName(bankName: String, bic: String?): String? = when {
|
||||||
|
bic?.startsWith("BDWBDEMM") == true || bankName.equals("Baader Bank", true) -> "https://www.baaderbank.de/favicon.ico"
|
||||||
else -> null // TODO: call Favicon web service
|
else -> null // TODO: call Favicon web service
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue