mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-05 20:09:04 +00:00
Remove the dynamic member lookup from UserSettings in favour of nested access. (#6294)
* Remove the dynamic member lookup from UserSettings in favour of nested access. * Remove forwarding methods from UserSettings. * Update the Enterprise submodule.
This commit is contained in:
@@ -80,7 +80,7 @@ final class ComposerToolbarViewModel: ComposerToolbarViewModelType, ComposerTool
|
||||
|
||||
super.init(initialViewState: ComposerToolbarViewState(wysiwygViewModel: wysiwygViewModel,
|
||||
isRoomEncrypted: roomProxy.infoPublisher.value.isEncrypted,
|
||||
isLocationSharingEnabled: userSettings.mapTilerConfiguration.publisher.value.isEnabled,
|
||||
isLocationSharingEnabled: userSettings.app.mapTilerConfiguration.publisher.value.isEnabled,
|
||||
bindings: .init()),
|
||||
mediaProvider: mediaProvider)
|
||||
|
||||
|
||||
@@ -122,13 +122,13 @@ final class RoomScreenCoordinator: CoordinatorProtocol {
|
||||
case .displayReportContent(let itemID, let senderID):
|
||||
actionsSubject.send(.presentReportContent(itemID: itemID, senderID: senderID))
|
||||
case .displayCameraPicker:
|
||||
actionsSubject.send(.presentMediaUploadPicker(mode: .init(source: .camera, selectionType: .multiple(galleryEnabled: userSettings.galleryEnabled)),
|
||||
actionsSubject.send(.presentMediaUploadPicker(mode: .init(source: .camera, selectionType: .multiple(galleryEnabled: userSettings.app.galleryEnabled)),
|
||||
caption: composerViewModel.context.plainComposerText))
|
||||
case .displayMediaPicker:
|
||||
actionsSubject.send(.presentMediaUploadPicker(mode: .init(source: .photoLibrary, selectionType: .multiple(galleryEnabled: userSettings.galleryEnabled)),
|
||||
actionsSubject.send(.presentMediaUploadPicker(mode: .init(source: .photoLibrary, selectionType: .multiple(galleryEnabled: userSettings.app.galleryEnabled)),
|
||||
caption: composerViewModel.context.plainComposerText))
|
||||
case .displayDocumentPicker:
|
||||
actionsSubject.send(.presentMediaUploadPicker(mode: .init(source: .documents(), selectionType: .multiple(galleryEnabled: userSettings.galleryEnabled)),
|
||||
actionsSubject.send(.presentMediaUploadPicker(mode: .init(source: .documents(), selectionType: .multiple(galleryEnabled: userSettings.app.galleryEnabled)),
|
||||
caption: composerViewModel.context.plainComposerText))
|
||||
case .displayMediaPreview(let mediaPreviewViewModel):
|
||||
roomViewModel.displayMediaPreview(mediaPreviewViewModel)
|
||||
|
||||
@@ -68,7 +68,7 @@ class RoomScreenViewModel: RoomScreenViewModelType, RoomScreenViewModelProtocol
|
||||
|
||||
let viewState = RoomScreenViewState(roomTitle: roomProxy.infoPublisher.value.displayNameOrID,
|
||||
roomAvatar: roomProxy.infoPublisher.value.avatar,
|
||||
isNativeCallingEnabled: userSettings.nativeCallEnabled,
|
||||
isNativeCallingEnabled: userSettings.app.nativeCallEnabled,
|
||||
hasOngoingCall: roomProxy.infoPublisher.value.hasRoomCall,
|
||||
isDM: roomProxy.infoPublisher.value.isDM,
|
||||
hasSuccessor: roomProxy.infoPublisher.value.successor != nil,
|
||||
@@ -127,7 +127,7 @@ class RoomScreenViewModel: RoomScreenViewModelType, RoomScreenViewModelProtocol
|
||||
Task {
|
||||
// When navigating away from the room, we need to mark the room as both read
|
||||
// and fully read for Synapse to clear this room from the app's badge count.
|
||||
_ = await roomProxy.markAsRead(receiptType: userSettings.sharePresence ? .read : .readPrivate)
|
||||
_ = await roomProxy.markAsRead(receiptType: userSettings.app.sharePresence ? .read : .readPrivate)
|
||||
_ = await roomProxy.markAsRead(receiptType: .fullyRead)
|
||||
}
|
||||
// Work around QLPreviewController dismissal issues, see the InteractiveQuickLookModifier.
|
||||
@@ -166,11 +166,11 @@ class RoomScreenViewModel: RoomScreenViewModelType, RoomScreenViewModelProtocol
|
||||
// MARK: - Private
|
||||
|
||||
private func setupSubscriptions(ongoingCallRoomIDPublisher: CurrentValuePublisher<String?, Never>) {
|
||||
userSettings.threadsEnabledPublisher
|
||||
userSettings.app.threadsEnabledPublisher
|
||||
.weakAssign(to: \.state.roomThreadListEnabled, on: self)
|
||||
.store(in: &cancellables)
|
||||
|
||||
userSettings.liveLocationSharingSessionsByRoomIDPublisher
|
||||
userSettings.app.liveLocationSharingSessionsByRoomIDPublisher
|
||||
.receive(on: DispatchQueue.main)
|
||||
.sink { [weak self] sessionsByRoomID in
|
||||
guard let self else { return }
|
||||
@@ -264,10 +264,10 @@ class RoomScreenViewModel: RoomScreenViewModelType, RoomScreenViewModelProtocol
|
||||
|
||||
if let member = identityVerificationViolations.values.first {
|
||||
state.footerDetails = .verificationViolation(member: member,
|
||||
learnMoreURL: userSettings.identityPinningViolationDetailsURL)
|
||||
learnMoreURL: userSettings.app.identityPinningViolationDetailsURL)
|
||||
} else if let member = identityPinningViolations.values.first {
|
||||
state.footerDetails = .pinViolation(member: member,
|
||||
learnMoreURL: userSettings.identityPinningViolationDetailsURL)
|
||||
learnMoreURL: userSettings.app.identityPinningViolationDetailsURL)
|
||||
} else {
|
||||
state.footerDetails = nil
|
||||
}
|
||||
@@ -428,7 +428,7 @@ class RoomScreenViewModel: RoomScreenViewModelType, RoomScreenViewModelProtocol
|
||||
Task {
|
||||
switch await roomProxy.loadOrFetchEventDetails(for: eventID) {
|
||||
case .success(let event):
|
||||
if userSettings.threadsEnabled,
|
||||
if userSettings.app.threadsEnabled,
|
||||
let threadRootEventID = event.threadRootEventId() {
|
||||
actionsSubject.send(.focusEvent(eventID: threadRootEventID))
|
||||
actionsSubject.send(.displayThread(threadRootEventID: threadRootEventID, focussedEventID: eventID))
|
||||
|
||||
@@ -396,7 +396,7 @@ struct RoomScreen_Previews: PreviewProvider, TestablePreview {
|
||||
let roomViewModel = RoomScreenViewModel.mock(roomProxyMock: roomProxyMock)
|
||||
|
||||
let userSettings = UserSettings.mock()
|
||||
userSettings.messageMultiSelectEnabled = isSelecting
|
||||
userSettings.app.messageMultiSelectEnabled = isSelecting
|
||||
let userSession = UserSessionMock(.init(userSettings: userSettings))
|
||||
|
||||
let timelineController = TimelineControllerMock(.init())
|
||||
|
||||
Reference in New Issue
Block a user