Skip to content

Commit

Permalink
Merge pull request #1131 from soramitsu/staging
Browse files Browse the repository at this point in the history
staging
  • Loading branch information
PankraSerg authored Mar 21, 2024
2 parents cad8840 + ca57983 commit c00e08f
Show file tree
Hide file tree
Showing 322 changed files with 16,778 additions and 2,268 deletions.
2 changes: 1 addition & 1 deletion Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def jobParams = [
def pipeline = new org.android.AppPipeline(
steps: this,
sonar: true,
sonarCommand: './gradlew sonar -x :core-db:compileDebugUnitTestKotlin -x :core-db:compileDebugAndroidTestKotlin -x :feature-crowdloan-impl:compileDebugAndroidTestKotlin -x :runtime:compileDebugUnitTestKotlin -x :app:kaptDebugAndroidTestKotlin -x :app:compileDebugAndroidTestKotlin -Dsonar.coverage.jacoco.xmlReportPaths=**/coverage/*.xml',
sonarCmd: 'sonar -x :core-db:compileDebugUnitTestKotlin -x :core-db:compileDebugAndroidTestKotlin -x :feature-crowdloan-impl:compileDebugAndroidTestKotlin -x :runtime:compileDebugUnitTestKotlin -x :app:kaptDebugAndroidTestKotlin -x :app:compileDebugAndroidTestKotlin -Dsonar.coverage.jacoco.xmlReportPaths=**/coverage/*.xml',
sonarProjectName: 'fearless-android',
sonarProjectKey: 'fearless:fearless-android',
pushReleaseNotes: false,
Expand Down
75 changes: 39 additions & 36 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ android {
signingConfig signingConfigs.debug
}
release {
minifyEnabled shouldEnableR8D8
shrinkResources shouldEnableR8D8
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.ci
}
Expand Down Expand Up @@ -108,14 +108,14 @@ android {
}

compileOptions {
sourceCompatibility 11
targetCompatibility 11
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}

kotlinOptions {
freeCompilerArgs = ["-Xallow-result-return-type"]

jvmTarget = '11'
jvmTarget = '17'
}
composeOptions {
kotlinCompilerExtensionVersion composeCompilerVersion
Expand Down Expand Up @@ -176,58 +176,61 @@ dependencies {
implementation project(':feature-walletconnect-api')
implementation project(':feature-walletconnect-impl')

implementation kotlinDep
implementation project(':feature-nft-api')
implementation project(':feature-nft-impl')

implementation libs.kotlin.stdlib.jdk7

implementation androidDep
implementation constraintDep
implementation libs.appcompat
implementation libs.constraintlayout

implementation zXingEmbeddedDep
implementation libs.zxing.embedded

implementation navigationFragmentDep
implementation navigationUiDep
implementation libs.navigation.fragment.ktx
implementation libs.navigation.ui.ktx

implementation roomDep
implementation libs.room.runtime

implementation daggerDep
kapt daggerKapt
implementation libs.hilt.android
kapt libs.hilt.compiler

implementation lifecycleProcessDep
kapt lifecycleKapt
implementation libs.lifecycle.process
kapt libs.lifecycle.compiler

implementation lifeCycleKtxDep
implementation libs.lifecycle.runtime.ktx

implementation gsonConvertedDep
implementation libs.converter.gson

implementation gifDep
// implementation "pl.droidsonroids.gif:android-gif-drawable:1.2.25"

compileOnly wsDep
compileOnly libs.nv.websocket.client

implementation coroutinesDep
implementation libs.coroutines.core

testImplementation project(':test-shared')

implementation insetterDep
implementation libs.insetter.widgets

implementation liveDataKtxDep
implementation libs.lifecycle.livedata.ktx

implementation jnaDep
implementation beaconDep, withoutJna
implementation libs.jna
implementation libs.beacon.android.sdk, withoutJna

kaptAndroidTest daggerKapt
implementation storiesDep
kaptAndroidTest libs.hilt.compiler
implementation libs.storiesProgressView

implementation compose
debugImplementation composeDebug
implementation libs.bundles.compose
debugImplementation libs.bundles.composeDebug

implementation soraUiCoreDep
implementation libs.sora.ui

implementation(platform(libs.walletconnectBomDep))
implementation(libs.walletconnectCoreDep)
implementation(libs.walletconnectWeb3WalletDep)
implementation platform(libs.walletconnectBomDep)
implementation libs.walletconnectCoreDep
implementation libs.walletconnectWeb3WalletDep

androidTestImplementation androidTestRunnerDep
androidTestImplementation androidTestRulesDep
androidTestImplementation androidJunitDep
androidTestImplementation libs.runner
androidTestImplementation libs.rules
androidTestImplementation libs.ext.junit
}

task printVersion {
Expand Down
156 changes: 155 additions & 1 deletion app/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
## General

# Application classes that will be serialized/deserialized over Gson (Web3j Jackson)
-keep, allowobfuscation class jp.co.soramitsu.nft.data.models.** { public <init>(*); }
-keep, allowobfuscation class jp.co.soramitsu.nft.impl.data.model.** { public <init>(*); }
-keep class jp.co.soramitsu.nft.impl.domain.utils.** { *; }

#-keep class ** { *; }
#-dontobfuscate
-keep class jp.co.soramitsu.shared_utils.** { *; }
Expand Down Expand Up @@ -37,6 +43,22 @@
-keep class net.jpountz.** { *; }
-keep class org.web3j.** { *; }

# Jackson (serializer used in web3j lib) tries to get Enum classes from the whole application (not only its packages)
# by doing so it tries to find Enums that are defined inside its packages :/
# So, if this keep rule is not enabled, R8 removes (obfucates, etc..) all application enums to its liking
# leaving Jackson unaware of it is looking for, and thus an exception will be thrown
# Actual exception is: ExceptionInInitializerError(), but it happens in static code of Enum classes
# while searching for the needed Jackson defined enum
-keepclassmembers,allowoptimization enum com.fasterxml.jackson.databind.** {
public static **[] values();
public static ** valueOf(java.lang.String);
**[] $VALUES;
public *;
}

-keep class jp.co.soramitsu.backup.** { *; }
-keep class com.google.api.** { *; }
-keep class io.opencensus.trace.** { *; }
#for beacon sdk

-keep class it.airgap.beaconsdk.** { *; }
Expand Down Expand Up @@ -99,4 +121,136 @@

# Needed by google-play-services when linking against an older platform version

-dontwarn com.google.android.gms.**
-dontwarn com.google.android.gms.**

# This is generated automatically by the Android Gradle plugin.
-dontwarn org.slf4j.impl.StaticLoggerBinder
-dontwarn org.slf4j.impl.StaticMDCBinder
-dontwarn org.w3c.dom.events.DocumentEvent
-dontwarn org.w3c.dom.events.Event
-dontwarn org.w3c.dom.events.EventException
-dontwarn org.w3c.dom.events.EventListener
-dontwarn org.w3c.dom.events.EventTarget
-dontwarn org.w3c.dom.events.MutationEvent
-dontwarn org.w3c.dom.ls.LSSerializerFilter
-dontwarn org.w3c.dom.ranges.DocumentRange
-dontwarn org.w3c.dom.ranges.Range
-dontwarn org.w3c.dom.traversal.DocumentTraversal
-dontwarn org.w3c.dom.traversal.NodeFilter
-dontwarn org.w3c.dom.traversal.NodeIterator

-dontwarn org.jetbrains.kotlin.compiler.plugin.CliOption
-dontwarn org.jetbrains.kotlin.compiler.plugin.CommandLineProcessor
-dontwarn org.jetbrains.kotlin.compiler.plugin.ComponentRegistrar
-dontwarn org.jetbrains.kotlin.diagnostics.DiagnosticFactory0
-dontwarn org.jetbrains.kotlin.diagnostics.DiagnosticFactory1
-dontwarn org.jetbrains.kotlin.diagnostics.DiagnosticFactory2
-dontwarn org.jetbrains.kotlin.diagnostics.DiagnosticFactory3
-dontwarn org.jetbrains.kotlin.diagnostics.Errors$Initializer
-dontwarn org.jetbrains.kotlin.diagnostics.PositioningStrategies
-dontwarn org.jetbrains.kotlin.diagnostics.PositioningStrategy
-dontwarn org.jetbrains.kotlin.diagnostics.Severity
-dontwarn org.jetbrains.kotlin.diagnostics.rendering.CommonRenderers
-dontwarn org.jetbrains.kotlin.diagnostics.rendering.ContextIndependentParameterRenderer
-dontwarn org.jetbrains.kotlin.diagnostics.rendering.DefaultErrorMessages$Extension
-dontwarn org.jetbrains.kotlin.diagnostics.rendering.DiagnosticFactoryToRendererMap
-dontwarn org.jetbrains.kotlin.diagnostics.rendering.DiagnosticParameterRenderer
-dontwarn org.jetbrains.kotlin.diagnostics.rendering.Renderers
-dontwarn org.jetbrains.kotlin.diagnostics.rendering.SmartDescriptorRenderer
-dontwarn org.jetbrains.kotlin.diagnostics.rendering.SmartTypeRenderer

-dontwarn javax.naming.InvalidNameException
-dontwarn javax.naming.NamingException
-dontwarn javax.naming.directory.Attribute
-dontwarn javax.naming.directory.Attributes
-dontwarn javax.naming.ldap.LdapName
-dontwarn javax.naming.ldap.Rdn
-dontwarn org.ietf.jgss.GSSContext
-dontwarn org.ietf.jgss.GSSCredential
-dontwarn org.ietf.jgss.GSSException
-dontwarn org.ietf.jgss.GSSManager
-dontwarn org.ietf.jgss.GSSName
-dontwarn org.ietf.jgss.Oid

# Retrofit does reflection on generic parameters. InnerClasses is required to use Signature and
# EnclosingMethod is required to use InnerClasses.
-keepattributes Signature, InnerClasses, EnclosingMethod

# Retrofit does reflection on method and parameter annotations.
-keepattributes RuntimeVisibleAnnotations, RuntimeVisibleParameterAnnotations

# Keep annotation default values (e.g., retrofit2.http.Field.encoded).
-keepattributes AnnotationDefault

# Retain service method parameters when optimizing.
-keepclassmembers,allowshrinking,allowobfuscation interface * {
@retrofit2.http.* <methods>;
}

# Ignore annotation used for build tooling.
-dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement

# Ignore JSR 305 annotations for embedding nullability information.
-dontwarn javax.annotation.**

# Guarded by a NoClassDefFoundError try/catch and only used when on the classpath.
-dontwarn kotlin.Unit

# Top-level functions that can only be used by Kotlin.
-dontwarn retrofit2.KotlinExtensions
-dontwarn retrofit2.KotlinExtensions$*

# With R8 full mode, it sees no subtypes of Retrofit interfaces since they are created with a Proxy
# and replaces all potential values with null. Explicitly keeping the interfaces prevents this.
-if interface * { @retrofit2.http.* <methods>; }
-keep,allowobfuscation interface <1>

# Keep inherited services.
-if interface * { @retrofit2.http.* <methods>; }
-keep,allowobfuscation interface * extends <1>

# With R8 full mode generic signatures are stripped for classes that are not
# kept. Suspend functions are wrapped in continuations where the type argument
# is used.
-keep,allowobfuscation,allowshrinking class kotlin.coroutines.Continuation

# R8 full mode strips generic signatures from return types if not kept.
-if interface * { @retrofit2.http.* public *** *(...); }
-keep,allowoptimization,allowshrinking,allowobfuscation class <3>

# With R8 full mode generic signatures are stripped for classes that are not kept.
-keep,allowobfuscation,allowshrinking class retrofit2.Response

# Gson uses generic type information stored in a class file when working with fields. Proguard
# removes such information by default, so configure it to keep all of it.
-keepattributes Signature

# For using GSON @Expose annotation
-keepattributes *Annotation*

# Gson specific classes
-dontwarn sun.misc.**
#-keep class com.google.gson.stream.** { *; }

# Application classes that will be serialized/deserialized over Gson
-keep class com.google.gson.examples.android.model.** { <fields>; }

# Prevent proguard from stripping interface information from TypeAdapter, TypeAdapterFactory,
# JsonSerializer, JsonDeserializer instances (so they can be used in @JsonAdapter)
-keep class * extends com.google.gson.TypeAdapter
-keep class * implements com.google.gson.TypeAdapterFactory
-keep class * implements com.google.gson.JsonSerializer
-keep class * implements com.google.gson.JsonDeserializer

# Prevent R8 from leaving Data object members always null
-keepclassmembers,allowobfuscation class * {
@com.google.gson.annotations.SerializedName <fields>;
}

# 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>;
}
5 changes: 3 additions & 2 deletions app/src/main/java/jp/co/soramitsu/app/App.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import com.walletconnect.android.relay.ConnectionType
import com.walletconnect.web3.wallet.client.Wallet
import com.walletconnect.web3.wallet.client.Web3Wallet
import dagger.hilt.android.HiltAndroidApp
import jp.co.soramitsu.common.BuildConfig
import jp.co.soramitsu.common.data.network.OptionsProvider
import jp.co.soramitsu.common.resources.ContextManager
import jp.co.soramitsu.common.resources.LanguagesHolder
Expand All @@ -32,7 +33,7 @@ open class App : Application() {
override fun onCreate() {
super.onCreate()

OptionsProvider.APPLICATION_ID = BuildConfig.APPLICATION_ID
OptionsProvider.APPLICATION_ID = BuildConfig.LIBRARY_PACKAGE_NAME
OptionsProvider.CURRENT_VERSION_CODE = BuildConfig.VERSION_CODE
OptionsProvider.CURRENT_VERSION_NAME = BuildConfig.VERSION_NAME
OptionsProvider.CURRENT_BUILD_TYPE = BuildConfig.BUILD_TYPE
Expand All @@ -42,7 +43,7 @@ open class App : Application() {

private fun setupWalletConnect() {
val connectionType = ConnectionType.AUTOMATIC // ConnectionType.AUTOMATIC or ConnectionType.MANUAL
val projectId = jp.co.soramitsu.common.BuildConfig.WALLET_CONNECT_PROJECT_ID // Project ID at https://cloud.walletconnect.com/
val projectId = BuildConfig.WALLET_CONNECT_PROJECT_ID // Project ID at https://cloud.walletconnect.com/
val relayUrl = "relay.walletconnect.com"
val serverUrl = "wss://$relayUrl?projectId=${projectId}"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import javax.inject.Singleton
import jp.co.soramitsu.account.impl.presentation.AccountRouter
import jp.co.soramitsu.app.root.navigation.Navigator
import jp.co.soramitsu.crowdloan.impl.presentation.CrowdloanRouter
import jp.co.soramitsu.nft.navigation.NFTRouter
import jp.co.soramitsu.onboarding.impl.OnboardingRouter
import jp.co.soramitsu.polkaswap.api.presentation.PolkaswapRouter
import jp.co.soramitsu.soracard.api.presentation.SoraCardRouter
Expand Down Expand Up @@ -64,4 +65,8 @@ class NavigationModule {
@Singleton
@Provides
fun provideWalletConnectRouter(navigator: Navigator): WalletConnectRouter = navigator

@Singleton
@Provides
fun provideNFTRouter(navigator: Navigator): NFTRouter = navigator
}
26 changes: 15 additions & 11 deletions app/src/main/java/jp/co/soramitsu/app/root/domain/RootInteractor.kt
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@ import jp.co.soramitsu.core.updater.UpdateSystem
import jp.co.soramitsu.core.updater.Updater
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.flowOf
import kotlinx.coroutines.withContext

class RootInteractor(
private val updateSystem: UpdateSystem,
Expand All @@ -35,20 +37,22 @@ class RootInteractor(
}

suspend fun getRemoteConfig(): Result<AppConfig> {
val remoteVersion = walletRepository.getRemoteConfig()

return if (remoteVersion.isSuccess) {
preferences.appConfig = remoteVersion.requireValue()
remoteVersion
} else {
val localVersion = preferences.appConfig
Result.success(localVersion)
}.map { it.toDomain() }
return withContext(Dispatchers.Default) {
val remoteVersion = walletRepository.getRemoteConfig()

if (remoteVersion.isSuccess) {
preferences.appConfig = remoteVersion.requireValue()
remoteVersion
} else {
val localVersion = preferences.appConfig
Result.success(localVersion)
}.map { it.toDomain() }
}
}

fun chainRegistrySyncUp() = walletRepository.chainRegistrySyncUp()

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

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

0 comments on commit c00e08f

Please sign in to comment.