Skip to content

Conversation

@Sagar0-0
Copy link
Contributor

First time contributor checklist

Contributor checklist

  • Device A, Android X.Y.Z
  • Device B, Android Z.Y
  • Virtual device W, Android Y.Y.Z
  • My contribution is fully baked and ready to be merged as is
  • I ensure that all the open issues my contribution fixes are mentioned in the commit message of my first commit using the Fixes #1234 syntax

Description

  1. Hold the mic and start record the audio.
    2., Lock the Recorder
  2. Currently the user can only send the audio
  3. After this change, the user can long press send and can schedule the audio.

@greyson-signal
Copy link
Contributor

greyson-signal commented Feb 20, 2025

I like this idea, but I think the UX could be improved. As-written, the app is actually still recording while you're picking the scheduled time. That could be a non-trivial amount of awkward silence at the end :)

I think we could fix it though by stopping recording when the user long-presses the send button. When the long-press goes through, we could stop the recording at render it like we render voice note drafts (to see it, lock the recorder, then leave the chat and come back -- it's a special UI that shows a pending voice note). That way the recording is finalized when you're picking the time.

@Sagar0-0 Sagar0-0 force-pushed the support-scheduled-audio branch from cb0ae30 to 722d706 Compare February 25, 2025 22:03

override fun onSendScheduled() {
if(inputPanel.isRecordingInLockedMode) {
inputPanel.onSaveRecordDraft()
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could have used the inputPanel.onPause() call, which calls the cancelAction which then calls the onRecorderCanceled with byUser = false, which saves the audio draft and gives same results.

But, I decided to use new functions inputPanel.onSaveRecordDraft, onRecorderSaved, etc. so that these will make sense with the call site and anyone who has not worked in this flow can easily understand what is going on by just the function names.

What would you generally recommend? @greyson-signal
Some code duplicacy but more sensible names. Like I have created onSaveRecordDraft which works exactly same as onRecordCanceled(false)
or
Less Easy to understand code with no duplicacy? Like calling the inputPanel.onPause() to save audio draft, or calling onRecordCanceled(false) to save audio draft.

I believe, a good code is self-explanatory with no need for documenting every function.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think having the names describe the action that's happening, even if the bodies are identical, is probably for the best. So I think what you have here is good 👍

Copy link
Contributor

@greyson-signal greyson-signal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is fantastic, thank you! It'll go out in 7.38


override fun onSendScheduled() {
if(inputPanel.isRecordingInLockedMode) {
inputPanel.onSaveRecordDraft()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think having the names describe the action that's happening, even if the bodies are identical, is probably for the best. So I think what you have here is good 👍

isopod-a pushed a commit to isopod-a/Signal-Android that referenced this pull request Apr 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants