followup to PR #4439
Exception java.lang.NullPointerException:
at com.nextcloud.talk.chat.MessageInputFragment.handleMessageQueue (MessageInputFragment.kt:251)
at com.nextcloud.talk.chat.MessageInputFragment.access$handleMessageQueue (MessageInputFragment.kt:82)
at com.nextcloud.talk.chat.MessageInputFragment$initObservers$4$1.invokeSuspend (MessageInputFragment.kt:192)
at com.nextcloud.talk.chat.MessageInputFragment$initObservers$4$1.invoke (Unknown Source:12)
at com.nextcloud.talk.chat.MessageInputFragment$initObservers$4$1.invoke (Unknown Source:8)
at kotlinx.coroutines.flow.FlowKt__TransformKt$onEach$$inlined$unsafeTransform$1$2.emit (Emitters.kt:219)
at kotlinx.coroutines.flow.FlowKt__ChannelsKt.emitAllImpl$FlowKt__ChannelsKt (Channels.kt:33)
at kotlinx.coroutines.flow.FlowKt__ChannelsKt.access$emitAllImpl$FlowKt__ChannelsKt (Channels.kt:1)
at kotlinx.coroutines.flow.FlowKt__ChannelsKt$emitAllImpl$1.invokeSuspend (Unknown Source:14)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith (ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run (DispatchedTask.kt:104)
at android.os.Handler.handleCallback (Handler.java:938)
at android.os.Handler.dispatchMessage (Handler.java:99)
at android.os.Looper.loopOnce (Looper.java:241)
at android.os.Looper.loop (Looper.java:342)
at android.app.ActivityThread.main (ActivityThread.java:8128)
at java.lang.reflect.Method.invoke
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:583)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1045)
Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
As the number of provided emojis grew, there was a bug that only one emoji was shown.
Putting all 12 emojis would have been too close, so it's implemented to scroll them horizontally
Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
however i was not able to see onDestroy being executed.
anyway, disposables won't be necessary when coroutine is used.
also: remove a useless outdated log line
Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
The request seems to cause problems so blockingSubscribe doesn't seem to be a good choice here. This commit will replace blockingSubscribe by subscribe and modify the related code in order to be executed when the request succeeds.
The root cause why the request seems to cause problems may have to be analyzed further.
I was not able to reproduce the ANR without this PR, however the following error was reported on gplay console very often!:
at jdk.internal.misc.Unsafe.park (Native method)
at java.util.concurrent.locks.LockSupport.park (LockSupport.java:341)
at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionNode.block (AbstractQueuedSynchronizer.java:506)
at java.util.concurrent.ForkJoinPool.unmanagedBlock (ForkJoinPool.java:3466)
at java.util.concurrent.ForkJoinPool.managedBlock (ForkJoinPool.java:3437)
at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await (AbstractQueuedSynchronizer.java:1623)
at java.util.concurrent.LinkedBlockingQueue.take (LinkedBlockingQueue.java:435)
at io.reactivex.internal.operators.observable.ObservableBlockingSubscribe.subscribe (ObservableBlockingSubscribe.java:56)
at io.reactivex.Observable.blockingSubscribe (Observable.java:5552)
at com.nextcloud.talk.chat.ChatActivity.setupWebsocket (ChatActivity.kt:2445)
at com.nextcloud.talk.chat.ChatActivity.joinRoomWithPassword (ChatActivity.kt:2402)
at com.nextcloud.talk.chat.ChatActivity.initObservers$lambda$13 (ChatActivity.kt:594)
at com.nextcloud.talk.chat.ChatActivity.$r8$lambda$QKH5JCFLmCzRMlSJ-EV-m4IW5ig (unavailable)
at com.nextcloud.talk.chat.ChatActivity$$ExternalSyntheticLambda38.invoke (D8$$SyntheticClass)
at com.nextcloud.talk.chat.ChatActivity$sam$androidx_lifecycle_Observer$0.onChanged (unavailable:2)
at androidx.lifecycle.LiveData.considerNotify (LiveData.java:133)
at androidx.lifecycle.LiveData.dispatchingValue (LiveData.java:151)
at androidx.lifecycle.LiveData.setValue (LiveData.java:309)
at androidx.lifecycle.MutableLiveData.setValue (MutableLiveData.java:50)
at com.nextcloud.talk.chat.viewmodels.ChatViewModel.getCapabilities (ChatViewModel.kt:240)
at com.nextcloud.talk.chat.ChatActivity$initObservers$1$1.invokeSuspend (ChatActivity.kt:553)
at com.nextcloud.talk.chat.ChatActivity$initObservers$1$1.invoke (unavailable:8)
at com.nextcloud.talk.chat.ChatActivity$initObservers$1$1.invoke (unavailable:4)
at kotlinx.coroutines.flow.FlowKt__TransformKt$onEach$$inlined$unsafeTransform$1$2.emit (Emitters.kt:219)
at kotlinx.coroutines.flow.FlowKt__ErrorsKt$catchImpl$2.emit (Errors.kt:154)
at kotlinx.coroutines.flow.FlowKt__TransformKt$onEach$$inlined$unsafeTransform$1$2.emit (Emitters.kt:220)
at kotlinx.coroutines.flow.SharedFlowImpl.collect$suspendImpl (SharedFlow.kt:392)
at kotlinx.coroutines.flow.SharedFlowImpl$collect$1.invokeSuspend (unavailable:15)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith (ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run (DispatchedTask.kt:104)
at android.os.Handler.handleCallback (Handler.java:938)
at android.os.Handler.dispatchMessage (Handler.java:99)
at android.os.Looper.loopOnce (Looper.java:210)
at android.os.Looper.loop (Looper.java:299)
at android.app.ActivityThread.main (ActivityThread.java:8168)
at java.lang.reflect.Method.invoke (Native method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:556)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1037)
Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
As remote server is empty instead null when not available, the check was also true when no remote server was in use.
Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
when adapter has no items adapter!!.items[1].item will crash with IndexOutOfBoundsException
This could happen e.g. when chat history is cleared.
error was:
Exception java.lang.IndexOutOfBoundsException: Index 1 out of bounds for length 0
at jdk.internal.util.Preconditions.outOfBounds (Preconditions.java:64)
at jdk.internal.util.Preconditions.outOfBoundsCheckIndex (Preconditions.java:70)
at jdk.internal.util.Preconditions.checkIndex (Preconditions.java:266)
at java.util.Objects.checkIndex (Objects.java:359)
at java.util.ArrayList.get (ArrayList.java:434)
at com.nextcloud.talk.chat.ChatActivity.processMessagesFromTheFuture (ChatActivity.kt:2666)
at com.nextcloud.talk.chat.ChatActivity.access$processMessagesFromTheFuture (ChatActivity.kt:209)
at com.nextcloud.talk.chat.ChatActivity$initObservers$12$1.invokeSuspend (ChatActivity.kt:875)
at com.nextcloud.talk.chat.ChatActivity$initObservers$12$1.invoke (Unknown Source:8)
at com.nextcloud.talk.chat.ChatActivity$initObservers$12$1.invoke (Unknown Source:4)
at kotlinx.coroutines.flow.FlowKt__TransformKt$onEach$$inlined$unsafeTransform$1$2.emit (Emitters.kt:219)
at kotlinx.coroutines.flow.FlowKt__ErrorsKt$catchImpl$2.emit (Errors.kt:154)
at kotlinx.coroutines.flow.FlowKt__TransformKt$onEach$$inlined$unsafeTransform$1$2.emit (Emitters.kt:220)
at kotlinx.coroutines.flow.SharedFlowImpl.collect$suspendImpl (SharedFlow.kt:392)
at kotlinx.coroutines.flow.SharedFlowImpl$collect$1.invokeSuspend (Unknown Source:15)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith (ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run (DispatchedTask.kt:104)
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:7932)
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:942)
Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
When messages were sorted out in handleSystemMessages it can happen that the chatMessageList is empty. Because setUnreadMessageMarker accessed chatMessageList[0] this crashed.
This can happen e.g. when only a reaction to a chat message was made before opening the chat.
Exception java.lang.IndexOutOfBoundsException: Empty list doesn't contain element at index 0.
at kotlin.collections.EmptyList.get (Collections.kt:37)
at kotlin.collections.EmptyList.get (Collections.kt:25)
at com.nextcloud.talk.chat.ChatActivity.setUnreadMessageMarker (ChatActivity.kt:2691)
at com.nextcloud.talk.chat.ChatActivity.processMessagesFromTheFuture (ChatActivity.kt:2651)
at com.nextcloud.talk.chat.ChatActivity.access$processMessagesFromTheFuture (ChatActivity.kt:209)
at com.nextcloud.talk.chat.ChatActivity$initObservers$12$1.invokeSuspend (ChatActivity.kt:875)
at com.nextcloud.talk.chat.ChatActivity$initObservers$12$1.invoke (Unknown Source:8)
at com.nextcloud.talk.chat.ChatActivity$initObservers$12$1.invoke (Unknown Source:4)
at kotlinx.coroutines.flow.FlowKt__TransformKt$onEach$$inlined$unsafeTransform$1$2.emit (Emitters.kt:219)
at kotlinx.coroutines.flow.FlowKt__ErrorsKt$catchImpl$2.emit (Errors.kt:154)
at kotlinx.coroutines.flow.FlowKt__TransformKt$onEach$$inlined$unsafeTransform$1$2.emit (Emitters.kt:220)
at kotlinx.coroutines.flow.SharedFlowImpl.collect$suspendImpl (SharedFlow.kt:392)
at kotlinx.coroutines.flow.SharedFlowImpl$collect$1.invokeSuspend (Unknown Source:15)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith (ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run (DispatchedTask.kt:104)
at android.os.Handler.handleCallback (Handler.java:942)
at android.os.Handler.dispatchMessage (Handler.java:99)
at android.os.Looper.loopOnce (Looper.java:226)
at android.os.Looper.loop (Looper.java:313)
at android.app.ActivityThread.main (ActivityThread.java:8762)
at java.lang.reflect.Method.invoke
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:604)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1067)
Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
currentConversation was not yet initialized in ChatActivity.
In the future this may be better handled via StateFlows. For now it's solved via arguments.
Without the fix, this NPE appeared:
Exception java.lang.RuntimeException:
at android.app.ActivityThread.performResumeActivity (ActivityThread.java:4768)
at android.app.ActivityThread.handleResumeActivity (ActivityThread.java:4801)
at android.app.servertransaction.ResumeActivityItem.execute (ResumeActivityItem.java:54)
at android.app.servertransaction.ActivityTransactionItem.execute (ActivityTransactionItem.java:45)
at android.app.servertransaction.TransactionExecutor.executeLifecycleState (TransactionExecutor.java:176)
at android.app.servertransaction.TransactionExecutor.execute (TransactionExecutor.java:97)
at android.app.ActivityThread$H.handleMessage (ActivityThread.java:2215)
at android.os.Handler.dispatchMessage (Handler.java:106)
at android.os.Looper.loopOnce (Looper.java:346)
at android.os.Looper.loop (Looper.java:475)
at android.app.ActivityThread.main (ActivityThread.java:7889)
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:1009)
Caused by java.lang.NullPointerException:
at com.nextcloud.talk.chat.MessageInputFragment.onResume (MessageInputFragment.kt:146)
at androidx.fragment.app.Fragment.performResume (Fragment.java:3180)
at androidx.fragment.app.FragmentStateManager.resume (FragmentStateManager.java:606)
at androidx.fragment.app.FragmentStateManager.moveToExpectedState (FragmentStateManager.java:285)
at androidx.fragment.app.FragmentStore.moveToExpectedState (FragmentStore.java:113)
at androidx.fragment.app.FragmentManager.moveToState (FragmentManager.java:1433)
at androidx.fragment.app.FragmentManager.dispatchStateChange (FragmentManager.java:2977)
at androidx.fragment.app.FragmentManager.dispatchResume (FragmentManager.java:2909)
at androidx.fragment.app.FragmentController.dispatchResume (FragmentController.java:285)
at androidx.fragment.app.FragmentActivity.onResumeFragments (FragmentActivity.java:334)
at androidx.fragment.app.FragmentActivity.onPostResume (FragmentActivity.java:323)
at androidx.appcompat.app.AppCompatActivity.onPostResume (AppCompatActivity.java:245)
at android.app.Activity.performResume (Activity.java:8215)
at android.app.ActivityThread.performResumeActivity (ActivityThread.java:4758)
Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
For archived conversations, require "-v2".
This is done because on server api, "archived-conversations" was already released for 20.0.2 by mistake which should have only be done for 20.1
As it's planned to release android talk 20.0.3 with a fresh master state, the archived conversations feature must be hidden manually, This is done by required "-v2".
Either it's served as this in the future or it can be removed for the 20.1.0 release.
Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
only more complex checks should be made in CapabilitiesUtil, just checking a capability should be done directly via hasSpreedFeatureCapability
Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
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>