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>
With server version 23.0.12 it happened that the chat did not load because values were null. Now default values in json model are set (because that's easier than changing the entity).
Additionally a check was added in CallActivity that a callStartTime of 0 would not be used (but it should not be used anyway if it would be 0 because then capability should also not be available).
Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
Otherwise the WebSocket configuration and session clashes with the one
from the CallActivity, which already uses the federated settings.
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
Starting with Talk 20 the signaling messages that provide updates to the
participants ("participants->update" in the external signaling server,
"usersInRoom" in the internal signaling server) now include "actorType"
and "actorId" properties for each participant.
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
The "federation" values are used by the external signaling server to
establish a connection with the remote signaling server in a federated
room.
For now this is applied only in calls; when the room is joined in the
chat view again after a call it will still join it in the old way,
without federation properties, which will cause the connection with the
remote signaling server to be closed.
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
Starting with Talk 20 the signaling settings include a "federation"
property that provide the values needed to join a federated room in the
external signaling settings. The "federation" property is specific to
each conversation, and it will be returned although empty for
non-federated conversations.
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
add delay between sending of queued messages to increase the chance they are received on server in the correct order. This is not the best solution though as it blocks the UI a bit so may have to be improved!
Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
Otherwise, it resulted in a lot of flickering because _lastCommonReadFlow was emitted every 500ms. And anyway if we know we are offline or paused then it doesn't make sense to execute the sync method.
chain which caused the flickering was:
updateUiForLastCommonRead (_lastCommonReadFlow) -> updateReadStatusOfAllMessages - notifyDataSetChanged -> onBindViewHolder -> IncomingLinkPreviewMessageViewHolder
Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
In dark mode, the call buttons looked like disabled otherwise.
There is still the 3-dots menu next to the call icons like disabled for dark and light mode. But this is a different bug that needs to be fixed in another branch(could not find the reason for now).
Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
same for swipeRefreshLayoutView?.isRefreshing
If searchHelper would be null (= when UnifiedSearch is not available) then going back to conversations list view would not trigger to check to show for unread mentions bubble. This fix will make it independent from searchHelper.
Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
no idea how this happens, however this was
reported via gplay pre launch report for 20.0.0RC1
("Detected on 10 devices during testing"):
Exception java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String com.nextcloud.talk.data.user.model.User.getBaseUrl()' on a null object reference
at com.nextcloud.talk.activities.BaseActivity.startActivity (BaseActivity.kt:240)
at com.nextcloud.talk.account.ServerSelectionActivity.showVisitProvidersInfo$lambda$5 (ServerSelectionActivity.kt:206)
at com.nextcloud.talk.account.ServerSelectionActivity.$r8$lambda$pjpPT-LQbGLSCJPXeRE8IJvpLIE
at com.nextcloud.talk.account.ServerSelectionActivity$$ExternalSyntheticLambda0.onClick (D8$$SyntheticClass)
at android.view.View.performClick (View.java:7506)
at android.view.View.performClickInternal (View.java:7483)
at android.view.View.-$$Nest$mperformClickInternal
at android.view.View$PerformClick.run (View.java:29335)
at android.os.Handler.handleCallback (Handler.java:942)
at android.os.Handler.dispatchMessage (Handler.java:99)
at androidx.test.espresso.base.Interrogator.loopAndInterrogate (Interrogator.java:10)
at androidx.test.espresso.base.UiControllerImpl.loopUntil (UiControllerImpl.java:7)
at androidx.test.espresso.base.UiControllerImpl.loopUntil (UiControllerImpl.java:1)
at androidx.test.espresso.base.UiControllerImpl.injectMotionEvent (UiControllerImpl.java:5)
at androidx.test.espresso.action.MotionEvents.sendUp (MotionEvents.java:6)
at androidx.test.espresso.action.MotionEvents.sendUp (MotionEvents.java:1)
at androidx.test.espresso.action.Tap.sendSingleTap (Tap.java:5)
at androidx.test.espresso.action.Tap.-$$Nest$smsendSingleTap
at androidx.test.espresso.action.Tap$1.sendTap (Tap.java:1)
at androidx.test.espresso.action.GeneralClickAction.perform (GeneralClickAction.java:4)
at androidx.test.espresso.ViewInteraction$SingleExecutionViewAction.perform (ViewInteraction.java:2)
at androidx.test.espresso.ViewInteraction.doPerform (ViewInteraction.java:23)
at androidx.test.espresso.ViewInteraction.-$$Nest$mdoPerform
at androidx.test.espresso.ViewInteraction$1.call (ViewInteraction.java:6)
at androidx.test.espresso.ViewInteraction$1.call (ViewInteraction.java:1)
at java.util.concurrent.FutureTask.run (FutureTask.java:264)
at android.os.Handler.handleCallback (Handler.java:942)
at android.os.Handler.dispatchMessage (Handler.java:99)
at android.os.Looper.loopOnce (Looper.java:201)
at android.os.Looper.loop (Looper.java:288)
at android.app.ActivityThread.main (ActivityThread.java:7898)
at java.lang.reflect.Method.invoke
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:548)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:936)
If baseUrl is really missing this may lead to followup issues, however this maybe only 'happens' in gplay pre launch report without any real world scenario. A best solution may be to make baseUrl not nullable, but don't want to do this on short term before release..
Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
...for ConversationCreationActivity and ContactsActivityCompose
just a quick fix, this may not be the best solution!
Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
the bug was, that the sent text was overwritten with "" in restoreState.
With this fix the saved state is only applied when the input field is empty (which means there was nothing shared)
Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
Got join conversation to work
Unread message popup should work when entering a conversation now
"Delete All Messages" now works without breaking the initMessagePolling
linter
Signed-off-by: rapterjet2004 <juliuslinus1@gmail.com>
Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
This will fix to scroll to the last read message when a chat is opened.
Some refactorings were made that are not necessary for the fix (I tried to also show the "Unread messages" hint in the adapter but came to the conclusion this is not a good idea until chatkit is removed. Chatkit doesn't support to add some item in between but only at the end or start which will make it too complicated..)
Signed-off-by: Marcel Hibbe <dev@mhibbe.de>