Skip to content

Commit 03093dd

Browse files
authored
Merge pull request #1161 from soramitsu/staging
staging
2 parents 94ef3c4 + 70a2f60 commit 03093dd

File tree

242 files changed

+4357
-2453
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

242 files changed

+4357
-2453
lines changed

CONTRIBUTING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ In case you have found any issues with an existing app, feel free to report it d
1111
* Was your app affected eventually or right after installing the update?
1212
* 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.
1313
* Provide steps to reproduce your bug
14-
* If helpful, provide screenshots (or videos) of every step (addresses and balances can be blured on your choice)
14+
* If helpful, provide screenshots (or videos) of every step (addresses and balances can be blurred on your choice)
1515
* (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
1616

1717
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.
@@ -34,7 +34,7 @@ Even if you provide mockups, please understand that our design team will review
3434
If you would like to help us by contributing writing the code, please follow next steps:
3535

3636
* Always create and issue prior to opening Pull Request (hereinafter the PR), or your PR less likely to be reviewed
37-
* 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
37+
* 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
3838
* Follow the coding standards guidelines (TO BE PROVIDED LATER), or you will be asked to make changes to follow them
3939
* 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
4040
* Provide steps for QA engineer to test your functionality (they should cover requirements from your issue)

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,15 @@ Track features development: [board link](https://soramitsucoltd.aha.io/shared/34
1616

1717
## How to build
1818

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

2121
### Moonpay properties
2222
```
2323
MOONPAY_TEST_SECRET=stub
2424
MOONPAY_PRODUCTION_SECRET=stub
2525
```
26-
Note, that with stub keys buy via moonpay will not work correctly. However, other parts of application will not be affected.
26+
27+
Note, that with stub keys buy via moonpay will not work correctly. However, other parts of the application will not be affected.
2728

2829
### Sora CARD SDK
2930

app/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,8 @@ android {
130130
resources.excludes.add("META-INF/*")
131131
}
132132

133-
configurations{
134-
all*.exclude module: 'bcprov-jdk15on'
133+
configurations.configureEach {
134+
exclude group: "org.bouncycastle", module: "bcprov-jdk15on"
135135
}
136136
}
137137

app/proguard-rules.pro

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@
158158
-dontwarn org.jetbrains.kotlin.diagnostics.rendering.Renderers
159159
-dontwarn org.jetbrains.kotlin.diagnostics.rendering.SmartDescriptorRenderer
160160
-dontwarn org.jetbrains.kotlin.diagnostics.rendering.SmartTypeRenderer
161+
-dontwarn org.jetbrains.kotlin.fir.extensions.FirExtensionRegistrar
161162

162163
-dontwarn javax.naming.InvalidNameException
163164
-dontwarn javax.naming.NamingException
@@ -250,7 +251,3 @@
250251
# Retain generic signatures of TypeToken and its subclasses with R8 version 3.0 and higher.
251252
-keep,allowobfuscation,allowshrinking class com.google.gson.reflect.TypeToken
252253
-keep,allowobfuscation,allowshrinking class * extends com.google.gson.reflect.TypeToken
253-
254-
-keepclassmembers class * {
255-
@com.google.api.client.util.Key <fields>;
256-
}

app/src/androidTest/java/jp/co/soramitsu/ChainSyncIntegrationTest.kt

Lines changed: 0 additions & 60 deletions
This file was deleted.

app/src/main/java/jp/co/soramitsu/app/root/di/RootFeatureModule.kt

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,12 @@ import dagger.hilt.InstallIn
66
import dagger.hilt.components.SingletonComponent
77
import javax.inject.Named
88
import jp.co.soramitsu.account.api.domain.PendulumPreInstalledAccountsScenario
9+
import jp.co.soramitsu.account.api.domain.interfaces.AccountRepository
10+
import jp.co.soramitsu.account.impl.domain.WalletSyncService
911
import jp.co.soramitsu.app.root.domain.RootInteractor
1012
import jp.co.soramitsu.common.data.storage.Preferences
1113
import jp.co.soramitsu.core.updater.UpdateSystem
14+
import jp.co.soramitsu.runtime.multiNetwork.ChainRegistry
1215
import jp.co.soramitsu.wallet.impl.domain.interfaces.WalletRepository
1316

1417
@InstallIn(SingletonComponent::class)
@@ -20,13 +23,19 @@ class RootFeatureModule {
2023
walletRepository: WalletRepository,
2124
@Named("BalancesUpdateSystem") walletUpdateSystem: UpdateSystem,
2225
pendulumPreInstalledAccountsScenario: PendulumPreInstalledAccountsScenario,
23-
preferences: Preferences
26+
preferences: Preferences,
27+
accountRepository: AccountRepository,
28+
walletSyncService: WalletSyncService,
29+
chainRegistry: ChainRegistry
2430
): RootInteractor {
2531
return RootInteractor(
2632
walletUpdateSystem,
2733
walletRepository,
2834
pendulumPreInstalledAccountsScenario,
29-
preferences
35+
preferences,
36+
accountRepository,
37+
walletSyncService,
38+
chainRegistry
3039
)
3140
}
3241
}

app/src/main/java/jp/co/soramitsu/app/root/domain/RootInteractor.kt

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ package jp.co.soramitsu.app.root.domain
22

33
import com.walletconnect.web3.wallet.client.Web3Wallet
44
import jp.co.soramitsu.account.api.domain.PendulumPreInstalledAccountsScenario
5+
import jp.co.soramitsu.account.api.domain.interfaces.AccountRepository
6+
import jp.co.soramitsu.account.impl.domain.WalletSyncService
57
import jp.co.soramitsu.common.data.storage.Preferences
68
import jp.co.soramitsu.common.data.storage.appConfig
79
import jp.co.soramitsu.common.domain.model.AppConfig
@@ -10,21 +12,40 @@ import jp.co.soramitsu.common.utils.inBackground
1012
import jp.co.soramitsu.common.utils.requireValue
1113
import jp.co.soramitsu.core.updater.UpdateSystem
1214
import jp.co.soramitsu.core.updater.Updater
15+
import jp.co.soramitsu.runtime.multiNetwork.ChainRegistry
1316
import jp.co.soramitsu.wallet.impl.data.buyToken.ExternalProvider
1417
import jp.co.soramitsu.wallet.impl.domain.interfaces.WalletRepository
1518
import kotlinx.coroutines.Dispatchers
1619
import kotlinx.coroutines.flow.Flow
20+
import kotlinx.coroutines.flow.filter
21+
import kotlinx.coroutines.flow.first
1722
import kotlinx.coroutines.flow.flowOf
1823
import kotlinx.coroutines.withContext
1924

2025
class RootInteractor(
2126
private val updateSystem: UpdateSystem,
2227
private val walletRepository: WalletRepository,
2328
private val pendulumPreInstalledAccountsScenario: PendulumPreInstalledAccountsScenario,
24-
private val preferences: Preferences
29+
private val preferences: Preferences,
30+
private val accountRepository: AccountRepository,
31+
private val walletSyncService: WalletSyncService,
32+
private val chainRegistry: ChainRegistry,
2533
) {
34+
suspend fun syncChainsConfigs(): Result<Unit> {
35+
return withContext(Dispatchers.Default) {
36+
return@withContext chainRegistry.syncConfigs()
37+
}
38+
}
2639

27-
fun runBalancesUpdate(): Flow<Updater.SideEffect> = updateSystem.start().inBackground()
40+
fun runWalletsSync() {
41+
walletSyncService.start()
42+
}
43+
44+
suspend fun runBalancesUpdate(): Flow<Updater.SideEffect> = withContext(Dispatchers.Default) {
45+
// await all accounts initialized
46+
accountRepository.allMetaAccountsFlow().filter { accounts -> accounts.all { it.initialized } }.filter { it.isNotEmpty() }.first()
47+
return@withContext updateSystem.start().inBackground()
48+
}
2849

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

@@ -50,9 +71,9 @@ class RootInteractor(
5071
}
5172
}
5273

53-
fun chainRegistrySyncUp() = walletRepository.chainRegistrySyncUp()
74+
fun chainRegistrySyncUp() = chainRegistry.syncUp()
5475

55-
suspend fun fetchFeatureToggle() = withContext(Dispatchers.Default){ pendulumPreInstalledAccountsScenario.fetchFeatureToggle() }
76+
suspend fun fetchFeatureToggle() = withContext(Dispatchers.Default) { pendulumPreInstalledAccountsScenario.fetchFeatureToggle() }
5677

5778
suspend fun getPendingListOfSessionRequests(topic: String) = withContext(Dispatchers.Default){ Web3Wallet.getPendingListOfSessionRequests(topic) }
5879
}

app/src/main/java/jp/co/soramitsu/app/root/navigation/Navigator.kt

Lines changed: 18 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -162,10 +162,10 @@ import jp.co.soramitsu.wallet.impl.presentation.transaction.detail.reward.Reward
162162
import jp.co.soramitsu.wallet.impl.presentation.transaction.detail.reward.RewardDetailsPayload
163163
import jp.co.soramitsu.wallet.impl.presentation.transaction.detail.swap.SwapDetailFragment
164164
import jp.co.soramitsu.wallet.impl.presentation.transaction.detail.transfer.TransferDetailFragment
165-
import jp.co.soramitsu.walletconnect.impl.presentation.sessionproposal.SessionProposalFragment
166165
import jp.co.soramitsu.walletconnect.impl.presentation.chainschooser.ChainChooseFragment
167166
import jp.co.soramitsu.walletconnect.impl.presentation.connectioninfo.ConnectionInfoFragment
168167
import jp.co.soramitsu.walletconnect.impl.presentation.requestpreview.RequestPreviewFragment
168+
import jp.co.soramitsu.walletconnect.impl.presentation.sessionproposal.SessionProposalFragment
169169
import jp.co.soramitsu.walletconnect.impl.presentation.sessionrequest.SessionRequestFragment
170170
import jp.co.soramitsu.walletconnect.impl.presentation.transactionrawdata.RawDataFragment
171171
import kotlin.coroutines.coroutineContext
@@ -177,15 +177,13 @@ import kotlinx.coroutines.flow.distinctUntilChanged
177177
import kotlinx.coroutines.flow.emptyFlow
178178
import kotlinx.coroutines.flow.filter
179179
import kotlinx.coroutines.flow.filterNotNull
180-
import kotlinx.coroutines.flow.flowOf
181180
import kotlinx.coroutines.flow.map
182181
import kotlinx.coroutines.flow.mapNotNull
183182
import kotlinx.coroutines.flow.onCompletion
184183
import kotlinx.coroutines.flow.onEach
185184
import kotlinx.coroutines.flow.onStart
186185
import kotlinx.coroutines.job
187186
import kotlinx.parcelize.Parcelize
188-
import jp.co.soramitsu.common.utils.combine as combineLiveData
189187

190188
@Parcelize
191189
class NavComponentDelayedNavigation(val globalActionId: Int, val extras: Bundle? = null) : DelayedNavigation
@@ -218,14 +216,21 @@ class Navigator :
218216
activity = null
219217
}
220218

221-
override fun openAddFirstAccount() {
219+
override fun openOnboarding() {
222220
navController?.navigate(R.id.action_to_onboarding, WelcomeFragment.getBundle(false))
223221
}
224222

223+
override fun openCreatePincode() {
224+
val action = PinCodeAction.Create(NavComponentDelayedNavigation(R.id.action_open_main))
225+
val bundle = PincodeFragment.getPinCodeBundle(action)
226+
navController?.navigate(R.id.pincodeFragment, bundle)
227+
}
228+
229+
225230
override fun openInitialCheckPincode() {
226231
val action = PinCodeAction.Check(NavComponentDelayedNavigation(R.id.action_open_main), ToolbarConfiguration())
227232
val bundle = PincodeFragment.getPinCodeBundle(action)
228-
navController?.navigateSafe(R.id.action_splash_to_pin, bundle)
233+
navController?.navigateSafe(R.id.pincodeFragment, bundle)
229234
}
230235

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

340-
override fun openCreatePincode() {
341-
val bundle = buildCreatePinBundle()
342-
343-
navController?.navigate(R.id.pincodeFragment, bundle)
344-
}
345-
346345
override fun openConfirmMnemonicOnCreate(confirmMnemonicPayload: ConfirmMnemonicPayload) {
347346
val bundle = ConfirmMnemonicFragment.getBundle(confirmMnemonicPayload)
348347

@@ -1021,8 +1020,8 @@ class Navigator :
10211020
}
10221021

10231022
@SuppressLint("RestrictedApi")
1024-
override fun openOperationSuccessAndPopUpToNearestRelatedScreen(operationHash: String?, chainId: ChainId?, customMessage: String?) {
1025-
val bundle = SuccessFragment.getBundle(operationHash, chainId, customMessage)
1023+
override fun openOperationSuccessAndPopUpToNearestRelatedScreen(operationHash: String?, chainId: ChainId?, customMessage: String?, customTitle: String?) {
1024+
val bundle = SuccessFragment.getBundle(operationHash, chainId, customMessage, customTitle)
10261025

10271026
val latestAvailableWalletConnectRelatedDestinationId =
10281027
navController?.currentBackStack?.replayCache?.firstOrNull()?.last {
@@ -1042,8 +1041,8 @@ class Navigator :
10421041
navController?.popBackStack()
10431042
}
10441043

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

10481047
navController?.navigate(R.id.open_transfer_detail, bundle)
10491048
}
@@ -1276,16 +1275,6 @@ class Navigator :
12761275
navController?.navigate(R.id.root_nav_graph, bundle)
12771276
}
12781277

1279-
private fun buildCreatePinBundle(): Bundle {
1280-
val delayedNavigation = NavComponentDelayedNavigation(R.id.action_open_main)
1281-
val action = PinCodeAction.Create(delayedNavigation)
1282-
return PincodeFragment.getPinCodeBundle(action)
1283-
}
1284-
1285-
override fun openEducationalStories(stories: StoryGroupModel) {
1286-
navController?.navigate(R.id.action_splash_to_stories, StoryFragment.getBundle(stories))
1287-
}
1288-
12891278
override fun openSelectWallet() {
12901279
navController?.navigate(R.id.selectWalletFragment)
12911280
}
@@ -1341,17 +1330,6 @@ class Navigator :
13411330
navController?.navigateUp()
13421331
}
13431332

1344-
override val educationalStoriesCompleted: Flow<Boolean>
1345-
get() {
1346-
return combineLiveData(
1347-
navController?.currentBackStackEntry?.lifecycle?.onResumeObserver() ?: return flowOf(false),
1348-
navController?.currentBackStackEntry?.savedStateHandle?.getLiveData<Boolean>(StoryFragment.KEY_STORY) ?: return flowOf(false),
1349-
combiner = { (isResumed: Boolean, storiesCompleted: Boolean) ->
1350-
isResumed && storiesCompleted
1351-
}
1352-
).asFlow()
1353-
}
1354-
13551333
override fun openExperimentalFeatures() {
13561334
navController?.navigate(R.id.experimentalFragment)
13571335
}
@@ -1526,6 +1504,10 @@ class Navigator :
15261504
navController?.navigate(R.id.nftFiltersFragment)
15271505
}
15281506

1507+
override fun openManageAssets() {
1508+
navController?.navigate(R.id.manageAssetsFragment)
1509+
}
1510+
15291511
override fun openServiceScreen() {
15301512
navController?.navigate(R.id.serviceFragment)
15311513
}

0 commit comments

Comments
 (0)