this will set NOT NULL and DEFAULT 0 to hasArchived column
Otherwise there would be an error when updating from the previous DB version:
IllegalStateException: Migration didn't properly handle: Conversations(com.nextcloud.talk.data.database.model.ConversationEntity)
Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
replace com.nextcloud.ui.popupbubble.PopupBubble with MaterialButton.
com.nextcloud.ui.popupbubble.PopupBubble was forked from
https://github.com/webianks/PopupBubble
which is quite outdated.
com.nextcloud.ui.popupbubble.PopupBubble is still used in ConversationsListActivity but there it should also be removed.
Removing this recycler view stuff will also help a bit to switch to JetpackCompose
Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
this commit will avoid to fail to show messages in adapter. This was caused by the usage of
messagesListAdapter.deleteById("-1");
in UnreadNoticeMessageViewHolder.
The bug seems to exist in the past already but was never reported (Sometimes, when receiving a lot of messages it could happen that some message in between is not shown in UI). However with recent changes after release 20.0.2 the bug appeared more often.
The root cause was not analyzed, but the handling was modified in general as the unread marker behavior was never really good.
By not using deleteById but replace it with new unread marker logic, the bug of disappearing messages is solved and the unread messages marker behavior is improved.
Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
When the message applies to all participants the property is all in
lower case. The comparison is case sensitive, so the message was ignored
and the call was not left by the Talk Android app.
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
"IN_CONVERSATION" was set when the activity was created and "state" in
the intent extras had the value "resume". However, there is no "state"
extra set by default in Android intents, it should be explicitly set,
but as it is not set anywhere in Talk Android code that would make it
dead code and safe to remove.
Moreover, the connection to the call should be initialized again in any
case rather than resumed when "onCreate" is called, as it is likely that
any previous connection would have been ended if the previous activity
instance was destroyed.
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
avoid NPE:
java.lang.NullPointerException
at com.nextcloud.talk.chat.data.network.OfflineFirstChatRepository.getCappedMessagesAmountOfChatBlock(OfflineFirstChatRepository.kt:186)
at com.nextcloud.talk.chat.data.network.OfflineFirstChatRepository.access$getCappedMessagesAmountOfChatBlock(OfflineFirstChatRepository.kt:43)
at com.nextcloud.talk.chat.data.network.OfflineFirstChatRepository$loadInitialMessages$1.invokeSuspend(OfflineFirstChatRepository.kt:162)
Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
Mistake was, that the conversations from DB and sync could differ due to values.
E.g. when a user changed the status, the conversations from DB and sync would differ. So there were conversations (+related messages&chatBlocks) deleted sometimes.
This caused bugs that when entering a chat, all data was loaded again.
In the previous implementation (before this PR), this error was only visible in the UI when you were offline (in this case, nothing was displayed!).
To fix the bug, only the internalId's are compared.
Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
If conversation has a newer message id than DB then an online request is necessary
If conversation has an older message id than DB then an online request is not necessary (this could happen when updating of DB is implemented for push notification, not yet done).
If conversation has the same message id like DB than request can be skipped
Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
Decrease message limit for retries of message loading
make it possible to add any amount (up to 100) of messages to UI for initial loading.
add logging
only make initial request for chat messages when newest message from DB is not equal the lastReadMessage that is offered by the conversation
Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
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>
After 30 seconds (when the capabilities were updated) the call buttons of federated conversations were removed (this was done back then when fed calls were not implemented).
However this happened not always because of the check
"if (this::spreedCapabilities.isInitialized) {...."
It seems this check sometimes is false when it's supposed to be true. This has be to further investigated and has to be be simplified/improved by a cleaner architecture.
Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
The messageInputFragment was hidden by checkShowMessageInputView(), but it was immediately shown again by checkLobbyState()
This fix will execute checkShowMessageInputView() inside checkLobbyState() in the correct order.
Additionally, the check
checkLobbyState()
has to be already executed in
GetCapabilitiesInitialLoadState
as well as
checkShowCallButtons()
Otherwise the expected behavior would only be set after 30 seconds.
An improvemnt for the future must be to improve the capabilities handling.
Signed-off-by: Marcel Hibbe <dev@mhibbe.de>