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

Names instead of IDs on cover? #52

Closed
ichthyosaurus opened this issue Nov 5, 2024 · 3 comments · Fixed by #53
Closed

Names instead of IDs on cover? #52

ichthyosaurus opened this issue Nov 5, 2024 · 3 comments · Fixed by #53

Comments

@ichthyosaurus
Copy link
Collaborator

When I updated the cover, I added this line: https://github.com/hydrogen-sailfishos/harbour-hydrogen/blob/a218183fa992c1930277714840555424c0ec174e/qml/notificationCount.js#L45C1-L45C55

name: item.name || item.heroes[0],

It takes the room name from the room summary, or the first "hero" if there is no room name to show the number of unread messages per room.

However, "heroes" seems to be an array of IDs (@something) instead of display names.

I dug through the hydrogen code base and found relevant parts:

I'm at a loss how we can translate the handle into a display name. Any ideas or pointers?

@b100dian
Copy link
Contributor

Hi, and sorry for the slow reply.

The communication between the hydrogen-web app and the native application is, as you've observed, a polling script that watches for changes in the IndexedDB.. This is set to 5 seconds because we found out that there's some locking when accessing the database that somehow races with login at times ;-S

I am not sure how to get many details from the database, as I may not have the context to do that as I had one year ago, and that solution was a hackathon-style one.

The correct solution for the notification polling would be to implement the notification API in sailfishos-webview (which I've tried a bit in this year's hackathon, and plan to continue).

For displaying the unread labels, the correct solution would probably be to build our on web app based on the Hydrogen SDK https://github.com/element-hq/hydrogen-web/blob/master/doc/SDK.md#tutorial (I hope).

However, given that you want a more detailed answer sooner, it might be interesting if you would deepen the IndexedDB knowledge we have on current hydrogen-web version.
One thing I remember I did was to

  1. open the web client in Firefox desktop
  2. open developer tools, go to storage
  3. inspect the database 'at will' - of course, this is the hardest part and most work.

image

@b100dian
Copy link
Contributor

b100dian commented Nov 17, 2024

For example, given a "hero" @x:matrix.org present in roomSummary with roomId !room, in the heroes array, roomMembers contains an entry with key !room|@x:matrix:org and the value seems to have a displayName.

@ichthyosaurus
Copy link
Collaborator Author

Thank you @b100dian, that put me on the right track! Implementing took me way longer than I anticipated but at least it works now ;).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants