mirror of
https://github.com/AChep/keyguard-app.git
synced 2025-01-31 14:34:52 +01:00
fix: Display a correct current region when Re-logging into an account
This commit is contained in:
parent
97ff7e84ad
commit
c22595537e
@ -455,8 +455,9 @@ private fun LoginItemDropdown(
|
|||||||
ExpandedIfNotEmpty(field.text) { text ->
|
ExpandedIfNotEmpty(field.text) { text ->
|
||||||
Text(
|
Text(
|
||||||
text = text,
|
text = text,
|
||||||
style = MaterialTheme.typography.bodySmall,
|
style = MaterialTheme.typography.labelMedium,
|
||||||
color = MaterialTheme.colorScheme.primary,
|
color = MaterialTheme.colorScheme.primary
|
||||||
|
.combineAlpha(LocalContentColor.current.alpha),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -36,6 +36,7 @@ import com.artemchep.keyguard.provider.bitwarden.usecase.internal.AddAccount
|
|||||||
import com.artemchep.keyguard.res.Res
|
import com.artemchep.keyguard.res.Res
|
||||||
import com.artemchep.keyguard.ui.FlatItemAction
|
import com.artemchep.keyguard.ui.FlatItemAction
|
||||||
import com.artemchep.keyguard.ui.icons.icon
|
import com.artemchep.keyguard.ui.icons.icon
|
||||||
|
import kotlinx.collections.immutable.persistentListOf
|
||||||
import kotlinx.collections.immutable.toPersistentList
|
import kotlinx.collections.immutable.toPersistentList
|
||||||
import kotlinx.collections.immutable.toPersistentMap
|
import kotlinx.collections.immutable.toPersistentMap
|
||||||
import kotlinx.coroutines.CoroutineScope
|
import kotlinx.coroutines.CoroutineScope
|
||||||
@ -173,7 +174,19 @@ fun produceLoginScreenState(
|
|||||||
|
|
||||||
// region
|
// region
|
||||||
|
|
||||||
val regionDefault = LoginRegion.default
|
val regionDefault = if (
|
||||||
|
args.env.baseUrl.isNotBlank() ||
|
||||||
|
args.env.webVaultUrl.isNotBlank() ||
|
||||||
|
args.env.apiUrl.isNotBlank() ||
|
||||||
|
args.env.identityUrl.isNotBlank() ||
|
||||||
|
args.env.iconsUrl.isNotBlank() ||
|
||||||
|
args.env.notificationsUrl.isNotBlank() ||
|
||||||
|
args.env.headers.isNotEmpty()
|
||||||
|
) {
|
||||||
|
LoginRegion.Custom
|
||||||
|
} else {
|
||||||
|
LoginRegion.Predefined(args.env.region)
|
||||||
|
}
|
||||||
val regionSink = mutablePersistedFlow(KEY_REGION) { regionDefault.key }
|
val regionSink = mutablePersistedFlow(KEY_REGION) { regionDefault.key }
|
||||||
val regionFlow = regionSink
|
val regionFlow = regionSink
|
||||||
.map { regionName ->
|
.map { regionName ->
|
||||||
@ -181,18 +194,22 @@ fun produceLoginScreenState(
|
|||||||
?: regionDefault
|
?: regionDefault
|
||||||
}
|
}
|
||||||
|
|
||||||
val regionItems = LoginRegion.values
|
val regionItems = if (args.envEditable) {
|
||||||
.asSequence()
|
LoginRegion.values
|
||||||
.map { region ->
|
.asSequence()
|
||||||
FlatItemAction(
|
.map { region ->
|
||||||
id = region.key,
|
FlatItemAction(
|
||||||
title = translate(region.title),
|
id = region.key,
|
||||||
onClick = {
|
title = translate(region.title),
|
||||||
regionSink.value = region.key
|
onClick = {
|
||||||
},
|
regionSink.value = region.key
|
||||||
)
|
},
|
||||||
}
|
)
|
||||||
.toPersistentList()
|
}
|
||||||
|
.toPersistentList()
|
||||||
|
} else {
|
||||||
|
persistentListOf()
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
|
Loading…
x
Reference in New Issue
Block a user