Prevent last message sender name in front of composing label in chat rooms list cells + prevent network unreachable alert during core startup

This commit is contained in:
Sylvain Berfini 2024-12-05 12:10:54 +01:00
parent c988504319
commit 935d463896
2 changed files with 4 additions and 4 deletions

View file

@ -303,8 +303,8 @@ class MainViewModel @UiThread constructor() : ViewModel() {
core.addListener(coreListener)
if (!core.isNetworkReachable) {
Log.w("$TAG Network is not reachable!")
if (!core.isNetworkReachable && core.globalState == GlobalState.On) {
Log.w("$TAG Core is ON & network is not reachable!")
val label = AppUtils.getString(R.string.network_not_reachable)
addAlert(NETWORK_NOT_REACHABLE, label)
}
@ -554,7 +554,7 @@ class MainViewModel @UiThread constructor() : ViewModel() {
private fun checkNetworkReachability() {
val reachable = coreContext.core.isNetworkReachable
Log.i("$TAG Network is ${if (reachable) "reachable" else "not reachable"}")
if (!reachable) {
if (!reachable && coreContext.core.globalState == GlobalState.On) {
val label = AppUtils.getString(R.string.network_not_reachable)
addAlert(NETWORK_NOT_REACHABLE, label)
} else {

View file

@ -90,7 +90,7 @@
android:text="@{model.lastMessageTextSender, default=`John Doe:`}"
android:textSize="14sp"
android:textColor="?attr/color_main2_400"
android:visibility="@{model.lastMessageTextSender.length() > 0 ? View.VISIBLE : View.GONE}"
android:visibility="@{model.isBeingDeleted || model.lastMessageTextSender.length() == 0 || model.isComposing ? View.GONE : View.VISIBLE}"
textFont="@{model.isBeingDeleted || model.unreadMessageCount > 0 || model.isComposing ? NotoSansFont.NotoSansBold : NotoSansFont.NotoSansRegular}"
app:layout_constraintStart_toStartOf="@id/title"
app:layout_constraintEnd_toStartOf="@id/last_message_forward"