From 64d4941dedc9507dd09bd21c176ac1a071cf0fd1 Mon Sep 17 00:00:00 2001 From: arvifox Date: Wed, 4 Oct 2023 12:45:23 +0300 Subject: [PATCH] sca-116 wip --- app/build.gradle | 6 -- build.gradle | 21 +++---- common/build.gradle | 3 +- .../common/di/modules/CommonModule.kt | 8 +-- common/src/main/res/layout/layout_loading.xml | 12 ++-- common_wallet/build.gradle | 3 +- demeter/build.gradle | 3 +- feature_assets_api/build.gradle | 4 +- feature_assets_impl/build.gradle | 4 -- feature_blockexplorer_api/build.gradle | 4 +- .../data/BlockExplorerManager.kt | 62 ++++++++++--------- feature_blockexplorer_impl/build.gradle | 4 +- .../data/TransactionHistoryRepositoryImpl.kt | 4 +- .../data/TransactionMapper.kt | 4 +- .../data/TransactionHistoryRepositoryTest.kt | 2 +- .../testdata/TestTransactions.kt | 6 +- feature_ecosystem_api/build.gradle | 3 +- feature_ecosystem_impl/build.gradle | 5 +- feature_main_impl/build.gradle | 1 - feature_multiaccount_impl/build.gradle | 1 - feature_polkaswap_api/build.gradle | 3 +- feature_polkaswap_impl/build.gradle | 5 +- feature_referral_api/build.gradle | 2 +- feature_referral_impl/build.gradle | 4 +- feature_select_node_impl/build.gradle | 4 +- feature_sora_card_impl/build.gradle | 2 +- feature_wallet_api/build.gradle | 3 +- feature_wallet_impl/build.gradle | 4 -- .../datasource/BuyCryptoDataSourceImpl.kt | 2 +- .../di/WalletFeatureModule.kt | 2 +- network/build.gradle | 5 +- .../java/jp/co/soramitsu/network/WebSocket.kt | 8 +-- sorasubstrate/build.gradle | 2 +- .../sora/substrate/di/SubstrateModule.kt | 6 +- .../sora/substrate/runtime/RuntimeManager.kt | 2 +- 35 files changed, 89 insertions(+), 125 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 18ab52d97..d4f958efa 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -120,10 +120,6 @@ android { } } - kotlin { - jvmToolchain(11) - } - applicationVariants.all { variant -> variant.outputs.all { output -> outputFileName = new File("Sora_" + variant.versionName + "_" + variant.flavorName + "_" + buildType.name + ".apk") @@ -184,7 +180,6 @@ dependencies { implementation androidDep implementation appCompatResourcesDep implementation materialDep - implementation cardViewDep implementation constraintDep implementation navigationFragmentDep @@ -210,7 +205,6 @@ dependencies { implementation platform(googleFirebaseBomDep) implementation googleCrashlyticsDep - implementation xNetworkingDep implementation webSocketLibDep implementation zXingCoreDep diff --git a/build.gradle b/build.gradle index a1b75837e..4c4cf9a61 100644 --- a/build.gradle +++ b/build.gradle @@ -39,17 +39,16 @@ buildscript { insetter : '0.6.0', truth : '1.1.5', lottie : '4.2.0', - xNetworking : '0.0.61', - compose : '1.5.1', - composeMaterial : '1.4.3', + xNetworking : '0.2.1', + compose : '1.5.2', composeCompiler : '1.5.3', composeConstraintLayout: '1.1.0-alpha05', uiCore : '0.2.7', - soraCard : '0.1.45', + soraCard : '0.1.48', lazySodium : '5.0.2', jna : '5.8.0', accompanist : '0.30.1', - xserializationjson : '1.5.0', + xserializationjson : '1.5.1', ktor : '2.3.1', xbackup : '0.0.2-20231002.173502-3' ] @@ -73,7 +72,6 @@ buildscript { appCompatResourcesDep = "androidx.appcompat:appcompat-resources:1.6.1" biometricDep = "androidx.biometric:biometric:$versions.biometric" materialDep = "com.google.android.material:material:1.9.0" - cardViewDep = "androidx.cardview:cardview:1.0.0" constraintDep = "androidx.constraintlayout:constraintlayout:$versions.constraint" activityKtxDep = "androidx.activity:activity-ktx:1.7.1" fragmentKtxDep = "androidx.fragment:fragment-ktx:1.6.1" @@ -113,7 +111,8 @@ buildscript { irohaDep = "com.github.hyperledger.iroha-java:client:$versions.iroha" soraDep = "com.github.soramitsu:sora-sdk:$versions.soraSdk" - xNetworkingDep = "jp.co.soramitsu:XNetworking-android:$versions.xNetworking" + xNetworkingDep = "jp.co.soramitsu.xnetworking:basic-android:$versions.xNetworking" + xNetworkingSoraWalletDep = "jp.co.soramitsu.xnetworking:sorawallet-android:$versions.xNetworking" ktorWebSocketDep = "io.ktor:ktor-client-websockets:$versions.ktor" webSocketLibDep = "com.neovisionaries:nv-websocket-client:$versions.webSocketLib" uiCoreDep = "jp.co.soramitsu:ui-core:$versions.uiCore" @@ -202,12 +201,12 @@ buildscript { composeAnimationGraphicsDep = "androidx.compose.animation:animation-graphics:$versions.compose" composeToolingDep = "androidx.compose.ui:ui-tooling:$versions.compose" composeToolingPreviewDep = "androidx.compose.ui:ui-tooling-preview:$versions.compose" - composeActivityDep = "androidx.activity:activity-compose:1.7.1" - composeViewModelDep = "androidx.lifecycle:lifecycle-viewmodel-compose:2.6.1" - composeLifecycleDep = "androidx.lifecycle:lifecycle-runtime-compose:2.6.1" + composeActivityDep = "androidx.activity:activity-compose:1.7.2" + composeViewModelDep = "androidx.lifecycle:lifecycle-viewmodel-compose:2.6.2" + composeLifecycleDep = "androidx.lifecycle:lifecycle-runtime-compose:2.6.2" composeConstraintLayoutDep = "androidx.constraintlayout:constraintlayout-compose:$versions.composeConstraintLayout" - accompanistNavAnimationDep = "com.google.accompanist:accompanist-navigation-animation:$versions.accompanist" +// accompanistNavAnimationDep = "com.google.accompanist:accompanist-navigation-animation:$versions.accompanist" lazySodiumDep = "com.goterl:lazysodium-android:$versions.lazySodium@aar" jnaDep = "net.java.dev.jna:jna:$versions.jna@aar" diff --git a/common/build.gradle b/common/build.gradle index d442031cc..ae0ad1313 100644 --- a/common/build.gradle +++ b/common/build.gradle @@ -113,13 +113,13 @@ dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) implementation project(":android-foundation") implementation project(":soracrypro") + implementation project(":network") implementation activityKtxDep implementation coreKtxDep implementation androidDep implementation appCompatResourcesDep implementation materialDep - implementation cardViewDep implementation constraintDep implementation coroutineAndroidDep @@ -132,7 +132,6 @@ dependencies { implementation googlePlayCoreDep implementation coilSvgDep - implementation xNetworkingDep implementation webSocketLibDep implementation uiCoreDep diff --git a/common/src/main/java/jp/co/soramitsu/common/di/modules/CommonModule.kt b/common/src/main/java/jp/co/soramitsu/common/di/modules/CommonModule.kt index b71c5c463..ab7a70d12 100644 --- a/common/src/main/java/jp/co/soramitsu/common/di/modules/CommonModule.kt +++ b/common/src/main/java/jp/co/soramitsu/common/di/modules/CommonModule.kt @@ -83,14 +83,14 @@ import jp.co.soramitsu.common.vibration.DeviceVibrator import jp.co.soramitsu.crypto.ed25519.Ed25519Sha3 import jp.co.soramitsu.shared_utils.encrypt.json.JsonSeedEncoder import jp.co.soramitsu.xbackup.BackupService -import jp.co.soramitsu.xnetworking.networkclient.SoramitsuHttpClientProvider -import jp.co.soramitsu.xnetworking.networkclient.SoramitsuHttpClientProviderImpl -import jp.co.soramitsu.xnetworking.networkclient.SoramitsuNetworkClient +import jp.co.soramitsu.xnetworking.basic.networkclient.SoramitsuHttpClientProvider +import jp.co.soramitsu.xnetworking.basic.networkclient.SoramitsuHttpClientProviderImpl +import jp.co.soramitsu.xnetworking.basic.networkclient.SoramitsuNetworkClient import jp.co.soramitsu.xnetworking.sorawallet.blockexplorerinfo.SoraWalletBlockExplorerInfo import jp.co.soramitsu.xnetworking.sorawallet.mainconfig.SoraRemoteConfigBuilder import jp.co.soramitsu.xnetworking.sorawallet.mainconfig.SoraRemoteConfigProvider import jp.co.soramitsu.xnetworking.sorawallet.tokenwhitelist.SoraTokensWhitelistManager -import jp.co.soramitsu.xnetworking.txhistory.client.sorawallet.SubQueryClientForSoraWalletFactory +import jp.co.soramitsu.xnetworking.sorawallet.txhistory.client.SubQueryClientForSoraWalletFactory @InstallIn(SingletonComponent::class) @Module diff --git a/common/src/main/res/layout/layout_loading.xml b/common/src/main/res/layout/layout_loading.xml index 7c625e33a..c36b8fcb1 100644 --- a/common/src/main/res/layout/layout_loading.xml +++ b/common/src/main/res/layout/layout_loading.xml @@ -1,17 +1,17 @@ - + android:orientation="horizontal" + app:cardCornerRadius="@dimen/x2"> + android:indeterminate="true" /> - \ No newline at end of file + \ No newline at end of file diff --git a/common_wallet/build.gradle b/common_wallet/build.gradle index 8d7f2498d..c436f2b6a 100644 --- a/common_wallet/build.gradle +++ b/common_wallet/build.gradle @@ -62,10 +62,10 @@ dependencies { implementation project(":common") implementation project(":feature_blockexplorer_api") implementation project(":core_db") + implementation project(":network") implementation coreKtxDep implementation materialDep - implementation cardViewDep implementation constraintDep implementation coroutineAndroidDep @@ -76,7 +76,6 @@ dependencies { implementation googlePlayCoreDep implementation coilSvgDep - implementation xNetworkingDep implementation webSocketLibDep implementation uiCoreDep diff --git a/demeter/build.gradle b/demeter/build.gradle index ce799d2a3..efa5aadb5 100644 --- a/demeter/build.gradle +++ b/demeter/build.gradle @@ -64,6 +64,7 @@ dependencies { implementation project(":feature_blockexplorer_api") implementation project(":feature_account_api") implementation project(":sorasubstrate") + implementation project(":network") implementation daggerDep kapt daggerKaptDep @@ -75,10 +76,8 @@ dependencies { implementation roomDep implementation roomKtxDep - //kapt roomKaptDep implementation sharedUtilsDep - implementation xNetworkingDep testImplementation project(":test_shared") testImplementation project(":test_data") diff --git a/feature_assets_api/build.gradle b/feature_assets_api/build.gradle index 6a2c75f1a..f0c2e9e20 100644 --- a/feature_assets_api/build.gradle +++ b/feature_assets_api/build.gradle @@ -63,6 +63,7 @@ dependencies { implementation project(":common") implementation project(':common_wallet') implementation project(":sorasubstrate") + implementation project(":network") implementation sharedUtilsDep implementation coroutineAndroidDep @@ -84,9 +85,6 @@ dependencies { implementation composeLifecycleDep debugImplementation composeToolingDep implementation navigationComposeDep - //implementation accompanistNavAnimationDep - - implementation xNetworkingDep implementation daggerDep kapt daggerKaptDep diff --git a/feature_assets_impl/build.gradle b/feature_assets_impl/build.gradle index 6b58b4180..a4da6b277 100644 --- a/feature_assets_impl/build.gradle +++ b/feature_assets_impl/build.gradle @@ -79,7 +79,6 @@ dependencies { implementation androidDep implementation materialDep - implementation cardViewDep implementation constraintDep implementation navigationFragmentDep @@ -131,9 +130,6 @@ dependencies { implementation composeLifecycleDep debugImplementation composeToolingDep implementation navigationComposeDep - //implementation accompanistNavAnimationDep - - implementation xNetworkingDep implementation zXingCoreDep implementation zXingEmbeddedDep diff --git a/feature_blockexplorer_api/build.gradle b/feature_blockexplorer_api/build.gradle index 886ef841c..8425d8c12 100644 --- a/feature_blockexplorer_api/build.gradle +++ b/feature_blockexplorer_api/build.gradle @@ -64,10 +64,10 @@ dependencies { implementation project(":common") implementation project(":core_db") + implementation project(":network") implementation androidDep implementation materialDep - implementation cardViewDep implementation constraintDep implementation coilDep @@ -106,8 +106,6 @@ dependencies { implementation navigationFragmentDep implementation navigationUiDep - implementation xNetworkingDep - implementation daggerDep kapt daggerKaptDep diff --git a/feature_blockexplorer_api/src/main/java/jp/co/soramitsu/feature_blockexplorer_api/data/BlockExplorerManager.kt b/feature_blockexplorer_api/src/main/java/jp/co/soramitsu/feature_blockexplorer_api/data/BlockExplorerManager.kt index 5d1723c43..d11aeaf4b 100644 --- a/feature_blockexplorer_api/src/main/java/jp/co/soramitsu/feature_blockexplorer_api/data/BlockExplorerManager.kt +++ b/feature_blockexplorer_api/src/main/java/jp/co/soramitsu/feature_blockexplorer_api/data/BlockExplorerManager.kt @@ -44,10 +44,12 @@ import jp.co.soramitsu.common.logger.FirebaseWrapper import jp.co.soramitsu.core_db.AppDatabase import jp.co.soramitsu.core_db.model.FiatTokenPriceLocal import jp.co.soramitsu.core_db.model.ReferralLocal -import jp.co.soramitsu.xnetworking.common.Utils.toDoubleNan -import jp.co.soramitsu.xnetworking.networkclient.SoramitsuNetworkClient +import jp.co.soramitsu.xnetworking.basic.common.Utils.toDoubleNan +import jp.co.soramitsu.xnetworking.basic.networkclient.SoramitsuNetworkClient import jp.co.soramitsu.xnetworking.sorawallet.blockexplorerinfo.SoraWalletBlockExplorerInfo import jp.co.soramitsu.xnetworking.sorawallet.blockexplorerinfo.sbapy.SbApyInfo +import kotlinx.coroutines.sync.Mutex +import kotlinx.coroutines.sync.withLock import kotlinx.serialization.json.Json import kotlinx.serialization.serializer @@ -64,6 +66,8 @@ class BlockExplorerManager @Inject constructor( private var assetsInfo: List>? = null + private val mutex = Mutex() + fun getTempApy(id: String) = tempApy.find { it.id == id }?.sbApy?.times(100) @@ -73,25 +77,27 @@ class BlockExplorerManager @Inject constructor( assetsInfo = it } - private suspend fun getAssetsInfoInternal(tokenIds: List): List> = runCatching { - val selected = soraConfigManager.getSelectedCurrency() - val tokens = db.assetDao().getFiatTokenPriceLocal(selected.code) - val yesterdayHour = yesterday() - val resultList = mutableListOf>() - val fiats = mutableListOf() - info.getAssetsInfo(tokenIds, yesterdayHour).forEach { assetInfo -> - val dbValue = tokens.find { it.tokenIdFiat == assetInfo.tokenId } - val delta = assetInfo.hourDelta - if (dbValue != null && delta != null) { - fiats.add(dbValue.copy(fiatPricePrevH = delta, fiatPricePrevHTime = yesterdayHour)) + private suspend fun getAssetsInfoInternal(tokenIds: List): List> = mutex.withLock { + runCatching { + val selected = soraConfigManager.getSelectedCurrency() + val tokens = db.assetDao().getFiatTokenPriceLocal(selected.code) + val yesterdayHour = yesterday() + val resultList = mutableListOf>() + val fiats = mutableListOf() + info.getAssetsInfo(tokenIds, yesterdayHour).forEach { assetInfo -> + val dbValue = tokens.find { it.tokenIdFiat == assetInfo.tokenId } + val delta = assetInfo.hourDelta + if (dbValue != null && delta != null) { + fiats.add(dbValue.copy(fiatPricePrevH = delta, fiatPricePrevHTime = yesterdayHour)) + } + resultList.add(assetInfo.tokenId to BigInteger(assetInfo.liquidity)) } - resultList.add(assetInfo.tokenId to BigInteger(assetInfo.liquidity)) + db.assetDao().insertFiatPrice(fiats) + resultList + }.getOrElse { + FirebaseWrapper.recordException(it) + emptyList() } - db.assetDao().insertFiatPrice(fiats) - resultList - }.getOrElse { - FirebaseWrapper.recordException(it) - emptyList() } suspend fun updatePoolsSbApy() { @@ -99,7 +105,12 @@ class BlockExplorerManager @Inject constructor( } suspend fun updateFiat() { - updateFiatInternal() + if (appStateProvider.isForeground) { + runCatching { + val response = info.getFiat() + updateFiatPrices(response.map { FiatInfo(it.id, it.priceUsd) }) + } + } } suspend fun updateReferrerRewards( @@ -136,16 +147,7 @@ class BlockExplorerManager @Inject constructor( } } - private suspend fun updateFiatInternal() { - if (appStateProvider.isForeground) { - runCatching { - val response = info.getFiat() - updateFiatPrices(response.map { FiatInfo(it.id, it.priceUsd) }) - } - } - } - - private suspend fun updateFiatPrices(fiatData: List) { + private suspend fun updateFiatPrices(fiatData: List) = mutex.withLock { val selected = soraConfigManager.getSelectedCurrency() val tokens = db.assetDao().getTokensWithFiatOfCurrency(selected.code) diff --git a/feature_blockexplorer_impl/build.gradle b/feature_blockexplorer_impl/build.gradle index 095e86864..f672e511c 100644 --- a/feature_blockexplorer_impl/build.gradle +++ b/feature_blockexplorer_impl/build.gradle @@ -71,10 +71,10 @@ dependencies { implementation project(":feature_account_api") implementation project(":feature_main_api") implementation project(":feature_wallet_api") + implementation project(":network") implementation androidDep implementation materialDep - implementation cardViewDep implementation constraintDep implementation coilDep @@ -111,8 +111,6 @@ dependencies { implementation navigationFragmentDep implementation navigationUiDep - implementation xNetworkingDep - implementation daggerDep kapt daggerKaptDep diff --git a/feature_blockexplorer_impl/src/main/java/jp/co/soramitsu/feature_blockexplorer_impl/data/TransactionHistoryRepositoryImpl.kt b/feature_blockexplorer_impl/src/main/java/jp/co/soramitsu/feature_blockexplorer_impl/data/TransactionHistoryRepositoryImpl.kt index 2ab8f3f5d..8de9bf461 100644 --- a/feature_blockexplorer_impl/src/main/java/jp/co/soramitsu/feature_blockexplorer_impl/data/TransactionHistoryRepositoryImpl.kt +++ b/feature_blockexplorer_impl/src/main/java/jp/co/soramitsu/feature_blockexplorer_impl/data/TransactionHistoryRepositoryImpl.kt @@ -44,8 +44,8 @@ import jp.co.soramitsu.feature_blockexplorer_api.presentation.txhistory.Transact import jp.co.soramitsu.sora.substrate.runtime.Pallete import jp.co.soramitsu.sora.substrate.runtime.SubstrateOptionsProvider import jp.co.soramitsu.sora.substrate.substrate.ExtrinsicManager -import jp.co.soramitsu.xnetworking.txhistory.TxHistoryItem -import jp.co.soramitsu.xnetworking.txhistory.client.sorawallet.SubQueryClientForSoraWallet +import jp.co.soramitsu.xnetworking.basic.txhistory.TxHistoryItem +import jp.co.soramitsu.xnetworking.sorawallet.txhistory.client.SubQueryClientForSoraWallet import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.debounce diff --git a/feature_blockexplorer_impl/src/main/java/jp/co/soramitsu/feature_blockexplorer_impl/data/TransactionMapper.kt b/feature_blockexplorer_impl/src/main/java/jp/co/soramitsu/feature_blockexplorer_impl/data/TransactionMapper.kt index ca95668a9..80585608c 100644 --- a/feature_blockexplorer_impl/src/main/java/jp/co/soramitsu/feature_blockexplorer_impl/data/TransactionMapper.kt +++ b/feature_blockexplorer_impl/src/main/java/jp/co/soramitsu/feature_blockexplorer_impl/data/TransactionMapper.kt @@ -46,8 +46,8 @@ import jp.co.soramitsu.feature_blockexplorer_api.presentation.txhistory.Transact import jp.co.soramitsu.sora.substrate.runtime.Method import jp.co.soramitsu.sora.substrate.runtime.Pallete import jp.co.soramitsu.sora.substrate.runtime.SubstrateOptionsProvider -import jp.co.soramitsu.xnetworking.txhistory.TxHistoryItem -import jp.co.soramitsu.xnetworking.txhistory.TxHistoryItemParam +import jp.co.soramitsu.xnetworking.basic.txhistory.TxHistoryItem +import jp.co.soramitsu.xnetworking.basic.txhistory.TxHistoryItemParam fun mapHistoryItemsToTransactions( txs: List, diff --git a/feature_blockexplorer_impl/src/test/java/jp/co/soramitsu/feature_blockexplorer_impl/data/TransactionHistoryRepositoryTest.kt b/feature_blockexplorer_impl/src/test/java/jp/co/soramitsu/feature_blockexplorer_impl/data/TransactionHistoryRepositoryTest.kt index 5ab0ab473..b40966517 100644 --- a/feature_blockexplorer_impl/src/test/java/jp/co/soramitsu/feature_blockexplorer_impl/data/TransactionHistoryRepositoryTest.kt +++ b/feature_blockexplorer_impl/src/test/java/jp/co/soramitsu/feature_blockexplorer_impl/data/TransactionHistoryRepositoryTest.kt @@ -47,7 +47,7 @@ import jp.co.soramitsu.sora.substrate.substrate.ExtrinsicManager import jp.co.soramitsu.test_data.TestAccounts import jp.co.soramitsu.test_data.TestTokens import jp.co.soramitsu.test_shared.MainCoroutineRule -import jp.co.soramitsu.xnetworking.txhistory.client.sorawallet.SubQueryClientForSoraWallet +import jp.co.soramitsu.xnetworking.sorawallet.txhistory.client.SubQueryClientForSoraWallet import junit.framework.TestCase.assertEquals import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.test.runTest diff --git a/feature_blockexplorer_impl/src/test/java/jp/co/soramitsu/feature_blockexplorer_impl/testdata/TestTransactions.kt b/feature_blockexplorer_impl/src/test/java/jp/co/soramitsu/feature_blockexplorer_impl/testdata/TestTransactions.kt index 8304c7aa9..f0a7a7cf5 100644 --- a/feature_blockexplorer_impl/src/test/java/jp/co/soramitsu/feature_blockexplorer_impl/testdata/TestTransactions.kt +++ b/feature_blockexplorer_impl/src/test/java/jp/co/soramitsu/feature_blockexplorer_impl/testdata/TestTransactions.kt @@ -38,12 +38,10 @@ import jp.co.soramitsu.feature_blockexplorer_api.presentation.txhistory.Transact import jp.co.soramitsu.feature_blockexplorer_api.presentation.txhistory.TransactionLiquidityType import jp.co.soramitsu.feature_blockexplorer_api.presentation.txhistory.TransactionStatus import jp.co.soramitsu.feature_blockexplorer_api.presentation.txhistory.TransactionTransferType -import jp.co.soramitsu.sora.substrate.runtime.Method -import jp.co.soramitsu.sora.substrate.runtime.Pallete import jp.co.soramitsu.test_data.TestAccounts import jp.co.soramitsu.test_data.TestTokens -import jp.co.soramitsu.xnetworking.txhistory.TxHistoryItem -import jp.co.soramitsu.xnetworking.txhistory.TxHistoryItemParam +import jp.co.soramitsu.xnetworking.basic.txhistory.TxHistoryItem +import jp.co.soramitsu.xnetworking.basic.txhistory.TxHistoryItemParam import java.math.BigDecimal object TestTransactions { diff --git a/feature_ecosystem_api/build.gradle b/feature_ecosystem_api/build.gradle index 9fd1a1ae7..7200b5e43 100644 --- a/feature_ecosystem_api/build.gradle +++ b/feature_ecosystem_api/build.gradle @@ -54,13 +54,12 @@ dependencies { implementation project(":common") implementation project(':common_wallet') implementation project(":sorasubstrate") + implementation project(":network") implementation sharedUtilsDep implementation coroutineAndroidDep implementation coroutineDep - implementation xNetworkingDep - implementation daggerDep kapt daggerKaptDep } \ No newline at end of file diff --git a/feature_ecosystem_impl/build.gradle b/feature_ecosystem_impl/build.gradle index 4e5e152d3..1572fce28 100644 --- a/feature_ecosystem_impl/build.gradle +++ b/feature_ecosystem_impl/build.gradle @@ -67,12 +67,12 @@ dependencies { implementation project(":feature_polkaswap_api") implementation project(":sorasubstrate") implementation project(":feature_blockexplorer_api") + implementation project(":network") implementation sharedUtilsDep implementation androidDep implementation materialDep - implementation cardViewDep implementation constraintDep implementation navigationFragmentDep @@ -119,9 +119,6 @@ dependencies { implementation composeLifecycleDep debugImplementation composeToolingDep implementation navigationComposeDep - //implementation accompanistNavAnimationDep - - implementation xNetworkingDep implementation zXingCoreDep implementation zXingEmbeddedDep diff --git a/feature_main_impl/build.gradle b/feature_main_impl/build.gradle index fad73026e..59f4bcd09 100644 --- a/feature_main_impl/build.gradle +++ b/feature_main_impl/build.gradle @@ -77,7 +77,6 @@ dependencies { implementation androidDep implementation materialDep - implementation cardViewDep implementation constraintDep implementation biometricDep diff --git a/feature_multiaccount_impl/build.gradle b/feature_multiaccount_impl/build.gradle index 451fe176d..001de0492 100644 --- a/feature_multiaccount_impl/build.gradle +++ b/feature_multiaccount_impl/build.gradle @@ -79,7 +79,6 @@ dependencies { implementation androidDep implementation materialDep - implementation cardViewDep implementation constraintDep implementation coroutineAndroidDep diff --git a/feature_polkaswap_api/build.gradle b/feature_polkaswap_api/build.gradle index 34bba50e2..879303338 100644 --- a/feature_polkaswap_api/build.gradle +++ b/feature_polkaswap_api/build.gradle @@ -54,13 +54,12 @@ dependencies { implementation project(":common") implementation project(':common_wallet') implementation project(":sorasubstrate") + implementation project(":network") implementation sharedUtilsDep implementation coroutineAndroidDep implementation coroutineDep - implementation xNetworkingDep - implementation daggerDep kapt daggerKaptDep } \ No newline at end of file diff --git a/feature_polkaswap_impl/build.gradle b/feature_polkaswap_impl/build.gradle index 3f10ba943..109905b77 100644 --- a/feature_polkaswap_impl/build.gradle +++ b/feature_polkaswap_impl/build.gradle @@ -72,12 +72,12 @@ dependencies { implementation project(":sorasubstrate") implementation project(":feature_main_api") implementation project(":feature_blockexplorer_api") + implementation project(":network") implementation sharedUtilsDep implementation androidDep implementation materialDep - implementation cardViewDep implementation constraintDep implementation navigationFragmentDep @@ -126,9 +126,6 @@ dependencies { implementation composeLifecycleDep debugImplementation composeToolingDep implementation navigationComposeDep - //implementation accompanistNavAnimationDep - - implementation xNetworkingDep implementation zXingCoreDep implementation zXingEmbeddedDep diff --git a/feature_referral_api/build.gradle b/feature_referral_api/build.gradle index 0179f217e..37a973eed 100644 --- a/feature_referral_api/build.gradle +++ b/feature_referral_api/build.gradle @@ -52,11 +52,11 @@ dependencies { implementation project(":sorasubstrate") implementation project(":feature_wallet_api") implementation project(":feature_blockexplorer_api") + implementation project(":network") implementation navigationFragmentDep implementation navigationUiDep - implementation xNetworkingDep implementation sharedUtilsDep implementation daggerDep diff --git a/feature_referral_impl/build.gradle b/feature_referral_impl/build.gradle index 3064f3bad..20f07b22c 100644 --- a/feature_referral_impl/build.gradle +++ b/feature_referral_impl/build.gradle @@ -69,10 +69,10 @@ dependencies { implementation project(":feature_referral_api") implementation project(":feature_blockexplorer_api") implementation project(":sorasubstrate") + implementation project(":network") implementation androidDep implementation materialDep - implementation cardViewDep implementation constraintDep implementation coroutineAndroidDep @@ -109,8 +109,6 @@ dependencies { implementation navigationFragmentDep implementation navigationUiDep - implementation xNetworkingDep - implementation daggerDep kapt daggerKaptDep diff --git a/feature_select_node_impl/build.gradle b/feature_select_node_impl/build.gradle index f8eeab74b..14c848c68 100644 --- a/feature_select_node_impl/build.gradle +++ b/feature_select_node_impl/build.gradle @@ -67,10 +67,10 @@ dependencies { implementation project(":core_di") implementation project(":sorasubstrate") implementation project(":soracrypro") + implementation project(":network") implementation androidDep implementation materialDep - implementation cardViewDep implementation constraintDep implementation coroutineAndroidDep @@ -83,8 +83,6 @@ dependencies { implementation navigationFragmentDep implementation navigationUiDep - implementation xNetworkingDep - implementation roomDep implementation roomKtxDep diff --git a/feature_sora_card_impl/build.gradle b/feature_sora_card_impl/build.gradle index 495eba692..c4cf0ff12 100644 --- a/feature_sora_card_impl/build.gradle +++ b/feature_sora_card_impl/build.gradle @@ -70,6 +70,7 @@ dependencies { implementation project(":feature_blockexplorer_api") implementation project(":sorasubstrate") implementation project(":core_di") + implementation project(":network") implementation kotlinxSerializationJsonDep @@ -88,7 +89,6 @@ dependencies { implementation navigationUiDep implementation uiCoreDep - implementation xNetworkingDep implementation timberDep diff --git a/feature_wallet_api/build.gradle b/feature_wallet_api/build.gradle index f61f7b9cd..e277046ae 100644 --- a/feature_wallet_api/build.gradle +++ b/feature_wallet_api/build.gradle @@ -54,13 +54,12 @@ dependencies { implementation project(":common") implementation project(':common_wallet') implementation project(":sorasubstrate") + implementation project(":network") implementation sharedUtilsDep implementation coroutineAndroidDep implementation coroutineDep - implementation xNetworkingDep - implementation daggerDep kapt daggerKaptDep } \ No newline at end of file diff --git a/feature_wallet_impl/build.gradle b/feature_wallet_impl/build.gradle index 18dcbbbf0..55aba7960 100644 --- a/feature_wallet_impl/build.gradle +++ b/feature_wallet_impl/build.gradle @@ -85,7 +85,6 @@ dependencies { implementation androidDep implementation materialDep - implementation cardViewDep implementation constraintDep implementation navigationFragmentDep @@ -137,9 +136,6 @@ dependencies { implementation composeLifecycleDep debugImplementation composeToolingDep implementation navigationComposeDep - //implementation accompanistNavAnimationDep - - implementation xNetworkingDep implementation zXingCoreDep implementation zXingEmbeddedDep diff --git a/feature_wallet_impl/src/main/java/jp/co/soramitsu/feature_wallet_impl/data/repository/datasource/BuyCryptoDataSourceImpl.kt b/feature_wallet_impl/src/main/java/jp/co/soramitsu/feature_wallet_impl/data/repository/datasource/BuyCryptoDataSourceImpl.kt index 626f9937e..6f915c426 100644 --- a/feature_wallet_impl/src/main/java/jp/co/soramitsu/feature_wallet_impl/data/repository/datasource/BuyCryptoDataSourceImpl.kt +++ b/feature_wallet_impl/src/main/java/jp/co/soramitsu/feature_wallet_impl/data/repository/datasource/BuyCryptoDataSourceImpl.kt @@ -40,7 +40,7 @@ import jp.co.soramitsu.network.WebSocket import jp.co.soramitsu.network.WebSocketListener import jp.co.soramitsu.network.WebSocketRequest import jp.co.soramitsu.network.WebSocketResponse -import jp.co.soramitsu.xnetworking.networkclient.SoramitsuHttpClientProvider +import jp.co.soramitsu.xnetworking.basic.networkclient.SoramitsuHttpClientProvider import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.MutableSharedFlow import kotlinx.serialization.decodeFromString diff --git a/feature_wallet_impl/src/main/java/jp/co/soramitsu/feature_wallet_impl/di/WalletFeatureModule.kt b/feature_wallet_impl/src/main/java/jp/co/soramitsu/feature_wallet_impl/di/WalletFeatureModule.kt index e765ed5d8..00e3aff5d 100644 --- a/feature_wallet_impl/src/main/java/jp/co/soramitsu/feature_wallet_impl/di/WalletFeatureModule.kt +++ b/feature_wallet_impl/src/main/java/jp/co/soramitsu/feature_wallet_impl/di/WalletFeatureModule.kt @@ -57,7 +57,7 @@ import jp.co.soramitsu.feature_wallet_impl.data.repository.datasource.PrefsWalle import jp.co.soramitsu.feature_wallet_impl.domain.PoolsFeatureStorageManager import jp.co.soramitsu.feature_wallet_impl.domain.WalletInteractorImpl import jp.co.soramitsu.sora.substrate.runtime.RuntimeManager -import jp.co.soramitsu.xnetworking.networkclient.SoramitsuHttpClientProvider +import jp.co.soramitsu.xnetworking.basic.networkclient.SoramitsuHttpClientProvider import kotlinx.coroutines.FlowPreview @FlowPreview diff --git a/network/build.gradle b/network/build.gradle index d31922afc..e7841c282 100644 --- a/network/build.gradle +++ b/network/build.gradle @@ -50,6 +50,9 @@ dependencies { implementation kotlinxSerializationJsonDep - implementation xNetworkingDep + api(xNetworkingDep) + api(xNetworkingSoraWalletDep) { + exclude group: 'jp.co.soramitsu.xnetworking', module: 'basic' + } implementation ktorWebSocketDep } diff --git a/network/src/main/java/jp/co/soramitsu/network/WebSocket.kt b/network/src/main/java/jp/co/soramitsu/network/WebSocket.kt index c1cc3a02c..9ddfad295 100644 --- a/network/src/main/java/jp/co/soramitsu/network/WebSocket.kt +++ b/network/src/main/java/jp/co/soramitsu/network/WebSocket.kt @@ -38,9 +38,9 @@ import io.ktor.client.plugins.websocket.webSocket import io.ktor.websocket.Frame import io.ktor.websocket.close import io.ktor.websocket.readText -import jp.co.soramitsu.xnetworking.networkclient.NetworkClientConfig -import jp.co.soramitsu.xnetworking.networkclient.SoramitsuHttpClientProvider -import jp.co.soramitsu.xnetworking.networkclient.WebSocketClientConfig +import jp.co.soramitsu.xnetworking.basic.networkclient.NetworkClientConfig +import jp.co.soramitsu.xnetworking.basic.networkclient.SoramitsuHttpClientProvider +import jp.co.soramitsu.xnetworking.basic.networkclient.WebSocketClientConfig import kotlinx.coroutines.flow.filter import kotlinx.coroutines.flow.receiveAsFlow import kotlinx.coroutines.launch @@ -63,7 +63,7 @@ class WebSocket( pingInterval: Long = 20, maxFrameSize: Long = Int.MAX_VALUE.toLong(), logging: Boolean = false, - provider: SoramitsuHttpClientProvider + provider: SoramitsuHttpClientProvider, ) { private var socketSession: DefaultClientWebSocketSession? = null diff --git a/sorasubstrate/build.gradle b/sorasubstrate/build.gradle index 80e4acf97..2db021b0c 100644 --- a/sorasubstrate/build.gradle +++ b/sorasubstrate/build.gradle @@ -56,8 +56,8 @@ dependencies { implementation project(":common_wallet") implementation project(":feature_blockexplorer_api") implementation project(":soracrypro") + implementation project(":network") - implementation xNetworkingDep implementation gsonDep implementation webSocketLibDep implementation coroutineAndroidDep diff --git a/sorasubstrate/src/main/java/jp/co/soramitsu/sora/substrate/di/SubstrateModule.kt b/sorasubstrate/src/main/java/jp/co/soramitsu/sora/substrate/di/SubstrateModule.kt index f9a25bac5..28e984645 100644 --- a/sorasubstrate/src/main/java/jp/co/soramitsu/sora/substrate/di/SubstrateModule.kt +++ b/sorasubstrate/src/main/java/jp/co/soramitsu/sora/substrate/di/SubstrateModule.kt @@ -55,10 +55,10 @@ import jp.co.soramitsu.sora.substrate.substrate.SubstrateApi import jp.co.soramitsu.sora.substrate.substrate.SubstrateApiImpl import jp.co.soramitsu.sora.substrate.substrate.WsConnectionManager import jp.co.soramitsu.sora.substrate.substrate.WsLogger -import jp.co.soramitsu.xnetworking.networkclient.SoramitsuNetworkClient +import jp.co.soramitsu.xnetworking.basic.networkclient.SoramitsuNetworkClient import jp.co.soramitsu.xnetworking.sorawallet.mainconfig.SoraRemoteConfigBuilder -import jp.co.soramitsu.xnetworking.txhistory.client.sorawallet.SubQueryClientForSoraWallet -import jp.co.soramitsu.xnetworking.txhistory.client.sorawallet.SubQueryClientForSoraWalletFactory +import jp.co.soramitsu.xnetworking.sorawallet.txhistory.client.SubQueryClientForSoraWallet +import jp.co.soramitsu.xnetworking.sorawallet.txhistory.client.SubQueryClientForSoraWalletFactory @InstallIn(SingletonComponent::class) @Module 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 040a4ea0f..9965631c6 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 @@ -66,7 +66,7 @@ import jp.co.soramitsu.shared_utils.wsrpc.mappers.nonNull import jp.co.soramitsu.shared_utils.wsrpc.mappers.pojo import jp.co.soramitsu.shared_utils.wsrpc.request.runtime.chain.RuntimeVersion import jp.co.soramitsu.shared_utils.wsrpc.request.runtime.chain.RuntimeVersionRequest -import jp.co.soramitsu.xnetworking.networkclient.SoramitsuNetworkClient +import jp.co.soramitsu.xnetworking.basic.networkclient.SoramitsuNetworkClient import kotlinx.coroutines.launch import kotlinx.coroutines.sync.Mutex import kotlinx.coroutines.sync.withLock