refactor: remove context attribute at ChatViewModel.kt

This commit is contained in:
alpermelkeli
2025-07-16 18:30:26 +03:00
parent 013f0c00cf
commit eb575182c6
@@ -25,13 +25,11 @@ class ChatViewModel(
val meshService: BluetoothMeshService val meshService: BluetoothMeshService
) : AndroidViewModel(application), BluetoothMeshDelegate { ) : AndroidViewModel(application), BluetoothMeshDelegate {
private val context: Context = application.applicationContext
// State management // State management
private val state = ChatState() private val state = ChatState()
// Specialized managers // Specialized managers
private val dataManager = DataManager(context) private val dataManager = DataManager(application.applicationContext)
private val messageManager = MessageManager(state) private val messageManager = MessageManager(state)
private val channelManager = ChannelManager(state, messageManager, dataManager, viewModelScope) private val channelManager = ChannelManager(state, messageManager, dataManager, viewModelScope)
val privateChatManager = PrivateChatManager(state, messageManager, dataManager) val privateChatManager = PrivateChatManager(state, messageManager, dataManager)
@@ -46,7 +44,7 @@ class ChatViewModel(
privateChatManager = privateChatManager, privateChatManager = privateChatManager,
notificationManager = notificationManager, notificationManager = notificationManager,
coroutineScope = viewModelScope, coroutineScope = viewModelScope,
onHapticFeedback = { ChatViewModelUtils.triggerHapticFeedback(context) }, onHapticFeedback = { ChatViewModelUtils.triggerHapticFeedback(application.applicationContext) },
getMyPeerID = { meshService.myPeerID } getMyPeerID = { meshService.myPeerID }
) )