mirror of
https://github.com/vector-im/element-android.git
synced 2024-11-15 01:35:07 +08:00
Show "Clear message queue" option (in debug mode)
This commit is contained in:
parent
d1a61f29e4
commit
b24a372262
@ -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 *****************************************************************************
|
||||||
|
@ -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" />
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user