From d029f068e2340fb5b5f15ab0258cfcb42f465c0c Mon Sep 17 00:00:00 2001 From: Artem Zaiats Date: Mon, 9 Dec 2024 16:23:38 +0200 Subject: [PATCH] Update animation and popups logic --- .../accountsoverview/AccountsOverviewFragment.kt | 14 ++++++++------ .../accountsoverview/AccountsOverviewViewModel.kt | 6 ++---- app/src/main/res/values/strings.xml | 4 ++-- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/app/src/main/java/com/concordium/wallet/ui/account/accountsoverview/AccountsOverviewFragment.kt b/app/src/main/java/com/concordium/wallet/ui/account/accountsoverview/AccountsOverviewFragment.kt index 08367017..48286928 100644 --- a/app/src/main/java/com/concordium/wallet/ui/account/accountsoverview/AccountsOverviewFragment.kt +++ b/app/src/main/java/com/concordium/wallet/ui/account/accountsoverview/AccountsOverviewFragment.kt @@ -88,7 +88,6 @@ class AccountsOverviewFragment : BaseFragment() { super.onViewCreated(view, savedInstanceState) initializeViewModel() - viewModel.initialize() initializeViews() val baseActivity = (activity as BaseActivity) @@ -173,7 +172,7 @@ class AccountsOverviewFragment : BaseFragment() { showDisposalBalance(totalBalance.totalAtDisposalForAllAccounts) } viewModel.showDialogLiveData.observe(viewLifecycleOwner) { event -> - if (viewModel.hasShowedInitialAnimation()) { + if (mainViewModel.hasCompletedOnboarding()) { when (event.contentIfNotHandled) { AccountsOverviewViewModel.DialogToShow.UNSHIELDING -> { UnshieldingNoticeDialog().showSingle( @@ -196,10 +195,6 @@ class AccountsOverviewFragment : BaseFragment() { viewModel.stateFlow.collectWhenStarted(viewLifecycleOwner) { state -> when (state) { OnboardingState.DONE -> { - if (!viewModel.hasShowedInitialAnimation()) { - binding.confettiAnimation.visibility = View.VISIBLE - binding.confettiAnimation.playAnimation() - } showStateDefault() } @@ -210,6 +205,13 @@ class AccountsOverviewFragment : BaseFragment() { } } viewModel.onrampActive.collectWhenStarted(viewLifecycleOwner) { active -> + if (active) { + if (!viewModel.hasShowedInitialAnimation()) { + binding.confettiAnimation.visibility = View.VISIBLE + binding.confettiAnimation.playAnimation() + } + } + binding.onrampBanner.root.setOnClickListener { App.appCore.tracker.homeOnRampBannerClicked() diff --git a/app/src/main/java/com/concordium/wallet/ui/account/accountsoverview/AccountsOverviewViewModel.kt b/app/src/main/java/com/concordium/wallet/ui/account/accountsoverview/AccountsOverviewViewModel.kt index 6b68b233..3221c088 100644 --- a/app/src/main/java/com/concordium/wallet/ui/account/accountsoverview/AccountsOverviewViewModel.kt +++ b/app/src/main/java/com/concordium/wallet/ui/account/accountsoverview/AccountsOverviewViewModel.kt @@ -121,10 +121,6 @@ class AccountsOverviewViewModel(application: Application) : AndroidViewModel(app updateNotificationSubscription() } - fun initialize() { - showSingleDialogIfNeeded() - } - override fun onCleared() { super.onCleared() accountRepository.allAccountsWithIdentity.removeObserver(accountsObserver) @@ -191,6 +187,7 @@ class AccountsOverviewViewModel(application: Application) : AndroidViewModel(app } else { App.appCore.session.hasCompletedOnboarding() postState(OnboardingState.DONE, notifyWaitingLiveData = notifyWaitingLiveData) + showSingleDialogIfNeeded() updateSubmissionStatesAndBalances() } } @@ -200,6 +197,7 @@ class AccountsOverviewViewModel(application: Application) : AndroidViewModel(app if (doneCount > 0) { App.appCore.session.hasCompletedOnboarding() postState(OnboardingState.DONE, notifyWaitingLiveData = notifyWaitingLiveData) + showSingleDialogIfNeeded() updateSubmissionStatesAndBalances() } else { postState(OnboardingState.SAVE_PHRASE, zeroAccountBalances, notifyWaitingLiveData) diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index f11da931..abe0d5ac 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -999,9 +999,9 @@ Continue You can import your wallet with a secret seed phrase, wallet private key or a backup file. Import a wallet - Create passcode + Create Passcode %1$d-digit passcode to secure your wallet. Remember it to enter the wallet again - Repeat passcode + Repeat Passcode It should be the same %1$d-digit passcode you entered in the previous step Use full password instead Delete