Show "Clear message queue" option (in debug mode)

This commit is contained in:
Benoit Marty 2019-09-25 10:50:13 +02:00
parent d1a61f29e4
commit b24a372262
2 changed files with 9 additions and 13 deletions

View File

@ -48,6 +48,7 @@ import im.vector.matrix.android.api.session.room.timeline.getTextEditableContent
import im.vector.matrix.android.internal.crypto.attachments.toElementToDecrypt import im.vector.matrix.android.internal.crypto.attachments.toElementToDecrypt
import im.vector.matrix.android.internal.crypto.model.event.EncryptedEventContent import im.vector.matrix.android.internal.crypto.model.event.EncryptedEventContent
import im.vector.matrix.rx.rx import im.vector.matrix.rx.rx
import im.vector.riotx.BuildConfig
import im.vector.riotx.R import im.vector.riotx.R
import im.vector.riotx.core.extensions.postLiveEvent import im.vector.riotx.core.extensions.postLiveEvent
import im.vector.riotx.core.intent.getFilenameFromUri import im.vector.riotx.core.intent.getFilenameFromUri
@ -232,18 +233,13 @@ class RoomDetailViewModel @AssistedInject constructor(@Assisted initialState: Ro
get() = _downloadedFileEvent get() = _downloadedFileEvent
fun isMenuItemVisible(@IdRes itemId: Int): Boolean { fun isMenuItemVisible(@IdRes itemId: Int) = when (itemId) {
if (itemId == R.id.clear_message_queue) { R.id.clear_message_queue ->
//For now always disable, woker cancellation is not working properly /* For now always disable on production, worker cancellation is not working properly */
return false//timeline.pendingEventCount() > 0 timeline.pendingEventCount() > 0 && BuildConfig.DEBUG
} R.id.resend_all -> timeline.failedToDeliverEventCount() > 0
if (itemId == R.id.resend_all) { R.id.clear_all -> timeline.failedToDeliverEventCount() > 0
return timeline.failedToDeliverEventCount() > 0 else -> false
}
if (itemId == R.id.clear_all) {
return timeline.failedToDeliverEventCount() > 0
}
return false
} }
// PRIVATE METHODS ***************************************************************************** // PRIVATE METHODS *****************************************************************************

View File

@ -22,7 +22,7 @@
<item <item
android:id="@+id/clear_message_queue" android:id="@+id/clear_message_queue"
android:title="@string/clear_timeline_send_queue" android:title="@string/clear_timeline_send_queue"
android:visible="false" android:visible="@bool/debug_mode"
app:showAsAction="never" app:showAsAction="never"
tools:visible="true" /> tools:visible="true" />