-
Notifications
You must be signed in to change notification settings - Fork 497
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
fix issue on timeline bubbles not showing proper content after decrypt #7397
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.
Left minor comments.
LGTM overall!
mxEventDidDecryptNotificationObserver = [[NSNotificationCenter defaultCenter] addObserverForName:kMXEventDidDecryptNotification object:nil queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification *notif) { | ||
MXEvent *decryptedEvent = notif.object; | ||
[self->roomDataSourcesToDestroy addObject:decryptedEvent.roomId]; | ||
}]; |
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.
mxEventDidDecryptNotificationObserver = [[NSNotificationCenter defaultCenter] addObserverForName:kMXEventDidDecryptNotification object:nil queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification *notif) { | |
MXEvent *decryptedEvent = notif.object; | |
[self->roomDataSourcesToDestroy addObject:decryptedEvent.roomId]; | |
}]; | |
mxEventDidDecryptNotificationObserver = [NSNotificationCenter.defaultCenter addObserverForName:kMXEventDidDecryptNotification object:nil queue:NSOperationQueue.mainQueue usingBlock:^(NSNotification *notif) { | |
MXEvent *decryptedEvent = notif.object; | |
[self->roomDataSourcesToDestroy addObject:decryptedEvent.roomId]; | |
}]; |
Minor: dot notation should work on static vars.
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 was trying to remain consistent with similar denotation in the same file
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 wouldn't care much about that.
Writing more readable code is better to me.
I'll leave this up to you in the end. ;)
@@ -156,6 +174,11 @@ - (void)destroy | |||
[[NSNotificationCenter defaultCenter] removeObserver:UIApplicationDidReceiveMemoryWarningNotificationObserver]; | |||
UIApplicationDidReceiveMemoryWarningNotificationObserver = nil; | |||
} | |||
if (mxEventDidDecryptNotificationObserver) | |||
{ | |||
[[NSNotificationCenter defaultCenter] removeObserver:mxEventDidDecryptNotificationObserver]; |
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.
[[NSNotificationCenter defaultCenter] removeObserver:mxEventDidDecryptNotificationObserver]; | |
[NSNotificationCenter.defaultCenter removeObserver:mxEventDidDecryptNotificationObserver]; |
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## develop #7397 +/- ##
===========================================
- Coverage 12.15% 12.15% -0.01%
===========================================
Files 1643 1643
Lines 162265 162282 +17
Branches 66630 66638 +8
===========================================
+ Hits 19729 19731 +2
- Misses 141890 141905 +15
Partials 646 646
Flags with carried forward coverage won't be shown. Click here to find out more.
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
Co-authored-by: Alfonso Grillo <alfogrillo@element.io>
Kudos, SonarCloud Quality Gate passed! |
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.
Seems like a decent enough workaround if its not possible to update the incorrect tag.
I tested it out and there's one edge case, not sure if it matters:
- Open a room with a location shared in.
- Send a verification request from web so that the verification occurs on a modal above the room.
- When the verification completes and the events start to decrypt that location shows as a
geo:
text.
[roomDataSource destroy]; | ||
roomDataSources[roomId] = nil; |
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 wonder if this should be reusing closeRoomDataSourceWithRoomId
in case that ever gets tweaked and this is missed.
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.
So basically I found that the best spot to do it is before opening a room. Calling it on closing it won't cover a case when you receive the key once closed.
Other than that, I did not destroy everything when the user is inside the room.
Also I did found out the destroy is really necessary otherwise it won't work properly
Fixes https://github.com/vector-im/customer-retainer/issues/12
When an event is received but not decrypted properly, a bubble is create in the timeline with a missing content tag.
The event is lately decrypted correctly but the bubble still has a missing tag.
Resetting the Datasource for that room solve the problem.