Repository navigation
Link Matrix users to system contacts - #137
Conversation
Matrix users can be linked to a contact from their profile in the inspector. The link is stored on the contact as a "Matrix" social profile, so it syncs with the contact and shows up in Contacts.app. When enabled in the new Contacts settings tab, the linked contact's name (or nickname) and photo replace the Matrix display name and avatar throughout the app: timeline, replies, read receipts, typing indicator, state events, mention pills and autocomplete, DM room titles and notifications. Contact names are display-only; mentions sent to the server keep the Matrix display name.
|
Awesome great work. I've reviewed the code and it looks very readable and maintainable. When testing the application the integration works really well. I were not able to produce any stale synchronization between Apple Contacts and Mactrix. Although, I couldn't figure out how to add a matrix url to a contact manually (I don't know how to add a custom attribute called matrix without linking from Mactrix). I only found one small bug that happens when I click "Cancel" to dismiss the link contact popup sheet. Instead of closing the popup cleanly, it plays the close animation twice. I also managed to have the close animation replay several times when relinking. This is probably a simple fix. Otherwise great work! |
|
As the earlier mentioned issues are very minor and I want to merge this before another PR (to simplify merge conflicts), I'm merging this one now. Let's address the animation glitch in a separate PR instead. Thank you very much for implementing this! |
* Implement QuickNavigationSession * Implement navigation window * First draft of presenting navigation window * Make quick navigation view based rather than window based. * Update quick navigation view to use glass effect * Hook up navigation popup with matrix rooms * Polish quick navigation view * Implement custom scroll animation * Integrate quick navigation with linked contacts (#137)
Summary
Lets you link a Matrix user to an existing macOS contact. Once linked, Mactrix shows the contact's name (or nickname) and photo instead of the user's chosen Matrix display name and avatar.
How it works
Matrix, the Matrix ID as username and a matrix.to URL. It shows in Contacts.app, syncs with the contact, and can also be added there by hand. A Matrix ID is linked to at most one contact.Privacy: contact names are display-only. Mentions inserted by the composer and drag payloads keep the Matrix display name, so contact names are never sent to other users.
Implementation notes
ContactLinkingtarget with a@MainActor @ObservableContactDirectory. It loads contacts off the main actor in two passes: social profiles first, then names and photos for linked contacts only. It reloads onCNContactStoreDidChange.AvatarView. The timeline redraws visible rows when the directory changes.RoomInfogainsdirectUserId(the single hero of a direct room) to resolve DM titles and avatars.NSContactsUsageDescription.Testing
swift testpasses, including a newContactLinkingTeststarget: social profile parsing, name fallback order, settings gating. The test target is added toMactrix.xctestplan.Mactrixscheme builds; the built app has the address-book entitlement and the usage description.