From 12cc03f3497da8520521543002ed8b191c6738cc Mon Sep 17 00:00:00 2001 From: Rafael Date: Thu, 3 Oct 2024 18:18:12 +0600 Subject: [PATCH] Fix showing ReleaseNotes ui bug --- app/build.gradle | 2 +- .../bankwallet/modules/main/MainFragment.kt | 1 + .../bankwallet/modules/main/MainViewModel.kt | 1 - .../modules/releasenotes/ReleaseNotesFragment.kt | 7 ++----- .../bankwallet/modules/releasenotes/ReleaseNotesModule.kt | 1 + .../modules/releasenotes/ReleaseNotesViewModel.kt | 6 ++++++ 6 files changed, 11 insertions(+), 7 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 4287d4c3105..92ed0edd8dc 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -19,7 +19,7 @@ android { compileSdk compile_sdk_version minSdkVersion min_sdk_version targetSdkVersion compile_sdk_version - versionCode 117 + versionCode 118 versionName "0.40.0" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" diff --git a/app/src/main/java/io/horizontalsystems/bankwallet/modules/main/MainFragment.kt b/app/src/main/java/io/horizontalsystems/bankwallet/modules/main/MainFragment.kt index 807d11c9001..51fcefd1bf2 100644 --- a/app/src/main/java/io/horizontalsystems/bankwallet/modules/main/MainFragment.kt +++ b/app/src/main/java/io/horizontalsystems/bankwallet/modules/main/MainFragment.kt @@ -247,6 +247,7 @@ private fun MainScreen( R.id.releaseNotesFragment, ReleaseNotesFragment.Input(true) ) + viewModel.whatsNewShown() } } diff --git a/app/src/main/java/io/horizontalsystems/bankwallet/modules/main/MainViewModel.kt b/app/src/main/java/io/horizontalsystems/bankwallet/modules/main/MainViewModel.kt index e767b786dd3..0927b5271ec 100644 --- a/app/src/main/java/io/horizontalsystems/bankwallet/modules/main/MainViewModel.kt +++ b/app/src/main/java/io/horizontalsystems/bankwallet/modules/main/MainViewModel.kt @@ -171,7 +171,6 @@ class MainViewModel( fun whatsNewShown() { showWhatsNew = false - releaseNotesManager.updateShownAppVersion() emitState() } diff --git a/app/src/main/java/io/horizontalsystems/bankwallet/modules/releasenotes/ReleaseNotesFragment.kt b/app/src/main/java/io/horizontalsystems/bankwallet/modules/releasenotes/ReleaseNotesFragment.kt index 923ae67b352..7a59b72b638 100644 --- a/app/src/main/java/io/horizontalsystems/bankwallet/modules/releasenotes/ReleaseNotesFragment.kt +++ b/app/src/main/java/io/horizontalsystems/bankwallet/modules/releasenotes/ReleaseNotesFragment.kt @@ -24,8 +24,6 @@ import androidx.navigation.NavController import io.horizontalsystems.bankwallet.R import io.horizontalsystems.bankwallet.core.BaseComposeFragment import io.horizontalsystems.bankwallet.core.getInput -import io.horizontalsystems.bankwallet.modules.main.MainModule -import io.horizontalsystems.bankwallet.modules.main.MainViewModel import io.horizontalsystems.bankwallet.modules.markdown.MarkdownContent import io.horizontalsystems.bankwallet.ui.compose.ComposeAppTheme import io.horizontalsystems.bankwallet.ui.compose.TranslatableString @@ -56,10 +54,9 @@ fun ReleaseNotesScreen( closeablePopup: Boolean, onCloseClick: () -> Unit, viewModel: ReleaseNotesViewModel = viewModel(factory = ReleaseNotesModule.Factory()), - mainViewModel: MainViewModel = viewModel(factory = MainModule.Factory()) ) { BackHandler() { - mainViewModel.whatsNewShown() + viewModel.whatsNewShown() onCloseClick.invoke() } @@ -73,7 +70,7 @@ fun ReleaseNotesScreen( title = TranslatableString.ResString(R.string.Button_Close), icon = R.drawable.ic_close, onClick = { - mainViewModel.whatsNewShown() + viewModel.whatsNewShown() onCloseClick.invoke() } ) diff --git a/app/src/main/java/io/horizontalsystems/bankwallet/modules/releasenotes/ReleaseNotesModule.kt b/app/src/main/java/io/horizontalsystems/bankwallet/modules/releasenotes/ReleaseNotesModule.kt index feca8d72bde..e2b7fbd9971 100644 --- a/app/src/main/java/io/horizontalsystems/bankwallet/modules/releasenotes/ReleaseNotesModule.kt +++ b/app/src/main/java/io/horizontalsystems/bankwallet/modules/releasenotes/ReleaseNotesModule.kt @@ -12,6 +12,7 @@ object ReleaseNotesModule { App.networkManager, App.releaseNotesManager.releaseNotesUrl, App.connectivityManager, + App.releaseNotesManager, App.appConfigProvider ) as T } diff --git a/app/src/main/java/io/horizontalsystems/bankwallet/modules/releasenotes/ReleaseNotesViewModel.kt b/app/src/main/java/io/horizontalsystems/bankwallet/modules/releasenotes/ReleaseNotesViewModel.kt index 40c66e14a6a..01f9dd4a823 100644 --- a/app/src/main/java/io/horizontalsystems/bankwallet/modules/releasenotes/ReleaseNotesViewModel.kt +++ b/app/src/main/java/io/horizontalsystems/bankwallet/modules/releasenotes/ReleaseNotesViewModel.kt @@ -7,6 +7,7 @@ import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope import io.horizontalsystems.bankwallet.core.INetworkManager import io.horizontalsystems.bankwallet.core.managers.ConnectivityManager +import io.horizontalsystems.bankwallet.core.managers.ReleaseNotesManager import io.horizontalsystems.bankwallet.core.providers.AppConfigProvider import io.horizontalsystems.bankwallet.entities.ViewState import io.horizontalsystems.bankwallet.modules.markdown.MarkdownBlock @@ -21,6 +22,7 @@ class ReleaseNotesViewModel( private val networkManager: INetworkManager, private val contentUrl: String, private val connectivityManager: ConnectivityManager, + private val releaseNotesManager: ReleaseNotesManager, appConfigProvider: AppConfigProvider ) : ViewModel() { @@ -50,6 +52,10 @@ class ReleaseNotesViewModel( loadContent() } + fun whatsNewShown() { + releaseNotesManager.updateShownAppVersion() + } + private fun loadContent() { viewModelScope.launch { try {