From 6fd8729291292d5c8924b3207628701552fc1605 Mon Sep 17 00:00:00 2001 From: Sixten Otto Date: Mon, 20 Feb 2023 12:04:55 -0700 Subject: [PATCH] disable quite a few line length warnings --- apple/AppStoreScreenshots/SnapshotHelper.swift | 4 +++- .../App/AppExtensions/Share/Views/ShareExtensionView.swift | 2 ++ .../Sources/App/Views/Highlights/HighlightsListCard.swift | 1 + .../OmnivoreKit/Sources/App/Views/Home/HomeFeedViewIOS.swift | 1 + .../Sources/App/Views/Labels/MarqueTextView.swift | 2 ++ .../Sources/App/Views/Profile/TextToSpeechView.swift | 1 + .../App/Views/Profile/TextToSpeechVoiceSelectionView.swift | 5 ++++- .../Sources/App/Views/WebReader/HighlightViewer.swift | 2 ++ .../Sources/App/Views/WebReader/WebReaderContainer.swift | 1 + .../Sources/Services/AudioSession/SpeechPlayerItem.swift | 3 +++ apple/OmnivoreKit/Sources/Services/AudioSession/Voices.swift | 2 +- .../DataService/Mutations/CreateRecommendationGroup.swift | 1 + .../Sources/Utils/UIViewControllerExtensions.swift | 1 + apple/OmnivoreKit/Sources/Views/CommunityModal.swift | 2 ++ apple/OmnivoreKit/Sources/Views/TextChip.swift | 1 + apple/Sources/AppDelegate.swift | 1 + 16 files changed, 27 insertions(+), 3 deletions(-) diff --git a/apple/AppStoreScreenshots/SnapshotHelper.swift b/apple/AppStoreScreenshots/SnapshotHelper.swift index d0edfd942..96a8556e0 100644 --- a/apple/AppStoreScreenshots/SnapshotHelper.swift +++ b/apple/AppStoreScreenshots/SnapshotHelper.swift @@ -1,3 +1,4 @@ +// swiftlint:disable line_length // // SnapshotHelper.swift // Example @@ -32,7 +33,8 @@ func snapshot(_ name: String, waitForLoadingIndicator: Bool) { /// - Parameters: /// - name: The name of the snapshot -/// - timeout: Amount of seconds to wait until the network loading indicator disappears. Pass `0` if you don't want to wait. +/// - timeout: Amount of seconds to wait until the network loading indicator disappears. +/// Pass `0` if you don't want to wait. func snapshot(_ name: String, timeWaitingForIdle timeout: TimeInterval = 20) { Snapshot.snapshot(name, timeWaitingForIdle: timeout) } diff --git a/apple/OmnivoreKit/Sources/App/AppExtensions/Share/Views/ShareExtensionView.swift b/apple/OmnivoreKit/Sources/App/AppExtensions/Share/Views/ShareExtensionView.swift index 1aa17c4bc..d1c0d0b82 100644 --- a/apple/OmnivoreKit/Sources/App/AppExtensions/Share/Views/ShareExtensionView.swift +++ b/apple/OmnivoreKit/Sources/App/AppExtensions/Share/Views/ShareExtensionView.swift @@ -177,6 +177,7 @@ public struct ShareExtensionView: View { VStack(spacing: 15) { SearchBar(searchTerm: $labelsViewModel.labelSearchFilter) + // swiftlint:disable line_length ScrollView { LabelsMasonaryView(labels: labelsViewModel.labels.applySearchFilter(labelsViewModel.labelSearchFilter), selectedLabels: labelsViewModel.selectedLabels.applySearchFilter(labelsViewModel.labelSearchFilter), @@ -199,6 +200,7 @@ public struct ShareExtensionView: View { .buttonStyle(PlainButtonStyle()) .padding(10) }.background(Color.appButtonBackground) + // swiftlint:enable line_length } } } diff --git a/apple/OmnivoreKit/Sources/App/Views/Highlights/HighlightsListCard.swift b/apple/OmnivoreKit/Sources/App/Views/Highlights/HighlightsListCard.swift index 3cf567b8b..24c16f61a 100644 --- a/apple/OmnivoreKit/Sources/App/Views/Highlights/HighlightsListCard.swift +++ b/apple/OmnivoreKit/Sources/App/Views/Highlights/HighlightsListCard.swift @@ -143,6 +143,7 @@ struct HighlightsListCard: View { HStack { Divider() .frame(width: 2) + // swiftlint:disable:next line_length .overlay(highlightParams.createdBy != nil ? Color(red: 206 / 255.0, green: 239 / 255.0, blue: 159 / 255.0) : Color.appYellow48) .opacity(0.8) .padding(.top, 2) diff --git a/apple/OmnivoreKit/Sources/App/Views/Home/HomeFeedViewIOS.swift b/apple/OmnivoreKit/Sources/App/Views/Home/HomeFeedViewIOS.swift index e28691269..8c54a0d9a 100644 --- a/apple/OmnivoreKit/Sources/App/Views/Home/HomeFeedViewIOS.swift +++ b/apple/OmnivoreKit/Sources/App/Views/Home/HomeFeedViewIOS.swift @@ -514,6 +514,7 @@ import Views } } } + // swiftlint:disable:next line_length .alert("Are you sure you want to delete this item? All associated notes and highlights will be deleted.", isPresented: $confirmationShown) { Button("Delete Item", role: .destructive) { if let itemToRemove = itemToRemove { diff --git a/apple/OmnivoreKit/Sources/App/Views/Labels/MarqueTextView.swift b/apple/OmnivoreKit/Sources/App/Views/Labels/MarqueTextView.swift index 7fe66c592..cee36950b 100644 --- a/apple/OmnivoreKit/Sources/App/Views/Labels/MarqueTextView.swift +++ b/apple/OmnivoreKit/Sources/App/Views/Labels/MarqueTextView.swift @@ -37,6 +37,7 @@ } .frame(height: storedSize.height) .overlay(content: { + // swiftlint:disable line_length HStack { let color: Color = .systemBackground @@ -47,6 +48,7 @@ LinearGradient(colors: [color, color.opacity(0.7), color.opacity(0.5), color.opacity(0.3)].reversed(), startPoint: .leading, endPoint: .trailing) .frame(width: 8) + // swiftlint:enable line_length } }) .disabled(true) diff --git a/apple/OmnivoreKit/Sources/App/Views/Profile/TextToSpeechView.swift b/apple/OmnivoreKit/Sources/App/Views/Profile/TextToSpeechView.swift index d09feae6f..4fe368349 100644 --- a/apple/OmnivoreKit/Sources/App/Views/Profile/TextToSpeechView.swift +++ b/apple/OmnivoreKit/Sources/App/Views/Profile/TextToSpeechView.swift @@ -4,6 +4,7 @@ import SwiftUI import Views + // swiftlint:disable line_length struct TextToSpeechView: View { @EnvironmentObject var audioController: AudioController diff --git a/apple/OmnivoreKit/Sources/App/Views/Profile/TextToSpeechVoiceSelectionView.swift b/apple/OmnivoreKit/Sources/App/Views/Profile/TextToSpeechVoiceSelectionView.swift index 54521a35d..3a5aa99c4 100644 --- a/apple/OmnivoreKit/Sources/App/Views/Profile/TextToSpeechVoiceSelectionView.swift +++ b/apple/OmnivoreKit/Sources/App/Views/Profile/TextToSpeechVoiceSelectionView.swift @@ -62,8 +62,10 @@ } .navigationTitle("Choose a Voice") .onAppear { + // swiftlint:disable:next line_length viewModel.realisticVoicesToggle = (audioController.useUltraRealisticVoices && !audioController.ultraRealisticFeatureKey.isEmpty) - }.onChange(of: viewModel.realisticVoicesToggle) { value in + } + .onChange(of: viewModel.realisticVoicesToggle) { value in if value, audioController.ultraRealisticFeatureKey.isEmpty { // User wants to sign up viewModel.waitingForRealisticVoices = true @@ -94,6 +96,7 @@ private var ultraRealisticVoices: some View { ForEach([VoiceCategory.enUS], id: \.self) { category in Section(category.rawValue) { + // swiftlint:disable:next line_length ForEach(audioController.realisticVoiceList?.filter { $0.category == category } ?? [], id: \.key.self) { voice in voiceRow(for: voice) } diff --git a/apple/OmnivoreKit/Sources/App/Views/WebReader/HighlightViewer.swift b/apple/OmnivoreKit/Sources/App/Views/WebReader/HighlightViewer.swift index e27a2d50c..571858e50 100644 --- a/apple/OmnivoreKit/Sources/App/Views/WebReader/HighlightViewer.swift +++ b/apple/OmnivoreKit/Sources/App/Views/WebReader/HighlightViewer.swift @@ -54,6 +54,7 @@ struct HighlightViewer: PlatformViewRepresentable { } private func loadContent(webView: WKWebView) { + // swiftlint:disable line_length let themeKey = ThemeManager.currentThemeName let content = """ @@ -73,6 +74,7 @@ struct HighlightViewer: PlatformViewRepresentable { """ + // swiftlint:enable line_length webView.loadHTMLString(content, baseURL: ViewsPackage.resourceURL) } diff --git a/apple/OmnivoreKit/Sources/App/Views/WebReader/WebReaderContainer.swift b/apple/OmnivoreKit/Sources/App/Views/WebReader/WebReaderContainer.swift index 7d3ca406c..0176e8718 100644 --- a/apple/OmnivoreKit/Sources/App/Views/WebReader/WebReaderContainer.swift +++ b/apple/OmnivoreKit/Sources/App/Views/WebReader/WebReaderContainer.swift @@ -195,6 +195,7 @@ struct WebReaderContainerView: View { viewModel.downloadAudio(audioController: audioController, item: item) }, label: { + // swiftlint:disable:next line_length Label(viewModel.isDownloadingAudio ? "Downloading Audio" : "Download Audio", systemImage: "icloud.and.arrow.down") } ) diff --git a/apple/OmnivoreKit/Sources/Services/AudioSession/SpeechPlayerItem.swift b/apple/OmnivoreKit/Sources/Services/AudioSession/SpeechPlayerItem.swift index 1f71cd6b0..90a31ff46 100644 --- a/apple/OmnivoreKit/Sources/Services/AudioSession/SpeechPlayerItem.swift +++ b/apple/OmnivoreKit/Sources/Services/AudioSession/SpeechPlayerItem.swift @@ -22,6 +22,7 @@ class SpeechPlayerItem: AVPlayerItem { var observer: Any? + // swiftlint:disable:next line_length init(session: AudioController, prefetchQueue: OperationQueue, speechItem: SpeechItem, completed: @escaping () -> Void) { self.speechItem = speechItem self.session = session @@ -120,6 +121,7 @@ class SpeechPlayerItem: AVPlayerItem { } do { + // swiftlint:disable:next line_length let speechData = try await SpeechSynthesizer.download(speechItem: speechItem, session: self.session ?? URLSession.shared) DispatchQueue.main.async { @@ -173,6 +175,7 @@ class SpeechPlayerItem: AVPlayerItem { _ = requestsFulfilled.map { self.pendingRequests.remove($0) } } + // swiftlint:disable:next line_length func fillInContentInformationRequest(_ contentInformationRequest: AVAssetResourceLoadingContentInformationRequest?) { contentInformationRequest?.contentType = UTType.mp3.identifier diff --git a/apple/OmnivoreKit/Sources/Services/AudioSession/Voices.swift b/apple/OmnivoreKit/Sources/Services/AudioSession/Voices.swift index d145688e9..b84e47043 100644 --- a/apple/OmnivoreKit/Sources/Services/AudioSession/Voices.swift +++ b/apple/OmnivoreKit/Sources/Services/AudioSession/Voices.swift @@ -53,6 +53,7 @@ public struct VoicePair { let category: VoiceCategory } +// swiftlint:disable line_length public enum Voices { public static func isUltraRealisticVoice(_ voiceKey: String) -> Bool { UltraPairs.contains(where: { voice in @@ -77,7 +78,6 @@ public enum Voices { VoiceLanguage(key: "ta", name: "Tamil", defaultVoice: "ta-IN-PallaviNeural", categories: [.taIN, .taLK, .taMY, .taSG]) ] - // swiftlint:disable all public static let Pairs = [ VoicePair(firstKey: "en-US-JennyNeural", secondKey: "en-US-BrandonNeural", firstName: "Jenny", secondName: "Brandon", language: "en-US", category: .enUS), VoicePair(firstKey: "en-US-CoraNeural", secondKey: "en-US-ChristopherNeural", firstName: "Cora", secondName: "Christopher", language: "en-US", category: .enUS), diff --git a/apple/OmnivoreKit/Sources/Services/DataService/Mutations/CreateRecommendationGroup.swift b/apple/OmnivoreKit/Sources/Services/DataService/Mutations/CreateRecommendationGroup.swift index 7e15ca9fe..525be340d 100644 --- a/apple/OmnivoreKit/Sources/Services/DataService/Mutations/CreateRecommendationGroup.swift +++ b/apple/OmnivoreKit/Sources/Services/DataService/Mutations/CreateRecommendationGroup.swift @@ -4,6 +4,7 @@ import Models import SwiftGraphQL public extension DataService { + // swiftlint:disable:next line_length func createRecommendationGroup(name: String, onlyAdminCanPost: Bool, onlyAdminCanSeeMembers: Bool) async throws -> InternalRecommendationGroup { enum MutationResult { case saved(recommendationGroup: InternalRecommendationGroup) diff --git a/apple/OmnivoreKit/Sources/Utils/UIViewControllerExtensions.swift b/apple/OmnivoreKit/Sources/Utils/UIViewControllerExtensions.swift index cf337a68c..9b8fcf751 100644 --- a/apple/OmnivoreKit/Sources/Utils/UIViewControllerExtensions.swift +++ b/apple/OmnivoreKit/Sources/Utils/UIViewControllerExtensions.swift @@ -2,6 +2,7 @@ import UIKit public extension UIViewController { + // swiftlint:disable line_length func embed(childViewController child: UIViewController, heightRatio: CGFloat? = nil) { addChild(child) diff --git a/apple/OmnivoreKit/Sources/Views/CommunityModal.swift b/apple/OmnivoreKit/Sources/Views/CommunityModal.swift index 94bb9a449..fe02d05ec 100644 --- a/apple/OmnivoreKit/Sources/Views/CommunityModal.swift +++ b/apple/OmnivoreKit/Sources/Views/CommunityModal.swift @@ -9,6 +9,7 @@ import Foundation import StoreKit import SwiftUI +// swiftlint:disable:next line_length let tweetUrl = "https://twitter.com/intent/tweet?text=I%20recently%20started%20using%20@OmnivoreApp%20as%20a%20free,%20open-source%20read-it-later%20app.%20Check%20it%20out:%20https://omnivore.app" public struct CommunityModal: View { @@ -80,6 +81,7 @@ public struct CommunityModal: View { var buttonLinks: some View { VStack(spacing: 15) { Button(action: { + // swiftlint:disable:next line_length if let scene = UIApplication.shared.connectedScenes.first(where: { $0.activationState == .foregroundActive }) as? UIWindowScene { SKStoreReviewController.requestReview(in: scene) } diff --git a/apple/OmnivoreKit/Sources/Views/TextChip.swift b/apple/OmnivoreKit/Sources/Views/TextChip.swift index 920b877ab..6500a014f 100644 --- a/apple/OmnivoreKit/Sources/Views/TextChip.swift +++ b/apple/OmnivoreKit/Sources/Views/TextChip.swift @@ -27,6 +27,7 @@ public struct TextChip: View { self.padded = false } + // swiftlint:disable:next line_length public init?(feedItemLabel: LinkedItemLabel, negated: Bool = false, checked: Bool = false, padded: Bool = false, onTap: ((TextChip) -> Void)?) { guard let color = Color(hex: feedItemLabel.color ?? "") else { return nil diff --git a/apple/Sources/AppDelegate.swift b/apple/Sources/AppDelegate.swift index 45b292604..e1672654e 100644 --- a/apple/Sources/AppDelegate.swift +++ b/apple/Sources/AppDelegate.swift @@ -48,6 +48,7 @@ private let logger = Logger(subsystem: "app.omnivore", category: "app-delegate") Services.registerBackgroundFetch() configureFirebase() + // swiftlint:disable:next line_length NotificationCenter.default.addObserver(forName: Notification.Name("ReconfigurePushNotifications"), object: nil, queue: OperationQueue.main) { _ in if UserDefaults.standard.bool(forKey: UserDefaultKey.notificationsEnabled.rawValue) { self.registerForNotifications()