mirror of
https://github.com/permissionlesstech/bitchat-android.git
synced 2026-07-25 00:25:20 +00:00
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:
@@ -112,7 +112,7 @@ fun ChatScreen(viewModel: ChatViewModel) {
|
||||
// Input area - stays at bottom
|
||||
ChatInputSection(
|
||||
messageText = messageText,
|
||||
onMessageTextChange = { newText ->
|
||||
onMessageTextChange = { newText: String ->
|
||||
messageText = newText
|
||||
viewModel.updateCommandSuggestions(newText)
|
||||
},
|
||||
@@ -124,7 +124,7 @@ fun ChatScreen(viewModel: ChatViewModel) {
|
||||
},
|
||||
showCommandSuggestions = showCommandSuggestions,
|
||||
commandSuggestions = commandSuggestions,
|
||||
onSuggestionClick = { suggestion ->
|
||||
onSuggestionClick = { suggestion: CommandSuggestion ->
|
||||
messageText = viewModel.selectCommandSuggestion(suggestion)
|
||||
},
|
||||
selectedPrivatePeer = selectedPrivatePeer,
|
||||
@@ -199,8 +199,8 @@ private fun ChatInputSection(
|
||||
onMessageTextChange: (String) -> Unit,
|
||||
onSend: () -> Unit,
|
||||
showCommandSuggestions: Boolean,
|
||||
commandSuggestions: List<ChatViewModel.CommandSuggestion>,
|
||||
onSuggestionClick: (ChatViewModel.CommandSuggestion) -> Unit,
|
||||
commandSuggestions: List<CommandSuggestion>,
|
||||
onSuggestionClick: (CommandSuggestion) -> Unit,
|
||||
selectedPrivatePeer: String?,
|
||||
currentChannel: String?,
|
||||
nickname: String,
|
||||
|
||||
Reference in New Issue
Block a user