Skip to content

Commit

Permalink
Fix - menu language changing when changing phone language
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandregpereira committed Aug 18, 2024
1 parent c0ece81 commit 80a03c0
Showing 1 changed file with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import br.alexandregpereira.hunter.domain.settings.GetAlternativeSourceJsonUrlUs
import br.alexandregpereira.hunter.domain.settings.GetMonsterImageJsonUrlUseCase
import br.alexandregpereira.hunter.domain.settings.SaveLanguageUseCase
import br.alexandregpereira.hunter.domain.settings.SaveUrlsUseCase
import br.alexandregpereira.hunter.localization.AppLocalization
import br.alexandregpereira.hunter.localization.AppReactiveLocalization
import br.alexandregpereira.hunter.localization.Language
import br.alexandregpereira.hunter.monster.content.event.MonsterContentManagerEvent.Show
import br.alexandregpereira.hunter.monster.content.event.MonsterContentManagerEventDispatcher
Expand Down Expand Up @@ -54,7 +54,7 @@ internal class SettingsStateHolder(
private val monsterEventDispatcher: MonsterEventDispatcher,
private val shareContentEventDispatcher: ShareContentEventDispatcher,
private val analytics: SettingsAnalytics,
private val appLocalization: AppLocalization,
private val appLocalization: AppReactiveLocalization,
private val saveLanguage: SaveLanguageUseCase,
private val getAppearanceSettings: GetAppearanceSettingsFromMonsters,
private val applyAppearanceSettings: ApplyAppearanceSettings,
Expand All @@ -65,9 +65,16 @@ internal class SettingsStateHolder(
private var originalSettingsState: SettingsState = SettingsState()

init {
observeLanguageChanges()
load()
}

private fun observeLanguageChanges() {
appLocalization.languageFlow.onEach {
load()
}.launchIn(scope)
}

override fun onImageBaseUrlChange(value: String) {
setState { copy(imageBaseUrl = value) }
}
Expand Down

0 comments on commit 80a03c0

Please sign in to comment.