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

Add sort to shared prefs tool #72

Merged
merged 5 commits into from
Jul 12, 2024
Merged

Conversation

KCeh
Copy link
Collaborator

@KCeh KCeh commented Jul 7, 2024

📷 Screenshots

Check out video in comments down below

📄 Context

Requested in #44.
I added a sort by key to shared preferences tools. Worth keeping in mind that tool works in a way that separates each prefs file in UI (for example encrypted shared prefs are not mixed with normal shared prefs - check out video).

📝 Changes

I added:

  • Icon and related listener to sort prefs on click
  • Each prefs file is sorted separately by key
  • If user clicks on sort multiple times sort will change from ascending to descending (for that I added additional field to related data class)
  • Option to expand/hide each preferences (file)
  • Preferences are sorted based on file name

🛠️ How to test

Run sample app or any other app that uses Sentinel. Worth noting that you might need to set some shared prefs.

@KCeh KCeh added the enhancement New feature or request label Jul 7, 2024
@KCeh KCeh requested a review from AsimRibo July 7, 2024 17:21
@KCeh KCeh self-assigned this Jul 7, 2024
@JonatanPlesko
Copy link
Collaborator

Looking at the video, it seems as if the sorting is implemented only within a certain category (shared prefs file), and there is no way to sort categories. Since my initial motivation behind the request was to make the finding of your own custom prefs easier by making the sort of categories themselves more consistent/predictable or customizable, I'm wondering whether we could achieve that too (or instead).

Additionally, does this persist - and if not, could it? Same reasoning.

@KCeh
Copy link
Collaborator Author

KCeh commented Jul 8, 2024

Looking at the video, it seems as if the sorting is implemented only within a certain category (shared prefs file), and there is no way to sort categories. Since my initial motivation behind the request was to make the finding of your own custom prefs easier by making the sort of categories themselves more consistent/predictable or customizable, I'm wondering whether we could achieve that too (or instead).

Additionally, does this persist - and if not, could it? Same reasoning.

OK, I see your point about sorting categories.
We could expand upon this feature with the additional flag in settings which would control whether we want to have separate categories or merge them into one. But this will take additional effort.

I see value in the current solution and we will include it in upcoming release. We will look into additional options for shared prefs tools.
As for persistency of the current solution, right now it is only in memory. This means if you close Sentinel, sort for category will disappear. This is an additional point we can improve upon. But current solution was a trade-off between effort to implement and additional value to the user.

@KCeh
Copy link
Collaborator Author

KCeh commented Jul 8, 2024

Just questions about your use case @JonatanPlesko
Do you need to find one specific key? Could search help you with data?
Or do you want a way to easily get to one specific category/preference file? Could minimising categories that you are not interested in help you?

@JonatanPlesko
Copy link
Collaborator

@KCeh I'm usually looking for a specific preference file and/or a specific key. Minimizing other preference files would help, and so would search or filtering.

I initially suggested sorting to have a consistent logic at least, as I noticed the order would randomly change, making it even more difficult to find what you're looking for as it is always in a different place.

@KCeh
Copy link
Collaborator Author

KCeh commented Jul 9, 2024

I further improved options, now all preferences files should be sorted (always). Meaning consistency in list.
And you can now expand/hide files.
Unfortunately, persistence for user adjustable settings will require much more effort so it is not implemented. But again, list of preferences files should be consistent (alphabetically sorted order). Hopefully, this will help you in your use case.

Screen_recording_20240709_181422.webm

Copy link
Contributor

@AsimRibo AsimRibo left a comment

Choose a reason for hiding this comment

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

🔥
Nothing to add, for first iteration looks great.

Copy link
Collaborator

@JonatanPlesko JonatanPlesko left a comment

Choose a reason for hiding this comment

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

These additional changes are great 👏 👏 👏 the consistent sort + the ability to collapse them is already a big improvement and will definitely make it much easier to find specific preferences. Thank you for the effort 🙌

Copy link

@KCeh KCeh merged commit 59eeb85 into develop Jul 12, 2024
6 checks passed
@KCeh KCeh deleted the feature/sort-shared-preferences branch August 20, 2024 19:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants