mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-02 21:33:26 +00:00
Update files following swiftformat upgrade
This commit is contained in:
committed by
Stefan Ceriu
parent
fe189fcfed
commit
23062901c0
@@ -106,10 +106,10 @@ private struct MediaPreviewViewController: UIViewControllerRepresentable {
|
||||
])
|
||||
}
|
||||
|
||||
// Don't use viewWillAppear due to the following warning:
|
||||
// Presenting view controller <QLPreviewController> from detached view controller <HostingController> is not supported,
|
||||
// and may result in incorrect safe area insets and a corrupt root presentation. Make sure <HostingController> is in
|
||||
// the view controller hierarchy before presenting from it. Will become a hard exception in a future release.
|
||||
/// Don't use viewWillAppear due to the following warning:
|
||||
/// Presenting view controller <QLPreviewController> from detached view controller <HostingController> is not supported,
|
||||
/// and may result in incorrect safe area insets and a corrupt root presentation. Make sure <HostingController> is in
|
||||
/// the view controller hierarchy before presenting from it. Will become a hard exception in a future release.
|
||||
override func viewDidAppear(_ animated: Bool) {
|
||||
super.viewDidAppear(animated)
|
||||
|
||||
@@ -153,7 +153,10 @@ private struct MediaPreviewViewController: UIViewControllerRepresentable {
|
||||
class MediaPreviewItem: NSObject, QLPreviewItem {
|
||||
let file: MediaFileHandleProxy
|
||||
|
||||
var previewItemURL: URL? { file.url }
|
||||
var previewItemURL: URL? {
|
||||
file.url
|
||||
}
|
||||
|
||||
let previewItemTitle: String?
|
||||
|
||||
init(file: MediaFileHandleProxy, title: String?) {
|
||||
|
||||
@@ -114,8 +114,13 @@ class TimelineMediaPreviewDataSource: NSObject, QLPreviewControllerDataSource {
|
||||
|
||||
// MARK: - QLPreviewControllerDataSource
|
||||
|
||||
var firstPreviewItemIndex: Int { backwardPadding }
|
||||
var lastPreviewItemIndex: Int { backwardPadding + previewItems.count - 1 }
|
||||
var firstPreviewItemIndex: Int {
|
||||
backwardPadding
|
||||
}
|
||||
|
||||
var lastPreviewItemIndex: Int {
|
||||
backwardPadding + previewItems.count - 1
|
||||
}
|
||||
|
||||
func numberOfPreviewItems(in controller: QLPreviewController) -> Int {
|
||||
previewItems.count + backwardPadding + forwardPadding
|
||||
|
||||
@@ -56,7 +56,10 @@ struct TimelineMediaPreviewViewState: BindableState {
|
||||
var dataSource: TimelineMediaPreviewDataSource
|
||||
|
||||
/// The media item that is currently being previewed.
|
||||
var currentItem: TimelineMediaPreviewItem { dataSource.currentItem }
|
||||
var currentItem: TimelineMediaPreviewItem {
|
||||
dataSource.currentItem
|
||||
}
|
||||
|
||||
/// All of the available actions for the current item.
|
||||
var currentItemActions: TimelineItemMenuActions?
|
||||
|
||||
|
||||
@@ -101,10 +101,10 @@ private struct MediaPreviewViewController: UIViewControllerRepresentable {
|
||||
])
|
||||
}
|
||||
|
||||
// Don't use viewWillAppear due to the following warning:
|
||||
// Presenting view controller <QLPreviewController> from detached view controller <HostingController> is not supported,
|
||||
// and may result in incorrect safe area insets and a corrupt root presentation. Make sure <HostingController> is in
|
||||
// the view controller hierarchy before presenting from it. Will become a hard exception in a future release.
|
||||
/// Don't use viewWillAppear due to the following warning:
|
||||
/// Presenting view controller <QLPreviewController> from detached view controller <HostingController> is not supported,
|
||||
/// and may result in incorrect safe area insets and a corrupt root presentation. Make sure <HostingController> is in
|
||||
/// the view controller hierarchy before presenting from it. Will become a hard exception in a future release.
|
||||
override func viewDidAppear(_ animated: Bool) {
|
||||
super.viewDidAppear(animated)
|
||||
|
||||
|
||||
@@ -236,5 +236,7 @@ class TimelineMediaPreviewViewModel: TimelineMediaPreviewViewModelType {
|
||||
title: L10n.screenMediaDetailsNoMoreMediaToShow))
|
||||
}
|
||||
|
||||
private var statusIndicatorID: String { "\(Self.self)-Status" }
|
||||
private var statusIndicatorID: String {
|
||||
"\(Self.self)-Status"
|
||||
}
|
||||
}
|
||||
|
||||
+23
-7
@@ -24,7 +24,10 @@ class TimelineMediaPreviewController: QLPreviewController {
|
||||
|
||||
private var cancellables: Set<AnyCancellable> = []
|
||||
|
||||
private var navigationBar: UINavigationBar? { view.subviews.first?.subviews.first { $0 is UINavigationBar } as? UINavigationBar }
|
||||
private var navigationBar: UINavigationBar? {
|
||||
view.subviews.first?.subviews.first { $0 is UINavigationBar } as? UINavigationBar
|
||||
}
|
||||
|
||||
private var bottomBarItemsContainer: UIView? {
|
||||
if #available(iOS 26, *) {
|
||||
view.subviews.first?.subviews.last?.subviews.first
|
||||
@@ -33,8 +36,13 @@ class TimelineMediaPreviewController: QLPreviewController {
|
||||
}
|
||||
}
|
||||
|
||||
private var pageScrollView: UIScrollView? { view.firstScrollView() }
|
||||
private var captionView: UIView { captionHostingController.view }
|
||||
private var pageScrollView: UIScrollView? {
|
||||
view.firstScrollView()
|
||||
}
|
||||
|
||||
private var captionView: UIView {
|
||||
captionHostingController.view
|
||||
}
|
||||
|
||||
override var overrideUserInterfaceStyle: UIUserInterfaceStyle {
|
||||
get { .dark }
|
||||
@@ -255,7 +263,9 @@ class TimelineMediaPreviewController: QLPreviewController {
|
||||
|
||||
private struct HeaderView: View {
|
||||
@ObservedObject var context: TimelineMediaPreviewViewModel.Context
|
||||
private var currentItem: TimelineMediaPreviewItem { context.viewState.currentItem }
|
||||
private var currentItem: TimelineMediaPreviewItem {
|
||||
context.viewState.currentItem
|
||||
}
|
||||
|
||||
var body: some View {
|
||||
switch currentItem {
|
||||
@@ -281,7 +291,9 @@ private struct HeaderView: View {
|
||||
|
||||
private struct DetailsButton: View {
|
||||
@ObservedObject var context: TimelineMediaPreviewViewModel.Context
|
||||
private var currentItem: TimelineMediaPreviewItem { context.viewState.currentItem }
|
||||
private var currentItem: TimelineMediaPreviewItem {
|
||||
context.viewState.currentItem
|
||||
}
|
||||
|
||||
var isHidden: Bool {
|
||||
switch currentItem {
|
||||
@@ -301,7 +313,9 @@ private struct DetailsButton: View {
|
||||
|
||||
private struct CaptionView: View {
|
||||
@ObservedObject var context: TimelineMediaPreviewViewModel.Context
|
||||
private var currentItem: TimelineMediaPreviewItem { context.viewState.currentItem }
|
||||
private var currentItem: TimelineMediaPreviewItem {
|
||||
context.viewState.currentItem
|
||||
}
|
||||
|
||||
var body: some View {
|
||||
if case let .media(mediaItem) = currentItem, let caption = mediaItem.caption {
|
||||
@@ -323,7 +337,9 @@ private struct CaptionView: View {
|
||||
|
||||
private struct DownloadIndicatorView: View {
|
||||
@ObservedObject var context: TimelineMediaPreviewViewModel.Context
|
||||
private var currentItem: TimelineMediaPreviewItem { context.viewState.currentItem }
|
||||
private var currentItem: TimelineMediaPreviewItem {
|
||||
context.viewState.currentItem
|
||||
}
|
||||
|
||||
private var shouldShowDownloadIndicator: Bool {
|
||||
switch currentItem {
|
||||
|
||||
+3
-1
@@ -11,7 +11,9 @@ import SwiftUI
|
||||
struct TimelineMediaPreviewFileExportPicker: UIViewControllerRepresentable {
|
||||
struct File: Identifiable {
|
||||
let url: URL
|
||||
var id: String { url.absoluteString }
|
||||
var id: String {
|
||||
url.absoluteString
|
||||
}
|
||||
}
|
||||
|
||||
let file: File
|
||||
|
||||
-1
@@ -57,7 +57,6 @@ struct TimelineMediaPreviewRedactConfirmationView: View {
|
||||
.padding(.horizontal, 24)
|
||||
}
|
||||
|
||||
@ViewBuilder
|
||||
private var preview: some View {
|
||||
HStack(spacing: 12) {
|
||||
if let mediaSource = item.thumbnailMediaSource {
|
||||
|
||||
Reference in New Issue
Block a user