Check whether URL previews should be shown in a single location.

Reset all cell data when this setting is changed to force a refresh.
Rename `hasClosedPreview(from:)` to `shouldShowPreview(for:)` for clarity and potentially adding more rules at a later date.
This commit is contained in:
Doug
2021-09-29 11:39:11 +01:00
parent 57018f90ee
commit bf84540b39
4 changed files with 9 additions and 11 deletions
@@ -731,11 +731,6 @@ NSString *const URLPreviewDidUpdateNotification = @"URLPreviewDidUpdateNotificat
- (MXKRoomBubbleComponent *)bubbleComponentWithLinkForEventId:(NSString *)eventId
{
if (!RiotSettings.shared.roomScreenShowsURLPreviews)
{
return nil;
}
NSInteger index = [self bubbleComponentIndexForEventId:eventId];
if (index == NSNotFound)
{
@@ -1085,8 +1080,8 @@ NSString *const URLPreviewDidUpdateNotification = @"URLPreviewDidUpdateNotificat
return;
}
// Don't show the preview if it has been dismissed already.
component.showURLPreview = ![URLPreviewService.shared hasClosedPreviewFrom:component.event];
// Don't show the preview if they're disabled globally or this one has been dismissed previously.
component.showURLPreview = RiotSettings.shared.roomScreenShowsURLPreviews && [URLPreviewService.shared shouldShowPreviewFor:component.event];
if (!component.showURLPreview)
{
return;