Skip to content

Commit

Permalink
Merge pull request #1193 from soramitsu/staging
Browse files Browse the repository at this point in the history
staging to master
  • Loading branch information
PankraSerg authored Aug 24, 2024
2 parents 664277d + 9680bac commit 0776bd2
Show file tree
Hide file tree
Showing 233 changed files with 11,404 additions and 1,275 deletions.
2 changes: 1 addition & 1 deletion android-foundation
Submodule android-foundation updated 43 files
+0 −41 build.gradle
+68 −0 build.gradle.kts
+1 −0 src/main/AndroidManifest.xml
+9 −0 src/main/java/jp/co/soramitsu/androidfoundation/compose/AnyTitle.kt
+108 −0 src/main/java/jp/co/soramitsu/androidfoundation/compose/BottomSheetExt.kt
+18 −0 src/main/java/jp/co/soramitsu/androidfoundation/compose/KeyboardState.kt
+46 −0 src/main/java/jp/co/soramitsu/androidfoundation/compose/ModifierExts.kt
+70 −0 src/main/java/jp/co/soramitsu/androidfoundation/compose/OverlappingLayout.kt
+20 −0 src/main/java/jp/co/soramitsu/androidfoundation/compose/SharedViewModel.kt
+11 −0 src/main/java/jp/co/soramitsu/androidfoundation/compose/TestTag.kt
+19 −0 src/main/java/jp/co/soramitsu/androidfoundation/compose/UiState.kt
+13 −0 src/main/java/jp/co/soramitsu/androidfoundation/coroutine/CoroutineManager.kt
+26 −0 src/main/java/jp/co/soramitsu/androidfoundation/coroutine/SuspendableProperty.kt
+153 −0 src/main/java/jp/co/soramitsu/androidfoundation/format/BigDecimalExt.kt
+5 −0 src/main/java/jp/co/soramitsu/androidfoundation/format/BigIntegerExt.kt
+41 −0 src/main/java/jp/co/soramitsu/androidfoundation/format/BigIntegerSerializer.kt
+10 −0 src/main/java/jp/co/soramitsu/androidfoundation/format/CastExt.kt
+21 −0 src/main/java/jp/co/soramitsu/androidfoundation/format/CollectionExt.kt
+33 −0 src/main/java/jp/co/soramitsu/androidfoundation/format/CompoundNumberFormatter.kt
+8 −0 src/main/java/jp/co/soramitsu/androidfoundation/format/CoroutineExt.kt
+24 −0 src/main/java/jp/co/soramitsu/androidfoundation/format/FiatFormatter.kt
+33 −0 src/main/java/jp/co/soramitsu/androidfoundation/format/ImageValue.kt
+7 −0 src/main/java/jp/co/soramitsu/androidfoundation/format/InputStreamExt.kt
+12 −0 src/main/java/jp/co/soramitsu/androidfoundation/format/MapUtils.kt
+10 −0 src/main/java/jp/co/soramitsu/androidfoundation/format/NumberAbbreviation.kt
+8 −0 src/main/java/jp/co/soramitsu/androidfoundation/format/NumberFormatter.kt
+29 −0 src/main/java/jp/co/soramitsu/androidfoundation/format/NumberFormatters.kt
+14 −0 src/main/java/jp/co/soramitsu/androidfoundation/format/TextString.kt
+73 −0 src/main/java/jp/co/soramitsu/androidfoundation/format/TextValue.kt
+13 −0 src/main/java/jp/co/soramitsu/androidfoundation/fragment/CustomViewModelFactory.kt
+97 −2 src/main/java/jp/co/soramitsu/androidfoundation/fragment/FragmentUtils.kt
+59 −0 src/main/java/jp/co/soramitsu/androidfoundation/fragment/SingleLiveEvent.kt
+94 −2 src/main/java/jp/co/soramitsu/androidfoundation/intent/IntentUtils.kt
+6 −23 src/main/java/jp/co/soramitsu/androidfoundation/intent/ShareUtil.kt
+4 −4 src/main/java/jp/co/soramitsu/androidfoundation/phone/BasicClipboardManager.kt
+13 −2 src/main/java/jp/co/soramitsu/androidfoundation/phone/DeviceVibrator.kt
+70 −0 src/main/java/jp/co/soramitsu/androidfoundation/resource/ResourceManager.kt
+22 −0 src/main/java/jp/co/soramitsu/androidfoundation/testing/AssertException.kt
+13 −0 src/main/java/jp/co/soramitsu/androidfoundation/testing/Ext.kt
+59 −0 src/main/java/jp/co/soramitsu/androidfoundation/testing/LiveDataTestUtil.kt
+25 −0 src/main/java/jp/co/soramitsu/androidfoundation/testing/MainCoroutineRule.kt
+20 −0 src/main/java/jp/co/soramitsu/androidfoundation/testing/ReadRes.kt
+71 −0 src/main/java/jp/co/soramitsu/androidfoundation/testing/TestFlowCollector.kt
17 changes: 9 additions & 8 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//file:noinspection GroovyImplicitNullArgumentCall
import com.github.triplet.gradle.androidpublisher.ReleaseStatus

apply plugin: 'com.android.application'
Expand Down Expand Up @@ -129,10 +130,6 @@ android {
resources.excludes.add("META-INF/**/*")
resources.excludes.add("META-INF/*")
}

configurations.configureEach {
exclude group: "org.bouncycastle", module: "bcprov-jdk15on"
}
}

play {
Expand All @@ -142,6 +139,7 @@ play {
}

dependencies {
implementation project(':android-foundation')
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation project(':core-db')
implementation project(':common')
Expand Down Expand Up @@ -179,6 +177,9 @@ dependencies {
implementation project(':feature-nft-api')
implementation project(':feature-nft-impl')

implementation project(':feature-liquiditypools-api')
implementation project(':feature-liquiditypools-impl')

implementation libs.kotlin.stdlib.jdk7

implementation libs.appcompat
Expand Down Expand Up @@ -233,8 +234,8 @@ dependencies {
androidTestImplementation libs.ext.junit
}

task printVersion {
doLast {
println "versionName:${computeVersionName()}"
}
tasks.register('printVersion') {
doLast {
println "versionName:${computeVersionName()}"
}
}
2 changes: 2 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">

<uses-feature android:name="android.hardware.camera" android:required="false" />

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.CAMERA" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import javax.inject.Singleton
import jp.co.soramitsu.account.impl.presentation.AccountRouter
import jp.co.soramitsu.app.root.navigation.Navigator
import jp.co.soramitsu.crowdloan.impl.presentation.CrowdloanRouter
import jp.co.soramitsu.liquiditypools.navigation.LiquidityPoolsRouter
import jp.co.soramitsu.nft.navigation.NFTRouter
import jp.co.soramitsu.onboarding.impl.OnboardingRouter
import jp.co.soramitsu.polkaswap.api.presentation.PolkaswapRouter
Expand Down Expand Up @@ -69,4 +70,8 @@ class NavigationModule {
@Singleton
@Provides
fun provideNFTRouter(navigator: Navigator): NFTRouter = navigator

@Singleton
@Provides
fun provideLiquidityPoolsRouter(navigator: Navigator): LiquidityPoolsRouter = navigator
}
26 changes: 18 additions & 8 deletions app/src/main/java/jp/co/soramitsu/app/root/navigation/Navigator.kt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import co.jp.soramitsu.walletconnect.domain.WalletConnectRouter
import co.jp.soramitsu.walletconnect.model.ChainChooseResult
import co.jp.soramitsu.walletconnect.model.ChainChooseState
import it.airgap.beaconsdk.blockchain.substrate.data.SubstrateSignerPayload
import java.math.BigDecimal
import jp.co.soramitsu.account.api.domain.model.ImportMode
import jp.co.soramitsu.account.api.presentation.account.create.ChainAccountCreatePayload
import jp.co.soramitsu.account.api.presentation.actions.AddAccountPayload
Expand Down Expand Up @@ -46,6 +45,7 @@ import jp.co.soramitsu.account.impl.presentation.node.add.AddNodeFragment
import jp.co.soramitsu.account.impl.presentation.node.details.NodeDetailsFragment
import jp.co.soramitsu.account.impl.presentation.node.details.NodeDetailsPayload
import jp.co.soramitsu.account.impl.presentation.node.list.NodesFragment
import jp.co.soramitsu.account.impl.presentation.nomis_scoring.ScoreDetailsFragment
import jp.co.soramitsu.account.impl.presentation.options_switch_node.OptionsSwitchNodeFragment
import jp.co.soramitsu.account.impl.presentation.optionsaddaccount.OptionsAddAccountFragment
import jp.co.soramitsu.account.impl.presentation.pincode.PinCodeAction
Expand All @@ -72,6 +72,7 @@ import jp.co.soramitsu.crowdloan.impl.presentation.contribute.custom.CustomContr
import jp.co.soramitsu.crowdloan.impl.presentation.contribute.custom.model.CustomContributePayload
import jp.co.soramitsu.crowdloan.impl.presentation.contribute.select.CrowdloanContributeFragment
import jp.co.soramitsu.crowdloan.impl.presentation.contribute.select.parcel.ContributePayload
import jp.co.soramitsu.liquiditypools.navigation.LiquidityPoolsRouter
import jp.co.soramitsu.nft.impl.presentation.NFTFlowFragment
import jp.co.soramitsu.nft.navigation.NFTRouter
import jp.co.soramitsu.onboarding.impl.OnboardingRouter
Expand Down Expand Up @@ -121,7 +122,6 @@ import jp.co.soramitsu.staking.impl.presentation.validators.change.custom.settin
import jp.co.soramitsu.staking.impl.presentation.validators.details.CollatorDetailsFragment
import jp.co.soramitsu.staking.impl.presentation.validators.details.ValidatorDetailsFragment
import jp.co.soramitsu.staking.impl.presentation.validators.parcel.CollatorDetailsParcelModel
import jp.co.soramitsu.staking.impl.presentation.validators.parcel.ValidatorDetailsParcelModel
import jp.co.soramitsu.success.presentation.SuccessFragment
import jp.co.soramitsu.success.presentation.SuccessRouter
import jp.co.soramitsu.wallet.api.domain.model.XcmChainType
Expand Down Expand Up @@ -168,7 +168,6 @@ import jp.co.soramitsu.walletconnect.impl.presentation.requestpreview.RequestPre
import jp.co.soramitsu.walletconnect.impl.presentation.sessionproposal.SessionProposalFragment
import jp.co.soramitsu.walletconnect.impl.presentation.sessionrequest.SessionRequestFragment
import jp.co.soramitsu.walletconnect.impl.presentation.transactionrawdata.RawDataFragment
import kotlin.coroutines.coroutineContext
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.StateFlow
Expand All @@ -184,6 +183,8 @@ import kotlinx.coroutines.flow.onEach
import kotlinx.coroutines.flow.onStart
import kotlinx.coroutines.job
import kotlinx.parcelize.Parcelize
import java.math.BigDecimal
import kotlin.coroutines.coroutineContext

@Parcelize
class NavComponentDelayedNavigation(val globalActionId: Int, val extras: Bundle? = null) : DelayedNavigation
Expand All @@ -200,7 +201,8 @@ class Navigator :
SuccessRouter,
SoraCardRouter,
WalletConnectRouter,
NFTRouter
NFTRouter,
LiquidityPoolsRouter
{

private var navController: NavController? = null
Expand Down Expand Up @@ -614,8 +616,8 @@ class Navigator :
navController?.navigate(R.id.confirmJoinPoolFragment)
}

override fun openPoolInfo(poolInfo: PoolInfo) {
navController?.navigate(R.id.poolInfoFragment, PoolInfoFragment.getBundle(poolInfo))
override fun openPoolInfo(poolId: Int) {
navController?.navigate(R.id.poolInfoFragment, PoolInfoFragment.getBundle(poolId))
}

override fun openManagePoolStake() {
Expand Down Expand Up @@ -728,8 +730,8 @@ class Navigator :
navController?.navigate(R.id.close_swap)
}

override fun openValidatorDetails(validatorDetails: ValidatorDetailsParcelModel) {
navController?.navigate(R.id.validatorDetailsFragment, ValidatorDetailsFragment.getBundle(validatorDetails))
override fun openValidatorDetails(validatorIdHex: String) {
navController?.navigate(R.id.validatorDetailsFragment, ValidatorDetailsFragment.getBundle(validatorIdHex))
}

override fun openSelectedValidators() {
Expand Down Expand Up @@ -1511,4 +1513,12 @@ class Navigator :
override fun openServiceScreen() {
navController?.navigate(R.id.serviceFragment)
}

override fun openScoreDetailsScreen(metaId: Long) {
navController?.navigate(R.id.scoreDetailsFragment, ScoreDetailsFragment.getBundle(metaId))
}

override fun openPools() {
navController?.navigate(R.id.poolsFlowFragment)
}
}
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
package jp.co.soramitsu.app.root.presentation.main

import androidx.lifecycle.viewModelScope
import dagger.hilt.android.lifecycle.HiltViewModel
import javax.inject.Inject
import jp.co.soramitsu.app.root.domain.RootInteractor
import jp.co.soramitsu.common.base.BaseViewModel
import jp.co.soramitsu.core.runtime.ChainConnection
import jp.co.soramitsu.polkaswap.api.domain.PolkaswapInteractor
import jp.co.soramitsu.polkaswap.api.presentation.PolkaswapRouter
import jp.co.soramitsu.wallet.impl.presentation.WalletRouter
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.launchIn
import kotlinx.coroutines.flow.onEach
import javax.inject.Inject

@HiltViewModel
class MainViewModel @Inject constructor(
Expand All @@ -24,29 +21,19 @@ class MainViewModel @Inject constructor(

init {
externalRequirements.value = ChainConnection.ExternalRequirement.ALLOWED
walletRouter.listenPolkaswapDisclaimerResultFlowFromMainScreen()
.onEach {
if (it) {
walletRouter.openSwapTokensScreen(
chainId = null,
assetIdFrom = null,
assetIdTo = null
)
}
}.launchIn(viewModelScope)
}

val stakingAvailableLiveData = interactor.stakingAvailableFlow()
.asLiveData()

fun navigateToSwapScreen() {
if (polkaswapInteractor.hasReadDisclaimer) {
walletRouter.openSwapTokensScreen(
chainId = null,
assetIdFrom = null,
assetIdTo = null
)
} else {
walletRouter.openSwapTokensScreen(
chainId = null,
assetIdFrom = null,
assetIdTo = null
)

if (!polkaswapInteractor.hasReadDisclaimer) {
polkaswapRouter.openPolkaswapDisclaimerFromMainScreen()
}
}
Expand Down
1 change: 0 additions & 1 deletion app/src/main/res/navigation/bottom_nav_graph.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

<fragment
android:id="@+id/profileFragment"
tools:layout="@layout/fragment_profile"
android:name="jp.co.soramitsu.account.impl.presentation.profile.ProfileFragment"
android:label="ProfileFragment" />

Expand Down
10 changes: 10 additions & 0 deletions app/src/main/res/navigation/main_nav_graph.xml
Original file line number Diff line number Diff line change
Expand Up @@ -934,6 +934,11 @@
app:popExitAnim="?android:attr/fragmentCloseExitAnimation" />
</dialog>

<dialog
android:id="@+id/poolsFlowFragment"
android:name="jp.co.soramitsu.liquiditypools.impl.presentation.PoolsFlowFragment"
android:label="poolsFlowFragment" />

<fragment
android:id="@+id/settingsCustomValidatorsFragment"
android:name="jp.co.soramitsu.staking.impl.presentation.validators.change.custom.settings.CustomValidatorsSettingsFragment"
Expand Down Expand Up @@ -1362,4 +1367,9 @@
android:name="jp.co.soramitsu.wallet.impl.presentation.beacon.sign.TransactionRawDataFragment"
android:label="TransactionRawDataFragment" />

<fragment
android:id="@+id/scoreDetailsFragment"
android:name="jp.co.soramitsu.account.impl.presentation.nomis_scoring.ScoreDetailsFragment"
android:label="ScoreDetailsFragment" />

</navigation>
25 changes: 20 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,20 @@ apply plugin: "org.sonarqube"
buildscript {
ext {
// App version
versionName = '3.6.1'
versionCode = 192
versionName = '3.7.1'
versionCode = 200

// SDK and tools
compileSdkVersion = 34
minSdkVersion = 24
minSdkVersion = 26
targetSdkVersion = 34

composeCompilerVersion = '1.5.11'
composeCompilerVersion = '1.5.14'

withoutBasic = { exclude group: 'jp.co.soramitsu.xnetworking', module: 'basic' }
withoutJna = { exclude group: 'net.java.dev.jna' }
withoutJavaWS = { exclude module: 'java-websocket-lib' }
withoutAndroidFoundation = { exclude module: 'android-foundation' }
}

repositories {
Expand Down Expand Up @@ -61,10 +62,24 @@ allprojects {
}
}
}

configurations {
cleanedAnnotations
implementation.exclude group: 'com.intellij' , module:'annotations'
}

configurations.configureEach {
resolutionStrategy {
// add dependency substitution rules
dependencySubstitution {
substitute module('org.bouncycastle:bcprov-jdk15on') using module('org.bouncycastle:bcprov-jdk18on:1.78')
}
}
}
}

tasks.register('clean', Delete) {
delete rootProject.buildDir
delete rootProject.layout.buildDirectory
}

tasks.register('runTest', GradleBuild) {
Expand Down
1 change: 1 addition & 0 deletions buildSrc/src/main/kotlin/detekt-setup.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ fun Detekt.setup(autoCorrect: Boolean) {

// TODO: Remove exclude paths after merge detekt to develop
exclude(
"**/androidfoundation/**",
"**/common/**",
"**/core-api/**",
"**/core-db/**",
Expand Down
2 changes: 1 addition & 1 deletion common/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -163,5 +163,5 @@ dependencies {
testImplementation libs.mockito.inline
testImplementation project(':test-shared')

api libs.sharedFeaturesCoreDep
api libs.sharedFeaturesCoreDep, withoutAndroidFoundation
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package jp.co.soramitsu.common.compose.component

import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.padding
Expand All @@ -13,16 +12,15 @@ import androidx.compose.material.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment.Companion.CenterVertically
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.platform.testTag
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import jp.co.soramitsu.common.R
import jp.co.soramitsu.common.compose.theme.FearlessTheme
import jp.co.soramitsu.common.compose.theme.customColors
import jp.co.soramitsu.common.compose.theme.FearlessAppTheme
import jp.co.soramitsu.common.compose.theme.customTypography
import jp.co.soramitsu.common.compose.theme.white
import jp.co.soramitsu.common.compose.theme.white08
import jp.co.soramitsu.common.utils.formatting.shortenAddress

@Composable
Expand All @@ -32,10 +30,9 @@ fun Address(
onClick: () -> Unit
) {
Surface(
modifier.background(
color = MaterialTheme.customColors.white08,
shape = RoundedCornerShape(100.dp)
)
color = white08,
shape = RoundedCornerShape(100.dp),
modifier = modifier
) {
Row(
modifier = Modifier
Expand All @@ -45,7 +42,7 @@ fun Address(
Text(
text = address.shortenAddress(),
style = MaterialTheme.customTypography.body2,
color = Color.White,
color = white,
maxLines = 1,
modifier = Modifier
.testTag("address")
Expand All @@ -68,12 +65,10 @@ fun Address(
@Preview
@Composable
private fun AddressPreview() {
FearlessTheme {
Surface(Modifier.background(Color.Black)) {
FearlessAppTheme {
Address(
address = "0x32141235qwegtf24315reqwerfasdgqwert243rfasdvgergsdf",
onClick = {}
)
}
}
}
Loading

0 comments on commit 0776bd2

Please sign in to comment.