mirror of
https://git.mihon.tech/mihonapp/mihon
synced 2024-11-25 22:55:59 +03:00
Avoid jank in extensions list if install permissions already granted
This commit is contained in:
parent
f115edf2ea
commit
14510f1d26
2 changed files with 4 additions and 4 deletions
|
@ -133,13 +133,13 @@ private fun ExtensionContent(
|
||||||
) {
|
) {
|
||||||
val context = LocalContext.current
|
val context = LocalContext.current
|
||||||
var trustState by remember { mutableStateOf<Extension.Untrusted?>(null) }
|
var trustState by remember { mutableStateOf<Extension.Untrusted?>(null) }
|
||||||
val installGranted = rememberRequestPackageInstallsPermissionState()
|
val installGranted = rememberRequestPackageInstallsPermissionState(initialValue = true)
|
||||||
|
|
||||||
FastScrollLazyColumn(
|
FastScrollLazyColumn(
|
||||||
contentPadding = contentPadding + topSmallPaddingValues,
|
contentPadding = contentPadding + topSmallPaddingValues,
|
||||||
) {
|
) {
|
||||||
if (!installGranted && state.installer?.requiresSystemPermission == true) {
|
if (!installGranted && state.installer?.requiresSystemPermission == true) {
|
||||||
item {
|
item(key = "extension-permissions-warning") {
|
||||||
WarningBanner(
|
WarningBanner(
|
||||||
textRes = MR.strings.ext_permission_install_apps_warning,
|
textRes = MR.strings.ext_permission_install_apps_warning,
|
||||||
modifier = Modifier.clickable {
|
modifier = Modifier.clickable {
|
||||||
|
|
|
@ -14,11 +14,11 @@ import androidx.lifecycle.DefaultLifecycleObserver
|
||||||
import androidx.lifecycle.LifecycleOwner
|
import androidx.lifecycle.LifecycleOwner
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun rememberRequestPackageInstallsPermissionState(): Boolean {
|
fun rememberRequestPackageInstallsPermissionState(initialValue: Boolean = false): Boolean {
|
||||||
val context = LocalContext.current
|
val context = LocalContext.current
|
||||||
val lifecycleOwner = LocalLifecycleOwner.current
|
val lifecycleOwner = LocalLifecycleOwner.current
|
||||||
|
|
||||||
var installGranted by remember { mutableStateOf(false) }
|
var installGranted by remember { mutableStateOf(initialValue) }
|
||||||
|
|
||||||
DisposableEffect(lifecycleOwner.lifecycle) {
|
DisposableEffect(lifecycleOwner.lifecycle) {
|
||||||
val observer = object : DefaultLifecycleObserver {
|
val observer = object : DefaultLifecycleObserver {
|
||||||
|
|
Loading…
Reference in a new issue