Files
session-ios/SessionUIKit/Types/LinkPreviewManagerType.swift
Morgan Pretty 1b863fdf33 Finished off changes
• Linked up quote clearing
• Removed the duplicate link preview loading and UI from the MediaMessageView (just use the input UI now)
• Cleaned up how the InputView input types is handled a bit
• Fixed an issue where link previews weren't rendering in the share extension
2025-11-03 12:35:48 +11:00

27 lines
958 B
Swift

// Copyright © 2025 Rangeproof Pty Ltd. All rights reserved.
import Foundation
// MARK: - LinkPreviewManagerType
public protocol LinkPreviewManagerType {
var areLinkPreviewsEnabled: Bool { get async }
var hasSeenLinkPreviewSuggestion: Bool { get async }
func setHasSeenLinkPreviewSuggestion(_ value: Bool) async
func allPreviewUrls(forMessageBodyText body: String) async -> [String]
func previewUrl(for text: String?, selectedRange: NSRange?) async -> String?
func ensureLinkPreviewsEnabled() async throws
func tryToBuildPreviewInfo(previewUrl: String, skipImageDownload: Bool) async throws -> LinkPreviewViewModel
}
public extension LinkPreviewManagerType {
nonisolated static func isValidLinkUrl(_ urlString: String) -> Bool {
return (URL(string: urlString) != nil)
}
func previewUrl(for text: String?) async -> String? {
return await previewUrl(for: text, selectedRange: nil)
}
}