Skip to content

Commit

Permalink
mwr-651
Browse files Browse the repository at this point in the history
  • Loading branch information
arvifox committed Sep 29, 2023
1 parent f5ca00c commit 77f58d0
Show file tree
Hide file tree
Showing 99 changed files with 1,070 additions and 914 deletions.
115 changes: 115 additions & 0 deletions app/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,121 @@
#Firebase Crashlytics
-keep,includedescriptorclasses public class * extends java.lang.Exception

###########
-keep public class * extends jp.co.soramitsu.common.util.ParseModel {
<fields>;
<methods>;
}

# This is generated automatically by the Android Gradle plugin.
-dontwarn build.IgnoreJava8API
-dontwarn java.awt.Component
-dontwarn java.awt.GraphicsEnvironment
-dontwarn java.awt.HeadlessException
-dontwarn java.awt.Window
-dontwarn java.beans.ConstructorProperties
-dontwarn java.beans.Transient
-dontwarn java.lang.management.ManagementFactory
-dontwarn java.lang.management.RuntimeMXBean
-dontwarn java.lang.management.ThreadMXBean
-dontwarn javax.servlet.ServletContextListener
-dontwarn lombok.NonNull
-dontwarn org.apache.avalon.framework.logger.Logger
-dontwarn org.apache.log.Hierarchy
-dontwarn org.apache.log.Logger
-dontwarn org.apache.log4j.Level
-dontwarn org.apache.log4j.Logger
-dontwarn org.apache.log4j.Priority
-dontwarn org.apache.xml.resolver.Catalog
-dontwarn org.apache.xml.resolver.CatalogManager
-dontwarn org.apache.xml.resolver.readers.CatalogReader
-dontwarn org.apache.xml.resolver.readers.SAXCatalogReader
-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
-dontwarn org.slf4j.impl.StaticLoggerBinder
-dontwarn org.slf4j.impl.StaticMDCBinder
-dontwarn org.slf4j.impl.StaticMarkerBinder
-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.MouseEvent
-dontwarn org.w3c.dom.events.MutationEvent
-dontwarn org.w3c.dom.events.UIEvent
-dontwarn org.w3c.dom.html.HTMLAnchorElement
-dontwarn org.w3c.dom.html.HTMLAppletElement
-dontwarn org.w3c.dom.html.HTMLAreaElement
-dontwarn org.w3c.dom.html.HTMLBRElement
-dontwarn org.w3c.dom.html.HTMLBaseElement
-dontwarn org.w3c.dom.html.HTMLBaseFontElement
-dontwarn org.w3c.dom.html.HTMLBodyElement
-dontwarn org.w3c.dom.html.HTMLButtonElement
-dontwarn org.w3c.dom.html.HTMLCollection
-dontwarn org.w3c.dom.html.HTMLDListElement
-dontwarn org.w3c.dom.html.HTMLDirectoryElement
-dontwarn org.w3c.dom.html.HTMLDivElement
-dontwarn org.w3c.dom.html.HTMLDocument
-dontwarn org.w3c.dom.html.HTMLElement
-dontwarn org.w3c.dom.html.HTMLFieldSetElement
-dontwarn org.w3c.dom.html.HTMLFontElement
-dontwarn org.w3c.dom.html.HTMLFormElement
-dontwarn org.w3c.dom.html.HTMLFrameElement
-dontwarn org.w3c.dom.html.HTMLFrameSetElement
-dontwarn org.w3c.dom.html.HTMLHRElement
-dontwarn org.w3c.dom.html.HTMLHeadElement
-dontwarn org.w3c.dom.html.HTMLHeadingElement
-dontwarn org.w3c.dom.html.HTMLHtmlElement
-dontwarn org.w3c.dom.html.HTMLIFrameElement
-dontwarn org.w3c.dom.html.HTMLImageElement
-dontwarn org.w3c.dom.html.HTMLInputElement
-dontwarn org.w3c.dom.html.HTMLIsIndexElement
-dontwarn org.w3c.dom.html.HTMLLIElement
-dontwarn org.w3c.dom.html.HTMLLabelElement
-dontwarn org.w3c.dom.html.HTMLLegendElement
-dontwarn org.w3c.dom.html.HTMLLinkElement
-dontwarn org.w3c.dom.html.HTMLMapElement
-dontwarn org.w3c.dom.html.HTMLMenuElement
-dontwarn org.w3c.dom.html.HTMLMetaElement
-dontwarn org.w3c.dom.html.HTMLModElement
-dontwarn org.w3c.dom.html.HTMLOListElement
-dontwarn org.w3c.dom.html.HTMLObjectElement
-dontwarn org.w3c.dom.html.HTMLOptGroupElement
-dontwarn org.w3c.dom.html.HTMLOptionElement
-dontwarn org.w3c.dom.html.HTMLParagraphElement
-dontwarn org.w3c.dom.html.HTMLParamElement
-dontwarn org.w3c.dom.html.HTMLPreElement
-dontwarn org.w3c.dom.html.HTMLQuoteElement
-dontwarn org.w3c.dom.html.HTMLScriptElement
-dontwarn org.w3c.dom.html.HTMLSelectElement
-dontwarn org.w3c.dom.html.HTMLStyleElement
-dontwarn org.w3c.dom.html.HTMLTableCaptionElement
-dontwarn org.w3c.dom.html.HTMLTableCellElement
-dontwarn org.w3c.dom.html.HTMLTableColElement
-dontwarn org.w3c.dom.html.HTMLTableElement
-dontwarn org.w3c.dom.html.HTMLTableRowElement
-dontwarn org.w3c.dom.html.HTMLTableSectionElement
-dontwarn org.w3c.dom.html.HTMLTextAreaElement
-dontwarn org.w3c.dom.html.HTMLTitleElement
-dontwarn org.w3c.dom.html.HTMLUListElement
-dontwarn org.w3c.dom.ls.LSSerializerFilter
-dontwarn org.w3c.dom.ranges.DocumentRange
-dontwarn org.w3c.dom.ranges.Range
-dontwarn org.w3c.dom.ranges.RangeException
-dontwarn org.w3c.dom.traversal.DocumentTraversal
-dontwarn org.w3c.dom.traversal.NodeFilter
-dontwarn org.w3c.dom.traversal.NodeIterator
-dontwarn org.w3c.dom.traversal.TreeWalker
-dontwarn org.web3j.abi.datatypes.generated.AbiTypes
-dontwarn org.webrtc.Dav1dDecoder
-dontwarn sun.security.x509.X509Key

-dontwarn java.lang.invoke.StringConcatFactory

# Gson
-keep,allowobfuscation,allowoptimization class * {
@com.google.gson.annotations.SerializedName <fields>;
Expand Down
12 changes: 5 additions & 7 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ buildscript {
composeMaterial : '1.4.3',
composeCompiler : '1.5.3',
composeConstraintLayout: '1.1.0-alpha05',
uiCore : '0.2.0',
uiCore : '0.2.5',
soraCard : '0.1.45',
lazySodium : '5.0.2',
jna : '5.8.0',
Expand Down Expand Up @@ -90,9 +90,6 @@ buildscript {
daggerDep = "com.google.dagger:hilt-android:$versions.dagger"
daggerKaptDep = "com.google.dagger:hilt-compiler:$versions.dagger"
hiltUiTestDep = "com.google.dagger:hilt-android-testing:$versions.dagger"
hiltUiTestKaptDep = "com.google.dagger:hilt-compiler:$versions.dagger"
hiltUnitTestDep = "com.google.dagger:hilt-android-testing:$versions.dagger"
hiltUnitTestKaptDep = "com.google.dagger:hilt-compiler:$versions.dagger"
hiltNavComposeDep = "androidx.hilt:hilt-navigation-compose:$versions.hiltCompose"
hiltWorkManagerDep = "androidx.hilt:hilt-work:$versions.hiltWorkManager"
hiltWorkManagerKaptDep = "androidx.hilt:hilt-compiler:$versions.hiltWorkManager"
Expand Down Expand Up @@ -154,10 +151,10 @@ buildscript {

jUnitDep = "junit:junit:$versions.jUnit"
mockitoDep = "org.mockito:mockito-inline:$versions.mockito"
mockitoKotlinDep = "org.mockito.kotlin:mockito-kotlin:4.1.0"
mockitoKotlinDep = "org.mockito.kotlin:mockito-kotlin:5.1.0"

// https://github.com/mockk/mockk/issues/243
mockkDep = "io.mockk:mockk:1.13.5"
mockkDep = "io.mockk:mockk:1.13.8"

// powerMockDep = "org.powermock:powermock-module-junit4:2.0.2"
// powerMockMockitoDep = "org.powermock:powermock-api-mockito2:2.0.2"
Expand Down Expand Up @@ -221,7 +218,7 @@ buildscript {
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${versions.kotlin}"
classpath "org.jetbrains.kotlin:kotlin-serialization:${versions.kotlin}"
classpath 'com.android.tools.build:gradle:8.2.0-beta05'
classpath 'com.android.tools.build:gradle:8.2.0-beta06'
classpath 'com.google.gms:google-services:4.3.15'
classpath 'com.google.firebase:firebase-appdistribution-gradle:3.2.0'
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.9.4'
Expand All @@ -232,6 +229,7 @@ buildscript {

plugins {
id "org.sonarqube" version "2.7"
id 'com.google.devtools.ksp' version '1.9.10-1.0.13' apply false
}

apply from: 'secrets.gradle'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.Toast
import androidx.activity.compose.BackHandler
import androidx.activity.addCallback
import androidx.compose.animation.ExperimentalAnimationApi
import androidx.compose.foundation.ScrollState
import androidx.compose.foundation.layout.fillMaxSize
Expand Down Expand Up @@ -69,7 +69,7 @@ import androidx.navigation.compose.rememberNavController
import androidx.navigation.findNavController
import javax.inject.Inject
import jp.co.soramitsu.common.R
import jp.co.soramitsu.common.domain.BarsColorhandler
import jp.co.soramitsu.common.domain.BarsColorHandler
import jp.co.soramitsu.common.domain.DarkThemeManager
import jp.co.soramitsu.common.presentation.compose.components.AlertDialogContent
import jp.co.soramitsu.common.presentation.compose.components.Toolbar
Expand All @@ -94,9 +94,16 @@ abstract class SoraBaseFragment<T : BaseViewModel> : Fragment() {
@Inject
lateinit var darkThemeManager: DarkThemeManager

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
activity?.onBackPressedDispatcher?.addCallback(this) {
onBack()
}
}

override fun onResume() {
super.onResume()
activity?.safeCast<BarsColorhandler>()?.setColor(backgroundColor())
activity?.safeCast<BarsColorHandler>()?.setColor(backgroundColor())
}

override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
Expand Down Expand Up @@ -149,6 +156,19 @@ abstract class SoraBaseFragment<T : BaseViewModel> : Fragment() {
it.second.invoke(this)
}
}
viewModel.navToStart.observe {
with(navController) {
popBackStack(graph.startDestinationId, true)
graph.setStartDestination(it)
navigate(it)
}
// with(navController) {
// navigate(it) {
// popUpTo(graph.startDestinationId) {inclusive = true}
// }
// graph.setStartDestination(it)
// }
}
viewModel.errorLiveData.observe {
openAlertDialog.value = AlertDialogData(
title = R.string.common_error_general_title,
Expand Down Expand Up @@ -208,9 +228,6 @@ abstract class SoraBaseFragment<T : BaseViewModel> : Fragment() {
)
}
) { padding ->
BackHandler {
onBack()
}
NavHost(
modifier = Modifier
.padding(padding)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,11 @@ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

package jp.co.soramitsu.common.data.network.dto

import androidx.annotation.Keep
import java.math.BigInteger
import jp.co.soramitsu.common.util.ParseModel

@Keep
data class SwapFeeDto(
val amount: BigInteger,
val fee: BigInteger,
val route: List<String>? = null,
)
) : ParseModel()
7 changes: 3 additions & 4 deletions common/src/main/java/jp/co/soramitsu/common/domain/Asset.kt
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

package jp.co.soramitsu.common.domain

import android.net.Uri
import android.os.Parcelable
import java.math.BigDecimal
import jp.co.soramitsu.common.R
Expand Down Expand Up @@ -87,7 +86,7 @@ data class Token(
val symbol: String,
val precision: Int,
val isHidable: Boolean,
val iconFile: Uri?,
val iconFile: String?,
val fiatPrice: Double?,
val fiatPriceChange: Double?,
val fiatSymbol: String?,
Expand Down Expand Up @@ -136,12 +135,12 @@ fun List<Token>.getByIdOrEmpty(id: String): Token =
it.id == id
} ?: AssetHolder.emptyToken

fun Token.iconUri(): Uri = this.iconFile ?: DEFAULT_ICON_URI
fun Token.iconUri(): String = this.iconFile ?: DEFAULT_ICON_URI

fun Token.isMatchFilter(filter: String): Boolean =
name.lowercase().contains(filter.lowercase()) ||
symbol.lowercase().contains(filter.lowercase()) ||
id.lowercase().contains(filter.lowercase())

val DEFAULT_ICON: Int = R.drawable.ic_token_default
val DEFAULT_ICON_URI = Uri.parse("file:///android_asset/ic_token_default.png")
val DEFAULT_ICON_URI = "file:///android_asset/ic_token_default.png"
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ interface BottomBarController {
fun isBottomBarVisible(): Boolean
}

interface BarsColorhandler {
interface BarsColorHandler {

fun setColor(@AttrRes color: Int)
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

package jp.co.soramitsu.common.domain

import android.net.Uri
import javax.inject.Inject
import javax.inject.Singleton
import jp.co.soramitsu.common.io.FileManager
Expand Down Expand Up @@ -78,13 +77,14 @@ class WhitelistTokensManager @Inject constructor(
}
}

fun getTokenIconUri(tokenId: String): Uri {
fun getTokenIconUri(tokenId: String): String {
val type = curWhitelist.find { it.id == tokenId }?.type
return if (type == null) {
val u = if (type == null) {
DEFAULT_ICON_URI
} else {
fileManager.readInternalCacheFileAsUri("$tokenId.$type") ?: DEFAULT_ICON_URI
}
return u.toString()
}

suspend fun updateWhitelistStorage() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,8 @@ package jp.co.soramitsu.common.inappupdate
import android.app.Activity
import android.content.Context
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.LifecycleObserver
import androidx.lifecycle.LifecycleEventObserver
import androidx.lifecycle.LifecycleOwner
import androidx.lifecycle.OnLifecycleEvent
import com.google.android.play.core.appupdate.AppUpdateInfo
import com.google.android.play.core.appupdate.AppUpdateManagerFactory
import com.google.android.play.core.install.InstallStateUpdatedListener
Expand All @@ -54,7 +53,7 @@ import kotlin.coroutines.suspendCoroutine
class InAppUpdateManager(
context: Context,
private val soraPreferences: SoraPreferences
) : LifecycleObserver {
) : LifecycleEventObserver {

interface UpdateManagerListener : LifecycleOwner {
fun readyToShowFlexible(): Int?
Expand All @@ -74,6 +73,7 @@ class InAppUpdateManager(
InstallStatus.DOWNLOADED -> {
mainActivity?.askUserToInstall()
}

else -> {
}
}
Expand Down Expand Up @@ -127,6 +127,7 @@ class InAppUpdateManager(
)
}
}

AppUpdateType.IMMEDIATE -> {
soraPreferences.putLong(ARG_TIME, now)
googleUpdateManager.startUpdateFlowForResult(
Expand All @@ -136,6 +137,7 @@ class InAppUpdateManager(
1
)
}

else -> {
}
}
Expand Down Expand Up @@ -171,9 +173,10 @@ class InAppUpdateManager(
) == true
}

@OnLifecycleEvent(Lifecycle.Event.ON_STOP)
fun onStop() {
mainActivity?.lifecycle?.removeObserver(this)
mainActivity = null
override fun onStateChanged(source: LifecycleOwner, event: Lifecycle.Event) {
if (event == Lifecycle.Event.ON_STOP) {
mainActivity?.lifecycle?.removeObserver(this)
mainActivity = null
}
}
}
Loading

0 comments on commit 77f58d0

Please sign in to comment.