-
Notifications
You must be signed in to change notification settings - Fork 43
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
Identity server & Contact Integration #280
base: stable
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is extremely cool! I love it!
I left some minor comments with some feedback inline, but all in all it looks great.
struct NewConversationContainerView: View { | ||
@EnvironmentObject private var store: AccountStore | ||
@Binding var createdRoomId: ObjectIdentifier? | ||
@AppStorage("matrixUsers") private var matrixUsersJSON: String = "" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is just for persisting the last selection I think? That would be kinda OK. The bigger issue is that this is not scoped on the scene. I.e. if you have multiple scenes open (on iPad or windows on macOS) and you'd want to join different conversations, they would all show the same set. I think what you'd want here is a State which is initialised from a user default.
My general recommendation: One StateObject per scene, and from there drill down into distinct detail observed objects, e.g. one representing a new conversation in this case. But that would be a bigger refactoring.
Not sure what the Contacts.fw has to do with this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As far as I can tell from the context this is a list of contacts matched with the identity server to have a linked Matrix account, serialized to JSON and stored in user defaults. But it's totally possible I read this wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, looks like persistence of matched users to me. Re limits: last time I hit a limit in user defaults it was "4194304 bytes of data"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not that I'd necessarily push for storing this in CoreData, which would just open ten new cans of worms, but maybe this would better be stored as a json file on disk? Or would that be too error-prone?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another option would be storing this in it's own suite that's separate from settings:
@AppStorage("matrixUsers", store: UserDefaults.contacts) private var matrixUsersJSON: String = ""
Maybe this could actually be the group suite which is already about storing Matrix state? Not sure re any privacy implications of that though 🕵️.
Also, a nice tidy up would be to conform codable arrays to RawRepresentable
like this and then you could have:
@AppStorage("matrixUsers", store: UserDefaults.contacts) private var matrixUsers: [MatrixUser] = []
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Something else we might be able to do is use the “instant message” field in contacts. I will have to find out how that works, but that would remove the need for us to store it ourselves.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm using the messaging fields in Past for iChat to find user thumbnails and names. (It is an app-wide ObservedObject, I guess I could post the code).
And yes, ideally you'd use that to link and store the Matrix address, i.e. like Mail.app does.
It's too long ago, but Contacts is essentially using the vCard model. IIRC the IMPP field can have a type and those fields can also all have a "label". The "label" is for things like "Home", "Friends" or "Work" (i.e. like a tag). We might be able to use a custom type for Matrix, I'm not entirely sure about that, but it probably works.
@AppStorage("identityServer") private var identityServer: String = "https://vector.im" | ||
@AppStorage("identityServerBool") private var identityServerBool: Bool = false | ||
@AppStorage("matrixUsers") private var matrixUsersJSON: String = "" | ||
@AppStorage("locSyncContacts") private var locSyncContacts: Bool = false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this a typo? What does loc
stand for?
Co-authored-by: Kilian Koeltzsch <[email protected]>
Co-authored-by: Kilian Koeltzsch <[email protected]> Typo enum UserStatus Co-authored-by: Kilian Koeltzsch <[email protected]> Typo enum UserStatus Co-authored-by: Kilian Koeltzsch <[email protected]>
910cb4c
to
2bc6f32
Compare
Enables the option to enable Identity Servers and Contact Synchronization to start new chats based on email, phone number, or by simple pressing a contact that is using Matrix.