Swift format

This commit is contained in:
Thomas Ricouard 2023-01-30 07:27:06 +01:00
parent 5871d13eee
commit 16636b12a9
26 changed files with 191 additions and 187 deletions

View file

@ -116,7 +116,8 @@ struct IceCubesApp: App {
}
}
if proxy.frame(in: .global).width > (.maxColumnWidth + .secondaryColumnWidth),
currentAccount.account?.id != nil {
currentAccount.account?.id != nil
{
Divider().edgesIgnoringSafeArea(.all)
NotificationsTab(popToRootTab: $popToRootTab, lockedType: nil)
.environment(\.isSecondaryColumn, true)

View file

@ -12,7 +12,7 @@ struct QuickLookPreview: UIViewControllerRepresentable {
let selectedURL: URL
let urls: [URL]
func makeUIViewController(context: Context) -> UIViewController {
func makeUIViewController(context _: Context) -> UIViewController {
return AppQLPreviewController(selectedURL: selectedURL, urls: urls)
}
@ -25,7 +25,7 @@ class AppQLPreviewController: UIViewController {
let selectedURL: URL
let urls: [URL]
var qlController : QLPreviewController?
var qlController: QLPreviewController?
init(selectedURL: URL, urls: [URL]) {
self.selectedURL = selectedURL
@ -33,49 +33,49 @@ class AppQLPreviewController: UIViewController {
super.init(nibName: nil, bundle: nil)
}
required init?(coder: NSCoder) {
@available(*, unavailable)
required init?(coder _: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
if self.qlController == nil {
self.qlController = QLPreviewController()
self.qlController?.dataSource = self
self.qlController?.delegate = self
self.qlController?.currentPreviewItemIndex = urls.firstIndex(of: selectedURL) ?? 0
self.present(self.qlController!, animated: true)
if qlController == nil {
qlController = QLPreviewController()
qlController?.dataSource = self
qlController?.delegate = self
qlController?.currentPreviewItemIndex = urls.firstIndex(of: selectedURL) ?? 0
present(qlController!, animated: true)
}
}
}
extension AppQLPreviewController : QLPreviewControllerDataSource {
extension AppQLPreviewController: QLPreviewControllerDataSource {
func numberOfPreviewItems(in _: QLPreviewController) -> Int {
return self.urls.count
return urls.count
}
func previewController(_: QLPreviewController, previewItemAt index: Int) -> QLPreviewItem {
return self.urls[index] as QLPreviewItem
return urls[index] as QLPreviewItem
}
}
extension AppQLPreviewController : QLPreviewControllerDelegate {
extension AppQLPreviewController: QLPreviewControllerDelegate {
func previewController(_: QLPreviewController, editingModeFor _: QLPreviewItem) -> QLPreviewItemEditingMode {
.createCopy
}
func previewControllerWillDismiss(_ controller: QLPreviewController) {
self.dismiss(animated: true)
func previewControllerWillDismiss(_: QLPreviewController) {
dismiss(animated: true)
}
}
struct TransparentBackground: UIViewControllerRepresentable {
public func makeUIViewController(context: Context) -> UIViewController {
public func makeUIViewController(context _: Context) -> UIViewController {
return TransparentController()
}
public func updateUIViewController(_ uiViewController: UIViewController, context: Context) {
}
public func updateUIViewController(_: UIViewController, context _: Context) {}
class TransparentController: UIViewController {
override func viewDidLoad() {

View file

@ -44,7 +44,7 @@ class ShareViewController: UIViewController {
childView.view.topAnchor.constraint(equalTo: self.view.topAnchor),
childView.view.bottomAnchor.constraint(equalTo: self.view.bottomAnchor),
childView.view.leadingAnchor.constraint(equalTo: self.view.leadingAnchor),
childView.view.trailingAnchor.constraint(equalTo: self.view.trailingAnchor)
childView.view.trailingAnchor.constraint(equalTo: self.view.trailingAnchor),
])
}
}

View file

@ -11,7 +11,7 @@ public struct FontPicker: UIViewControllerRepresentable {
self.dismiss = dismiss
}
public func fontPickerViewControllerDidCancel(_ viewController: UIFontPickerViewController) {
public func fontPickerViewControllerDidCancel(_: UIFontPickerViewController) {
dismiss()
}
@ -33,5 +33,5 @@ public struct FontPicker: UIViewControllerRepresentable {
return controller
}
public func updateUIViewController(_ viewController: UIFontPickerViewController, context: Context) {}
public func updateUIViewController(_: UIFontPickerViewController, context _: Context) {}
}

View file

@ -5,8 +5,8 @@ private struct SecondaryColumnKey: EnvironmentKey {
static let defaultValue = false
}
extension EnvironmentValues {
public var isSecondaryColumn: Bool {
public extension EnvironmentValues {
var isSecondaryColumn: Bool {
get { self[SecondaryColumnKey.self] }
set { self[SecondaryColumnKey.self] = newValue }
}

View file

@ -33,7 +33,7 @@ public class QuickLook: ObservableObject {
paths.append(path)
}
return paths.sorted { url1, url2 in
return pathOrderMap[url1.lastPathComponent] ?? 0 < pathOrderMap[url2.lastPathComponent] ?? 0
pathOrderMap[url1.lastPathComponent] ?? 0 < pathOrderMap[url2.lastPathComponent] ?? 0
}
})
withTransaction(transaction) {

View file

@ -78,7 +78,8 @@ public class UserPreferences: ObservableObject {
}
set {
if let font = newValue,
let data = try? NSKeyedArchiver.archivedData(withRootObject: font, requiringSecureCoding: false) {
let data = try? NSKeyedArchiver.archivedData(withRootObject: font, requiringSecureCoding: false)
{
chosenFontData = data
} else {
chosenFontData = nil

View file

@ -32,8 +32,8 @@ struct NotificationRowView: View {
}
}
}
.alignmentGuide(.listRowSeparatorLeading) { viewDimensions in
return -100
.alignmentGuide(.listRowSeparatorLeading) { _ in
-100
}
}

View file

@ -1,6 +1,6 @@
import DesignSystem
import Models
import SwiftUI
import DesignSystem
extension Models.Notification.NotificationType {
func label(count: Int) -> LocalizedStringKey {

View file

@ -146,7 +146,7 @@ public struct NotificationsListView: View {
}
private var topPaddingView: some View {
HStack { }
HStack {}
.listRowBackground(Color.clear)
.listRowSeparator(.hidden)
.listRowInsets(.init())

View file

@ -1,6 +1,6 @@
import AVKit
import SwiftUI
import Env
import SwiftUI
class VideoPlayerViewModel: ObservableObject {
@Published var player: AVPlayer?

View file

@ -86,7 +86,8 @@ struct StatusRowContextMenu: View {
}
} label: {
if let statusLanguage = viewModel.status.language,
let lanugageName = Locale.current.localizedString(forLanguageCode: statusLanguage) {
let lanugageName = Locale.current.localizedString(forLanguageCode: statusLanguage)
{
Label("status.action.translate-from-\(lanugageName)", systemImage: "captions.bubble")
} else {
Label("status.action.translate", systemImage: "captions.bubble")

View file

@ -317,7 +317,8 @@ public struct StatusRowView: View {
ProgressView()
} else {
if let statusLanguage = status.language,
let lanugageName = Locale.current.localizedString(forLanguageCode: statusLanguage) {
let lanugageName = Locale.current.localizedString(forLanguageCode: statusLanguage)
{
Text("status.action.translate-from-\(lanugageName)")
} else {
Text("status.action.translate")