Skip to content

Commit

Permalink
Merge pull request #1390 from novasamatech/rc/7.9.0
Browse files Browse the repository at this point in the history
Rc/7.9.0
  • Loading branch information
valentunn committed Feb 19, 2024
2 parents 33e8d7f + 1940e27 commit f006e37
Show file tree
Hide file tree
Showing 173 changed files with 5,902 additions and 498 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/manual_firebase_distribution.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
uses: ./.github/workflows/upload-to-firebase
with:
appId: ${{ secrets.ANDROID_DEVELOP_FIREBASE_APP_ID }}
firebase-token: ${{ secrets.ANDROID_DEV_FIREBASE_TOKEN }}
firebase-token: ${{ secrets.CREDENTIAL_FILE_CONTENT }}
releaseNotes: ${{ github.event.head_commit.message }}
test-groups: ${{ github.event.inputs.firebase_group }}
upload-file: app/develop/app-develop.apk
2 changes: 1 addition & 1 deletion .github/workflows/push_develop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
uses: ./.github/workflows/upload-to-firebase
with:
appId: ${{ secrets.ANDROID_DEVELOP_FIREBASE_APP_ID }}
firebase-token: ${{ secrets.ANDROID_DEV_FIREBASE_TOKEN }}
firebase-token: ${{ secrets.CREDENTIAL_FILE_CONTENT }}
releaseNotes: ${{ github.event.head_commit.message }}
test-groups: dev-team
upload-file: app/develop/app-develop.apk
8 changes: 4 additions & 4 deletions .github/workflows/upload-to-firebase/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ runs:
- name: Upload artifact to Firebase App Distribution
id: upload
continue-on-error: true
uses: wzieba/Firebase-Distribution-Github-Action@v1
uses: wzieba/Firebase-Distribution-Github-Action@v1.7.0
with:
appId: ${{ inputs.appId }}
token: ${{ inputs.firebase-token }}
serviceCredentialsFileContent: ${{ inputs.firebase-token }}
releaseNotes: ${{ inputs.releaseNotes }}
groups: ${{ inputs.test-groups }}
file: ${{ inputs.upload-file }}
Expand All @@ -40,10 +40,10 @@ runs:

- name: Retry upload artifacts
if: steps.upload.outcome=='failure'
uses: wzieba/Firebase-Distribution-Github-Action@v1
uses: wzieba/Firebase-Distribution-Github-Action@v1.7.0
with:
appId: ${{ inputs.appId }}
token: ${{ inputs.firebase-token }}
serviceCredentialsFileContent: ${{ inputs.firebase-token }}
releaseNotes: ${{ inputs.releaseNotes }}
groups: ${{ inputs.test-groups }}
file: ${{ inputs.upload-file }}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import android.util.Log
import io.novafoundation.nova.common.di.FeatureUtils
import io.novafoundation.nova.common.utils.Percent
import io.novafoundation.nova.feature_swap_api.di.SwapFeatureApi
import io.novafoundation.nova.feature_swap_api.domain.model.QuotePath
import io.novafoundation.nova.feature_swap_api.domain.model.SwapDirection
import io.novafoundation.nova.feature_swap_api.domain.model.SwapExecuteArgs
import io.novafoundation.nova.feature_swap_api.domain.model.SwapLimit
Expand Down Expand Up @@ -88,7 +89,8 @@ class SwapServiceIntegrationTest : BaseIntegrationTest() {
expectedAmountOut = Balance.ZERO
),
customFeeAsset = null,
nativeAsset = arbitraryAssetUseCase.assetFlow(westmint.commissionAsset).first()
nativeAsset = arbitraryAssetUseCase.assetFlow(westmint.commissionAsset).first(),
path = QuotePath(emptyList())
)

val fee = swapService.estimateFee(swapArgs)
Expand All @@ -111,7 +113,8 @@ class SwapServiceIntegrationTest : BaseIntegrationTest() {
expectedAmountOut = Balance.ZERO
),
customFeeAsset = siri,
nativeAsset = arbitraryAssetUseCase.assetFlow(westmint.commissionAsset).first()
nativeAsset = arbitraryAssetUseCase.assetFlow(westmint.commissionAsset).first(),
path = QuotePath(emptyList())
)

val fee = swapService.estimateFee(swapArgs)
Expand Down
32 changes: 32 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
<uses-permission
android:name="android.permission.BLUETOOTH_SCAN"
tools:targetApi="s" />

<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />

<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
Expand Down Expand Up @@ -76,6 +77,37 @@
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
</intent-filter>

<intent-filter android:autoVerify="true">
<data android:host="request" />
<data android:scheme="novawallet" />

<action android:name="android.intent.action.VIEW" />

<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
</intent-filter>

<intent-filter android:autoVerify="true">
<data android:host="wc" />
<data android:scheme="novawallet" />

<action android:name="android.intent.action.VIEW" />

<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
</intent-filter>

<intent-filter android:autoVerify="true">
<data
android:pathPattern="/.*@2"
android:scheme="wc" />

<action android:name="android.intent.action.VIEW" />

<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
</intent-filter>
</activity>

<activity
Expand Down
4 changes: 3 additions & 1 deletion app/src/main/java/io/novafoundation/nova/app/App.kt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ import io.novafoundation.nova.common.resources.LanguagesHolder
import io.novafoundation.nova.feature_wallet_connect_impl.BuildConfig
import javax.inject.Inject

private const val WC_REDIRECT_URL = "novawallet://request"

open class App : Application(), FeatureContainer {

@Inject
Expand Down Expand Up @@ -74,7 +76,7 @@ open class App : Application(), FeatureContainer {
description = "Next-gen wallet for Polkadot and Kusama ecosystem",
url = "https://novawallet.io/",
icons = listOf("https://raw.githubusercontent.com/novasamatech/branding/master/logos/Nova_Wallet_Star_Color.png"),
redirect = null
redirect = WC_REDIRECT_URL
)

CoreClient.initialize(relayServerUrl = serverUrl, connectionType = connectionType, application = this, metaData = appMetaData) { error ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import io.novafoundation.nova.common.resources.ResourceManager
import io.novafoundation.nova.common.sequrity.SafeModeService
import io.novafoundation.nova.common.utils.coroutines.RootScope
import io.novafoundation.nova.common.utils.inBackground
import io.novafoundation.nova.common.utils.sequrity.AutomaticInteractionGate
import io.novafoundation.nova.common.utils.sequrity.BackgroundAccessObserver
import io.novafoundation.nova.core.updater.Updater
import io.novafoundation.nova.feature_crowdloan_api.domain.contributions.ContributionsInteractor
Expand Down Expand Up @@ -44,7 +43,6 @@ class RootViewModel(
private val walletConnectService: WalletConnectService,
private val walletConnectSessionsUseCase: WalletConnectSessionsUseCase,
private val deepLinkHandler: DeepLinkHandler,
private val automaticInteractionGate: AutomaticInteractionGate,
private val rootScope: RootScope,
private val compoundRequestBusHandler: CompoundRequestBusHandler
) : BaseViewModel(), NetworkStateUi by networkStateMixin {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,11 @@ class RootDeepLinkHandler(
}

override suspend fun handleDeepLink(data: Uri) {
nestedHandlers.find { it.matches(data) }
?.handleDeepLink(data)
runCatching {
nestedHandlers.find {
runCatching { it.matches(data) }.getOrDefault(false)
}
?.handleDeepLink(data)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,22 @@ import io.novafoundation.nova.app.root.presentation.deepLinks.DeepLinkHandler
import io.novafoundation.nova.app.root.presentation.deepLinks.common.DeepLinkHandlingException.ReferendumHandlingException
import io.novafoundation.nova.common.utils.sequrity.AutomaticInteractionGate
import io.novafoundation.nova.common.utils.sequrity.awaitInteractionAllowed
import io.novafoundation.nova.feature_account_api.domain.interfaces.AccountRepository
import io.novafoundation.nova.feature_governance_api.data.MutableGovernanceState
import io.novafoundation.nova.feature_governance_impl.presentation.GovernanceRouter
import io.novafoundation.nova.feature_governance_impl.presentation.referenda.details.ReferendumDetailsPayload
import io.novafoundation.nova.runtime.ext.utilityAsset
import io.novafoundation.nova.runtime.multiNetwork.ChainRegistry
import io.novafoundation.nova.runtime.multiNetwork.chain.model.Chain
import io.novafoundation.nova.runtime.multiNetwork.getChainOrNull
import java.math.BigInteger
import kotlinx.coroutines.flow.MutableSharedFlow
import java.math.BigInteger

private const val GOV_DEEP_LINK_PREFIX = "/open/gov"

class ReferendumDeepLinkHandler(
private val governanceRouter: GovernanceRouter,
private val chainRegistry: ChainRegistry,
private val mutableGovernanceState: MutableGovernanceState,
private val accountRepository: AccountRepository,
private val automaticInteractionGate: AutomaticInteractionGate
) : DeepLinkHandler {

Expand Down Expand Up @@ -57,7 +55,7 @@ class ReferendumDeepLinkHandler(
?.toBigIntegerOrNull()
}

private suspend fun Uri.getGovernanceType(chain: Chain): Chain.Governance {
private fun Uri.getGovernanceType(chain: Chain): Chain.Governance {
val supportedGov = chain.governance
val govType = getQueryParameter("type")
?.toIntOrNull()
Expand All @@ -74,8 +72,4 @@ class ReferendumDeepLinkHandler(
else -> throw ReferendumHandlingException.GovernanceTypeIsNotSupported
}
}

private fun Chain.Governance.takeIfContainedIn(list: List<Chain.Governance>): Chain.Governance? {
return list.firstOrNull { it == this }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package io.novafoundation.nova.app.root.presentation.deepLinks.handlers.walletConnect

import android.net.Uri
import io.novafoundation.nova.app.root.presentation.deepLinks.CallbackEvent
import io.novafoundation.nova.app.root.presentation.deepLinks.DeepLinkHandler
import io.novafoundation.nova.common.utils.sequrity.AutomaticInteractionGate
import io.novafoundation.nova.common.utils.sequrity.awaitInteractionAllowed
import io.novafoundation.nova.feature_wallet_connect_api.presentation.WalletConnectService
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.emptyFlow

class WalletConnectPairDeeplinkHandler(
private val walletConnectService: WalletConnectService,
private val automaticInteractionGate: AutomaticInteractionGate
) : DeepLinkHandler {

override val callbackFlow: Flow<CallbackEvent> = emptyFlow()

override suspend fun matches(data: Uri): Boolean {
val newLinkMatch = data.scheme == "novawallet" && data.host == "wc"
// Older version of wc send both pair and sign requests through `wc:` deeplink so we additionaly check for `symKey` which is only present in pairing url
val oldLinkMatch = data.scheme == "wc" && "symKey" in data.toString()

return newLinkMatch || oldLinkMatch
}

override suspend fun handleDeepLink(data: Uri) {
automaticInteractionGate.awaitInteractionAllowed()
walletConnectService.pair(data.toString())
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import io.novafoundation.nova.app.root.presentation.deepLinks.handlers.DAppDeepL
import io.novafoundation.nova.app.root.presentation.deepLinks.handlers.ImportMnemonicDeepLinkHandler
import io.novafoundation.nova.app.root.presentation.deepLinks.handlers.ReferendumDeepLinkHandler
import io.novafoundation.nova.app.root.presentation.deepLinks.handlers.StakingDashboardDeepLinkHandler
import io.novafoundation.nova.app.root.presentation.deepLinks.handlers.walletConnect.WalletConnectPairDeeplinkHandler
import io.novafoundation.nova.common.resources.ResourceManager
import io.novafoundation.nova.common.utils.sequrity.AutomaticInteractionGate
import io.novafoundation.nova.feature_account_api.domain.account.common.EncryptionDefaults
Expand All @@ -21,6 +22,7 @@ import io.novafoundation.nova.feature_dapp_api.data.repository.DAppMetadataRepos
import io.novafoundation.nova.feature_dapp_impl.DAppRouter
import io.novafoundation.nova.feature_governance_api.data.MutableGovernanceState
import io.novafoundation.nova.feature_governance_impl.presentation.GovernanceRouter
import io.novafoundation.nova.feature_wallet_connect_api.presentation.WalletConnectService
import io.novafoundation.nova.runtime.multiNetwork.ChainRegistry

@Module
Expand Down Expand Up @@ -71,14 +73,12 @@ class DeepLinkModule {
governanceRouter: GovernanceRouter,
chainRegistry: ChainRegistry,
mutableGovernanceState: MutableGovernanceState,
accountRepository: AccountRepository,
automaticInteractionGate: AutomaticInteractionGate
): DeepLinkHandler {
return ReferendumDeepLinkHandler(
governanceRouter,
chainRegistry,
mutableGovernanceState,
accountRepository,
automaticInteractionGate
)
}
Expand All @@ -92,6 +92,15 @@ class DeepLinkModule {
return BuyCallbackDeepLinkHandler(interactor, resourceManager)
}

@Provides
@IntoSet
fun provideWalletConnectPairDeepLinkHandler(
walletConnectService: WalletConnectService,
automaticInteractionGate: AutomaticInteractionGate
): DeepLinkHandler {
return WalletConnectPairDeeplinkHandler(walletConnectService, automaticInteractionGate)
}

@Provides
fun provideRootDeepLinkHandler(
deepLinkHandlers: Set<@JvmSuppressWildcards DeepLinkHandler>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import io.novafoundation.nova.common.di.viewmodel.ViewModelModule
import io.novafoundation.nova.common.mixin.api.NetworkStateMixin
import io.novafoundation.nova.common.resources.ResourceManager
import io.novafoundation.nova.common.sequrity.SafeModeService
import io.novafoundation.nova.common.utils.sequrity.AutomaticInteractionGate
import io.novafoundation.nova.common.utils.coroutines.RootScope
import io.novafoundation.nova.common.utils.sequrity.BackgroundAccessObserver
import io.novafoundation.nova.feature_crowdloan_api.domain.contributions.ContributionsInteractor
Expand Down Expand Up @@ -52,7 +51,6 @@ class RootActivityModule {
walletConnectService: WalletConnectService,
walletConnectSessionsUseCase: WalletConnectSessionsUseCase,
deepLinkHandler: RootDeepLinkHandler,
automaticInteractionGate: AutomaticInteractionGate,
rootScope: RootScope,
compoundRequestBusHandler: CompoundRequestBusHandler
): ViewModel {
Expand All @@ -70,7 +68,6 @@ class RootActivityModule {
walletConnectService,
walletConnectSessionsUseCase,
deepLinkHandler,
automaticInteractionGate,
rootScope,
compoundRequestBusHandler
)
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/navigation/main_nav_graph.xml
Original file line number Diff line number Diff line change
Expand Up @@ -867,6 +867,7 @@
android:label="SelectWalletFragment" />

<fragment
app:useAdd="true"
android:id="@+id/walletConnectApproveSessionFragment"
android:name="io.novafoundation.nova.feature_wallet_connect_impl.presentation.sessions.approve.WalletConnectApproveSessionFragment"
android:label="WalletConnectApproveSessionFragment" />
Expand Down
11 changes: 6 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
buildscript {
ext {
// App version
versionName = '7.8.0'
versionCode = 115
versionName = '7.9.0'
versionCode = 117

applicationId = "io.novafoundation.nova"
releaseApplicationSuffix = "market"
Expand Down Expand Up @@ -51,7 +51,7 @@ buildscript {

web3jVersion = '4.9.5'

fearlessLibVersion = '1.11.1'
fearlessLibVersion = '1.11.2'

gifVersion = '1.2.19'

Expand Down Expand Up @@ -83,8 +83,8 @@ buildscript {

markwonVersion = '4.6.2'

walletConnectCoreVersion = "1.13.0"
walletConnectWalletVersion = "1.6.0"
walletConnectCoreVersion = "1.27.2"
walletConnectWalletVersion = "1.20.2"

withoutTransitiveAndroidX = {
exclude group: "androidx.appcompat", module: "appcompat"
Expand Down Expand Up @@ -208,6 +208,7 @@ buildscript {
classpath 'com.android.tools.build:gradle:7.4.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
classpath 'com.google.gms:google-services:4.3.14'
classpath 'org.mozilla.rust-android-gradle:plugin:0.9.3'
classpath "com.google.firebase:firebase-appdistribution-gradle:$firebaseAppDistrVersion"
classpath "com.github.triplet.gradle:play-publisher:$playPublisherVersion"
}
Expand Down

0 comments on commit f006e37

Please sign in to comment.