REFACTOR: Break ChatViewModel into smaller specialized files

- Created ChatState.kt for centralized state management
- Created DataManager.kt for persistence operations
- Created MessageManager.kt for message handling and deduplication
- Created ChannelManager.kt for channel operations and encryption
- Created PrivateChatManager.kt for private chat functionality
- Created CommandProcessor.kt for IRC-style command processing

ChatViewModel.kt reduced from 1000+ lines to ~300 lines while maintaining 100% functionality.
All existing functionality preserved, just better organized.
This commit is contained in:
callebtc
2025-07-09 00:42:43 +02:00
parent 6d22aa7315
commit 56824b6594
9 changed files with 1732 additions and 1069 deletions
@@ -101,8 +101,8 @@ fun MessageInput(
@Composable
fun CommandSuggestionsBox(
suggestions: List<ChatViewModel.CommandSuggestion>,
onSuggestionClick: (ChatViewModel.CommandSuggestion) -> Unit,
suggestions: List<CommandSuggestion>,
onSuggestionClick: (CommandSuggestion) -> Unit,
modifier: Modifier = Modifier
) {
val colorScheme = MaterialTheme.colorScheme
@@ -113,7 +113,7 @@ fun CommandSuggestionsBox(
.border(1.dp, colorScheme.outline.copy(alpha = 0.3f), RoundedCornerShape(4.dp))
.padding(vertical = 8.dp)
) {
suggestions.forEach { suggestion ->
suggestions.forEach { suggestion: CommandSuggestion ->
CommandSuggestionItem(
suggestion = suggestion,
onClick = { onSuggestionClick(suggestion) }
@@ -124,7 +124,7 @@ fun CommandSuggestionsBox(
@Composable
fun CommandSuggestionItem(
suggestion: ChatViewModel.CommandSuggestion,
suggestion: CommandSuggestion,
onClick: () -> Unit
) {
val colorScheme = MaterialTheme.colorScheme