Clean up the link preview cache.

pull/2/head
Matthew Chen 6 years ago
parent f6ca66f9c6
commit ae5cee2167

@ -878,6 +878,10 @@ const CGFloat kMaxTextViewHeight = 98;
[self ensureShouldShowVoiceMemoButtonAnimated:YES doLayout:YES];
[self updateHeightWithTextView:textView];
[self updateInputLinkPreview];
if (textView.text.ows_stripped.length < 1) {
[OWSLinkPreview clearLinkPreviewCache];
}
}
- (void)textViewDidChangeSelection:(UITextView *)textView

@ -2752,6 +2752,8 @@ typedef enum : NSUInteger {
AudioServicesPlaySystemSound(soundId);
}
[self.typingIndicators didSendOutgoingMessageInThread:self.thread];
[OWSLinkPreview clearLinkPreviewCache];
}
#pragma mark UIDocumentMenuDelegate

@ -709,6 +709,8 @@ typedef NS_ENUM(NSInteger, HomeViewControllerSection) {
[self.searchResultsController viewDidAppear:animated];
self.hasEverAppeared = YES;
[OWSLinkPreview clearLinkPreviewCache];
}
- (void)viewDidDisappear:(BOOL)animated

@ -553,6 +553,13 @@ public class OWSLinkPreview: MTLModel {
}
}
@objc
public class func clearLinkPreviewCache() {
return serialQueue.async {
linkPreviewDraftCache.removeAllObjects()
}
}
@objc
public class func tryToBuildPreviewInfoObjc(previewUrl: String?) -> AnyPromise {
return AnyPromise(tryToBuildPreviewInfo(previewUrl: previewUrl))

Loading…
Cancel
Save