|
1 | 1 | package to.bitkit.ui.screens.transfer.external |
2 | 2 |
|
3 | | -import android.content.Context |
4 | 3 | import androidx.lifecycle.ViewModel |
5 | 4 | import androidx.lifecycle.viewModelScope |
6 | 5 | import dagger.hilt.android.lifecycle.HiltViewModel |
7 | | -import dagger.hilt.android.qualifiers.ApplicationContext |
8 | 6 | import kotlinx.coroutines.flow.MutableSharedFlow |
9 | 7 | import kotlinx.coroutines.flow.MutableStateFlow |
10 | 8 | import kotlinx.coroutines.flow.asSharedFlow |
@@ -35,7 +33,6 @@ import javax.inject.Inject |
35 | 33 | @Suppress("LongParameterList") |
36 | 34 | @HiltViewModel |
37 | 35 | class ExternalNodeViewModel @Inject constructor( |
38 | | - @ApplicationContext private val context: Context, |
39 | 36 | private val walletRepo: WalletRepo, |
40 | 37 | private val lightningRepo: LightningRepo, |
41 | 38 | private val settingsStore: SettingsStore, |
@@ -98,15 +95,13 @@ class ExternalNodeViewModel @Inject constructor( |
98 | 95 | val maxAmount = _uiState.value.amount.max |
99 | 96 |
|
100 | 97 | if (sats > maxAmount) { |
101 | | - viewModelScope.launch { |
102 | | - toaster.error( |
103 | | - title = ToastText(R.string.lightning__spending_amount__error_max__title), |
104 | | - body = ToastText( |
105 | | - context.getString(R.string.lightning__spending_amount__error_max__description) |
106 | | - .replace("{amount}", maxAmount.formatToModernDisplay()) |
107 | | - ), |
108 | | - ) |
109 | | - } |
| 98 | + toaster.error( |
| 99 | + title = ToastText(R.string.lightning__spending_amount__error_max__title), |
| 100 | + body = ToastText( |
| 101 | + R.string.lightning__spending_amount__error_max__description, |
| 102 | + mapOf("amount" to maxAmount.formatToModernDisplay()), |
| 103 | + ), |
| 104 | + ) |
110 | 105 | return |
111 | 106 | } |
112 | 107 |
|
@@ -193,8 +188,8 @@ class ExternalNodeViewModel @Inject constructor( |
193 | 188 | toaster.error( |
194 | 189 | title = ToastText(R.string.lightning__error_channel_purchase), |
195 | 190 | body = ToastText( |
196 | | - context.getString(R.string.lightning__error_channel_setup_msg) |
197 | | - .replace("{raw}", error) |
| 191 | + R.string.lightning__error_channel_setup_msg, |
| 192 | + mapOf("raw" to error), |
198 | 193 | ), |
199 | 194 | ) |
200 | 195 | } |
|
0 commit comments