Skip to content

Commit

Permalink
Merge pull request #849 from soramitsu/merge/staging-to-master
Browse files Browse the repository at this point in the history
merge/staging-to-master
  • Loading branch information
PankraSerg authored Feb 24, 2023
2 parents 36ba728 + 0f5ac70 commit 0a7f2a9
Show file tree
Hide file tree
Showing 207 changed files with 7,770 additions and 1,025 deletions.
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ root = true
max_line_length = 160
insert_final_newline = true
indent_size = 4
ktlint_disabled_rules = import-ordering
ktlint_disabled_rules = import-ordering,package-name
6 changes: 6 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,12 @@ dependencies {
implementation project(':feature-crowdloan-api')
implementation project(':feature-crowdloan-impl')

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

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

implementation kotlinDep

implementation androidDep
Expand Down
10 changes: 10 additions & 0 deletions app/src/main/java/jp/co/soramitsu/app/di/app/NavigationModule.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@ import jp.co.soramitsu.app.root.navigation.Navigator
import jp.co.soramitsu.account.impl.presentation.AccountRouter
import jp.co.soramitsu.crowdloan.impl.presentation.CrowdloanRouter
import jp.co.soramitsu.onboarding.impl.OnboardingRouter
import jp.co.soramitsu.polkaswap.api.presentation.PolkaswapRouter
import jp.co.soramitsu.staking.impl.presentation.StakingRouter
import jp.co.soramitsu.wallet.impl.presentation.WalletRouter
import jp.co.soramitsu.splash.SplashRouter
import jp.co.soramitsu.success.presentation.SuccessRouter
import javax.inject.Singleton

@InstallIn(SingletonComponent::class)
Expand All @@ -37,6 +39,14 @@ class NavigationModule {
@Provides
fun provideWalletRouter(navigator: Navigator): WalletRouter = navigator

@Singleton
@Provides
fun providePolkaswapRouter(navigator: Navigator): PolkaswapRouter = navigator

@Singleton
@Provides
fun provideSuccessRouter(navigator: Navigator): SuccessRouter = navigator

@Singleton
@Provides
fun provideStakingRouter(navigator: Navigator): StakingRouter = navigator
Expand Down
100 changes: 85 additions & 15 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 @@ -9,6 +9,7 @@ import androidx.lifecycle.asFlow
import androidx.navigation.NavController
import androidx.navigation.NavDeepLinkRequest
import androidx.navigation.NavOptions
import it.airgap.beaconsdk.blockchain.substrate.data.SubstrateSignerPayload
import jp.co.soramitsu.account.api.presentation.account.create.ChainAccountCreatePayload
import jp.co.soramitsu.account.api.presentation.actions.AddAccountBottomSheet
import jp.co.soramitsu.account.impl.domain.account.details.AccountInChain
Expand All @@ -18,6 +19,7 @@ import jp.co.soramitsu.account.impl.presentation.account.export.WalletExportFrag
import jp.co.soramitsu.account.impl.presentation.account.exportaccounts.AccountsForExportFragment
import jp.co.soramitsu.account.impl.presentation.account.list.AccountChosenNavDirection
import jp.co.soramitsu.account.impl.presentation.account.list.AccountListFragment
import jp.co.soramitsu.account.impl.presentation.experimental.SuccessfulFragment
import jp.co.soramitsu.account.impl.presentation.exporting.json.confirm.ExportJsonConfirmFragment
import jp.co.soramitsu.account.impl.presentation.exporting.json.confirm.ExportJsonConfirmPayload
import jp.co.soramitsu.account.impl.presentation.exporting.json.password.ExportJsonPasswordFragment
Expand All @@ -35,8 +37,6 @@ import jp.co.soramitsu.account.impl.presentation.optionsaddaccount.OptionsAddAcc
import jp.co.soramitsu.account.impl.presentation.pincode.PinCodeAction
import jp.co.soramitsu.account.impl.presentation.pincode.PincodeFragment
import jp.co.soramitsu.account.impl.presentation.pincode.ToolbarConfiguration
import it.airgap.beaconsdk.blockchain.substrate.data.SubstrateSignerPayload
import jp.co.soramitsu.account.impl.presentation.experimental.SuccessfulFragment
import jp.co.soramitsu.app.R
import jp.co.soramitsu.app.root.presentation.AlertFragment
import jp.co.soramitsu.app.root.presentation.RootRouter
Expand All @@ -58,10 +58,15 @@ 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.wallet.impl.domain.beacon.SignStatus
import jp.co.soramitsu.wallet.impl.presentation.beacon.sign.TransactionRawDataFragment
import jp.co.soramitsu.onboarding.impl.OnboardingRouter
import jp.co.soramitsu.onboarding.impl.welcome.WelcomeFragment
import jp.co.soramitsu.polkaswap.api.presentation.PolkaswapRouter
import jp.co.soramitsu.polkaswap.api.presentation.models.SwapDetailsParcelModel
import jp.co.soramitsu.polkaswap.api.presentation.models.SwapDetailsViewState
import jp.co.soramitsu.polkaswap.api.presentation.models.TransactionSettingsModel
import jp.co.soramitsu.polkaswap.impl.presentation.swap_preview.SwapPreviewFragment
import jp.co.soramitsu.polkaswap.impl.presentation.swap_tokens.SwapTokensFragment
import jp.co.soramitsu.polkaswap.impl.presentation.transaction_settings.TransactionSettingsFragment
import jp.co.soramitsu.runtime.multiNetwork.chain.model.Chain
import jp.co.soramitsu.runtime.multiNetwork.chain.model.ChainId
import jp.co.soramitsu.splash.SplashRouter
Expand Down Expand Up @@ -96,6 +101,9 @@ import jp.co.soramitsu.staking.impl.presentation.validators.details.CollatorDeta
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.impl.domain.beacon.SignStatus
import jp.co.soramitsu.wallet.impl.domain.model.PhishingType
import jp.co.soramitsu.wallet.impl.presentation.AssetPayload
import jp.co.soramitsu.wallet.impl.presentation.WalletRouter
Expand All @@ -106,28 +114,31 @@ import jp.co.soramitsu.wallet.impl.presentation.balance.detail.BalanceDetailFrag
import jp.co.soramitsu.wallet.impl.presentation.balance.detail.frozen.FrozenAssetPayload
import jp.co.soramitsu.wallet.impl.presentation.balance.detail.frozen.FrozenTokensFragment
import jp.co.soramitsu.wallet.impl.presentation.balance.optionswallet.OptionsWalletFragment
import jp.co.soramitsu.wallet.impl.presentation.balance.searchAssets.SearchAssetsFragment
import jp.co.soramitsu.wallet.impl.presentation.balance.walletselector.light.WalletSelectorFragment
import jp.co.soramitsu.wallet.impl.presentation.beacon.main.BeaconFragment
import jp.co.soramitsu.wallet.impl.presentation.beacon.main.DAppMetadataModel
import jp.co.soramitsu.wallet.impl.presentation.beacon.sign.SignBeaconTransactionFragment
import jp.co.soramitsu.wallet.impl.presentation.balance.walletselector.light.WalletSelectorFragment
import jp.co.soramitsu.wallet.impl.presentation.beacon.sign.TransactionRawDataFragment
import jp.co.soramitsu.wallet.impl.presentation.history.AddressHistoryFragment
import jp.co.soramitsu.wallet.impl.presentation.model.OperationParcelizeModel
import jp.co.soramitsu.wallet.impl.presentation.receive.ReceiveFragment
import jp.co.soramitsu.wallet.impl.presentation.send.TransferDraft
import jp.co.soramitsu.wallet.impl.presentation.send.confirm.ConfirmSendFragment
import jp.co.soramitsu.wallet.impl.presentation.send.setup.SendSetupFragment
import jp.co.soramitsu.wallet.impl.presentation.send.success.SendSuccessFragment
import jp.co.soramitsu.wallet.impl.presentation.transaction.detail.extrinsic.ExtrinsicDetailFragment
import jp.co.soramitsu.wallet.impl.presentation.transaction.detail.extrinsic.ExtrinsicDetailsPayload
import jp.co.soramitsu.wallet.impl.presentation.transaction.detail.reward.RewardDetailFragment
import jp.co.soramitsu.wallet.impl.presentation.transaction.detail.reward.RewardDetailsPayload
import jp.co.soramitsu.wallet.impl.presentation.transaction.detail.swap.SwapDetailFragment
import jp.co.soramitsu.wallet.impl.presentation.transaction.detail.transfer.TransferDetailFragment
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.emptyFlow
import kotlinx.coroutines.flow.filter
import kotlinx.coroutines.flow.filterNotNull
import kotlinx.coroutines.flow.flowOf
import kotlinx.coroutines.flow.map
import kotlinx.coroutines.flow.onEach
import kotlinx.parcelize.Parcelize

@Parcelize
Expand All @@ -140,7 +151,9 @@ class Navigator :
WalletRouter,
RootRouter,
StakingRouter,
CrowdloanRouter {
CrowdloanRouter,
PolkaswapRouter,
SuccessRouter {

private var navController: NavController? = null
private var activity: AppCompatActivity? = null
Expand Down Expand Up @@ -394,6 +407,31 @@ class Navigator :
}
}

override fun backWithResult(vararg results: Pair<String, Any?>) {
val savedStateHandle = navController?.previousBackStackEntry?.savedStateHandle
if (savedStateHandle != null) {
results.forEach { (key, value) ->
savedStateHandle[key] = value
}
}
back()
}

override fun openTransactionSettingsDialog(initialSettings: TransactionSettingsModel) {
val bundle = TransactionSettingsFragment.getBundle(initialSettings)
navController?.navigate(R.id.transactionSettingsFragment, bundle)
}

override fun openSwapPreviewDialog(swapDetailsViewState: SwapDetailsViewState, parcelModel: SwapDetailsParcelModel) {
val bundle = SwapPreviewFragment.getBundle(swapDetailsViewState, parcelModel)

navController?.navigate(R.id.swapPreviewFragment, bundle)
}

override fun openSelectMarketDialog() {
navController?.navigate(R.id.selectMarketFragment)
}

override fun openCustomRebond() {
navController?.navigate(R.id.action_stakingBalanceFragment_to_customRebondFragment)
}
Expand Down Expand Up @@ -537,6 +575,10 @@ class Navigator :
navController?.navigate(R.id.back_to_main)
}

override fun returnToAssetDetails() {
navController?.navigate(R.id.back_to_asset_details)
}

override fun openValidatorDetails(validatorDetails: ValidatorDetailsParcelModel) {
navController?.navigate(R.id.validatorDetailsFragment, ValidatorDetailsFragment.getBundle(validatorDetails))
}
Expand All @@ -555,8 +597,14 @@ class Navigator :
navController?.navigate(R.id.sendSetupFragment, bundle)
}

override fun openSelectChain(assetId: String, chooserMode: Boolean) {
val bundle = ChainSelectFragment.getBundle(assetId = assetId, chooserMode = chooserMode)
override fun openSwapTokensScreen(assetPayload: AssetPayload) {
val bundle = SwapTokensFragment.getBundle(assetPayload.chainAssetId, assetPayload.chainId)

navController?.navigate(R.id.swapTokensFragment, bundle)
}

override fun openSelectChain(assetId: String, chainId: ChainId?, chooserMode: Boolean) {
val bundle = ChainSelectFragment.getBundle(assetId = assetId, chainId = chainId, chooserMode = chooserMode)
navController?.navigate(R.id.chainSelectFragment, bundle)
}

Expand All @@ -570,6 +618,19 @@ class Navigator :
navController?.navigate(R.id.assetSelectFragment, bundle)
}

override fun openSelectAsset(chainId: ChainId, selectedAssetId: String?, excludeAssetId: String?) {
val bundle = AssetSelectFragment.getBundle(chainId, selectedAssetId, excludeAssetId)
navController?.navigate(R.id.assetSelectFragment, bundle)
}

override fun <T> observeResult(key: String): Flow<T> {
val savedStateHandle = navController?.currentBackStackEntry?.savedStateHandle
val resultFlow = savedStateHandle?.getStateFlow<T?>(key, null) ?: MutableStateFlow(null)
return resultFlow
.filter { it != null }
.onEach { savedStateHandle?.set<T>(key, null) } as Flow<T>
}

override fun openSelectChainAsset(chainId: ChainId) {
val bundle = AssetSelectFragment.getBundleFilterByChain(chainId)
navController?.navigate(R.id.assetSelectFragment, bundle)
Expand All @@ -589,10 +650,14 @@ class Navigator :
openOperationSuccess(operationHash, chainId, null)
}

override fun openPolkaswapDisclaimer() {
navController?.navigate(R.id.polkaswapDisclaimerFragment)
}

override fun openOperationSuccess(operationHash: String?, chainId: ChainId, customMessage: String?) {
val bundle = SendSuccessFragment.getBundle(operationHash, chainId, customMessage)
val bundle = SuccessFragment.getBundle(operationHash, chainId, customMessage)

navController?.navigate(R.id.sendSuccessFragment, bundle)
navController?.navigate(R.id.successSheetFragment, bundle)
}

override fun finishSendFlow() {
Expand All @@ -617,6 +682,12 @@ class Navigator :
navController?.navigate(R.id.open_extrinsic_detail, bundle)
}

override fun openSwapDetail(operation: OperationParcelizeModel.Swap) {
val bundle = SwapDetailFragment.getBundle(operation)

navController?.navigate(R.id.swapDetailFragment, bundle)
}

override fun openWallets(accountChosenNavDirection: AccountChosenNavDirection) {
navController?.navigate(R.id.action_open_accounts, AccountListFragment.getBundle(accountChosenNavDirection))
}
Expand Down Expand Up @@ -842,9 +913,8 @@ class Navigator :
navController?.navigate(R.id.alertFragment, bundle)
}

override fun openSearchAssets(chainId: String?) {
val bundle = SearchAssetsFragment.getBundle(chainId)
navController?.navigate(R.id.searchAssetsFragment, bundle)
override fun openSearchAssets() {
navController?.navigate(R.id.searchAssetsFragment)
}

override fun openOptionsWallet(walletId: Long) {
Expand Down
45 changes: 42 additions & 3 deletions app/src/main/res/navigation/main_nav_graph.xml
Original file line number Diff line number Diff line change
Expand Up @@ -468,9 +468,9 @@
</dialog>

<dialog
android:id="@+id/sendSuccessFragment"
android:name="jp.co.soramitsu.wallet.impl.presentation.send.success.SendSuccessFragment"
android:label="sendSuccessFragment" />
android:id="@+id/successSheetFragment"
android:name="jp.co.soramitsu.success.presentation.SuccessFragment"
android:label="successSheetFragment" />

<dialog
android:id="@+id/startStakingPoolFragment"
Expand Down Expand Up @@ -662,6 +662,37 @@
android:name="jp.co.soramitsu.wallet.impl.presentation.balance.chainselector.ChainSelectFragment"
android:label="chainSelectFragment" />

<dialog
android:id="@+id/swapTokensFragment"
android:name="jp.co.soramitsu.polkaswap.impl.presentation.swap_tokens.SwapTokensFragment"
android:label="swapTokensFragment" />

<dialog
android:id="@+id/polkaswapDisclaimerFragment"
android:name="jp.co.soramitsu.polkaswap.impl.presentation.disclaimer.PolkaswapDisclaimerFragment"
android:label="polkaswapDisclaimerFragment" />

<dialog
android:id="@+id/transactionSettingsFragment"
android:name="jp.co.soramitsu.polkaswap.impl.presentation.transaction_settings.TransactionSettingsFragment"
android:label="transactionSettingsFragment" />


<dialog
android:id="@+id/swapPreviewFragment"
android:name="jp.co.soramitsu.polkaswap.impl.presentation.swap_preview.SwapPreviewFragment"
android:label="swapPreviewFragment" />

<dialog
android:id="@+id/swapDetailFragment"
android:name="jp.co.soramitsu.wallet.impl.presentation.transaction.detail.swap.SwapDetailFragment"
android:label="swapDetailFragment" />

<dialog
android:id="@+id/selectMarketFragment"
android:name="jp.co.soramitsu.polkaswap.impl.presentation.select_market.SelectMarketFragment"
android:label="selectMarketFragment" />

<dialog
android:id="@+id/assetSelectFragment"
android:name="jp.co.soramitsu.wallet.impl.presentation.balance.assetselector.AssetSelectFragment"
Expand Down Expand Up @@ -829,6 +860,14 @@
app:popExitAnim="?android:attr/fragmentOpenExitAnimation"
app:popUpTo="@id/mainFragment" />

<action
android:id="@+id/back_to_asset_details"
app:enterAnim="?android:attr/fragmentCloseEnterAnimation"
app:exitAnim="?android:attr/fragmentCloseExitAnimation"
app:popEnterAnim="?android:attr/fragmentOpenEnterAnimation"
app:popExitAnim="?android:attr/fragmentOpenExitAnimation"
app:popUpTo="@id/balanceDetailFragment" />

<fragment
android:id="@+id/confirmStakingFragment"
android:name="jp.co.soramitsu.staking.impl.presentation.confirm.ConfirmStakingFragment"
Expand Down
8 changes: 5 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
buildscript {
ext {
// App version
versionName = '2.1.2'
versionCode = 87
versionName = '2.2.0'
versionCode = 88

// SDK and tools
compileSdkVersion = 33
Expand All @@ -22,6 +22,7 @@ buildscript {
biometricVersion = '1.1.0'

progressButtonsVersion = '2.1.0'
xNetworkingVersion = '0.0.46'

daggerVersion = '2.43'
javaxInjectVersion = '1'
Expand Down Expand Up @@ -168,6 +169,7 @@ buildscript {
gifDep = "pl.droidsonroids.gif:android-gif-drawable:$gifVersion"

wsDep = "com.neovisionaries:nv-websocket-client:$wsVersion"
xNetworkingDep = "jp.co.soramitsu:XNetworking-android:$xNetworkingVersion"

shimmerDep = "com.facebook.shimmer:shimmer:$shimmerVersion"

Expand Down Expand Up @@ -202,7 +204,7 @@ buildscript {
dependencies {
classpath 'com.android.tools.build:gradle:7.3.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
classpath 'com.google.gms:google-services:4.3.14'
classpath 'com.google.gms:google-services:4.3.15'
classpath "com.google.firebase:firebase-appdistribution-gradle:$firebaseAppDistrVersion"
classpath "com.github.triplet.gradle:play-publisher:$playPublisherVersion"
classpath "com.google.dagger:hilt-android-gradle-plugin:$daggerVersion"
Expand Down
1 change: 1 addition & 0 deletions common/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ android {

buildConfigField "String", "FIAT_CONFIG_URL", "\"https://raw.githubusercontent.com/soramitsu/fearless-utils/android/2.0.8/fiat/fiats.json\""
buildConfigField "String", "APP_CONFIG_URL", "\"https://raw.githubusercontent.com/soramitsu/fearless-utils/android/2.0.8/android_app_configuration.json\""
buildConfigField "String", "POLKASWAP_CONFIG_URL", "\"https://raw.githubusercontent.com/soramitsu/fearless-utils/ios/v3-jsonupd/polkaswapSettings.json\""

buildConfigField "String", "WEBSITE_URL", "\"https://fearlesswallet.io\""
buildConfigField "String", "TWITTER_URL", "\"https://twitter.com/fearlesswallet\""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import jp.co.soramitsu.common.presentation.ErrorDialog
import jp.co.soramitsu.common.utils.Event
import jp.co.soramitsu.common.utils.EventObserver

abstract class BaseComposeBottomSheetDialogFragment<T : BaseViewModel>() : BottomSheetDialogFragment() {
abstract class BaseComposeBottomSheetDialogFragment<T : BaseViewModel> : BottomSheetDialogFragment() {

abstract val viewModel: T

Expand Down
Loading

0 comments on commit 0a7f2a9

Please sign in to comment.