Merge pull request from vector-im/feature/ons/delabs_voice_message

Enable voice message by default, remove from labs.
This commit is contained in:
Onuray Sahin 2021-08-11 16:34:37 +03:00 committed by GitHub
commit ba83092ebc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 8 additions and 16 deletions
changelog.d
vector/src/main
java/im/vector/app/features
res/xml

1
changelog.d/3802.bugfix Normal file
View file

@ -0,0 +1 @@
Stop VMs playing in the timeline if a new VM recording is started

1
changelog.d/3817.feature Normal file
View file

@ -0,0 +1 @@
Voice Message - Enable by default, remove from labs

View file

@ -971,7 +971,7 @@ class RoomDetailFragment @Inject constructor(
autoCompleter.exitSpecialMode() autoCompleter.exitSpecialMode()
views.composerLayout.collapse() views.composerLayout.collapse()
views.voiceMessageRecorderView.isVisible = text.isBlank() && vectorPreferences.labsUseVoiceMessage() views.voiceMessageRecorderView.isVisible = text.isBlank()
updateComposerText(text) updateComposerText(text)
views.composerLayout.views.sendButton.contentDescription = getString(R.string.send) views.composerLayout.views.sendButton.contentDescription = getString(R.string.send)
@ -1301,7 +1301,7 @@ class RoomDetailFragment @Inject constructor(
} }
override fun onTextBlankStateChanged(isBlank: Boolean) { 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 // Animate alpha to prevent overlapping with the animation of the send button
views.voiceMessageRecorderView.alpha = 0f views.voiceMessageRecorderView.alpha = 0f
views.voiceMessageRecorderView.isVisible = true views.voiceMessageRecorderView.isVisible = true
@ -1374,10 +1374,10 @@ class RoomDetailFragment @Inject constructor(
if (state.canSendMessage) { if (state.canSendMessage) {
if (!views.voiceMessageRecorderView.isActive()) { if (!views.voiceMessageRecorderView.isActive()) {
views.composerLayout.isVisible = true 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.composerLayout.setRoomEncrypted(summary.isEncrypted)
views.notificationAreaView.render(NotificationAreaView.State.Hidden) views.notificationAreaView.render(NotificationAreaView.State.Hidden)
views.composerLayout.alwaysShowSendButton = !vectorPreferences.labsUseVoiceMessage() views.composerLayout.alwaysShowSendButton = false
} }
} else { } else {
views.composerLayout.isVisible = false views.composerLayout.isVisible = false

View file

@ -68,7 +68,8 @@ class VoiceMessagePlaybackTracker @Inject constructor() {
.forEach { key -> .forEach { key ->
val state = states[key] val state = states[key]
if (state is Listener.State.Playing) { 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)
} }
} }
} }

View file

@ -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_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_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_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_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" private const val SETTINGS_LABS_ENABLE_SWIPE_TO_REPLY = "SETTINGS_LABS_ENABLE_SWIPE_TO_REPLY"
@ -989,8 +987,4 @@ class VectorPreferences @Inject constructor(private val context: Context) {
putInt(TAKE_PHOTO_VIDEO_MODE, mode) putInt(TAKE_PHOTO_VIDEO_MODE, mode)
} }
} }
fun labsUseVoiceMessage(): Boolean {
return defaultPrefs.getBoolean(SETTINGS_LABS_VOICE_MESSAGE, false)
}
} }

View file

@ -57,9 +57,4 @@
android:key="SETTINGS_LABS_SPACES_HOME_AS_ORPHAN" android:key="SETTINGS_LABS_SPACES_HOME_AS_ORPHAN"
android:title="@string/labs_space_show_orphan_in_home"/> 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> </androidx.preference.PreferenceScreen>