Run SwiftFormat.

This commit is contained in:
Doug
2026-05-27 14:38:50 +01:00
committed by Doug
parent 5138e05e47
commit fa67713726
573 changed files with 2426 additions and 2426 deletions
@@ -28,12 +28,12 @@ enum LocationSharingInteractionMode: Hashable {
case picker(shouldShowLiveLocationOption: Bool)
case viewStatic(StaticLocationData)
case viewLive(sender: TimelineItemSender?, initialLiveLocationShare: LiveLocationShare?)
var isPicker: Bool {
if case .picker = self { return true }
return false
}
var shouldShowLiveLocationOption: Bool {
if case .picker(let shouldShowLiveLocationOption) = self {
return shouldShowLiveLocationOption
@@ -73,7 +73,7 @@ struct LocationSharingScreenViewState: BindableState {
case .viewStatic, .viewLive: .show
}
}
let interactionMode: LocationSharingInteractionMode
let mapURLBuilder: MapTilerURLBuilderProtocol
let ownUserID: String
@@ -112,7 +112,7 @@ struct LocationSharingScreenViewState: BindableState {
}
var bindings = LocationSharingScreenBindings(showsUserLocationMode: .hide)
/// Indicates whether the user is sharing his current location
var isSharingUserLocation: Bool {
bindings.isLocationAuthorized == true && bindings.showsUserLocationMode == .showAndFollow
@@ -148,7 +148,7 @@ struct LocationSharingScreenViewState: BindableState {
!bindings.hasLoadedUserLocation && bindings.isLocationAuthorized == true
}
}
var zoomLevel: Double {
15.0
}
@@ -194,7 +194,7 @@ struct LocationSharingScreenBindings {
/// Information describing the currently displayed alert.
var alertInfo: AlertInfo<LocationSharingViewAlert>?
var sharedAnnotation: LocationAnnotation?
}
@@ -46,7 +46,7 @@ class LocationSharingScreenViewModel: LocationSharingScreenViewModelType, Locati
self.analytics = analytics
self.userIndicatorController = userIndicatorController
self.notificationCenter = notificationCenter
super.init(initialViewState: .init(interactionMode: interactionMode,
mapURLBuilder: mapURLBuilder,
ownUserID: roomProxy.ownUserID),
@@ -338,7 +338,7 @@ extension LocationSharingScreenViewModel {
case viewLive
case viewLiveEmpty
}
static func mock(type: MockType,
senderID: String = "@dan:matrix.org") -> LocationSharingScreenViewModel {
let interactionMode: LocationSharingInteractionMode = switch type {
@@ -388,7 +388,7 @@ extension LocationSharingScreenViewModel {
let liveLocationServiceMock = RoomLiveLocationServiceMock(.init(shares: liveLocationShares))
let roomProxy = JoinedRoomProxyMock(.init(members: .allMembers, ownUserID: RoomMemberProxyMock.mockMe.userID))
roomProxy.makeLiveLocationServiceReturnValue = liveLocationServiceMock
return LocationSharingScreenViewModel(interactionMode: interactionMode,
mapURLBuilder: AppSettings.volatile().mapTilerConfiguration,
roomProxy: roomProxy,
@@ -11,14 +11,14 @@ import SwiftUI
struct LocationPickerSheet: View {
@Bindable var context: LocationSharingScreenViewModel.Context
@State private var height: CGFloat = .zero
/// Fixes an iOS 26 sheet issue
/// if the content doesn't meet a certain size
/// additional insets are added.
private var additionalHeight: CGFloat {
context.viewState.interactionMode.shouldShowLiveLocationOption ? 0 : 28
}
var body: some View {
VStack(spacing: 0) {
Text(L10n.screenSharingLocationOptionSheetTitle)
@@ -44,7 +44,7 @@ struct LocationShareSheet_Previews: PreviewProvider {
static let annotation = LocationAnnotation(id: profile.userID,
coordinate: .init(latitude: 51.509865, longitude: -0.118092),
kind: .liveUser(profile))
static var previews: some View {
LocationShareSheet(annotation: annotation)
.previewDisplayName("Live location share sheet")
@@ -126,26 +126,26 @@ struct LocationSharingScreen: View {
struct LocationSharingScreen_Previews: PreviewProvider, TestablePreview {
static let viewModel = LocationSharingScreenViewModel.mock(type: .staticSenderLocation)
static let withoutLiveSharingViewModel = LocationSharingScreenViewModel.mock(type: .pickerWithoutLiveLocationOption)
static let pinViewModel = LocationSharingScreenViewModel.mock(type: .staticPinLocation)
static let pickerViewModel = LocationSharingScreenViewModel.mock(type: .picker)
static let liveLocationViewModel = LocationSharingScreenViewModel.mock(type: .viewLive)
static var previews: some View {
ElementNavigationStack {
LocationSharingScreen(context: pickerViewModel.context)
}
.previewDisplayName("Picker")
ElementNavigationStack {
LocationSharingScreen(context: withoutLiveSharingViewModel.context)
}
.previewDisplayName("Picker without live location sharing")
ElementNavigationStack {
LocationSharingScreen(context: viewModel.context)
}