Skip to content
This repository has been archived by the owner on Nov 9, 2023. It is now read-only.

Commit

Permalink
HomePage: mark changelog as shown before dismissing dialog
Browse files Browse the repository at this point in the history
Signed-off-by: Lucchetto <[email protected]>
  • Loading branch information
Lucchetto committed Feb 17, 2023
1 parent cff5ebc commit 82979c6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ fun HomePage(viewModel: HomePageViewModel, navController: NavHostController) {
}

val showChangelogState by viewModel.showChangelogFlow.collectAsStateWithLifecycle()
ChangelogDialog(showChangelogState) { viewModel.changelogShown() }
ChangelogDialog(showChangelogState) { viewModel.showChangelogFlow.tryEmit(Changelog.Hide) }
}

@Composable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ class HomePageViewModel(application: Application): AndroidViewModel(application)
if (runBlocking { AppVersionUtils.shouldShowChangelog(dataStore) }) {
showChangelogFlow = MutableStateFlow(Changelog.Loading)
viewModelScope.launch(Dispatchers.IO) {
AppVersionUtils.clearShowChangelog(dataStore)
showChangelogFlow.tryEmit(readChangelog())
}
} else {
Expand Down Expand Up @@ -171,11 +172,6 @@ class HomePageViewModel(application: Application): AndroidViewModel(application)
Timber.wtf(e)
Changelog.Hide
}

fun changelogShown() {
showChangelogFlow.tryEmit(Changelog.Hide)
viewModelScope.launch { AppVersionUtils.clearShowChangelog(dataStore) }
}
}

private fun RealESRGANWorker.InputData.toInputImage(context: Context) = with(RealESRGANWorkerManager.getTempFile(context, tempFileName)) {
Expand Down

0 comments on commit 82979c6

Please sign in to comment.