Hide search feature if room is federated.
Also, for conversation list the check for federation inside isUnifiedSearchAvailable makes no sense.
Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
This test respects different API versions and checks if default values are set as expected.
- remove deprecated+unused methods
- remove comments
- remove unnecessary double-bang operator
Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
Otherwise, following crash happened, as it was tried to deal with the empty url:
2024-09-24 15:10:30.719 17765-17765 WebSocketInstance com.nextcloud.talk2 D restartWebSocket: /spreed
2024-09-24 15:10:30.722 17765-17765 System.err com.nextcloud.talk2 W java.lang.IllegalArgumentException: Expected URL scheme 'http' or 'https' but no scheme was found for /spree...
2024-09-24 15:10:30.723 17765-17765 System.err com.nextcloud.talk2 W at okhttp3.HttpUrl$Builder.parse$okhttp(HttpUrl.kt:1261)
Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
On gplay console the following NPE was reported for the line
participantPermissions = ParticipantPermissions(spreedCapabilities, currentConversation!!)
E FATAL EXCEPTION: main
Process: com.nextcloud.talk2, PID: 6626
java.lang.NullPointerException
at com.nextcloud.talk.chat.ChatActivity.initObservers$lambda$13(ChatActivity.kt:583)
at com.nextcloud.talk.chat.ChatActivity.$r8$lambda$QKH5JCFLmCzRMlSJ-EV-m4IW5ig(Unknown Source:0)
which seems that currentConversation was null. If it would have been spreedCapabilities, then the error would have been thrown in the line before..
A reason MAY BE that the observer is triggered before setData on the ViewModel is executed.
While this fix is just not executing code when currentConversation is null, it's unsure if it will follow up problems (like an empty chat) or if the observer is triggered another time when currentConversation is available.
So it's just a hotfix.
To improve the situation in the long term, we should move more logic to viewModel and only use Flow instead to mix it with LiveData.
Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
reported issue on gplay console was:
Exception kotlin.UninitializedPropertyAccessException: lateinit property spreedCapabilities has not been initialized
at com.nextcloud.talk.chat.ChatActivity.getSpreedCapabilities (ChatActivity.kt:284)
at com.nextcloud.talk.chat.ChatActivity.processExpiredMessages (ChatActivity.kt:2536)
at com.nextcloud.talk.chat.ChatActivity.access$processExpiredMessages (ChatActivity.kt:204)
at com.nextcloud.talk.chat.ChatActivity$initObservers$10$1.invokeSuspend (ChatActivity.kt:820)
This is just a hotfix while hoping processExpiredMessages is executed again while spreedCapabilities are available.
To improve the situation in the long term, we should move more logic to viewModel and have better control over sequence of actions.
Signed-off-by: Marcel Hibbe <dev@mhibbe.de>