-
Notifications
You must be signed in to change notification settings - Fork 212
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
Dismiss thread when hard deleting root message #3569
base: develop
Are you sure you want to change the base?
Dismiss thread when hard deleting root message #3569
Conversation
SDK Size
|
This was caused by setting 2 event delegates, one for channel events and another one for regular events
This was because when hard deleting a message it disappears from CoreData, so we can't create the Event domain model with the message model. So for this I created a different event.
… is because the message was hard deleted
ad394cd
to
4437e15
Compare
23ed5ed
to
773b01a
Compare
SDK Performance
|
Co-authored-by: Toomas Vahter <[email protected]>
SDK Size
|
@@ -24,6 +24,7 @@ open class ChatThreadVC: _ViewController, | |||
public var initialReplyId: MessageId? | |||
|
|||
/// Controller for observing typing events for this thread. | |||
@available(*, deprecated, message: "Events are now handled by the `eventsController`.") |
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.
why do we deprecate it in this PR?
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.
The ChatThreadVC.didReceiveEvent delegate was always being called twice. This was due to the fact that we had channelEventsController and eventsController assigning both delegates to the ChatThreadVC
Its in the PR description. Since it is not used anymore, it is deprecated. The delegate of this controller was conflicting with the eventsController
Quality Gate passedIssues Measures |
🔗 Issue Links
Resolves https://linear.app/stream/issue/IOS-282/hard-delete-on-a-root-message-from-a-thread-is-broken
🎯 Goal
Fix the Thread not dismissing when the root message is hard deleted.
🛠 Implementation
I've decided to implement this on the Demo App since hard deleting is an action that only exists on the Demo App. Usually, we do not advertise the feature much since it is not recommended.
Besides that, the logic will most likely differ depending on the app. So this is mostly app logic and not SDK logic.
Either way, while doing this, I spotted some bugs:
ChatThreadVC.didReceiveEvent
delegate was always being called twice. This was due to the fact that we hadchannelEventsController
andeventsController
assigning both delegates to theChatThreadVC
MessageDeletedEvent
was not being surfaced to thedidReceiveEvent
delegate. This only happened for the hard deleted message, and the reason is that this event requires amessage: ChatMessage
property. But, since the mesasge is hard deleted, it also does not exist in CoreData, so we can't provide the whole message, only the ID. For this reason, I created a new eventMessageHardDeletedEvent
and deprecated theMessageDeletedEvent.isHardDeleted
property. This was the only option to avoid breaking changes.UPDATE: In order to avoid creating a new
MessageHardDeletedEvent
, and diverge from the other SDKs, we decided to map the message payload directly to the model so that theMessageDeletedEvent.message
is present.🧪 Manual Testing Notes
Dismissing Thread
Hard Deleting Thread from Channel
☑️ Contributor Checklist
docs-content
repo