Format file

This commit is contained in:
Benoit Marty 2022-05-05 12:01:33 +02:00
parent 66b32a74d5
commit 67bc7c93e6
1 changed files with 35 additions and 18 deletions

View File

@ -666,11 +666,13 @@ class TimelineFragment @Inject constructor(
).apply { ).apply {
directListener = { granted -> directListener = { granted ->
if (granted) { if (granted) {
timelineViewModel.handle(RoomDetailAction.EnsureNativeWidgetAllowed( timelineViewModel.handle(
RoomDetailAction.EnsureNativeWidgetAllowed(
widget = it.widget, widget = it.widget,
userJustAccepted = true, userJustAccepted = true,
grantedEvents = it.grantedEvents grantedEvents = it.grantedEvents
)) )
)
} }
} }
} }
@ -791,25 +793,29 @@ class TimelineFragment @Inject constructor(
override fun onSendVoiceMessage() { override fun onSendVoiceMessage() {
messageComposerViewModel.handle( messageComposerViewModel.handle(
MessageComposerAction.EndRecordingVoiceMessage(isCancelled = false, rootThreadEventId = getRootThreadEventId())) MessageComposerAction.EndRecordingVoiceMessage(isCancelled = false, rootThreadEventId = getRootThreadEventId())
)
updateRecordingUiState(RecordingUiState.Idle) updateRecordingUiState(RecordingUiState.Idle)
} }
override fun onDeleteVoiceMessage() { override fun onDeleteVoiceMessage() {
messageComposerViewModel.handle( messageComposerViewModel.handle(
MessageComposerAction.EndRecordingVoiceMessage(isCancelled = true, rootThreadEventId = getRootThreadEventId())) MessageComposerAction.EndRecordingVoiceMessage(isCancelled = true, rootThreadEventId = getRootThreadEventId())
)
updateRecordingUiState(RecordingUiState.Idle) updateRecordingUiState(RecordingUiState.Idle)
} }
override fun onRecordingLimitReached() { override fun onRecordingLimitReached() {
messageComposerViewModel.handle( messageComposerViewModel.handle(
MessageComposerAction.PauseRecordingVoiceMessage) MessageComposerAction.PauseRecordingVoiceMessage
)
updateRecordingUiState(RecordingUiState.Draft) updateRecordingUiState(RecordingUiState.Draft)
} }
override fun onRecordingWaveformClicked() { override fun onRecordingWaveformClicked() {
messageComposerViewModel.handle( messageComposerViewModel.handle(
MessageComposerAction.PauseRecordingVoiceMessage) MessageComposerAction.PauseRecordingVoiceMessage
)
updateRecordingUiState(RecordingUiState.Draft) updateRecordingUiState(RecordingUiState.Draft)
} }
@ -827,7 +833,8 @@ class TimelineFragment @Inject constructor(
private fun updateRecordingUiState(state: RecordingUiState) { private fun updateRecordingUiState(state: RecordingUiState) {
messageComposerViewModel.handle( messageComposerViewModel.handle(
MessageComposerAction.OnVoiceRecordingUiStateChanged(state)) MessageComposerAction.OnVoiceRecordingUiStateChanged(state)
)
} }
} }
} }
@ -1527,9 +1534,11 @@ class TimelineFragment @Inject constructor(
attachmentTypeSelector = AttachmentTypeSelectorView(vectorBaseActivity, vectorBaseActivity.layoutInflater, this@TimelineFragment) attachmentTypeSelector = AttachmentTypeSelectorView(vectorBaseActivity, vectorBaseActivity.layoutInflater, this@TimelineFragment)
attachmentTypeSelector.setAttachmentVisibility( attachmentTypeSelector.setAttachmentVisibility(
AttachmentTypeSelectorView.Type.LOCATION, AttachmentTypeSelectorView.Type.LOCATION,
vectorPreferences.isLocationSharingEnabled()) vectorPreferences.isLocationSharingEnabled()
)
attachmentTypeSelector.setAttachmentVisibility( attachmentTypeSelector.setAttachmentVisibility(
AttachmentTypeSelectorView.Type.POLL, !isThreadTimeLine()) AttachmentTypeSelectorView.Type.POLL, !isThreadTimeLine()
)
} }
attachmentTypeSelector.show(views.composerLayout.views.attachmentButton) attachmentTypeSelector.show(views.composerLayout.views.attachmentButton)
} }
@ -2292,12 +2301,18 @@ class TimelineFragment @Inject constructor(
handleCancelSend(action) handleCancelSend(action)
} }
is EventSharedAction.ReportContentSpam -> { is EventSharedAction.ReportContentSpam -> {
timelineViewModel.handle(RoomDetailAction.ReportContent( timelineViewModel.handle(
action.eventId, action.senderId, "This message is spam", spam = true)) RoomDetailAction.ReportContent(
action.eventId, action.senderId, "This message is spam", spam = true
)
)
} }
is EventSharedAction.ReportContentInappropriate -> { is EventSharedAction.ReportContentInappropriate -> {
timelineViewModel.handle(RoomDetailAction.ReportContent( timelineViewModel.handle(
action.eventId, action.senderId, "This message is inappropriate", inappropriate = true)) RoomDetailAction.ReportContent(
action.eventId, action.senderId, "This message is inappropriate", inappropriate = true
)
)
} }
is EventSharedAction.ReportContentCustom -> { is EventSharedAction.ReportContentCustom -> {
promptReasonToReportContent(action) promptReasonToReportContent(action)
@ -2443,7 +2458,8 @@ class TimelineFragment @Inject constructor(
displayName = timelineViewModel.getRoomSummary()?.displayName, displayName = timelineViewModel.getRoomSummary()?.displayName,
avatarUrl = timelineViewModel.getRoomSummary()?.avatarUrl, avatarUrl = timelineViewModel.getRoomSummary()?.avatarUrl,
roomEncryptionTrustLevel = timelineViewModel.getRoomSummary()?.roomEncryptionTrustLevel, roomEncryptionTrustLevel = timelineViewModel.getRoomSummary()?.roomEncryptionTrustLevel,
rootThreadEventId = rootThreadEventId) rootThreadEventId = rootThreadEventId
)
navigator.openThread(it, roomThreadDetailArgs) navigator.openThread(it, roomThreadDetailArgs)
} }
} }
@ -2479,7 +2495,8 @@ class TimelineFragment @Inject constructor(
roomId = timelineArgs.roomId, roomId = timelineArgs.roomId,
displayName = timelineViewModel.getRoomSummary()?.displayName, displayName = timelineViewModel.getRoomSummary()?.displayName,
roomEncryptionTrustLevel = timelineViewModel.getRoomSummary()?.roomEncryptionTrustLevel, roomEncryptionTrustLevel = timelineViewModel.getRoomSummary()?.roomEncryptionTrustLevel,
avatarUrl = timelineViewModel.getRoomSummary()?.avatarUrl) avatarUrl = timelineViewModel.getRoomSummary()?.avatarUrl
)
navigator.openThreadList(it, roomThreadDetailArgs) navigator.openThreadList(it, roomThreadDetailArgs)
} }
} }