1)
Use session id returned from join room
= introduce sessionIdAfterRoomJoined to make clear this is the session to use instead of currentConversation?.sessionId
See https://nextcloud-talk.readthedocs.io/en/latest/conversation/#get-user-s-conversations :
"'0' if not connected, otherwise an up to 512 character long string that is the identifier of the user's session making the request. Should only be used to pre-check if the user joined already with this session, but this might be outdated by the time of usage, so better check via Get list of participants in a conversation"
2)
Also, trigger getRoomInfo() or handleFromNotification() in onAttach() instead of in onViewBound.
onViewBound is not called when returning back from an other view (e.g. conversation infos) so after this, new messages were not handled.
Furthermore, getRoomInfo()/joinRoomWithPassword() in onViewBound and onAttach were sometimes both called, because the handling of validSessionId was buggy. This resulted in duplicated messages.
3)
Use ApplicationWideCurrentRoomHolder to set sessionId from call and check in ChatController if there is already a session for the room. If yes, use this instead to joinRoom again.
This is necessary for PictureInPicture mode. Otherwise, call would be left whenever ChatController joins room again.
Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
avoid:
2023-03-01 16:47:40.443 23569-23628 UploadAndS...ilesWorker com.nextcloud.talk2 E Something went wrong when trying to upload file
java.lang.NullPointerException
at com.nextcloud.talk.jobs.UploadAndShareFilesWorker.showFailedToUploadNotification(UploadAndShareFilesWorker.kt:258)
at com.nextcloud.talk.jobs.UploadAndShareFilesWorker.doWork(UploadAndShareFilesWorker.kt:163)
at androidx.work.Worker$1.run(Worker.java:86)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:919)
2023-03-01 16:47:40.444 23569-23607 WM-WorkerWrapper com.nextcloud.talk2 E Work [ id=27e4e319-a966-4515-ac07-d6ad7ee68268, tags={ com.nextcloud.talk.jobs.UploadAndShareFilesWorker } ] failed because it threw an exception/error
java.util.concurrent.ExecutionException: java.lang.NullPointerException
at androidx.work.impl.utils.futures.AbstractFuture.getDoneValue(AbstractFuture.java:516)
at androidx.work.impl.utils.futures.AbstractFuture.get(AbstractFuture.java:475)
at androidx.work.impl.WorkerWrapper$2.run(WorkerWrapper.java:311)
at androidx.work.impl.utils.SerialExecutor$Task.run(SerialExecutor.java:91)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:919)
Caused by: java.lang.NullPointerException
at com.nextcloud.talk.jobs.UploadAndShareFilesWorker.showFailedToUploadNotification(UploadAndShareFilesWorker.kt:258)
at com.nextcloud.talk.jobs.UploadAndShareFilesWorker.doWork(UploadAndShareFilesWorker.kt:167)
at androidx.work.Worker$1.run(Worker.java:86)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:919)
2023-03-01 16:47:40.446 23569-23607 WM-WorkerWrapper com.nextcloud.talk2 I Worker result FAILURE for Work [ id=27e4e319-a966-
Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
2023-02-27 12:29:00.275 995-995 AndroidRuntime.........
java.lang.NullPointerException
at com.nextcloud.talk.controllers.ChatController.modifyMessageCount(ChatController.kt:2536)
at com.nextcloud.talk.controllers.ChatController.addMessagesToAdapter(ChatController.kt:2515)
at com.nextcloud.talk.controllers.ChatController.processMessagesFromTheFuture(ChatController.kt:2489)
at com.nextcloud.talk.controllers.ChatController.processMessages(ChatController.kt:2437)
at com.nextcloud.talk.controllers.ChatController.processMessagesResponse(ChatController.kt:2398)
at com.nextcloud.talk.controllers.ChatController.access$processMessagesResponse(ChatController.kt:221)
at com.nextcloud.talk.controllers.ChatController$pullChatMessages$2.onNext(ChatController.kt:2309)
at com.nextcloud.talk.controllers.ChatController$pullChatMessages$2.onNext(ChatController.kt:2294)
at io.reactivex.internal.operators.observable.ObservableObserveOn$ObserveOnObserver.drainNormal(ObservableObserveOn.java:201)
at io.reactivex.internal.operators.observable.ObservableObserveOn$ObserveOnObserver.run(ObservableObserveOn.java:255)
at io.reactivex.android.schedulers.HandlerScheduler$ScheduledRunnable.run(HandlerScheduler.java:124)
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:8741)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:571)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1067)
Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
...for preparation to replace Dialog that was openend in ChatController. It will be replaced by Notification Actions.
The dialog was not opened when already being in a chat, because remapChatController only moved the currentChatController to top so to won't be initialized again. That's why the dialog didn't pop up for this case.
As a solution, the actions should be available directly inside the notification.
For this, it must be avoided that the "recording available" notification is closed whenever the chat is opened.
Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
Otherwise following error was thrown:
Expected com.nextcloud.talk.viewmodels.CallRecordingViewModel$RecordingStartingState@5f78de22 but encountered com.nextcloud.talk.viewmodels.CallRecordingViewModel$RecordingStartingState@516ebdf8
com.vividsolutions.jts.util.AssertionFailedException: Expected com.nextcloud.talk.viewmodels.CallRecordingViewModel$RecordingStartingState@5f78de22 but encountered com.nextcloud.talk.viewmodels.CallRecordingViewModel$RecordingStartingState@516ebdf8
at app//com.vividsolutions.jts.util.Assert.equals(Assert.java:100)
at app//com.vividsolutions.jts.util.Assert.equals(Assert.java:85)
at app//com.nextcloud.talk.viewmodels.CallRecordingViewModelTest.testCallRecordingViewModel_clickStartRecord(CallRecordingViewModelTest.kt:25)
at java.base@11.0.15/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
more call recording states are:
3 = Starting video recording
4 = Starting audio recording
5 = Recording failed
these actions were added:
- Show grey recording icon to moderators if recording is starting
- Show toast to moderators if recording failed
- Add system message for recording failed
Signed-off-by: Marcel Hibbe <dev@mhibbe.de>