Skip to content

Commit

Permalink
Merge pull request #1161 from soramitsu/staging
Browse files Browse the repository at this point in the history
staging
  • Loading branch information
PankraSerg authored May 30, 2024
2 parents 94ef3c4 + 70a2f60 commit 03093dd
Show file tree
Hide file tree
Showing 242 changed files with 4,357 additions and 2,453 deletions.
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ In case you have found any issues with an existing app, feel free to report it d
* Was your app affected eventually or right after installing the update?
* Do you use the Google Play version of application, APK file from releases or running it via Android Studio (if other, mention what)? If you installed it manually, please provide backtrace if possible.
* Provide steps to reproduce your bug
* If helpful, provide screenshots (or videos) of every step (addresses and balances can be blured on your choice)
* If helpful, provide screenshots (or videos) of every step (addresses and balances can be blurred on your choice)
* (OPTIONAL) Provide your telegram username, and be sure to join [Our Community Channel](https://t.me/fearlesshappiness) on Telegram, so our admins can ping you here in case they need some assistance from your side

Notice, that if you don't leave your Telegram username, we might ask directly in your created issue for more information if such is required.
Expand All @@ -34,7 +34,7 @@ Even if you provide mockups, please understand that our design team will review
If you would like to help us by contributing writing the code, please follow next steps:

* Always create and issue prior to opening Pull Request (hereinafter the PR), or your PR less likely to be reviewed
* Remember, that in that case you are required to provide full description for you feature in created issue, otherwise it would be hard for us to understand what you're trying to add to our codebase
* Remember, that in that case you are required to provide full description of your feature in created issue, otherwise it would be hard for us to understand what you're trying to add to our codebase
* Follow the coding standards guidelines (TO BE PROVIDED LATER), or you will be asked to make changes to follow them
* Please avoid huge PRs, and if your contribution really requires lots of files, please make a base branch with series of small PRs on your fork, and then provide link to those PRs in your big one PR in our repository
* Provide steps for QA engineer to test your functionality (they should cover requirements from your issue)
Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,15 @@ Track features development: [board link](https://soramitsucoltd.aha.io/shared/34

## How to build

To build Fearless Wallet Android project, you need to provide several keys either in enviroment variables or in `local.properties` file:
To build Fearless Wallet Android project, you need to provide several keys either in environment variables or in `local.properties` file:

### Moonpay properties
```
MOONPAY_TEST_SECRET=stub
MOONPAY_PRODUCTION_SECRET=stub
```
Note, that with stub keys buy via moonpay will not work correctly. However, other parts of application will not be affected.

Note, that with stub keys buy via moonpay will not work correctly. However, other parts of the application will not be affected.

### Sora CARD SDK

Expand Down
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,8 @@ android {
resources.excludes.add("META-INF/*")
}

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

Expand Down
5 changes: 1 addition & 4 deletions app/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@
-dontwarn org.jetbrains.kotlin.diagnostics.rendering.Renderers
-dontwarn org.jetbrains.kotlin.diagnostics.rendering.SmartDescriptorRenderer
-dontwarn org.jetbrains.kotlin.diagnostics.rendering.SmartTypeRenderer
-dontwarn org.jetbrains.kotlin.fir.extensions.FirExtensionRegistrar

-dontwarn javax.naming.InvalidNameException
-dontwarn javax.naming.NamingException
Expand Down Expand Up @@ -250,7 +251,3 @@
# Retain generic signatures of TypeToken and its subclasses with R8 version 3.0 and higher.
-keep,allowobfuscation,allowshrinking class com.google.gson.reflect.TypeToken
-keep,allowobfuscation,allowshrinking class * extends com.google.gson.reflect.TypeToken

-keepclassmembers class * {
@com.google.api.client.util.Key <fields>;
}

This file was deleted.

13 changes: 11 additions & 2 deletions app/src/main/java/jp/co/soramitsu/app/root/di/RootFeatureModule.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,12 @@ import dagger.hilt.InstallIn
import dagger.hilt.components.SingletonComponent
import javax.inject.Named
import jp.co.soramitsu.account.api.domain.PendulumPreInstalledAccountsScenario
import jp.co.soramitsu.account.api.domain.interfaces.AccountRepository
import jp.co.soramitsu.account.impl.domain.WalletSyncService
import jp.co.soramitsu.app.root.domain.RootInteractor
import jp.co.soramitsu.common.data.storage.Preferences
import jp.co.soramitsu.core.updater.UpdateSystem
import jp.co.soramitsu.runtime.multiNetwork.ChainRegistry
import jp.co.soramitsu.wallet.impl.domain.interfaces.WalletRepository

@InstallIn(SingletonComponent::class)
Expand All @@ -20,13 +23,19 @@ class RootFeatureModule {
walletRepository: WalletRepository,
@Named("BalancesUpdateSystem") walletUpdateSystem: UpdateSystem,
pendulumPreInstalledAccountsScenario: PendulumPreInstalledAccountsScenario,
preferences: Preferences
preferences: Preferences,
accountRepository: AccountRepository,
walletSyncService: WalletSyncService,
chainRegistry: ChainRegistry
): RootInteractor {
return RootInteractor(
walletUpdateSystem,
walletRepository,
pendulumPreInstalledAccountsScenario,
preferences
preferences,
accountRepository,
walletSyncService,
chainRegistry
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ package jp.co.soramitsu.app.root.domain

import com.walletconnect.web3.wallet.client.Web3Wallet
import jp.co.soramitsu.account.api.domain.PendulumPreInstalledAccountsScenario
import jp.co.soramitsu.account.api.domain.interfaces.AccountRepository
import jp.co.soramitsu.account.impl.domain.WalletSyncService
import jp.co.soramitsu.common.data.storage.Preferences
import jp.co.soramitsu.common.data.storage.appConfig
import jp.co.soramitsu.common.domain.model.AppConfig
Expand All @@ -10,21 +12,40 @@ import jp.co.soramitsu.common.utils.inBackground
import jp.co.soramitsu.common.utils.requireValue
import jp.co.soramitsu.core.updater.UpdateSystem
import jp.co.soramitsu.core.updater.Updater
import jp.co.soramitsu.runtime.multiNetwork.ChainRegistry
import jp.co.soramitsu.wallet.impl.data.buyToken.ExternalProvider
import jp.co.soramitsu.wallet.impl.domain.interfaces.WalletRepository
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.filter
import kotlinx.coroutines.flow.first
import kotlinx.coroutines.flow.flowOf
import kotlinx.coroutines.withContext

class RootInteractor(
private val updateSystem: UpdateSystem,
private val walletRepository: WalletRepository,
private val pendulumPreInstalledAccountsScenario: PendulumPreInstalledAccountsScenario,
private val preferences: Preferences
private val preferences: Preferences,
private val accountRepository: AccountRepository,
private val walletSyncService: WalletSyncService,
private val chainRegistry: ChainRegistry,
) {
suspend fun syncChainsConfigs(): Result<Unit> {
return withContext(Dispatchers.Default) {
return@withContext chainRegistry.syncConfigs()
}
}

fun runBalancesUpdate(): Flow<Updater.SideEffect> = updateSystem.start().inBackground()
fun runWalletsSync() {
walletSyncService.start()
}

suspend fun runBalancesUpdate(): Flow<Updater.SideEffect> = withContext(Dispatchers.Default) {
// await all accounts initialized
accountRepository.allMetaAccountsFlow().filter { accounts -> accounts.all { it.initialized } }.filter { it.isNotEmpty() }.first()
return@withContext updateSystem.start().inBackground()
}

fun isBuyProviderRedirectLink(link: String) = ExternalProvider.REDIRECT_URL_BASE in link

Expand All @@ -50,9 +71,9 @@ class RootInteractor(
}
}

fun chainRegistrySyncUp() = walletRepository.chainRegistrySyncUp()
fun chainRegistrySyncUp() = chainRegistry.syncUp()

suspend fun fetchFeatureToggle() = withContext(Dispatchers.Default){ pendulumPreInstalledAccountsScenario.fetchFeatureToggle() }
suspend fun fetchFeatureToggle() = withContext(Dispatchers.Default) { pendulumPreInstalledAccountsScenario.fetchFeatureToggle() }

suspend fun getPendingListOfSessionRequests(topic: String) = withContext(Dispatchers.Default){ Web3Wallet.getPendingListOfSessionRequests(topic) }
}
54 changes: 18 additions & 36 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 @@ -162,10 +162,10 @@ import jp.co.soramitsu.wallet.impl.presentation.transaction.detail.reward.Reward
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 jp.co.soramitsu.walletconnect.impl.presentation.sessionproposal.SessionProposalFragment
import jp.co.soramitsu.walletconnect.impl.presentation.chainschooser.ChainChooseFragment
import jp.co.soramitsu.walletconnect.impl.presentation.connectioninfo.ConnectionInfoFragment
import jp.co.soramitsu.walletconnect.impl.presentation.requestpreview.RequestPreviewFragment
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
Expand All @@ -177,15 +177,13 @@ import kotlinx.coroutines.flow.distinctUntilChanged
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.mapNotNull
import kotlinx.coroutines.flow.onCompletion
import kotlinx.coroutines.flow.onEach
import kotlinx.coroutines.flow.onStart
import kotlinx.coroutines.job
import kotlinx.parcelize.Parcelize
import jp.co.soramitsu.common.utils.combine as combineLiveData

@Parcelize
class NavComponentDelayedNavigation(val globalActionId: Int, val extras: Bundle? = null) : DelayedNavigation
Expand Down Expand Up @@ -218,14 +216,21 @@ class Navigator :
activity = null
}

override fun openAddFirstAccount() {
override fun openOnboarding() {
navController?.navigate(R.id.action_to_onboarding, WelcomeFragment.getBundle(false))
}

override fun openCreatePincode() {
val action = PinCodeAction.Create(NavComponentDelayedNavigation(R.id.action_open_main))
val bundle = PincodeFragment.getPinCodeBundle(action)
navController?.navigate(R.id.pincodeFragment, bundle)
}


override fun openInitialCheckPincode() {
val action = PinCodeAction.Check(NavComponentDelayedNavigation(R.id.action_open_main), ToolbarConfiguration())
val bundle = PincodeFragment.getPinCodeBundle(action)
navController?.navigateSafe(R.id.action_splash_to_pin, bundle)
navController?.navigateSafe(R.id.pincodeFragment, bundle)
}

private fun NavController.navigateSafe(@IdRes resId: Int, args: Bundle?) {
Expand Down Expand Up @@ -337,12 +342,6 @@ class Navigator :
navController?.navigate(delayedNavigation.globalActionId, delayedNavigation.extras, navOptions)
}

override fun openCreatePincode() {
val bundle = buildCreatePinBundle()

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

override fun openConfirmMnemonicOnCreate(confirmMnemonicPayload: ConfirmMnemonicPayload) {
val bundle = ConfirmMnemonicFragment.getBundle(confirmMnemonicPayload)

Expand Down Expand Up @@ -1021,8 +1020,8 @@ class Navigator :
}

@SuppressLint("RestrictedApi")
override fun openOperationSuccessAndPopUpToNearestRelatedScreen(operationHash: String?, chainId: ChainId?, customMessage: String?) {
val bundle = SuccessFragment.getBundle(operationHash, chainId, customMessage)
override fun openOperationSuccessAndPopUpToNearestRelatedScreen(operationHash: String?, chainId: ChainId?, customMessage: String?, customTitle: String?) {
val bundle = SuccessFragment.getBundle(operationHash, chainId, customMessage, customTitle)

val latestAvailableWalletConnectRelatedDestinationId =
navController?.currentBackStack?.replayCache?.firstOrNull()?.last {
Expand All @@ -1042,8 +1041,8 @@ class Navigator :
navController?.popBackStack()
}

override fun openTransferDetail(transaction: OperationParcelizeModel.Transfer, assetPayload: AssetPayload, chainHistoryType: Chain.ExternalApi.Section.Type?) {
val bundle = TransferDetailFragment.getBundle(transaction, assetPayload, chainHistoryType)
override fun openTransferDetail(transaction: OperationParcelizeModel.Transfer, assetPayload: AssetPayload, chainExplorerType: Chain.Explorer.Type?) {
val bundle = TransferDetailFragment.getBundle(transaction, assetPayload, chainExplorerType)

navController?.navigate(R.id.open_transfer_detail, bundle)
}
Expand Down Expand Up @@ -1276,16 +1275,6 @@ class Navigator :
navController?.navigate(R.id.root_nav_graph, bundle)
}

private fun buildCreatePinBundle(): Bundle {
val delayedNavigation = NavComponentDelayedNavigation(R.id.action_open_main)
val action = PinCodeAction.Create(delayedNavigation)
return PincodeFragment.getPinCodeBundle(action)
}

override fun openEducationalStories(stories: StoryGroupModel) {
navController?.navigate(R.id.action_splash_to_stories, StoryFragment.getBundle(stories))
}

override fun openSelectWallet() {
navController?.navigate(R.id.selectWalletFragment)
}
Expand Down Expand Up @@ -1341,17 +1330,6 @@ class Navigator :
navController?.navigateUp()
}

override val educationalStoriesCompleted: Flow<Boolean>
get() {
return combineLiveData(
navController?.currentBackStackEntry?.lifecycle?.onResumeObserver() ?: return flowOf(false),
navController?.currentBackStackEntry?.savedStateHandle?.getLiveData<Boolean>(StoryFragment.KEY_STORY) ?: return flowOf(false),
combiner = { (isResumed: Boolean, storiesCompleted: Boolean) ->
isResumed && storiesCompleted
}
).asFlow()
}

override fun openExperimentalFeatures() {
navController?.navigate(R.id.experimentalFragment)
}
Expand Down Expand Up @@ -1526,6 +1504,10 @@ class Navigator :
navController?.navigate(R.id.nftFiltersFragment)
}

override fun openManageAssets() {
navController?.navigate(R.id.manageAssetsFragment)
}

override fun openServiceScreen() {
navController?.navigate(R.id.serviceFragment)
}
Expand Down
Loading

0 comments on commit 03093dd

Please sign in to comment.