@@ -8,6 +8,7 @@ import kotlinx.coroutines.flow.asStateFlow
88import kotlinx.coroutines.flow.update
99import kotlinx.coroutines.launch
1010import me.nya_n.notificationnotifier.domain.usecase.ExportDataUseCase
11+ import me.nya_n.notificationnotifier.domain.usecase.GetUserSettingsUseCase
1112import me.nya_n.notificationnotifier.domain.usecase.ImportDataUseCase
1213import me.nya_n.notificationnotifier.domain.usecase.LoadAddressUseCase
1314import me.nya_n.notificationnotifier.domain.usecase.NotifyUseCase
@@ -24,6 +25,7 @@ class SettingsViewModel(
2425 private val saveAddressUseCase : SaveAddressUseCase ,
2526 private val notifyUseCase : NotifyUseCase ,
2627 private val saveWifiOnlyNotificationSettingUseCase : SaveWifiOnlyNotificationSettingUseCase ,
28+ private val getUserSettingsUseCase : GetUserSettingsUseCase ,
2729 private val exportDataUseCase : ExportDataUseCase ,
2830 private val importDataUseCase : ImportDataUseCase
2931) : BaseViewModel<UiEvent>() {
@@ -34,7 +36,13 @@ class SettingsViewModel(
3436
3537 init {
3638 viewModelScope.launch {
37- _uiState .update { it.copy(address = loadAddressUseCase()) }
39+ val userSettings = getUserSettingsUseCase()
40+ _uiState .update {
41+ it.copy(
42+ address = loadAddressUseCase(),
43+ isWifiOnlyNotificationEnabled = userSettings.isWifiOnlyNotificationEnabled
44+ )
45+ }
3846 }
3947 }
4048
0 commit comments