mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-19 16:13:42 +02:00
Refactoring and tidy up.
Make the preview manager a singleton (passing in the MXSession to functions). Fix tests. PreviewManager → URLPreviewManager URLPreviewViewData → URLPreviewData URLPreviewCache → URLPreviewStore
This commit is contained in:
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
|
||||
#import <MatrixKit/MatrixKit.h>
|
||||
@class URLPreviewViewData;
|
||||
@class URLPreviewData;
|
||||
|
||||
extern NSString *const URLPreviewDidUpdateNotification;
|
||||
|
||||
@@ -84,7 +84,7 @@ typedef NS_ENUM(NSInteger, RoomBubbleCellDataTag)
|
||||
/**
|
||||
A link if the textMessage contains one, otherwise nil.
|
||||
*/
|
||||
@property (nonatomic) URLPreviewViewData *urlPreviewData;
|
||||
@property (nonatomic) URLPreviewData *urlPreviewData;
|
||||
|
||||
/**
|
||||
MXKeyVerification object associated to key verification event when using key verification by direct message.
|
||||
|
||||
@@ -1071,7 +1071,7 @@ NSString *const URLPreviewDidUpdateNotification = @"URLPreviewDidUpdateNotificat
|
||||
}
|
||||
|
||||
// Check that the preview hasn't been dismissed already.
|
||||
if ([LegacyAppDelegate.theDelegate.previewManager hasClosedPreviewFrom:lastComponent.event])
|
||||
if ([URLPreviewManager.shared hasClosedPreviewFrom:lastComponent.event])
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -1079,7 +1079,10 @@ NSString *const URLPreviewDidUpdateNotification = @"URLPreviewDidUpdateNotificat
|
||||
// Set the preview data.
|
||||
MXWeakify(self);
|
||||
|
||||
[LegacyAppDelegate.theDelegate.previewManager previewFor:lastComponent.link and:lastComponent.event success:^(URLPreviewViewData * _Nonnull urlPreviewData) {
|
||||
[URLPreviewManager.shared previewFor:lastComponent.link
|
||||
and:lastComponent.event
|
||||
with:self.mxSession
|
||||
success:^(URLPreviewData * _Nonnull urlPreviewData) {
|
||||
MXStrongifyAndReturnIfNil(self);
|
||||
|
||||
// Update the preview data and send a notification for refresh
|
||||
|
||||
Reference in New Issue
Block a user