From c125189b892279956dded5f7ec0b53f69edc3051 Mon Sep 17 00:00:00 2001 From: Doug <6060466+pixlwave@users.noreply.github.com> Date: Wed, 6 Jul 2022 16:01:50 +0100 Subject: [PATCH] Enable blank line rules. (#132) --- .swiftformat | 2 -- DesignKit/Sources/Fonts/ElementSharedFonts.swift | 2 -- DesignKit/Sources/Fonts/Fonts.swift | 1 - DesignKit/Sources/Fonts/UIFont.swift | 1 - ElementX/Sources/AppDelegate.swift | 1 - ElementX/Sources/BuildSettings.swift | 2 -- ElementX/Sources/Other/Coordinator.swift | 2 -- .../Sources/Other/ElementNavigationController.swift | 2 -- ElementX/Sources/Other/ElementSettings.swift | 1 - ElementX/Sources/Other/Extensions/Bundle.swift | 2 -- .../Other/HTMLParsing/AttributedStringBuilder.swift | 2 -- .../DTHTMLElement+AttributedStringBuilder.swift | 1 - ElementX/Sources/Other/ImageAnonymizer.swift | 2 -- ElementX/Sources/Other/Logging/MXLog.swift | 2 -- ElementX/Sources/Other/Routers/NavigationModule.swift | 2 -- ElementX/Sources/Other/Routers/NavigationRouter.swift | 10 ---------- .../Sources/Other/Routers/NavigationRouterStore.swift | 3 --- .../Other/Routers/NavigationRouterStoreProtocol.swift | 1 - .../Sources/Other/Routers/NavigationRouterType.swift | 5 ----- ElementX/Sources/Other/Routers/Presentable.swift | 2 -- ElementX/Sources/Other/Routers/RootRouter.swift | 2 -- ElementX/Sources/Other/Routers/RootRouterType.swift | 1 - .../Other/SwiftUI/ViewModel/StateStoreViewModel.swift | 1 - .../Other/SwiftUI/Views/ElementToggleStyle.swift | 1 - .../UserIndicators/ActivityIndicatorPresenter.swift | 2 -- .../Other/UserIndicators/ActivityIndicatorView.swift | 1 - .../Other/UserIndicators/RectangleToastView.swift | 1 - .../Other/UserIndicators/RoundedToastView.swift | 1 - .../Sources/Other/WeakDictionary/WeakDictionary.swift | 2 -- .../WeakDictionary/WeakDictionaryKeyReference.swift | 1 - .../Other/WeakDictionary/WeakKeyDictionary.swift | 2 -- .../Authentication/AuthenticationCoordinator.swift | 1 - .../Authentication/AuthenticationIconImage.swift | 1 - .../Authentication/LoginScreen/LoginCoordinator.swift | 1 - .../Authentication/LoginScreen/LoginHomeserver.swift | 1 - .../Authentication/LoginScreen/LoginViewModel.swift | 1 - .../LoginScreen/LoginViewModelProtocol.swift | 1 - .../Authentication/LoginScreen/View/LoginScreen.swift | 2 -- .../LoginScreen/View/LoginServerInfoSection.swift | 1 - .../ServerSelection/ServerSelectionCoordinator.swift | 1 - .../ServerSelection/ServerSelectionViewModel.swift | 1 - .../ServerSelectionViewModelProtocol.swift | 1 - .../ServerSelection/View/ServerSelectionScreen.swift | 1 - .../Screens/BugReport/BugReportCoordinator.swift | 1 - .../Sources/Screens/BugReport/BugReportViewModel.swift | 1 - .../Screens/BugReport/BugReportViewModelProtocol.swift | 1 - .../Screens/BugReport/View/BugReportScreen.swift | 1 - .../Screens/HomeScreen/HomeScreenCoordinator.swift | 1 - .../Screens/HomeScreen/HomeScreenViewModel.swift | 2 -- .../Sources/Screens/HomeScreen/View/HomeScreen.swift | 3 --- .../Screens/RoomScreen/RoomScreenCoordinator.swift | 1 - .../Screens/RoomScreen/RoomScreenViewModel.swift | 1 - .../Screens/RoomScreen/View/ListTableViewAdapter.swift | 1 - .../Screens/RoomScreen/View/MessageComposer.swift | 1 - .../RoomScreen/View/MessageComposerTextField.swift | 1 - .../Screens/RoomScreen/View/RoomHeaderView.swift | 2 -- .../Sources/Screens/RoomScreen/View/RoomScreen.swift | 1 - .../View/Style/TimelineItemBubbledStylerView.swift | 2 -- .../View/Style/TimelineItemPlainStylerView.swift | 1 - .../RoomScreen/View/Timeline/FormattedBodyText.swift | 1 - .../View/Timeline/PlaceholderAvatarImage.swift | 1 - .../RoomScreen/View/TimelineItemContextMenu.swift | 1 - .../Screens/RoomScreen/View/TimelineItemList.swift | 1 - .../RoomScreen/View/TimelineSenderAvatarView.swift | 2 -- .../Sources/Screens/RoomScreen/View/TimelineView.swift | 1 - .../SessionVerificationCoordinator.swift | 1 - .../SessionVerificationViewModel.swift | 2 -- .../View/SessionVerificationScreen.swift | 1 - .../Sources/Screens/Settings/SettingsCoordinator.swift | 1 - .../Sources/Screens/Settings/SettingsViewModel.swift | 1 - .../Screens/Settings/SettingsViewModelProtocol.swift | 1 - .../Sources/Screens/Settings/View/SettingsScreen.swift | 1 - .../Screens/SplashScreen/SplashScreenCoordinator.swift | 1 - .../Screens/SplashScreen/SplashScreenModels.swift | 1 - .../Screens/SplashScreen/SplashScreenViewModel.swift | 1 - .../Screens/SplashScreen/View/SplashScreen.swift | 3 --- .../SplashScreen/View/SplashScreenPageIndicator.swift | 1 - .../SplashScreen/View/SplashScreenPageView.swift | 1 - .../Authentication/AuthenticationService.swift | 1 - .../Background/BackgroundTaskServiceProtocol.swift | 4 ---- .../Background/UIKitBackgroundTaskService.swift | 2 -- .../Sources/Services/BugReport/BugReportService.swift | 1 - .../Services/BugReport/BugReportServiceProtocol.swift | 1 - .../Services/BugReport/MockBugReportService.swift | 2 -- .../Services/BugReport/ScreenshotDetector.swift | 4 ---- ElementX/Sources/Services/Client/ClientProxy.swift | 2 -- ElementX/Sources/Services/Client/MockClientProxy.swift | 1 - .../Sources/Services/Media/MockMediaProvider.swift | 1 - .../Room/Members/MemberDetailProviderManager.swift | 1 - .../Services/Room/RoomSummary/EventBriefFactory.swift | 1 - .../Services/Timeline/MockRoomTimelineController.swift | 1 - .../TimelineItems/RoomTimelineItemFactory.swift | 1 - .../Services/UserSessionStore/UserSessionStore.swift | 1 - ElementX/Sources/UITestsRootView.swift | 1 - .../ElementX/TemplateCoordinator.swift | 1 - .../ElementX/TemplateViewModel.swift | 1 - .../ElementX/View/TemplateScreen.swift | 1 - UITests/Sources/BugReportUITests.swift | 2 -- UITests/Sources/RoomScreenUITests.swift | 1 - UITests/Sources/ServerSelectionUITests.swift | 1 - UITests/Sources/SessionVerificationUITests.swift | 1 - UITests/Sources/SettingsUITests.swift | 2 -- UnitTests/Sources/AttributedStringBuilderTests.swift | 2 -- UnitTests/Sources/BackgroundTaskTests.swift | 6 ------ UnitTests/Sources/BugReportServiceTests.swift | 6 ------ UnitTests/Sources/BugReportViewModelTests.swift | 1 - UnitTests/Sources/ElementXTests.swift | 1 - UnitTests/Sources/HomeScreenViewModelTests.swift | 2 -- UnitTests/Sources/ImageAnonymizerTests.swift | 2 -- UnitTests/Sources/LocalizationTests.swift | 2 -- UnitTests/Sources/LoggingTests.swift | 2 -- UnitTests/Sources/ScreenshotDetectorTests.swift | 2 -- .../Sources/SessionVerificationViewModelTests.swift | 3 --- UnitTests/Sources/SettingsViewModelTests.swift | 2 -- 114 files changed, 184 deletions(-) diff --git a/.swiftformat b/.swiftformat index 690f0afdd..90d11ac9a 100644 --- a/.swiftformat +++ b/.swiftformat @@ -3,8 +3,6 @@ --exclude ElementX/Sources/Generated --disable wrapMultiLineStatementBraces ---disable blankLinesAtStartOfScope ---disable blankLinesAtEndOfScope --disable hoistPatternLet --commas inline diff --git a/DesignKit/Sources/Fonts/ElementSharedFonts.swift b/DesignKit/Sources/Fonts/ElementSharedFonts.swift index 8090132c9..7f3f57666 100644 --- a/DesignKit/Sources/Fonts/ElementSharedFonts.swift +++ b/DesignKit/Sources/Fonts/ElementSharedFonts.swift @@ -19,7 +19,6 @@ import SwiftUI /// Fonts at https://www.figma.com/file/X4XTH9iS2KGJ2wFKDqkyed/Compound?node-id=1362%3A0 @objcMembers public class ElementSharedFonts { - // MARK: - Types /// A wrapper to provide both a `UIFont` and a SwiftUI `Font` in the same type. @@ -43,7 +42,6 @@ public class ElementSharedFonts { // MARK: - Fonts protocol public extension ElementSharedFonts { - var largeTitle: SharedFont { let uiFont = font(forTextStyle: .largeTitle) return SharedFont(uiFont: uiFont, font: .largeTitle) diff --git a/DesignKit/Sources/Fonts/Fonts.swift b/DesignKit/Sources/Fonts/Fonts.swift index faa2b3132..d781964b7 100644 --- a/DesignKit/Sources/Fonts/Fonts.swift +++ b/DesignKit/Sources/Fonts/Fonts.swift @@ -20,7 +20,6 @@ import Foundation /// Font names are based on Element typography https://www.figma.com/file/X4XTH9iS2KGJ2wFKDqkyed/Compound?node-id=1362%3A0 which is based on Apple font text styles (UIFont.TextStyle): https://developer.apple.com/documentation/uikit/uifonttextstyle /// Create a custom TextStyle enum (like DesignKit.Fonts.TextStyle) is also a possibility public protocol Fonts { - associatedtype FontType /// The font for large titles. diff --git a/DesignKit/Sources/Fonts/UIFont.swift b/DesignKit/Sources/Fonts/UIFont.swift index f1524ca6e..3288edcbb 100644 --- a/DesignKit/Sources/Fonts/UIFont.swift +++ b/DesignKit/Sources/Fonts/UIFont.swift @@ -17,7 +17,6 @@ import UIKit public extension UIFont { - // MARK: - Convenient methods /// Update current font with a SymbolicTraits diff --git a/ElementX/Sources/AppDelegate.swift b/ElementX/Sources/AppDelegate.swift index deb5a226c..a33c8445a 100644 --- a/ElementX/Sources/AppDelegate.swift +++ b/ElementX/Sources/AppDelegate.swift @@ -10,7 +10,6 @@ import UIKit @main class AppDelegate: UIResponder, UIApplicationDelegate { - private lazy var appCoordinator: Coordinator = isRunningUITests ? UITestsAppCoordinator() : AppCoordinator() func application(_ application: UIApplication, willFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil) -> Bool { diff --git a/ElementX/Sources/BuildSettings.swift b/ElementX/Sources/BuildSettings.swift index d3ec391a0..e93e8bd57 100644 --- a/ElementX/Sources/BuildSettings.swift +++ b/ElementX/Sources/BuildSettings.swift @@ -9,7 +9,6 @@ import Foundation final class BuildSettings { - // MARK: - Servers static let defaultHomeserverURLString = "https://matrix.org" @@ -32,5 +31,4 @@ final class BuildSettings { // MARK: - Room screen static let defaultRoomTimelineStyle: TimelineStyle = .bubbles - } diff --git a/ElementX/Sources/Other/Coordinator.swift b/ElementX/Sources/Other/Coordinator.swift index f9d5dfe73..323eae256 100755 --- a/ElementX/Sources/Other/Coordinator.swift +++ b/ElementX/Sources/Other/Coordinator.swift @@ -21,7 +21,6 @@ import UIKit /// It helps to isolate and reuse view controllers and pass dependencies down the navigation hierarchy. @MainActor protocol Coordinator: AnyObject { - /// Starts job of the coordinator. func start() @@ -41,7 +40,6 @@ protocol Coordinator: AnyObject { // `Coordinator` default implementation extension Coordinator { - func add(childCoordinator coordinator: Coordinator) { childCoordinators.append(coordinator) } diff --git a/ElementX/Sources/Other/ElementNavigationController.swift b/ElementX/Sources/Other/ElementNavigationController.swift index 2dbdab5be..b0847765d 100644 --- a/ElementX/Sources/Other/ElementNavigationController.swift +++ b/ElementX/Sources/Other/ElementNavigationController.swift @@ -9,10 +9,8 @@ import UIKit class ElementNavigationController: UINavigationController { - override func viewWillLayoutSubviews() { super.viewWillLayoutSubviews() navigationBar.topItem?.backButtonDisplayMode = .minimal } - } diff --git a/ElementX/Sources/Other/ElementSettings.swift b/ElementX/Sources/Other/ElementSettings.swift index be7452376..07b9643ad 100644 --- a/ElementX/Sources/Other/ElementSettings.swift +++ b/ElementX/Sources/Other/ElementSettings.swift @@ -11,7 +11,6 @@ import SwiftUI /// Store Element specific app settings. final class ElementSettings: ObservableObject { - // MARK: - Constants public enum UserDefaultsKeys: String { diff --git a/ElementX/Sources/Other/Extensions/Bundle.swift b/ElementX/Sources/Other/Extensions/Bundle.swift index 6ee01f595..30ffd1e36 100644 --- a/ElementX/Sources/Other/Extensions/Bundle.swift +++ b/ElementX/Sources/Other/Extensions/Bundle.swift @@ -9,7 +9,6 @@ import Foundation public extension Bundle { - /// Get an lproj language bundle from the receiver bundle. /// - Parameter language: The language to try to load. /// - Returns: The lproj bundle if found otherwise nil. @@ -46,5 +45,4 @@ public extension Bundle { .compactMap { $0 } .filter { set.insert($0).inserted } } - } diff --git a/ElementX/Sources/Other/HTMLParsing/AttributedStringBuilder.swift b/ElementX/Sources/Other/HTMLParsing/AttributedStringBuilder.swift index 3a21f7f0f..410773793 100644 --- a/ElementX/Sources/Other/HTMLParsing/AttributedStringBuilder.swift +++ b/ElementX/Sources/Other/HTMLParsing/AttributedStringBuilder.swift @@ -10,7 +10,6 @@ import DTCoreText import Foundation struct AttributedStringBuilder: AttributedStringBuilderProtocol { - private let temporaryBlockquoteMarkingColor = UIColor.magenta private let temporaryCodeBlockMarkingColor = UIColor.cyan private let linkColor = UIColor.blue @@ -159,7 +158,6 @@ struct AttributedStringBuilder: AttributedStringBuilderProtocol { } private func addLinks(_ attributedString: NSMutableAttributedString) { - let string = attributedString.string let range = NSRange(location: 0, length: attributedString.string.count) diff --git a/ElementX/Sources/Other/HTMLParsing/DTHTMLElement+AttributedStringBuilder.swift b/ElementX/Sources/Other/HTMLParsing/DTHTMLElement+AttributedStringBuilder.swift index e8dfae055..b93a9b54a 100644 --- a/ElementX/Sources/Other/HTMLParsing/DTHTMLElement+AttributedStringBuilder.swift +++ b/ElementX/Sources/Other/HTMLParsing/DTHTMLElement+AttributedStringBuilder.swift @@ -17,7 +17,6 @@ public extension DTHTMLElement { /// - imageHandler: An optional image handler to be run on `img` tags (if allowed) to update the `src` attribute. @objc func sanitize(font: UIFont) { if let name = name, !Self.allowedHTMLTags.contains(name) { - // This is an unsupported tag. // Remove any attachments to fix rendering. textAttachment = nil diff --git a/ElementX/Sources/Other/ImageAnonymizer.swift b/ElementX/Sources/Other/ImageAnonymizer.swift index ac9804d99..bd7bea9d0 100644 --- a/ElementX/Sources/Other/ImageAnonymizer.swift +++ b/ElementX/Sources/Other/ImageAnonymizer.swift @@ -15,7 +15,6 @@ enum ImageAnonymizerError: Error { } enum ImageAnonymizer { - private static var allowedTextItems: [String] = [ "#", "@", @@ -113,5 +112,4 @@ enum ImageAnonymizer { } return result } - } diff --git a/ElementX/Sources/Other/Logging/MXLog.swift b/ElementX/Sources/Other/Logging/MXLog.swift index 03686dea0..c3e66f048 100644 --- a/ElementX/Sources/Other/Logging/MXLog.swift +++ b/ElementX/Sources/Other/Logging/MXLog.swift @@ -19,7 +19,6 @@ import SwiftyBeaver /// Various MXLog configuration options. Used in conjunction with `MXLog.configure()` @objc public class MXLogConfiguration: NSObject { - /// the desired log level. `.verbose` by default. @objc public var logLevel = MXLogLevel.verbose @@ -58,7 +57,6 @@ private var logger: SwiftyBeaver.Type = { Please see `MXLog.h` for Objective-C options. */ @objc public class MXLog: NSObject { - /// Method used to customize MXLog's behavior. /// Called automatically when first accessing the logger with the default values. /// Please see `MXLogConfiguration` for all available options. diff --git a/ElementX/Sources/Other/Routers/NavigationModule.swift b/ElementX/Sources/Other/Routers/NavigationModule.swift index ce2f3789c..ba246cd32 100644 --- a/ElementX/Sources/Other/Routers/NavigationModule.swift +++ b/ElementX/Sources/Other/Routers/NavigationModule.swift @@ -28,9 +28,7 @@ struct NavigationModule { // MARK: - CustomStringConvertible extension NavigationModule: CustomStringConvertible { - var description: String { "NavigationModule: \(presentable), pop completion: \(String(describing: popCompletion))" } - } diff --git a/ElementX/Sources/Other/Routers/NavigationRouter.swift b/ElementX/Sources/Other/Routers/NavigationRouter.swift index b68c19183..9e2808153 100755 --- a/ElementX/Sources/Other/Routers/NavigationRouter.swift +++ b/ElementX/Sources/Other/Routers/NavigationRouter.swift @@ -18,7 +18,6 @@ import UIKit /// `NavigationRouter` is a concrete implementation of NavigationRouterType. final class NavigationRouter: NSObject, NavigationRouterType { - // MARK: - Properties // MARK: Private @@ -117,7 +116,6 @@ final class NavigationRouter: NSObject, NavigationRouterType { } func setModules(_ modules: [NavigationModule], hideNavigationBar: Bool, animated: Bool) { - MXLog.debug("[NavigationRouter] Set modules \(modules)") let controllers = modules.map { module -> UIViewController in @@ -279,7 +277,6 @@ final class NavigationRouter: NSObject, NavigationRouterType { } func contains(_ module: Presentable) -> Bool { - let controller = module.toPresentable() return navigationController.viewControllers.contains(controller) } @@ -293,7 +290,6 @@ final class NavigationRouter: NSObject, NavigationRouterType { // MARK: - Private private func module(for viewController: UIViewController) -> Presentable { - guard let module = storedModules[viewController] as? Presentable else { return viewController } @@ -339,7 +335,6 @@ final class NavigationRouter: NSObject, NavigationRouterType { } private func postNotification(withName name: Notification.Name, for viewController: UIViewController) { - let module = module(for: viewController) let userInfo: [String: Any] = [ @@ -354,14 +349,11 @@ final class NavigationRouter: NSObject, NavigationRouterType { // MARK: - UINavigationControllerDelegate extension NavigationRouter: UINavigationControllerDelegate { - func navigationController(_ navigationController: UINavigationController, willShow viewController: UIViewController, animated: Bool) { - // Try to post `NavigationRouter.willPopModule` notification here } func navigationController(_ navigationController: UINavigationController, didShow viewController: UIViewController, animated: Bool) { - // Ensure the view controller is popping guard let poppedViewController = navigationController.transitionCoordinator?.viewController(forKey: .from), !navigationController.viewControllers.contains(poppedViewController) else { @@ -377,7 +369,6 @@ extension NavigationRouter: UINavigationControllerDelegate { // MARK: - NavigationRouter notification constants extension NavigationRouter { - // MARK: Notification names public static let willPushModule = Notification.Name("NavigationRouterWillPushModule") @@ -391,7 +382,6 @@ extension NavigationRouter { // MARK: Notification keys public enum NotificationUserInfoKey { - /// The associated view controller (UIViewController). static let viewController = "viewController" diff --git a/ElementX/Sources/Other/Routers/NavigationRouterStore.swift b/ElementX/Sources/Other/Routers/NavigationRouterStore.swift index e130f18cd..606877cc6 100644 --- a/ElementX/Sources/Other/Routers/NavigationRouterStore.swift +++ b/ElementX/Sources/Other/Routers/NavigationRouterStore.swift @@ -18,7 +18,6 @@ import UIKit /// `NavigationRouterStore` enables to get a NavigationRouter from a UINavigationController instance. class NavigationRouterStore: NavigationRouterStoreProtocol { - // MARK: - Constants static let shared = NavigationRouterStore() @@ -39,7 +38,6 @@ class NavigationRouterStore: NavigationRouterStoreProtocol { // MARK: - Public func navigationRouter(for navigationController: UINavigationController) -> NavigationRouterType { - if let existingNavigationRouter = findNavigationRouter(for: navigationController) { return existingNavigationRouter } @@ -64,7 +62,6 @@ class NavigationRouterStore: NavigationRouterStoreProtocol { } @objc private func navigationRouterDidCreate(_ notification: Notification) { - guard let userInfo = notification.userInfo, let navigationRouter = userInfo[NavigationRouter.NotificationUserInfoKey.navigationRouter] as? NavigationRouterType, let navigationController = userInfo[NavigationRouter.NotificationUserInfoKey.navigationController] as? UINavigationController else { diff --git a/ElementX/Sources/Other/Routers/NavigationRouterStoreProtocol.swift b/ElementX/Sources/Other/Routers/NavigationRouterStoreProtocol.swift index be48666ad..ad7a2e7dd 100644 --- a/ElementX/Sources/Other/Routers/NavigationRouterStoreProtocol.swift +++ b/ElementX/Sources/Other/Routers/NavigationRouterStoreProtocol.swift @@ -19,7 +19,6 @@ import UIKit /// `NavigationRouterStoreProtocol` describes a structure that enables to get a NavigationRouter from a UINavigationController instance. @MainActor protocol NavigationRouterStoreProtocol { - /// Gets the existing navigation router for the supplied controller, creating a new one if it doesn't yet exist. /// Note: The store only holds a weak reference to the returned router. It is the caller's responsibility to retain it. func navigationRouter(for navigationController: UINavigationController) -> NavigationRouterType diff --git a/ElementX/Sources/Other/Routers/NavigationRouterType.swift b/ElementX/Sources/Other/Routers/NavigationRouterType.swift index 1d1e39a90..c7cebec02 100755 --- a/ElementX/Sources/Other/Routers/NavigationRouterType.swift +++ b/ElementX/Sources/Other/Routers/NavigationRouterType.swift @@ -20,7 +20,6 @@ import UIKit /// Routers are used to be passed between coordinators. They handles only `physical` navigation. @MainActor protocol NavigationRouterType: AnyObject, Presentable { - /// Present modally a view controller on the navigation controller /// /// - Parameter module: The Presentable to present. @@ -91,7 +90,6 @@ protocol NavigationRouterType: AnyObject, Presentable { // `NavigationRouterType` default implementation extension NavigationRouterType { - func setRootModule(_ module: Presentable) { setRootModule(module, hideNavigationBar: false, animated: false, popCompletion: nil) } @@ -107,13 +105,11 @@ extension NavigationRouterType { func setModules(_ modules: [Presentable], animated: Bool) { setModules(modules, hideNavigationBar: false, animated: animated) } - } // MARK: - Presentable <--> NavigationModule Transitive Methods extension NavigationRouterType { - func setRootModule(_ module: NavigationModule) { setRootModule(module.presentable, popCompletion: module.popCompletion) } @@ -132,5 +128,4 @@ extension NavigationRouterType { push(modules.map { $0.toModule() }, animated: animated) } - } diff --git a/ElementX/Sources/Other/Routers/Presentable.swift b/ElementX/Sources/Other/Routers/Presentable.swift index dcb9c4154..9ca9dd8b8 100755 --- a/ElementX/Sources/Other/Routers/Presentable.swift +++ b/ElementX/Sources/Other/Routers/Presentable.swift @@ -29,11 +29,9 @@ extension UIViewController: Presentable { } extension Presentable { - /// Returns a new module from the presentable without a pop completion block /// - Returns: Module func toModule() -> NavigationModule { NavigationModule(presentable: self, popCompletion: nil) } - } diff --git a/ElementX/Sources/Other/Routers/RootRouter.swift b/ElementX/Sources/Other/Routers/RootRouter.swift index bea2ed741..aad4342f9 100755 --- a/ElementX/Sources/Other/Routers/RootRouter.swift +++ b/ElementX/Sources/Other/Routers/RootRouter.swift @@ -18,7 +18,6 @@ import UIKit /// `RootRouter` is a concrete implementation of RootRouterType. final class RootRouter: RootRouterType { - // MARK: - Constants // `rootViewController` animation constants @@ -69,7 +68,6 @@ final class RootRouter: RootRouterType { // MARK: - Private methods private func updateRootViewController(rootViewController: UIViewController?, animated: Bool, completion: (() -> Void)?) { - if animated { UIView.transition(with: window, duration: RootViewControllerUpdateAnimation.duration, options: RootViewControllerUpdateAnimation.options, animations: { let oldState: Bool = UIView.areAnimationsEnabled diff --git a/ElementX/Sources/Other/Routers/RootRouterType.swift b/ElementX/Sources/Other/Routers/RootRouterType.swift index 6fd49d1b2..8d6d63473 100755 --- a/ElementX/Sources/Other/Routers/RootRouterType.swift +++ b/ElementX/Sources/Other/Routers/RootRouterType.swift @@ -20,7 +20,6 @@ import UIKit /// Routers are used to be passed between coordinators. They handles only `physical` navigation. @MainActor protocol RootRouterType: AnyObject { - /// Update the root view controller /// /// - Parameter module: The new root view controller to set diff --git a/ElementX/Sources/Other/SwiftUI/ViewModel/StateStoreViewModel.swift b/ElementX/Sources/Other/SwiftUI/ViewModel/StateStoreViewModel.swift index d85440cbb..81bd30592 100644 --- a/ElementX/Sources/Other/SwiftUI/ViewModel/StateStoreViewModel.swift +++ b/ElementX/Sources/Other/SwiftUI/ViewModel/StateStoreViewModel.swift @@ -73,7 +73,6 @@ class ViewModelContext: ObservableObject { /// we can do it in this centralised place. @MainActor class StateStoreViewModel { - typealias Context = ViewModelContext // MARK: - Properties diff --git a/ElementX/Sources/Other/SwiftUI/Views/ElementToggleStyle.swift b/ElementX/Sources/Other/SwiftUI/Views/ElementToggleStyle.swift index 200a61726..584322368 100644 --- a/ElementX/Sources/Other/SwiftUI/Views/ElementToggleStyle.swift +++ b/ElementX/Sources/Other/SwiftUI/Views/ElementToggleStyle.swift @@ -10,7 +10,6 @@ import SwiftUI /// A toggle style that uses a button, with a checked/unchecked image like a checkbox. struct ElementToggleStyle: ToggleStyle { - func makeBody(configuration: Configuration) -> some View { Button { configuration.isOn.toggle() } label: { Image(systemName: configuration.isOn ? "checkmark.square.fill" : "square") diff --git a/ElementX/Sources/Other/UserIndicators/ActivityIndicatorPresenter.swift b/ElementX/Sources/Other/UserIndicators/ActivityIndicatorPresenter.swift index 47e5e887f..da33a5f7b 100755 --- a/ElementX/Sources/Other/UserIndicators/ActivityIndicatorPresenter.swift +++ b/ElementX/Sources/Other/UserIndicators/ActivityIndicatorPresenter.swift @@ -19,7 +19,6 @@ import UIKit /// Used to present activity indicator on a view final class ActivityIndicatorPresenter: ActivityIndicatorPresenterType { - // MARK: - Constants private enum Constants { @@ -131,7 +130,6 @@ final class ActivityIndicatorPresenter: ActivityIndicatorPresenterType { } private extension UIView { - /// Add a subview matching parent view using autolayout @objc func vc_addSubViewMatchingParent(_ subView: UIView) { addSubview(subView) diff --git a/ElementX/Sources/Other/UserIndicators/ActivityIndicatorView.swift b/ElementX/Sources/Other/UserIndicators/ActivityIndicatorView.swift index 43e85660b..c1622d5ce 100755 --- a/ElementX/Sources/Other/UserIndicators/ActivityIndicatorView.swift +++ b/ElementX/Sources/Other/UserIndicators/ActivityIndicatorView.swift @@ -17,7 +17,6 @@ import UIKit final class ActivityIndicatorView: UIView { - // MARK: - Constants private enum Constants { diff --git a/ElementX/Sources/Other/UserIndicators/RectangleToastView.swift b/ElementX/Sources/Other/UserIndicators/RectangleToastView.swift index b59aa1935..5bc96b440 100644 --- a/ElementX/Sources/Other/UserIndicators/RectangleToastView.swift +++ b/ElementX/Sources/Other/UserIndicators/RectangleToastView.swift @@ -18,7 +18,6 @@ import Foundation import UIKit class RectangleToastView: UIView { - private enum Constants { static let padding = UIEdgeInsets(top: 16, left: 16, bottom: 16, right: 16) static let cornerRadius: CGFloat = 8.0 diff --git a/ElementX/Sources/Other/UserIndicators/RoundedToastView.swift b/ElementX/Sources/Other/UserIndicators/RoundedToastView.swift index eaaa764fa..1fd641245 100644 --- a/ElementX/Sources/Other/UserIndicators/RoundedToastView.swift +++ b/ElementX/Sources/Other/UserIndicators/RoundedToastView.swift @@ -70,7 +70,6 @@ class RoundedToastView: UIView { } private func setup(viewState: ToastViewState) { - backgroundColor = .clear clipsToBounds = true diff --git a/ElementX/Sources/Other/WeakDictionary/WeakDictionary.swift b/ElementX/Sources/Other/WeakDictionary/WeakDictionary.swift index 11ae71c25..7aa657908 100644 --- a/ElementX/Sources/Other/WeakDictionary/WeakDictionary.swift +++ b/ElementX/Sources/Other/WeakDictionary/WeakDictionary.swift @@ -9,7 +9,6 @@ import Foundation public struct WeakDictionary { - private var storage: [Key: WeakDictionaryReference] public init() { @@ -48,7 +47,6 @@ public struct WeakDictionary { } extension WeakDictionary: Collection { - public typealias Index = DictionaryIndex> public var startIndex: Index { diff --git a/ElementX/Sources/Other/WeakDictionary/WeakDictionaryKeyReference.swift b/ElementX/Sources/Other/WeakDictionary/WeakDictionaryKeyReference.swift index 1aa6e01b9..8e5ce752f 100644 --- a/ElementX/Sources/Other/WeakDictionary/WeakDictionaryKeyReference.swift +++ b/ElementX/Sources/Other/WeakDictionary/WeakDictionaryKeyReference.swift @@ -9,7 +9,6 @@ import Foundation public struct WeakDictionaryKey: Hashable { - private weak var baseKey: Key? private let hash: Int private var retainedValue: Value? diff --git a/ElementX/Sources/Other/WeakDictionary/WeakKeyDictionary.swift b/ElementX/Sources/Other/WeakDictionary/WeakKeyDictionary.swift index cc9f606b5..def57b66d 100644 --- a/ElementX/Sources/Other/WeakDictionary/WeakKeyDictionary.swift +++ b/ElementX/Sources/Other/WeakDictionary/WeakKeyDictionary.swift @@ -9,7 +9,6 @@ import Foundation public struct WeakKeyDictionary { - private var storage: WeakDictionary, Value> private let valuesRetainedByKey: Bool @@ -69,7 +68,6 @@ public struct WeakKeyDictionary { } extension WeakKeyDictionary: Collection { - public typealias Index = DictionaryIndex, WeakDictionaryReference> public var startIndex: Index { diff --git a/ElementX/Sources/Screens/Authentication/AuthenticationCoordinator.swift b/ElementX/Sources/Screens/Authentication/AuthenticationCoordinator.swift index b1111c36e..0f6523b8a 100644 --- a/ElementX/Sources/Screens/Authentication/AuthenticationCoordinator.swift +++ b/ElementX/Sources/Screens/Authentication/AuthenticationCoordinator.swift @@ -16,7 +16,6 @@ protocol AuthenticationCoordinatorDelegate: AnyObject { } class AuthenticationCoordinator: Coordinator, Presentable { - private let authenticationService: AuthenticationServiceProtocol private let navigationRouter: NavigationRouter diff --git a/ElementX/Sources/Screens/Authentication/AuthenticationIconImage.swift b/ElementX/Sources/Screens/Authentication/AuthenticationIconImage.swift index 58939f9dd..6da243a1b 100644 --- a/ElementX/Sources/Screens/Authentication/AuthenticationIconImage.swift +++ b/ElementX/Sources/Screens/Authentication/AuthenticationIconImage.swift @@ -18,7 +18,6 @@ import SwiftUI /// An image that is styled for use as the screen icon in the onboarding flow. struct AuthenticationIconImage: View { - let image: ImageAsset var body: some View { diff --git a/ElementX/Sources/Screens/Authentication/LoginScreen/LoginCoordinator.swift b/ElementX/Sources/Screens/Authentication/LoginScreen/LoginCoordinator.swift index a8918de00..8521f473d 100644 --- a/ElementX/Sources/Screens/Authentication/LoginScreen/LoginCoordinator.swift +++ b/ElementX/Sources/Screens/Authentication/LoginScreen/LoginCoordinator.swift @@ -32,7 +32,6 @@ enum LoginCoordinatorAction { } final class LoginCoordinator: Coordinator, Presentable { - // MARK: - Properties // MARK: Private diff --git a/ElementX/Sources/Screens/Authentication/LoginScreen/LoginHomeserver.swift b/ElementX/Sources/Screens/Authentication/LoginScreen/LoginHomeserver.swift index bb43df847..8a06c8d3b 100644 --- a/ElementX/Sources/Screens/Authentication/LoginScreen/LoginHomeserver.swift +++ b/ElementX/Sources/Screens/Authentication/LoginScreen/LoginHomeserver.swift @@ -85,5 +85,4 @@ extension LoginHomeserver { isMatrixDotOrg: false, loginMode: .unsupported) } - } diff --git a/ElementX/Sources/Screens/Authentication/LoginScreen/LoginViewModel.swift b/ElementX/Sources/Screens/Authentication/LoginScreen/LoginViewModel.swift index 57255691f..d8ecc0e62 100644 --- a/ElementX/Sources/Screens/Authentication/LoginScreen/LoginViewModel.swift +++ b/ElementX/Sources/Screens/Authentication/LoginScreen/LoginViewModel.swift @@ -19,7 +19,6 @@ import SwiftUI typealias LoginViewModelType = StateStoreViewModel class LoginViewModel: LoginViewModelType, LoginViewModelProtocol { - // MARK: - Properties // MARK: Public diff --git a/ElementX/Sources/Screens/Authentication/LoginScreen/LoginViewModelProtocol.swift b/ElementX/Sources/Screens/Authentication/LoginScreen/LoginViewModelProtocol.swift index 1b5d9eab0..768bbc8cc 100644 --- a/ElementX/Sources/Screens/Authentication/LoginScreen/LoginViewModelProtocol.swift +++ b/ElementX/Sources/Screens/Authentication/LoginScreen/LoginViewModelProtocol.swift @@ -18,7 +18,6 @@ import Foundation @MainActor protocol LoginViewModelProtocol { - var callback: (@MainActor(LoginViewModelAction) -> Void)? { get set } var context: LoginViewModelType.Context { get } diff --git a/ElementX/Sources/Screens/Authentication/LoginScreen/View/LoginScreen.swift b/ElementX/Sources/Screens/Authentication/LoginScreen/View/LoginScreen.swift index d665e6a1c..07a1ffca9 100644 --- a/ElementX/Sources/Screens/Authentication/LoginScreen/View/LoginScreen.swift +++ b/ElementX/Sources/Screens/Authentication/LoginScreen/View/LoginScreen.swift @@ -17,7 +17,6 @@ import SwiftUI struct LoginScreen: View { - // MARK: - Properties // MARK: Private @@ -54,7 +53,6 @@ struct LoginScreen: View { default: loginUnavailableText } - } .readableFrame() .padding(.horizontal, 16) diff --git a/ElementX/Sources/Screens/Authentication/LoginScreen/View/LoginServerInfoSection.swift b/ElementX/Sources/Screens/Authentication/LoginScreen/View/LoginServerInfoSection.swift index 35b9d7fce..9ede010a1 100644 --- a/ElementX/Sources/Screens/Authentication/LoginScreen/View/LoginServerInfoSection.swift +++ b/ElementX/Sources/Screens/Authentication/LoginScreen/View/LoginServerInfoSection.swift @@ -19,7 +19,6 @@ import SwiftUI /// A view that shows information about the chosen homeserver, /// along with an edit button to pick a different one. struct LoginServerInfoSection: View { - // MARK: - Public /// The address shown for the server. diff --git a/ElementX/Sources/Screens/Authentication/ServerSelection/ServerSelectionCoordinator.swift b/ElementX/Sources/Screens/Authentication/ServerSelection/ServerSelectionCoordinator.swift index 82dbfe325..2aebb2e6f 100644 --- a/ElementX/Sources/Screens/Authentication/ServerSelection/ServerSelectionCoordinator.swift +++ b/ElementX/Sources/Screens/Authentication/ServerSelection/ServerSelectionCoordinator.swift @@ -29,7 +29,6 @@ enum ServerSelectionCoordinatorAction { } final class ServerSelectionCoordinator: Coordinator, Presentable { - // MARK: - Properties // MARK: Private diff --git a/ElementX/Sources/Screens/Authentication/ServerSelection/ServerSelectionViewModel.swift b/ElementX/Sources/Screens/Authentication/ServerSelection/ServerSelectionViewModel.swift index fc0570e03..a60045e66 100644 --- a/ElementX/Sources/Screens/Authentication/ServerSelection/ServerSelectionViewModel.swift +++ b/ElementX/Sources/Screens/Authentication/ServerSelection/ServerSelectionViewModel.swift @@ -19,7 +19,6 @@ import SwiftUI typealias ServerSelectionViewModelType = StateStoreViewModel class ServerSelectionViewModel: ServerSelectionViewModelType, ServerSelectionViewModelProtocol { - // MARK: - Properties // MARK: Private diff --git a/ElementX/Sources/Screens/Authentication/ServerSelection/ServerSelectionViewModelProtocol.swift b/ElementX/Sources/Screens/Authentication/ServerSelection/ServerSelectionViewModelProtocol.swift index 63e15a75e..72bc3404f 100644 --- a/ElementX/Sources/Screens/Authentication/ServerSelection/ServerSelectionViewModelProtocol.swift +++ b/ElementX/Sources/Screens/Authentication/ServerSelection/ServerSelectionViewModelProtocol.swift @@ -18,7 +18,6 @@ import Foundation @MainActor protocol ServerSelectionViewModelProtocol { - var callback: (@MainActor(ServerSelectionViewModelAction) -> Void)? { get set } var context: ServerSelectionViewModelType.Context { get } diff --git a/ElementX/Sources/Screens/Authentication/ServerSelection/View/ServerSelectionScreen.swift b/ElementX/Sources/Screens/Authentication/ServerSelection/View/ServerSelectionScreen.swift index 469fdb657..47292f348 100644 --- a/ElementX/Sources/Screens/Authentication/ServerSelection/View/ServerSelectionScreen.swift +++ b/ElementX/Sources/Screens/Authentication/ServerSelection/View/ServerSelectionScreen.swift @@ -17,7 +17,6 @@ import SwiftUI struct ServerSelectionScreen: View { - // MARK: - Properties // MARK: Private diff --git a/ElementX/Sources/Screens/BugReport/BugReportCoordinator.swift b/ElementX/Sources/Screens/BugReport/BugReportCoordinator.swift index 48f613e8e..ff057334c 100644 --- a/ElementX/Sources/Screens/BugReport/BugReportCoordinator.swift +++ b/ElementX/Sources/Screens/BugReport/BugReportCoordinator.swift @@ -22,7 +22,6 @@ struct BugReportCoordinatorParameters { } final class BugReportCoordinator: Coordinator, Presentable { - // MARK: - Properties // MARK: Private diff --git a/ElementX/Sources/Screens/BugReport/BugReportViewModel.swift b/ElementX/Sources/Screens/BugReport/BugReportViewModel.swift index cd6516420..35013a1e9 100644 --- a/ElementX/Sources/Screens/BugReport/BugReportViewModel.swift +++ b/ElementX/Sources/Screens/BugReport/BugReportViewModel.swift @@ -21,7 +21,6 @@ typealias BugReportViewModelType = StateStoreViewModel @available(iOS 14, *) class BugReportViewModel: BugReportViewModelType, BugReportViewModelProtocol { - // MARK: - Properties let bugReportService: BugReportServiceProtocol diff --git a/ElementX/Sources/Screens/BugReport/BugReportViewModelProtocol.swift b/ElementX/Sources/Screens/BugReport/BugReportViewModelProtocol.swift index 48f5a1d7d..d8a6e1056 100644 --- a/ElementX/Sources/Screens/BugReport/BugReportViewModelProtocol.swift +++ b/ElementX/Sources/Screens/BugReport/BugReportViewModelProtocol.swift @@ -18,7 +18,6 @@ import Foundation @MainActor protocol BugReportViewModelProtocol { - var callback: ((BugReportViewModelAction) -> Void)? { get set } @available(iOS 14, *) var context: BugReportViewModelType.Context { get } diff --git a/ElementX/Sources/Screens/BugReport/View/BugReportScreen.swift b/ElementX/Sources/Screens/BugReport/View/BugReportScreen.swift index 6e60ff538..779a12ba6 100644 --- a/ElementX/Sources/Screens/BugReport/View/BugReportScreen.swift +++ b/ElementX/Sources/Screens/BugReport/View/BugReportScreen.swift @@ -17,7 +17,6 @@ import SwiftUI struct BugReportScreen: View { - // MARK: Private @Environment(\.horizontalSizeClass) private var horizontalSizeClass diff --git a/ElementX/Sources/Screens/HomeScreen/HomeScreenCoordinator.swift b/ElementX/Sources/Screens/HomeScreen/HomeScreenCoordinator.swift index 3a3a78c4b..d1d80f3f9 100644 --- a/ElementX/Sources/Screens/HomeScreen/HomeScreenCoordinator.swift +++ b/ElementX/Sources/Screens/HomeScreen/HomeScreenCoordinator.swift @@ -30,7 +30,6 @@ enum HomeScreenCoordinatorAction { } final class HomeScreenCoordinator: Coordinator, Presentable { - // MARK: - Properties // MARK: Private diff --git a/ElementX/Sources/Screens/HomeScreen/HomeScreenViewModel.swift b/ElementX/Sources/Screens/HomeScreen/HomeScreenViewModel.swift index 0d325ba6a..84bf41e9a 100644 --- a/ElementX/Sources/Screens/HomeScreen/HomeScreenViewModel.swift +++ b/ElementX/Sources/Screens/HomeScreen/HomeScreenViewModel.swift @@ -20,7 +20,6 @@ import SwiftUI typealias HomeScreenViewModelType = StateStoreViewModel class HomeScreenViewModel: HomeScreenViewModelType, HomeScreenViewModelProtocol { - private let attributedStringBuilder: AttributedStringBuilderProtocol private var roomUpdateListeners = Set() @@ -82,7 +81,6 @@ class HomeScreenViewModel: HomeScreenViewModelType, HomeScreenViewModelProtocol } .store(in: &roomUpdateListeners) } - } func updateWithUserAvatar(_ avatar: UIImage) { diff --git a/ElementX/Sources/Screens/HomeScreen/View/HomeScreen.swift b/ElementX/Sources/Screens/HomeScreen/View/HomeScreen.swift index 57535a127..dec506b29 100644 --- a/ElementX/Sources/Screens/HomeScreen/View/HomeScreen.swift +++ b/ElementX/Sources/Screens/HomeScreen/View/HomeScreen.swift @@ -17,7 +17,6 @@ import SwiftUI struct HomeScreen: View { - @ObservedObject var context: HomeScreenViewModel.Context // MARK: Views @@ -30,7 +29,6 @@ struct HomeScreen: View { ProgressView() } } else { - if context.viewState.showSessionVerificationBanner { HStack { Text(ElementL10n.verificationVerifyDevice) @@ -115,7 +113,6 @@ struct HomeScreen: View { } struct RoomCell: View { - @ScaledMetric private var avatarSize = 32.0 let room: HomeScreenRoom diff --git a/ElementX/Sources/Screens/RoomScreen/RoomScreenCoordinator.swift b/ElementX/Sources/Screens/RoomScreen/RoomScreenCoordinator.swift index 5b49e4e00..5484baa4c 100644 --- a/ElementX/Sources/Screens/RoomScreen/RoomScreenCoordinator.swift +++ b/ElementX/Sources/Screens/RoomScreen/RoomScreenCoordinator.swift @@ -24,7 +24,6 @@ struct RoomScreenCoordinatorParameters { } final class RoomScreenCoordinator: Coordinator, Presentable { - // MARK: - Properties // MARK: Private diff --git a/ElementX/Sources/Screens/RoomScreen/RoomScreenViewModel.swift b/ElementX/Sources/Screens/RoomScreen/RoomScreenViewModel.swift index fbddfc7fe..70935c49c 100644 --- a/ElementX/Sources/Screens/RoomScreen/RoomScreenViewModel.swift +++ b/ElementX/Sources/Screens/RoomScreen/RoomScreenViewModel.swift @@ -19,7 +19,6 @@ import SwiftUI typealias RoomScreenViewModelType = StateStoreViewModel class RoomScreenViewModel: RoomScreenViewModelType, RoomScreenViewModelProtocol { - private enum Constants { static let backPaginationPageSize: UInt = 30 } diff --git a/ElementX/Sources/Screens/RoomScreen/View/ListTableViewAdapter.swift b/ElementX/Sources/Screens/RoomScreen/View/ListTableViewAdapter.swift index 8a5ba31be..4da965fc0 100644 --- a/ElementX/Sources/Screens/RoomScreen/View/ListTableViewAdapter.swift +++ b/ElementX/Sources/Screens/RoomScreen/View/ListTableViewAdapter.swift @@ -10,7 +10,6 @@ import Combine import UIKit class ListTableViewAdapter: NSObject, UITableViewDelegate { - private enum ContentOffsetDetails { case topOffset(previousVisibleIndexPath: IndexPath, previousItemCount: Int) case bottomOffset diff --git a/ElementX/Sources/Screens/RoomScreen/View/MessageComposer.swift b/ElementX/Sources/Screens/RoomScreen/View/MessageComposer.swift index 716cbf854..5832032ff 100644 --- a/ElementX/Sources/Screens/RoomScreen/View/MessageComposer.swift +++ b/ElementX/Sources/Screens/RoomScreen/View/MessageComposer.swift @@ -9,7 +9,6 @@ import SwiftUI struct MessageComposer: View { - @Binding var text: String var disabled: Bool let action: () -> Void diff --git a/ElementX/Sources/Screens/RoomScreen/View/MessageComposerTextField.swift b/ElementX/Sources/Screens/RoomScreen/View/MessageComposerTextField.swift index f11bcf312..ff1a5b868 100644 --- a/ElementX/Sources/Screens/RoomScreen/View/MessageComposerTextField.swift +++ b/ElementX/Sources/Screens/RoomScreen/View/MessageComposerTextField.swift @@ -9,7 +9,6 @@ import SwiftUI struct MessageComposerTextField: View { - @Binding private var text: String @State private var dynamicHeight: CGFloat = 100 @State private var isEditing = false diff --git a/ElementX/Sources/Screens/RoomScreen/View/RoomHeaderView.swift b/ElementX/Sources/Screens/RoomScreen/View/RoomHeaderView.swift index 900c0c077..ec77056fd 100644 --- a/ElementX/Sources/Screens/RoomScreen/View/RoomHeaderView.swift +++ b/ElementX/Sources/Screens/RoomScreen/View/RoomHeaderView.swift @@ -13,7 +13,6 @@ import SwiftUI import Introspect struct RoomHeaderView: View { - @ObservedObject var context: RoomScreenViewModel.Context var body: some View { @@ -49,7 +48,6 @@ struct RoomHeaderView: View { .accessibilityIdentifier("roomAvatarPlaceholderImage") } } - } struct RoomHeaderView_Previews: PreviewProvider { diff --git a/ElementX/Sources/Screens/RoomScreen/View/RoomScreen.swift b/ElementX/Sources/Screens/RoomScreen/View/RoomScreen.swift index d13095d54..204675d82 100644 --- a/ElementX/Sources/Screens/RoomScreen/View/RoomScreen.swift +++ b/ElementX/Sources/Screens/RoomScreen/View/RoomScreen.swift @@ -17,7 +17,6 @@ import SwiftUI struct RoomScreen: View { - @ObservedObject var context: RoomScreenViewModel.Context var body: some View { diff --git a/ElementX/Sources/Screens/RoomScreen/View/Style/TimelineItemBubbledStylerView.swift b/ElementX/Sources/Screens/RoomScreen/View/Style/TimelineItemBubbledStylerView.swift index a891bd2a8..f4021e6e7 100644 --- a/ElementX/Sources/Screens/RoomScreen/View/Style/TimelineItemBubbledStylerView.swift +++ b/ElementX/Sources/Screens/RoomScreen/View/Style/TimelineItemBubbledStylerView.swift @@ -10,7 +10,6 @@ import Foundation import SwiftUI struct TimelineItemBubbledStylerView: View { - let timelineItem: EventBasedTimelineItemProtocol @ViewBuilder let content: () -> Content @@ -96,7 +95,6 @@ struct TimelineItemBubbledStylerView: View { let opacity = colorScheme == .light ? 0.06 : 0.15 return timelineItem.isOutgoing ? .element.accent.opacity(opacity) : .element.system } - } struct TimelineItemBubbledStylerView_Previews: PreviewProvider { diff --git a/ElementX/Sources/Screens/RoomScreen/View/Style/TimelineItemPlainStylerView.swift b/ElementX/Sources/Screens/RoomScreen/View/Style/TimelineItemPlainStylerView.swift index 161138a73..7587ee085 100644 --- a/ElementX/Sources/Screens/RoomScreen/View/Style/TimelineItemPlainStylerView.swift +++ b/ElementX/Sources/Screens/RoomScreen/View/Style/TimelineItemPlainStylerView.swift @@ -10,7 +10,6 @@ import Foundation import SwiftUI struct TimelineItemPlainStylerView: View { - let timelineItem: EventBasedTimelineItemProtocol @ViewBuilder let content: () -> Content diff --git a/ElementX/Sources/Screens/RoomScreen/View/Timeline/FormattedBodyText.swift b/ElementX/Sources/Screens/RoomScreen/View/Timeline/FormattedBodyText.swift index 9c62ecafd..964d8700d 100644 --- a/ElementX/Sources/Screens/RoomScreen/View/Timeline/FormattedBodyText.swift +++ b/ElementX/Sources/Screens/RoomScreen/View/Timeline/FormattedBodyText.swift @@ -39,7 +39,6 @@ struct FormattedBodyText_Previews: PreviewProvider { static var previews: some View { body.preferredColorScheme(.light) body.preferredColorScheme(.dark) - } @ViewBuilder diff --git a/ElementX/Sources/Screens/RoomScreen/View/Timeline/PlaceholderAvatarImage.swift b/ElementX/Sources/Screens/RoomScreen/View/Timeline/PlaceholderAvatarImage.swift index 67c31c27f..6510dd6b8 100644 --- a/ElementX/Sources/Screens/RoomScreen/View/Timeline/PlaceholderAvatarImage.swift +++ b/ElementX/Sources/Screens/RoomScreen/View/Timeline/PlaceholderAvatarImage.swift @@ -17,7 +17,6 @@ import SwiftUI struct PlaceholderAvatarImage: View { - private let textForImage: String var body: some View { diff --git a/ElementX/Sources/Screens/RoomScreen/View/TimelineItemContextMenu.swift b/ElementX/Sources/Screens/RoomScreen/View/TimelineItemContextMenu.swift index e5bfd5815..af507b516 100644 --- a/ElementX/Sources/Screens/RoomScreen/View/TimelineItemContextMenu.swift +++ b/ElementX/Sources/Screens/RoomScreen/View/TimelineItemContextMenu.swift @@ -9,7 +9,6 @@ import SwiftUI public struct TimelineItemContextMenu: View { - let contextMenuActions: [TimelineItemContextMenuAction] let callback: (TimelineItemContextMenuAction) -> Void diff --git a/ElementX/Sources/Screens/RoomScreen/View/TimelineItemList.swift b/ElementX/Sources/Screens/RoomScreen/View/TimelineItemList.swift index 744f3972e..e1ff58ef3 100644 --- a/ElementX/Sources/Screens/RoomScreen/View/TimelineItemList.swift +++ b/ElementX/Sources/Screens/RoomScreen/View/TimelineItemList.swift @@ -11,7 +11,6 @@ import Introspect import SwiftUI struct TimelineItemList: View { - @State private var tableViewObserver = ListTableViewAdapter() @State private var timelineItems: [RoomTimelineViewProvider] = [] @State private var hasPendingChanges = false diff --git a/ElementX/Sources/Screens/RoomScreen/View/TimelineSenderAvatarView.swift b/ElementX/Sources/Screens/RoomScreen/View/TimelineSenderAvatarView.swift index 729eb35e6..eb4daa4e0 100644 --- a/ElementX/Sources/Screens/RoomScreen/View/TimelineSenderAvatarView.swift +++ b/ElementX/Sources/Screens/RoomScreen/View/TimelineSenderAvatarView.swift @@ -10,7 +10,6 @@ import Foundation import SwiftUI struct TimelineSenderAvatarView: View { - let timelineItem: EventBasedTimelineItemProtocol @ScaledMetric private var avatarSize = 26 @@ -35,5 +34,4 @@ struct TimelineSenderAvatarView: View { .animation(.default, value: timelineItem.senderAvatar) } - } diff --git a/ElementX/Sources/Screens/RoomScreen/View/TimelineView.swift b/ElementX/Sources/Screens/RoomScreen/View/TimelineView.swift index 544c2fe9d..b567df86e 100644 --- a/ElementX/Sources/Screens/RoomScreen/View/TimelineView.swift +++ b/ElementX/Sources/Screens/RoomScreen/View/TimelineView.swift @@ -13,7 +13,6 @@ import SwiftUI import Introspect struct TimelineView: View { - @State private var bottomVisiblePublisher = PassthroughSubject() @State private var scrollToBottomPublisher = PassthroughSubject() @State private var scollToBottomButtonVisible = false diff --git a/ElementX/Sources/Screens/SessionVerification/SessionVerificationCoordinator.swift b/ElementX/Sources/Screens/SessionVerification/SessionVerificationCoordinator.swift index 752e81ab9..c2d3a6e28 100644 --- a/ElementX/Sources/Screens/SessionVerification/SessionVerificationCoordinator.swift +++ b/ElementX/Sources/Screens/SessionVerification/SessionVerificationCoordinator.swift @@ -21,7 +21,6 @@ struct SessionVerificationCoordinatorParameters { } final class SessionVerificationCoordinator: Coordinator, Presentable { - // MARK: - Properties // MARK: Private diff --git a/ElementX/Sources/Screens/SessionVerification/SessionVerificationViewModel.swift b/ElementX/Sources/Screens/SessionVerification/SessionVerificationViewModel.swift index 89d6a3ad0..b264df1ff 100644 --- a/ElementX/Sources/Screens/SessionVerification/SessionVerificationViewModel.swift +++ b/ElementX/Sources/Screens/SessionVerification/SessionVerificationViewModel.swift @@ -19,7 +19,6 @@ import SwiftUI typealias SessionVerificationViewModelType = StateStoreViewModel class SessionVerificationViewModel: SessionVerificationViewModelType, SessionVerificationViewModelProtocol { - // MARK: - Properties // MARK: Private @@ -36,7 +35,6 @@ class SessionVerificationViewModel: SessionVerificationViewModelType, SessionVer init(sessionVerificationControllerProxy: SessionVerificationControllerProxyProtocol, initialState: SessionVerificationViewState = SessionVerificationViewState()) { - self.sessionVerificationControllerProxy = sessionVerificationControllerProxy stateMachine = SessionVerificationStateMachine() diff --git a/ElementX/Sources/Screens/SessionVerification/View/SessionVerificationScreen.swift b/ElementX/Sources/Screens/SessionVerification/View/SessionVerificationScreen.swift index 75ffdc2cd..fc2113016 100644 --- a/ElementX/Sources/Screens/SessionVerification/View/SessionVerificationScreen.swift +++ b/ElementX/Sources/Screens/SessionVerification/View/SessionVerificationScreen.swift @@ -18,7 +18,6 @@ import MatrixRustSDK import SwiftUI struct SessionVerificationScreen: View { - @ObservedObject var context: SessionVerificationViewModel.Context // MARK: Views diff --git a/ElementX/Sources/Screens/Settings/SettingsCoordinator.swift b/ElementX/Sources/Screens/Settings/SettingsCoordinator.swift index 14aa6ae1d..91ea1fe0d 100644 --- a/ElementX/Sources/Screens/Settings/SettingsCoordinator.swift +++ b/ElementX/Sources/Screens/Settings/SettingsCoordinator.swift @@ -26,7 +26,6 @@ enum SettingsCoordinatorAction { } final class SettingsCoordinator: Coordinator, Presentable { - // MARK: - Properties // MARK: Private diff --git a/ElementX/Sources/Screens/Settings/SettingsViewModel.swift b/ElementX/Sources/Screens/Settings/SettingsViewModel.swift index 825c0687c..ccf6ec9b5 100644 --- a/ElementX/Sources/Screens/Settings/SettingsViewModel.swift +++ b/ElementX/Sources/Screens/Settings/SettingsViewModel.swift @@ -21,7 +21,6 @@ typealias SettingsViewModelType = StateStoreViewModel @available(iOS 14, *) class SettingsViewModel: SettingsViewModelType, SettingsViewModelProtocol { - // MARK: - Properties // MARK: Private diff --git a/ElementX/Sources/Screens/Settings/SettingsViewModelProtocol.swift b/ElementX/Sources/Screens/Settings/SettingsViewModelProtocol.swift index 87d69ca9d..05e13c667 100644 --- a/ElementX/Sources/Screens/Settings/SettingsViewModelProtocol.swift +++ b/ElementX/Sources/Screens/Settings/SettingsViewModelProtocol.swift @@ -18,7 +18,6 @@ import Foundation @MainActor protocol SettingsViewModelProtocol { - var callback: ((SettingsViewModelAction) -> Void)? { get set } @available(iOS 14, *) var context: SettingsViewModelType.Context { get } diff --git a/ElementX/Sources/Screens/Settings/View/SettingsScreen.swift b/ElementX/Sources/Screens/Settings/View/SettingsScreen.swift index e5a004ad7..3996aca66 100644 --- a/ElementX/Sources/Screens/Settings/View/SettingsScreen.swift +++ b/ElementX/Sources/Screens/Settings/View/SettingsScreen.swift @@ -17,7 +17,6 @@ import SwiftUI struct SettingsScreen: View { - // MARK: Private @State private var showingLogoutConfirmation = false diff --git a/ElementX/Sources/Screens/SplashScreen/SplashScreenCoordinator.swift b/ElementX/Sources/Screens/SplashScreen/SplashScreenCoordinator.swift index bf23edb4c..9590432b4 100644 --- a/ElementX/Sources/Screens/SplashScreen/SplashScreenCoordinator.swift +++ b/ElementX/Sources/Screens/SplashScreen/SplashScreenCoordinator.swift @@ -17,7 +17,6 @@ import SwiftUI final class SplashScreenCoordinator: Coordinator, Presentable { - // MARK: - Properties // MARK: Private diff --git a/ElementX/Sources/Screens/SplashScreen/SplashScreenModels.swift b/ElementX/Sources/Screens/SplashScreen/SplashScreenModels.swift index 297aefccc..30f9db200 100644 --- a/ElementX/Sources/Screens/SplashScreen/SplashScreenModels.swift +++ b/ElementX/Sources/Screens/SplashScreen/SplashScreenModels.swift @@ -38,7 +38,6 @@ enum SplashScreenViewModelAction { // MARK: View struct SplashScreenViewState: BindableState { - /// The colours of the background gradient shown behind the 4 pages. private let gradientColors = [ Color(red: 0.95, green: 0.98, blue: 0.96), diff --git a/ElementX/Sources/Screens/SplashScreen/SplashScreenViewModel.swift b/ElementX/Sources/Screens/SplashScreen/SplashScreenViewModel.swift index 4c4b070c8..19f9958f8 100644 --- a/ElementX/Sources/Screens/SplashScreen/SplashScreenViewModel.swift +++ b/ElementX/Sources/Screens/SplashScreen/SplashScreenViewModel.swift @@ -20,7 +20,6 @@ import SwiftUI typealias SplashScreenViewModelType = StateStoreViewModel class SplashScreenViewModel: SplashScreenViewModelType, SplashScreenViewModelProtocol { - // MARK: - Properties // MARK: Private diff --git a/ElementX/Sources/Screens/SplashScreen/View/SplashScreen.swift b/ElementX/Sources/Screens/SplashScreen/View/SplashScreen.swift index 408d699d8..74d2c1fa8 100644 --- a/ElementX/Sources/Screens/SplashScreen/View/SplashScreen.swift +++ b/ElementX/Sources/Screens/SplashScreen/View/SplashScreen.swift @@ -19,7 +19,6 @@ import SwiftUI /// The splash screen shown at the beginning of the onboarding flow. struct SplashScreen: View { - // MARK: - Properties // MARK: Private @@ -47,7 +46,6 @@ struct SplashScreen: View { // The main content of the carousel HStack(alignment: .top, spacing: 0) { - // Add a hidden page at the start of the carousel duplicating the content of the last page SplashScreenPageView(content: context.viewState.content[pageCount - 1]) .frame(width: geometry.size.width) @@ -57,7 +55,6 @@ struct SplashScreen: View { SplashScreenPageView(content: context.viewState.content[index]) .frame(width: geometry.size.width) } - } .offset(x: pageOffset(in: geometry)) diff --git a/ElementX/Sources/Screens/SplashScreen/View/SplashScreenPageIndicator.swift b/ElementX/Sources/Screens/SplashScreen/View/SplashScreenPageIndicator.swift index d6fe83d1e..5d05a50f1 100644 --- a/ElementX/Sources/Screens/SplashScreen/View/SplashScreenPageIndicator.swift +++ b/ElementX/Sources/Screens/SplashScreen/View/SplashScreenPageIndicator.swift @@ -17,7 +17,6 @@ import SwiftUI struct SplashScreenPageIndicator: View { - // MARK: - Properties // MARK: Public diff --git a/ElementX/Sources/Screens/SplashScreen/View/SplashScreenPageView.swift b/ElementX/Sources/Screens/SplashScreen/View/SplashScreenPageView.swift index f4f7cac02..bc1767719 100644 --- a/ElementX/Sources/Screens/SplashScreen/View/SplashScreenPageView.swift +++ b/ElementX/Sources/Screens/SplashScreen/View/SplashScreenPageView.swift @@ -17,7 +17,6 @@ import SwiftUI struct SplashScreenPageView: View { - // MARK: - Properties // MARK: Public diff --git a/ElementX/Sources/Services/Authentication/AuthenticationService.swift b/ElementX/Sources/Services/Authentication/AuthenticationService.swift index 7f53a5f56..618e3418c 100644 --- a/ElementX/Sources/Services/Authentication/AuthenticationService.swift +++ b/ElementX/Sources/Services/Authentication/AuthenticationService.swift @@ -10,7 +10,6 @@ import Foundation import MatrixRustSDK class AuthenticationService: AuthenticationServiceProtocol { - // MARK: - Properties // MARK: Private diff --git a/ElementX/Sources/Services/Background/BackgroundTaskServiceProtocol.swift b/ElementX/Sources/Services/Background/BackgroundTaskServiceProtocol.swift index 3988f1183..f080f14a6 100644 --- a/ElementX/Sources/Services/Background/BackgroundTaskServiceProtocol.swift +++ b/ElementX/Sources/Services/Background/BackgroundTaskServiceProtocol.swift @@ -9,15 +9,12 @@ import Foundation protocol BackgroundTaskServiceProtocol { - func startBackgroundTask(withName name: String, isReusable: Bool, expirationHandler: (() -> Void)?) -> BackgroundTaskProtocol? - } extension BackgroundTaskServiceProtocol { - func startBackgroundTask(withName name: String) -> BackgroundTaskProtocol? { startBackgroundTask(withName: name, expirationHandler: nil) @@ -36,5 +33,4 @@ extension BackgroundTaskServiceProtocol { isReusable: false, expirationHandler: expirationHandler) } - } diff --git a/ElementX/Sources/Services/Background/UIKitBackgroundTaskService.swift b/ElementX/Sources/Services/Background/UIKitBackgroundTaskService.swift index eed6e995b..df047eb36 100644 --- a/ElementX/Sources/Services/Background/UIKitBackgroundTaskService.swift +++ b/ElementX/Sources/Services/Background/UIKitBackgroundTaskService.swift @@ -11,7 +11,6 @@ import UIKit /// /// UIKitBackgroundTaskService is a concrete implementation of BackgroundTaskServiceProtocol using a given `ApplicationProtocol` instance. class UIKitBackgroundTaskService: BackgroundTaskServiceProtocol { - private let application: ApplicationProtocol? private var reusableTasks: WeakDictionary = WeakDictionary() @@ -91,7 +90,6 @@ class UIKitBackgroundTaskService: BackgroundTaskServiceProtocol { } return false } - } private extension TimeInterval { diff --git a/ElementX/Sources/Services/BugReport/BugReportService.swift b/ElementX/Sources/Services/BugReport/BugReportService.swift index ebc1d6232..cdd65026e 100644 --- a/ElementX/Sources/Services/BugReport/BugReportService.swift +++ b/ElementX/Sources/Services/BugReport/BugReportService.swift @@ -213,7 +213,6 @@ class BugReportService: BugReportServiceProtocol { return zippedFiles } - } private extension Data { diff --git a/ElementX/Sources/Services/BugReport/BugReportServiceProtocol.swift b/ElementX/Sources/Services/BugReport/BugReportServiceProtocol.swift index 8f1e25e02..9a9c86054 100644 --- a/ElementX/Sources/Services/BugReport/BugReportServiceProtocol.swift +++ b/ElementX/Sources/Services/BugReport/BugReportServiceProtocol.swift @@ -14,7 +14,6 @@ struct SubmitBugReportResponse: Decodable { } protocol BugReportServiceProtocol { - var crashedLastRun: Bool { get } func crash() diff --git a/ElementX/Sources/Services/BugReport/MockBugReportService.swift b/ElementX/Sources/Services/BugReport/MockBugReportService.swift index 2ca33f668..9c2f01de8 100644 --- a/ElementX/Sources/Services/BugReport/MockBugReportService.swift +++ b/ElementX/Sources/Services/BugReport/MockBugReportService.swift @@ -10,7 +10,6 @@ import Foundation import UIKit class MockBugReportService: BugReportServiceProtocol { - func submitBugReport(text: String, includeLogs: Bool, includeCrashLog: Bool, @@ -24,5 +23,4 @@ class MockBugReportService: BugReportServiceProtocol { func crash() { // no-op } - } diff --git a/ElementX/Sources/Services/BugReport/ScreenshotDetector.swift b/ElementX/Sources/Services/BugReport/ScreenshotDetector.swift index d22b454a7..049fda318 100644 --- a/ElementX/Sources/Services/BugReport/ScreenshotDetector.swift +++ b/ElementX/Sources/Services/BugReport/ScreenshotDetector.swift @@ -17,7 +17,6 @@ enum ScreenshotDetectorError: String, Error { @MainActor class ScreenshotDetector { - var callback: (@MainActor(UIImage?, Error?) -> Void)? /// Flag to whether ask for photos authorization by default if needed. @@ -80,11 +79,9 @@ class ScreenshotDetector { func fail(withError error: Error) { callback?(nil, error) } - } private extension PHAsset { - static func fetchLastScreenshot() -> PHAsset? { let options = PHFetchOptions() @@ -99,7 +96,6 @@ private extension PHAsset { } private extension PHImageRequestOptions { - static var highQualitySyncLocal: PHImageRequestOptions { let options = PHImageRequestOptions() options.deliveryMode = .highQualityFormat diff --git a/ElementX/Sources/Services/Client/ClientProxy.swift b/ElementX/Sources/Services/Client/ClientProxy.swift index 25e3643b2..b74b34fb6 100644 --- a/ElementX/Sources/Services/Client/ClientProxy.swift +++ b/ElementX/Sources/Services/Client/ClientProxy.swift @@ -24,7 +24,6 @@ private class WeakClientProxyWrapper: ClientDelegate { } class ClientProxy: ClientProxyProtocol { - private let client: Client private let backgroundTaskService: BackgroundTaskServiceProtocol private var sessionVerificationControllerProxy: SessionVerificationControllerProxy? @@ -71,7 +70,6 @@ class ClientProxy: ClientProxyProtocol { } catch { return .failure(.failedRetrievingDisplayName) } - } .value } diff --git a/ElementX/Sources/Services/Client/MockClientProxy.swift b/ElementX/Sources/Services/Client/MockClientProxy.swift index 96b12abfa..69812996c 100644 --- a/ElementX/Sources/Services/Client/MockClientProxy.swift +++ b/ElementX/Sources/Services/Client/MockClientProxy.swift @@ -10,7 +10,6 @@ import Combine import MatrixRustSDK struct MockClientProxy: ClientProxyProtocol { - let callbacks = PassthroughSubject() let userIdentifier: String diff --git a/ElementX/Sources/Services/Media/MockMediaProvider.swift b/ElementX/Sources/Services/Media/MockMediaProvider.swift index ecb859faf..7b9ba2326 100644 --- a/ElementX/Sources/Services/Media/MockMediaProvider.swift +++ b/ElementX/Sources/Services/Media/MockMediaProvider.swift @@ -10,7 +10,6 @@ import Foundation import UIKit struct MockMediaProvider: MediaProviderProtocol { - func imageFromSource(_ source: MediaSource?) -> UIImage? { nil } diff --git a/ElementX/Sources/Services/Room/Members/MemberDetailProviderManager.swift b/ElementX/Sources/Services/Room/Members/MemberDetailProviderManager.swift index 86802363c..079590681 100644 --- a/ElementX/Sources/Services/Room/Members/MemberDetailProviderManager.swift +++ b/ElementX/Sources/Services/Room/Members/MemberDetailProviderManager.swift @@ -10,7 +10,6 @@ import Foundation @MainActor class MemberDetailProviderManager { - private var memberDetailProviders: [String: MemberDetailProviderProtocol] = [:] func memberDetailProviderForRoomProxy(_ roomProxy: RoomProxyProtocol) -> MemberDetailProviderProtocol { diff --git a/ElementX/Sources/Services/Room/RoomSummary/EventBriefFactory.swift b/ElementX/Sources/Services/Room/RoomSummary/EventBriefFactory.swift index 6f4ed208f..4efa7350c 100644 --- a/ElementX/Sources/Services/Room/RoomSummary/EventBriefFactory.swift +++ b/ElementX/Sources/Services/Room/RoomSummary/EventBriefFactory.swift @@ -9,7 +9,6 @@ import Foundation struct EventBriefFactory: EventBriefFactoryProtocol { - private let memberDetailProvider: MemberDetailProviderProtocol init(memberDetailProvider: MemberDetailProviderProtocol) { diff --git a/ElementX/Sources/Services/Timeline/MockRoomTimelineController.swift b/ElementX/Sources/Services/Timeline/MockRoomTimelineController.swift index 0ef4f8d6f..6c7c0a76d 100644 --- a/ElementX/Sources/Services/Timeline/MockRoomTimelineController.swift +++ b/ElementX/Sources/Services/Timeline/MockRoomTimelineController.swift @@ -10,7 +10,6 @@ import Combine import Foundation class MockRoomTimelineController: RoomTimelineControllerProtocol { - let callbacks = PassthroughSubject() var timelineItems: [RoomTimelineItemProtocol] = [SeparatorRoomTimelineItem(id: UUID().uuidString, diff --git a/ElementX/Sources/Services/Timeline/TimelineItems/RoomTimelineItemFactory.swift b/ElementX/Sources/Services/Timeline/TimelineItems/RoomTimelineItemFactory.swift index 1af8d5668..cde4ade40 100644 --- a/ElementX/Sources/Services/Timeline/TimelineItems/RoomTimelineItemFactory.swift +++ b/ElementX/Sources/Services/Timeline/TimelineItems/RoomTimelineItemFactory.swift @@ -67,7 +67,6 @@ struct RoomTimelineItemFactory: RoomTimelineItemFactoryProtocol { _ showSenderDetails: Bool, _ displayName: String?, _ avatarImage: UIImage?) -> RoomTimelineItemProtocol { - var aspectRatio: CGFloat? if let width = message.width, let height = message.height { diff --git a/ElementX/Sources/Services/UserSessionStore/UserSessionStore.swift b/ElementX/Sources/Services/UserSessionStore/UserSessionStore.swift index ab1357b50..ed90bfc7f 100644 --- a/ElementX/Sources/Services/UserSessionStore/UserSessionStore.swift +++ b/ElementX/Sources/Services/UserSessionStore/UserSessionStore.swift @@ -19,7 +19,6 @@ import Kingfisher import MatrixRustSDK class UserSessionStore: UserSessionStoreProtocol { - private let keychainController: KeychainControllerProtocol private let backgroundTaskService: BackgroundTaskServiceProtocol diff --git a/ElementX/Sources/UITestsRootView.swift b/ElementX/Sources/UITestsRootView.swift index c1370c7df..f80efd800 100644 --- a/ElementX/Sources/UITestsRootView.swift +++ b/ElementX/Sources/UITestsRootView.swift @@ -9,7 +9,6 @@ import SwiftUI struct UITestsRootView: View { - let mockScreens: [MockScreen] var selectionCallback: ((UITestScreenIdentifier) -> Void)? diff --git a/Tools/Scripts/Templates/SimpleScreenExample/ElementX/TemplateCoordinator.swift b/Tools/Scripts/Templates/SimpleScreenExample/ElementX/TemplateCoordinator.swift index f50420ecf..cb6f158c0 100644 --- a/Tools/Scripts/Templates/SimpleScreenExample/ElementX/TemplateCoordinator.swift +++ b/Tools/Scripts/Templates/SimpleScreenExample/ElementX/TemplateCoordinator.swift @@ -26,7 +26,6 @@ enum TemplateCoordinatorAction { } final class TemplateCoordinator: Coordinator, Presentable { - // MARK: - Properties // MARK: Private diff --git a/Tools/Scripts/Templates/SimpleScreenExample/ElementX/TemplateViewModel.swift b/Tools/Scripts/Templates/SimpleScreenExample/ElementX/TemplateViewModel.swift index ba4e661ea..7da3b439e 100644 --- a/Tools/Scripts/Templates/SimpleScreenExample/ElementX/TemplateViewModel.swift +++ b/Tools/Scripts/Templates/SimpleScreenExample/ElementX/TemplateViewModel.swift @@ -19,7 +19,6 @@ import SwiftUI typealias TemplateViewModelType = StateStoreViewModel class TemplateViewModel: TemplateViewModelType, TemplateViewModelProtocol { - // MARK: - Properties // MARK: Private diff --git a/Tools/Scripts/Templates/SimpleScreenExample/ElementX/View/TemplateScreen.swift b/Tools/Scripts/Templates/SimpleScreenExample/ElementX/View/TemplateScreen.swift index 3b8a49a62..f55990ba8 100644 --- a/Tools/Scripts/Templates/SimpleScreenExample/ElementX/View/TemplateScreen.swift +++ b/Tools/Scripts/Templates/SimpleScreenExample/ElementX/View/TemplateScreen.swift @@ -17,7 +17,6 @@ import SwiftUI struct TemplateScreen: View { - // MARK: Private @Environment(\.colorScheme) private var colorScheme diff --git a/UITests/Sources/BugReportUITests.swift b/UITests/Sources/BugReportUITests.swift index 81b90187c..8d2ef3c20 100644 --- a/UITests/Sources/BugReportUITests.swift +++ b/UITests/Sources/BugReportUITests.swift @@ -18,7 +18,6 @@ import ElementX import XCTest class BugReportUITests: XCTestCase { - func testInitialStateComponents() { let app = Application.launch() app.goToScreenWithIdentifier(.bugReport) @@ -85,7 +84,6 @@ class BugReportUITests: XCTestCase { XCTAssertEqual(sendButton.label, ElementL10n.actionSend) XCTAssertFalse(sendButton.isEnabled) } - } extension XCUIElement { diff --git a/UITests/Sources/RoomScreenUITests.swift b/UITests/Sources/RoomScreenUITests.swift index 7abc3941b..a1f059408 100644 --- a/UITests/Sources/RoomScreenUITests.swift +++ b/UITests/Sources/RoomScreenUITests.swift @@ -19,7 +19,6 @@ import XCTest @MainActor class RoomScreenUITests: XCTestCase { - func testPlainNoAvatar() { let app = Application.launch() app.goToScreenWithIdentifier(.roomPlainNoAvatar) diff --git a/UITests/Sources/ServerSelectionUITests.swift b/UITests/Sources/ServerSelectionUITests.swift index 29b47e134..0f3ade6b8 100644 --- a/UITests/Sources/ServerSelectionUITests.swift +++ b/UITests/Sources/ServerSelectionUITests.swift @@ -19,7 +19,6 @@ import XCTest @MainActor class ServerSelectionUITests: XCTestCase { - let textFieldIdentifier = "addressTextField" func testNormalState() async { diff --git a/UITests/Sources/SessionVerificationUITests.swift b/UITests/Sources/SessionVerificationUITests.swift index 0fae9332e..4729aef33 100644 --- a/UITests/Sources/SessionVerificationUITests.swift +++ b/UITests/Sources/SessionVerificationUITests.swift @@ -18,7 +18,6 @@ import ElementX import XCTest class SessionVerificationUITests: XCTestCase { - func testChallengeMatches() { let app = Application.launch() app.goToScreenWithIdentifier(.sessionVerification) diff --git a/UITests/Sources/SettingsUITests.swift b/UITests/Sources/SettingsUITests.swift index 8dd82c594..fdb9789e4 100644 --- a/UITests/Sources/SettingsUITests.swift +++ b/UITests/Sources/SettingsUITests.swift @@ -18,7 +18,6 @@ import ElementX import XCTest class SettingsUITests: XCTestCase { - func testInitialStateComponents() { let app = Application.launch() app.goToScreenWithIdentifier(.settings) @@ -37,5 +36,4 @@ class SettingsUITests: XCTestCase { XCTAssert(logoutButton.exists) XCTAssertEqual(logoutButton.label, ElementL10n.logout) } - } diff --git a/UnitTests/Sources/AttributedStringBuilderTests.swift b/UnitTests/Sources/AttributedStringBuilderTests.swift index b11274616..59ca3659c 100644 --- a/UnitTests/Sources/AttributedStringBuilderTests.swift +++ b/UnitTests/Sources/AttributedStringBuilderTests.swift @@ -10,7 +10,6 @@ import XCTest class AttributedStringBuilderTests: XCTestCase { - let attributedStringBuilder = AttributedStringBuilder() let maxHeaderPointSize = ceil(UIFont.preferredFont(forTextStyle: .body).pointSize * 1.2) @@ -370,7 +369,6 @@ class AttributedStringBuilderTests: XCTestCase { // MARK: - Private private func checkMatrixEntityLinkIn(attributedString: AttributedString?, expected: String) { - guard let attributedString = attributedString else { XCTFail("Could not build the attributed string") return diff --git a/UnitTests/Sources/BackgroundTaskTests.swift b/UnitTests/Sources/BackgroundTaskTests.swift index c67319a0b..0d91e922a 100644 --- a/UnitTests/Sources/BackgroundTaskTests.swift +++ b/UnitTests/Sources/BackgroundTaskTests.swift @@ -11,7 +11,6 @@ import XCTest @testable import ElementX class BackgroundTaskTests: XCTestCase { - private enum Constants { static let bgTaskName = "test" } @@ -155,11 +154,9 @@ class BackgroundTaskTests: XCTestCase { XCTAssertNil(task, "Task should not be created") } - } private extension UIApplication { - static var mockHealty: ApplicationProtocol { MockApplication() } @@ -175,11 +172,9 @@ private extension UIApplication { backgroundTimeRemaining: 2, allowTasks: false) } - } private class MockApplication: ApplicationProtocol { - let applicationState: UIApplication.State let backgroundTimeRemaining: TimeInterval private let allowTasks: Bool @@ -223,5 +218,4 @@ private class MockApplication: ApplicationProtocol { } bgTasks.removeValue(forKey: identifier) } - } diff --git a/UnitTests/Sources/BugReportServiceTests.swift b/UnitTests/Sources/BugReportServiceTests.swift index 7e6be6c22..6231e5ab0 100644 --- a/UnitTests/Sources/BugReportServiceTests.swift +++ b/UnitTests/Sources/BugReportServiceTests.swift @@ -11,7 +11,6 @@ import Foundation import XCTest class BugReportServiceTests: XCTestCase { - let bugReportService = MockBugReportService() func testInitialStateWithMockService() { @@ -49,11 +48,9 @@ class BugReportServiceTests: XCTestCase { XCTAssertEqual(result.reportUrl, "https://example.com/123") } - } private class MockURLProtocol: URLProtocol { - override func startLoading() { let response = "{\"report_url\":\"https://example.com/123\"}" if let data = response.data(using: .utf8) { @@ -75,16 +72,13 @@ private class MockURLProtocol: URLProtocol { override class func canInit(with request: URLRequest) -> Bool { true } - } private extension URLSession { - static var mock: URLSession { let configuration = URLSessionConfiguration.default configuration.protocolClasses = [MockURLProtocol.self] + (configuration.protocolClasses ?? []) let result = URLSession(configuration: configuration) return result } - } diff --git a/UnitTests/Sources/BugReportViewModelTests.swift b/UnitTests/Sources/BugReportViewModelTests.swift index e01dbaf29..494dfae72 100644 --- a/UnitTests/Sources/BugReportViewModelTests.swift +++ b/UnitTests/Sources/BugReportViewModelTests.swift @@ -20,7 +20,6 @@ import XCTest @MainActor class BugReportViewModelTests: XCTestCase { - func testInitialState() { let viewModel = BugReportViewModel(bugReportService: MockBugReportService(), screenshot: nil) let context = viewModel.context diff --git a/UnitTests/Sources/ElementXTests.swift b/UnitTests/Sources/ElementXTests.swift index bf5c79e42..852350621 100644 --- a/UnitTests/Sources/ElementXTests.swift +++ b/UnitTests/Sources/ElementXTests.swift @@ -10,7 +10,6 @@ import XCTest class ElementXTests: XCTestCase { - override func setUpWithError() throws { // Put setup code here. This method is called before the invocation of each test method in the class. } diff --git a/UnitTests/Sources/HomeScreenViewModelTests.swift b/UnitTests/Sources/HomeScreenViewModelTests.swift index 642762367..2644202f2 100644 --- a/UnitTests/Sources/HomeScreenViewModelTests.swift +++ b/UnitTests/Sources/HomeScreenViewModelTests.swift @@ -19,7 +19,6 @@ import XCTest @testable import ElementX class HomeScreenViewModelTests: XCTestCase { - var viewModel: HomeScreenViewModelProtocol! var context: HomeScreenViewModelType.Context! @@ -63,5 +62,4 @@ class HomeScreenViewModelTests: XCTestCase { await Task.yield() XCTAssert(correctResult) } - } diff --git a/UnitTests/Sources/ImageAnonymizerTests.swift b/UnitTests/Sources/ImageAnonymizerTests.swift index 5a5087b6e..83927b7b7 100644 --- a/UnitTests/Sources/ImageAnonymizerTests.swift +++ b/UnitTests/Sources/ImageAnonymizerTests.swift @@ -14,7 +14,6 @@ enum ImageAnonymizerTestsError: String, Error { } class ImageAnonymizerTests: XCTestCase { - override func setUpWithError() throws { // Put setup code here. This method is called before the invocation of each test method in the class. } @@ -53,5 +52,4 @@ class ImageAnonymizerTests: XCTestCase { XCTAssertNotEqual(image, anonymizedRed) XCTAssertNotEqual(anonymizedBlue, anonymizedRed) } - } diff --git a/UnitTests/Sources/LocalizationTests.swift b/UnitTests/Sources/LocalizationTests.swift index 73ac5c819..3af868a45 100644 --- a/UnitTests/Sources/LocalizationTests.swift +++ b/UnitTests/Sources/LocalizationTests.swift @@ -10,7 +10,6 @@ import XCTest class LocalizationTests: XCTestCase { - /// Test ElementL10n considers app language changes func testAppLanguage() { // set app language to English @@ -101,5 +100,4 @@ class LocalizationTests: XCTestCase { XCTAssertEqual(ElementL10n.untranslatedPlural(1), "One untranslated item") XCTAssertEqual(ElementL10n.untranslatedPlural(5), "5 untranslated items") } - } diff --git a/UnitTests/Sources/LoggingTests.swift b/UnitTests/Sources/LoggingTests.swift index eaa193256..f6ee4b18f 100644 --- a/UnitTests/Sources/LoggingTests.swift +++ b/UnitTests/Sources/LoggingTests.swift @@ -10,7 +10,6 @@ import XCTest class LoggingTests: XCTestCase { - private enum Constants { static let genericFailure = "Test failed" } @@ -92,5 +91,4 @@ class LoggingTests: XCTestCase { XCTAssertTrue(logFile.contains(subLogName)) } - } diff --git a/UnitTests/Sources/ScreenshotDetectorTests.swift b/UnitTests/Sources/ScreenshotDetectorTests.swift index bd70fd5e3..d6566da78 100644 --- a/UnitTests/Sources/ScreenshotDetectorTests.swift +++ b/UnitTests/Sources/ScreenshotDetectorTests.swift @@ -12,7 +12,6 @@ import Photos import XCTest class ScreenshotDetectorTests: XCTestCase { - @MainActor func testDetection() async { async { expectation in let detector = ScreenshotDetector() @@ -59,5 +58,4 @@ class ScreenshotDetectorTests: XCTestCase { block(expectation) waiter.wait(for: [expectation], timeout: timeout) } - } diff --git a/UnitTests/Sources/SessionVerificationViewModelTests.swift b/UnitTests/Sources/SessionVerificationViewModelTests.swift index b5ccd9f7f..f79720d84 100644 --- a/UnitTests/Sources/SessionVerificationViewModelTests.swift +++ b/UnitTests/Sources/SessionVerificationViewModelTests.swift @@ -21,7 +21,6 @@ import XCTest @MainActor class SessionVerificationViewModelTests: XCTestCase { - var viewModel: SessionVerificationViewModelProtocol! var context: SessionVerificationViewModelType.Context! var sessionVerificationController: SessionVerificationControllerProxyProtocol! @@ -70,7 +69,6 @@ class SessionVerificationViewModelTests: XCTestCase { } func testAcceptChallenge() { - setupChallengeReceived() let waitForAcceptance = XCTestExpectation(description: "Wait for acceptance") @@ -98,7 +96,6 @@ class SessionVerificationViewModelTests: XCTestCase { } func testDeclineChallenge() { - setupChallengeReceived() let expectation = XCTestExpectation(description: "Wait for cancellation") diff --git a/UnitTests/Sources/SettingsViewModelTests.swift b/UnitTests/Sources/SettingsViewModelTests.swift index cf5aaa2e9..1daab66f4 100644 --- a/UnitTests/Sources/SettingsViewModelTests.swift +++ b/UnitTests/Sources/SettingsViewModelTests.swift @@ -20,7 +20,6 @@ import XCTest @MainActor class SettingsViewModelTests: XCTestCase { - var viewModel: SettingsViewModelProtocol! var context: SettingsViewModelType.Context! @@ -66,5 +65,4 @@ class SettingsViewModelTests: XCTestCase { await Task.yield() XCTAssert(correctResult) } - }