Skip to content

Commit

Permalink
Debounce camera switcher button.
Browse files Browse the repository at this point in the history
  • Loading branch information
nicholas-signal authored and clark-signal committed Mar 11, 2024
1 parent 39aa583 commit 6e09d10
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ import org.thoughtcrime.securesms.mediasend.v2.text.send.TextStoryPostSendReposi
import org.thoughtcrime.securesms.recipients.RecipientId
import org.thoughtcrime.securesms.safety.SafetyNumberBottomSheet
import org.thoughtcrime.securesms.stories.Stories
import org.thoughtcrime.securesms.util.Debouncer
import org.thoughtcrime.securesms.util.FullscreenHelper
import org.thoughtcrime.securesms.util.WindowUtil
import org.thoughtcrime.securesms.util.navigation.safeNavigate
Expand Down Expand Up @@ -79,6 +80,8 @@ class MediaSelectionActivity :
private val draftText: CharSequence?
get() = intent.getCharSequenceExtra(MESSAGE)

private val debouncer = Debouncer(200)

override fun attachBaseContext(newBase: Context) {
delegate.localNightMode = AppCompatDelegate.MODE_NIGHT_YES
super.attachBaseContext(newBase)
Expand Down Expand Up @@ -122,7 +125,7 @@ class MediaSelectionActivity :
}

cameraSwitch.setOnClickListener {
viewModel.sendCommand(HudCommand.GoToCapture)
debouncer.publish { viewModel.sendCommand(HudCommand.GoToCapture) }
}

if (savedInstanceState == null) {
Expand Down

0 comments on commit 6e09d10

Please sign in to comment.