mirror of
https://github.com/element-hq/element-x-ios.git
synced 2025-03-10 13:37:11 +00:00
Enable blank line rules. (#132)
This commit is contained in:
parent
02eb4b35e2
commit
25d7ba55ad
@ -3,8 +3,6 @@
|
||||
--exclude ElementX/Sources/Generated
|
||||
|
||||
--disable wrapMultiLineStatementBraces
|
||||
--disable blankLinesAtStartOfScope
|
||||
--disable blankLinesAtEndOfScope
|
||||
--disable hoistPatternLet
|
||||
|
||||
--commas inline
|
||||
|
@ -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)
|
||||
|
@ -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.
|
||||
|
@ -17,7 +17,6 @@
|
||||
import UIKit
|
||||
|
||||
public extension UIFont {
|
||||
|
||||
// MARK: - Convenient methods
|
||||
|
||||
/// Update current font with a SymbolicTraits
|
||||
|
@ -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 {
|
||||
|
@ -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
|
||||
|
||||
}
|
||||
|
@ -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)
|
||||
}
|
||||
|
@ -9,10 +9,8 @@
|
||||
import UIKit
|
||||
|
||||
class ElementNavigationController: UINavigationController {
|
||||
|
||||
override func viewWillLayoutSubviews() {
|
||||
super.viewWillLayoutSubviews()
|
||||
navigationBar.topItem?.backButtonDisplayMode = .minimal
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -11,7 +11,6 @@ import SwiftUI
|
||||
|
||||
/// Store Element specific app settings.
|
||||
final class ElementSettings: ObservableObject {
|
||||
|
||||
// MARK: - Constants
|
||||
|
||||
public enum UserDefaultsKeys: String {
|
||||
|
@ -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 }
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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)
|
||||
|
||||
|
@ -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
|
||||
|
@ -15,7 +15,6 @@ enum ImageAnonymizerError: Error {
|
||||
}
|
||||
|
||||
enum ImageAnonymizer {
|
||||
|
||||
private static var allowedTextItems: [String] = [
|
||||
"#",
|
||||
"@",
|
||||
@ -113,5 +112,4 @@ enum ImageAnonymizer {
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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.
|
||||
|
@ -28,9 +28,7 @@ struct NavigationModule {
|
||||
// MARK: - CustomStringConvertible
|
||||
|
||||
extension NavigationModule: CustomStringConvertible {
|
||||
|
||||
var description: String {
|
||||
"NavigationModule: \(presentable), pop completion: \(String(describing: popCompletion))"
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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"
|
||||
|
||||
|
@ -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 {
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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)
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -73,7 +73,6 @@ class ViewModelContext<ViewState: BindableState, ViewAction>: ObservableObject {
|
||||
/// we can do it in this centralised place.
|
||||
@MainActor
|
||||
class StateStoreViewModel<State: BindableState, ViewAction> {
|
||||
|
||||
typealias Context = ViewModelContext<State, ViewAction>
|
||||
|
||||
// MARK: - Properties
|
||||
|
@ -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")
|
||||
|
@ -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)
|
||||
|
@ -17,7 +17,6 @@
|
||||
import UIKit
|
||||
|
||||
final class ActivityIndicatorView: UIView {
|
||||
|
||||
// MARK: - Constants
|
||||
|
||||
private enum Constants {
|
||||
|
@ -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
|
||||
|
@ -70,7 +70,6 @@ class RoundedToastView: UIView {
|
||||
}
|
||||
|
||||
private func setup(viewState: ToastViewState) {
|
||||
|
||||
backgroundColor = .clear
|
||||
clipsToBounds = true
|
||||
|
||||
|
@ -9,7 +9,6 @@
|
||||
import Foundation
|
||||
|
||||
public struct WeakDictionary<Key: Hashable, Value: AnyObject> {
|
||||
|
||||
private var storage: [Key: WeakDictionaryReference<Value>]
|
||||
|
||||
public init() {
|
||||
@ -48,7 +47,6 @@ public struct WeakDictionary<Key: Hashable, Value: AnyObject> {
|
||||
}
|
||||
|
||||
extension WeakDictionary: Collection {
|
||||
|
||||
public typealias Index = DictionaryIndex<Key, WeakDictionaryReference<Value>>
|
||||
|
||||
public var startIndex: Index {
|
||||
|
@ -9,7 +9,6 @@
|
||||
import Foundation
|
||||
|
||||
public struct WeakDictionaryKey<Key: AnyObject & Hashable, Value: AnyObject>: Hashable {
|
||||
|
||||
private weak var baseKey: Key?
|
||||
private let hash: Int
|
||||
private var retainedValue: Value?
|
||||
|
@ -9,7 +9,6 @@
|
||||
import Foundation
|
||||
|
||||
public struct WeakKeyDictionary<Key: AnyObject & Hashable, Value: AnyObject> {
|
||||
|
||||
private var storage: WeakDictionary<WeakDictionaryKey<Key, Value>, Value>
|
||||
private let valuesRetainedByKey: Bool
|
||||
|
||||
@ -69,7 +68,6 @@ public struct WeakKeyDictionary<Key: AnyObject & Hashable, Value: AnyObject> {
|
||||
}
|
||||
|
||||
extension WeakKeyDictionary: Collection {
|
||||
|
||||
public typealias Index = DictionaryIndex<WeakDictionaryKey<Key, Value>, WeakDictionaryReference<Value>>
|
||||
|
||||
public var startIndex: Index {
|
||||
|
@ -16,7 +16,6 @@ protocol AuthenticationCoordinatorDelegate: AnyObject {
|
||||
}
|
||||
|
||||
class AuthenticationCoordinator: Coordinator, Presentable {
|
||||
|
||||
private let authenticationService: AuthenticationServiceProtocol
|
||||
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.
|
||||
struct AuthenticationIconImage: View {
|
||||
|
||||
let image: ImageAsset
|
||||
|
||||
var body: some View {
|
||||
|
@ -32,7 +32,6 @@ enum LoginCoordinatorAction {
|
||||
}
|
||||
|
||||
final class LoginCoordinator: Coordinator, Presentable {
|
||||
|
||||
// MARK: - Properties
|
||||
|
||||
// MARK: Private
|
||||
|
@ -85,5 +85,4 @@ extension LoginHomeserver {
|
||||
isMatrixDotOrg: false,
|
||||
loginMode: .unsupported)
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -19,7 +19,6 @@ import SwiftUI
|
||||
typealias LoginViewModelType = StateStoreViewModel<LoginViewState, LoginViewAction>
|
||||
|
||||
class LoginViewModel: LoginViewModelType, LoginViewModelProtocol {
|
||||
|
||||
// MARK: - Properties
|
||||
|
||||
// MARK: Public
|
||||
|
@ -18,7 +18,6 @@ import Foundation
|
||||
|
||||
@MainActor
|
||||
protocol LoginViewModelProtocol {
|
||||
|
||||
var callback: (@MainActor(LoginViewModelAction) -> Void)? { get set }
|
||||
var context: LoginViewModelType.Context { get }
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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.
|
||||
|
@ -29,7 +29,6 @@ enum ServerSelectionCoordinatorAction {
|
||||
}
|
||||
|
||||
final class ServerSelectionCoordinator: Coordinator, Presentable {
|
||||
|
||||
// MARK: - Properties
|
||||
|
||||
// MARK: Private
|
||||
|
@ -19,7 +19,6 @@ import SwiftUI
|
||||
typealias ServerSelectionViewModelType = StateStoreViewModel<ServerSelectionViewState, ServerSelectionViewAction>
|
||||
|
||||
class ServerSelectionViewModel: ServerSelectionViewModelType, ServerSelectionViewModelProtocol {
|
||||
|
||||
// MARK: - Properties
|
||||
|
||||
// MARK: Private
|
||||
|
@ -18,7 +18,6 @@ import Foundation
|
||||
|
||||
@MainActor
|
||||
protocol ServerSelectionViewModelProtocol {
|
||||
|
||||
var callback: (@MainActor(ServerSelectionViewModelAction) -> Void)? { get set }
|
||||
var context: ServerSelectionViewModelType.Context { get }
|
||||
|
||||
|
@ -17,7 +17,6 @@
|
||||
import SwiftUI
|
||||
|
||||
struct ServerSelectionScreen: View {
|
||||
|
||||
// MARK: - Properties
|
||||
|
||||
// MARK: Private
|
||||
|
@ -22,7 +22,6 @@ struct BugReportCoordinatorParameters {
|
||||
}
|
||||
|
||||
final class BugReportCoordinator: Coordinator, Presentable {
|
||||
|
||||
// MARK: - Properties
|
||||
|
||||
// MARK: Private
|
||||
|
@ -21,7 +21,6 @@ typealias BugReportViewModelType = StateStoreViewModel<BugReportViewState,
|
||||
BugReportViewAction>
|
||||
@available(iOS 14, *)
|
||||
class BugReportViewModel: BugReportViewModelType, BugReportViewModelProtocol {
|
||||
|
||||
// MARK: - Properties
|
||||
|
||||
let bugReportService: BugReportServiceProtocol
|
||||
|
@ -18,7 +18,6 @@ import Foundation
|
||||
|
||||
@MainActor
|
||||
protocol BugReportViewModelProtocol {
|
||||
|
||||
var callback: ((BugReportViewModelAction) -> Void)? { get set }
|
||||
@available(iOS 14, *)
|
||||
var context: BugReportViewModelType.Context { get }
|
||||
|
@ -17,7 +17,6 @@
|
||||
import SwiftUI
|
||||
|
||||
struct BugReportScreen: View {
|
||||
|
||||
// MARK: Private
|
||||
|
||||
@Environment(\.horizontalSizeClass) private var horizontalSizeClass
|
||||
|
@ -30,7 +30,6 @@ enum HomeScreenCoordinatorAction {
|
||||
}
|
||||
|
||||
final class HomeScreenCoordinator: Coordinator, Presentable {
|
||||
|
||||
// MARK: - Properties
|
||||
|
||||
// MARK: Private
|
||||
|
@ -20,7 +20,6 @@ import SwiftUI
|
||||
typealias HomeScreenViewModelType = StateStoreViewModel<HomeScreenViewState, HomeScreenViewAction>
|
||||
|
||||
class HomeScreenViewModel: HomeScreenViewModelType, HomeScreenViewModelProtocol {
|
||||
|
||||
private let attributedStringBuilder: AttributedStringBuilderProtocol
|
||||
|
||||
private var roomUpdateListeners = Set<AnyCancellable>()
|
||||
@ -82,7 +81,6 @@ class HomeScreenViewModel: HomeScreenViewModelType, HomeScreenViewModelProtocol
|
||||
}
|
||||
.store(in: &roomUpdateListeners)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func updateWithUserAvatar(_ avatar: UIImage) {
|
||||
|
@ -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
|
||||
|
@ -24,7 +24,6 @@ struct RoomScreenCoordinatorParameters {
|
||||
}
|
||||
|
||||
final class RoomScreenCoordinator: Coordinator, Presentable {
|
||||
|
||||
// MARK: - Properties
|
||||
|
||||
// MARK: Private
|
||||
|
@ -19,7 +19,6 @@ import SwiftUI
|
||||
typealias RoomScreenViewModelType = StateStoreViewModel<RoomScreenViewState, RoomScreenViewAction>
|
||||
|
||||
class RoomScreenViewModel: RoomScreenViewModelType, RoomScreenViewModelProtocol {
|
||||
|
||||
private enum Constants {
|
||||
static let backPaginationPageSize: UInt = 30
|
||||
}
|
||||
|
@ -10,7 +10,6 @@ import Combine
|
||||
import UIKit
|
||||
|
||||
class ListTableViewAdapter: NSObject, UITableViewDelegate {
|
||||
|
||||
private enum ContentOffsetDetails {
|
||||
case topOffset(previousVisibleIndexPath: IndexPath, previousItemCount: Int)
|
||||
case bottomOffset
|
||||
|
@ -9,7 +9,6 @@
|
||||
import SwiftUI
|
||||
|
||||
struct MessageComposer: View {
|
||||
|
||||
@Binding var text: String
|
||||
var disabled: Bool
|
||||
let action: () -> Void
|
||||
|
@ -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
|
||||
|
@ -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 {
|
||||
|
@ -17,7 +17,6 @@
|
||||
import SwiftUI
|
||||
|
||||
struct RoomScreen: View {
|
||||
|
||||
@ObservedObject var context: RoomScreenViewModel.Context
|
||||
|
||||
var body: some View {
|
||||
|
@ -10,7 +10,6 @@ import Foundation
|
||||
import SwiftUI
|
||||
|
||||
struct TimelineItemBubbledStylerView<Content: View>: View {
|
||||
|
||||
let timelineItem: EventBasedTimelineItemProtocol
|
||||
@ViewBuilder let content: () -> Content
|
||||
|
||||
@ -96,7 +95,6 @@ struct TimelineItemBubbledStylerView<Content: View>: View {
|
||||
let opacity = colorScheme == .light ? 0.06 : 0.15
|
||||
return timelineItem.isOutgoing ? .element.accent.opacity(opacity) : .element.system
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
struct TimelineItemBubbledStylerView_Previews: PreviewProvider {
|
||||
|
@ -10,7 +10,6 @@ import Foundation
|
||||
import SwiftUI
|
||||
|
||||
struct TimelineItemPlainStylerView<Content: View>: View {
|
||||
|
||||
let timelineItem: EventBasedTimelineItemProtocol
|
||||
@ViewBuilder let content: () -> Content
|
||||
|
||||
|
@ -39,7 +39,6 @@ struct FormattedBodyText_Previews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
body.preferredColorScheme(.light)
|
||||
body.preferredColorScheme(.dark)
|
||||
|
||||
}
|
||||
|
||||
@ViewBuilder
|
||||
|
@ -17,7 +17,6 @@
|
||||
import SwiftUI
|
||||
|
||||
struct PlaceholderAvatarImage: View {
|
||||
|
||||
private let textForImage: String
|
||||
|
||||
var body: some View {
|
||||
|
@ -9,7 +9,6 @@
|
||||
import SwiftUI
|
||||
|
||||
public struct TimelineItemContextMenu: View {
|
||||
|
||||
let contextMenuActions: [TimelineItemContextMenuAction]
|
||||
let callback: (TimelineItemContextMenuAction) -> Void
|
||||
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -13,7 +13,6 @@ import SwiftUI
|
||||
import Introspect
|
||||
|
||||
struct TimelineView: View {
|
||||
|
||||
@State private var bottomVisiblePublisher = PassthroughSubject<Bool, Never>()
|
||||
@State private var scrollToBottomPublisher = PassthroughSubject<Void, Never>()
|
||||
@State private var scollToBottomButtonVisible = false
|
||||
|
@ -21,7 +21,6 @@ struct SessionVerificationCoordinatorParameters {
|
||||
}
|
||||
|
||||
final class SessionVerificationCoordinator: Coordinator, Presentable {
|
||||
|
||||
// MARK: - Properties
|
||||
|
||||
// MARK: Private
|
||||
|
@ -19,7 +19,6 @@ import SwiftUI
|
||||
typealias SessionVerificationViewModelType = StateStoreViewModel<SessionVerificationViewState, SessionVerificationViewAction>
|
||||
|
||||
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()
|
||||
|
@ -18,7 +18,6 @@ import MatrixRustSDK
|
||||
import SwiftUI
|
||||
|
||||
struct SessionVerificationScreen: View {
|
||||
|
||||
@ObservedObject var context: SessionVerificationViewModel.Context
|
||||
|
||||
// MARK: Views
|
||||
|
@ -26,7 +26,6 @@ enum SettingsCoordinatorAction {
|
||||
}
|
||||
|
||||
final class SettingsCoordinator: Coordinator, Presentable {
|
||||
|
||||
// MARK: - Properties
|
||||
|
||||
// MARK: Private
|
||||
|
@ -21,7 +21,6 @@ typealias SettingsViewModelType = StateStoreViewModel<SettingsViewState,
|
||||
SettingsViewAction>
|
||||
@available(iOS 14, *)
|
||||
class SettingsViewModel: SettingsViewModelType, SettingsViewModelProtocol {
|
||||
|
||||
// MARK: - Properties
|
||||
|
||||
// MARK: Private
|
||||
|
@ -18,7 +18,6 @@ import Foundation
|
||||
|
||||
@MainActor
|
||||
protocol SettingsViewModelProtocol {
|
||||
|
||||
var callback: ((SettingsViewModelAction) -> Void)? { get set }
|
||||
@available(iOS 14, *)
|
||||
var context: SettingsViewModelType.Context { get }
|
||||
|
@ -17,7 +17,6 @@
|
||||
import SwiftUI
|
||||
|
||||
struct SettingsScreen: View {
|
||||
|
||||
// MARK: Private
|
||||
|
||||
@State private var showingLogoutConfirmation = false
|
||||
|
@ -17,7 +17,6 @@
|
||||
import SwiftUI
|
||||
|
||||
final class SplashScreenCoordinator: Coordinator, Presentable {
|
||||
|
||||
// MARK: - Properties
|
||||
|
||||
// MARK: Private
|
||||
|
@ -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),
|
||||
|
@ -20,7 +20,6 @@ import SwiftUI
|
||||
typealias SplashScreenViewModelType = StateStoreViewModel<SplashScreenViewState, SplashScreenViewAction>
|
||||
|
||||
class SplashScreenViewModel: SplashScreenViewModelType, SplashScreenViewModelProtocol {
|
||||
|
||||
// MARK: - Properties
|
||||
|
||||
// MARK: Private
|
||||
|
@ -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))
|
||||
|
||||
|
@ -17,7 +17,6 @@
|
||||
import SwiftUI
|
||||
|
||||
struct SplashScreenPageIndicator: View {
|
||||
|
||||
// MARK: - Properties
|
||||
|
||||
// MARK: Public
|
||||
|
@ -17,7 +17,6 @@
|
||||
import SwiftUI
|
||||
|
||||
struct SplashScreenPageView: View {
|
||||
|
||||
// MARK: - Properties
|
||||
|
||||
// MARK: Public
|
||||
|
@ -10,7 +10,6 @@ import Foundation
|
||||
import MatrixRustSDK
|
||||
|
||||
class AuthenticationService: AuthenticationServiceProtocol {
|
||||
|
||||
// MARK: - Properties
|
||||
|
||||
// MARK: Private
|
||||
|
@ -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)
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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<String, UIKitBackgroundTask> = WeakDictionary()
|
||||
|
||||
@ -91,7 +90,6 @@ class UIKitBackgroundTaskService: BackgroundTaskServiceProtocol {
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private extension TimeInterval {
|
||||
|
@ -213,7 +213,6 @@ class BugReportService: BugReportServiceProtocol {
|
||||
|
||||
return zippedFiles
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private extension Data {
|
||||
|
@ -14,7 +14,6 @@ struct SubmitBugReportResponse: Decodable {
|
||||
}
|
||||
|
||||
protocol BugReportServiceProtocol {
|
||||
|
||||
var crashedLastRun: Bool { get }
|
||||
|
||||
func crash()
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -10,7 +10,6 @@ import Combine
|
||||
import MatrixRustSDK
|
||||
|
||||
struct MockClientProxy: ClientProxyProtocol {
|
||||
|
||||
let callbacks = PassthroughSubject<ClientProxyCallback, Never>()
|
||||
|
||||
let userIdentifier: String
|
||||
|
@ -10,7 +10,6 @@ import Foundation
|
||||
import UIKit
|
||||
|
||||
struct MockMediaProvider: MediaProviderProtocol {
|
||||
|
||||
func imageFromSource(_ source: MediaSource?) -> UIImage? {
|
||||
nil
|
||||
}
|
||||
|
@ -10,7 +10,6 @@ import Foundation
|
||||
|
||||
@MainActor
|
||||
class MemberDetailProviderManager {
|
||||
|
||||
private var memberDetailProviders: [String: MemberDetailProviderProtocol] = [:]
|
||||
|
||||
func memberDetailProviderForRoomProxy(_ roomProxy: RoomProxyProtocol) -> MemberDetailProviderProtocol {
|
||||
|
@ -9,7 +9,6 @@
|
||||
import Foundation
|
||||
|
||||
struct EventBriefFactory: EventBriefFactoryProtocol {
|
||||
|
||||
private let memberDetailProvider: MemberDetailProviderProtocol
|
||||
|
||||
init(memberDetailProvider: MemberDetailProviderProtocol) {
|
||||
|
@ -10,7 +10,6 @@ import Combine
|
||||
import Foundation
|
||||
|
||||
class MockRoomTimelineController: RoomTimelineControllerProtocol {
|
||||
|
||||
let callbacks = PassthroughSubject<RoomTimelineControllerCallback, Never>()
|
||||
|
||||
var timelineItems: [RoomTimelineItemProtocol] = [SeparatorRoomTimelineItem(id: UUID().uuidString,
|
||||
|
@ -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 {
|
||||
|
@ -19,7 +19,6 @@ import Kingfisher
|
||||
import MatrixRustSDK
|
||||
|
||||
class UserSessionStore: UserSessionStoreProtocol {
|
||||
|
||||
private let keychainController: KeychainControllerProtocol
|
||||
private let backgroundTaskService: BackgroundTaskServiceProtocol
|
||||
|
||||
|
@ -9,7 +9,6 @@
|
||||
import SwiftUI
|
||||
|
||||
struct UITestsRootView: View {
|
||||
|
||||
let mockScreens: [MockScreen]
|
||||
var selectionCallback: ((UITestScreenIdentifier) -> Void)?
|
||||
|
||||
|
@ -26,7 +26,6 @@ enum TemplateCoordinatorAction {
|
||||
}
|
||||
|
||||
final class TemplateCoordinator: Coordinator, Presentable {
|
||||
|
||||
// MARK: - Properties
|
||||
|
||||
// MARK: Private
|
||||
|
@ -19,7 +19,6 @@ import SwiftUI
|
||||
typealias TemplateViewModelType = StateStoreViewModel<TemplateViewState, TemplateViewAction>
|
||||
|
||||
class TemplateViewModel: TemplateViewModelType, TemplateViewModelProtocol {
|
||||
|
||||
// MARK: - Properties
|
||||
|
||||
// MARK: Private
|
||||
|
@ -17,7 +17,6 @@
|
||||
import SwiftUI
|
||||
|
||||
struct TemplateScreen: View {
|
||||
|
||||
// MARK: Private
|
||||
|
||||
@Environment(\.colorScheme) private var colorScheme
|
||||
|
@ -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 {
|
||||
|
@ -19,7 +19,6 @@ import XCTest
|
||||
|
||||
@MainActor
|
||||
class RoomScreenUITests: XCTestCase {
|
||||
|
||||
func testPlainNoAvatar() {
|
||||
let app = Application.launch()
|
||||
app.goToScreenWithIdentifier(.roomPlainNoAvatar)
|
||||
|
@ -19,7 +19,6 @@ import XCTest
|
||||
|
||||
@MainActor
|
||||
class ServerSelectionUITests: XCTestCase {
|
||||
|
||||
let textFieldIdentifier = "addressTextField"
|
||||
|
||||
func testNormalState() async {
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user