Skip to content

Commit

Permalink
Merge pull request #1259 from novasamatech/rc/7.5.0
Browse files Browse the repository at this point in the history
Rc/7.5.0
  • Loading branch information
valentunn authored Dec 6, 2023
2 parents 87517f6 + bf9aed2 commit 7da646c
Show file tree
Hide file tree
Showing 391 changed files with 2,919 additions and 1,226 deletions.
26 changes: 26 additions & 0 deletions .github/scripts/pr_comment_extract_data.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import requests
import sys
import os
from datetime import datetime


def parse_base_params(comment_link):
response = requests.get(comment_link).json()
try:
lines = response["body"].split("\n")
except:
print("Please, create a comment with 'Release severity: Major | Critical | Normal' and 'Release notes:'")
exit(1)

time = datetime.utcnow().strftime('%Y-%m-%dT%H:%M:%SZ')
severity = next((s.split(': ')[1] for s in lines if s.startswith('Release severity: ')), '').strip()

if not time or not severity:
print(f"Current values: Time - '{time}', Severity - '{severity}'")
print("Time or severity cannot be empty, please set it in the PR comment with lines 'Release time:' and 'Release severity:'")
sys.exit(1)

with open(os.getenv('GITHUB_ENV'), 'a') as f:
f.write(f'TIME={time}\n')
f.write(f'SEVERITY={severity}\n')
parse_base_params(os.getenv("COMMENT_LINK"))
62 changes: 47 additions & 15 deletions .github/workflows/pr_workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,24 @@ name: PR Workflow
on:
pull_request:
branches:
- 'develop' # master

- 'master'
pull_request_review_comment:
types: [created, edited, deleted]

jobs:
checkRef:
if: github.event.pull_request.base.ref == 'master' || github.event_name == 'pull_request'
runs-on: ubuntu-latest
outputs:
is_rc: ${{ steps.check_ref.outputs.ref_contains_rc }}

steps:
- uses: actions/checkout@v2
- name: Check if "rc" is present in github.ref
id: check_ref
run: |
echo ${{ github.head_ref || github.ref_name }}
if [[ "${{ github.head_ref || github.ref_name }}" == *"/rc/"* ]]; then
if [[ "${{ github.head_ref || github.ref_name }}" == *"rc"* ]]; then
echo "ref_contains_rc=1" >> $GITHUB_OUTPUT
else
echo "ref_contains_rc=0" >> $GITHUB_OUTPUT
Expand All @@ -25,19 +30,46 @@ jobs:
run: |
echo "Output: ${{ steps.check_ref.outputs.ref_contains_rc }}"
build:
make-or-update-pr:
runs-on: ubuntu-latest
permissions: write-all
needs: checkRef
if: needs.checkRef.outputs.is_rc == '1'

steps:
- name: Check if comment contains "Release notes"
if: github.ref == 'refs/heads/master'
uses: actions/github-script@v4
- uses: actions/checkout@v4
- name: Find Comment
uses: peter-evans/find-comment@v2
id: fc
with:
issue-number: ${{ github.event.pull_request.number }}
body-includes: Release notes

- name: Create comment link
id: create_link
run: |
echo "COMMENT_LINK=https://api.github.com/repos/${{ github.repository }}/issues/comments/${{ steps.fc.outputs.comment-id }}" >> $GITHUB_ENV
shell: bash

- name: Extract version from branch name
id: extract_version
run: |
VERSION=${{ github.head_ref }}
echo "::set-output name=version::${VERSION#*rc/}"
- uses: tibdex/github-app-token@v1
id: generate-token
with:
app_id: ${{ secrets.PR_APP_ID }}
private_key: ${{ secrets.PR_APP_TOKEN }}

- name: Run Python script
run: python .github/scripts/pr_comment_extract_data.py

- name: Create new branch and file in nova-wallet-android-releases repo
uses: peter-evans/repository-dispatch@v2
with:
script: |
const comment = github.event.pull_request.comments.find(c => c.body.includes('Release notes'));
if (!comment) {
console.log('No comment found with "Release notes"');
throw new Error('Missing release notes');
} else {
console.log('Comment found with "Release notes"');
}
token: ${{ steps.generate-token.outputs.token }}
repository: novasamatech/nova-wallet-android-releases
event-type: create-pr
client-payload: '{"version": "${{ steps.extract_version.outputs.version }}", "comment_link": "${{ env.COMMENT_LINK }}", "time": "${{ env.TIME }}", "severity": "${{ env.SEVERITY }}"}'
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class SwapServiceIntegrationTest : BaseIntegrationTest() {

@Test
fun shouldRetrieveAvailableDirections() = runTest {
val allAvailableAssetIdsToSwap = swapService.assetsAvailableForSwap(this)
val allAvailableAssetIdsToSwap = swapService.assetsAvailableForSwap(this).first()
val allAvailableChainAssetsToSwap = allAvailableAssetIdsToSwap.map {
val (chain, asset) = chainRegistry.chainWithAsset(it.chainId, it.assetId)

Expand Down Expand Up @@ -84,7 +84,8 @@ class SwapServiceIntegrationTest : BaseIntegrationTest() {
assetOut = siri,
swapLimit = SwapLimit.SpecifiedIn(
expectedAmountIn = siri.planksFromAmount(0.000001.toBigDecimal()),
amountOutMin = Balance.ZERO
amountOutMin = Balance.ZERO,
expectedAmountOut = Balance.ZERO
),
customFeeAsset = null,
nativeAsset = arbitraryAssetUseCase.assetFlow(westmint.commissionAsset).first()
Expand All @@ -106,7 +107,8 @@ class SwapServiceIntegrationTest : BaseIntegrationTest() {
assetOut = wnd,
swapLimit = SwapLimit.SpecifiedIn(
expectedAmountIn = siri.planksFromAmount(0.000001.toBigDecimal()),
amountOutMin = Balance.ZERO
amountOutMin = Balance.ZERO,
expectedAmountOut = Balance.ZERO
),
customFeeAsset = siri,
nativeAsset = arbitraryAssetUseCase.assetFlow(westmint.commissionAsset).first()
Expand Down Expand Up @@ -146,7 +148,7 @@ class SwapServiceIntegrationTest : BaseIntegrationTest() {
}

private suspend fun CoroutineScope.findAvailableDirectionsFor(asset: Chain.Asset) {
val directionsForWnd = swapService.availableSwapDirectionsFor(asset, this)
val directionsForWnd = swapService.availableSwapDirectionsFor(asset, this).first()
val directionsForWndFormatted = directionsForWnd.map { otherId ->
val otherAsset = chainRegistry.asset(otherId)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import io.novafoundation.nova.common.data.network.runtime.binding.AccountInfo
import io.novafoundation.nova.common.data.network.runtime.binding.bindAccountInfo
import io.novafoundation.nova.common.di.FeatureUtils
import io.novafoundation.nova.common.utils.fromJson
import io.novafoundation.nova.common.utils.hasModule
import io.novafoundation.nova.common.utils.system
import io.novafoundation.nova.feature_account_api.di.AccountFeatureApi
import io.novafoundation.nova.feature_account_impl.di.AccountFeatureComponent
Expand Down Expand Up @@ -125,6 +126,11 @@ class BalancesIntegrationTest(
withTimeout(80.seconds) {
extrinsicService.estimateFee(chain) {
systemRemark(byteArrayOf(0))

val haveBatch = runtime.metadata.hasModule("Utility")
if (haveBatch) {
systemRemark(byteArrayOf(0))
}
}
}
}
Expand Down
38 changes: 26 additions & 12 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,36 +9,39 @@

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

<uses-permission android:name="android.permission.BLUETOOTH"
<uses-permission
android:name="android.permission.BLUETOOTH"
android:maxSdkVersion="30" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN"
<uses-permission
android:name="android.permission.BLUETOOTH_ADMIN"
android:maxSdkVersion="30" />

<uses-permission android:name="android.permission.BLUETOOTH_SCAN"
<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" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

<application
tools:replace="android:allowBackup,android:fullBackupContent,android:dataExtractionRules"
android:name="io.novafoundation.nova.app.App"
android:allowBackup="false"
android:fullBackupContent="false"
android:dataExtractionRules="@xml/data_extraction_rules"
tools:targetApi="s"
android:fullBackupContent="false"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true">
android:supportsRtl="true"
tools:replace="android:allowBackup,android:fullBackupContent,android:dataExtractionRules"
tools:targetApi="s">

<activity
android:name="io.novafoundation.nova.app.root.presentation.RootActivity"
android:exported="true"
android:launchMode="singleTask"
android:screenOrientation="portrait"
android:theme="@style/Theme.NovaFoundation.Nova"
android:launchMode="singleTask"
android:windowSoftInputMode="adjustResize"
android:exported="true">
android:windowSoftInputMode="adjustResize">

<intent-filter tools:ignore="AppLinkUrlError">
<action android:name="android.intent.action.VIEW" />
Expand All @@ -62,6 +65,17 @@
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
</intent-filter>

<intent-filter android:label="@string/app_name">
<data
android:host="nova"
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>
</activity>

<activity
Expand All @@ -73,8 +87,8 @@
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.provider"
android:grantUriPermissions="true"
android:exported="false">
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/provider_paths" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import dagger.Module
import dagger.Provides
import io.novafoundation.nova.app.root.navigation.NavigationHolder
import io.novafoundation.nova.app.root.navigation.Navigator
import io.novafoundation.nova.app.root.navigation.account.AdvancedEncryptionCommunicatorImpl
import io.novafoundation.nova.app.root.navigation.account.PolkadotVaultVariantSignCommunicatorImpl
import io.novafoundation.nova.app.root.navigation.account.SelectAddressCommunicatorImpl
import io.novafoundation.nova.app.root.navigation.account.SelectWalletCommunicatorImpl
Expand All @@ -15,7 +14,6 @@ import io.novafoundation.nova.feature_account_api.presenatation.account.wallet.l
import io.novafoundation.nova.feature_account_api.presenatation.mixin.selectWallet.SelectWalletCommunicator
import io.novafoundation.nova.feature_account_impl.data.signer.paritySigner.PolkadotVaultVariantSignCommunicator
import io.novafoundation.nova.feature_account_impl.presentation.AccountRouter
import io.novafoundation.nova.feature_account_impl.presentation.AdvancedEncryptionCommunicator
import io.novafoundation.nova.feature_assets.presentation.AssetsRouter

@Module
Expand All @@ -27,12 +25,6 @@ class AccountNavigationModule {
navigationHolder: NavigationHolder
): PinCodeTwoFactorVerificationCommunicator = PinCodeTwoFactorVerificationCommunicatorImpl(navigationHolder)

@Provides
@ApplicationScope
fun provideAdvancedEncryptionCommunicator(
navigationHolder: NavigationHolder
): AdvancedEncryptionCommunicator = AdvancedEncryptionCommunicatorImpl(navigationHolder)

@Provides
@ApplicationScope
fun provideSelectWalletCommunicator(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,15 @@ import io.novafoundation.nova.common.di.CommonApi
import io.novafoundation.nova.common.di.scope.FeatureScope
import io.novafoundation.nova.core_db.di.DbApi
import io.novafoundation.nova.feature_account_api.di.AccountFeatureApi
import io.novafoundation.nova.feature_account_impl.presentation.AccountRouter
import io.novafoundation.nova.feature_assets.di.AssetsFeatureApi
import io.novafoundation.nova.feature_assets.presentation.AssetsRouter
import io.novafoundation.nova.feature_crowdloan_api.di.CrowdloanFeatureApi
import io.novafoundation.nova.feature_currency_api.di.CurrencyFeatureApi
import io.novafoundation.nova.feature_dapp_api.di.DAppFeatureApi
import io.novafoundation.nova.feature_dapp_impl.DAppRouter
import io.novafoundation.nova.feature_governance_api.di.GovernanceFeatureApi
import io.novafoundation.nova.feature_governance_impl.presentation.GovernanceRouter
import io.novafoundation.nova.feature_staking_api.di.StakingFeatureApi
import io.novafoundation.nova.feature_versions_api.di.VersionsFeatureApi
import io.novafoundation.nova.feature_wallet_api.di.WalletFeatureApi
Expand All @@ -40,6 +46,10 @@ interface RootComponent {
fun create(
@BindsInstance navigationHolder: NavigationHolder,
@BindsInstance rootRouter: RootRouter,
@BindsInstance governanceRouter: GovernanceRouter,
@BindsInstance dAppRouter: DAppRouter,
@BindsInstance assetsRouter: AssetsRouter,
@BindsInstance accountRouter: AccountRouter,
@BindsInstance stakingDashboardNavigator: StakingDashboardNavigator,
deps: RootDependencies
): RootComponent
Expand All @@ -53,6 +63,8 @@ interface RootComponent {
CrowdloanFeatureApi::class,
AssetsFeatureApi::class,
CurrencyFeatureApi::class,
GovernanceFeatureApi::class,
DAppFeatureApi::class,
DbApi::class,
CommonApi::class,
RuntimeApi::class,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,17 @@ import io.novafoundation.nova.common.utils.sequrity.AutomaticInteractionGate
import io.novafoundation.nova.common.utils.sequrity.BackgroundAccessObserver
import io.novafoundation.nova.common.utils.systemCall.SystemCallExecutor
import io.novafoundation.nova.feature_account_api.domain.interfaces.AccountRepository
import io.novafoundation.nova.feature_account_api.domain.account.common.EncryptionDefaults
import io.novafoundation.nova.feature_assets.data.network.BalancesUpdateSystem
import io.novafoundation.nova.feature_crowdloan_api.data.repository.CrowdloanRepository
import io.novafoundation.nova.feature_crowdloan_api.domain.contributions.ContributionsInteractor
import io.novafoundation.nova.feature_currency_api.domain.CurrencyInteractor
import io.novafoundation.nova.feature_dapp_api.data.repository.DAppMetadataRepository
import io.novafoundation.nova.feature_governance_api.data.MutableGovernanceState
import io.novafoundation.nova.feature_staking_api.domain.api.StakingRepository
import io.novafoundation.nova.feature_versions_api.domain.UpdateNotificationsInteractor
import io.novafoundation.nova.feature_wallet_api.domain.interfaces.WalletRepository
import io.novafoundation.nova.feature_wallet_connect_api.domain.sessions.WalletConnectSessionsUseCase
import io.novafoundation.nova.feature_wallet_connect_api.presentation.WalletConnectService
import io.novafoundation.nova.runtime.multiNetwork.ChainRegistry
import io.novafoundation.nova.runtime.multiNetwork.connection.ChainConnection
Expand Down Expand Up @@ -57,6 +61,12 @@ interface RootDependencies {

fun rootScope(): RootScope

fun governanceStateUpdater(): MutableGovernanceState

fun dappMetadataRepository(): DAppMetadataRepository

fun encryptionDefaults(): EncryptionDefaults

val systemCallExecutor: SystemCallExecutor

val contextManager: ContextManager
Expand All @@ -66,4 +76,6 @@ interface RootDependencies {
val imageLoader: ImageLoader

val automaticInteractionGate: AutomaticInteractionGate

val walletConnectSessionsUseCase: WalletConnectSessionsUseCase
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,15 @@ import io.novafoundation.nova.common.di.FeatureContainer
import io.novafoundation.nova.common.di.scope.ApplicationScope
import io.novafoundation.nova.core_db.di.DbApi
import io.novafoundation.nova.feature_account_api.di.AccountFeatureApi
import io.novafoundation.nova.feature_account_impl.presentation.AccountRouter
import io.novafoundation.nova.feature_assets.di.AssetsFeatureApi
import io.novafoundation.nova.feature_assets.presentation.AssetsRouter
import io.novafoundation.nova.feature_crowdloan_api.di.CrowdloanFeatureApi
import io.novafoundation.nova.feature_currency_api.di.CurrencyFeatureApi
import io.novafoundation.nova.feature_dapp_api.di.DAppFeatureApi
import io.novafoundation.nova.feature_dapp_impl.DAppRouter
import io.novafoundation.nova.feature_governance_api.di.GovernanceFeatureApi
import io.novafoundation.nova.feature_governance_impl.presentation.GovernanceRouter
import io.novafoundation.nova.feature_staking_api.di.StakingFeatureApi
import io.novafoundation.nova.feature_versions_api.di.VersionsFeatureApi
import io.novafoundation.nova.feature_wallet_api.di.WalletFeatureApi
Expand All @@ -22,6 +28,10 @@ import javax.inject.Inject
class RootFeatureHolder @Inject constructor(
private val navigationHolder: NavigationHolder,
private val navigator: Navigator,
private val governanceRouter: GovernanceRouter,
private val dAppRouter: DAppRouter,
private val accountRouter: AccountRouter,
private val assetsRouter: AssetsRouter,
private val stakingDashboardNavigator: StakingDashboardNavigator,
featureContainer: FeatureContainer
) : FeatureApiHolder(featureContainer) {
Expand All @@ -36,12 +46,14 @@ class RootFeatureHolder @Inject constructor(
.assetsFeatureApi(getFeature(AssetsFeatureApi::class.java))
.currencyFeatureApi(getFeature(CurrencyFeatureApi::class.java))
.crowdloanFeatureApi(getFeature(CrowdloanFeatureApi::class.java))
.governanceFeatureApi(getFeature(GovernanceFeatureApi::class.java))
.dAppFeatureApi(getFeature(DAppFeatureApi::class.java))
.runtimeApi(getFeature(RuntimeApi::class.java))
.versionsFeatureApi(getFeature(VersionsFeatureApi::class.java))
.walletConnectFeatureApi(getFeature(WalletConnectFeatureApi::class.java))
.build()

return DaggerRootComponent.factory()
.create(navigationHolder, navigator, stakingDashboardNavigator, rootFeatureDependencies)
.create(navigationHolder, navigator, governanceRouter, dAppRouter, assetsRouter, accountRouter, stakingDashboardNavigator, rootFeatureDependencies)
}
}
Loading

0 comments on commit 7da646c

Please sign in to comment.