mirror of
https://github.com/permissionlesstech/bitchat-android.git
synced 2026-07-25 07:25:20 +00:00
refactor: remove context attribute at ChatViewModel.kt
This commit is contained in:
@@ -24,14 +24,12 @@ class ChatViewModel(
|
|||||||
application: Application,
|
application: Application,
|
||||||
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 }
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user