Created
December 15, 2020 08:15
-
-
Save AlexGladkov/e4d1fee50e778d7d2ecaf71fc330789e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// Module | |
@Module | |
class SharedModule { | |
@Provides | |
fun provideConfigurationRepository(context: Context): ConfigurationRepository = | |
ConfigurationRepository( | |
localDataSource = CommonConfigurationDataSource(context), | |
remoteDataSource = MockConfigurationDataSource() | |
) | |
} | |
/// View Model function | |
private fun checkOpenedQuest() { | |
viewModelScope.launch { | |
val userConfiguration = configurationRepository.fetchConfiguration() | |
if (userConfiguration.currentQuestId >= 0) { | |
viewAction = QuestListAction.OpenQuestPage( | |
questId = userConfiguration.currentQuestId.toInt(), | |
questPage = userConfiguration.currentQuestPage.toInt() | |
) | |
} else { | |
fetchQuestList() | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment