session-ios/Session/Media Viewing & Editing/MediaInfoVC+MediaPreviewView.swift
Morgan Pretty 5b5f4a4e88 Various tweaks and fixes
Fixed an issue where the GlobalSearch push animation could be jittery
Fixed a crash which could occur when returning from the background on certain screens
Removed the keyboard dismiss animation when pushing from global search to a conversation (apparently this is how iMessage avoids the animation bug...)
Updated to the latest version of GRDB
Updated the Atomic wrapper to use the ReadWrite lock for less blocking behaviours
Updated the audio attachment icon to be consistent with Android & Desktop
Updated the QuoteView to omit the "author" if we don't have their name and the quote can't be found
2023-05-16 09:38:14 +10:00

64 lines
1.8 KiB
Swift

// Copyright © 2023 Rangeproof Pty Ltd. All rights reserved.
import UIKit
import SessionUIKit
import SessionUtilitiesKit
import SessionMessagingKit
extension MediaInfoVC {
final class MediaPreviewView: UIView {
private static let cornerRadius: CGFloat = 8
private let attachment: Attachment
private let isOutgoing: Bool
// MARK: - UI
private lazy var mediaView: MediaView = {
let result: MediaView = MediaView.init(
attachment: attachment,
isOutgoing: isOutgoing,
cornerRadius: 0
)
return result
}()
// MARK: - Lifecycle
init(attachment: Attachment, isOutgoing: Bool) {
self.attachment = attachment
self.isOutgoing = isOutgoing
super.init(frame: CGRect.zero)
self.accessibilityLabel = "Media info"
setUpViewHierarchy()
}
override init(frame: CGRect) {
preconditionFailure("Use init(attachment:) instead.")
}
required init?(coder: NSCoder) {
preconditionFailure("Use init(attachment:) instead.")
}
private func setUpViewHierarchy() {
set(.width, to: MediaInfoVC.mediaSize)
set(.height, to: MediaInfoVC.mediaSize)
addSubview(mediaView)
mediaView.pin(to: self)
mediaView.loadMedia()
}
// MARK: - Copy
/// This function is used to make sure the carousel view contains this class can loop infinitely
func copyView() -> MediaPreviewView {
return MediaPreviewView(attachment: self.attachment, isOutgoing: self.isOutgoing)
}
}
}