improvement: If Keyguard is already open when you click on a custom filter home icon, apply the custom filter anyway
This commit is contained in:
parent
4651a45216
commit
a24d7470b4
@ -141,7 +141,11 @@ data class Rail(
|
||||
|
||||
private const val ROUTE_NAME = "home"
|
||||
|
||||
private val vaultRoute = VaultRoute()
|
||||
private val vaultRoute = VaultRoute(
|
||||
args = VaultRoute.Args(
|
||||
main = true,
|
||||
),
|
||||
)
|
||||
|
||||
private val sendsRoute = SendRoute()
|
||||
|
||||
|
@ -63,7 +63,9 @@ import kotlinx.coroutines.flow.distinctUntilChanged
|
||||
import kotlinx.coroutines.flow.first
|
||||
import kotlinx.coroutines.flow.flowOf
|
||||
import kotlinx.coroutines.flow.flowOn
|
||||
import kotlinx.coroutines.flow.launchIn
|
||||
import kotlinx.coroutines.flow.map
|
||||
import kotlinx.coroutines.flow.onEach
|
||||
import kotlinx.coroutines.flow.update
|
||||
import kotlinx.serialization.encodeToString
|
||||
import org.kodein.di.DirectDI
|
||||
@ -216,7 +218,7 @@ data class OurFilterResult(
|
||||
)
|
||||
|
||||
data class FilterParams(
|
||||
val deeplinkCustomFilter: String? = null,
|
||||
val deeplinkCustomFilterFlow: Flow<String>? = null,
|
||||
val section: Section = Section(),
|
||||
) {
|
||||
data class Section(
|
||||
@ -834,15 +836,19 @@ suspend fun <
|
||||
)
|
||||
.filterSection(params.section.misc)
|
||||
|
||||
if (params.deeplinkCustomFilter != null) {
|
||||
val customFilter = kotlin.run {
|
||||
val customFilters = getCipherFilters()
|
||||
.first()
|
||||
customFilters.firstOrNull { it.id == params.deeplinkCustomFilter }
|
||||
}
|
||||
if (customFilter != null) {
|
||||
input.onApply(customFilter.filter)
|
||||
}
|
||||
if (params.deeplinkCustomFilterFlow != null) {
|
||||
params.deeplinkCustomFilterFlow
|
||||
.onEach { customFilterId ->
|
||||
val customFilter = kotlin.run {
|
||||
val customFilters = getCipherFilters()
|
||||
.first()
|
||||
customFilters.firstOrNull { it.id == customFilterId }
|
||||
}
|
||||
if (customFilter != null) {
|
||||
input.onApply(customFilter.filter)
|
||||
}
|
||||
}
|
||||
.launchIn(screenScope)
|
||||
}
|
||||
|
||||
val filterCustomListFlow = getCipherFilters()
|
||||
|
@ -124,6 +124,7 @@ import kotlinx.coroutines.flow.SharingStarted
|
||||
import kotlinx.coroutines.flow.combine
|
||||
import kotlinx.coroutines.flow.debounce
|
||||
import kotlinx.coroutines.flow.distinctUntilChanged
|
||||
import kotlinx.coroutines.flow.filterNotNull
|
||||
import kotlinx.coroutines.flow.flowOf
|
||||
import kotlinx.coroutines.flow.flowOn
|
||||
import kotlinx.coroutines.flow.launchIn
|
||||
@ -1277,8 +1278,17 @@ fun vaultListScreenState(
|
||||
.flowOn(Dispatchers.Default)
|
||||
.shareIn(this, SharingStarted.WhileSubscribed(), replay = 1)
|
||||
|
||||
val dl = deeplinkService.get("customFilter")
|
||||
deeplinkService.clear("customFilter")
|
||||
val deeplinkCustomFilterFlow = if (args.main) {
|
||||
val customFilterKey = "customFilter"
|
||||
deeplinkService
|
||||
.getFlow(customFilterKey)
|
||||
.filterNotNull()
|
||||
.onEach {
|
||||
deeplinkService.clear(customFilterKey)
|
||||
}
|
||||
} else {
|
||||
null
|
||||
}
|
||||
val filterListFlow = ah(
|
||||
directDI = directDI,
|
||||
outputGetter = { it.source },
|
||||
@ -1301,7 +1311,7 @@ fun vaultListScreenState(
|
||||
organizationFlow = getOrganizations(),
|
||||
input = filterResult,
|
||||
params = FilterParams(
|
||||
deeplinkCustomFilter = dl,
|
||||
deeplinkCustomFilterFlow = deeplinkCustomFilterFlow,
|
||||
),
|
||||
)
|
||||
.stateIn(this, SharingStarted.WhileSubscribed(), OurFilterResult())
|
||||
|
Loading…
x
Reference in New Issue
Block a user