Configured and applied SwiftFormat

This commit is contained in:
Stefan Ceriu
2022-09-27 10:17:22 +03:00
committed by Stefan Ceriu
parent ff2e6ddfa7
commit 43c28d23b7
663 changed files with 2329 additions and 2840 deletions
@@ -14,8 +14,8 @@
// limitations under the License.
//
import SwiftUI
import CommonKit
import SwiftUI
struct UserSessionsOverviewCoordinatorParameters {
let session: MXSession
@@ -69,7 +69,7 @@ final class UserSessionsOverviewCoordinator: Coordinator, Presentable {
}
func toPresentable() -> UIViewController {
return hostingViewController
hostingViewController
}
// MARK: - Private
@@ -88,15 +88,15 @@ final class UserSessionsOverviewCoordinator: Coordinator, Presentable {
}
private func showAllUnverifiedSessions() {
// TODO
// TODO:
}
private func showAllInactiveSessions() {
// TODO
// TODO:
}
private func startVerifyCurrentSession() {
// TODO
// TODO:
}
private func showCurrentSessionOverview(sessionInfo: UserSessionInfo) {
@@ -108,6 +108,6 @@ final class UserSessionsOverviewCoordinator: Coordinator, Presentable {
}
private func showAllOtherSessions() {
// TODO
// TODO:
}
}
@@ -1,4 +1,4 @@
//
//
// Copyright 2022 New Vector Ltd
//
// Licensed under the Apache License, Version 2.0 (the "License");
@@ -33,12 +33,12 @@ enum MockUserSessionsOverviewScreenState: MockScreenState, CaseIterable {
/// A list of screen state definitions
static var allCases: [MockUserSessionsOverviewScreenState] {
// Each of the presence statuses
return [.verifiedSession]
[.verifiedSession]
}
/// Generate the view struct for the screen state.
var screenView: ([Any], AnyView) {
let service: MockUserSessionsOverviewService = MockUserSessionsOverviewService()
var screenView: ([Any], AnyView) {
let service = MockUserSessionsOverviewService()
switch self {
case .verifiedSession:
break
@@ -1,4 +1,4 @@
//
//
// Copyright 2022 New Vector Ltd
//
// Licensed under the Apache License, Version 2.0 (the "License");
@@ -25,10 +25,10 @@ class UserSessionsOverviewService: UserSessionsOverviewServiceProtocol {
init(mxSession: MXSession) {
self.mxSession = mxSession
overviewData = UserSessionsOverviewData(currentSession: nil,
unverifiedSessions: [],
inactiveSessions: [],
otherSessions: [])
overviewData = UserSessionsOverviewData(currentSession: nil,
unverifiedSessions: [],
inactiveSessions: [],
otherSessions: [])
setupInitialOverviewData()
}
@@ -1,4 +1,4 @@
//
//
// Copyright 2022 New Vector Ltd
//
// Licensed under the Apache License, Version 2.0 (the "License");
@@ -35,14 +35,14 @@ class MockUserSessionsOverviewService: UserSessionsOverviewServiceProtocol {
let inactiveSessionsInfo: [UserSessionInfo] = []
let otherSessionsInfo: [UserSessionInfo] = [
UserSessionInfo(sessionId: "1", sessionName: "macOS", deviceType: .desktop, isVerified: true, lastSeenIP: "1.0.0.1", lastSeenTimestamp: (Date().timeIntervalSince1970 - 130000)),
UserSessionInfo(sessionId: "2", sessionName: "Firefox on Windows", deviceType: .web, isVerified: true, lastSeenIP: "2.0.0.2", lastSeenTimestamp: (Date().timeIntervalSince1970 - 100)),
UserSessionInfo(sessionId: "3", sessionName: "Android", deviceType: .mobile, isVerified: false, lastSeenIP: "3.0.0.3", lastSeenTimestamp: (Date().timeIntervalSince1970 - 10))
UserSessionInfo(sessionId: "1", sessionName: "macOS", deviceType: .desktop, isVerified: true, lastSeenIP: "1.0.0.1", lastSeenTimestamp: Date().timeIntervalSince1970 - 130_000),
UserSessionInfo(sessionId: "2", sessionName: "Firefox on Windows", deviceType: .web, isVerified: true, lastSeenIP: "2.0.0.2", lastSeenTimestamp: Date().timeIntervalSince1970 - 100),
UserSessionInfo(sessionId: "3", sessionName: "Android", deviceType: .mobile, isVerified: false, lastSeenIP: "3.0.0.3", lastSeenTimestamp: Date().timeIntervalSince1970 - 10)
]
overviewData = UserSessionsOverviewData(currentSession: currentSessionInfo,
unverifiedSessions: unverifiedSessionsInfo,
inactiveSessions: inactiveSessionsInfo,
otherSessions: otherSessionsInfo)
unverifiedSessions: unverifiedSessionsInfo,
inactiveSessions: inactiveSessionsInfo,
otherSessions: otherSessionsInfo)
}
}
@@ -1,4 +1,4 @@
//
//
// Copyright 2022 New Vector Ltd
//
// Licensed under the Apache License, Version 2.0 (the "License");
@@ -14,8 +14,8 @@
// limitations under the License.
//
import XCTest
import RiotSwiftUI
import XCTest
class UserSessionsOverviewUITests: MockScreenTestCase {
// TODO:
@@ -1,4 +1,4 @@
//
//
// Copyright 2022 New Vector Ltd
//
// Licensed under the Apache License, Version 2.0 (the "License");
@@ -14,8 +14,8 @@
// limitations under the License.
//
import XCTest
import Combine
import XCTest
@testable import RiotSwiftUI
@@ -1,4 +1,4 @@
//
//
// Copyright 2022 New Vector Ltd
//
// Licensed under the Apache License, Version 2.0 (the "License");
@@ -44,7 +44,7 @@ struct UserSessionsOverviewViewState: BindableState {
var otherSessionsViewData = [UserSessionListItemViewData]()
var showLoadingIndicator: Bool = false
var showLoadingIndicator = false
}
enum UserSessionsOverviewViewAction {
@@ -17,8 +17,8 @@
import SwiftUI
typealias UserSessionsOverviewViewModelType = StateStoreViewModel<UserSessionsOverviewViewState,
Never,
UserSessionsOverviewViewAction>
Never,
UserSessionsOverviewViewAction>
class UserSessionsOverviewViewModel: UserSessionsOverviewViewModelType, UserSessionsOverviewViewModelProtocol {
private let userSessionsOverviewService: UserSessionsOverviewServiceProtocol
@@ -88,7 +88,7 @@ class UserSessionsOverviewViewModel: UserSessionsOverviewViewModelType, UserSess
case .success(let overViewData):
self.updateViewState(with: overViewData)
case .failure(let error):
// TODO
// TODO:
break
}
}
@@ -1,4 +1,4 @@
//
//
// Copyright 2022 New Vector Ltd
//
// Licensed under the Apache License, Version 2.0 (the "License");
@@ -28,7 +28,7 @@ struct UserSessionListItem: View {
let viewData: UserSessionListItemViewData
var onBackgroundTap: ((String) -> (Void))? = nil
var onBackgroundTap: ((String) -> Void)?
var body: some View {
Button {
@@ -71,7 +71,7 @@ struct UserSessionListPreview: View {
ForEach(userSessionsOverviewService.overviewData.otherSessions) { userSessionInfo in
let viewData = UserSessionListItemViewData(userSessionInfo: userSessionInfo)
UserSessionListItem(viewData: viewData, onBackgroundTap: { sessionId in
UserSessionListItem(viewData: viewData, onBackgroundTap: { _ in
})
}
@@ -22,7 +22,7 @@ struct UserSessionListItemViewData: Identifiable {
private static let lastActivityDateFormatter = UserSessionLastActivityFormatter()
var id: String {
return sessionId
sessionId
}
let sessionId: String
@@ -38,7 +38,6 @@ struct UserSessionListItemViewData: Identifiable {
deviceType: DeviceType,
isVerified: Bool,
lastActivityDate: TimeInterval?) {
self.sessionId = sessionId
sessionName = Self.userSessionNameFormatter.sessionName(deviceType: deviceType, sessionDisplayName: sessionDisplayName)
sessionDetails = Self.buildSessionDetails(isVerified: isVerified, lastActivityDate: lastActivityDate)
@@ -1,4 +1,4 @@
//
//
// Copyright 2022 New Vector Ltd
//
// Licensed under the Apache License, Version 2.0 (the "License");
@@ -49,7 +49,6 @@ struct UserSessionsOverview: View {
ScrollView {
// Security recommendations section
if viewModel.viewState.unverifiedSessionsViewData.isEmpty == false || viewModel.viewState.inactiveSessionsViewData.isEmpty == false {
// TODO:
}
@@ -65,7 +64,7 @@ struct UserSessionsOverview: View {
.frame(maxHeight: .infinity)
.navigationTitle(VectorL10n.userSessionsOverviewTitle)
.activityIndicator(show: viewModel.viewState.showLoadingIndicator)
.onAppear() {
.onAppear {
viewModel.send(viewAction: .viewAppeared)
}
}