Closed danpecher closed 4 years ago
@schwarja I added some new commits.
I added a new method load
to the core to be able to load all users before the conversations are loaded. I think in the future it could be used also for some other loading tasks that might be needed.
I used notifications to call the temporary createTestConversation
method for simplicity, because if I wanted to call Firebase methods from controller or appdelegate I would have to mess around with dependencies to be able to import them.
@schwarja I added commits and some comments 🙂
@schwarja ok I managed to do the load without exposing through the core by adding onLoadListeners
to ChatNetworkingFirebase
so that even if listenToConversations
is called before the init is done, the code will wait until loading is complete. I hope this solution is not too ugly 😬 this specific code change is here: https://github.com/strvcom/ios-research-chat-component-imperative/pull/2/commits/f0846b2fa0653c4dc59a5a3aefac89a52036a003
@schwarja done
FirebaseFirestoreSwift
pod which is part of firebase-ios-sdk (albeit undocumented 😞 - but it does simplify decoding, including documentID property and timestamps)Comments
message_type
property is necessary since the decoding process decides the message type based on presence of either "text" field or "imageUrl" field.conversations/members
I used map of [id: [name: "..."]] instead of just array of IDs because we need the names in the conversation list. We will need to think about updating those names whenever any user's name updates. I wasn't sure about this but it seems denormalization is pretty common with Firebase databases ¯_(ツ)_/¯ https://www.youtube.com/watch?v=vKqXSZLLnHA (Sorry if this is something obvious, I haven't worked with Firebase that much..)