-
Notifications
You must be signed in to change notification settings - Fork 768
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Voice recording UI state in ViewModel #4515
Merged
Merged
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
f0ef9e9
inverting and splitting the voice message view into logic and views
ouchadam f269055
lifting voice display logic out of the view and to the layer above
ouchadam 40d762c
lifting current recording state out of the view
ouchadam 2ad121e
moving the recording ui state to the textcomposer view model and state
ouchadam e895dbd
replacing chained ifs with when
ouchadam 9ae03b7
allows locking and cancelling to occur after choosing either option
ouchadam be685bc
aligning the locked recording view to the send message button without…
ouchadam dfc67b8
updating the state rather than calling display directly
ouchadam bf37437
removing no longer needed cancelled status check
ouchadam 734e7df
renaming display function as its updating state, rather than directly…
ouchadam c5746a5
updating voice view interface method names for consistency
ouchadam 16ca7d5
adding sending of voice message on send pressed
ouchadam 4dbb150
clarifying why we do nothing when the state is locked on voice record…
ouchadam 1afc1b5
separating the cancelled and ended events to make the consumption sim…
ouchadam 7d262eb
removing no longer needed message delete on animation end, we delete …
ouchadam 331bcbf
separating the drag state from the main UI state in order to clarify …
ouchadam 7d0d105
adding changelog entry
ouchadam File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Voice recording mic button refactor with small animation tweaks in preparation for voice drafts | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,6 +18,7 @@ package im.vector.app.features.home.room.detail.composer | |
|
||
import com.airbnb.mvrx.MavericksState | ||
import im.vector.app.features.home.room.detail.RoomDetailArgs | ||
import im.vector.app.features.home.room.detail.composer.voice.VoiceMessageRecorderView | ||
import org.matrix.android.sdk.api.session.room.timeline.TimelineEvent | ||
|
||
/** | ||
|
@@ -44,13 +45,27 @@ sealed class SendMode(open val text: String) { | |
data class TextComposerViewState( | ||
val roomId: String, | ||
val canSendMessage: Boolean = true, | ||
val isVoiceRecording: Boolean = false, | ||
val isSendButtonVisible: Boolean = false, | ||
val sendMode: SendMode = SendMode.REGULAR("", false) | ||
val sendMode: SendMode = SendMode.REGULAR("", false), | ||
val voiceRecordingUiState: VoiceMessageRecorderView.RecordingUiState = VoiceMessageRecorderView.RecordingUiState.None | ||
) : MavericksState { | ||
|
||
val isVoiceRecording = when (voiceRecordingUiState) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the |
||
VoiceMessageRecorderView.RecordingUiState.None, | ||
VoiceMessageRecorderView.RecordingUiState.Cancelled, | ||
VoiceMessageRecorderView.RecordingUiState.Playback -> false | ||
VoiceMessageRecorderView.RecordingUiState.Locked, | ||
VoiceMessageRecorderView.RecordingUiState.Started -> true | ||
} | ||
|
||
val isVoiceMessageIdle = when (voiceRecordingUiState) { | ||
VoiceMessageRecorderView.RecordingUiState.None, VoiceMessageRecorderView.RecordingUiState.Cancelled -> false | ||
else -> true | ||
} | ||
|
||
val isComposerVisible = canSendMessage && !isVoiceRecording | ||
val isVoiceMessageRecorderVisible = canSendMessage && !isSendButtonVisible | ||
|
||
@Suppress("UNUSED") // needed by mavericks | ||
constructor(args: RoomDetailArgs) : this(roomId = args.roomId) | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wasn't 100% sure if the change log entry was needed as this is mostly refactoring (same as #4523)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Always OK to have a changelog, if something goes wrong (I hope no!), we keep quickly see in the change history what have been done.