google / google/accompanist

Confusing preview behavior

Open
#1,821 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Kotlin
Stars
7.8k
Forks
683
PR merge metrics
No merged PRs in 30d

Description

## Describe the bug

I'm attempting to use `previewPermissionStatuses` to customize previews for different scenarios but it looks like `PreviewMultiplePermissionsState` doesn't actually adapt to a change in permissions.

A quick look at [the code](https://github.com/google/accompanist/blob/fda7f06a24a42b0b1afa75591e768d82d2941984/permissions/src/main/java/com/google/accompanist/permissions/MultiplePermissionsState.kt#L122-L127) suggests that only `PreviewPermissionsState.permissions` is an accurate reflection making properties like `shouldShowRationale` and code to detect partial permissions like the following unavailable:

```kotlin
locationPermissionsState.permissions.size == locationPermissionsState.revokedPermissions.size
```

It appears that in a preview `shouldShowRationale` always returns `false` and the partial permission code above will always be `true` because the revoked permissions list is always empty.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.