Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[stable-20.0] Feature/4299/improve offline support #4355

Merged
merged 9 commits into from
Oct 22, 2024

Conversation

backportbot[bot]
Copy link

@backportbot backportbot bot commented Oct 21, 2024

Backport of PR #4300

@backportbot backportbot bot added the 3. to review Waiting for reviews label Oct 21, 2024
@backportbot backportbot bot added this to the 20.0.2 milestone Oct 21, 2024
@mahibi mahibi modified the milestones: 20.0.2, 20.0.3 Oct 22, 2024
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 <[email protected]>
delay progress bar for one second before showing up for slow connection

Signed-off-by: Marcel Hibbe <[email protected]>
…adMessage from conversation

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 <[email protected]>
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 <[email protected]>
Signed-off-by: Marcel Hibbe <[email protected]>
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 <[email protected]>
@mahibi mahibi enabled auto-merge October 22, 2024 08:42
@mahibi mahibi merged commit 2ab6111 into stable-20.0 Oct 22, 2024
11 of 14 checks passed
@mahibi mahibi deleted the backport/4300/stable-20.0 branch October 22, 2024 08:43
Copy link
Contributor

APK file: https://www.kaminsky.me/nc-dev/android-artifacts/4355-talk.apk

qrcode

To test this change/fix you can simply download above APK file and install and test it in parallel to your existing Nextcloud Talk app.

Copy link
Contributor

Codacy

Lint

TypemasterPR
Warnings9496
Errors132132

SpotBugs

CategoryBaseNew
Bad practice66
Correctness1111
Dodgy code7979
Internationalization33
Malicious code vulnerability33
Performance66
Security11
Total109109

Lint increased!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3. to review Waiting for reviews
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant