Skip to content

Commit

Permalink
Merge pull request #445 from sora-xor/develop_to_master
Browse files Browse the repository at this point in the history
Develop to master
  • Loading branch information
C4tWithShell authored Nov 1, 2024
2 parents b7f4fea + 11b5eef commit 283f18c
Show file tree
Hide file tree
Showing 47 changed files with 255 additions and 276 deletions.
89 changes: 45 additions & 44 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ kotlin {
jvmToolchain(17)
}

// soralution 138 3.8.5.0 2024.09.06
// soralution 143 3.8.6.3 2024.10.31
// sora dae 118 3.8.5.3 2024.10.23

android {
Expand All @@ -30,8 +30,8 @@ android {
applicationId = "jp.co.soramitsu.sora"
minSdk = 26
targetSdk = 34
versionCode = System.getenv("CI_BUILD_ID")?.toInt() ?: 118
versionName = "3.8.5.3"
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"
Expand Down Expand Up @@ -172,7 +172,7 @@ play {
serviceAccountCredentials = file(System.getenv("CI_PLAY_KEY") ?: "../key/fake.json")
track = "internal"
releaseStatus = ReleaseStatus.DRAFT
releaseName = "3.8.5.3 - Bug fixes and minor improvements"
releaseName = "3.8.6.3 - SORA Card Improvements"
defaultToAppBundles = true
}

Expand Down Expand Up @@ -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"))
Expand Down Expand Up @@ -280,47 +282,46 @@ kapt {
correctErrorTypes = true
}

koverReport {
androidReports("developDebug") {
filters {
excludes {
classes(
"*.BuildConfig",
"**.models.*",
"**.core.network.*",
"**.di.*",
"**.shared_utils.wsrpc.*",
"*NetworkDataSource",
"*NetworkDataSource\$*",
"*ChainConnection",
"*ChainConnection\$*",
"**.runtime.definitions.TypeDefinitionsTreeV2",
"**.runtime.definitions.TypeDefinitionsTreeV2\$*",

// TODO: Coverage these modules by tests
"**.core.rpc.*",
"**.core.utils.*",
"**.core.extrinsic.*",
)
kover {
reports {
variant("developDebug") {
xml {
onCheck = true
title = "sora wallet xml report"
xmlFile = file("${project.rootDir}/report/coverage.xml")
}
}

xml {
onCheck = false
}

html {
onCheck = true
}

verify {
onCheck = true

rule {
isEnabled = true

minBound(14)
// TODO: Update to 85
html {
title = "sora wallet html report"
onCheck = true
charset = "UTF-8"
htmlDir.set(file("${project.rootDir}/htmlreport"))
}
verify {
rule {
minBound(14)
}
}
filters {
excludes {
classes(
"*.BuildConfig",
"**.models.*",
"**.core.network.*",
"**.di.*",
"**.shared_utils.wsrpc.*",
"*NetworkDataSource",
"*NetworkDataSource\$*",
"*ChainConnection",
"*ChainConnection\$*",
"**.runtime.definitions.TypeDefinitionsTreeV2",
"**.runtime.definitions.TypeDefinitionsTreeV2\$*",

// TODO: Coverage these modules by tests
"**.core.rpc.*",
"**.core.utils.*",
"**.core.extrinsic.*",
)
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ class MigrationManager @Inject constructor(
FirebaseWrapper.log("Migration ma done")
}
}
userRepository.defaultGlobalCards()
return true
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -49,6 +50,7 @@ import kotlinx.coroutines.launch
@HiltViewModel
class SplashViewModel @Inject constructor(
private val interactor: SplashInteractor,
coroutineManager: CoroutineManager,
) : BaseViewModel() {

private val _runtimeInitiated = MutableLiveData<Boolean>()
Expand All @@ -73,7 +75,7 @@ class SplashViewModel @Inject constructor(
loadingTextVisiblity.trigger()
}
}
viewModelScope.launch {
viewModelScope.launch(coroutineManager.io) {
interactor.checkMigration()
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ plugins {
alias(libs.plugins.firebaseAppDistributionPlugin) apply false
alias(libs.plugins.triplet) apply false
id("com.google.devtools.ksp") version "1.9.24-1.0.20" apply false
id("org.jetbrains.kotlinx.kover") version "0.7.5"
id("org.jetbrains.kotlinx.kover") version "0.8.3"
}

tasks.register("clean", Delete::class) {
Expand Down
19 changes: 6 additions & 13 deletions common/src/main/java/jp/co/soramitsu/common/domain/AssetHolder.kt
Original file line number Diff line number Diff line change
Expand Up @@ -70,27 +70,20 @@ object AssetHolder {
true, true,
3,
),
// xst
"0x0200090000000000000000000000000000000000000000000000000000000000" to
// dai
"0x0200060000000000000000000000000000000000000000000000000000000000" to
AssetDefault(
"SORA Synthetics", "XST",
"Dai", "DAI",
true, true,
4,
),
// xstusd
"0x0200080000000000000000000000000000000000000000000000000000000000" to
// eth
"0x0200070000000000000000000000000000000000000000000000000000000000" to
AssetDefault(
"SORA Synthetic USD", "XSTUSD",
"Ether", "ETH",
true, true,
5,
),
// tbcd
"0x02000a0000000000000000000000000000000000000000000000000000000000" to
AssetDefault(
"SORA TBC Dollar", "TBCD",
true, true,
6,
),
)
private val defaultAsset: AssetDefault = AssetDefault(
name = "",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,14 @@ fun BasicBannerCard(
title: String,
description: String,
button: String,
buttonEnabled: Boolean = true,
onButtonClicked: () -> Unit,
closeEnabled: Boolean,
onCloseCard: () -> Unit,
) {
ContentCard(
modifier = Modifier.fillMaxWidth(),
onClick = onButtonClicked,
onClick = if (buttonEnabled) onButtonClicked else null,
) {
Box(
modifier = Modifier
Expand All @@ -103,6 +104,7 @@ fun BasicBannerCard(
description = description,
button = button,
onStartClicked = onButtonClicked,
buttonEnabled = buttonEnabled,
)

Image(
Expand Down Expand Up @@ -144,6 +146,7 @@ private fun CardContent(
title: String,
description: String,
button: String,
buttonEnabled: Boolean,
onStartClicked: () -> Unit,
) {
Column(
Expand Down Expand Up @@ -174,6 +177,7 @@ private fun CardContent(
.padding(top = Dimens.x1_5),
text = button,
size = Size.ExtraSmall,
enabled = buttonEnabled,
order = Order.PRIMARY,
onClick = onStartClicked,
)
Expand All @@ -188,6 +192,7 @@ private fun PreviewBasicBannerCard1() {
title = "Some title of banner card, let it be longeeerr",
description = "Long description of banner card, The quick brown fox jumps over the lazy dog, The quick brown fox jumps over the lazy dog.And I, even I Artaxerxes the king, do make a decree to all the treasurers which are beyond the river, that whatsoever Ezra the priest, the scribe of the law of the God of heaven, shall require of you, it be done speedily",
button = "Just button title",
buttonEnabled = true,
closeEnabled = true,
onCloseCard = {},
onButtonClicked = {},
Expand All @@ -202,6 +207,7 @@ private fun PreviewBasicBannerCard12() {
title = "Some title",
description = "Long description of banner",
button = "Just button title",
buttonEnabled = true,
closeEnabled = false,
onCloseCard = {},
onButtonClicked = {},
Expand All @@ -216,6 +222,7 @@ private fun PreviewBasicBannerCard2() {
title = "Title",
description = "Description",
button = "Button",
buttonEnabled = true,
closeEnabled = true,
onCloseCard = {},
onButtonClicked = {},
Expand Down
2 changes: 1 addition & 1 deletion common/src/soralution/assets/sora2_metadata
100755 → 100644

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ data class UserPoolData(
val poolProvidersBalance: BigDecimal,
val favorite: Boolean,
val sort: Int,
val kensetsuIncluded: BigDecimal?,
)

val List<CommonUserPoolData>.fiatSymbol: String
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ data class SoraCardState(
override val loading: Boolean,
) : BasicBannerCardState(loading)

data object BuyXorState : BasicBannerCardState(false)
data class BuyXorState(val canStartGatehub: Boolean) : BasicBannerCardState(false)

data object ReferralState : BasicBannerCardState(false)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ interface AssetDao {
private const val QUERY_ASSET_TOKEN_ACTIVE = """
select * from assets inner join ($joinFiatToken) tokensfiats on assets.tokenId=tokensfiats.id
where assets.accountAddress=:address and tokensfiats.whitelistName=:whitelist
and ((assets.visibility=1 or assets.displayAsset=1 or tokensfiats.isHidable = 0) or (tokensfiats.id = "0x02000e0000000000000000000000000000000000000000000000000000000000") or (tokensfiats.id in (select tokenIdTarget from allpools)) or (tokensfiats.id in (select tokenId from poolBaseTokens))) order by assets.position
and ((assets.visibility=1 or assets.displayAsset=1 or tokensfiats.isHidable = 0) or (tokensfiats.id in (select tokenIdTarget from allpools)) or (tokensfiats.id in (select tokenId from poolBaseTokens))) order by assets.position
"""
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down Expand Up @@ -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,
)
}
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,8 +208,8 @@ internal fun AssetDetailsBalanceCard(
AmountCardIcon(
res = R.drawable.ic_buy_crypto,
text = stringResource(id = R.string.common_buy),
enabled = false,
onClick = onBuyCryptoClick
enabled = true,
onClick = onBuyCryptoClick,
)
}
}
Expand Down
Loading

0 comments on commit 283f18c

Please sign in to comment.