mirror of
https://github.com/lux-tel/session-ios.git
synced 2026-10-30 20:38:32 +00:00
• 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
32 lines
1.1 KiB
Swift
32 lines
1.1 KiB
Swift
// Copyright © 2022 Rangeproof Pty Ltd. All rights reserved.
|
|
|
|
import UIKit
|
|
import SessionUIKit
|
|
import SessionMessagingKit
|
|
import SessionUtilitiesKit
|
|
|
|
public extension LinkPreview {
|
|
func sentState(
|
|
imageAttachment: Attachment?,
|
|
using dependencies: Dependencies
|
|
) -> LinkPreviewViewModel {
|
|
return LinkPreviewViewModel(
|
|
state: .sent,
|
|
urlString: url,
|
|
title: (title?.isEmpty == false ? title : nil),
|
|
imageSource: {
|
|
/// **Note:** We don't check if the image is valid here because that can be confirmed in 'imageState' and it's a
|
|
/// little inefficient
|
|
guard
|
|
imageAttachment?.isImage == true,
|
|
let imageDownloadUrl: String = imageAttachment?.downloadUrl,
|
|
let path: String = try? dependencies[singleton: .attachmentManager]
|
|
.path(for: imageDownloadUrl)
|
|
else { return nil }
|
|
|
|
return .url(URL(fileURLWithPath: path))
|
|
}()
|
|
)
|
|
}
|
|
}
|