Skip to content

Commit f838118

Browse files
committed
設定画面の初期化処理を修正
1 parent 4af5683 commit f838118

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

AndroidApp/ui/src/main/kotlin/me/nya_n/notificationnotifier/ui/screen/settings/SettingsViewModel.kt

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import kotlinx.coroutines.flow.asStateFlow
88
import kotlinx.coroutines.flow.update
99
import kotlinx.coroutines.launch
1010
import me.nya_n.notificationnotifier.domain.usecase.ExportDataUseCase
11+
import me.nya_n.notificationnotifier.domain.usecase.GetUserSettingsUseCase
1112
import me.nya_n.notificationnotifier.domain.usecase.ImportDataUseCase
1213
import me.nya_n.notificationnotifier.domain.usecase.LoadAddressUseCase
1314
import 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

Comments
 (0)