Files
aiturk-mobil/app/src/main/java
M57 3aa40414e6 refactor(chat): extract ChatSearchDelegate from ChatViewModel (#486)
* refactor(chat): extract ChatSearchDelegate from ChatViewModel god-object

Move the 4 search methods (toggleSearch/setSearchQuery/navigateSearchMatch/
clearSearch) + searchJob field into a dedicated ChatSearchDelegate that owns the
chat-search state transitions against the shared _uiState flow. ChatViewModel
keeps thin one-line delegating wrappers so its public API (used by ChatScreen)
is unchanged.

This is the first separable slice of the ChatViewModel god-object (1421 LOC,
47 funcs). Streaming/session/WS clusters are intentionally left in place - they
are entangled and will be addressed separately to avoid splitting one logical
op across classes.

Verified: ktlintCheck PASS, compileDebugKotlin PASS (local SDK).

* refactor(chat): extract ChatAttachmentsDelegate from ChatViewModel

Move addAttachment/removeAttachment/clearAttachments into a dedicated
ChatAttachmentsDelegate that owns pendingAttachments state transitions against
the shared _uiState flow. ChatViewModel keeps 3 one-line delegating wrappers -
public API unchanged. Read sites (sendMessage) already read pendingAttachments
straight off uiState, so no delegate read API needed.

Second separable slice of the ChatViewModel god-object (after #486 search).

Verified: ktlintCheck PASS, compileDebugKotlin PASS (local SDK).

* refactor(chat): address Sourcery review on search extraction

- Inject the CoroutineDispatcher into ChatSearchDelegate instead of
  hardcoding Dispatchers.Default (defaults to Dispatchers.Default so
  behavior is unchanged; now customizable per environment).
- Group the four search delegating methods in ChatViewModel under a
  'Compatibility façade' comment marking them as the transitional API
  surface around ChatSearchDelegate.
2026-07-07 23:55:28 +03:00
..