Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop' into SN-2813/cut-and-pa…
Browse files Browse the repository at this point in the history
…ste-problems-fix
  • Loading branch information
AmadeyKuspakov committed Sep 5, 2023
2 parents 865cfb7 + 4c0bce8 commit 317a73a
Show file tree
Hide file tree
Showing 93 changed files with 282 additions and 521 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import dagger.Provides
import dagger.hilt.InstallIn
import dagger.hilt.components.SingletonComponent
import javax.inject.Singleton
import jp.co.soramitsu.feature_assets_api.presentation.launcher.AssetsRouter
import jp.co.soramitsu.feature_assets_api.presentation.AssetsRouter
import jp.co.soramitsu.feature_main_api.launcher.MainRouter
import jp.co.soramitsu.feature_polkaswap_api.launcher.PolkaswapRouter
import jp.co.soramitsu.feature_referral_api.ReferralRouter
Expand Down
10 changes: 8 additions & 2 deletions app/src/main/java/jp/co/soramitsu/sora/navigation/Navigator.kt
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ import jp.co.soramitsu.common.presentation.compose.webview.title
import jp.co.soramitsu.common.presentation.compose.webview.url
import jp.co.soramitsu.common.util.BuildUtils
import jp.co.soramitsu.common.util.StringPair
import jp.co.soramitsu.feature_assets_api.presentation.launcher.AssetsRouter
import jp.co.soramitsu.feature_assets_api.presentation.AssetsRouter
import jp.co.soramitsu.feature_assets_impl.presentation.screens.assetdetails.AssetDetailsFragment
import jp.co.soramitsu.feature_assets_impl.presentation.screens.receiverequest.QRCodeFlowFragment
import jp.co.soramitsu.feature_assets_impl.presentation.screens.send.TransferAmountFragment
Expand All @@ -73,7 +73,13 @@ import jp.co.soramitsu.feature_sora_card_impl.presentation.get.card.GetSoraCardF
import jp.co.soramitsu.feature_wallet_api.launcher.WalletRouter
import jp.co.soramitsu.sora.R

class Navigator : MainRouter, WalletRouter, ReferralRouter, SelectNodeRouter, PolkaswapRouter, AssetsRouter {
class Navigator :
MainRouter,
WalletRouter,
ReferralRouter,
SelectNodeRouter,
PolkaswapRouter,
AssetsRouter {

private var navController: NavController? = null

Expand Down
1 change: 1 addition & 0 deletions common/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ android {

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation project(":android-foundation")
implementation project(":soracrypro")

implementation activityKtxDep
Expand Down
81 changes: 0 additions & 81 deletions common/src/main/java/jp/co/soramitsu/common/base/BaseFragment.kt

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,12 @@ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package jp.co.soramitsu.common.base

import android.annotation.SuppressLint
import android.os.Build
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.Toast
import androidx.activity.compose.BackHandler
import androidx.compose.animation.ExperimentalAnimationApi
import androidx.compose.foundation.ScrollState
Expand Down Expand Up @@ -70,6 +72,7 @@ import jp.co.soramitsu.common.presentation.compose.components.AlertDialogContent
import jp.co.soramitsu.common.presentation.compose.components.Toolbar
import jp.co.soramitsu.common.presentation.compose.theme.SoraAppTheme
import jp.co.soramitsu.common.presentation.viewmodel.BaseViewModel
import jp.co.soramitsu.common.util.BuildUtils
import jp.co.soramitsu.common.util.DebounceClickHandler
import jp.co.soramitsu.common.util.ext.safeCast
import jp.co.soramitsu.ui_core.theme.customColors
Expand All @@ -90,6 +93,15 @@ abstract class SoraBaseFragment<T : BaseViewModel> : Fragment() {
activity?.safeCast<BarsColorhandler>()?.setColor(backgroundColor())
}

override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
if (BuildUtils.sdkAtLeast(Build.VERSION_CODES.TIRAMISU).not()) {
viewModel.copiedToast.observe {
Toast.makeText(requireActivity(), R.string.common_copied, Toast.LENGTH_SHORT).show()
}
}
}

@SuppressLint("UnusedMaterialScaffoldPaddingParameter")
override fun onCreateView(
inflater: LayoutInflater,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

package jp.co.soramitsu.common.di.modules

import android.content.ClipboardManager
import android.content.Context
import android.graphics.Color
import android.os.Build
Expand All @@ -51,6 +52,7 @@ import java.security.SecureRandom
import java.util.Locale
import java.util.TimeZone
import javax.inject.Singleton
import jp.co.soramitsu.androidfoundation.phone.BasicClipboardManager
import jp.co.soramitsu.backup.BackupService
import jp.co.soramitsu.common.BuildConfig
import jp.co.soramitsu.common.account.AccountAvatarGenerator
Expand All @@ -69,7 +71,6 @@ import jp.co.soramitsu.common.inappupdate.InAppUpdateManager
import jp.co.soramitsu.common.interfaces.WithProgress
import jp.co.soramitsu.common.io.FileManager
import jp.co.soramitsu.common.io.FileManagerImpl
import jp.co.soramitsu.common.resourses.ClipboardManager
import jp.co.soramitsu.common.resourses.LanguagesHolder
import jp.co.soramitsu.common.resourses.ResourceManager
import jp.co.soramitsu.common.util.CryptoAssistant
Expand Down Expand Up @@ -293,8 +294,8 @@ class CommonModule {

@Provides
@Singleton
fun provideClipBoardManager(@ApplicationContext context: Context): ClipboardManager {
return ClipboardManager(context.getSystemService(Context.CLIPBOARD_SERVICE) as android.content.ClipboardManager)
fun provideClipBoardManager(@ApplicationContext context: Context): BasicClipboardManager {
return BasicClipboardManager(context.getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager)
}

@Provides
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ open class BaseViewModel : ViewModel() {
val errorFromResourceLiveData = SingleLiveEvent<Pair<Int, Int>>()
val alertDialogLiveData = SingleLiveEvent<Pair<String, String>>()
val snackBarLiveData = SingleLiveEvent<SnackBarState>()
val copiedToast = SingleLiveEvent<Unit>()

protected val _toolbarState = MutableLiveData<SoramitsuToolbarState>()
val toolbarState: LiveData<SoramitsuToolbarState> = _toolbarState
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ import jp.co.soramitsu.common_wallet.data.AssetLocalToAssetMapper
import jp.co.soramitsu.core_db.AppDatabase
import jp.co.soramitsu.demeter.domain.DemeterFarmingPool
import jp.co.soramitsu.feature_blockexplorer_api.data.SoraConfigManager
import jp.co.soramitsu.shared_utils.extensions.toHexString
import jp.co.soramitsu.shared_utils.runtime.definitions.types.composite.Struct
import jp.co.soramitsu.shared_utils.runtime.definitions.types.fromHex
import jp.co.soramitsu.shared_utils.runtime.metadata.module
Expand All @@ -50,6 +49,7 @@ import jp.co.soramitsu.shared_utils.ss58.SS58Encoder.toAccountId
import jp.co.soramitsu.sora.substrate.runtime.Pallete
import jp.co.soramitsu.sora.substrate.runtime.RuntimeManager
import jp.co.soramitsu.sora.substrate.runtime.Storage
import jp.co.soramitsu.sora.substrate.runtime.mapToToken
import jp.co.soramitsu.sora.substrate.substrate.SubstrateCalls

interface DemeterFarmingRepository {
Expand Down Expand Up @@ -123,18 +123,9 @@ internal class DemeterFarmingRepositoryImpl(
?.safeCast<List<*>>()
?.filterIsInstance<Struct.Instance>()
?.mapNotNull { instance ->
val baseToken = instance.get<Struct.Instance>("baseAsset")
?.get<List<*>>("code")?.map {
(it as BigInteger).toByte()
}?.toByteArray()?.toHexString(true)
val poolToken = instance.get<Struct.Instance>("poolAsset")
?.get<List<*>>("code")?.map {
(it as BigInteger).toByte()
}?.toByteArray()?.toHexString(true)
val rewardToken = instance.get<Struct.Instance>("rewardAsset")
?.get<List<*>>("code")?.map {
(it as BigInteger).toByte()
}?.toByteArray()?.toHexString(true)
val baseToken = instance.mapToToken("baseAsset")
val poolToken = instance.mapToToken("poolAsset")
val rewardToken = instance.mapToToken("rewardAsset")
val isFarm = instance.get<Boolean>("isFarm")
val pooled = instance.get<BigInteger>("pooledTokens")
if (isFarm != null && baseToken != null && poolToken != null && rewardToken != null && pooled != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

package jp.co.soramitsu.feature_assets_api.data.interfaces
package jp.co.soramitsu.feature_assets_api.data

import java.math.BigDecimal
import jp.co.soramitsu.common.account.SoraAccount
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

package jp.co.soramitsu.feature_assets_api.domain.interfaces
package jp.co.soramitsu.feature_assets_api.domain

import java.math.BigDecimal
import jp.co.soramitsu.common.account.SoraAccount
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

package jp.co.soramitsu.feature_assets_api.domain.interfaces
package jp.co.soramitsu.feature_assets_api.domain

interface QrCodeInteractor {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

package jp.co.soramitsu.feature_assets_api.presentation.launcher
package jp.co.soramitsu.feature_assets_api.presentation

interface AssetsRouter {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ import jp.co.soramitsu.core_db.AppDatabase
import jp.co.soramitsu.core_db.model.AssetLocal
import jp.co.soramitsu.core_db.model.AssetTokenWithFiatLocal
import jp.co.soramitsu.core_db.model.TokenLocal
import jp.co.soramitsu.feature_assets_api.data.interfaces.AssetsRepository
import jp.co.soramitsu.feature_assets_api.data.AssetsRepository
import jp.co.soramitsu.feature_blockexplorer_api.data.SoraConfigManager
import jp.co.soramitsu.shared_utils.encrypt.keypair.substrate.Sr25519Keypair
import jp.co.soramitsu.sora.substrate.models.ExtrinsicSubmitStatus
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ import javax.inject.Singleton
import jp.co.soramitsu.common.domain.CoroutineManager
import jp.co.soramitsu.feature_account_api.domain.interfaces.CredentialsRepository
import jp.co.soramitsu.feature_account_api.domain.interfaces.UserRepository
import jp.co.soramitsu.feature_assets_api.data.interfaces.AssetsRepository
import jp.co.soramitsu.feature_assets_api.domain.interfaces.AssetsInteractor
import jp.co.soramitsu.feature_assets_api.domain.interfaces.QrCodeInteractor
import jp.co.soramitsu.feature_assets_api.data.AssetsRepository
import jp.co.soramitsu.feature_assets_api.domain.AssetsInteractor
import jp.co.soramitsu.feature_assets_api.domain.QrCodeInteractor
import jp.co.soramitsu.feature_assets_impl.data.AssetsRepositoryImpl
import jp.co.soramitsu.feature_assets_impl.domain.AssetsInteractorImpl
import jp.co.soramitsu.feature_assets_impl.domain.QrCodeInteractorImpl
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ import jp.co.soramitsu.common.util.ext.orZero
import jp.co.soramitsu.common_wallet.data.XorAssetBalance
import jp.co.soramitsu.feature_account_api.domain.interfaces.CredentialsRepository
import jp.co.soramitsu.feature_account_api.domain.interfaces.UserRepository
import jp.co.soramitsu.feature_assets_api.data.interfaces.AssetsRepository
import jp.co.soramitsu.feature_assets_api.domain.interfaces.AssetsInteractor
import jp.co.soramitsu.feature_assets_api.data.AssetsRepository
import jp.co.soramitsu.feature_assets_api.domain.AssetsInteractor
import jp.co.soramitsu.feature_blockexplorer_api.data.TransactionHistoryRepository
import jp.co.soramitsu.feature_blockexplorer_api.presentation.txhistory.TransactionBuilder
import jp.co.soramitsu.feature_blockexplorer_api.presentation.txhistory.TransactionStatus
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ import javax.inject.Inject
import jp.co.soramitsu.common.domain.OptionsProvider
import jp.co.soramitsu.common_wallet.domain.model.QrException
import jp.co.soramitsu.feature_account_api.domain.interfaces.UserRepository
import jp.co.soramitsu.feature_assets_api.data.interfaces.AssetsRepository
import jp.co.soramitsu.feature_assets_api.domain.interfaces.QrCodeInteractor
import jp.co.soramitsu.feature_assets_api.data.AssetsRepository
import jp.co.soramitsu.feature_assets_api.domain.QrCodeInteractor
import jp.co.soramitsu.sora.substrate.runtime.RuntimeManager
import jp.co.soramitsu.sora.substrate.runtime.SubstrateOptionsProvider

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ package jp.co.soramitsu.feature_assets_impl.presentation.screens.assetdetails

import android.os.Bundle
import android.view.View
import android.widget.Toast
import androidx.compose.animation.ExperimentalAnimationApi
import androidx.compose.foundation.ScrollState
import androidx.compose.foundation.layout.Box
Expand All @@ -56,7 +55,6 @@ import androidx.navigation.NavHostController
import com.google.accompanist.navigation.animation.composable
import dagger.hilt.android.AndroidEntryPoint
import javax.inject.Inject
import jp.co.soramitsu.common.R
import jp.co.soramitsu.common.base.SoraBaseFragment
import jp.co.soramitsu.common.base.theOnlyRoute
import jp.co.soramitsu.common.domain.BottomBarController
Expand Down Expand Up @@ -174,11 +172,7 @@ class AssetDetailsFragment : SoraBaseFragment<AssetDetailsViewModel>() {
}

override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
(activity as BottomBarController).hideBottomBar()
viewModel.copyEvent.observe {
Toast.makeText(requireActivity(), R.string.common_copied, Toast.LENGTH_SHORT).show()
}

super.onViewCreated(view, savedInstanceState)
(activity as BottomBarController).hideBottomBar()
}
}
Loading

0 comments on commit 317a73a

Please sign in to comment.