Add dynamic shortcuts for starred contacts
What is it?
- [ ] Bugfix
- [x] Feature
- [ ] Codebase improvement
Description of the changes in your PR
- It uses the custom sorting if set.
- It uses
ACTION_DIALinstead ofACTION_CALLif calling permission is denied.
Fixes the following issue(s)
- Fixes #248
Acknowledgement
- [x] I read the contribution guidelines.
I think that visible shortcuts should always be the first ones according to current sorting of Favorites tab. For example, if I sort descending by name, I want to see in shortcuts three first items by that sorting, not by the default one; if I use custom sorting, I want to have specific contacts visible at the top, so also in shortcuts.
Done! I recall sorting the list at first but I must have accidentally removed it while refactoring.
I've downloaded your latest changes and sorting is still not applied. See screenshots:
Also, there are two other bugs:
- Changing sorting doesn't invoke refreshing shortcuts.
- After fresh installation of the app, there are no shortcuts at all. I have to add/remove any contact from favorites first.
The changes aren't applied immediately. It's called onResume so it'll apply if you close the app and reopen it (you don't have to fully close it, you can open it through recents as well).
I have to add/remove any contact from favorites first.
I didn't need to add/remove anything when I was testing it so I'm not sure why that's happening.
I did it, and sorting is still not applied.
I just tested it again with a fresh install and it seems to work fine. It only shows up after the second or third time I open the app after a fresh install, but after that it reflects sorting changes relatively quickly.
I'm not sure where the issue is happening.
Edit: Just to clarify, I'm talking about the sorting in the Favourites tab.
@Aga-C can you test out the latest commit? It should work now.
But you still haven't solved a problem, which is in your code:
if (order.isEmpty()) {
starred.sorted()
} else {
val orderList = Converters().jsonToStringList(order).withIndex().associate { it.value to it.index }
starred.sortedBy { orderList[it.contactId.toString()] }
}
You always assume, that if order is set, that's the only way to sort, while you should check config.isCustomOrderSelected. That's why I haven't seen changes - I had order set, but I was changing sorting to different from custom.
I see. Sorry about that, it seems like I fundamentally misunderstood the issue. It should be fixed now.
It still doesn't show the first three items from the current sorting. Check the recording below:
https://github.com/user-attachments/assets/947fd237-eec3-4480-8c3f-e269ffc2a9c9
Also, one of these contacts (Test Hmm) is created as a private contact. It should still display it.
At this point, I genuinely have no idea where the problem is. I'm just not encountering that issue so I have no way to debug it.
I can reproduce the sorting issue as well. Sometimes, I get shortcuts that are not even on my favorite list. Restarting the app doesn't help. It's probably because you are relying on cachedContacts, which is not even initialized when pushStarredShortcuts() is called on resume.
Also, it should directly initiate a call instead of asking for a phone app.
This pull request was automatically closed due to inactivity and/or lack of response from the author. If you have further updates or additional information, please comment or reopen the PR to continue.