mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-24 02:22:44 +02:00
Configured and applied SwiftFormat
This commit is contained in:
committed by
Stefan Ceriu
parent
ff2e6ddfa7
commit
43c28d23b7
+7
-7
@@ -15,9 +15,9 @@
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import UIKit
|
||||
import SwiftUI
|
||||
import MatrixSDK
|
||||
import SwiftUI
|
||||
import UIKit
|
||||
|
||||
struct StaticLocationViewingCoordinatorParameters {
|
||||
let session: MXSession
|
||||
@@ -28,7 +28,6 @@ struct StaticLocationViewingCoordinatorParameters {
|
||||
}
|
||||
|
||||
final class StaticLocationViewingCoordinator: Coordinator, Presentable {
|
||||
|
||||
// MARK: - Properties
|
||||
|
||||
// MARK: Private
|
||||
@@ -54,7 +53,8 @@ final class StaticLocationViewingCoordinator: Coordinator, Presentable {
|
||||
mapStyleURL: parameters.session.vc_homeserverConfiguration().tileServer.mapStyleURL,
|
||||
avatarData: parameters.avatarData,
|
||||
location: parameters.location,
|
||||
coordinateType: parameters.coordinateType)
|
||||
coordinateType: parameters.coordinateType
|
||||
)
|
||||
let view = StaticLocationView(viewModel: viewModel.context)
|
||||
.addDependency(AvatarService.instantiate(mediaManager: parameters.mediaManager))
|
||||
staticLocationViewingViewModel = viewModel
|
||||
@@ -62,6 +62,7 @@ final class StaticLocationViewingCoordinator: Coordinator, Presentable {
|
||||
}
|
||||
|
||||
// MARK: - Public
|
||||
|
||||
func start() {
|
||||
MXLog.debug("[StaticLocationSharingViewerCoordinator] did start.")
|
||||
staticLocationViewingViewModel.completion = { [weak self] result in
|
||||
@@ -77,13 +78,12 @@ final class StaticLocationViewingCoordinator: Coordinator, Presentable {
|
||||
}
|
||||
|
||||
func toPresentable() -> UIViewController {
|
||||
return self.staticLocationViewingHostingController
|
||||
staticLocationViewingHostingController
|
||||
}
|
||||
|
||||
func presentLocationActivityController(with coordinate: CLLocationCoordinate2D) {
|
||||
|
||||
let shareActivityController = shareLocationActivityControllerBuilder.build(with: coordinate)
|
||||
|
||||
self.staticLocationViewingHostingController.present(shareActivityController, animated: true)
|
||||
staticLocationViewingHostingController.present(shareActivityController, animated: true)
|
||||
}
|
||||
}
|
||||
|
||||
+5
-6
@@ -1,4 +1,4 @@
|
||||
//
|
||||
//
|
||||
// Copyright 2021 New Vector Ltd
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@@ -14,9 +14,9 @@
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
import CoreLocation
|
||||
import Foundation
|
||||
import SwiftUI
|
||||
import CoreLocation
|
||||
|
||||
/// Using an enum for the screen allows you define the different state cases with
|
||||
/// the relevant associated data for each case.
|
||||
@@ -34,11 +34,11 @@ enum MockStaticLocationViewingScreenState: MockScreenState, CaseIterable {
|
||||
|
||||
/// A list of screen state definitions
|
||||
static var allCases: [MockStaticLocationViewingScreenState] {
|
||||
return [.showUserLocation, .showPinLocation]
|
||||
[.showUserLocation, .showPinLocation]
|
||||
}
|
||||
|
||||
/// Generate the view struct for the screen state.
|
||||
var screenView: ([Any], AnyView) {
|
||||
var screenView: ([Any], AnyView) {
|
||||
let location = CLLocationCoordinate2D(latitude: 51.4932641, longitude: -0.257096)
|
||||
let coordinateType: LocationSharingCoordinateType = self == .showUserLocation ? .user : .pin
|
||||
|
||||
@@ -50,7 +50,6 @@ enum MockStaticLocationViewingScreenState: MockScreenState, CaseIterable {
|
||||
|
||||
return ([viewModel],
|
||||
AnyView(StaticLocationView(viewModel: viewModel.context)
|
||||
.addDependency(MockAvatarService.example))
|
||||
)
|
||||
.addDependency(MockAvatarService.example)))
|
||||
}
|
||||
}
|
||||
|
||||
+3
-4
@@ -1,4 +1,4 @@
|
||||
//
|
||||
//
|
||||
// Copyright 2021 New Vector Ltd
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@@ -14,9 +14,9 @@
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import Combine
|
||||
import CoreLocation
|
||||
import Foundation
|
||||
|
||||
// MARK: View model
|
||||
|
||||
@@ -33,7 +33,6 @@ enum StaticLocationViewingViewModelResult {
|
||||
// MARK: View
|
||||
|
||||
struct StaticLocationViewingViewState: BindableState {
|
||||
|
||||
/// Map style URL
|
||||
let mapStyleURL: URL
|
||||
|
||||
@@ -43,7 +42,7 @@ struct StaticLocationViewingViewState: BindableState {
|
||||
/// Shared annotation to display existing location
|
||||
let sharedAnnotation: LocationAnnotation
|
||||
|
||||
var showLoadingIndicator: Bool = false
|
||||
var showLoadingIndicator = false
|
||||
|
||||
var shareButtonEnabled: Bool {
|
||||
!showLoadingIndicator
|
||||
|
||||
+4
-5
@@ -14,14 +14,13 @@
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
import CoreLocation
|
||||
import SwiftUI
|
||||
|
||||
typealias StaticLocationViewingViewModelType = StateStoreViewModel<StaticLocationViewingViewState,
|
||||
Never,
|
||||
StaticLocationViewingViewAction>
|
||||
Never,
|
||||
StaticLocationViewingViewAction>
|
||||
class StaticLocationViewingViewModel: StaticLocationViewingViewModelType, StaticLocationViewingViewModelProtocol {
|
||||
|
||||
// MARK: - Properties
|
||||
|
||||
// MARK: Private
|
||||
@@ -79,7 +78,7 @@ class StaticLocationViewingViewModel: StaticLocationViewingViewModelType, Static
|
||||
|
||||
switch error {
|
||||
case .invalidLocationAuthorization:
|
||||
if let applicationSettingsURL = URL(string:UIApplication.openSettingsURLString) {
|
||||
if let applicationSettingsURL = URL(string: UIApplication.openSettingsURLString) {
|
||||
UIApplication.shared.open(applicationSettingsURL)
|
||||
} else {
|
||||
self?.completion?(.close)
|
||||
|
||||
+1
-2
@@ -1,4 +1,4 @@
|
||||
//
|
||||
//
|
||||
// Copyright 2021 New Vector Ltd
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@@ -17,7 +17,6 @@
|
||||
import Foundation
|
||||
|
||||
protocol StaticLocationViewingViewModelProtocol {
|
||||
|
||||
var completion: ((StaticLocationViewingViewModelResult) -> Void)? { get set }
|
||||
var context: StaticLocationViewingViewModelType.Context { get }
|
||||
}
|
||||
|
||||
+1
-1
@@ -14,8 +14,8 @@
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
import XCTest
|
||||
import RiotSwiftUI
|
||||
import XCTest
|
||||
|
||||
class StaticLocationViewingUITests: MockScreenTestCase {
|
||||
// This test has issues running consistently on CI. Removed for now until the issue has been fixed.
|
||||
|
||||
+4
-5
@@ -1,4 +1,4 @@
|
||||
//
|
||||
//
|
||||
// Copyright 2021 New Vector Ltd
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@@ -14,14 +14,13 @@
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
import XCTest
|
||||
import Combine
|
||||
import CoreLocation
|
||||
import XCTest
|
||||
|
||||
@testable import RiotSwiftUI
|
||||
|
||||
class StaticLocationViewingViewModelTests: XCTestCase {
|
||||
|
||||
var cancellables = Set<AnyCancellable>()
|
||||
|
||||
func testInitialState() {
|
||||
@@ -39,7 +38,7 @@ class StaticLocationViewingViewModelTests: XCTestCase {
|
||||
func testCancellation() {
|
||||
let viewModel = buildViewModel()
|
||||
|
||||
let expectation = self.expectation(description: "Cancellation completion should be invoked")
|
||||
let expectation = expectation(description: "Cancellation completion should be invoked")
|
||||
|
||||
viewModel.completion = { result in
|
||||
switch result {
|
||||
@@ -58,7 +57,7 @@ class StaticLocationViewingViewModelTests: XCTestCase {
|
||||
func testShareExistingLocation() {
|
||||
let viewModel = buildViewModel()
|
||||
|
||||
let expectation = self.expectation(description: "Share completion should be invoked")
|
||||
let expectation = expectation(description: "Share completion should be invoked")
|
||||
|
||||
viewModel.completion = { result in
|
||||
switch result {
|
||||
|
||||
+1
-2
@@ -1,4 +1,4 @@
|
||||
//
|
||||
//
|
||||
// Copyright 2021 New Vector Ltd
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@@ -17,7 +17,6 @@
|
||||
import SwiftUI
|
||||
|
||||
struct StaticLocationView: View {
|
||||
|
||||
// MARK: - Properties
|
||||
|
||||
// MARK: Private
|
||||
|
||||
Reference in New Issue
Block a user