Commit Graph
7 Commits
Author SHA1 Message Date
Narasimha-sc 6e3c668fb9 ios, android, desktop: do not add loaded items of another chat to the opened chat (#7450)
* ios, android, desktop: do not add loaded items of another chat to the opened chat

apiLoadMessages could apply a loaded page to a chat it was not loaded for,
mixing messages of two chats in one list:

- the chat id was not checked at all for .last pagination, and the loading
  coroutine is not cancelled when the chat is closed (PreloadItems wraps it
  into NonCancellable, apiFindMessages runs in a scope of its own), so a .last
  page loaded for the previously opened chat was appended to the items of the
  chat opened while it was loading;
- for the other paginations the chat id was checked before the items were
  loaded, but they are applied on the main thread after a dispatch, so the chat
  could be switched in between.

Check the chat id (and the remote host id in kotlin) right before the items are
applied, in every pagination except .initial and opening around item that set
chat id themselves. Empty chatItems remain allowed for .last that is used for
searching.

* android, desktop: test that loaded items of another chat are not added to the opened chat

Reproduces the bug deterministically, without depending on the timing of the
race: processLoadedChat is called with a page loaded for another chat while the
opened chat has its own items.

Without the fix the items of the two chats end up in one list:

    lastPageLoadedForAnotherChatIsNotAddedToOpenedChat
      expected:<[101, 102]> but was:<[101, 102, 201, 202]>
    beforePageLoadedForAnotherChatIsNotAddedToOpenedChat
      expected:<[101, 102]> but was:<[201, 202, 101, 102]>
    aroundPageLoadedForAnotherChatIsNotAddedToOpenedChat
      expected:<[101, 102]> but was:<[101, 102, 201, 202]>
2026-09-05 15:28:00 +01:00
Evgeny a87f0772c8 ios: content filter in chats (#6590)
* ios: content filter in chats

* allowed content types

* icons
2026-01-23 12:50:44 +00:00
spaced4ndy 32fb5a5d12 ios: knocking ui (#5851)
* ios: knocking ui types

* update types

* member admission

* remove chatItemStatuses

* member support view

* member support chat view wip

* ios: secondary ItemsModel (#5862)

* toolbar

* more chats

* remove theme

* preview icon

* chat toolbar fast markers

* change icon

* change icon

* remove/accept buttons

* item style

* get item ItemsModel in chat model methods (chat view doesn't work dynamically)

* fix support chat

* fix other chats

* refresh on exit

* refresh button

* dynamic marker in chat list

* prohibit multi select actions

* prohibited send field
2025-05-04 22:27:20 +01:00
Stanislav DmitrenkoandEvgeny Poberezkin 364aa667ad ios: scrolling improvements (#5746)
* ios: scrolling improvements

* changes

* fixes

* fix

* private

---------

Co-authored-by: Evgeny Poberezkin <evgeny@poberezkin.com>
2025-03-13 22:36:45 +00:00
Stanislav Dmitrenko fefddb3b5a ios: go to forwarded item or search result (#5679)
* ios: go to forwarded item or search result

* react on touch

* changes
2025-02-28 14:45:24 +00:00
Stanislav DmitrenkoandEvgeny Poberezkin dc980ae88f ios: loading progress moved to chat list (#5639)
* ios: loading progress moved to chat list

* place

* changes

* large spinner, smaller timeout

---------

Co-authored-by: Evgeny Poberezkin <evgeny@poberezkin.com>
2025-02-19 16:13:20 +00:00
Stanislav DmitrenkoandEvgeny Poberezkin 9d1329498b ios: open chat on first unread, "scroll" to quoted items that were not loaded (#5392)
* ios: open chat on first unread, "scroll" to quoted items that were not loaded

* more changes

* changes

* unused

* fix reveal logic

* debug

* changes

* test

* Revert "test"

This reverts commit 553be124d5.

* change

* change

* changes

* changes

* changes

* commented deceleration logic

* changes

* fixes

* optimized item identifiers to use merged item directly

* fixed counters

* encreased initial and preload counters

* fix initial loading and trimming items

* optimize

* allow marking read

* 10 instead of 5

* performance

* one more parameter in hash

* disable trimming

* performance

* performance - in background

* optimization

* next/prev

* changes

* markread

* finally

* less logs

* read

* change after merge

* trimming, edge cases

* wait until items loaded

* Revert "wait until items loaded"

This reverts commit 895218b978.

* progress indicator

* optimization

* disable scroll helper

* experiment

* Revert "experiment"

This reverts commit c952c9e623.

* jump

* no read

* layoutIfNeeded

* changes

* EndlessScrollView

* read

* changes

* changes

* changes

* reduce time to open a chat (by ~300ms)

* open from the first unread when clicking member chat

* refactored and removed unused code

* handling search emptiness to scroll to correct position

* changes

* read state maintain

* remove protocol

* avoid parsing chatId

* pass chat

* changes

* remove reveal

* refactor spaghetti

* remove ItemsScrollModel

* rename

* remove setUpdateListener

* unused

* optimization

* scrollToTop

* fix

* scrollbar working again

* scrollToBottom

* fix

* scrollBar hiding when not many items on screen

* small safer change

---------

Co-authored-by: Evgeny Poberezkin <evgeny@poberezkin.com>
2025-02-17 18:21:40 +00:00