Skip to content

Commit

Permalink
Merge pull request #1600 from novasamatech/rc/8.2.1
Browse files Browse the repository at this point in the history
Rc/8.2.1
  • Loading branch information
antonijzelinskij authored Jul 22, 2024
2 parents c519ace + 2b69b18 commit 7bd8bf9
Show file tree
Hide file tree
Showing 131 changed files with 1,446 additions and 241 deletions.
2 changes: 1 addition & 1 deletion .github/scripts/run_balances_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ adb devices
adb -s emulator-5554 install app/debug/app-debug.apk

# Install instrumental tests
adb -s emulator-5554 install test-app/androidTest/debug/app-debug-androidTest.apk
adb -s emulator-5554 install app/androidTest/debug/app-debug-androidTest.apk

# Run tests
adb logcat -c &&
Expand Down
8 changes: 8 additions & 0 deletions .github/workflows/android_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ on:
required: false
type: string
default: "apk"
build-debug-tests:
required: false
type: boolean
default: false
secrets:
ACALA_PROD_AUTH_TOKEN:
required: true
Expand Down Expand Up @@ -174,6 +178,10 @@ jobs:
if: ${{ !startsWith(inputs.gradlew-command, 'false') }}
run: ./gradlew ${{ inputs.gradlew-command }}

- name: 🏗 Build debug tests
if: ${{ inputs.build-debug-tests }}
run: ./gradlew assembleDebugAndroidTest

- name: 🧹 Delete key after building
if: ${{ !startsWith(inputs.keystore-file-name, 'false') }}
run: rm ./app/${{ inputs.keystore-file-name }}
Expand Down
24 changes: 3 additions & 21 deletions .github/workflows/balances_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,18 @@ on:
- cron: '0 */8 * * *'

jobs:
develop-build:
build-app:
uses: novasamatech/nova-wallet-android/.github/workflows/android_build.yml@develop
with:
branch: ${{github.head_ref}}
gradlew-command: assembleDebug
upload-name: develop-apk
run-tests: false
secrets: inherit

test-build:
uses: novasamatech/nova-wallet-android/.github/workflows/android_build.yml@develop
with:
branch: ${{github.head_ref}}
gradlew-command: assembleDebugAndroidTest
upload-name: test-apk
run-tests: false
build-debug-tests: true
secrets: inherit

run-tests:
needs: [develop-build, test-build]
needs: [build-app]
runs-on: macos-13
steps:
- uses: actions/checkout@v4
Expand All @@ -40,16 +32,6 @@ jobs:
run: |
ls -laR app
- name: Download instrumential test artifact
uses: actions/download-artifact@v4
with:
name: test-apk
path: test-app

- name: Debug path
run: |
ls -laR test-app
- name: Add permissions
run: chmod +x .github/scripts/run_balances_test.sh

Expand Down
1 change: 1 addition & 0 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ jobs:
with:
branch: ${{github.head_ref}}
gradlew-command: assembleDevelop
build-debug-tests: true
secrets: inherit
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ package io.novafoundation.nova.feature_dapp_impl.data.repository

import io.novafoundation.nova.core_db.dao.PhishingSitesDao
import io.novafoundation.nova.feature_dapp_impl.data.network.phishing.PhishingSitesApi
import io.novafoundation.nova.feature_dapp_impl.data.phisning.BlackListPhishingDetectingService
import io.novafoundation.nova.feature_dapp_impl.data.phisning.CompoundPhishingDetectingService
import io.novafoundation.nova.feature_dapp_impl.data.phisning.DomainListPhishingDetectingService
import io.novafoundation.nova.feature_dapp_impl.data.phisning.PhishingDetectingService
import io.novafoundation.nova.test_shared.any
import kotlinx.coroutines.runBlocking
import org.junit.Assert.assertEquals
Expand All @@ -21,8 +25,17 @@ class PhishingSitesRepositoryImplTest {
@Mock
lateinit var phishingSitesApi: PhishingSitesApi

private val phishingDetectingService: PhishingDetectingService by lazy {
CompoundPhishingDetectingService(
listOf(
BlackListPhishingDetectingService(phishingDao),
DomainListPhishingDetectingService(listOf("top"))
)
)
}

private val phishingSiteRepository by lazy {
PhishingSitesRepositoryImpl(phishingDao, phishingSitesApi)
PhishingSitesRepositoryImpl(phishingDao, phishingSitesApi, phishingDetectingService)
}


Expand Down Expand Up @@ -70,6 +83,13 @@ class PhishingSitesRepositoryImplTest {
checkingUrl = "http://valid.com?redirectUrl=host.com",
expectedResult = false
)

// top url is always phishing
runTest(
dbItems = listOf(),
checkingUrl = "http://invalid.host.top",
expectedResult = true
)
}
}

Expand Down
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
buildscript {
ext {
// App version
versionName = '8.2.0'
versionCode = 143
versionName = '8.2.1'
versionCode = 145

applicationId = "io.novafoundation.nova"
releaseApplicationSuffix = "market"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ fun BaseFragmentMixin<*>.observeValidations(
}
level >= DefaultFailureLevel.WARNING -> warningDialog(
context = dialogContext,
onConfirm = it.confirmWarning
onPositiveClick = it.confirmWarning
) {
setTitle(it.title)
setMessage(it.message)
Expand Down
14 changes: 9 additions & 5 deletions common/src/main/java/io/novafoundation/nova/common/utils/Ext.kt
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,16 @@ fun Context.sendEmailIntent(
targetEmail: String,
title: String = getString(R.string.common_email_chooser_title)
) {
val emailIntent = Intent(Intent.ACTION_SENDTO).apply {
putExtra(Intent.EXTRA_EMAIL, targetEmail)
type = "message/rfc822"
data = Uri.parse("mailto:$targetEmail")
try {
val emailIntent = Intent(Intent.ACTION_SENDTO).apply {
putExtra(Intent.EXTRA_EMAIL, targetEmail)
type = "message/rfc822"
data = Uri.parse("mailto:$targetEmail")
}
startActivity(Intent.createChooser(emailIntent, title))
} catch (e: Exception) {
Toast.makeText(this, R.string.common_something_went_wrong_title, Toast.LENGTH_SHORT)
}
startActivity(Intent.createChooser(emailIntent, title))
}

fun @receiver:ColorInt Int.toHexColor(): String {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,10 @@ fun RuntimeMetadata.preImage() = module(Modules.PREIMAGE)

fun RuntimeMetadata.nominationPools() = module(Modules.NOMINATION_POOLS)

fun RuntimeMetadata.delegatedStakingOrNull() = moduleOrNull(Modules.DELEGATED_STAKING)

fun RuntimeMetadata.delegatedStaking() = module(Modules.DELEGATED_STAKING)

fun RuntimeMetadata.nominationPoolsOrNull() = moduleOrNull(Modules.NOMINATION_POOLS)

fun RuntimeMetadata.assetConversionOrNull() = moduleOrNull(Modules.ASSET_CONVERSION)
Expand Down Expand Up @@ -437,6 +441,8 @@ object Modules {

const val NOMINATION_POOLS = "NominationPools"

const val DELEGATED_STAKING = "DelegatedStaking"

const val ASSET_CONVERSION = "AssetConversion"

const val TRANSACTION_PAYMENT = "TransactionPayment"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,7 @@ fun <T : Identifiable, R> Flow<List<T>>.transformLatestDiffed(transform: suspend
private class SendingCollector<T>(
private val channel: SendChannel<T>
) : FlowCollector<T> {

override suspend fun emit(value: T): Unit = channel.send(value)
}

Expand Down Expand Up @@ -554,6 +555,20 @@ fun <A, B, C, R> unite(flowA: Flow<A>, flowB: Flow<B>, flowC: Flow<C>, transform
).map { transform(aResult, bResult, cResult) }
}

fun <A, B, C, D, R> unite(flowA: Flow<A>, flowB: Flow<B>, flowC: Flow<C>, flowD: Flow<D>, transform: (A?, B?, C?, D?) -> R): Flow<R> {
var aResult: A? = null
var bResult: B? = null
var cResult: C? = null
var dResult: D? = null

return merge(
flowA.onEach { aResult = it },
flowB.onEach { bResult = it },
flowC.onEach { cResult = it },
flowD.onEach { dResult = it }
).map { transform(aResult, bResult, cResult, dResult) }
}

fun <T> firstNonEmpty(
vararg sources: Flow<List<T>>
): Flow<List<T>> = accumulate(*sources)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ object Urls {
return URL(url).host
}

fun domainOf(url: String): String {
return URL(url).authority
}

fun isValidWebUrl(url: String): Boolean {
return Patterns.WEB_URL.matcher(url).matches()
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
package io.novafoundation.nova.common.utils.formatting.spannable

import android.content.Context
import android.text.SpannedString
import androidx.annotation.StringRes
import io.novafoundation.nova.common.resources.ResourceManager
import io.novafoundation.nova.common.utils.formatting.spannable.SpannableFormatter.fill
import java.util.regex.Pattern

/**
Expand Down Expand Up @@ -64,3 +68,13 @@ object SpannableFormatter {
fun result(): CharSequence
}
}

fun SpannableFormatter.format(resourceManager: ResourceManager, @StringRes resId: Int, vararg args: Any): SpannedString {
val format = resourceManager.getString(resId)
return format(format, *args)
}

fun SpannableFormatter.format(context: Context, @StringRes resId: Int, vararg args: Any): SpannedString {
val format = context.getString(resId)
return format(format, *args)
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ fun BaseFragment<*>.setupPermissionAsker(

warningDialog(
context = requireContext(),
onConfirm = { it.onSuccess(PermissionDeniedAction.RETRY) },
onCancel = { it.onSuccess(PermissionDeniedAction.BACK) },
confirmTextRes = if (level == CAN_ASK_AGAIN) R.string.common_ask_again else R.string.common_to_settings
onPositiveClick = { it.onSuccess(PermissionDeniedAction.RETRY) },
onNegativeClick = { it.onSuccess(PermissionDeniedAction.BACK) },
positiveTextRes = if (level == CAN_ASK_AGAIN) R.string.common_ask_again else R.string.common_to_settings
) {
if (level == CAN_ASK_AGAIN) {
setTitle(R.string.common_permission_permissions_needed_title)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@ import android.content.Context
import android.os.Bundle
import android.widget.ImageView
import android.widget.TextView
import androidx.annotation.ColorRes
import androidx.annotation.DrawableRes
import androidx.core.view.setPadding
import io.novafoundation.nova.common.R
import io.novafoundation.nova.common.utils.WithContextExtensions
import io.novafoundation.nova.common.utils.setImageTintRes
import io.novafoundation.nova.common.view.PrimaryButton
import kotlinx.android.synthetic.main.bottom_sheet_action_not_allowed.actionNotAllowedImage
import kotlinx.android.synthetic.main.bottom_sheet_action_not_allowed.actionNotAllowedOk
Expand Down Expand Up @@ -50,14 +52,16 @@ open class ActionNotAllowedBottomSheet(
super.setContentView(layoutResId)
}

protected fun applySolidIconStyle(@DrawableRes src: Int) = with(iconView) {
protected fun applySolidIconStyle(@DrawableRes src: Int, @ColorRes tint: Int? = R.color.icon_primary) = with(iconView) {
setPadding(12.dp)
setImageTintRes(tint)
setBackgroundResource(R.drawable.bg_icon_big)
setImageResource(src)
}

protected fun applyDashedIconStyle(@DrawableRes src: Int) = with(iconView) {
protected fun applyDashedIconStyle(@DrawableRes src: Int, @ColorRes tint: Int? = R.color.icon_primary) = with(iconView) {
setPadding(12.dp)
setImageTintRes(tint)
setBackgroundResource(R.drawable.bg_icon_big_dashed)
setImageResource(src)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,16 @@ fun infoDialog(

fun warningDialog(
context: Context,
onConfirm: DialogClickHandler,
@StringRes confirmTextRes: Int = R.string.common_continue,
@StringRes cancelTextRes: Int = R.string.common_cancel,
onCancel: DialogClickHandler? = null,
onPositiveClick: DialogClickHandler,
@StringRes positiveTextRes: Int = R.string.common_continue,
@StringRes negativeTextRes: Int = R.string.common_cancel,
onNegativeClick: DialogClickHandler? = null,
@StyleRes styleRes: Int = R.style.AccentNegativeAlertDialogTheme_Reversed,
decorator: DialogDecorator? = null
) {
dialog(context.themed(R.style.AccentNegativeAlertDialogTheme_Reversed)) {
setPositiveButton(confirmTextRes) { _, _ -> onConfirm() }
setNegativeButton(cancelTextRes) { _, _ -> onCancel?.invoke() }
dialog(context.themed(styleRes)) {
setPositiveButton(positiveTextRes) { _, _ -> onPositiveClick() }
setNegativeButton(negativeTextRes) { _, _ -> onNegativeClick?.invoke() }

decorator?.invoke(this)
}
Expand Down
7 changes: 7 additions & 0 deletions common/src/main/res/values-es/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -629,6 +629,9 @@
<string name="dapp_sign_error_unsupported_chain">Cadena no soportada con hash de génesis %s</string>
<string name="dapp_sign_extrinsic_details_subtitle">Asegúrese de que la operación sea correcta</string>
<string name="dapp_sign_extrinsic_failed">No se pudo firmar la operación solicitada</string>
<string name="dapp_url_warning_open_anyway">Abrir de todos modos</string>
<string name="dapp_url_warning_subtitle">Las DApps maliciosas pueden retirar todos tus fondos. Siempre realiza tu propia investigación antes de usar una DApp, otorgar permiso o enviar fondos.\n\nSi alguien te está presionando para que visites esta DApp, es probable que sea una estafa. En caso de duda, por favor contacta con el soporte de Nova Wallet: %s.</string>
<string name="dapp_url_warning_title">¡Advertencia! La DApp es desconocida</string>
<string name="deep_linking_chain_id_is_not_found">Cadena no encontrada</string>
<string name="deep_linking_domain_is_not_matched">El dominio del enlace %s no está permitido</string>
<string name="deep_linking_governance_type_is_not_specified">Tipo de gobernanza no especificado</string>
Expand Down Expand Up @@ -887,6 +890,8 @@
<string name="pool_full_failure_title">El pool está lleno</string>
<string name="pool_inactive_failure_message">No puedes unirte a un pool que no está abierto. Por favor, contacta al propietario del pool.</string>
<string name="pool_inactive_failure_title">El pool no está abierto</string>
<string name="pool_staking_conflict_message">Ya no puedes usar tanto Staking Directo como Pool Staking desde la misma cuenta. Para gestionar tu Pool Staking, primero necesitas unstakear tus tokens del Staking Directo.</string>
<string name="pool_staking_conflict_title">Las operaciones de Pool no están disponibles</string>
<string name="pre_configured_networks_add_custom_button">Agregar red manualmente</string>
<string name="pre_configured_networks_progress_text">Cargando lista de redes...</string>
<string name="pre_configured_networks_search_hint">Buscar por nombre de la red</string>
Expand Down Expand Up @@ -1122,6 +1127,8 @@
<string name="settings_twitter">Twitter</string>
<string name="settings_wiki">Wiki</string>
<string name="settings_youtube">Youtube</string>
<string name="setup_staking_conflict_message">No puedes hacer stake con Staking Directo y Pools de Nominación al mismo tiempo</string>
<string name="setup_staking_conflict_title">Ya estás en staking</string>
<string name="setup_staking_type_advanced_options_condition">Gestión avanzada de staking</string>
<string name="setup_staking_type_already_used_title">El tipo de staking no puede ser cambiado</string>
<string name="setup_staking_type_direct_already_used_message">Ya tienes Staking directo</string>
Expand Down
7 changes: 7 additions & 0 deletions common/src/main/res/values-fr-rFR/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -629,6 +629,9 @@
<string name="dapp_sign_error_unsupported_chain">Chaîne non prise en charge avec le hachage de genèse %s</string>
<string name="dapp_sign_extrinsic_details_subtitle">Assurez-vous que l’opération est correcte</string>
<string name="dapp_sign_extrinsic_failed">Échec de la signature de l’opération demandée</string>
<string name="dapp_url_warning_open_anyway">Ouvrir quand même</string>
<string name="dapp_url_warning_subtitle">Les DApps malveillantes peuvent retirer tous vos fonds. Faites toujours vos propres recherches avant d\'utiliser une DApp, d\'accorder des permissions ou d\'envoyer des fonds.\n\nSi quelqu\'un vous pousse à visiter cette DApp, il est probable que ce soit une escroquerie. En cas de doute, veuillez contacter le support de Nova Wallet : %s.</string>
<string name="dapp_url_warning_title">Attention ! DApp inconnue</string>
<string name="deep_linking_chain_id_is_not_found">Chaîne non trouvée</string>
<string name="deep_linking_domain_is_not_matched">Le domaine du lien %s n\'est pas autorisé</string>
<string name="deep_linking_governance_type_is_not_specified">Le type de gouvernance n\'est pas spécifié</string>
Expand Down Expand Up @@ -887,6 +890,8 @@
<string name="pool_full_failure_title">Le pool est complet</string>
<string name="pool_inactive_failure_message">Vous ne pouvez pas rejoindre un pool qui n\'est pas ouvert. Veuillez contacter le propriétaire du pool.</string>
<string name="pool_inactive_failure_title">Le pool n\'est pas ouvert</string>
<string name="pool_staking_conflict_message">Vous ne pouvez plus utiliser à la fois le Stake direct et le Pool Staking depuis le même compte. Pour gérer votre Pool Staking, vous devez d\'abord unstake vos tokens du Stake direct.</string>
<string name="pool_staking_conflict_title">Les opérations de Pool ne sont pas disponibles</string>
<string name="pre_configured_networks_add_custom_button">Ajouter un réseau manuellement</string>
<string name="pre_configured_networks_progress_text">Chargement de la liste des réseaux...</string>
<string name="pre_configured_networks_search_hint">Rechercher par nom de réseau</string>
Expand Down Expand Up @@ -1122,6 +1127,8 @@
<string name="settings_twitter">Twitter</string>
<string name="settings_wiki">Wiki</string>
<string name="settings_youtube">YouTube</string>
<string name="setup_staking_conflict_message">Vous ne pouvez pas staker avec le Stake direct et les Pools de Nomination en même temps</string>
<string name="setup_staking_conflict_title">Déjà staké</string>
<string name="setup_staking_type_advanced_options_condition">Gestion avancée du staking</string>
<string name="setup_staking_type_already_used_title">Le type de staking ne peut pas être modifié</string>
<string name="setup_staking_type_direct_already_used_message">Vous avez déjà un staking Direct</string>
Expand Down
Loading

0 comments on commit 7bd8bf9

Please sign in to comment.