Skip to content
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

Enable voice message by default, remove from labs. #3818

Merged
merged 2 commits into from
Aug 11, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/3802.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Stop VMs playing in the timeline if a new VM recording is started
1 change: 1 addition & 0 deletions changelog.d/3817.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Voice Message - Enable by default, remove from labs
Original file line number Diff line number Diff line change
Expand Up @@ -971,7 +971,7 @@ class RoomDetailFragment @Inject constructor(
autoCompleter.exitSpecialMode()
views.composerLayout.collapse()

views.voiceMessageRecorderView.isVisible = text.isBlank() && vectorPreferences.labsUseVoiceMessage()
views.voiceMessageRecorderView.isVisible = text.isBlank()

updateComposerText(text)
views.composerLayout.views.sendButton.contentDescription = getString(R.string.send)
Expand Down Expand Up @@ -1298,7 +1298,7 @@ class RoomDetailFragment @Inject constructor(
}

override fun onTextBlankStateChanged(isBlank: Boolean) {
if (!views.composerLayout.views.sendButton.isVisible && vectorPreferences.labsUseVoiceMessage()) {
if (!views.composerLayout.views.sendButton.isVisible) {
// Animate alpha to prevent overlapping with the animation of the send button
views.voiceMessageRecorderView.alpha = 0f
views.voiceMessageRecorderView.isVisible = true
Expand All @@ -1318,7 +1318,7 @@ class RoomDetailFragment @Inject constructor(
if (text.isNotBlank()) {
// We collapse ASAP, if not there will be a slight annoying delay
views.composerLayout.collapse(true)
views.voiceMessageRecorderView.isVisible = vectorPreferences.labsUseVoiceMessage()
views.voiceMessageRecorderView.isVisible = true
lockSendButton = true
roomDetailViewModel.handle(RoomDetailAction.SendMessage(text, vectorPreferences.isMarkdownEnabled()))
emojiPopup.dismiss()
Expand Down Expand Up @@ -1372,10 +1372,10 @@ class RoomDetailFragment @Inject constructor(
if (state.canSendMessage) {
if (!views.voiceMessageRecorderView.isActive()) {
views.composerLayout.isVisible = true
views.voiceMessageRecorderView.isVisible = vectorPreferences.labsUseVoiceMessage() && views.composerLayout.text?.isBlank().orFalse()
views.voiceMessageRecorderView.isVisible = views.composerLayout.text?.isBlank().orFalse()
views.composerLayout.setRoomEncrypted(summary.isEncrypted)
views.notificationAreaView.render(NotificationAreaView.State.Hidden)
views.composerLayout.alwaysShowSendButton = !vectorPreferences.labsUseVoiceMessage()
views.composerLayout.alwaysShowSendButton = false
}
} else {
views.composerLayout.isVisible = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ class VoiceMessagePlaybackTracker @Inject constructor() {
.forEach { key ->
val state = states[key]
if (state is Listener.State.Playing) {
setState(key, Listener.State.Paused(state.playbackTime))
// Paused(state.playbackTime) state should also be considered later.
setState(key, Listener.State.Idle)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,6 @@ class VectorPreferences @Inject constructor(private val context: Context) {
const val SETTINGS_LABS_USE_RESTRICTED_JOIN_RULE = "SETTINGS_LABS_USE_RESTRICTED_JOIN_RULE"
const val SETTINGS_LABS_SPACES_HOME_AS_ORPHAN = "SETTINGS_LABS_SPACES_HOME_AS_ORPHAN"

const val SETTINGS_LABS_VOICE_MESSAGE = "SETTINGS_LABS_VOICE_MESSAGE"

private const val SETTINGS_DEVELOPER_MODE_PREFERENCE_KEY = "SETTINGS_DEVELOPER_MODE_PREFERENCE_KEY"
private const val SETTINGS_LABS_SHOW_HIDDEN_EVENTS_PREFERENCE_KEY = "SETTINGS_LABS_SHOW_HIDDEN_EVENTS_PREFERENCE_KEY"
private const val SETTINGS_LABS_ENABLE_SWIPE_TO_REPLY = "SETTINGS_LABS_ENABLE_SWIPE_TO_REPLY"
Expand Down Expand Up @@ -989,8 +987,4 @@ class VectorPreferences @Inject constructor(private val context: Context) {
putInt(TAKE_PHOTO_VIDEO_MODE, mode)
}
}

fun labsUseVoiceMessage(): Boolean {
return defaultPrefs.getBoolean(SETTINGS_LABS_VOICE_MESSAGE, false)
}
}
5 changes: 0 additions & 5 deletions vector/src/main/res/xml/vector_settings_labs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,4 @@
android:key="SETTINGS_LABS_SPACES_HOME_AS_ORPHAN"
android:title="@string/labs_space_show_orphan_in_home"/>

<im.vector.app.core.preference.VectorSwitchPreference
android:defaultValue="false"
android:key="SETTINGS_LABS_VOICE_MESSAGE"
android:title="@string/labs_use_voice_message"/>

</androidx.preference.PreferenceScreen>