File tree Expand file tree Collapse file tree 2 files changed +9
-1
lines changed
app/src/main/java/to/bitkit Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,8 @@ import dagger.Module
55import dagger.Provides
66import dagger.hilt.InstallIn
77import dagger.hilt.components.SingletonComponent
8+ import kotlinx.coroutines.CoroutineScope
9+ import to.bitkit.ui.shared.toast.ToastQueueManager
810import javax.inject.Singleton
911
1012@Module
@@ -15,4 +17,9 @@ object ViewModelModule {
1517 fun provideFirebaseMessaging (): FirebaseMessaging {
1618 return FirebaseMessaging .getInstance()
1719 }
20+
21+ @Provides
22+ fun provideToastManagerProvider (): (CoroutineScope ) -> ToastQueueManager {
23+ return ::ToastQueueManager
24+ }
1825}
Original file line number Diff line number Diff line change @@ -126,6 +126,7 @@ class AppViewModel @Inject constructor(
126126 private val appUpdaterService : AppUpdaterService ,
127127 private val notifyPaymentReceivedHandler : NotifyPaymentReceivedHandler ,
128128 private val cacheStore : CacheStore ,
129+ private val toastManagerProvider : @JvmSuppressWildcards (CoroutineScope ) -> ToastQueueManager ,
129130) : ViewModel() {
130131 val healthState = healthRepo.healthState
131132
@@ -1522,7 +1523,7 @@ class AppViewModel @Inject constructor(
15221523 // endregion
15231524
15241525 // region Toasts
1525- private val toastManager = ToastQueueManager (viewModelScope)
1526+ private val toastManager = toastManagerProvider (viewModelScope)
15261527 val currentToast: StateFlow <Toast ?> = toastManager.currentToast
15271528
15281529 fun toast (
You can’t perform that action at this time.
0 commit comments