From 107231d5dba89c4d044836e2af788d813883d781 Mon Sep 17 00:00:00 2001 From: ryanzhao Date: Wed, 18 Jan 2023 16:56:58 +1100 Subject: [PATCH] WIP: media info screen --- Session.xcodeproj/project.pbxproj | 4 + .../Media Viewing & Editing/MediaInfoVC.swift | 146 ++++++++++++++++++ 2 files changed, 150 insertions(+) create mode 100644 Session/Media Viewing & Editing/MediaInfoVC.swift diff --git a/Session.xcodeproj/project.pbxproj b/Session.xcodeproj/project.pbxproj index 709944a25..159c8234b 100644 --- a/Session.xcodeproj/project.pbxproj +++ b/Session.xcodeproj/project.pbxproj @@ -110,6 +110,7 @@ 7B1D74AC27BDE7510030B423 /* Promise+Timeout.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B1D74AB27BDE7510030B423 /* Promise+Timeout.swift */; }; 7B1D74B027C365960030B423 /* Timer+MainThread.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B1D74AF27C365960030B423 /* Timer+MainThread.swift */; }; 7B3A392C2971100D002FE4AC /* ContextMenuVC+MessageInfoView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B3A392B2971100D002FE4AC /* ContextMenuVC+MessageInfoView.swift */; }; + 7B3A392E2977791E002FE4AC /* MediaInfoVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B3A392D2977791E002FE4AC /* MediaInfoVC.swift */; }; 7B46AAAF28766DF4001AF2DC /* AllMediaViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B46AAAE28766DF4001AF2DC /* AllMediaViewController.swift */; }; 7B4C75CB26B37E0F0000AC89 /* UnsendRequest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B4C75CA26B37E0F0000AC89 /* UnsendRequest.swift */; }; 7B4C75CD26BB92060000AC89 /* DeletedMessageView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B4C75CC26BB92060000AC89 /* DeletedMessageView.swift */; }; @@ -1177,6 +1178,7 @@ 7B1D74AF27C365960030B423 /* Timer+MainThread.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Timer+MainThread.swift"; sourceTree = ""; }; 7B2DB2AD26F1B0FF0035B509 /* si */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = si; path = si.lproj/Localizable.strings; sourceTree = ""; }; 7B3A392B2971100D002FE4AC /* ContextMenuVC+MessageInfoView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "ContextMenuVC+MessageInfoView.swift"; sourceTree = ""; }; + 7B3A392D2977791E002FE4AC /* MediaInfoVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MediaInfoVC.swift; sourceTree = ""; }; 7B46AAAE28766DF4001AF2DC /* AllMediaViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AllMediaViewController.swift; sourceTree = ""; }; 7B4C75CA26B37E0F0000AC89 /* UnsendRequest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UnsendRequest.swift; sourceTree = ""; }; 7B4C75CC26BB92060000AC89 /* DeletedMessageView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DeletedMessageView.swift; sourceTree = ""; }; @@ -2983,6 +2985,7 @@ 4C1885D1218F8E1C00B67051 /* PhotoGridViewCell.swift */, 4C4AE69F224AF21900D4AF6F /* SendMediaNavigationController.swift */, 7B46AAAE28766DF4001AF2DC /* AllMediaViewController.swift */, + 7B3A392D2977791E002FE4AC /* MediaInfoVC.swift */, ); path = "Media Viewing & Editing"; sourceTree = ""; @@ -5629,6 +5632,7 @@ FD71164828E2CE8700B47552 /* SessionCell+AccessoryView.swift in Sources */, B80A579F23DFF1F300876683 /* NewClosedGroupVC.swift in Sources */, FD71163A28E2C53700B47552 /* SessionAvatarCell.swift in Sources */, + 7B3A392E2977791E002FE4AC /* MediaInfoVC.swift in Sources */, 7BA68909272A27BE00EFC32F /* SessionCall.swift in Sources */, B835247925C38D880089A44F /* MessageCell.swift in Sources */, B86BD08623399CEF000F5AE3 /* SeedModal.swift in Sources */, diff --git a/Session/Media Viewing & Editing/MediaInfoVC.swift b/Session/Media Viewing & Editing/MediaInfoVC.swift new file mode 100644 index 000000000..ab317f95c --- /dev/null +++ b/Session/Media Viewing & Editing/MediaInfoVC.swift @@ -0,0 +1,146 @@ +// Copyright © 2023 Rangeproof Pty Ltd. All rights reserved. + +import Foundation + +final class MediaInfoVC: BaseVC { + private static let mediaInfoContainerCornerRadius: CGFloat = 8 + + // MARK: - UI + + private lazy var fullScreenButton: UIButton = { + let result: UIButton = UIButton(type: .custom) + + return result + }() + + private lazy var fileIdLabel: UILabel = { + let result: UILabel = UILabel() + result.font = .systemFont(ofSize: Values.mediumFontSize) + result.themeTextColor = .textPrimary + + return result + }() + + private lazy var fileTypeLabel: UILabel = { + let result: UILabel = UILabel() + result.font = .systemFont(ofSize: Values.mediumFontSize) + result.themeTextColor = .textPrimary + + return result + }() + + private lazy var fileSizeLabel: UILabel = { + let result: UILabel = UILabel() + result.font = .systemFont(ofSize: Values.mediumFontSize) + result.themeTextColor = .textPrimary + + return result + }() + + private lazy var resolutionLabel: UILabel = { + let result: UILabel = UILabel() + result.font = .systemFont(ofSize: Values.mediumFontSize) + result.themeTextColor = .textPrimary + + return result + }() + + private lazy var durationLabel: UILabel = { + let result: UILabel = UILabel() + result.font = .systemFont(ofSize: Values.mediumFontSize) + result.themeTextColor = .textPrimary + + return result + }() + + // MARK: - Initialization + + init() { + super.init(nibName: nil, bundle: nil) + } + + override init(nibName: String?, bundle: Bundle?) { + preconditionFailure("Use init() instead.") + } + + required init?(coder: NSCoder) { + preconditionFailure("Use init() instead.") + } + + // MARK: - Lifecycle + + override func viewDidLoad() { + super.viewDidLoad() + + let mediaInfoContainer: UIView = UIView() + mediaInfoContainer.clipsToBounds = true + mediaInfoContainer.themeBackgroundColor = .contextMenu_background + mediaInfoContainer.layer.cornerRadius = Self.mediaInfoContainerCornerRadius + + // File ID + let fileIdTitleLabel: UILabel = { + let result = UILabel() + result.font = .boldSystemFont(ofSize: Values.mediumFontSize) + result.text = "ATTACHMENT_INFO_FILE_ID".localized() + ":" + result.themeTextColor = .textPrimary + + return result + }() + fileIdLabel.text = "" // TODO: + let fileIdContainerStackView: UIStackView = UIStackView(arrangedSubviews: [ fileIdTitleLabel, fileIdLabel ]) + fileIdContainerStackView.axis = .vertical + + // File Type + let fileTypeTitleLabel: UILabel = { + let result = UILabel() + result.font = .boldSystemFont(ofSize: Values.mediumFontSize) + result.text = "ATTACHMENT_INFO_FILE_TYPE".localized() + ":" + result.themeTextColor = .textPrimary + + return result + }() + fileTypeLabel.text = "" // TODO: + let fileTypeContainerStackView: UIStackView = UIStackView(arrangedSubviews: [ fileTypeTitleLabel, fileTypeLabel ]) + fileTypeContainerStackView.axis = .vertical + + // File Size + let fileSizeTitleLabel: UILabel = { + let result = UILabel() + result.font = .boldSystemFont(ofSize: Values.mediumFontSize) + result.text = "ATTACHMENT_INFO_FILE_SIZE".localized() + ":" + result.themeTextColor = .textPrimary + + return result + }() + fileSizeLabel.text = "" // TODO: + let fileSizeContainerStackView: UIStackView = UIStackView(arrangedSubviews: [ fileSizeTitleLabel, fileSizeLabel ]) + fileSizeContainerStackView.axis = .vertical + + // Resolution + let resolutionTitleLabel: UILabel = { + let result = UILabel() + result.font = .boldSystemFont(ofSize: Values.mediumFontSize) + result.text = "ATTACHMENT_INFO_RESOLUTION".localized() + ":" + result.themeTextColor = .textPrimary + + return result + }() + resolutionLabel.text = "" // TODO: + let resolutionContainerStackView: UIStackView = UIStackView(arrangedSubviews: [ resolutionTitleLabel, resolutionLabel ]) + resolutionContainerStackView.axis = .vertical + + // File Size + let durationTitleLabel: UILabel = { + let result = UILabel() + result.font = .boldSystemFont(ofSize: Values.mediumFontSize) + result.text = "ATTACHMENT_INFO_DURATION".localized() + ":" + result.themeTextColor = .textPrimary + + return result + }() + durationLabel.text = "" // TODO: + let durationContainerStackView: UIStackView = UIStackView(arrangedSubviews: [ durationTitleLabel, durationLabel ]) + durationContainerStackView.axis = .vertical + + } +}