Enable blank line rules. (#132)

This commit is contained in:
Doug
2022-07-06 16:01:50 +01:00
committed by GitHub
parent 02eb4b35e2
commit 25d7ba55ad
114 changed files with 0 additions and 184 deletions
-2
View File
@@ -3,8 +3,6 @@
--exclude ElementX/Sources/Generated --exclude ElementX/Sources/Generated
--disable wrapMultiLineStatementBraces --disable wrapMultiLineStatementBraces
--disable blankLinesAtStartOfScope
--disable blankLinesAtEndOfScope
--disable hoistPatternLet --disable hoistPatternLet
--commas inline --commas inline
@@ -19,7 +19,6 @@ import SwiftUI
/// Fonts at https://www.figma.com/file/X4XTH9iS2KGJ2wFKDqkyed/Compound?node-id=1362%3A0 /// Fonts at https://www.figma.com/file/X4XTH9iS2KGJ2wFKDqkyed/Compound?node-id=1362%3A0
@objcMembers @objcMembers
public class ElementSharedFonts { public class ElementSharedFonts {
// MARK: - Types // MARK: - Types
/// A wrapper to provide both a `UIFont` and a SwiftUI `Font` in the same type. /// 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 // MARK: - Fonts protocol
public extension ElementSharedFonts { public extension ElementSharedFonts {
var largeTitle: SharedFont { var largeTitle: SharedFont {
let uiFont = font(forTextStyle: .largeTitle) let uiFont = font(forTextStyle: .largeTitle)
return SharedFont(uiFont: uiFont, font: .largeTitle) return SharedFont(uiFont: uiFont, font: .largeTitle)
-1
View File
@@ -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 /// 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 /// Create a custom TextStyle enum (like DesignKit.Fonts.TextStyle) is also a possibility
public protocol Fonts { public protocol Fonts {
associatedtype FontType associatedtype FontType
/// The font for large titles. /// The font for large titles.
-1
View File
@@ -17,7 +17,6 @@
import UIKit import UIKit
public extension UIFont { public extension UIFont {
// MARK: - Convenient methods // MARK: - Convenient methods
/// Update current font with a SymbolicTraits /// Update current font with a SymbolicTraits
-1
View File
@@ -10,7 +10,6 @@ import UIKit
@main @main
class AppDelegate: UIResponder, UIApplicationDelegate { class AppDelegate: UIResponder, UIApplicationDelegate {
private lazy var appCoordinator: Coordinator = isRunningUITests ? UITestsAppCoordinator() : AppCoordinator() private lazy var appCoordinator: Coordinator = isRunningUITests ? UITestsAppCoordinator() : AppCoordinator()
func application(_ application: UIApplication, willFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil) -> Bool { func application(_ application: UIApplication, willFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil) -> Bool {
-2
View File
@@ -9,7 +9,6 @@
import Foundation import Foundation
final class BuildSettings { final class BuildSettings {
// MARK: - Servers // MARK: - Servers
static let defaultHomeserverURLString = "https://matrix.org" static let defaultHomeserverURLString = "https://matrix.org"
@@ -32,5 +31,4 @@ final class BuildSettings {
// MARK: - Room screen // MARK: - Room screen
static let defaultRoomTimelineStyle: TimelineStyle = .bubbles static let defaultRoomTimelineStyle: TimelineStyle = .bubbles
} }
-2
View File
@@ -21,7 +21,6 @@ import UIKit
/// It helps to isolate and reuse view controllers and pass dependencies down the navigation hierarchy. /// It helps to isolate and reuse view controllers and pass dependencies down the navigation hierarchy.
@MainActor @MainActor
protocol Coordinator: AnyObject { protocol Coordinator: AnyObject {
/// Starts job of the coordinator. /// Starts job of the coordinator.
func start() func start()
@@ -41,7 +40,6 @@ protocol Coordinator: AnyObject {
// `Coordinator` default implementation // `Coordinator` default implementation
extension Coordinator { extension Coordinator {
func add(childCoordinator coordinator: Coordinator) { func add(childCoordinator coordinator: Coordinator) {
childCoordinators.append(coordinator) childCoordinators.append(coordinator)
} }
@@ -9,10 +9,8 @@
import UIKit import UIKit
class ElementNavigationController: UINavigationController { class ElementNavigationController: UINavigationController {
override func viewWillLayoutSubviews() { override func viewWillLayoutSubviews() {
super.viewWillLayoutSubviews() super.viewWillLayoutSubviews()
navigationBar.topItem?.backButtonDisplayMode = .minimal navigationBar.topItem?.backButtonDisplayMode = .minimal
} }
} }
@@ -11,7 +11,6 @@ import SwiftUI
/// Store Element specific app settings. /// Store Element specific app settings.
final class ElementSettings: ObservableObject { final class ElementSettings: ObservableObject {
// MARK: - Constants // MARK: - Constants
public enum UserDefaultsKeys: String { public enum UserDefaultsKeys: String {
@@ -9,7 +9,6 @@
import Foundation import Foundation
public extension Bundle { public extension Bundle {
/// Get an lproj language bundle from the receiver bundle. /// Get an lproj language bundle from the receiver bundle.
/// - Parameter language: The language to try to load. /// - Parameter language: The language to try to load.
/// - Returns: The lproj bundle if found otherwise nil. /// - Returns: The lproj bundle if found otherwise nil.
@@ -46,5 +45,4 @@ public extension Bundle {
.compactMap { $0 } .compactMap { $0 }
.filter { set.insert($0).inserted } .filter { set.insert($0).inserted }
} }
} }
@@ -10,7 +10,6 @@ import DTCoreText
import Foundation import Foundation
struct AttributedStringBuilder: AttributedStringBuilderProtocol { struct AttributedStringBuilder: AttributedStringBuilderProtocol {
private let temporaryBlockquoteMarkingColor = UIColor.magenta private let temporaryBlockquoteMarkingColor = UIColor.magenta
private let temporaryCodeBlockMarkingColor = UIColor.cyan private let temporaryCodeBlockMarkingColor = UIColor.cyan
private let linkColor = UIColor.blue private let linkColor = UIColor.blue
@@ -159,7 +158,6 @@ struct AttributedStringBuilder: AttributedStringBuilderProtocol {
} }
private func addLinks(_ attributedString: NSMutableAttributedString) { private func addLinks(_ attributedString: NSMutableAttributedString) {
let string = attributedString.string let string = attributedString.string
let range = NSRange(location: 0, length: attributedString.string.count) let range = NSRange(location: 0, length: attributedString.string.count)
@@ -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. /// - imageHandler: An optional image handler to be run on `img` tags (if allowed) to update the `src` attribute.
@objc func sanitize(font: UIFont) { @objc func sanitize(font: UIFont) {
if let name = name, !Self.allowedHTMLTags.contains(name) { if let name = name, !Self.allowedHTMLTags.contains(name) {
// This is an unsupported tag. // This is an unsupported tag.
// Remove any attachments to fix rendering. // Remove any attachments to fix rendering.
textAttachment = nil textAttachment = nil
@@ -15,7 +15,6 @@ enum ImageAnonymizerError: Error {
} }
enum ImageAnonymizer { enum ImageAnonymizer {
private static var allowedTextItems: [String] = [ private static var allowedTextItems: [String] = [
"#", "#",
"@", "@",
@@ -113,5 +112,4 @@ enum ImageAnonymizer {
} }
return result return result
} }
} }
@@ -19,7 +19,6 @@ import SwiftyBeaver
/// Various MXLog configuration options. Used in conjunction with `MXLog.configure()` /// Various MXLog configuration options. Used in conjunction with `MXLog.configure()`
@objc public class MXLogConfiguration: NSObject { @objc public class MXLogConfiguration: NSObject {
/// the desired log level. `.verbose` by default. /// the desired log level. `.verbose` by default.
@objc public var logLevel = MXLogLevel.verbose @objc public var logLevel = MXLogLevel.verbose
@@ -58,7 +57,6 @@ private var logger: SwiftyBeaver.Type = {
Please see `MXLog.h` for Objective-C options. Please see `MXLog.h` for Objective-C options.
*/ */
@objc public class MXLog: NSObject { @objc public class MXLog: NSObject {
/// Method used to customize MXLog's behavior. /// Method used to customize MXLog's behavior.
/// Called automatically when first accessing the logger with the default values. /// Called automatically when first accessing the logger with the default values.
/// Please see `MXLogConfiguration` for all available options. /// Please see `MXLogConfiguration` for all available options.
@@ -28,9 +28,7 @@ struct NavigationModule {
// MARK: - CustomStringConvertible // MARK: - CustomStringConvertible
extension NavigationModule: CustomStringConvertible { extension NavigationModule: CustomStringConvertible {
var description: String { var description: String {
"NavigationModule: \(presentable), pop completion: \(String(describing: popCompletion))" "NavigationModule: \(presentable), pop completion: \(String(describing: popCompletion))"
} }
} }
@@ -18,7 +18,6 @@ import UIKit
/// `NavigationRouter` is a concrete implementation of NavigationRouterType. /// `NavigationRouter` is a concrete implementation of NavigationRouterType.
final class NavigationRouter: NSObject, NavigationRouterType { final class NavigationRouter: NSObject, NavigationRouterType {
// MARK: - Properties // MARK: - Properties
// MARK: Private // MARK: Private
@@ -117,7 +116,6 @@ final class NavigationRouter: NSObject, NavigationRouterType {
} }
func setModules(_ modules: [NavigationModule], hideNavigationBar: Bool, animated: Bool) { func setModules(_ modules: [NavigationModule], hideNavigationBar: Bool, animated: Bool) {
MXLog.debug("[NavigationRouter] Set modules \(modules)") MXLog.debug("[NavigationRouter] Set modules \(modules)")
let controllers = modules.map { module -> UIViewController in let controllers = modules.map { module -> UIViewController in
@@ -279,7 +277,6 @@ final class NavigationRouter: NSObject, NavigationRouterType {
} }
func contains(_ module: Presentable) -> Bool { func contains(_ module: Presentable) -> Bool {
let controller = module.toPresentable() let controller = module.toPresentable()
return navigationController.viewControllers.contains(controller) return navigationController.viewControllers.contains(controller)
} }
@@ -293,7 +290,6 @@ final class NavigationRouter: NSObject, NavigationRouterType {
// MARK: - Private // MARK: - Private
private func module(for viewController: UIViewController) -> Presentable { private func module(for viewController: UIViewController) -> Presentable {
guard let module = storedModules[viewController] as? Presentable else { guard let module = storedModules[viewController] as? Presentable else {
return viewController return viewController
} }
@@ -339,7 +335,6 @@ final class NavigationRouter: NSObject, NavigationRouterType {
} }
private func postNotification(withName name: Notification.Name, for viewController: UIViewController) { private func postNotification(withName name: Notification.Name, for viewController: UIViewController) {
let module = module(for: viewController) let module = module(for: viewController)
let userInfo: [String: Any] = [ let userInfo: [String: Any] = [
@@ -354,14 +349,11 @@ final class NavigationRouter: NSObject, NavigationRouterType {
// MARK: - UINavigationControllerDelegate // MARK: - UINavigationControllerDelegate
extension NavigationRouter: UINavigationControllerDelegate { extension NavigationRouter: UINavigationControllerDelegate {
func navigationController(_ navigationController: UINavigationController, willShow viewController: UIViewController, animated: Bool) { func navigationController(_ navigationController: UINavigationController, willShow viewController: UIViewController, animated: Bool) {
// Try to post `NavigationRouter.willPopModule` notification here // Try to post `NavigationRouter.willPopModule` notification here
} }
func navigationController(_ navigationController: UINavigationController, didShow viewController: UIViewController, animated: Bool) { func navigationController(_ navigationController: UINavigationController, didShow viewController: UIViewController, animated: Bool) {
// Ensure the view controller is popping // Ensure the view controller is popping
guard let poppedViewController = navigationController.transitionCoordinator?.viewController(forKey: .from), guard let poppedViewController = navigationController.transitionCoordinator?.viewController(forKey: .from),
!navigationController.viewControllers.contains(poppedViewController) else { !navigationController.viewControllers.contains(poppedViewController) else {
@@ -377,7 +369,6 @@ extension NavigationRouter: UINavigationControllerDelegate {
// MARK: - NavigationRouter notification constants // MARK: - NavigationRouter notification constants
extension NavigationRouter { extension NavigationRouter {
// MARK: Notification names // MARK: Notification names
public static let willPushModule = Notification.Name("NavigationRouterWillPushModule") public static let willPushModule = Notification.Name("NavigationRouterWillPushModule")
@@ -391,7 +382,6 @@ extension NavigationRouter {
// MARK: Notification keys // MARK: Notification keys
public enum NotificationUserInfoKey { public enum NotificationUserInfoKey {
/// The associated view controller (UIViewController). /// The associated view controller (UIViewController).
static let viewController = "viewController" static let viewController = "viewController"
@@ -18,7 +18,6 @@ import UIKit
/// `NavigationRouterStore` enables to get a NavigationRouter from a UINavigationController instance. /// `NavigationRouterStore` enables to get a NavigationRouter from a UINavigationController instance.
class NavigationRouterStore: NavigationRouterStoreProtocol { class NavigationRouterStore: NavigationRouterStoreProtocol {
// MARK: - Constants // MARK: - Constants
static let shared = NavigationRouterStore() static let shared = NavigationRouterStore()
@@ -39,7 +38,6 @@ class NavigationRouterStore: NavigationRouterStoreProtocol {
// MARK: - Public // MARK: - Public
func navigationRouter(for navigationController: UINavigationController) -> NavigationRouterType { func navigationRouter(for navigationController: UINavigationController) -> NavigationRouterType {
if let existingNavigationRouter = findNavigationRouter(for: navigationController) { if let existingNavigationRouter = findNavigationRouter(for: navigationController) {
return existingNavigationRouter return existingNavigationRouter
} }
@@ -64,7 +62,6 @@ class NavigationRouterStore: NavigationRouterStoreProtocol {
} }
@objc private func navigationRouterDidCreate(_ notification: Notification) { @objc private func navigationRouterDidCreate(_ notification: Notification) {
guard let userInfo = notification.userInfo, guard let userInfo = notification.userInfo,
let navigationRouter = userInfo[NavigationRouter.NotificationUserInfoKey.navigationRouter] as? NavigationRouterType, let navigationRouter = userInfo[NavigationRouter.NotificationUserInfoKey.navigationRouter] as? NavigationRouterType,
let navigationController = userInfo[NavigationRouter.NotificationUserInfoKey.navigationController] as? UINavigationController else { let navigationController = userInfo[NavigationRouter.NotificationUserInfoKey.navigationController] as? UINavigationController else {
@@ -19,7 +19,6 @@ import UIKit
/// `NavigationRouterStoreProtocol` describes a structure that enables to get a NavigationRouter from a UINavigationController instance. /// `NavigationRouterStoreProtocol` describes a structure that enables to get a NavigationRouter from a UINavigationController instance.
@MainActor @MainActor
protocol NavigationRouterStoreProtocol { protocol NavigationRouterStoreProtocol {
/// Gets the existing navigation router for the supplied controller, creating a new one if it doesn't yet exist. /// 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. /// 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 func navigationRouter(for navigationController: UINavigationController) -> NavigationRouterType
@@ -20,7 +20,6 @@ import UIKit
/// Routers are used to be passed between coordinators. They handles only `physical` navigation. /// Routers are used to be passed between coordinators. They handles only `physical` navigation.
@MainActor @MainActor
protocol NavigationRouterType: AnyObject, Presentable { protocol NavigationRouterType: AnyObject, Presentable {
/// Present modally a view controller on the navigation controller /// Present modally a view controller on the navigation controller
/// ///
/// - Parameter module: The Presentable to present. /// - Parameter module: The Presentable to present.
@@ -91,7 +90,6 @@ protocol NavigationRouterType: AnyObject, Presentable {
// `NavigationRouterType` default implementation // `NavigationRouterType` default implementation
extension NavigationRouterType { extension NavigationRouterType {
func setRootModule(_ module: Presentable) { func setRootModule(_ module: Presentable) {
setRootModule(module, hideNavigationBar: false, animated: false, popCompletion: nil) setRootModule(module, hideNavigationBar: false, animated: false, popCompletion: nil)
} }
@@ -107,13 +105,11 @@ extension NavigationRouterType {
func setModules(_ modules: [Presentable], animated: Bool) { func setModules(_ modules: [Presentable], animated: Bool) {
setModules(modules, hideNavigationBar: false, animated: animated) setModules(modules, hideNavigationBar: false, animated: animated)
} }
} }
// MARK: - Presentable <--> NavigationModule Transitive Methods // MARK: - Presentable <--> NavigationModule Transitive Methods
extension NavigationRouterType { extension NavigationRouterType {
func setRootModule(_ module: NavigationModule) { func setRootModule(_ module: NavigationModule) {
setRootModule(module.presentable, popCompletion: module.popCompletion) setRootModule(module.presentable, popCompletion: module.popCompletion)
} }
@@ -132,5 +128,4 @@ extension NavigationRouterType {
push(modules.map { $0.toModule() }, push(modules.map { $0.toModule() },
animated: animated) animated: animated)
} }
} }
@@ -29,11 +29,9 @@ extension UIViewController: Presentable {
} }
extension Presentable { extension Presentable {
/// Returns a new module from the presentable without a pop completion block /// Returns a new module from the presentable without a pop completion block
/// - Returns: Module /// - Returns: Module
func toModule() -> NavigationModule { func toModule() -> NavigationModule {
NavigationModule(presentable: self, popCompletion: nil) NavigationModule(presentable: self, popCompletion: nil)
} }
} }
@@ -18,7 +18,6 @@ import UIKit
/// `RootRouter` is a concrete implementation of RootRouterType. /// `RootRouter` is a concrete implementation of RootRouterType.
final class RootRouter: RootRouterType { final class RootRouter: RootRouterType {
// MARK: - Constants // MARK: - Constants
// `rootViewController` animation constants // `rootViewController` animation constants
@@ -69,7 +68,6 @@ final class RootRouter: RootRouterType {
// MARK: - Private methods // MARK: - Private methods
private func updateRootViewController(rootViewController: UIViewController?, animated: Bool, completion: (() -> Void)?) { private func updateRootViewController(rootViewController: UIViewController?, animated: Bool, completion: (() -> Void)?) {
if animated { if animated {
UIView.transition(with: window, duration: RootViewControllerUpdateAnimation.duration, options: RootViewControllerUpdateAnimation.options, animations: { UIView.transition(with: window, duration: RootViewControllerUpdateAnimation.duration, options: RootViewControllerUpdateAnimation.options, animations: {
let oldState: Bool = UIView.areAnimationsEnabled let oldState: Bool = UIView.areAnimationsEnabled
@@ -20,7 +20,6 @@ import UIKit
/// Routers are used to be passed between coordinators. They handles only `physical` navigation. /// Routers are used to be passed between coordinators. They handles only `physical` navigation.
@MainActor @MainActor
protocol RootRouterType: AnyObject { protocol RootRouterType: AnyObject {
/// Update the root view controller /// Update the root view controller
/// ///
/// - Parameter module: The new root view controller to set /// - Parameter module: The new root view controller to set
@@ -73,7 +73,6 @@ class ViewModelContext<ViewState: BindableState, ViewAction>: ObservableObject {
/// we can do it in this centralised place. /// we can do it in this centralised place.
@MainActor @MainActor
class StateStoreViewModel<State: BindableState, ViewAction> { class StateStoreViewModel<State: BindableState, ViewAction> {
typealias Context = ViewModelContext<State, ViewAction> typealias Context = ViewModelContext<State, ViewAction>
// MARK: - Properties // MARK: - Properties
@@ -10,7 +10,6 @@ import SwiftUI
/// A toggle style that uses a button, with a checked/unchecked image like a checkbox. /// A toggle style that uses a button, with a checked/unchecked image like a checkbox.
struct ElementToggleStyle: ToggleStyle { struct ElementToggleStyle: ToggleStyle {
func makeBody(configuration: Configuration) -> some View { func makeBody(configuration: Configuration) -> some View {
Button { configuration.isOn.toggle() } label: { Button { configuration.isOn.toggle() } label: {
Image(systemName: configuration.isOn ? "checkmark.square.fill" : "square") Image(systemName: configuration.isOn ? "checkmark.square.fill" : "square")
@@ -19,7 +19,6 @@ import UIKit
/// Used to present activity indicator on a view /// Used to present activity indicator on a view
final class ActivityIndicatorPresenter: ActivityIndicatorPresenterType { final class ActivityIndicatorPresenter: ActivityIndicatorPresenterType {
// MARK: - Constants // MARK: - Constants
private enum Constants { private enum Constants {
@@ -131,7 +130,6 @@ final class ActivityIndicatorPresenter: ActivityIndicatorPresenterType {
} }
private extension UIView { private extension UIView {
/// Add a subview matching parent view using autolayout /// Add a subview matching parent view using autolayout
@objc func vc_addSubViewMatchingParent(_ subView: UIView) { @objc func vc_addSubViewMatchingParent(_ subView: UIView) {
addSubview(subView) addSubview(subView)
@@ -17,7 +17,6 @@
import UIKit import UIKit
final class ActivityIndicatorView: UIView { final class ActivityIndicatorView: UIView {
// MARK: - Constants // MARK: - Constants
private enum Constants { private enum Constants {
@@ -18,7 +18,6 @@ import Foundation
import UIKit import UIKit
class RectangleToastView: UIView { class RectangleToastView: UIView {
private enum Constants { private enum Constants {
static let padding = UIEdgeInsets(top: 16, left: 16, bottom: 16, right: 16) static let padding = UIEdgeInsets(top: 16, left: 16, bottom: 16, right: 16)
static let cornerRadius: CGFloat = 8.0 static let cornerRadius: CGFloat = 8.0
@@ -70,7 +70,6 @@ class RoundedToastView: UIView {
} }
private func setup(viewState: ToastViewState) { private func setup(viewState: ToastViewState) {
backgroundColor = .clear backgroundColor = .clear
clipsToBounds = true clipsToBounds = true
@@ -9,7 +9,6 @@
import Foundation import Foundation
public struct WeakDictionary<Key: Hashable, Value: AnyObject> { public struct WeakDictionary<Key: Hashable, Value: AnyObject> {
private var storage: [Key: WeakDictionaryReference<Value>] private var storage: [Key: WeakDictionaryReference<Value>]
public init() { public init() {
@@ -48,7 +47,6 @@ public struct WeakDictionary<Key: Hashable, Value: AnyObject> {
} }
extension WeakDictionary: Collection { extension WeakDictionary: Collection {
public typealias Index = DictionaryIndex<Key, WeakDictionaryReference<Value>> public typealias Index = DictionaryIndex<Key, WeakDictionaryReference<Value>>
public var startIndex: Index { public var startIndex: Index {
@@ -9,7 +9,6 @@
import Foundation import Foundation
public struct WeakDictionaryKey<Key: AnyObject & Hashable, Value: AnyObject>: Hashable { public struct WeakDictionaryKey<Key: AnyObject & Hashable, Value: AnyObject>: Hashable {
private weak var baseKey: Key? private weak var baseKey: Key?
private let hash: Int private let hash: Int
private var retainedValue: Value? private var retainedValue: Value?
@@ -9,7 +9,6 @@
import Foundation import Foundation
public struct WeakKeyDictionary<Key: AnyObject & Hashable, Value: AnyObject> { public struct WeakKeyDictionary<Key: AnyObject & Hashable, Value: AnyObject> {
private var storage: WeakDictionary<WeakDictionaryKey<Key, Value>, Value> private var storage: WeakDictionary<WeakDictionaryKey<Key, Value>, Value>
private let valuesRetainedByKey: Bool private let valuesRetainedByKey: Bool
@@ -69,7 +68,6 @@ public struct WeakKeyDictionary<Key: AnyObject & Hashable, Value: AnyObject> {
} }
extension WeakKeyDictionary: Collection { extension WeakKeyDictionary: Collection {
public typealias Index = DictionaryIndex<WeakDictionaryKey<Key, Value>, WeakDictionaryReference<Value>> public typealias Index = DictionaryIndex<WeakDictionaryKey<Key, Value>, WeakDictionaryReference<Value>>
public var startIndex: Index { public var startIndex: Index {
@@ -16,7 +16,6 @@ protocol AuthenticationCoordinatorDelegate: AnyObject {
} }
class AuthenticationCoordinator: Coordinator, Presentable { class AuthenticationCoordinator: Coordinator, Presentable {
private let authenticationService: AuthenticationServiceProtocol private let authenticationService: AuthenticationServiceProtocol
private let navigationRouter: NavigationRouter private let navigationRouter: NavigationRouter
@@ -18,7 +18,6 @@ import SwiftUI
/// An image that is styled for use as the screen icon in the onboarding flow. /// An image that is styled for use as the screen icon in the onboarding flow.
struct AuthenticationIconImage: View { struct AuthenticationIconImage: View {
let image: ImageAsset let image: ImageAsset
var body: some View { var body: some View {
@@ -32,7 +32,6 @@ enum LoginCoordinatorAction {
} }
final class LoginCoordinator: Coordinator, Presentable { final class LoginCoordinator: Coordinator, Presentable {
// MARK: - Properties // MARK: - Properties
// MARK: Private // MARK: Private
@@ -85,5 +85,4 @@ extension LoginHomeserver {
isMatrixDotOrg: false, isMatrixDotOrg: false,
loginMode: .unsupported) loginMode: .unsupported)
} }
} }
@@ -19,7 +19,6 @@ import SwiftUI
typealias LoginViewModelType = StateStoreViewModel<LoginViewState, LoginViewAction> typealias LoginViewModelType = StateStoreViewModel<LoginViewState, LoginViewAction>
class LoginViewModel: LoginViewModelType, LoginViewModelProtocol { class LoginViewModel: LoginViewModelType, LoginViewModelProtocol {
// MARK: - Properties // MARK: - Properties
// MARK: Public // MARK: Public
@@ -18,7 +18,6 @@ import Foundation
@MainActor @MainActor
protocol LoginViewModelProtocol { protocol LoginViewModelProtocol {
var callback: (@MainActor(LoginViewModelAction) -> Void)? { get set } var callback: (@MainActor(LoginViewModelAction) -> Void)? { get set }
var context: LoginViewModelType.Context { get } var context: LoginViewModelType.Context { get }
@@ -17,7 +17,6 @@
import SwiftUI import SwiftUI
struct LoginScreen: View { struct LoginScreen: View {
// MARK: - Properties // MARK: - Properties
// MARK: Private // MARK: Private
@@ -54,7 +53,6 @@ struct LoginScreen: View {
default: default:
loginUnavailableText loginUnavailableText
} }
} }
.readableFrame() .readableFrame()
.padding(.horizontal, 16) .padding(.horizontal, 16)
@@ -19,7 +19,6 @@ import SwiftUI
/// A view that shows information about the chosen homeserver, /// A view that shows information about the chosen homeserver,
/// along with an edit button to pick a different one. /// along with an edit button to pick a different one.
struct LoginServerInfoSection: View { struct LoginServerInfoSection: View {
// MARK: - Public // MARK: - Public
/// The address shown for the server. /// The address shown for the server.
@@ -29,7 +29,6 @@ enum ServerSelectionCoordinatorAction {
} }
final class ServerSelectionCoordinator: Coordinator, Presentable { final class ServerSelectionCoordinator: Coordinator, Presentable {
// MARK: - Properties // MARK: - Properties
// MARK: Private // MARK: Private
@@ -19,7 +19,6 @@ import SwiftUI
typealias ServerSelectionViewModelType = StateStoreViewModel<ServerSelectionViewState, ServerSelectionViewAction> typealias ServerSelectionViewModelType = StateStoreViewModel<ServerSelectionViewState, ServerSelectionViewAction>
class ServerSelectionViewModel: ServerSelectionViewModelType, ServerSelectionViewModelProtocol { class ServerSelectionViewModel: ServerSelectionViewModelType, ServerSelectionViewModelProtocol {
// MARK: - Properties // MARK: - Properties
// MARK: Private // MARK: Private
@@ -18,7 +18,6 @@ import Foundation
@MainActor @MainActor
protocol ServerSelectionViewModelProtocol { protocol ServerSelectionViewModelProtocol {
var callback: (@MainActor(ServerSelectionViewModelAction) -> Void)? { get set } var callback: (@MainActor(ServerSelectionViewModelAction) -> Void)? { get set }
var context: ServerSelectionViewModelType.Context { get } var context: ServerSelectionViewModelType.Context { get }
@@ -17,7 +17,6 @@
import SwiftUI import SwiftUI
struct ServerSelectionScreen: View { struct ServerSelectionScreen: View {
// MARK: - Properties // MARK: - Properties
// MARK: Private // MARK: Private
@@ -22,7 +22,6 @@ struct BugReportCoordinatorParameters {
} }
final class BugReportCoordinator: Coordinator, Presentable { final class BugReportCoordinator: Coordinator, Presentable {
// MARK: - Properties // MARK: - Properties
// MARK: Private // MARK: Private
@@ -21,7 +21,6 @@ typealias BugReportViewModelType = StateStoreViewModel<BugReportViewState,
BugReportViewAction> BugReportViewAction>
@available(iOS 14, *) @available(iOS 14, *)
class BugReportViewModel: BugReportViewModelType, BugReportViewModelProtocol { class BugReportViewModel: BugReportViewModelType, BugReportViewModelProtocol {
// MARK: - Properties // MARK: - Properties
let bugReportService: BugReportServiceProtocol let bugReportService: BugReportServiceProtocol
@@ -18,7 +18,6 @@ import Foundation
@MainActor @MainActor
protocol BugReportViewModelProtocol { protocol BugReportViewModelProtocol {
var callback: ((BugReportViewModelAction) -> Void)? { get set } var callback: ((BugReportViewModelAction) -> Void)? { get set }
@available(iOS 14, *) @available(iOS 14, *)
var context: BugReportViewModelType.Context { get } var context: BugReportViewModelType.Context { get }
@@ -17,7 +17,6 @@
import SwiftUI import SwiftUI
struct BugReportScreen: View { struct BugReportScreen: View {
// MARK: Private // MARK: Private
@Environment(\.horizontalSizeClass) private var horizontalSizeClass @Environment(\.horizontalSizeClass) private var horizontalSizeClass
@@ -30,7 +30,6 @@ enum HomeScreenCoordinatorAction {
} }
final class HomeScreenCoordinator: Coordinator, Presentable { final class HomeScreenCoordinator: Coordinator, Presentable {
// MARK: - Properties // MARK: - Properties
// MARK: Private // MARK: Private
@@ -20,7 +20,6 @@ import SwiftUI
typealias HomeScreenViewModelType = StateStoreViewModel<HomeScreenViewState, HomeScreenViewAction> typealias HomeScreenViewModelType = StateStoreViewModel<HomeScreenViewState, HomeScreenViewAction>
class HomeScreenViewModel: HomeScreenViewModelType, HomeScreenViewModelProtocol { class HomeScreenViewModel: HomeScreenViewModelType, HomeScreenViewModelProtocol {
private let attributedStringBuilder: AttributedStringBuilderProtocol private let attributedStringBuilder: AttributedStringBuilderProtocol
private var roomUpdateListeners = Set<AnyCancellable>() private var roomUpdateListeners = Set<AnyCancellable>()
@@ -82,7 +81,6 @@ class HomeScreenViewModel: HomeScreenViewModelType, HomeScreenViewModelProtocol
} }
.store(in: &roomUpdateListeners) .store(in: &roomUpdateListeners)
} }
} }
func updateWithUserAvatar(_ avatar: UIImage) { func updateWithUserAvatar(_ avatar: UIImage) {
@@ -17,7 +17,6 @@
import SwiftUI import SwiftUI
struct HomeScreen: View { struct HomeScreen: View {
@ObservedObject var context: HomeScreenViewModel.Context @ObservedObject var context: HomeScreenViewModel.Context
// MARK: Views // MARK: Views
@@ -30,7 +29,6 @@ struct HomeScreen: View {
ProgressView() ProgressView()
} }
} else { } else {
if context.viewState.showSessionVerificationBanner { if context.viewState.showSessionVerificationBanner {
HStack { HStack {
Text(ElementL10n.verificationVerifyDevice) Text(ElementL10n.verificationVerifyDevice)
@@ -115,7 +113,6 @@ struct HomeScreen: View {
} }
struct RoomCell: View { struct RoomCell: View {
@ScaledMetric private var avatarSize = 32.0 @ScaledMetric private var avatarSize = 32.0
let room: HomeScreenRoom let room: HomeScreenRoom
@@ -24,7 +24,6 @@ struct RoomScreenCoordinatorParameters {
} }
final class RoomScreenCoordinator: Coordinator, Presentable { final class RoomScreenCoordinator: Coordinator, Presentable {
// MARK: - Properties // MARK: - Properties
// MARK: Private // MARK: Private
@@ -19,7 +19,6 @@ import SwiftUI
typealias RoomScreenViewModelType = StateStoreViewModel<RoomScreenViewState, RoomScreenViewAction> typealias RoomScreenViewModelType = StateStoreViewModel<RoomScreenViewState, RoomScreenViewAction>
class RoomScreenViewModel: RoomScreenViewModelType, RoomScreenViewModelProtocol { class RoomScreenViewModel: RoomScreenViewModelType, RoomScreenViewModelProtocol {
private enum Constants { private enum Constants {
static let backPaginationPageSize: UInt = 30 static let backPaginationPageSize: UInt = 30
} }
@@ -10,7 +10,6 @@ import Combine
import UIKit import UIKit
class ListTableViewAdapter: NSObject, UITableViewDelegate { class ListTableViewAdapter: NSObject, UITableViewDelegate {
private enum ContentOffsetDetails { private enum ContentOffsetDetails {
case topOffset(previousVisibleIndexPath: IndexPath, previousItemCount: Int) case topOffset(previousVisibleIndexPath: IndexPath, previousItemCount: Int)
case bottomOffset case bottomOffset
@@ -9,7 +9,6 @@
import SwiftUI import SwiftUI
struct MessageComposer: View { struct MessageComposer: View {
@Binding var text: String @Binding var text: String
var disabled: Bool var disabled: Bool
let action: () -> Void let action: () -> Void
@@ -9,7 +9,6 @@
import SwiftUI import SwiftUI
struct MessageComposerTextField: View { struct MessageComposerTextField: View {
@Binding private var text: String @Binding private var text: String
@State private var dynamicHeight: CGFloat = 100 @State private var dynamicHeight: CGFloat = 100
@State private var isEditing = false @State private var isEditing = false
@@ -13,7 +13,6 @@ import SwiftUI
import Introspect import Introspect
struct RoomHeaderView: View { struct RoomHeaderView: View {
@ObservedObject var context: RoomScreenViewModel.Context @ObservedObject var context: RoomScreenViewModel.Context
var body: some View { var body: some View {
@@ -49,7 +48,6 @@ struct RoomHeaderView: View {
.accessibilityIdentifier("roomAvatarPlaceholderImage") .accessibilityIdentifier("roomAvatarPlaceholderImage")
} }
} }
} }
struct RoomHeaderView_Previews: PreviewProvider { struct RoomHeaderView_Previews: PreviewProvider {
@@ -17,7 +17,6 @@
import SwiftUI import SwiftUI
struct RoomScreen: View { struct RoomScreen: View {
@ObservedObject var context: RoomScreenViewModel.Context @ObservedObject var context: RoomScreenViewModel.Context
var body: some View { var body: some View {
@@ -10,7 +10,6 @@ import Foundation
import SwiftUI import SwiftUI
struct TimelineItemBubbledStylerView<Content: View>: View { struct TimelineItemBubbledStylerView<Content: View>: View {
let timelineItem: EventBasedTimelineItemProtocol let timelineItem: EventBasedTimelineItemProtocol
@ViewBuilder let content: () -> Content @ViewBuilder let content: () -> Content
@@ -96,7 +95,6 @@ struct TimelineItemBubbledStylerView<Content: View>: View {
let opacity = colorScheme == .light ? 0.06 : 0.15 let opacity = colorScheme == .light ? 0.06 : 0.15
return timelineItem.isOutgoing ? .element.accent.opacity(opacity) : .element.system return timelineItem.isOutgoing ? .element.accent.opacity(opacity) : .element.system
} }
} }
struct TimelineItemBubbledStylerView_Previews: PreviewProvider { struct TimelineItemBubbledStylerView_Previews: PreviewProvider {
@@ -10,7 +10,6 @@ import Foundation
import SwiftUI import SwiftUI
struct TimelineItemPlainStylerView<Content: View>: View { struct TimelineItemPlainStylerView<Content: View>: View {
let timelineItem: EventBasedTimelineItemProtocol let timelineItem: EventBasedTimelineItemProtocol
@ViewBuilder let content: () -> Content @ViewBuilder let content: () -> Content
@@ -39,7 +39,6 @@ struct FormattedBodyText_Previews: PreviewProvider {
static var previews: some View { static var previews: some View {
body.preferredColorScheme(.light) body.preferredColorScheme(.light)
body.preferredColorScheme(.dark) body.preferredColorScheme(.dark)
} }
@ViewBuilder @ViewBuilder
@@ -17,7 +17,6 @@
import SwiftUI import SwiftUI
struct PlaceholderAvatarImage: View { struct PlaceholderAvatarImage: View {
private let textForImage: String private let textForImage: String
var body: some View { var body: some View {
@@ -9,7 +9,6 @@
import SwiftUI import SwiftUI
public struct TimelineItemContextMenu: View { public struct TimelineItemContextMenu: View {
let contextMenuActions: [TimelineItemContextMenuAction] let contextMenuActions: [TimelineItemContextMenuAction]
let callback: (TimelineItemContextMenuAction) -> Void let callback: (TimelineItemContextMenuAction) -> Void
@@ -11,7 +11,6 @@ import Introspect
import SwiftUI import SwiftUI
struct TimelineItemList: View { struct TimelineItemList: View {
@State private var tableViewObserver = ListTableViewAdapter() @State private var tableViewObserver = ListTableViewAdapter()
@State private var timelineItems: [RoomTimelineViewProvider] = [] @State private var timelineItems: [RoomTimelineViewProvider] = []
@State private var hasPendingChanges = false @State private var hasPendingChanges = false
@@ -10,7 +10,6 @@ import Foundation
import SwiftUI import SwiftUI
struct TimelineSenderAvatarView: View { struct TimelineSenderAvatarView: View {
let timelineItem: EventBasedTimelineItemProtocol let timelineItem: EventBasedTimelineItemProtocol
@ScaledMetric private var avatarSize = 26 @ScaledMetric private var avatarSize = 26
@@ -35,5 +34,4 @@ struct TimelineSenderAvatarView: View {
.animation(.default, value: timelineItem.senderAvatar) .animation(.default, value: timelineItem.senderAvatar)
} }
} }
@@ -13,7 +13,6 @@ import SwiftUI
import Introspect import Introspect
struct TimelineView: View { struct TimelineView: View {
@State private var bottomVisiblePublisher = PassthroughSubject<Bool, Never>() @State private var bottomVisiblePublisher = PassthroughSubject<Bool, Never>()
@State private var scrollToBottomPublisher = PassthroughSubject<Void, Never>() @State private var scrollToBottomPublisher = PassthroughSubject<Void, Never>()
@State private var scollToBottomButtonVisible = false @State private var scollToBottomButtonVisible = false
@@ -21,7 +21,6 @@ struct SessionVerificationCoordinatorParameters {
} }
final class SessionVerificationCoordinator: Coordinator, Presentable { final class SessionVerificationCoordinator: Coordinator, Presentable {
// MARK: - Properties // MARK: - Properties
// MARK: Private // MARK: Private
@@ -19,7 +19,6 @@ import SwiftUI
typealias SessionVerificationViewModelType = StateStoreViewModel<SessionVerificationViewState, SessionVerificationViewAction> typealias SessionVerificationViewModelType = StateStoreViewModel<SessionVerificationViewState, SessionVerificationViewAction>
class SessionVerificationViewModel: SessionVerificationViewModelType, SessionVerificationViewModelProtocol { class SessionVerificationViewModel: SessionVerificationViewModelType, SessionVerificationViewModelProtocol {
// MARK: - Properties // MARK: - Properties
// MARK: Private // MARK: Private
@@ -36,7 +35,6 @@ class SessionVerificationViewModel: SessionVerificationViewModelType, SessionVer
init(sessionVerificationControllerProxy: SessionVerificationControllerProxyProtocol, init(sessionVerificationControllerProxy: SessionVerificationControllerProxyProtocol,
initialState: SessionVerificationViewState = SessionVerificationViewState()) { initialState: SessionVerificationViewState = SessionVerificationViewState()) {
self.sessionVerificationControllerProxy = sessionVerificationControllerProxy self.sessionVerificationControllerProxy = sessionVerificationControllerProxy
stateMachine = SessionVerificationStateMachine() stateMachine = SessionVerificationStateMachine()
@@ -18,7 +18,6 @@ import MatrixRustSDK
import SwiftUI import SwiftUI
struct SessionVerificationScreen: View { struct SessionVerificationScreen: View {
@ObservedObject var context: SessionVerificationViewModel.Context @ObservedObject var context: SessionVerificationViewModel.Context
// MARK: Views // MARK: Views
@@ -26,7 +26,6 @@ enum SettingsCoordinatorAction {
} }
final class SettingsCoordinator: Coordinator, Presentable { final class SettingsCoordinator: Coordinator, Presentable {
// MARK: - Properties // MARK: - Properties
// MARK: Private // MARK: Private
@@ -21,7 +21,6 @@ typealias SettingsViewModelType = StateStoreViewModel<SettingsViewState,
SettingsViewAction> SettingsViewAction>
@available(iOS 14, *) @available(iOS 14, *)
class SettingsViewModel: SettingsViewModelType, SettingsViewModelProtocol { class SettingsViewModel: SettingsViewModelType, SettingsViewModelProtocol {
// MARK: - Properties // MARK: - Properties
// MARK: Private // MARK: Private
@@ -18,7 +18,6 @@ import Foundation
@MainActor @MainActor
protocol SettingsViewModelProtocol { protocol SettingsViewModelProtocol {
var callback: ((SettingsViewModelAction) -> Void)? { get set } var callback: ((SettingsViewModelAction) -> Void)? { get set }
@available(iOS 14, *) @available(iOS 14, *)
var context: SettingsViewModelType.Context { get } var context: SettingsViewModelType.Context { get }
@@ -17,7 +17,6 @@
import SwiftUI import SwiftUI
struct SettingsScreen: View { struct SettingsScreen: View {
// MARK: Private // MARK: Private
@State private var showingLogoutConfirmation = false @State private var showingLogoutConfirmation = false
@@ -17,7 +17,6 @@
import SwiftUI import SwiftUI
final class SplashScreenCoordinator: Coordinator, Presentable { final class SplashScreenCoordinator: Coordinator, Presentable {
// MARK: - Properties // MARK: - Properties
// MARK: Private // MARK: Private
@@ -38,7 +38,6 @@ enum SplashScreenViewModelAction {
// MARK: View // MARK: View
struct SplashScreenViewState: BindableState { struct SplashScreenViewState: BindableState {
/// The colours of the background gradient shown behind the 4 pages. /// The colours of the background gradient shown behind the 4 pages.
private let gradientColors = [ private let gradientColors = [
Color(red: 0.95, green: 0.98, blue: 0.96), Color(red: 0.95, green: 0.98, blue: 0.96),
@@ -20,7 +20,6 @@ import SwiftUI
typealias SplashScreenViewModelType = StateStoreViewModel<SplashScreenViewState, SplashScreenViewAction> typealias SplashScreenViewModelType = StateStoreViewModel<SplashScreenViewState, SplashScreenViewAction>
class SplashScreenViewModel: SplashScreenViewModelType, SplashScreenViewModelProtocol { class SplashScreenViewModel: SplashScreenViewModelType, SplashScreenViewModelProtocol {
// MARK: - Properties // MARK: - Properties
// MARK: Private // MARK: Private
@@ -19,7 +19,6 @@ import SwiftUI
/// The splash screen shown at the beginning of the onboarding flow. /// The splash screen shown at the beginning of the onboarding flow.
struct SplashScreen: View { struct SplashScreen: View {
// MARK: - Properties // MARK: - Properties
// MARK: Private // MARK: Private
@@ -47,7 +46,6 @@ struct SplashScreen: View {
// The main content of the carousel // The main content of the carousel
HStack(alignment: .top, spacing: 0) { HStack(alignment: .top, spacing: 0) {
// Add a hidden page at the start of the carousel duplicating the content of the last page // Add a hidden page at the start of the carousel duplicating the content of the last page
SplashScreenPageView(content: context.viewState.content[pageCount - 1]) SplashScreenPageView(content: context.viewState.content[pageCount - 1])
.frame(width: geometry.size.width) .frame(width: geometry.size.width)
@@ -57,7 +55,6 @@ struct SplashScreen: View {
SplashScreenPageView(content: context.viewState.content[index]) SplashScreenPageView(content: context.viewState.content[index])
.frame(width: geometry.size.width) .frame(width: geometry.size.width)
} }
} }
.offset(x: pageOffset(in: geometry)) .offset(x: pageOffset(in: geometry))
@@ -17,7 +17,6 @@
import SwiftUI import SwiftUI
struct SplashScreenPageIndicator: View { struct SplashScreenPageIndicator: View {
// MARK: - Properties // MARK: - Properties
// MARK: Public // MARK: Public
@@ -17,7 +17,6 @@
import SwiftUI import SwiftUI
struct SplashScreenPageView: View { struct SplashScreenPageView: View {
// MARK: - Properties // MARK: - Properties
// MARK: Public // MARK: Public
@@ -10,7 +10,6 @@ import Foundation
import MatrixRustSDK import MatrixRustSDK
class AuthenticationService: AuthenticationServiceProtocol { class AuthenticationService: AuthenticationServiceProtocol {
// MARK: - Properties // MARK: - Properties
// MARK: Private // MARK: Private
@@ -9,15 +9,12 @@
import Foundation import Foundation
protocol BackgroundTaskServiceProtocol { protocol BackgroundTaskServiceProtocol {
func startBackgroundTask(withName name: String, func startBackgroundTask(withName name: String,
isReusable: Bool, isReusable: Bool,
expirationHandler: (() -> Void)?) -> BackgroundTaskProtocol? expirationHandler: (() -> Void)?) -> BackgroundTaskProtocol?
} }
extension BackgroundTaskServiceProtocol { extension BackgroundTaskServiceProtocol {
func startBackgroundTask(withName name: String) -> BackgroundTaskProtocol? { func startBackgroundTask(withName name: String) -> BackgroundTaskProtocol? {
startBackgroundTask(withName: name, startBackgroundTask(withName: name,
expirationHandler: nil) expirationHandler: nil)
@@ -36,5 +33,4 @@ extension BackgroundTaskServiceProtocol {
isReusable: false, isReusable: false,
expirationHandler: expirationHandler) expirationHandler: expirationHandler)
} }
} }
@@ -11,7 +11,6 @@ import UIKit
/// /// UIKitBackgroundTaskService is a concrete implementation of BackgroundTaskServiceProtocol using a given `ApplicationProtocol` instance. /// /// UIKitBackgroundTaskService is a concrete implementation of BackgroundTaskServiceProtocol using a given `ApplicationProtocol` instance.
class UIKitBackgroundTaskService: BackgroundTaskServiceProtocol { class UIKitBackgroundTaskService: BackgroundTaskServiceProtocol {
private let application: ApplicationProtocol? private let application: ApplicationProtocol?
private var reusableTasks: WeakDictionary<String, UIKitBackgroundTask> = WeakDictionary() private var reusableTasks: WeakDictionary<String, UIKitBackgroundTask> = WeakDictionary()
@@ -91,7 +90,6 @@ class UIKitBackgroundTaskService: BackgroundTaskServiceProtocol {
} }
return false return false
} }
} }
private extension TimeInterval { private extension TimeInterval {
@@ -213,7 +213,6 @@ class BugReportService: BugReportServiceProtocol {
return zippedFiles return zippedFiles
} }
} }
private extension Data { private extension Data {
@@ -14,7 +14,6 @@ struct SubmitBugReportResponse: Decodable {
} }
protocol BugReportServiceProtocol { protocol BugReportServiceProtocol {
var crashedLastRun: Bool { get } var crashedLastRun: Bool { get }
func crash() func crash()
@@ -10,7 +10,6 @@ import Foundation
import UIKit import UIKit
class MockBugReportService: BugReportServiceProtocol { class MockBugReportService: BugReportServiceProtocol {
func submitBugReport(text: String, func submitBugReport(text: String,
includeLogs: Bool, includeLogs: Bool,
includeCrashLog: Bool, includeCrashLog: Bool,
@@ -24,5 +23,4 @@ class MockBugReportService: BugReportServiceProtocol {
func crash() { func crash() {
// no-op // no-op
} }
} }
@@ -17,7 +17,6 @@ enum ScreenshotDetectorError: String, Error {
@MainActor @MainActor
class ScreenshotDetector { class ScreenshotDetector {
var callback: (@MainActor(UIImage?, Error?) -> Void)? var callback: (@MainActor(UIImage?, Error?) -> Void)?
/// Flag to whether ask for photos authorization by default if needed. /// Flag to whether ask for photos authorization by default if needed.
@@ -80,11 +79,9 @@ class ScreenshotDetector {
func fail(withError error: Error) { func fail(withError error: Error) {
callback?(nil, error) callback?(nil, error)
} }
} }
private extension PHAsset { private extension PHAsset {
static func fetchLastScreenshot() -> PHAsset? { static func fetchLastScreenshot() -> PHAsset? {
let options = PHFetchOptions() let options = PHFetchOptions()
@@ -99,7 +96,6 @@ private extension PHAsset {
} }
private extension PHImageRequestOptions { private extension PHImageRequestOptions {
static var highQualitySyncLocal: PHImageRequestOptions { static var highQualitySyncLocal: PHImageRequestOptions {
let options = PHImageRequestOptions() let options = PHImageRequestOptions()
options.deliveryMode = .highQualityFormat options.deliveryMode = .highQualityFormat
@@ -24,7 +24,6 @@ private class WeakClientProxyWrapper: ClientDelegate {
} }
class ClientProxy: ClientProxyProtocol { class ClientProxy: ClientProxyProtocol {
private let client: Client private let client: Client
private let backgroundTaskService: BackgroundTaskServiceProtocol private let backgroundTaskService: BackgroundTaskServiceProtocol
private var sessionVerificationControllerProxy: SessionVerificationControllerProxy? private var sessionVerificationControllerProxy: SessionVerificationControllerProxy?
@@ -71,7 +70,6 @@ class ClientProxy: ClientProxyProtocol {
} catch { } catch {
return .failure(.failedRetrievingDisplayName) return .failure(.failedRetrievingDisplayName)
} }
} }
.value .value
} }
@@ -10,7 +10,6 @@ import Combine
import MatrixRustSDK import MatrixRustSDK
struct MockClientProxy: ClientProxyProtocol { struct MockClientProxy: ClientProxyProtocol {
let callbacks = PassthroughSubject<ClientProxyCallback, Never>() let callbacks = PassthroughSubject<ClientProxyCallback, Never>()
let userIdentifier: String let userIdentifier: String
@@ -10,7 +10,6 @@ import Foundation
import UIKit import UIKit
struct MockMediaProvider: MediaProviderProtocol { struct MockMediaProvider: MediaProviderProtocol {
func imageFromSource(_ source: MediaSource?) -> UIImage? { func imageFromSource(_ source: MediaSource?) -> UIImage? {
nil nil
} }
@@ -10,7 +10,6 @@ import Foundation
@MainActor @MainActor
class MemberDetailProviderManager { class MemberDetailProviderManager {
private var memberDetailProviders: [String: MemberDetailProviderProtocol] = [:] private var memberDetailProviders: [String: MemberDetailProviderProtocol] = [:]
func memberDetailProviderForRoomProxy(_ roomProxy: RoomProxyProtocol) -> MemberDetailProviderProtocol { func memberDetailProviderForRoomProxy(_ roomProxy: RoomProxyProtocol) -> MemberDetailProviderProtocol {
@@ -9,7 +9,6 @@
import Foundation import Foundation
struct EventBriefFactory: EventBriefFactoryProtocol { struct EventBriefFactory: EventBriefFactoryProtocol {
private let memberDetailProvider: MemberDetailProviderProtocol private let memberDetailProvider: MemberDetailProviderProtocol
init(memberDetailProvider: MemberDetailProviderProtocol) { init(memberDetailProvider: MemberDetailProviderProtocol) {
@@ -10,7 +10,6 @@ import Combine
import Foundation import Foundation
class MockRoomTimelineController: RoomTimelineControllerProtocol { class MockRoomTimelineController: RoomTimelineControllerProtocol {
let callbacks = PassthroughSubject<RoomTimelineControllerCallback, Never>() let callbacks = PassthroughSubject<RoomTimelineControllerCallback, Never>()
var timelineItems: [RoomTimelineItemProtocol] = [SeparatorRoomTimelineItem(id: UUID().uuidString, var timelineItems: [RoomTimelineItemProtocol] = [SeparatorRoomTimelineItem(id: UUID().uuidString,
@@ -67,7 +67,6 @@ struct RoomTimelineItemFactory: RoomTimelineItemFactoryProtocol {
_ showSenderDetails: Bool, _ showSenderDetails: Bool,
_ displayName: String?, _ displayName: String?,
_ avatarImage: UIImage?) -> RoomTimelineItemProtocol { _ avatarImage: UIImage?) -> RoomTimelineItemProtocol {
var aspectRatio: CGFloat? var aspectRatio: CGFloat?
if let width = message.width, if let width = message.width,
let height = message.height { let height = message.height {
@@ -19,7 +19,6 @@ import Kingfisher
import MatrixRustSDK import MatrixRustSDK
class UserSessionStore: UserSessionStoreProtocol { class UserSessionStore: UserSessionStoreProtocol {
private let keychainController: KeychainControllerProtocol private let keychainController: KeychainControllerProtocol
private let backgroundTaskService: BackgroundTaskServiceProtocol private let backgroundTaskService: BackgroundTaskServiceProtocol
-1
View File
@@ -9,7 +9,6 @@
import SwiftUI import SwiftUI
struct UITestsRootView: View { struct UITestsRootView: View {
let mockScreens: [MockScreen] let mockScreens: [MockScreen]
var selectionCallback: ((UITestScreenIdentifier) -> Void)? var selectionCallback: ((UITestScreenIdentifier) -> Void)?
@@ -26,7 +26,6 @@ enum TemplateCoordinatorAction {
} }
final class TemplateCoordinator: Coordinator, Presentable { final class TemplateCoordinator: Coordinator, Presentable {
// MARK: - Properties // MARK: - Properties
// MARK: Private // MARK: Private
@@ -19,7 +19,6 @@ import SwiftUI
typealias TemplateViewModelType = StateStoreViewModel<TemplateViewState, TemplateViewAction> typealias TemplateViewModelType = StateStoreViewModel<TemplateViewState, TemplateViewAction>
class TemplateViewModel: TemplateViewModelType, TemplateViewModelProtocol { class TemplateViewModel: TemplateViewModelType, TemplateViewModelProtocol {
// MARK: - Properties // MARK: - Properties
// MARK: Private // MARK: Private
@@ -17,7 +17,6 @@
import SwiftUI import SwiftUI
struct TemplateScreen: View { struct TemplateScreen: View {
// MARK: Private // MARK: Private
@Environment(\.colorScheme) private var colorScheme @Environment(\.colorScheme) private var colorScheme
-2
View File
@@ -18,7 +18,6 @@ import ElementX
import XCTest import XCTest
class BugReportUITests: XCTestCase { class BugReportUITests: XCTestCase {
func testInitialStateComponents() { func testInitialStateComponents() {
let app = Application.launch() let app = Application.launch()
app.goToScreenWithIdentifier(.bugReport) app.goToScreenWithIdentifier(.bugReport)
@@ -85,7 +84,6 @@ class BugReportUITests: XCTestCase {
XCTAssertEqual(sendButton.label, ElementL10n.actionSend) XCTAssertEqual(sendButton.label, ElementL10n.actionSend)
XCTAssertFalse(sendButton.isEnabled) XCTAssertFalse(sendButton.isEnabled)
} }
} }
extension XCUIElement { extension XCUIElement {
-1
View File
@@ -19,7 +19,6 @@ import XCTest
@MainActor @MainActor
class RoomScreenUITests: XCTestCase { class RoomScreenUITests: XCTestCase {
func testPlainNoAvatar() { func testPlainNoAvatar() {
let app = Application.launch() let app = Application.launch()
app.goToScreenWithIdentifier(.roomPlainNoAvatar) app.goToScreenWithIdentifier(.roomPlainNoAvatar)
@@ -19,7 +19,6 @@ import XCTest
@MainActor @MainActor
class ServerSelectionUITests: XCTestCase { class ServerSelectionUITests: XCTestCase {
let textFieldIdentifier = "addressTextField" let textFieldIdentifier = "addressTextField"
func testNormalState() async { func testNormalState() async {

Some files were not shown because too many files have changed in this diff Show More