diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 7a2dab680..34fa614dc 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -19,7 +19,7 @@ kotlin { jvmToolchain(17) } -// soralution 142 3.8.6.2 2024.10.30 +// soralution 143 3.8.6.3 2024.10.31 // sora dae 118 3.8.5.3 2024.10.23 android { @@ -30,8 +30,8 @@ android { applicationId = "jp.co.soramitsu.sora" minSdk = 26 targetSdk = 34 - versionCode = System.getenv("CI_BUILD_ID")?.toInt() ?: 142 - versionName = "3.8.6.2" + versionCode = System.getenv("CI_BUILD_ID")?.toInt() ?: 143 + versionName = "3.8.6.3" testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" multiDexEnabled = true // resConfigs "en", "ru", "es", "fr", "de", "nb", "in", "tr", "ar" @@ -172,7 +172,7 @@ play { serviceAccountCredentials = file(System.getenv("CI_PLAY_KEY") ?: "../key/fake.json") track = "internal" releaseStatus = ReleaseStatus.DRAFT - releaseName = "3.8.6.2 - SORA Card Improvements" + releaseName = "3.8.6.3 - SORA Card Improvements" defaultToAppBundles = true } @@ -239,11 +239,13 @@ dependencies { implementation(libs.webSocketLibDep) + testImplementation(project(":test_data")) testImplementation(libs.coroutineTestDep) testImplementation(libs.junitDep) testImplementation(libs.mockkDep) testImplementation(libs.mockitoKotlinDep) testImplementation(libs.archCoreTestDep) + testImplementation(libs.truthDep) kover(project(":common")) kover(project(":common_wallet")) diff --git a/app/src/main/java/jp/co/soramitsu/sora/splash/domain/MigrationManager.kt b/app/src/main/java/jp/co/soramitsu/sora/splash/domain/MigrationManager.kt index fa496df5e..eb8f23c86 100644 --- a/app/src/main/java/jp/co/soramitsu/sora/splash/domain/MigrationManager.kt +++ b/app/src/main/java/jp/co/soramitsu/sora/splash/domain/MigrationManager.kt @@ -66,7 +66,6 @@ class MigrationManager @Inject constructor( FirebaseWrapper.log("Migration ma done") } } - userRepository.defaultGlobalCards() return true } } diff --git a/app/src/main/java/jp/co/soramitsu/sora/splash/presentation/SplashViewModel.kt b/app/src/main/java/jp/co/soramitsu/sora/splash/presentation/SplashViewModel.kt index 52b0e65b0..a80184a54 100644 --- a/app/src/main/java/jp/co/soramitsu/sora/splash/presentation/SplashViewModel.kt +++ b/app/src/main/java/jp/co/soramitsu/sora/splash/presentation/SplashViewModel.kt @@ -37,6 +37,7 @@ import androidx.lifecycle.MutableLiveData import androidx.lifecycle.viewModelScope import dagger.hilt.android.lifecycle.HiltViewModel import javax.inject.Inject +import jp.co.soramitsu.androidfoundation.coroutine.CoroutineManager import jp.co.soramitsu.androidfoundation.fragment.SingleLiveEvent import jp.co.soramitsu.androidfoundation.fragment.trigger import jp.co.soramitsu.common.logger.FirebaseWrapper @@ -49,6 +50,7 @@ import kotlinx.coroutines.launch @HiltViewModel class SplashViewModel @Inject constructor( private val interactor: SplashInteractor, + coroutineManager: CoroutineManager, ) : BaseViewModel() { private val _runtimeInitiated = MutableLiveData() @@ -73,7 +75,7 @@ class SplashViewModel @Inject constructor( loadingTextVisiblity.trigger() } } - viewModelScope.launch { + viewModelScope.launch(coroutineManager.io) { interactor.checkMigration() } } diff --git a/app/src/test/java/jp/co/soramitsu/sora/splash/presentation/SplashViewModelTest.kt b/app/src/test/java/jp/co/soramitsu/sora/splash/presentation/SplashViewModelTest.kt index 2fbd4a485..240811e01 100644 --- a/app/src/test/java/jp/co/soramitsu/sora/splash/presentation/SplashViewModelTest.kt +++ b/app/src/test/java/jp/co/soramitsu/sora/splash/presentation/SplashViewModelTest.kt @@ -35,12 +35,14 @@ package jp.co.soramitsu.sora.splash.presentation import androidx.arch.core.executor.testing.InstantTaskExecutorRule import io.mockk.every import io.mockk.mockkObject +import jp.co.soramitsu.androidfoundation.coroutine.CoroutineManager import jp.co.soramitsu.androidfoundation.testing.MainCoroutineRule import jp.co.soramitsu.androidfoundation.testing.getOrAwaitValue import jp.co.soramitsu.common.logger.FirebaseWrapper import jp.co.soramitsu.feature_account_api.domain.model.OnboardingState import jp.co.soramitsu.sora.splash.domain.SplashInteractor import kotlinx.coroutines.CompletableDeferred +import kotlinx.coroutines.CoroutineDispatcher import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.advanceUntilIdle import kotlinx.coroutines.test.runTest @@ -53,6 +55,7 @@ import org.junit.runner.RunWith import org.mockito.BDDMockito.given import org.mockito.Mock import org.mockito.junit.MockitoJUnitRunner +import org.mockito.kotlin.whenever @ExperimentalCoroutinesApi @RunWith(MockitoJUnitRunner::class) @@ -68,13 +71,18 @@ class SplashViewModelTest { @Mock private lateinit var interactor: SplashInteractor + @Mock + private lateinit var coroutineManager: CoroutineManager + private lateinit var splashViewModel: SplashViewModel + @OptIn(ExperimentalStdlibApi::class) @Before - fun setUp() { + fun setUp() = runTest { mockkObject(FirebaseWrapper) every { FirebaseWrapper.log("Splash next screen true") } returns Unit - splashViewModel = SplashViewModel(interactor) + whenever(coroutineManager.io).thenReturn(this.coroutineContext[CoroutineDispatcher]!!) + splashViewModel = SplashViewModel(interactor, coroutineManager) } @Test diff --git a/feature_account_impl/src/main/java/jp/co/soramitsu/feature_account_impl/data/repository/UserRepositoryImpl.kt b/feature_account_impl/src/main/java/jp/co/soramitsu/feature_account_impl/data/repository/UserRepositoryImpl.kt index d35631cb0..1c1757174 100644 --- a/feature_account_impl/src/main/java/jp/co/soramitsu/feature_account_impl/data/repository/UserRepositoryImpl.kt +++ b/feature_account_impl/src/main/java/jp/co/soramitsu/feature_account_impl/data/repository/UserRepositoryImpl.kt @@ -60,7 +60,7 @@ class UserRepositoryImpl( private val userDatasource: UserDatasource, private val credentialsDatasource: CredentialsDatasource, private val db: AppDatabase, - private val coroutineManager: CoroutineManager, + coroutineManager: CoroutineManager, private val languagesHolder: LanguagesHolder, ) : UserRepository { @@ -188,14 +188,14 @@ class UserRepositoryImpl( val count = db.globalCardsHubDao().count() if (count == 0) { db.globalCardsHubDao().insert( - CardHubType.values() + CardHubType.entries .filter { !it.boundToAccount } .map { cardType -> GlobalCardHubLocal( cardId = cardType.hubName, visibility = true, sortOrder = cardType.order, - collapsed = false + collapsed = false, ) } ) diff --git a/feature_main_impl/src/main/java/jp/co/soramitsu/feature_main_impl/domain/PinCodeInteractor.kt b/feature_main_impl/src/main/java/jp/co/soramitsu/feature_main_impl/domain/PinCodeInteractor.kt index fd0bd7d6e..921510e53 100644 --- a/feature_main_impl/src/main/java/jp/co/soramitsu/feature_main_impl/domain/PinCodeInteractor.kt +++ b/feature_main_impl/src/main/java/jp/co/soramitsu/feature_main_impl/domain/PinCodeInteractor.kt @@ -84,8 +84,12 @@ class PinCodeInteractor @Inject constructor( return if (isFetched) { userRepository.needsMigration(soraAccount) } else { - val irohaData = credentialsRepository.getIrohaData(soraAccount) - val needs = walletRepository.needsMigration(irohaData.address) + val needs = if (credentialsRepository.retrieveMnemonic(soraAccount).split(" ").size == 15) { + val irohaData = credentialsRepository.getIrohaData(soraAccount) + walletRepository.needsMigration(irohaData.address) + } else { + false + } userRepository.saveNeedsMigration(needs, soraAccount) userRepository.saveIsMigrationFetched(true, soraAccount) userRepository.needsMigration(soraAccount) diff --git a/feature_main_impl/src/main/java/jp/co/soramitsu/feature_main_impl/presentation/pincode/PinCodeViewModel.kt b/feature_main_impl/src/main/java/jp/co/soramitsu/feature_main_impl/presentation/pincode/PinCodeViewModel.kt index a9fee0994..7c6087766 100644 --- a/feature_main_impl/src/main/java/jp/co/soramitsu/feature_main_impl/presentation/pincode/PinCodeViewModel.kt +++ b/feature_main_impl/src/main/java/jp/co/soramitsu/feature_main_impl/presentation/pincode/PinCodeViewModel.kt @@ -74,10 +74,6 @@ class PinCodeViewModel @Inject constructor( connectionManager: ConnectionManager, ) : BaseViewModel(), WithProgress by progress { - companion object { - private const val COMPLETE_PIN_CODE_DELAY: Long = 12 - } - internal var state by mutableStateOf( PinCodeScreenState( maxDotsCount = PinCodeInteractor.PINCODE_LENGTH, @@ -269,7 +265,6 @@ class PinCodeViewModel @Inject constructor( private fun pinCodeEntered() { viewModelScope.launch { tryCatch { - delay(COMPLETE_PIN_CODE_DELAY) if (PinCodeAction.CREATE_PIN_CODE == action) { if (tempCode.isEmpty()) { tempCode = inputedCode diff --git a/feature_main_impl/src/test/java/jp/co/soramitsu/feature_main_impl/domain/PinCodeInteractorTest.kt b/feature_main_impl/src/test/java/jp/co/soramitsu/feature_main_impl/domain/PinCodeInteractorTest.kt index 56ad8be40..f9ed2497e 100644 --- a/feature_main_impl/src/test/java/jp/co/soramitsu/feature_main_impl/domain/PinCodeInteractorTest.kt +++ b/feature_main_impl/src/test/java/jp/co/soramitsu/feature_main_impl/domain/PinCodeInteractorTest.kt @@ -196,6 +196,7 @@ class PinCodeInteractorTest { given(userRepository.getCurSoraAccount()).willReturn(account) given(userRepository.isMigrationFetched(account)).willReturn(false) given(credentialsRepository.getIrohaData(account)).willReturn(irohaData) + given(credentialsRepository.retrieveMnemonic(account)).willReturn("qwe asd zxc vbn tyu qwe asd zxc vbn tyu qwe asd zxc vbn tyu") given(walletRepository.needsMigration(address)).willReturn(needsMigration) interactor.needsMigration() diff --git a/sorasubstrate/src/main/java/jp/co/soramitsu/sora/substrate/runtime/RuntimeManager.kt b/sorasubstrate/src/main/java/jp/co/soramitsu/sora/substrate/runtime/RuntimeManager.kt index 977b4d8ed..8b5b91457 100644 --- a/sorasubstrate/src/main/java/jp/co/soramitsu/sora/substrate/runtime/RuntimeManager.kt +++ b/sorasubstrate/src/main/java/jp/co/soramitsu/sora/substrate/runtime/RuntimeManager.kt @@ -283,6 +283,6 @@ class RuntimeManager @Inject constructor( private sealed class MetadataSource { data class Cache(val replaceCache: Boolean) : MetadataSource() - object SoraNet : MetadataSource() + data object SoraNet : MetadataSource() } }