mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-04 01:20:12 +00:00
removed LLS feature flag
This commit is contained in:
@@ -81,7 +81,6 @@ final class AppSettings {
|
|||||||
case linkPreviewsEnabled
|
case linkPreviewsEnabled
|
||||||
case focusEventOnNotificationTap
|
case focusEventOnNotificationTap
|
||||||
case linkNewDeviceEnabled
|
case linkNewDeviceEnabled
|
||||||
case liveLocationSharingEnabled
|
|
||||||
case automaticBackPaginationEnabled
|
case automaticBackPaginationEnabled
|
||||||
|
|
||||||
// Doug's tweaks 🔧
|
// Doug's tweaks 🔧
|
||||||
@@ -449,9 +448,6 @@ final class AppSettings {
|
|||||||
@UserPreference(key: UserDefaultsKeys.linkNewDeviceEnabled, defaultValue: false, storageType: .userDefaults(store))
|
@UserPreference(key: UserDefaultsKeys.linkNewDeviceEnabled, defaultValue: false, storageType: .userDefaults(store))
|
||||||
var linkNewDeviceEnabled
|
var linkNewDeviceEnabled
|
||||||
|
|
||||||
@UserPreference(key: UserDefaultsKeys.liveLocationSharingEnabled, defaultValue: false, storageType: .userDefaults(store))
|
|
||||||
var liveLocationSharingEnabled
|
|
||||||
|
|
||||||
@UserPreference(key: UserDefaultsKeys.automaticBackPaginationEnabled, defaultValue: false, storageType: .userDefaults(store))
|
@UserPreference(key: UserDefaultsKeys.automaticBackPaginationEnabled, defaultValue: false, storageType: .userDefaults(store))
|
||||||
var automaticBackPaginationEnabled
|
var automaticBackPaginationEnabled
|
||||||
|
|
||||||
|
|||||||
@@ -108,7 +108,6 @@ class PinnedEventsTimelineFlowCoordinator: FlowCoordinatorProtocol {
|
|||||||
|
|
||||||
let params = LocationSharingScreenCoordinatorParameters(interactionMode: interactionMode,
|
let params = LocationSharingScreenCoordinatorParameters(interactionMode: interactionMode,
|
||||||
mapURLBuilder: flowParameters.appSettings.mapTilerConfiguration,
|
mapURLBuilder: flowParameters.appSettings.mapTilerConfiguration,
|
||||||
liveLocationSharingEnabled: flowParameters.appSettings.liveLocationSharingEnabled,
|
|
||||||
roomProxy: roomProxy,
|
roomProxy: roomProxy,
|
||||||
timelineController: timelineController,
|
timelineController: timelineController,
|
||||||
liveLocationManager: flowParameters.userSession.liveLocationManager,
|
liveLocationManager: flowParameters.userSession.liveLocationManager,
|
||||||
|
|||||||
@@ -1168,7 +1168,6 @@ class RoomFlowCoordinator: FlowCoordinatorProtocol {
|
|||||||
|
|
||||||
let params = LocationSharingScreenCoordinatorParameters(interactionMode: interactionMode,
|
let params = LocationSharingScreenCoordinatorParameters(interactionMode: interactionMode,
|
||||||
mapURLBuilder: flowParameters.appSettings.mapTilerConfiguration,
|
mapURLBuilder: flowParameters.appSettings.mapTilerConfiguration,
|
||||||
liveLocationSharingEnabled: flowParameters.appSettings.liveLocationSharingEnabled,
|
|
||||||
roomProxy: roomProxy,
|
roomProxy: roomProxy,
|
||||||
timelineController: timelineController,
|
timelineController: timelineController,
|
||||||
liveLocationManager: flowParameters.userSession.liveLocationManager,
|
liveLocationManager: flowParameters.userSession.liveLocationManager,
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ import SwiftUI
|
|||||||
struct LocationSharingScreenCoordinatorParameters {
|
struct LocationSharingScreenCoordinatorParameters {
|
||||||
let interactionMode: LocationSharingInteractionMode
|
let interactionMode: LocationSharingInteractionMode
|
||||||
let mapURLBuilder: MapTilerURLBuilderProtocol
|
let mapURLBuilder: MapTilerURLBuilderProtocol
|
||||||
let liveLocationSharingEnabled: Bool
|
|
||||||
let roomProxy: JoinedRoomProxyProtocol
|
let roomProxy: JoinedRoomProxyProtocol
|
||||||
let timelineController: TimelineControllerProtocol
|
let timelineController: TimelineControllerProtocol
|
||||||
let liveLocationManager: LiveLocationManagerProtocol
|
let liveLocationManager: LiveLocationManagerProtocol
|
||||||
@@ -42,7 +41,6 @@ final class LocationSharingScreenCoordinator: CoordinatorProtocol {
|
|||||||
|
|
||||||
viewModel = LocationSharingScreenViewModel(interactionMode: parameters.interactionMode,
|
viewModel = LocationSharingScreenViewModel(interactionMode: parameters.interactionMode,
|
||||||
mapURLBuilder: parameters.mapURLBuilder,
|
mapURLBuilder: parameters.mapURLBuilder,
|
||||||
liveLocationSharingEnabled: parameters.liveLocationSharingEnabled,
|
|
||||||
roomProxy: parameters.roomProxy,
|
roomProxy: parameters.roomProxy,
|
||||||
timelineController: parameters.timelineController,
|
timelineController: parameters.timelineController,
|
||||||
liveLocationManager: parameters.liveLocationManager,
|
liveLocationManager: parameters.liveLocationManager,
|
||||||
|
|||||||
@@ -32,11 +32,9 @@ enum LocationSharingInteractionMode: Hashable {
|
|||||||
struct LocationSharingScreenViewState: BindableState {
|
struct LocationSharingScreenViewState: BindableState {
|
||||||
init(interactionMode: LocationSharingInteractionMode,
|
init(interactionMode: LocationSharingInteractionMode,
|
||||||
mapURLBuilder: MapTilerURLBuilderProtocol,
|
mapURLBuilder: MapTilerURLBuilderProtocol,
|
||||||
showLiveLocationSharingButton: Bool,
|
|
||||||
ownUserID: String) {
|
ownUserID: String) {
|
||||||
self.interactionMode = interactionMode
|
self.interactionMode = interactionMode
|
||||||
self.mapURLBuilder = mapURLBuilder
|
self.mapURLBuilder = mapURLBuilder
|
||||||
self.showLiveLocationSharingButton = showLiveLocationSharingButton
|
|
||||||
self.ownUserID = ownUserID
|
self.ownUserID = ownUserID
|
||||||
|
|
||||||
let initialProfile: UserProfileProxy = switch interactionMode {
|
let initialProfile: UserProfileProxy = switch interactionMode {
|
||||||
@@ -65,7 +63,6 @@ struct LocationSharingScreenViewState: BindableState {
|
|||||||
|
|
||||||
let interactionMode: LocationSharingInteractionMode
|
let interactionMode: LocationSharingInteractionMode
|
||||||
let mapURLBuilder: MapTilerURLBuilderProtocol
|
let mapURLBuilder: MapTilerURLBuilderProtocol
|
||||||
let showLiveLocationSharingButton: Bool
|
|
||||||
let ownUserID: String
|
let ownUserID: String
|
||||||
var userProfiles: [String: UserProfileProxy]
|
var userProfiles: [String: UserProfileProxy]
|
||||||
var liveLocationShares: [LiveLocationShare] = []
|
var liveLocationShares: [LiveLocationShare] = []
|
||||||
|
|||||||
@@ -33,7 +33,6 @@ class LocationSharingScreenViewModel: LocationSharingScreenViewModelType, Locati
|
|||||||
|
|
||||||
init(interactionMode: LocationSharingInteractionMode,
|
init(interactionMode: LocationSharingInteractionMode,
|
||||||
mapURLBuilder: MapTilerURLBuilderProtocol,
|
mapURLBuilder: MapTilerURLBuilderProtocol,
|
||||||
liveLocationSharingEnabled: Bool,
|
|
||||||
roomProxy: JoinedRoomProxyProtocol,
|
roomProxy: JoinedRoomProxyProtocol,
|
||||||
timelineController: TimelineControllerProtocol,
|
timelineController: TimelineControllerProtocol,
|
||||||
liveLocationManager: LiveLocationManagerProtocol,
|
liveLocationManager: LiveLocationManagerProtocol,
|
||||||
@@ -50,7 +49,6 @@ class LocationSharingScreenViewModel: LocationSharingScreenViewModelType, Locati
|
|||||||
|
|
||||||
super.init(initialViewState: .init(interactionMode: interactionMode,
|
super.init(initialViewState: .init(interactionMode: interactionMode,
|
||||||
mapURLBuilder: mapURLBuilder,
|
mapURLBuilder: mapURLBuilder,
|
||||||
showLiveLocationSharingButton: liveLocationSharingEnabled,
|
|
||||||
ownUserID: roomProxy.ownUserID),
|
ownUserID: roomProxy.ownUserID),
|
||||||
mediaProvider: mediaProvider)
|
mediaProvider: mediaProvider)
|
||||||
|
|
||||||
@@ -328,8 +326,7 @@ extension LocationSharingScreenViewModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static func mock(type: MockType,
|
static func mock(type: MockType,
|
||||||
senderID: String = "@dan:matrix.org",
|
senderID: String = "@dan:matrix.org") -> LocationSharingScreenViewModel {
|
||||||
liveLocationSharingEnabled: Bool = true) -> LocationSharingScreenViewModel {
|
|
||||||
let interactionMode: LocationSharingInteractionMode = switch type {
|
let interactionMode: LocationSharingInteractionMode = switch type {
|
||||||
case .picker:
|
case .picker:
|
||||||
.picker
|
.picker
|
||||||
@@ -378,7 +375,6 @@ extension LocationSharingScreenViewModel {
|
|||||||
|
|
||||||
return LocationSharingScreenViewModel(interactionMode: interactionMode,
|
return LocationSharingScreenViewModel(interactionMode: interactionMode,
|
||||||
mapURLBuilder: ServiceLocator.shared.settings.mapTilerConfiguration,
|
mapURLBuilder: ServiceLocator.shared.settings.mapTilerConfiguration,
|
||||||
liveLocationSharingEnabled: liveLocationSharingEnabled,
|
|
||||||
roomProxy: roomProxy,
|
roomProxy: roomProxy,
|
||||||
timelineController: MockTimelineController(),
|
timelineController: MockTimelineController(),
|
||||||
liveLocationManager: LiveLocationManagerMock(),
|
liveLocationManager: LiveLocationManagerMock(),
|
||||||
|
|||||||
@@ -12,13 +12,6 @@ struct LocationPickerSheet: View {
|
|||||||
@Bindable var context: LocationSharingScreenViewModel.Context
|
@Bindable var context: LocationSharingScreenViewModel.Context
|
||||||
@State private var height: CGFloat = .zero
|
@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.showLiveLocationSharingButton ? 0 : 28
|
|
||||||
}
|
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
VStack(spacing: 0) {
|
VStack(spacing: 0) {
|
||||||
Text(L10n.screenSharingLocationOptionSheetTitle)
|
Text(L10n.screenSharingLocationOptionSheetTitle)
|
||||||
@@ -26,6 +19,7 @@ struct LocationPickerSheet: View {
|
|||||||
.font(.compound.bodyLGSemibold)
|
.font(.compound.bodyLGSemibold)
|
||||||
.padding(.top, 29)
|
.padding(.top, 29)
|
||||||
.padding(.bottom, 25)
|
.padding(.bottom, 25)
|
||||||
|
|
||||||
Button {
|
Button {
|
||||||
context.send(viewAction: .selectLocation)
|
context.send(viewAction: .selectLocation)
|
||||||
} label: {
|
} label: {
|
||||||
@@ -39,14 +33,13 @@ struct LocationPickerSheet: View {
|
|||||||
iconColor: .compound.iconSecondary)
|
iconColor: .compound.iconSecondary)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if context.viewState.showLiveLocationSharingButton {
|
|
||||||
Button {
|
Button {
|
||||||
context.send(viewAction: .startLiveLocation)
|
context.send(viewAction: .startLiveLocation)
|
||||||
} label: {
|
} label: {
|
||||||
LocationPickerLabel(text: L10n.actionShareLiveLocation,
|
LocationPickerLabel(text: L10n.actionShareLiveLocation,
|
||||||
icon: \.locationPinSolid,
|
icon: \.locationPinSolid,
|
||||||
iconColor: .compound.iconAccentPrimary)
|
iconColor: .compound.iconAccentPrimary)
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.readHeight($height)
|
.readHeight($height)
|
||||||
@@ -54,7 +47,7 @@ struct LocationPickerSheet: View {
|
|||||||
.presentationBackground(.compound.bgCanvasDefault)
|
.presentationBackground(.compound.bgCanvasDefault)
|
||||||
.presentationBackgroundInteraction(.enabled)
|
.presentationBackgroundInteraction(.enabled)
|
||||||
.presentationDragIndicator(.hidden)
|
.presentationDragIndicator(.hidden)
|
||||||
.presentationDetents([.height(height + additionalHeight)])
|
.presentationDetents([.height(height)])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -126,9 +126,7 @@ struct LocationSharingScreen: View {
|
|||||||
|
|
||||||
struct LocationSharingScreen_Previews: PreviewProvider, TestablePreview {
|
struct LocationSharingScreen_Previews: PreviewProvider, TestablePreview {
|
||||||
static let viewModel = LocationSharingScreenViewModel.mock(type: .staticSenderLocation)
|
static let viewModel = LocationSharingScreenViewModel.mock(type: .staticSenderLocation)
|
||||||
|
|
||||||
static let withoutLiveSharingViewModel = LocationSharingScreenViewModel.mock(type: .picker, liveLocationSharingEnabled: false)
|
|
||||||
|
|
||||||
static let pinViewModel = LocationSharingScreenViewModel.mock(type: .staticPinLocation)
|
static let pinViewModel = LocationSharingScreenViewModel.mock(type: .staticPinLocation)
|
||||||
|
|
||||||
static let pickerViewModel = LocationSharingScreenViewModel.mock(type: .picker)
|
static let pickerViewModel = LocationSharingScreenViewModel.mock(type: .picker)
|
||||||
@@ -141,11 +139,6 @@ struct LocationSharingScreen_Previews: PreviewProvider, TestablePreview {
|
|||||||
}
|
}
|
||||||
.previewDisplayName("Picker")
|
.previewDisplayName("Picker")
|
||||||
|
|
||||||
ElementNavigationStack {
|
|
||||||
LocationSharingScreen(context: withoutLiveSharingViewModel.context)
|
|
||||||
}
|
|
||||||
.previewDisplayName("Picker without live location sharing")
|
|
||||||
|
|
||||||
ElementNavigationStack {
|
ElementNavigationStack {
|
||||||
LocationSharingScreen(context: viewModel.context)
|
LocationSharingScreen(context: viewModel.context)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -171,12 +171,11 @@ class RoomScreenViewModel: RoomScreenViewModelType, RoomScreenViewModelProtocol
|
|||||||
.weakAssign(to: \.state.isKnockingEnabled, on: self)
|
.weakAssign(to: \.state.isKnockingEnabled, on: self)
|
||||||
.store(in: &cancellables)
|
.store(in: &cancellables)
|
||||||
|
|
||||||
appSettings.$liveLocationSharingEnabled
|
appSettings.$liveLocationSharingTimeoutDatesByRoomID
|
||||||
.combineLatest(appSettings.$liveLocationSharingTimeoutDatesByRoomID)
|
|
||||||
.receive(on: DispatchQueue.main)
|
.receive(on: DispatchQueue.main)
|
||||||
.sink { [weak self] isEnabled, timeoutDatesByRoomID in
|
.sink { [weak self] timeoutDatesByRoomID in
|
||||||
guard let self else { return }
|
guard let self else { return }
|
||||||
state.isSharingLiveLocation = isEnabled && timeoutDatesByRoomID.keys.contains(roomProxy.id)
|
state.isSharingLiveLocation = timeoutDatesByRoomID.keys.contains(roomProxy.id)
|
||||||
}
|
}
|
||||||
.store(in: &cancellables)
|
.store(in: &cancellables)
|
||||||
|
|
||||||
|
|||||||
-1
@@ -61,7 +61,6 @@ protocol AdvancedSettingsProtocol: AnyObject {
|
|||||||
var sharePresence: Bool { get set }
|
var sharePresence: Bool { get set }
|
||||||
var optimizeMediaUploads: Bool { get set }
|
var optimizeMediaUploads: Bool { get set }
|
||||||
var liveLocationMinimumDistanceUpdate: Int { get set }
|
var liveLocationMinimumDistanceUpdate: Int { get set }
|
||||||
var liveLocationSharingEnabled: Bool { get set }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
extension AppSettings: AdvancedSettingsProtocol { }
|
extension AppSettings: AdvancedSettingsProtocol { }
|
||||||
|
|||||||
+2
-6
@@ -44,9 +44,7 @@ struct AdvancedSettingsScreen: View {
|
|||||||
|
|
||||||
moderationAndSafetySection
|
moderationAndSafetySection
|
||||||
timelineMediaSection
|
timelineMediaSection
|
||||||
if context.liveLocationSharingEnabled {
|
liveLocationSection
|
||||||
liveLocationSection
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
.compoundList()
|
.compoundList()
|
||||||
.navigationTitle(L10n.commonAdvancedSettings)
|
.navigationTitle(L10n.commonAdvancedSettings)
|
||||||
@@ -164,9 +162,7 @@ private extension AppAppearance {
|
|||||||
struct AdvancedSettingsScreen_Previews: PreviewProvider, TestablePreview {
|
struct AdvancedSettingsScreen_Previews: PreviewProvider, TestablePreview {
|
||||||
static let viewModel = {
|
static let viewModel = {
|
||||||
AppSettings.resetAllSettings()
|
AppSettings.resetAllSettings()
|
||||||
let appSettings = AppSettings()
|
return AdvancedSettingsScreenViewModel(advancedSettings: AppSettings(),
|
||||||
appSettings.liveLocationSharingEnabled = true
|
|
||||||
return AdvancedSettingsScreenViewModel(advancedSettings: appSettings,
|
|
||||||
analytics: ServiceLocator.shared.analytics,
|
analytics: ServiceLocator.shared.analytics,
|
||||||
clientProxy: ClientProxyMock(.init()),
|
clientProxy: ClientProxyMock(.init()),
|
||||||
userIndicatorController: UserIndicatorControllerMock())
|
userIndicatorController: UserIndicatorControllerMock())
|
||||||
|
|||||||
+1
-3
@@ -70,9 +70,7 @@ protocol DeveloperOptionsProtocol: AnyObject {
|
|||||||
var linkPreviewsEnabled: Bool { get set }
|
var linkPreviewsEnabled: Bool { get set }
|
||||||
|
|
||||||
var linkNewDeviceEnabled: Bool { get set }
|
var linkNewDeviceEnabled: Bool { get set }
|
||||||
|
|
||||||
var liveLocationSharingEnabled: Bool { get set }
|
|
||||||
|
|
||||||
var roomThreadListEnabled: Bool { get set }
|
var roomThreadListEnabled: Bool { get set }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
-5
@@ -91,11 +91,6 @@ struct DeveloperOptionsScreen: View {
|
|||||||
.foregroundStyle(.compound.textCriticalPrimary)
|
.foregroundStyle(.compound.textCriticalPrimary)
|
||||||
}
|
}
|
||||||
|
|
||||||
Toggle(isOn: $context.liveLocationSharingEnabled) {
|
|
||||||
Text("Live location sharing")
|
|
||||||
Text("Requires app reboot")
|
|
||||||
}
|
|
||||||
|
|
||||||
Toggle(isOn: $context.knockingEnabled) {
|
Toggle(isOn: $context.knockingEnabled) {
|
||||||
Text("Knocking")
|
Text("Knocking")
|
||||||
Text("Ask to join rooms")
|
Text("Ask to join rooms")
|
||||||
|
|||||||
@@ -196,16 +196,6 @@ class LiveLocationManager: NSObject, LiveLocationManagerProtocol, CLLocationMana
|
|||||||
}
|
}
|
||||||
.store(in: &cancellables)
|
.store(in: &cancellables)
|
||||||
|
|
||||||
appSettings.$liveLocationSharingEnabled
|
|
||||||
.filter { !$0 }
|
|
||||||
.sink { [weak self] _ in
|
|
||||||
guard let self else { return }
|
|
||||||
appSettings.liveLocationSharingTimeoutDatesByRoomID.removeAll()
|
|
||||||
activeRoomProxies.removeAll()
|
|
||||||
self.stopUpdatingLocation()
|
|
||||||
}
|
|
||||||
.store(in: &cancellables)
|
|
||||||
|
|
||||||
appSettings.$liveLocationMinimumDistanceUpdate
|
appSettings.$liveLocationMinimumDistanceUpdate
|
||||||
.removeDuplicates()
|
.removeDuplicates()
|
||||||
.debounce(for: .seconds(1), scheduler: DispatchQueue.main)
|
.debounce(for: .seconds(1), scheduler: DispatchQueue.main)
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ class JoinedRoomProxy: JoinedRoomProxyProtocol {
|
|||||||
|
|
||||||
let openRoomSpan = analyticsService.signpost.addSpan(.timelineLoad, toTransaction: .openRoom)
|
let openRoomSpan = analyticsService.signpost.addSpan(.timelineLoad, toTransaction: .openRoom)
|
||||||
timeline = try await TimelineProxy(timeline: room.timelineWithConfiguration(configuration: .init(focus: .live(hideThreadedEvents: appSettings.threadsEnabled),
|
timeline = try await TimelineProxy(timeline: room.timelineWithConfiguration(configuration: .init(focus: .live(hideThreadedEvents: appSettings.threadsEnabled),
|
||||||
filter: .eventFilter(filter: Self.excludedEventsFilter(appSettings: appSettings)),
|
filter: .eventFilter(filter: Self.excludedEventsFilter),
|
||||||
internalIdPrefix: nil,
|
internalIdPrefix: nil,
|
||||||
dateDividerMode: .daily,
|
dateDividerMode: .daily,
|
||||||
trackReadReceipts: .messageLikeEvents,
|
trackReadReceipts: .messageLikeEvents,
|
||||||
@@ -845,7 +845,7 @@ class JoinedRoomProxy: JoinedRoomProxyProtocol {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static func excludedEventsFilter(appSettings: AppSettings) -> TimelineEventFilter {
|
private static let excludedEventsFilter: TimelineEventFilter = {
|
||||||
var stateEventFilters: [StateEventType] = [.roomCanonicalAlias,
|
var stateEventFilters: [StateEventType] = [.roomCanonicalAlias,
|
||||||
.roomGuestAccess,
|
.roomGuestAccess,
|
||||||
.roomHistoryVisibility,
|
.roomHistoryVisibility,
|
||||||
@@ -859,11 +859,6 @@ class JoinedRoomProxy: JoinedRoomProxyProtocol {
|
|||||||
.policyRuleRoom,
|
.policyRuleRoom,
|
||||||
.policyRuleServer,
|
.policyRuleServer,
|
||||||
.policyRuleUser]
|
.policyRuleUser]
|
||||||
|
|
||||||
if !appSettings.liveLocationSharingEnabled {
|
|
||||||
stateEventFilters.append(.beaconInfo)
|
|
||||||
}
|
|
||||||
|
|
||||||
return .excludeEventTypes(eventTypes: stateEventFilters.map { FilterTimelineEventType.state(eventType: $0) })
|
return .excludeEventTypes(eventTypes: stateEventFilters.map { FilterTimelineEventType.state(eventType: $0) })
|
||||||
}
|
}()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import CoreLocation
|
|||||||
import Testing
|
import Testing
|
||||||
|
|
||||||
@MainActor
|
@MainActor
|
||||||
final class LocationSharingScreenViewModelTests {
|
struct LocationSharingScreenViewModelTests {
|
||||||
private var timelineProxy: TimelineProxyMock!
|
private var timelineProxy: TimelineProxyMock!
|
||||||
private var viewModel: LocationSharingScreenViewModel!
|
private var viewModel: LocationSharingScreenViewModel!
|
||||||
|
|
||||||
@@ -20,16 +20,8 @@ final class LocationSharingScreenViewModelTests {
|
|||||||
viewModel.context
|
viewModel.context
|
||||||
}
|
}
|
||||||
|
|
||||||
init() {
|
|
||||||
AppSettings.resetAllSettings()
|
|
||||||
}
|
|
||||||
|
|
||||||
deinit {
|
|
||||||
AppSettings.resetAllSettings()
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
func userDidPan() {
|
mutating func userDidPan() {
|
||||||
setupViewModel()
|
setupViewModel()
|
||||||
#expect(context.viewState.isSharingUserLocation)
|
#expect(context.viewState.isSharingUserLocation)
|
||||||
#expect(context.showsUserLocationMode == .showAndFollow)
|
#expect(context.showsUserLocationMode == .showAndFollow)
|
||||||
@@ -39,7 +31,7 @@ final class LocationSharingScreenViewModelTests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
func centerOnUser() {
|
mutating func centerOnUser() {
|
||||||
setupViewModel()
|
setupViewModel()
|
||||||
#expect(context.viewState.isSharingUserLocation)
|
#expect(context.viewState.isSharingUserLocation)
|
||||||
context.showsUserLocationMode = .show
|
context.showsUserLocationMode = .show
|
||||||
@@ -50,7 +42,7 @@ final class LocationSharingScreenViewModelTests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
func centerOnUserWithoutAuthorization() {
|
mutating func centerOnUserWithoutAuthorization() {
|
||||||
setupViewModel()
|
setupViewModel()
|
||||||
context.showsUserLocationMode = .hide
|
context.showsUserLocationMode = .hide
|
||||||
context.isLocationAuthorized = nil
|
context.isLocationAuthorized = nil
|
||||||
@@ -59,7 +51,7 @@ final class LocationSharingScreenViewModelTests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
func centerOnUserWithDeniedAuthorization() {
|
mutating func centerOnUserWithDeniedAuthorization() {
|
||||||
setupViewModel()
|
setupViewModel()
|
||||||
context.isLocationAuthorized = false
|
context.isLocationAuthorized = false
|
||||||
context.showsUserLocationMode = .hide
|
context.showsUserLocationMode = .hide
|
||||||
@@ -69,7 +61,7 @@ final class LocationSharingScreenViewModelTests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
func errorMapping() {
|
mutating func errorMapping() {
|
||||||
setupViewModel()
|
setupViewModel()
|
||||||
let mapError = AlertInfo(alertID: .mapError(.failedLoadingMap))
|
let mapError = AlertInfo(alertID: .mapError(.failedLoadingMap))
|
||||||
#expect(mapError.title == L10n.errorFailedLoadingMap(InfoPlistReader.main.bundleDisplayName))
|
#expect(mapError.title == L10n.errorFailedLoadingMap(InfoPlistReader.main.bundleDisplayName))
|
||||||
@@ -80,7 +72,7 @@ final class LocationSharingScreenViewModelTests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
func sendUserLocation() async throws {
|
mutating func sendUserLocation() async throws {
|
||||||
setupViewModel()
|
setupViewModel()
|
||||||
context.mapCenterLocation = .init(latitude: 0, longitude: 0)
|
context.mapCenterLocation = .init(latitude: 0, longitude: 0)
|
||||||
context.geolocationUncertainty = 10
|
context.geolocationUncertainty = 10
|
||||||
@@ -102,7 +94,7 @@ final class LocationSharingScreenViewModelTests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
func sendPickedLocation() async throws {
|
mutating func sendPickedLocation() async throws {
|
||||||
setupViewModel()
|
setupViewModel()
|
||||||
context.mapCenterLocation = .init(latitude: 0, longitude: 0)
|
context.mapCenterLocation = .init(latitude: 0, longitude: 0)
|
||||||
context.isLocationAuthorized = nil
|
context.isLocationAuthorized = nil
|
||||||
@@ -127,7 +119,7 @@ final class LocationSharingScreenViewModelTests {
|
|||||||
// MARK: - isLocationLoading Tests
|
// MARK: - isLocationLoading Tests
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
func isLocationLoadingInPickerModeWithAuthorizationNotDetermined() {
|
mutating func isLocationLoadingInPickerModeWithAuthorizationNotDetermined() {
|
||||||
setupViewModel()
|
setupViewModel()
|
||||||
context.isLocationAuthorized = nil
|
context.isLocationAuthorized = nil
|
||||||
context.hasLoadedUserLocation = false
|
context.hasLoadedUserLocation = false
|
||||||
@@ -135,7 +127,7 @@ final class LocationSharingScreenViewModelTests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
func isLocationLoadingInPickerModeWithAuthorizationGranted() {
|
mutating func isLocationLoadingInPickerModeWithAuthorizationGranted() {
|
||||||
setupViewModel()
|
setupViewModel()
|
||||||
context.isLocationAuthorized = true
|
context.isLocationAuthorized = true
|
||||||
context.hasLoadedUserLocation = false
|
context.hasLoadedUserLocation = false
|
||||||
@@ -143,7 +135,7 @@ final class LocationSharingScreenViewModelTests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
func isLocationNotLoadingInPickerModeWhenLocationLoaded() {
|
mutating func isLocationNotLoadingInPickerModeWhenLocationLoaded() {
|
||||||
setupViewModel()
|
setupViewModel()
|
||||||
context.isLocationAuthorized = true
|
context.isLocationAuthorized = true
|
||||||
context.hasLoadedUserLocation = true
|
context.hasLoadedUserLocation = true
|
||||||
@@ -151,7 +143,7 @@ final class LocationSharingScreenViewModelTests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
func isLocationNotLoadingInPickerModeWhenAuthorizationDenied() {
|
mutating func isLocationNotLoadingInPickerModeWhenAuthorizationDenied() {
|
||||||
setupViewModel()
|
setupViewModel()
|
||||||
context.isLocationAuthorized = false
|
context.isLocationAuthorized = false
|
||||||
context.hasLoadedUserLocation = false
|
context.hasLoadedUserLocation = false
|
||||||
@@ -159,7 +151,7 @@ final class LocationSharingScreenViewModelTests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
func isLocationNotLoadingInNonPickerModeWithAuthorizationNotDetermined() {
|
mutating func isLocationNotLoadingInNonPickerModeWithAuthorizationNotDetermined() {
|
||||||
let aliceShare = makeLiveLocationShare(userID: "@alice:matrix.org")
|
let aliceShare = makeLiveLocationShare(userID: "@alice:matrix.org")
|
||||||
let sender = TimelineItemSender(id: "@alice:matrix.org", displayName: "Alice")
|
let sender = TimelineItemSender(id: "@alice:matrix.org", displayName: "Alice")
|
||||||
let liveLocationsSubject = CurrentValueSubject<[LiveLocationShare], Never>([aliceShare])
|
let liveLocationsSubject = CurrentValueSubject<[LiveLocationShare], Never>([aliceShare])
|
||||||
@@ -170,7 +162,7 @@ final class LocationSharingScreenViewModelTests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
func isLocationLoadingInNonPickerModeWithAuthorizationGiven() {
|
mutating func isLocationLoadingInNonPickerModeWithAuthorizationGiven() {
|
||||||
let aliceShare = makeLiveLocationShare(userID: "@alice:matrix.org")
|
let aliceShare = makeLiveLocationShare(userID: "@alice:matrix.org")
|
||||||
let sender = TimelineItemSender(id: "@alice:matrix.org", displayName: "Alice")
|
let sender = TimelineItemSender(id: "@alice:matrix.org", displayName: "Alice")
|
||||||
let liveLocationsSubject = CurrentValueSubject<[LiveLocationShare], Never>([aliceShare])
|
let liveLocationsSubject = CurrentValueSubject<[LiveLocationShare], Never>([aliceShare])
|
||||||
@@ -183,21 +175,21 @@ final class LocationSharingScreenViewModelTests {
|
|||||||
// MARK: - Live Location Authorization Tests
|
// MARK: - Live Location Authorization Tests
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
func startLiveLocationWithDeniedAuthorization() {
|
mutating func startLiveLocationWithDeniedAuthorization() {
|
||||||
setupViewModel(liveLocationManagerConfiguration: .init(authorizationStatus: .denied))
|
setupViewModel(liveLocationManagerConfiguration: .init(authorizationStatus: .denied))
|
||||||
context.send(viewAction: .startLiveLocation)
|
context.send(viewAction: .startLiveLocation)
|
||||||
#expect(context.alertInfo?.id == .missingAlwaysAuthorization)
|
#expect(context.alertInfo?.id == .missingAlwaysAuthorization)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
func startLiveLocationWithRestrictedAuthorization() {
|
mutating func startLiveLocationWithRestrictedAuthorization() {
|
||||||
setupViewModel(liveLocationManagerConfiguration: .init(authorizationStatus: .restricted))
|
setupViewModel(liveLocationManagerConfiguration: .init(authorizationStatus: .restricted))
|
||||||
context.send(viewAction: .startLiveLocation)
|
context.send(viewAction: .startLiveLocation)
|
||||||
#expect(context.alertInfo?.id == .missingAlwaysAuthorization)
|
#expect(context.alertInfo?.id == .missingAlwaysAuthorization)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
func startLiveLocationWithWhenInUseAuthorizationAlreadyRequested() {
|
mutating func startLiveLocationWithWhenInUseAuthorizationAlreadyRequested() {
|
||||||
setupViewModel(liveLocationManagerConfiguration: .init(authorizationStatus: .authorizedWhenInUse,
|
setupViewModel(liveLocationManagerConfiguration: .init(authorizationStatus: .authorizedWhenInUse,
|
||||||
requestAlwaysAuthorizationIfPossibleReturnValue: false))
|
requestAlwaysAuthorizationIfPossibleReturnValue: false))
|
||||||
context.send(viewAction: .startLiveLocation)
|
context.send(viewAction: .startLiveLocation)
|
||||||
@@ -205,7 +197,7 @@ final class LocationSharingScreenViewModelTests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
func startLiveLocationWithWhenInUseAuthorizationNotYetRequested() {
|
mutating func startLiveLocationWithWhenInUseAuthorizationNotYetRequested() {
|
||||||
setupViewModel(liveLocationManagerConfiguration: .init(authorizationStatus: .authorizedWhenInUse,
|
setupViewModel(liveLocationManagerConfiguration: .init(authorizationStatus: .authorizedWhenInUse,
|
||||||
requestAlwaysAuthorizationIfPossibleReturnValue: true))
|
requestAlwaysAuthorizationIfPossibleReturnValue: true))
|
||||||
context.send(viewAction: .startLiveLocation)
|
context.send(viewAction: .startLiveLocation)
|
||||||
@@ -214,7 +206,7 @@ final class LocationSharingScreenViewModelTests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
func startLiveLocationWithNotDeterminedAuthorizationTransitionsToWhenInUse() async {
|
mutating func startLiveLocationWithNotDeterminedAuthorizationTransitionsToWhenInUse() async {
|
||||||
let authorizationStatusSubject = CurrentValueSubject<CLAuthorizationStatus, Never>(.notDetermined)
|
let authorizationStatusSubject = CurrentValueSubject<CLAuthorizationStatus, Never>(.notDetermined)
|
||||||
let liveLocationManagerMock = LiveLocationManagerMock()
|
let liveLocationManagerMock = LiveLocationManagerMock()
|
||||||
liveLocationManagerMock.underlyingAuthorizationStatus = .init(authorizationStatusSubject)
|
liveLocationManagerMock.underlyingAuthorizationStatus = .init(authorizationStatusSubject)
|
||||||
@@ -243,14 +235,14 @@ final class LocationSharingScreenViewModelTests {
|
|||||||
// MARK: - Live Location Start Flow Tests
|
// MARK: - Live Location Start Flow Tests
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
func startLiveLocationShowsDisclaimer() {
|
mutating func startLiveLocationShowsDisclaimer() {
|
||||||
setupViewModel(liveLocationManagerConfiguration: .init(authorizationStatus: .authorizedAlways))
|
setupViewModel(liveLocationManagerConfiguration: .init(authorizationStatus: .authorizedAlways))
|
||||||
context.send(viewAction: .startLiveLocation)
|
context.send(viewAction: .startLiveLocation)
|
||||||
#expect(context.alertInfo?.id == .liveLocationDisclaimer)
|
#expect(context.alertInfo?.id == .liveLocationDisclaimer)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
func startLiveLocationDisclaimerDeclineSkipsStart() {
|
mutating func startLiveLocationDisclaimerDeclineSkipsStart() {
|
||||||
let liveLocationManagerMock = LiveLocationManagerMock(.init(authorizationStatus: .authorizedAlways))
|
let liveLocationManagerMock = LiveLocationManagerMock(.init(authorizationStatus: .authorizedAlways))
|
||||||
setupViewModel(liveLocationManagerMock: liveLocationManagerMock)
|
setupViewModel(liveLocationManagerMock: liveLocationManagerMock)
|
||||||
context.send(viewAction: .startLiveLocation)
|
context.send(viewAction: .startLiveLocation)
|
||||||
@@ -259,7 +251,7 @@ final class LocationSharingScreenViewModelTests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
func startLiveLocationDisclaimerAcceptShowsDurationPicker() async throws {
|
mutating func startLiveLocationDisclaimerAcceptShowsDurationPicker() async throws {
|
||||||
setupViewModel(liveLocationManagerConfiguration: .init(authorizationStatus: .authorizedAlways))
|
setupViewModel(liveLocationManagerConfiguration: .init(authorizationStatus: .authorizedAlways))
|
||||||
context.send(viewAction: .startLiveLocation)
|
context.send(viewAction: .startLiveLocation)
|
||||||
#expect(context.alertInfo?.id == .liveLocationDisclaimer)
|
#expect(context.alertInfo?.id == .liveLocationDisclaimer)
|
||||||
@@ -269,7 +261,7 @@ final class LocationSharingScreenViewModelTests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
func startLiveLocationDurationPickerCancelSkipsStart() async throws {
|
mutating func startLiveLocationDurationPickerCancelSkipsStart() async throws {
|
||||||
let liveLocationManagerMock = LiveLocationManagerMock(.init(authorizationStatus: .authorizedAlways))
|
let liveLocationManagerMock = LiveLocationManagerMock(.init(authorizationStatus: .authorizedAlways))
|
||||||
setupViewModel(liveLocationManagerMock: liveLocationManagerMock)
|
setupViewModel(liveLocationManagerMock: liveLocationManagerMock)
|
||||||
context.send(viewAction: .startLiveLocation)
|
context.send(viewAction: .startLiveLocation)
|
||||||
@@ -281,7 +273,7 @@ final class LocationSharingScreenViewModelTests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
func startLiveLocationSuccess() async throws {
|
mutating func startLiveLocationSuccess() async throws {
|
||||||
let liveLocationManagerMock = LiveLocationManagerMock(.init(authorizationStatus: .authorizedAlways))
|
let liveLocationManagerMock = LiveLocationManagerMock(.init(authorizationStatus: .authorizedAlways))
|
||||||
setupViewModel(liveLocationManagerMock: liveLocationManagerMock)
|
setupViewModel(liveLocationManagerMock: liveLocationManagerMock)
|
||||||
context.send(viewAction: .startLiveLocation)
|
context.send(viewAction: .startLiveLocation)
|
||||||
@@ -299,7 +291,7 @@ final class LocationSharingScreenViewModelTests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
func startLiveLocationFailureDoesNotClose() async throws {
|
mutating func startLiveLocationFailureDoesNotClose() async throws {
|
||||||
let liveLocationManagerMock = LiveLocationManagerMock(.init(authorizationStatus: .authorizedAlways))
|
let liveLocationManagerMock = LiveLocationManagerMock(.init(authorizationStatus: .authorizedAlways))
|
||||||
liveLocationManagerMock.startLiveLocationRoomIDDurationReturnValue = .failure(.startFailed)
|
liveLocationManagerMock.startLiveLocationRoomIDDurationReturnValue = .failure(.startFailed)
|
||||||
setupViewModel(liveLocationManagerMock: liveLocationManagerMock)
|
setupViewModel(liveLocationManagerMock: liveLocationManagerMock)
|
||||||
@@ -316,7 +308,7 @@ final class LocationSharingScreenViewModelTests {
|
|||||||
// MARK: - Live Location Share Update Tests
|
// MARK: - Live Location Share Update Tests
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
func viewLiveInitialSenderShownCorrectly() {
|
mutating func viewLiveInitialSenderShownCorrectly() {
|
||||||
let aliceShare = makeLiveLocationShare(userID: "@alice:matrix.org", latitude: 51.5, longitude: -0.1)
|
let aliceShare = makeLiveLocationShare(userID: "@alice:matrix.org", latitude: 51.5, longitude: -0.1)
|
||||||
let sender = TimelineItemSender(id: "@alice:matrix.org", displayName: "Alice")
|
let sender = TimelineItemSender(id: "@alice:matrix.org", displayName: "Alice")
|
||||||
let liveLocationsSubject = CurrentValueSubject<[LiveLocationShare], Never>([aliceShare])
|
let liveLocationsSubject = CurrentValueSubject<[LiveLocationShare], Never>([aliceShare])
|
||||||
@@ -334,7 +326,7 @@ final class LocationSharingScreenViewModelTests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
func viewLiveReceivesAdditionalLocationUpdates() async throws {
|
mutating func viewLiveReceivesAdditionalLocationUpdates() async throws {
|
||||||
let aliceShare = makeLiveLocationShare(userID: "@alice:matrix.org", latitude: 51.5, longitude: -0.1)
|
let aliceShare = makeLiveLocationShare(userID: "@alice:matrix.org", latitude: 51.5, longitude: -0.1)
|
||||||
let sender = TimelineItemSender(id: "@alice:matrix.org", displayName: "Alice")
|
let sender = TimelineItemSender(id: "@alice:matrix.org", displayName: "Alice")
|
||||||
let liveLocationsSubject = CurrentValueSubject<[LiveLocationShare], Never>([aliceShare])
|
let liveLocationsSubject = CurrentValueSubject<[LiveLocationShare], Never>([aliceShare])
|
||||||
@@ -358,7 +350,7 @@ final class LocationSharingScreenViewModelTests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
func viewLiveProfilesResolvedFromRoomMembers() async throws {
|
mutating func viewLiveProfilesResolvedFromRoomMembers() async throws {
|
||||||
let aliceShare = makeLiveLocationShare(userID: "@alice:matrix.org", latitude: 51.5, longitude: -0.1)
|
let aliceShare = makeLiveLocationShare(userID: "@alice:matrix.org", latitude: 51.5, longitude: -0.1)
|
||||||
let sender = TimelineItemSender(id: "@alice:matrix.org", displayName: "Alice")
|
let sender = TimelineItemSender(id: "@alice:matrix.org", displayName: "Alice")
|
||||||
let liveLocationsSubject = CurrentValueSubject<[LiveLocationShare], Never>([aliceShare])
|
let liveLocationsSubject = CurrentValueSubject<[LiveLocationShare], Never>([aliceShare])
|
||||||
@@ -380,7 +372,7 @@ final class LocationSharingScreenViewModelTests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
func viewLiveFromBannerAwaitsFirstShareThenCentersOnIt() async throws {
|
mutating func viewLiveFromBannerAwaitsFirstShareThenCentersOnIt() async throws {
|
||||||
// Simulates opening from the banner: no sender info and no initial share are available yet.
|
// Simulates opening from the banner: no sender info and no initial share are available yet.
|
||||||
// The VM should wait for the first live location update and then center on the first share,
|
// The VM should wait for the first live location update and then center on the first share,
|
||||||
// which is assumed to belong to the own user.
|
// which is assumed to belong to the own user.
|
||||||
@@ -394,7 +386,6 @@ final class LocationSharingScreenViewModelTests {
|
|||||||
|
|
||||||
viewModel = LocationSharingScreenViewModel(interactionMode: .viewLive(sender: nil, initialLiveLocationShare: nil),
|
viewModel = LocationSharingScreenViewModel(interactionMode: .viewLive(sender: nil, initialLiveLocationShare: nil),
|
||||||
mapURLBuilder: ServiceLocator.shared.settings.mapTilerConfiguration,
|
mapURLBuilder: ServiceLocator.shared.settings.mapTilerConfiguration,
|
||||||
liveLocationSharingEnabled: true,
|
|
||||||
roomProxy: roomProxyMock,
|
roomProxy: roomProxyMock,
|
||||||
timelineController: MockTimelineController(timelineProxy: TimelineProxyMock(.init())),
|
timelineController: MockTimelineController(timelineProxy: TimelineProxyMock(.init())),
|
||||||
liveLocationManager: LiveLocationManagerMock(.init()),
|
liveLocationManager: LiveLocationManagerMock(.init()),
|
||||||
@@ -424,11 +415,10 @@ final class LocationSharingScreenViewModelTests {
|
|||||||
|
|
||||||
// MARK: - Private
|
// MARK: - Private
|
||||||
|
|
||||||
private func setupViewModel(liveLocationManagerConfiguration: LiveLocationManagerMock.Configuration = .init()) {
|
private mutating func setupViewModel(liveLocationManagerConfiguration: LiveLocationManagerMock.Configuration = .init()) {
|
||||||
timelineProxy = TimelineProxyMock(.init())
|
timelineProxy = TimelineProxyMock(.init())
|
||||||
viewModel = LocationSharingScreenViewModel(interactionMode: .picker,
|
viewModel = LocationSharingScreenViewModel(interactionMode: .picker,
|
||||||
mapURLBuilder: ServiceLocator.shared.settings.mapTilerConfiguration,
|
mapURLBuilder: ServiceLocator.shared.settings.mapTilerConfiguration,
|
||||||
liveLocationSharingEnabled: true,
|
|
||||||
roomProxy: JoinedRoomProxyMock(.init()),
|
roomProxy: JoinedRoomProxyMock(.init()),
|
||||||
timelineController: MockTimelineController(timelineProxy: timelineProxy),
|
timelineController: MockTimelineController(timelineProxy: timelineProxy),
|
||||||
liveLocationManager: LiveLocationManagerMock(liveLocationManagerConfiguration),
|
liveLocationManager: LiveLocationManagerMock(liveLocationManagerConfiguration),
|
||||||
@@ -438,11 +428,10 @@ final class LocationSharingScreenViewModelTests {
|
|||||||
viewModel.state.bindings.isLocationAuthorized = true
|
viewModel.state.bindings.isLocationAuthorized = true
|
||||||
}
|
}
|
||||||
|
|
||||||
private func setupViewModel(liveLocationManagerMock: LiveLocationManagerMock) {
|
private mutating func setupViewModel(liveLocationManagerMock: LiveLocationManagerMock) {
|
||||||
timelineProxy = TimelineProxyMock(.init())
|
timelineProxy = TimelineProxyMock(.init())
|
||||||
viewModel = LocationSharingScreenViewModel(interactionMode: .picker,
|
viewModel = LocationSharingScreenViewModel(interactionMode: .picker,
|
||||||
mapURLBuilder: ServiceLocator.shared.settings.mapTilerConfiguration,
|
mapURLBuilder: ServiceLocator.shared.settings.mapTilerConfiguration,
|
||||||
liveLocationSharingEnabled: true,
|
|
||||||
roomProxy: JoinedRoomProxyMock(.init()),
|
roomProxy: JoinedRoomProxyMock(.init()),
|
||||||
timelineController: MockTimelineController(timelineProxy: timelineProxy),
|
timelineController: MockTimelineController(timelineProxy: timelineProxy),
|
||||||
liveLocationManager: liveLocationManagerMock,
|
liveLocationManager: liveLocationManagerMock,
|
||||||
@@ -452,10 +441,10 @@ final class LocationSharingScreenViewModelTests {
|
|||||||
viewModel.state.bindings.isLocationAuthorized = true
|
viewModel.state.bindings.isLocationAuthorized = true
|
||||||
}
|
}
|
||||||
|
|
||||||
private func setupViewModelForViewLive(sender: TimelineItemSender,
|
private mutating func setupViewModelForViewLive(sender: TimelineItemSender,
|
||||||
initialShare: LiveLocationShare,
|
initialShare: LiveLocationShare,
|
||||||
liveLocationsSubject: CurrentValueSubject<[LiveLocationShare], Never>,
|
liveLocationsSubject: CurrentValueSubject<[LiveLocationShare], Never>,
|
||||||
members: [RoomMemberProxyMock] = .allMembers) {
|
members: [RoomMemberProxyMock] = .allMembers) {
|
||||||
let liveLocationServiceMock = RoomLiveLocationServiceMock()
|
let liveLocationServiceMock = RoomLiveLocationServiceMock()
|
||||||
liveLocationServiceMock.liveLocationsPublisher = liveLocationsSubject.asCurrentValuePublisher()
|
liveLocationServiceMock.liveLocationsPublisher = liveLocationsSubject.asCurrentValuePublisher()
|
||||||
|
|
||||||
@@ -464,7 +453,6 @@ final class LocationSharingScreenViewModelTests {
|
|||||||
|
|
||||||
viewModel = LocationSharingScreenViewModel(interactionMode: .viewLive(sender: sender, initialLiveLocationShare: initialShare),
|
viewModel = LocationSharingScreenViewModel(interactionMode: .viewLive(sender: sender, initialLiveLocationShare: initialShare),
|
||||||
mapURLBuilder: ServiceLocator.shared.settings.mapTilerConfiguration,
|
mapURLBuilder: ServiceLocator.shared.settings.mapTilerConfiguration,
|
||||||
liveLocationSharingEnabled: true,
|
|
||||||
roomProxy: roomProxyMock,
|
roomProxy: roomProxyMock,
|
||||||
timelineController: MockTimelineController(timelineProxy: TimelineProxyMock(.init())),
|
timelineController: MockTimelineController(timelineProxy: TimelineProxyMock(.init())),
|
||||||
liveLocationManager: LiveLocationManagerMock(.init()),
|
liveLocationManager: LiveLocationManagerMock(.init()),
|
||||||
|
|||||||
Reference in New Issue
Block a user