Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rewrite PermissionsActivity, PermissionsFragment to Compose #583

Merged

Conversation

ArnyminerZ
Copy link
Member

No description provided.

@ArnyminerZ ArnyminerZ self-assigned this Feb 19, 2024
@ArnyminerZ ArnyminerZ linked an issue Feb 19, 2024 that may be closed by this pull request
@ArnyminerZ ArnyminerZ marked this pull request as ready for review February 19, 2024 14:07
@ArnyminerZ ArnyminerZ requested a review from rfc2822 February 19, 2024 14:07
@ArnyminerZ ArnyminerZ requested a review from rfc2822 February 20, 2024 07:29
Signed-off-by: Arnau Mora Gras <arnyminerz@proton.me>
Signed-off-by: Arnau Mora Gras <arnyminerz@proton.me>
Signed-off-by: Arnau Mora Gras <arnyminerz@proton.me>
Signed-off-by: Arnau Mora Gras <arnyminerz@proton.me>
@rfc2822 rfc2822 force-pushed the 575-rewrite-permissionsactivity-permissionsfragment-to-compose branch from f68d13a to 37b45e7 Compare February 20, 2024 17:24
Copy link
Member

@rfc2822 rfc2822 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks basically good but what I'm missing is the on/off status text for every permission. I think they're necessary because they contain recommendations and users can't know what for instance Keep permissions means.

I also wonder whether there's a better method to be notified when auto-revoke permissions is changed, other than onResume(). But I couldn't find anything else …

I have also done a few minor changes (see commit).

@rfc2822 rfc2822 added the refactoring Internal improvement of existing functions label Feb 28, 2024
@ArnyminerZ
Copy link
Member Author

I also wonder whether there's a better method to be notified when auto-revoke permissions is changed

I've also been searching for something, and it doesn't seem to be much. The only thing I've found is maybe using the REQUEST_IGNORE_BATTERY_OPTIMIZATIONS permission, but it seems to only be intended to be used by system apps.

@rfc2822
Copy link
Member

rfc2822 commented Mar 5, 2024

@ArnyminerZ Can you add the on/off text? We can merge it then I think

Signed-off-by: Arnau Mora Gras <arnyminerz@proton.me>
Signed-off-by: Arnau Mora Gras <arnyminerz@proton.me>
@ArnyminerZ ArnyminerZ requested a review from rfc2822 March 5, 2024 09:08
Copy link
Member

@rfc2822 rfc2822 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok there's still a problem. In the old version we had a TasksWatcher, which updates the permission rows when a tasks app is (un)installed.

The current accompanist permissions approach doesn't update the rows = re-evaluate these lines:

    val openTasksAvailable = pm.resolveContentProvider(ProviderName.OpenTasks.authority, 0) != null
    val tasksOrgAvailable = pm.resolveContentProvider(ProviderName.TasksOrg.authority, 0) != null
    val jtxAvailable = pm.resolveContentProvider(ProviderName.JtxBoard.authority, 0) != null

when a tasks app is (un)installed.

Steps to reproduce:

  1. Open PermissionsActivity
  2. Switch to Play Store, install jtx Board, let it install in background
  3. While it's installing, switch back to PermissionsActivity
  4. PermissionsActivity is not updated when app is installed (jtx Board row doesn't appear)

Expected: the row should appear as soon as the app is installed.

Maybe re-evaluating the code could be triggered by a LiveData value from the model (something like "List" which is driven by the TasksWatcher)?

Signed-off-by: Arnau Mora Gras <arnyminerz@proton.me>
Signed-off-by: Arnau Mora Gras <arnyminerz@proton.me>
Signed-off-by: Arnau Mora Gras <arnyminerz@proton.me>
Signed-off-by: Arnau Mora Gras <arnyminerz@proton.me>
@ArnyminerZ
Copy link
Member Author

I think this should work fine.

Copy link
Member

@rfc2822 rfc2822 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, looks good now!

@rfc2822 rfc2822 merged commit 1cbfedc into dev-ose Mar 8, 2024
7 checks passed
@rfc2822 rfc2822 deleted the 575-rewrite-permissionsactivity-permissionsfragment-to-compose branch March 8, 2024 15:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
refactoring Internal improvement of existing functions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Rewrite PermissionsActivity, PermissionsFragment to Compose
2 participants