From c308f6796f08abbf0596405f169ce5b1c9ce751f Mon Sep 17 00:00:00 2001 From: Eduard Maximovich Date: Thu, 15 Jun 2023 20:31:55 +0400 Subject: [PATCH 1/2] PWN-8946 - striga bugfixes - fixed back navigation in StrigaKycFragment - added realtime home banners update (combined with tokens flow) - reverted StrigaStorage to keep striga user status - reordered striga kyc statuses to be able to use ordinal value --- .../p2p/wallet/home/ui/main/HomePresenter.kt | 22 ++++++++++----- .../ui/main/models/HomeScreenViewState.kt | 4 ++- .../wallet/infrastructure/StorageModule.kt | 7 +++++ .../wallet/striga/kyc/ui/StrigaKycFragment.kt | 28 ++++++++++++++++++- .../p2p/wallet/striga/user/StrigaStorage.kt | 27 ++++++++++++++++++ .../striga/user/StrigaStorageContract.kt | 7 +++++ .../user/interactor/StrigaUserInteractor.kt | 6 ++-- .../model/StrigaUserVerificationStatus.kt | 5 ++-- .../StrigaUserStatusDestinationMapper.kt | 4 ++- .../repository/StrigaUserStatusRepository.kt | 19 +++++++++++-- .../p2p/wallet/utils/NavigationExtensions.kt | 18 +++++++++--- 11 files changed, 126 insertions(+), 21 deletions(-) create mode 100644 app/src/main/java/org/p2p/wallet/striga/user/StrigaStorage.kt create mode 100644 app/src/main/java/org/p2p/wallet/striga/user/StrigaStorageContract.kt diff --git a/app/src/main/java/org/p2p/wallet/home/ui/main/HomePresenter.kt b/app/src/main/java/org/p2p/wallet/home/ui/main/HomePresenter.kt index b92166f58e..1681c2fe98 100644 --- a/app/src/main/java/org/p2p/wallet/home/ui/main/HomePresenter.kt +++ b/app/src/main/java/org/p2p/wallet/home/ui/main/HomePresenter.kt @@ -11,6 +11,7 @@ import kotlinx.coroutines.Job import kotlinx.coroutines.async import kotlinx.coroutines.awaitAll import kotlinx.coroutines.flow.MutableStateFlow +import kotlinx.coroutines.flow.combine import kotlinx.coroutines.flow.filterNotNull import kotlinx.coroutines.flow.launchIn import kotlinx.coroutines.flow.onCompletion @@ -215,16 +216,23 @@ class HomePresenter( tokensPolling.shareTokenPollFlowIn(this) .filterNotNull() + .combine(strigaUserInteractor.getUserStatusBannerFlow()) { homeState, strigaBanner -> + homeState to strigaBanner + } .onCompletion { homeStateSubscribed = false } - .collect { homeState -> + .collect { (homeState, strigaBanner) -> run { val solTokensLog = homeState.solTokens .joinToString { "${it.tokenSymbol}(${it.total.formatToken()}; ${it.totalInUsd?.formatFiat()})" } Timber.d("Home state solTokens: $solTokensLog") } - state = state.copy(tokens = homeState.solTokens, ethTokens = homeState.ethTokens) + state = state.copy( + tokens = homeState.solTokens, + ethTokens = homeState.ethTokens, + strigaKycStatusBanner = strigaBanner + ) initializeActionButtons() - handleUserTokensLoaded(homeState.solTokens, homeState.ethTokens) + handleHomeStateChanged(homeState.solTokens, homeState.ethTokens) showRefreshing(homeState.isRefreshing) } } @@ -452,7 +460,7 @@ class HomePresenter( } } - private fun handleUserTokensLoaded( + private fun handleHomeStateChanged( userTokens: List, ethTokens: List, ) { @@ -481,7 +489,7 @@ class HomePresenter( userInteractor.findMultipleTokenData(POPULAR_TOKENS_SYMBOLS.toList()) .sortedBy { tokenToBuy -> POPULAR_TOKENS_SYMBOLS.indexOf(tokenToBuy.tokenSymbol) } - val strigaBigBanner = strigaUserInteractor.getUserStatusBanner() + val strigaBigBanner = state.strigaKycStatusBanner ?.let(strigaUiBannerMapper::mapToBigBanner) ?: getDefaultBanner() @@ -517,7 +525,7 @@ class HomePresenter( ) val updatedTokens = userInteractor.getUserTokens() - handleUserTokensLoaded(updatedTokens, state.ethTokens) + handleHomeStateChanged(updatedTokens, state.ethTokens) } } @@ -564,7 +572,7 @@ class HomePresenter( ) claimAnalytics.logClaimAvailable(state.ethTokens.any { !it.isClaiming }) - val strigaBanner = strigaUserInteractor.getUserStatusBanner()?.let(strigaUiBannerMapper::mapToBanner) + val strigaBanner = state.strigaKycStatusBanner?.let(strigaUiBannerMapper::mapToBanner) val homeToken = buildList { if (strigaBanner != null) { this += HomeElementItem.Banner(strigaBanner) diff --git a/app/src/main/java/org/p2p/wallet/home/ui/main/models/HomeScreenViewState.kt b/app/src/main/java/org/p2p/wallet/home/ui/main/models/HomeScreenViewState.kt index 02eafdf207..af482fa64d 100644 --- a/app/src/main/java/org/p2p/wallet/home/ui/main/models/HomeScreenViewState.kt +++ b/app/src/main/java/org/p2p/wallet/home/ui/main/models/HomeScreenViewState.kt @@ -3,6 +3,7 @@ package org.p2p.wallet.home.ui.main.models import org.p2p.core.token.Token import org.p2p.wallet.auth.model.Username import org.p2p.wallet.home.model.VisibilityState +import org.p2p.wallet.kyc.model.StrigaKycStatusBanner data class HomeScreenViewState( val tokens: List = emptyList(), @@ -10,7 +11,8 @@ data class HomeScreenViewState( val visibilityState: VisibilityState = VisibilityState.Hidden, val username: Username? = null, val areZerosHidden: Boolean, - val state: LoadingState = LoadingState.INIT_LOADING + val state: LoadingState = LoadingState.INIT_LOADING, + val strigaKycStatusBanner: StrigaKycStatusBanner? = null ) enum class LoadingState { diff --git a/app/src/main/java/org/p2p/wallet/infrastructure/StorageModule.kt b/app/src/main/java/org/p2p/wallet/infrastructure/StorageModule.kt index c171094a68..c2bce9ad2c 100644 --- a/app/src/main/java/org/p2p/wallet/infrastructure/StorageModule.kt +++ b/app/src/main/java/org/p2p/wallet/infrastructure/StorageModule.kt @@ -23,6 +23,8 @@ import org.p2p.wallet.infrastructure.security.SecureStorage import org.p2p.wallet.infrastructure.security.SecureStorageContract import org.p2p.wallet.infrastructure.swap.JupiterSwapStorage import org.p2p.wallet.infrastructure.swap.JupiterSwapStorageContract +import org.p2p.wallet.striga.user.StrigaStorage +import org.p2p.wallet.striga.user.StrigaStorageContract private const val PREFS_DEFAULT = "prefs" private const val PREFS_ACCOUNT = "account_prefs" @@ -80,6 +82,11 @@ object StorageModule { JupiterSwapStorage(prefs, gson = get()) } bind JupiterSwapStorageContract::class + factory { + val prefs = androidPreferences(PREFS_STRIGA) + StrigaStorage(prefs, gson = get()) + } bind StrigaStorageContract::class + single { KeyStore.getInstance("AndroidKeyStore") } factoryOf(::EncoderDecoderMarshmallow) bind EncoderDecoder::class factoryOf(::FileRepository) diff --git a/app/src/main/java/org/p2p/wallet/striga/kyc/ui/StrigaKycFragment.kt b/app/src/main/java/org/p2p/wallet/striga/kyc/ui/StrigaKycFragment.kt index bb82c36bfd..d35ab0f7da 100644 --- a/app/src/main/java/org/p2p/wallet/striga/kyc/ui/StrigaKycFragment.kt +++ b/app/src/main/java/org/p2p/wallet/striga/kyc/ui/StrigaKycFragment.kt @@ -1,6 +1,13 @@ package org.p2p.wallet.striga.kyc.ui +import androidx.lifecycle.Lifecycle +import androidx.lifecycle.lifecycleScope +import androidx.lifecycle.repeatOnLifecycle +import android.os.Bundle +import android.view.View import org.koin.android.ext.android.inject +import kotlinx.coroutines.flow.MutableSharedFlow +import kotlinx.coroutines.launch import org.p2p.wallet.R import org.p2p.wallet.common.mvp.BaseMvpFragment import org.p2p.wallet.home.MainFragment @@ -12,6 +19,11 @@ class StrigaKycFragment : BaseMvpFragment(R.layout.fragment_striga_kyc), StrigaKycContract.View { + // navigateBack may be called too early, so we need to delay it until lifecycle is in resumed state + // attempting to popBackStack before `RESUMED` state will result in crash or + // freezing FragmentManager.popBackStackImmediate call + private val backPressDeferredHandler = MutableSharedFlow(replay = 1) + companion object { fun create(): StrigaKycFragment = StrigaKycFragment() } @@ -20,11 +32,25 @@ class StrigaKycFragment : private val strigaKycSdkFacade = StrigaKycSdkFacade() + override fun onViewCreated(view: View, savedInstanceState: Bundle?) { + super.onViewCreated(view, savedInstanceState) + + lifecycleScope.launch { + lifecycle.repeatOnLifecycle(Lifecycle.State.RESUMED) { + backPressDeferredHandler.collect { + popBackStackTo(MainFragment::class, immediate = false) + } + } + } + } + override fun startKyc(initParams: StrigaSdkInitParams) { strigaKycSdkFacade.startKycFlow(requireActivity(), initParams) } override fun navigateBack() { - popBackStackTo(MainFragment::class) + lifecycleScope.launch { + backPressDeferredHandler.emit(Unit) + } } } diff --git a/app/src/main/java/org/p2p/wallet/striga/user/StrigaStorage.kt b/app/src/main/java/org/p2p/wallet/striga/user/StrigaStorage.kt new file mode 100644 index 0000000000..5dbfcdd8fd --- /dev/null +++ b/app/src/main/java/org/p2p/wallet/striga/user/StrigaStorage.kt @@ -0,0 +1,27 @@ +package org.p2p.wallet.striga.user + +import androidx.core.content.edit +import android.content.SharedPreferences +import com.google.gson.Gson +import org.p2p.wallet.striga.user.model.StrigaUserStatus +import org.p2p.wallet.utils.fromJsonReified + +private const val KEY_USER_STATUS = "KEY_USER_STATUS" + +class StrigaStorage( + private val sharedPreferences: SharedPreferences, + private val gson: Gson +) : StrigaStorageContract { + + override var userStatus: StrigaUserStatus? + get() = sharedPreferences.getString(KEY_USER_STATUS, null)?.let(gson::fromJsonReified) + set(value) { + sharedPreferences.edit { + if (value == null) { + remove(KEY_USER_STATUS) + } else { + putString(KEY_USER_STATUS, gson.toJson(value)) + } + } + } +} diff --git a/app/src/main/java/org/p2p/wallet/striga/user/StrigaStorageContract.kt b/app/src/main/java/org/p2p/wallet/striga/user/StrigaStorageContract.kt new file mode 100644 index 0000000000..65a75e2b1b --- /dev/null +++ b/app/src/main/java/org/p2p/wallet/striga/user/StrigaStorageContract.kt @@ -0,0 +1,7 @@ +package org.p2p.wallet.striga.user + +import org.p2p.wallet.striga.user.model.StrigaUserStatus + +interface StrigaStorageContract { + var userStatus: StrigaUserStatus? +} diff --git a/app/src/main/java/org/p2p/wallet/striga/user/interactor/StrigaUserInteractor.kt b/app/src/main/java/org/p2p/wallet/striga/user/interactor/StrigaUserInteractor.kt index d77067d973..3f44dd1c3c 100644 --- a/app/src/main/java/org/p2p/wallet/striga/user/interactor/StrigaUserInteractor.kt +++ b/app/src/main/java/org/p2p/wallet/striga/user/interactor/StrigaUserInteractor.kt @@ -1,5 +1,6 @@ package org.p2p.wallet.striga.user.interactor +import kotlinx.coroutines.flow.StateFlow import org.p2p.wallet.kyc.model.StrigaKycStatusBanner import org.p2p.wallet.striga.StrigaUserIdProvider import org.p2p.wallet.striga.model.StrigaDataLayerResult @@ -35,12 +36,13 @@ class StrigaUserInteractor( fun isUserCreated(): Boolean { return strigaUserIdProvider.getUserId() != null } + fun loadAndSaveUserStatusData() { userStatusRepository.loadUserKycStatus() } - fun getUserStatusBanner(): StrigaKycStatusBanner? { - return userStatusRepository.getBanner() + fun getUserStatusBannerFlow(): StateFlow { + return userStatusRepository.getBannerFlow() } /** diff --git a/app/src/main/java/org/p2p/wallet/striga/user/model/StrigaUserVerificationStatus.kt b/app/src/main/java/org/p2p/wallet/striga/user/model/StrigaUserVerificationStatus.kt index 7544ca4b8f..a1c54b3323 100644 --- a/app/src/main/java/org/p2p/wallet/striga/user/model/StrigaUserVerificationStatus.kt +++ b/app/src/main/java/org/p2p/wallet/striga/user/model/StrigaUserVerificationStatus.kt @@ -9,14 +9,15 @@ package org.p2p.wallet.striga.user.model * @property REJECTED User rejected - Can be final or not */ enum class StrigaUserVerificationStatus { + // please, keep order, ordinal is used in comparative operations + UNKNOWN, NOT_STARTED, INITIATED, PENDING_REVIEW, ON_HOLD, - APPROVED, REJECTED, REJECTED_FINAL, - UNKNOWN; + APPROVED; companion object { fun from(status: String): StrigaUserVerificationStatus { diff --git a/app/src/main/java/org/p2p/wallet/striga/user/repository/StrigaUserStatusDestinationMapper.kt b/app/src/main/java/org/p2p/wallet/striga/user/repository/StrigaUserStatusDestinationMapper.kt index 123b9bde17..fc5960757f 100644 --- a/app/src/main/java/org/p2p/wallet/striga/user/repository/StrigaUserStatusDestinationMapper.kt +++ b/app/src/main/java/org/p2p/wallet/striga/user/repository/StrigaUserStatusDestinationMapper.kt @@ -1,5 +1,6 @@ package org.p2p.wallet.striga.user.repository +import timber.log.Timber import org.p2p.wallet.kyc.model.StrigaKycStatusBanner import org.p2p.wallet.striga.user.model.StrigaUserStatus import org.p2p.wallet.striga.user.model.StrigaUserStatusDestination @@ -35,10 +36,11 @@ class StrigaUserStatusDestinationMapper { !isMobileVerified(status) -> { StrigaUserStatusDestination.SMS_VERIFICATION } - status?.kysStatus == StrigaUserVerificationStatus.INITIATED -> { + status?.kysStatus != null && status.kysStatus.ordinal > StrigaUserVerificationStatus.UNKNOWN.ordinal -> { StrigaUserStatusDestination.SUM_SUB_VERIFICATION } else -> { + Timber.d("User status is not defined: cannot navigate to somewhere") StrigaUserStatusDestination.NONE } } diff --git a/app/src/main/java/org/p2p/wallet/striga/user/repository/StrigaUserStatusRepository.kt b/app/src/main/java/org/p2p/wallet/striga/user/repository/StrigaUserStatusRepository.kt index 20b5b63e2f..38b0c7dd2e 100644 --- a/app/src/main/java/org/p2p/wallet/striga/user/repository/StrigaUserStatusRepository.kt +++ b/app/src/main/java/org/p2p/wallet/striga/user/repository/StrigaUserStatusRepository.kt @@ -4,11 +4,14 @@ import timber.log.Timber import kotlin.jvm.Throws import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.flow.MutableStateFlow +import kotlinx.coroutines.flow.StateFlow +import kotlinx.coroutines.flow.asStateFlow import kotlinx.coroutines.launch import org.p2p.wallet.infrastructure.dispatchers.CoroutineDispatchers import org.p2p.wallet.kyc.model.StrigaKycStatusBanner import org.p2p.wallet.striga.StrigaUserIdProvider import org.p2p.wallet.striga.model.StrigaDataLayerError +import org.p2p.wallet.striga.user.StrigaStorageContract import org.p2p.wallet.striga.user.model.StrigaUserStatus import org.p2p.wallet.striga.user.model.StrigaUserStatusDestination @@ -19,12 +22,17 @@ class StrigaUserStatusRepository( private val strigaUserIdProvider: StrigaUserIdProvider, private val mapper: StrigaUserStatusDestinationMapper, private val userRepository: StrigaUserRepository, + private val strigaStorage: StrigaStorageContract, ) : CoroutineScope by CoroutineScope(dispatchers.io) { private val strigaUserDestinationFlow = MutableStateFlow(null) private val strigaBannerFlow = MutableStateFlow(null) - fun getBanner(): StrigaKycStatusBanner? = strigaBannerFlow.value + init { + handleUserStatus(strigaStorage.userStatus) + } + + fun getBannerFlow(): StateFlow = strigaBannerFlow.asStateFlow() fun getUserDestination(): StrigaUserStatusDestination? = strigaUserDestinationFlow.value @@ -38,8 +46,8 @@ class StrigaUserStatusRepository( } else { loadUserStatus() } - strigaUserDestinationFlow.value = userStatus.let(::mapToDestination) - strigaBannerFlow.value = userStatus.let(::mapToBanner) + strigaStorage.userStatus = userStatus + handleUserStatus(userStatus) } catch (e: Throwable) { Timber.tag(TAG).e(e, "Error while fetching user kyc status") } @@ -51,6 +59,11 @@ class StrigaUserStatusRepository( return userRepository.getUserStatus().unwrap() } + private fun handleUserStatus(userStatus: StrigaUserStatus?) { + strigaUserDestinationFlow.value = userStatus.let(::mapToDestination) + strigaBannerFlow.value = userStatus.let(::mapToBanner) + } + private fun mapToDestination(status: StrigaUserStatus?): StrigaUserStatusDestination { return mapper.mapToDestination( userStatus = status, diff --git a/app/src/main/java/org/p2p/wallet/utils/NavigationExtensions.kt b/app/src/main/java/org/p2p/wallet/utils/NavigationExtensions.kt index d9ef58be86..f95ad16b3d 100644 --- a/app/src/main/java/org/p2p/wallet/utils/NavigationExtensions.kt +++ b/app/src/main/java/org/p2p/wallet/utils/NavigationExtensions.kt @@ -42,10 +42,17 @@ fun FragmentActivity.popBackStack() { } } -fun Fragment.popBackStackTo(target: KClass, inclusive: Boolean = false): Boolean = - requireActivity().popBackStackTo(target, inclusive) +fun Fragment.popBackStackTo( + target: KClass, + inclusive: Boolean = false, + immediate: Boolean = true +): Boolean = requireActivity().popBackStackTo(target, inclusive, immediate) -fun FragmentActivity.popBackStackTo(target: KClass, inclusive: Boolean = false): Boolean { +fun FragmentActivity.popBackStackTo( + target: KClass, + inclusive: Boolean = false, + immediate: Boolean = true +): Boolean { val flag = if (inclusive) FragmentManager.POP_BACK_STACK_INCLUSIVE else 0 hideKeyboard() @@ -55,8 +62,11 @@ fun FragmentActivity.popBackStackTo(target: KClass, inclusive: return if (backStackEntryCount == 0 || getBackStackEntryAt(0).name == tag && inclusive) { finish() true - } else { + } else if (immediate) { popBackStackImmediate(tag, flag) + } else { + popBackStack(tag, flag) + true } } } From 348ff7ff36441fae5a8b253e1a6513ad8fe7ecdb Mon Sep 17 00:00:00 2001 From: Eduard Maximovich Date: Wed, 21 Jun 2023 19:49:01 +0400 Subject: [PATCH 2/2] PWN-8923 - striga. clean phone number when phone country is changed --- .../striga/signup/StrigaSignUpFirstStepContract.kt | 2 +- .../striga/signup/ui/StrigaSignUpFirstStepFragment.kt | 2 +- .../striga/signup/ui/StrigaSignUpFirstStepPresenter.kt | 10 +++++++--- .../signup/ui/StrigaSignupFirstStepPresenterTest.kt | 5 +++-- 4 files changed, 12 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/org/p2p/wallet/striga/signup/StrigaSignUpFirstStepContract.kt b/app/src/main/java/org/p2p/wallet/striga/signup/StrigaSignUpFirstStepContract.kt index e698113cbd..654c5dbfc0 100644 --- a/app/src/main/java/org/p2p/wallet/striga/signup/StrigaSignUpFirstStepContract.kt +++ b/app/src/main/java/org/p2p/wallet/striga/signup/StrigaSignUpFirstStepContract.kt @@ -27,7 +27,7 @@ interface StrigaSignUpFirstStepContract { fun onCountryOfBirthClicked() fun saveChanges() fun onSubmit() - fun onPhoneCountryCodeChanged(newCountry: CountryCode) + fun onPhoneCountryCodeChanged(newCountry: CountryCode, changedByUser: Boolean) fun onPhoneNumberChanged(newPhone: String) fun onPhoneCountryCodeClicked() } diff --git a/app/src/main/java/org/p2p/wallet/striga/signup/ui/StrigaSignUpFirstStepFragment.kt b/app/src/main/java/org/p2p/wallet/striga/signup/ui/StrigaSignUpFirstStepFragment.kt index 5f5d3e1a8a..cbf3ac9a21 100644 --- a/app/src/main/java/org/p2p/wallet/striga/signup/ui/StrigaSignUpFirstStepFragment.kt +++ b/app/src/main/java/org/p2p/wallet/striga/signup/ui/StrigaSignUpFirstStepFragment.kt @@ -260,7 +260,7 @@ class StrigaSignUpFirstStepFragment : } bundle.containsKey(RESULT_KEY_PHONE_COUNTRY_CODE) -> { val countryCode = bundle.getParcelableCompat(RESULT_KEY_PHONE_COUNTRY_CODE) ?: return - presenter.onPhoneCountryCodeChanged(countryCode) + presenter.onPhoneCountryCodeChanged(countryCode, changedByUser = true) } } } diff --git a/app/src/main/java/org/p2p/wallet/striga/signup/ui/StrigaSignUpFirstStepPresenter.kt b/app/src/main/java/org/p2p/wallet/striga/signup/ui/StrigaSignUpFirstStepPresenter.kt index e13b74b475..80a81e4c69 100644 --- a/app/src/main/java/org/p2p/wallet/striga/signup/ui/StrigaSignUpFirstStepPresenter.kt +++ b/app/src/main/java/org/p2p/wallet/striga/signup/ui/StrigaSignUpFirstStepPresenter.kt @@ -93,7 +93,7 @@ class StrigaSignUpFirstStepPresenter( } } - override fun onPhoneCountryCodeChanged(newCountry: CountryCode) { + override fun onPhoneCountryCodeChanged(newCountry: CountryCode, changedByUser: Boolean) { phoneCountryCode = newCountry view?.showPhoneCountryCode(phoneCountryCode) @@ -103,6 +103,10 @@ class StrigaSignUpFirstStepPresenter( countryCodeRepository = countryRepository ) ) + + if (changedByUser) { + view?.updateSignupField(StrigaSignupDataType.PHONE_NUMBER, "") + } } override fun onPhoneNumberChanged(newPhone: String) { @@ -156,7 +160,7 @@ class StrigaSignUpFirstStepPresenter( cachedPhoneNumber = signupData[StrigaSignupDataType.PHONE_NUMBER]?.value ) - onPhoneCountryCodeChanged(phoneNumberWithCode.phoneCode) + onPhoneCountryCodeChanged(phoneNumberWithCode.phoneCode, false) // Using the updated phoneCode and selectedPhoneNumber view?.setupPhoneCountryCodePicker( @@ -180,7 +184,7 @@ class StrigaSignUpFirstStepPresenter( signupData[StrigaSignupDataType.PHONE_CODE_WITH_PLUS]?.value?.let { val phoneCountryCode = countryRepository.findCountryCodeByPhoneCode(it) - phoneCountryCode?.let(::onPhoneCountryCodeChanged) + phoneCountryCode?.let { countryCode -> onPhoneCountryCodeChanged(countryCode, false) } } } diff --git a/app/src/test/java/org/p2p/wallet/striga/signup/ui/StrigaSignupFirstStepPresenterTest.kt b/app/src/test/java/org/p2p/wallet/striga/signup/ui/StrigaSignupFirstStepPresenterTest.kt index 390f8ba515..b50d9ec8c0 100644 --- a/app/src/test/java/org/p2p/wallet/striga/signup/ui/StrigaSignupFirstStepPresenterTest.kt +++ b/app/src/test/java/org/p2p/wallet/striga/signup/ui/StrigaSignupFirstStepPresenterTest.kt @@ -272,7 +272,8 @@ class StrigaSignupFirstStepPresenterTest { presenter.attach(view) interactor.setPhoneValidator(PhoneNumberInputValidator("90", countryCodeRepository)) presenter.onPhoneCountryCodeChanged( - CountryCode("tr", "tur", "90", "Turkey", ",") + CountryCode("tr", "tur", "90", "Turkey", ","), + true ) presenter.onPhoneNumberChanged("5556667788") presenter.onFieldChanged(StrigaSignupDataType.PHONE_CODE_WITH_PLUS, "+90") @@ -396,7 +397,7 @@ class StrigaSignupFirstStepPresenterTest { verify(exactly = 1) { view.showPhoneCountryCodePicker(TurkeyCountry) } advanceUntilIdle() - presenter.onPhoneCountryCodeChanged(TurkeyCountry) + presenter.onPhoneCountryCodeChanged(TurkeyCountry, true) verify { view.showPhoneCountryCode(TurkeyCountry) } presenter.detach()