diff --git a/app/build.gradle b/app/build.gradle index 3f12b8e345..105d4d8323 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -6,13 +6,13 @@ apply plugin: 'com.google.firebase.crashlytics' apply from: '../dependencies.gradle' android { - compileSdkVersion 31 + compileSdkVersion 32 defaultConfig { applicationId "com.tangem.wallet" versionCode project.hasProperty('versionCode') ? project.property('versionCode') as int : 1 versionName project.hasProperty('versionName') ? project.property('versionName') : "1.0.0.-SNAPSHOT" minSdkVersion 21 - targetSdkVersion 31 + targetSdkVersion 32 testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" buildConfigField 'Boolean', environmentConfig.testActionEnabled, 'false' @@ -83,12 +83,11 @@ dependencies { implementation implementation(project(path: ':network')) implementation implementation(project(path: ':common')) - implementation 'androidx.core:core-ktx:1.7.0' + implementation 'androidx.core:core-ktx:1.8.0' implementation 'androidx.appcompat:appcompat:1.4.1' implementation 'androidx.fragment:fragment-ktx:1.4.1' implementation 'androidx.constraintlayout:constraintlayout:2.1.3' implementation 'com.google.android.material:material:1.5.0' - implementation "androidx.core:core-ktx:1.7.0" implementation 'com.google.android.play:core:1.10.3' implementation 'com.google.android.play:core-ktx:1.8.1' coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.5' @@ -164,14 +163,14 @@ dependencies { implementation 'com.google.android.gms:play-services-wallet:19.1.0' //Compose - implementation 'androidx.activity:activity-compose:1.4.0' + implementation 'androidx.activity:activity-compose:1.5.0' implementation 'androidx.compose.material:material:1.1.1' implementation 'androidx.compose.animation:animation:1.1.1' - implementation 'androidx.compose.foundation:foundation:1.1.1' - implementation 'androidx.compose.foundation:foundation-layout:1.1.1' + implementation 'androidx.compose.foundation:foundation:1.2.0-rc03' implementation 'androidx.compose.ui:ui:1.1.1' implementation 'androidx.compose.ui:ui-tooling:1.1.1' implementation "com.google.accompanist:accompanist-appcompat-theme:0.23.0" + implementation "com.google.accompanist:accompanist-systemuicontroller:0.23.0" implementation "com.github.skydoves:androidveil:1.1.2" diff --git a/app/src/main/java/com/tangem/tap/MainActivity.kt b/app/src/main/java/com/tangem/tap/MainActivity.kt index 7593f303e7..78d55638ca 100644 --- a/app/src/main/java/com/tangem/tap/MainActivity.kt +++ b/app/src/main/java/com/tangem/tap/MainActivity.kt @@ -5,6 +5,8 @@ import android.content.pm.ActivityInfo import android.os.Bundle import android.view.View import androidx.appcompat.app.AppCompatActivity +import androidx.core.view.WindowCompat +import androidx.core.view.WindowInsetsControllerCompat import by.kirich1409.viewbindingdelegate.viewBinding import com.google.android.material.snackbar.Snackbar import com.tangem.TangemSdk @@ -27,11 +29,11 @@ import com.tangem.tap.features.details.redux.walletconnect.WalletConnectAction import com.tangem.tap.features.shop.redux.ShopAction import com.tangem.wallet.R import com.tangem.wallet.databinding.ActivityMainBinding -import java.lang.ref.WeakReference -import kotlin.coroutines.CoroutineContext import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Job +import java.lang.ref.WeakReference +import kotlin.coroutines.CoroutineContext lateinit var tangemSdk: TangemSdk lateinit var tangemSdkManager: TangemSdkManager @@ -83,8 +85,10 @@ class MainActivity : AppCompatActivity(), SnackbarHandler { } private fun systemActions() { - // makes the status bar text dark - window.decorView.systemUiVisibility = View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR + WindowCompat.setDecorFitsSystemWindows(window, false) + WindowInsetsControllerCompat(window, binding.root) + .isAppearanceLightStatusBars = true + requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT } diff --git a/app/src/main/java/com/tangem/tap/domain/termsOfUse/CardTou.kt b/app/src/main/java/com/tangem/tap/domain/termsOfUse/CardTou.kt index 032c0b97ca..f05065bc8d 100644 --- a/app/src/main/java/com/tangem/tap/domain/termsOfUse/CardTou.kt +++ b/app/src/main/java/com/tangem/tap/domain/termsOfUse/CardTou.kt @@ -4,16 +4,17 @@ import android.content.res.Resources import android.net.Uri import androidx.core.os.ConfigurationCompat import com.tangem.common.card.Card -import java.util.* +import java.util.Locale /** [REDACTED_AUTHOR] */ class CardTou { - private val locale: Locale = ConfigurationCompat.getLocales(Resources.getSystem().configuration).get(0) + private val locale: Locale = + ConfigurationCompat.getLocales(Resources.getSystem().configuration).get(0)!! fun getUrl(card: Card): Uri? { - val issuerName = card.issuer.name ?: return null + val issuerName = card.issuer.name if (issuerName.lowercase(Locale.getDefault()) != "start2coin") return null val baseUrl = "https://app.tangem.com/tou/" diff --git a/app/src/main/java/com/tangem/tap/features/home/HomeFragment.kt b/app/src/main/java/com/tangem/tap/features/home/HomeFragment.kt index c453cdadc4..f1b3fa3f55 100644 --- a/app/src/main/java/com/tangem/tap/features/home/HomeFragment.kt +++ b/app/src/main/java/com/tangem/tap/features/home/HomeFragment.kt @@ -1,10 +1,14 @@ package com.tangem.tap.features.home import android.os.Bundle +import android.view.LayoutInflater import android.view.View +import android.view.ViewGroup +import androidx.compose.runtime.Composable import androidx.compose.runtime.MutableState import androidx.compose.runtime.mutableStateOf import androidx.compose.ui.platform.ComposeView +import androidx.core.view.WindowInsetsControllerCompat import androidx.fragment.app.Fragment import com.google.accompanist.appcompattheme.AppCompatTheme import com.tangem.tap.common.redux.navigation.AppScreen @@ -15,48 +19,36 @@ import com.tangem.tap.features.home.redux.HomeState import com.tangem.tap.features.onboarding.products.wallet.redux.BackupAction import com.tangem.tap.features.tokens.redux.TokensAction import com.tangem.tap.store -import com.tangem.wallet.R import org.rekotlin.StoreSubscriber -class HomeFragment : Fragment(R.layout.fragment_home), StoreSubscriber { +class HomeFragment : Fragment(), StoreSubscriber { - var homeState: MutableState = mutableStateOf(store.state.homeState) + private var homeState: MutableState = mutableStateOf(store.state.homeState) + private var composeView: ComposeView? = null override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) store.dispatch(HomeAction.Init) } - override fun onViewCreated(view: View, savedInstanceState: Bundle?) { - super.onViewCreated(view, savedInstanceState) + override fun onCreateView( + inflater: LayoutInflater, + container: ViewGroup?, + savedInstanceState: Bundle?, + ): View? { + val context = container?.context ?: return null store.dispatch(BackupAction.CheckForUnfinishedBackup) - - - getView()?.findViewById(R.id.cv_stories)?.setContent { - AppCompatTheme { - StoriesScreen( - homeState, - onScanButtonClick = { store.dispatch(HomeAction.ReadCard) }, - onShopButtonClick = { - store.dispatch(HomeAction.GoToShop(store.state.globalState.userCountryCode)) - }, - onSearchTokensClick = { - store.dispatch(NavigationAction.NavigateTo(AppScreen.AddTokens)) - store.dispatch(TokensAction.AllowToAddTokens(false)) - store.dispatch(TokensAction.LoadCurrencies()) - } - ) + composeView = ComposeView(context).apply { + setContent { + AppCompatTheme { + ScreenContent() + } } } - } - private fun getRegionProvider(): RegionProvider = RegionService( - listOf( -// TelephonyManagerRegionProvider(requireContext()), - LocaleRegionProvider() - ) - ) + return composeView + } override fun onStart() { super.onStart() @@ -72,6 +64,11 @@ class HomeFragment : Fragment(R.layout.fragment_home), StoreSubscriber - - - + + + diff --git a/app/src/main/res/layout/fragment_home.xml b/app/src/main/res/layout/fragment_home.xml deleted file mode 100644 index 7a95116cd8..0000000000 --- a/app/src/main/res/layout/fragment_home.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index f36d1cd4bf..09cdff0b35 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -5,10 +5,6 @@ @color/colorPrimary @color/colorSecondary @color/darkGray6 - true - true - true - @null @color/menu_accent_color @style/Widget.AppTheme.CardView