-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[refactor] Refactor the PDF view cell
[feat] Add support for PDF caching [release] Bump version 1.8.5
- Loading branch information
Showing
21 changed files
with
656 additions
and
519 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
// | ||
// FileView.swift | ||
// Desk360 | ||
// | ||
// Created by Ali Ammar Hilal on 8.11.2021. | ||
// | ||
|
||
import UIKit | ||
|
||
/// A UIView based calss to render different files representations on the secren. | ||
final class FileView: UIView { | ||
|
||
/// The file icon. | ||
lazy var icon: UIImageView = { | ||
let view = UIImageView() | ||
view.pinSize(.init(width: 38, height: 36)) | ||
return view | ||
}() | ||
|
||
/// The file name. | ||
lazy var fileName: UILabel = { | ||
let label = UILabel() | ||
label.font = .systemFont(ofSize: 14) | ||
label.textColor = Colors.ticketDetailChatReceiverTextColor | ||
return label | ||
}() | ||
|
||
/// The file object of type `AttachObject` to be rendered. | ||
var file: AttachObject? { | ||
didSet { | ||
guard let file = file else { return } | ||
fileName.text = file.name | ||
icon.image = file.image?.withRenderingMode(.alwaysOriginal) | ||
} | ||
} | ||
|
||
/// A call back closure to be triggered when atappping on the file name or icon. | ||
var onFileSelected: ((AttachObject) -> Void)? | ||
|
||
override func layoutSubviews() { | ||
super.layoutSubviews() | ||
addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(didTapFile))) | ||
let stack: UIView = .hStack(alignment: .center, distribution: .fill, spacing: 8, [icon, fileName]) | ||
addSubview(stack) | ||
stack.pinToSuperviewEdges(padding: .init(top: 10, left: 0, bottom: 10, right: 12)) | ||
} | ||
|
||
@objc private func didTapFile() { | ||
guard let file = file else { | ||
return | ||
} | ||
onFileSelected?(file) | ||
} | ||
} |
Oops, something went wrong.